diff --git a/include/osgPresentation/SlideShowConstructor b/include/osgPresentation/SlideShowConstructor index 8b53aea2b..1673a9bb0 100644 --- a/include/osgPresentation/SlideShowConstructor +++ b/include/osgPresentation/SlideShowConstructor @@ -343,6 +343,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 addBrowser(const std::string& filename,const PositionData& positionData, const ImageData& imageData); void addPDF(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 4017f11ff..88feb9895 100644 --- a/src/osgPlugins/p3d/ReaderWriterP3D.cpp +++ b/src/osgPlugins/p3d/ReaderWriterP3D.cpp @@ -833,20 +833,20 @@ bool ReaderWriterP3DXML::getJumpProperties(osgDB::XmlNode*cur, bool& relativeJum if (getProperty(cur, "slide", slideNum)) { - osg::notify(osg::NOTICE)<<"slide "<get(); if (cur->name == "run") { - osg::notify(osg::INFO)<<"run ["<contents<<"]"<contents<<"]"<contents); } else if (cur->name == "jump") { - osg::notify(osg::NOTICE)<<"Parsed Jump "<contents<<"]"<contents<<"]"<contents,osgPresentation::RUN, relativeJump, slideNum, layerNum); } else if (cur->name == "click_to_load") @@ -1137,7 +1137,7 @@ void ReaderWriterP3DXML::parseLayer(osgPresentation::SlideShowConstructor& const int layerNum = 0; getJumpProperties(cur, relativeJump, slideNum, layerNum); - osg::notify(osg::INFO)<<"click_to_load ["<contents<<"]"<contents<<"]"<contents,osgPresentation::LOAD, relativeJump, slideNum, layerNum); } @@ -1150,7 +1150,7 @@ void ReaderWriterP3DXML::parseLayer(osgPresentation::SlideShowConstructor& const if (getKeyPositionInner( cur, keyPosition)) { - osg::notify(osg::INFO)<<"click_to_event ["<name == "bullet") { - osg::notify(osg::INFO)<<"bullet ["<contents<<"]"<contents<<"]"<name == "graph") + { + osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getImagePositionData(); + bool positionRead = getProperties(cur,positionData); + + osgPresentation::SlideShowConstructor::ImageData imageData;// = constructor.getImageData(); + getProperties(cur,imageData); + + std::string options; + getProperty(cur, "options", options); + + constructor.addGraph(cur->getTrimmedContents(), options, + positionRead ? positionData : constructor.getImagePositionData(), + imageData); + } else if (cur->name == "vnc") { osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getImagePositionData(); @@ -1287,7 +1302,7 @@ void ReaderWriterP3DXML::parseBullets(osgPresentation::SlideShowConstructor& con { constructor.addLayer(inheritPreviousLayers, defineAsBaseLayer); - osg::notify(osg::INFO)<<"bullets ["<contents<<"]"<contents<<"]"<contents<<"]"<contents<<"]"<getNumOfPages(); - osg::notify(osg::NOTICE)<<"NumOfPages = "<getDatabasePathList() : osgDB::getDataFilePathList(); @@ -1547,11 +1562,11 @@ struct MyFindFileCallback : public osgDB::FindFileCallback if (osgDB::containsServerAddress(path)) { osgDB::ReaderWriter* rw = osgDB::Registry::instance()->getReaderWriterForExtension("curl"); - osg::notify(osg::NOTICE)<<" file on server "<<*itr<<", try path "<getFileCache(); if (!fileCache) return osgDB::ReaderWriter::ReadResult::FILE_NOT_FOUND; - osg::notify(osg::NOTICE)<<"Trying fileCache "<isFileAppropriateForFileCache(filename)) @@ -1637,15 +1652,15 @@ class MyReadFileCallback : public virtual osgDB::ReadFileCallback if (result.success()) { - osg::notify(osg::INFO)<<" File read from FileCache."<createCacheFileName(filename)<createCacheFileName(filename)<getReaderWriterForExtension("curl"); @@ -1736,7 +1751,7 @@ class MyReadFileCallback : public virtual osgDB::ReadFileCallback if (result.success()) { - osg::notify(osg::INFO)<<" inserting object into file cache "<setPluginStringData("filename",newpath); @@ -1752,24 +1767,24 @@ class MyReadFileCallback : public virtual osgDB::ReadFileCallback if (!fileCache) fileCache = osgDB::Registry::instance()->getFileCache(); if (fileCache && !fileCache->isFileAppropriateForFileCache(filename)) fileCache = 0; - osg::notify(osg::NOTICE)<<"MyReadFileCallback::reading file "<second.valid()) { - osg::notify(osg::INFO)<<"File retrieved from cache, filename="< presentation_node; @@ -2035,7 +2050,7 @@ osg::Node* ReaderWriterP3DXML::parseXmlGraph(osgDB::XmlNode* root, bool readOnly if (cur->name=="env") { char* str = strdup(cur->contents.c_str()); - osg::notify(osg::INFO)<<"putenv("<name == "text-settings") @@ -2116,7 +2131,7 @@ osg::Node* ReaderWriterP3DXML::parseXmlGraph(osgDB::XmlNode* root, bool readOnly bool fontRead = getProperties(cur,constructor.getTextFontDataDefault()); if (fontRead) { - osg::notify(osg::INFO)<<"Text font details read"<name == "ratio") @@ -2127,7 +2142,7 @@ osg::Node* ReaderWriterP3DXML::parseXmlGraph(osgDB::XmlNode* root, bool readOnly }*/ else if (cur->name == "path") { - osg::notify(osg::INFO)<<"Appending search path "<contents<contents<contents)); } else if (cur->name == "bgcolor") diff --git a/src/osgPresentation/SlideShowConstructor.cpp b/src/osgPresentation/SlideShowConstructor.cpp index 005d1f61d..328ecf70f 100644 --- a/src/osgPresentation/SlideShowConstructor.cpp +++ b/src/osgPresentation/SlideShowConstructor.cpp @@ -1053,6 +1053,33 @@ void SlideShowConstructor::addStereoImagePair(const std::string& filenameLeft, c _currentLayer->addChild(subgraph); } +void SlideShowConstructor::addGraph(const std::string& filename,const std::string& options,const PositionData& positionData, const ImageData& imageData) +{ + std::string tmpDirectory("/tmp/"); + std::string tmpSvgFileName(tmpDirectory+osgDB::getStrippedName(filename)+std::string(".svg")); + std::string dotFileName = filename; + + if (osgDB::getFileExtension(filename)=="dot") + { + dotFileName = filename; + } + else + { + dotFileName = tmpDirectory+osgDB::getStrippedName(filename)+std::string(".dot"); + osg::ref_ptr model = osgDB::readNodeFile(filename); + if (!model) return; + + osgDB::writeNodeFile(*model, dotFileName); + } + + std::stringstream command; + command<<"dot -Tsvg "<