Skip to content

Commit

Permalink
Modify map api to new
Browse files Browse the repository at this point in the history
  • Loading branch information
KangLin committed Dec 6, 2016
1 parent 5e67aca commit 8e33011
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
12 changes: 11 additions & 1 deletion Data/Map.earth
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,22 @@
</image>
<image>
<visible>false</visible>
<url>../../build-RabbitGIS-Desktop_Qt_5_7_0_MSVC2015_32bit-Debug/Debug/Data/&quot;http:/webst0[1234].is.autonavi.com/appmaptile?style=6&amp;x={x}&amp;y={y}&amp;z={z}&quot;</url>
<url>http:/webst0[1234].is.autonavi.com/appmaptile?style=6&amp;x={x}&amp;y={y}&amp;z={z}&quot;</url>
<cache_policy>
<usage>read_write</usage>
</cache_policy>
<profile>global-mercator</profile>
<name>amap-1</name>
<driver>xyz</driver>
</image>
<image>
<enabled>false</enabled>
<url>http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/</url>
<cache_policy>
<usage>read_write</usage>
</cache_policy>
<nodata_image>http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/100/0/0.jpeg</nodata_image>
<name>arcgis image</name>
<driver>arcgis</driver>
</image>
</map>
12 changes: 11 additions & 1 deletion Data/Map_zh_CN.earth
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,22 @@
</image>
<image>
<visible>false</visible>
<url>Debug/Data/&quot;http:/webst0[1234].is.autonavi.com/appmaptile?style=6&amp;x={x}&amp;y={y}&amp;z={z}&quot;</url>
<url>http:/webst0[1234].is.autonavi.com/appmaptile?style=6&amp;x={x}&amp;y={y}&amp;z={z}&quot;</url>
<cache_policy>
<usage>read_write</usage>
</cache_policy>
<profile>global-mercator</profile>
<name>高德地图-1</name>
<driver>xyz</driver>
</image>
<image>
<enabled>false</enabled>
<url>http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/</url>
<cache_policy>
<usage>read_write</usage>
</cache_policy>
<nodata_image>http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/100/0/0.jpeg</nodata_image>
<name>arcgis影像</name>
<driver>arcgis</driver>
</image>
</map>
13 changes: 8 additions & 5 deletions Mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,12 +642,13 @@ void MainWindow::slotActionGroupMapTriggered(QAction *act)
std::list<QAction*>::iterator it;
for(it = m_ActionMap.begin(); it != m_ActionMap.end(); it++)
{
osgEarth::ImageLayer* layer = map->getLayerAt<osgEarth::ImageLayer>(i);
if(*it == act)
{
map->getImageLayerAt(i)->setVisible(true);
layer->setVisible(true);
}
else
map->getImageLayerAt(i)->setVisible(false);
layer->setVisible(false);
i++;
}
}
Expand All @@ -659,10 +660,12 @@ void MainWindow::slotMenuMapShow()

ClearMenuMap();
osg::ref_ptr<osgEarth::Map> map = m_MapNode->getMap();
int num = map->getNumImageLayers();
for(int i = 0; i < num; i++)
std::vector< osg::ref_ptr<osgEarth::ImageLayer> > v;
map->getLayers(v);
std::vector< osg::ref_ptr<osgEarth::ImageLayer> >::iterator it;
for(it = v.begin(); it != v.end(); it++)
{
osg::ref_ptr<osgEarth::ImageLayer> image = map->getImageLayerAt(i);
osg::ref_ptr<osgEarth::ImageLayer> image = *it;
QAction* action =
ui->menuMap_A->addAction(QString(image->getName().c_str()));
action->setCheckable(true);
Expand Down

0 comments on commit 8e33011

Please sign in to comment.