這是我工作的代碼的一部分:使用多邊形路徑(這遺留碼被繪製圓圈:替代爲point.x爲谷歌地圖API V3
GEvent.addListener(bigmap_rad, 'click', function(overlay, cpoint) {
var radius = document.getElementById('circle_radius').value;
var c_center = new GLatLng(cpoint.y,cpoint.x);
var c_marker = new GMarker(c_center);
var latOffset = 0.01;
var lonOffset = 0.01;
var latConv = c_center.distanceFrom(new GLatLng(c_center.lat()+0.1, c_center.lng()))/100;
var lngConv = c_center.distanceFrom(new GLatLng(c_center.lat(), c_center.lng()+0.1))/100;
// nodes = number of points to create polygon
var nodes = 40;
// Create an array of points
var cpoints = [];
var pointbegain = null;
// set the amount of steps from node
var step = parseInt(360/nodes);
// the for loop creates a series of points that define the circle, counting by the amount of steps, by 9 in the case of 40 nodes
for(var i=0; i<=360; i+=step){
var point1 = new GLatLng(c_center.lat() + (radius/latConv * Math.cos(i * Math.PI/180)),
c_center.lng() + (radius/lngConv * Math.sin(i * Math.PI/180)));
if(i==0){
pointbegain= point1;
}
cpoints.push(point1);
}
//cpoints.push(pointbegain);
polygon = new GPolygon(cpoints, "#000000", 1, 1, "#8000000", 0.5);
//bigmap_rad.addOverlay(polygon);
(這裏bigmap_rad是一個谷歌地圖V2 Map對象和連接點被
我用這谷歌地圖V2代碼把它變成V3傳遞給事件偵聽器),但無意中發現了這個
var c_center = new GLatLng(cpoint.y,cpoint.x);
我不能找到這個口岸系統的替代品。 y和cp oint.x谷歌地圖api v3。請有人建議我解決方案。提前致謝。
'cpoint'從哪裏來?什麼類型的對象是'bigmap_rad'?我認爲我們需要看到更多的代碼,特別是它的V3版本 – duncan
bigmap_rad是google map v2 Map對象,cpoint傳遞給該事件監聽器。我現在正在爲谷歌地圖v3尋找這個cpoint的替代方案。 – user2915001