是否可以使用Openlayers 3刷新矢量圖層的單個功能?我不想刷新所有圖層。使用Openlayers 3刷新功能3
回答
也許你可以告訴我們更多關於你的用例。但是,如果您使用的是ol矢量源,則可以嘗試移除該功能並再次添加它。添加要素功能會觸發更改事件(對於整個來源,但不應更新已經繪製的要素)。
ol.source.Vector.prototype.addFeature = function(feature) {
this.addFeatureInternal(feature);
this.changed();
};
就我而言,許多用戶可以在同一張地圖上工作。如果用戶修改某個功能,則必須爲其他用戶更新相同功能,而不更新所有層。 –
這很困難,因爲你必須觸發通知/從服務器,並推動它或把它拉到前端。您可以每隔5秒或稍微從前端拉出,或者使用websocket通知前端發生更改。 – foedchr
我嘗試了您的方法(刪除該功能並再次添加),但該功能從地圖上消失。 –
如果你有此功能的引用,您可以更新功能方面,喜歡它的形狀或特性,將在地圖進行更新。
setGeomtry
和setProperties
都火事件,使得地圖更新: http://openlayers.org/en/latest/apidoc/ol.Feature.html
只要你已經設置好了,這樣你可以找到或保持直接引用功能,您可以用詳細的方法在http://openlayers.org/en/latest/apidoc/ol.Feature.html更新功能
- 1. 更新OpenLayers中的功能樣式3
- 2. Openlayers 3:動畫點功能
- 3. 的OpenLayers 3 - 刪除功能
- 4. Openlayers 3:添加文本標籤功能
- 5. Openlayers 3功能標籤背景
- 6. 不能在webpack中使用openlayers-3
- 7. 使用TurfJS「合併」功能在OpenLayers 3中添加GeoJSON圖層
- 8. 刷新功能不能按預期工作Swift 3
- 9. Openlayers 3 Coords
- 10. OpenLayers 3直線
- 11. TWebBrowser&OpenLayers 3
- 12. Openlayers 3文檔
- 13. 刷新WMS層的OpenLayers 3數據變更後
- 14. 刷新頁面3
- 15. 在使用500個功能進行平移時,OpenLayers 3中的性能下降
- 16. 功能3秒
- 17. Rails 3使用AJAX刷新頁面
- 18. 如何使用Silverlight 3刷新ItemsSource?
- 19. 的OpenLayers 3 readExtensions GPX
- 20. 的OpenLayers 3:多行
- 21. Openlayers 3 - Interaction和pointermove
- 22. 標記的OpenLayers 3
- 23. Openlayers 3 ol.animation.pan超時?
- 24. OpenLayers 3 Reload Layer(s)
- 25. 隱藏一層或多層放大openlayers 3的功能?
- 26. 的OpenLayers 3刪除功能不會從地圖
- 27. 的OpenLayers 3將活力四射的風格與解析功能
- 28. OpenLayers 3 - 將選擇功能綁定到複選框
- 29. Openlayers 3:以編程方式選擇一個功能
- 30. 將平移功能添加到OpenLayers中的概覽圖3
很難想象如何刷新單個功能。 –