本文时在osgEarth earth文件到地球的创建---(1)的基础上,进一步讲解MapNode的创建过程。
本文通过代码的介绍,讲解在osgEarth中,MapNode的创建过程以及MapNode的子节点和traverse函数的内容。
内容
osg::Node*
EarthFileSerializer2::deserialize(
const Config& const_conf,
const std::string& referrer,
const osgDB::Options* readOptions) const
{
......
......
......
MapNode::Options mapNodeOptions( conf.child("options") );
// Create a map node.
osg::ref_ptr<MapNode> mapNode = new MapNode( map.get(), mapNodeOptions );
// Apply the external conf if there is one.
if (!externalConfig.empty())
{
mapNode->externalConfig() = externalConfig;
}
// Install the extensions
for (unsigned i = 0; i < extensions.size(); ++i)
{
mapNode->addExtension(extensions[i].get());
}
// return the topmost parent of the mapnode. It