简体   繁体   English

迪卡塔-如何刷新地图

[英]Decarta - how to refresh map

I am using the Decarta JS API. 我正在使用Decarta JS API。 I am displaying a map with layers. 我正在显示带有图层的地图。 I want to refresh the map and redraw new layers, but I see no way to do this in the documentation . 我想刷新地图并重新绘制新图层,但是在文档中看不到做到这一点的方法。

Is there a way to refresh the map using the API? 有没有一种使用API​​刷新地图的方法?

If you just want to refresh a single overlay and not the entire map, you can do this: 如果您只想刷新单个叠加层而不是整个地图,则可以执行以下操作:

myOverlay.render(myMap.tileGrid);

Assuming of course myMap is a deCarta.Core.Map and myOverlay is a deCarta.Core.MapOverlay. 当然,假设myMap是deCarta.Core.Map,而myOverlay是deCarta.Core.MapOverlay。

If the size of map container changed, you need to do the following so that the required tiles are loaded after the resize: 如果地图容器的大小已更改,则需要执行以下操作,以便在调整大小后加载所需的图块:

myMap.resize();

Using JQuery, I am able to accomplish my desired results by simply removing all children from the designated container the map is added to: 使用JQuery,我可以通过简单地从将地图添加到的指定容器中删除所有子项来实现所需的结果:

$('#mapContainer').empty();

I feel this is a crude way to handle this functionality and am hoping someone knows a more elegant way. 我觉得这是处理此功能的粗略方法,希望有人知道更优雅的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM