From 5d26d16fd36ae34a40ea94874f403ca47b3cc2d8 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 26 Oct 2011 12:48:57 +0000 Subject: [PATCH] Added password support into present3D's vnc support via the tag usage : hostname --- applications/present3D/present3D.cpp | 15 +++++++++++++++ include/osgPresentation/SlideShowConstructor | 2 +- src/osgPlugins/p3d/ReaderWriterP3D.cpp | 7 ++++++- src/osgPresentation/SlideShowConstructor.cpp | 9 ++++++++- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/applications/present3D/present3D.cpp b/applications/present3D/present3D.cpp index 02d71fb02..5cd4c819c 100644 --- a/applications/present3D/present3D.cpp +++ b/applications/present3D/present3D.cpp @@ -442,6 +442,21 @@ int main( int argc, char **argv ) osg::DisplaySettings::instance()->readEnvironmentalVariables(); } + // set up any logins required for http access + std::string url, username, password; + while(arguments.read("--login",url, username, password)) + { + if (!osgDB::Registry::instance()->getAuthenticationMap()) + { + osgDB::Registry::instance()->setAuthenticationMap(new osgDB::AuthenticationMap); + osgDB::Registry::instance()->getAuthenticationMap()->addAuthenticationDetails( + url, + new osgDB::AuthenticationDetails(username, password) + ); + } + } + + #ifdef USE_SDL SDLIntegration sdlIntegration; diff --git a/include/osgPresentation/SlideShowConstructor b/include/osgPresentation/SlideShowConstructor index 5fd82b52a..240eca070 100644 --- a/include/osgPresentation/SlideShowConstructor +++ b/include/osgPresentation/SlideShowConstructor @@ -394,7 +394,7 @@ public: void addStereoImagePair(const std::string& filenameLeft, const ImageData& imageDataLeft, const std::string& filenameRight,const ImageData& imageDataRight, const PositionData& positionData); void addGraph(const std::string& filename,const std::string& options,const PositionData& positionData, const ImageData& imageData); - void addVNC(const std::string& filename,const PositionData& positionData, const ImageData& imageData); + void addVNC(const std::string& filename,const PositionData& positionData, const ImageData& imageData, const std::string& password); void addBrowser(const std::string& filename,const PositionData& positionData, const ImageData& imageData); void addPDF(const std::string& filename,const PositionData& positionData, const ImageData& imageData); osg::Image* addInteractiveImage(const std::string& filename,const PositionData& positionData, const ImageData& imageData); diff --git a/src/osgPlugins/p3d/ReaderWriterP3D.cpp b/src/osgPlugins/p3d/ReaderWriterP3D.cpp index 412aad4f3..f4fb7e461 100644 --- a/src/osgPlugins/p3d/ReaderWriterP3D.cpp +++ b/src/osgPlugins/p3d/ReaderWriterP3D.cpp @@ -1313,9 +1313,14 @@ void ReaderWriterP3DXML::parseLayer(osgPresentation::SlideShowConstructor& const osgPresentation::SlideShowConstructor::ImageData imageData;// = constructor.getImageData(); getProperties(cur,imageData); + std::string password; + getProperty(cur, "password", password); + constructor.addVNC(cur->getTrimmedContents(), positionRead ? positionData : constructor.getImagePositionData(), - imageData); + imageData, + password + ); } else if (cur->name == "browser") { diff --git a/src/osgPresentation/SlideShowConstructor.cpp b/src/osgPresentation/SlideShowConstructor.cpp index 8cf519fb4..4e74be52b 100644 --- a/src/osgPresentation/SlideShowConstructor.cpp +++ b/src/osgPresentation/SlideShowConstructor.cpp @@ -1277,8 +1277,15 @@ void SlideShowConstructor::addGraph(const std::string& contents,const std::strin } -void SlideShowConstructor::addVNC(const std::string& hostname, const PositionData& positionData, const ImageData& imageData) +void SlideShowConstructor::addVNC(const std::string& hostname, const PositionData& positionData, const ImageData& imageData, const std::string& password) { + if (!password.empty()) + { + OSG_NOTICE<<"Setting password"<getAuthenticationMap()) osgDB::Registry::instance()->setAuthenticationMap(new osgDB::AuthenticationMap); + osgDB::Registry::instance()->getAuthenticationMap()->addAuthenticationDetails(hostname, new osgDB::AuthenticationDetails("", password)); + } + addInteractiveImage(hostname+".vnc", positionData, imageData); }