目标:解决(一)中的问题
构建地图节点的依据是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是如何根据文件扩展名寻找需要加载的动态链接库插件的((一)中问题)
2、加载动态库插件的过程是什么((一)中问题)
3、osgDB::Registry的作用是什么((一)中问题)
4、.earth文件如何解析成Config((一)中问题)
5、地图map图层的构建过程((一)中问题)
6、地图节点MapNode的构建过程((一)中问题)
5、地图map图层的构建过程((一)中问题)
6、地图节点MapNode的构建过程((一)中问题)
7、osgDB::Registry和osgEarth::Registry的关系((四)中问题)