目标:解决(一)中的问题
构建地图节点的依据是Config
osgEarthDrivers/earth/EarthFileSerialize2.cpp
osg::Node*
EarthFileSerializer2::deserialize( const Config& conf, const std::string& referrer ) const
{
osg::ref_ptr< Map > map = new Map( mapOptions );
map->beginUpdate();
...
map->endUpdate();
}
该Config是在osgEarthDrivers/earth/ReaderWriterOsgEarth中构造的。由此可见.earth文件本质上就是xml文件
virtual ReadResult readNode(std::istream& in, const osgDB::Options* readOptions) const
{
...
osg::ref_ptr<XmlDocument> doc = XmlDocument::load( in, uriContext );
Config docConf = doc->getConfig();
...
Config conf;
if ( docConf.hasChild( "map" ) )
conf = docConf.child( "map" );
else if ( docConf.hasChild( "earth" ) )
conf = docConf.child( "earth" );
...
}
待继续分析列表:
1、osg是如何根

本文探讨osgEarth中.earth文件被解析为Config的过程,解析工作在osgEarthDrivers/earth/ReaderWriterOsgEarth模块进行。同时列出了一系列待分析的问题,包括osg根据文件扩展名找插件、加载动态库、osgDB::Registry的功能等。
最低0.47元/天 解锁文章
578

被折叠的 条评论
为什么被折叠?



