From 622e7a6611c966b4cba0b2439dd364b0c4bf771a Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 7 May 2009 18:32:36 +0000 Subject: [PATCH] Moved property code from ImageLayer into Layer where it belongs --- src/osgPlugins/osgVolume/ImageLayer.cpp | 11 ----------- src/osgPlugins/osgVolume/Layer.cpp | 19 +++++++++++++++---- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/osgPlugins/osgVolume/ImageLayer.cpp b/src/osgPlugins/osgVolume/ImageLayer.cpp index 9322e9cc9..12788e855 100644 --- a/src/osgPlugins/osgVolume/ImageLayer.cpp +++ b/src/osgPlugins/osgVolume/ImageLayer.cpp @@ -35,12 +35,6 @@ bool ImageLayer_readLocalData(osg::Object& obj, osgDB::Input &fr) bool itrAdvanced = false; - osg::ref_ptr readObject = fr.readObjectOfType(osgDB::type_wrapper()); - if (readObject.valid()) itrAdvanced = true; - - osgVolume::Property* property = dynamic_cast(readObject.get()); - if (property) layer.addProperty(property); - if (fr.matchSequence("file %w") || fr.matchSequence("file %s")) { std::string filename = fr[1].getStr(); @@ -93,11 +87,6 @@ bool ImageLayer_writeLocalData(const osg::Object& obj, osgDB::Output& fw) { const osgVolume::ImageLayer& layer = static_cast(obj); - if (layer.getProperty()) - { - fw.writeObject(*layer.getProperty()); - } - if (!layer.getFileName().empty()) { fw.indent()<<"file "<< layer.getFileName() << std::endl; diff --git a/src/osgPlugins/osgVolume/Layer.cpp b/src/osgPlugins/osgVolume/Layer.cpp index a3d019928..c8ef34b15 100644 --- a/src/osgPlugins/osgVolume/Layer.cpp +++ b/src/osgPlugins/osgVolume/Layer.cpp @@ -34,23 +34,34 @@ bool Layer_readLocalData(osg::Object& obj, osgDB::Input &fr) osgVolume::Layer& layer = static_cast(obj); bool itrAdvanced = false; - + osg::ref_ptr readObject = fr.readObjectOfType(osgDB::type_wrapper()); osgVolume::Locator* locator = dynamic_cast(readObject.get()); if (locator) layer.setLocator(locator); - + + readObject = fr.readObjectOfType(osgDB::type_wrapper()); + if (readObject.valid()) itrAdvanced = true; + + osgVolume::Property* property = dynamic_cast(readObject.get()); + if (property) layer.addProperty(property); + return itrAdvanced; } bool Layer_writeLocalData(const osg::Object& obj, osgDB::Output& fw) { const osgVolume::Layer& layer = static_cast(obj); - + if (layer.getLocator()) { fw.writeObject(*layer.getLocator()); } - + + if (layer.getProperty()) + { + fw.writeObject(*layer.getProperty()); + } + return true; }