|
本帖最后由 lianghui 于 2010-1-14 15:27 编辑
如题
我想使用如下的config文件配制方法实现:
Viewer = new osgViewer::Viewer();
MapNode = new MapNode();
Root = new osg::Switch;
osgEarth::Config conf;
conf.add( "cache","NASA");
conf.add( "path","F:/cache");
conf.add( "url","http://localhost/TMS/tms.xml");
MapLayer* layer = new MapLayer("NASA", MapLayer::TYPE_IMAGE, "tms", conf );MapNode->getMap()->addMapLayer(layer);
Root->addChild(MapNode);
Viewer->setSceneData(Root);
这种方式不行,请教各位如何通过配置实现cache在MapNode中的设置?
osgEarth::Cache* cache = new Cache();是个不能实例化的抽象类,所以
layer->setCache(cache);的cache也没办法实现。
我看过一个通过读.earth文件加cache的例子,是可以实现的。如下:
std::string modelPath = "../configs/word_wind.earth";
{
osg::ref_ptr<osg::Node> node = osgDB::readNodeFile(modelPath);
viewer.setSceneData(node.get());
}
只要在word_wind.earth里边加入节点cache和子节点path就行
<map name="TileService" type="geocentric">
<cache type="tms" tms_type="">
<path>F:\cache</path>
</cache>
<image name="tileservice" driver="tileservice">
<url>http://s0.tileservice.worldwindcentral.com/getTile?<;/url>
<dataset>bmng.topo.bathy.200401</dataset>
<format>jpg</format>
<max_level>7</max_level>
</image>
</map> |
|