久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使用 Google Maps v3 拖動(移動)多邊形

Drag (move) a polygon using Google Maps v3(使用 Google Maps v3 拖動(移動)多邊形)
本文介紹了使用 Google Maps v3 拖動(移動)多邊形的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

Polygon 的 Google Maps API 可以不提供拖動方法.

The Google Maps API for a Polygon does not offer a drag method.

什么是實現此類功能的有效方法(即,充分優化,不會殺死一臺使用了四年的筆記本電腦)?

What would be an efficient way of implementing such a feature (i.e., sufficiently optimised so that it would not kill a four year old laptop)?

謝謝!

推薦答案

我發現 Google Maps V2 多邊形實現對我的需求非常有限,并通過創建自定義疊加層解決了這個問題.我的小組目前停留在 IE6 上,所以我還沒有遷移到 Google Maps V3 - 但快速瀏覽一下 API 就會發現,您可能可以做與我在 V2 和 V3 中所做的類似的事情.

I found the Google Maps V2 Polygon Implementation to be very limiting for the needs I have had and solved it by creating a custom overlay. My group is currently stuck on IE6 so I have yet to migrate over to Google Maps V3 - but taking a quick look at the API shows that you could probably do a similar thing that I did in V2 with V3.

基本上這個想法是:

  1. 創建自定義疊加層
  2. 使用您自己的 SVG/VML 多邊形填充它并將拖動事件附加到此自定義多邊形對象

<小時>

自定義疊加層:


Custom Overlays:

以下信息可幫助您開始制作自己的自定義疊加層:

Here is some information to get you started on making your own custom overlay:

http://code.google.com/apis/地圖/文檔/javascript/overlays.html#CustomOverlays

創建您自己的可拖動"多邊形對象:

Creating your own "Dragable" Polygon Object:

完成后,您需要將自己的多邊形添加到自定義疊加層,而不是使用 GPolygons.我經歷了學習 SVG/VML 并編寫一個庫以將 SVG/VML 連接在一起的痛苦過程——你可以這樣做,但我建議先嘗試使用另一個庫,例如 Rapha?l.

Once you get that down you'll want to add your own polygons to the custom overlay instead of using GPolygons. I went through the painful process of learning SVG/VML and writing a library to bridge SVG/VML together - you could do that, but I would recommend starting by trying to use another library such as Rapha?l.

http://raphaeljs.com/

使用 Rapha?l 將為您節省大量時間來嘗試了解如何獲得跨瀏覽器矢量圖形(多邊形)功能 - 最重要的是它已經支持拖動事件,下面是他們庫中的一個示例:

Using Rapha?l will save you a whole lot of time trying to figure out how to get cross-browser Vector Graphic (Polygon) functionality - and best of all it supports drag events already, here is an example from their library:

http://raphaeljs.com/graffle.html

一旦您有一個自定義疊加層并且您可以將一些 Rapha?l 對象扔到上面,最后一步是將您想要的坐標從 Lat/Lng 值轉換為 Pixel 值.這在 V3 的 MapCanvasProjection 中可用:

Once you have a custom overlay and you are able to throw some Rapha?l objects onto it the last step is to translate the coordinates you want from a Lat/Lng value to a Pixel value. This is available in the MapCanvasProjection of V3:

http://code.google.com/apis/地圖/文檔/javascript/reference.html#MapCanvasProjection

您可以使用 fromLatLngToDivPixel 確定 Raphael 多邊形上的點的實際像素值,繪制它,然后通過拖動事件將其添加到疊加層.

You can use fromLatLngToDivPixel to figure out what the actual pixel values are for the points on your Raphael polygon, draw it, then add it to the overlay with a drag event.

這篇關于使用 Google Maps v3 拖動(移動)多邊形的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How can I get my jasmine tests fixtures to load before the javascript considers the document to be quot;readyquot;?(在 javascript 認為文檔“準備好之前,如何讓我的 jasmine 測試裝置加載?) - IT屋-程序員軟件開發技術
What do jasmine runs and waitsFor actually do?(jasmine 運行和等待實際上是做什么的?)
How to provide mock files to change event of lt;input type=#39;file#39;gt; for unit testing(如何提供模擬文件來更改 lt;input type=filegt; 的事件用于單元測試)
How to unit test a chained method using Jasmine(如何使用 Jasmine 對鏈式方法進行單元測試)
How do I inject $rootScope into an AngularJS unit test?(如何將 $rootScope 注入 AngularJS 單元測試?)
Jasmine - How to spy on a function call within a function?(Jasmine - 如何監視函數中的函數調用?)
主站蜘蛛池模板: 羞羞的视频在线看 | 国产精品久久久久久久午夜片 | 欧美在线a| 精品一区二区三区电影 | 欧美日韩不卡合集视频 | 亚洲成人激情在线观看 | 久久精品在线 | 亚洲欧美视频 | 国产精品久久av | 伊人网91 | 91久久| 中文在线一区 | 国产成人久久久 | 在线国产视频观看 | 国产欧美日韩精品一区二区三区 | 天堂一区在线观看 | 亚洲精品免费在线观看 | 精品国产一级 | 少妇一区二区三区 | 国产三级电影网站 | 国产精品久久久久久久久图文区 | 亚洲高清av在线 | 国产精品久久久久久久久久久免费看 | 美国十次成人欧美色导视频 | 国产美女在线观看 | 97久久精品 | 久久99精品久久 | 丁香五月网久久综合 | 毛片一级片 | 99久久中文字幕三级久久日本 | 日韩精品在线免费观看视频 | 久久久精彩视频 | 久久久久久91 | 精品日韩一区 | 欧美a在线 | 久草热在线 | 久久国产一区二区三区 | 情侣av | 成人a免费 | www.av在线 | 中文字幕中文字幕 |