2010-07-06 63 views
0

在這examplegeometry.js頁我發現saveData函數,保存「信息」數組和JSON數據格式(不工作),如果我alert(record.type);根據我點擊的對象,我得到「點」或「polilyne」,如果我提醒record.title輸出標題非常正確,但是當我提醒record.coordinates輸出未定義時...谷歌地圖幾何控制標識座標陣

我只需要識別「地方」 whre保存座標...

感謝, 問候

+0

這看起來像一個V2問題連載權。你的標籤不正確。 – CrazyEnigma 2010-07-21 14:06:56

+0

是的,絕對是v2 – chrismarx 2010-12-08 21:24:27

回答

0

你可以發佈一個鏈接到你的網頁?至於幾何形狀被存儲,其中,每個控制添加到頁面(標記,線,多邊形)具有其自己的存儲陣列,例如從polygoncontrol.js

me.storage = [/*array of GeometryControls#beans#Geometry*/] 

,如果你看的把定義GeometryControls#豆,你會看到

Geometry:function(p){ 

    this.type = p.type; 

    this.geometry = p.geometry; 

    this.title = p.title || ["",""]; 

    this.description = p.description || ["",""]; 

    } 

實際座標在GeometryControls.prototype.saveData

//determine geometry type, and copy geometry appropriately 

    if(record.type === "point"){ 

     recordJSON.coordinates.push({lat:record.geometry.getLatLng().lat(),lng:record.geometry.getLatLng().lng()}); 

    } else { 

     var vertex; 

     for(var i=0;i<record.geometry.getVertexCount();i++){ 

     vertex = record.geometry.getVertex(i); 

     recordJSON.coordinates.push({lat:vertex.lat(),lng:vertex.lng()}); 

     } 

    }