Moved property code from ImageLayer into Layer where it belongs

This commit is contained in:
Robert Osfield 2009-05-07 18:32:36 +00:00
parent 24c19fa17e
commit 622e7a6611
2 changed files with 15 additions and 15 deletions

View File

@ -35,12 +35,6 @@ bool ImageLayer_readLocalData(osg::Object& obj, osgDB::Input &fr)
bool itrAdvanced = false;
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osgVolume::Property>());
if (readObject.valid()) itrAdvanced = true;
osgVolume::Property* property = dynamic_cast<osgVolume::Property*>(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<const osgVolume::ImageLayer&>(obj);
if (layer.getProperty())
{
fw.writeObject(*layer.getProperty());
}
if (!layer.getFileName().empty())
{
fw.indent()<<"file "<< layer.getFileName() << std::endl;

View File

@ -34,23 +34,34 @@ bool Layer_readLocalData(osg::Object& obj, osgDB::Input &fr)
osgVolume::Layer& layer = static_cast<osgVolume::Layer&>(obj);
bool itrAdvanced = false;
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osgVolume::Locator>());
osgVolume::Locator* locator = dynamic_cast<osgVolume::Locator*>(readObject.get());
if (locator) layer.setLocator(locator);
readObject = fr.readObjectOfType(osgDB::type_wrapper<osgVolume::Property>());
if (readObject.valid()) itrAdvanced = true;
osgVolume::Property* property = dynamic_cast<osgVolume::Property*>(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<const osgVolume::Layer&>(obj);
if (layer.getLocator())
{
fw.writeObject(*layer.getLocator());
}
if (layer.getProperty())
{
fw.writeObject(*layer.getProperty());
}
return true;
}