Files
OpenSceneGraph/src/osgDB/Options.cpp
Robert Osfield f61a6aa4e7 Refactored the way that the DatabasePager passes the Terrain decorator node onto the TerrainTile.
The DatabasePager now passes the Terrain pointer into the ReaderWriter's via osgDB::Options object,
rather than pushing a NodePath containing the Terrain onto NodeVisitor.  This
change means that the DatabasePager nolonger needs to observer the whole NodePath and
will be lighter and quicker for it.

The change also means that ReadFileCallback can now run custom NodeVisitor's on the scene graph without
having to worry about TerrainTile's constructing scene graphs prior to the Terrain being assigned.

Also changed is the NodeVisitor::DatabaseRequestHandler which now requires a NodePath to the node that you wish
to add to rather than just the pointer to the node you wish to add to.  This is more robust when handling scenes
with multiple parental paths, whereas previously errors could have occurred due to the default of picking the first
available parental path.  This change means that subclasses of DatabasePager will need to be updated to use this new
function entry point.
2011-01-12 19:29:24 +00:00

57 lines
2.1 KiB
C++

/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osgDB/Options>
#include <osgDB/Registry>
using namespace osgDB;
Options::Options(const Options& options,const osg::CopyOp& copyop):
osg::Object(options,copyop),
_str(options._str),
_databasePaths(options._databasePaths),
_objectCacheHint(options._objectCacheHint),
_precisionHint(options._precisionHint),
_buildKdTreesHint(options._buildKdTreesHint),
_pluginData(options._pluginData),
_pluginStringData(options._pluginStringData),
_findFileCallback(options._findFileCallback),
_readFileCallback(options._readFileCallback),
_writeFileCallback(options._writeFileCallback),
_fileLocationCallback(options._fileLocationCallback),
_fileCache(options._fileCache),
_terrain(options._terrain) {}
void Options::parsePluginStringData(const std::string& str, char separator1, char separator2)
{
StringList valueList;
split(str, valueList, separator1);
if (valueList.size() > 0)
{
StringList keyAndValue;
for (StringList::iterator itr=valueList.begin(); itr!=valueList.end(); ++itr)
{
split(*itr, keyAndValue, separator2);
if (keyAndValue.size() > 1)
{
setPluginStringData(keyAndValue.front(), keyAndValue.back());
}
else if (keyAndValue.size() > 0)
{
setPluginStringData(keyAndValue.front(), "true");
}
keyAndValue.clear();
}
}
}