目标:解决(一)中的问题
构建地图节点的依据是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( "ea