我一直在檢查有關此主題的不同問題,但他們沒有給我一個令人信服的答案。我有一個地圖中,我已經做繪製4軸以下:阻力線
function axis() {
var bounds = map.getBounds();
var NECorner = bounds.getNorthEast();
var SWCorner = bounds.getSouthWest();
// horizontal top axis
var PolylineCoordinates = [
new google.maps.LatLng(NECorner.lat()-0.0002, NECorner.lng()),
new google.maps.LatLng(NECorner.lat()-0.0002, SWCorner.lng()),
];
var Path = new google.maps.Polyline({
clickable: false,
geodesic: true,
path: PolylineCoordinates,
strokeColor: "#FF0000",
strokeOpacity: 1.000000,
strokeWeight: 0.8
});
Path.setMap(map);
// horizontal low axis
var PolylineCoordinates = [
new google.maps.LatLng(SWCorner.lat()+0.0002, NECorner.lng()),
new google.maps.LatLng(SWCorner.lat()+0.0002, SWCorner.lng()),
];
var Path = new google.maps.Polyline({
clickable: false,
geodesic: true,
path: PolylineCoordinates,
strokeColor: "#FF0000",
strokeOpacity: 1.000000,
strokeWeight: 0.8
});
Path.setMap(map);
// vertical left axis
var PolylineCoordinates = [
new google.maps.LatLng(NECorner.lat(), SWCorner.lng()+0.0002),
new google.maps.LatLng(SWCorner.lat(), SWCorner.lng()+0.0002),
];
var Path = new google.maps.Polyline({
clickable: false,
geodesic: true,
path: PolylineCoordinates,
strokeColor: "#FF0000",
strokeOpacity: 1.000000,
strokeWeight: 0.8
});
Path.setMap(map);
// vertical left axis
var PolylineCoordinates = [
new google.maps.LatLng(NECorner.lat(), NECorner.lng()-0.0002),
new google.maps.LatLng(SWCorner.lat(), NECorner.lng()-0.0002),
];
var Path = new google.maps.Polyline({
clickable: false,
geodesic: true,
path: PolylineCoordinates,
strokeColor: "#FF0000",
strokeOpacity: 1.000000,
strokeWeight: 0.8
});
Path.setMap(map);
}
我現在想要的是能夠水平或垂直拖拽這些軸(視軸)不斷獲得位置差在它們之間(在一方面的水平線之間和另一個垂直者之間)。
-be能夠移動/用鼠標拖動連奪四個紅色線
- 在地圖上方顯示abs(latitude_axis1 -latitude-axis2)和abs(longitude_axis1-longitude-axis2)的值
任何人都可以幫我嗎?如果沒有,沒有任何人知道已經回答了類似的問題(我認爲我已經檢查了所有的)
您是什麼意思「獲取位置差異」?你究竟想要拖動什麼?完整的線路/路徑還是隻有一點? – Dekel
@Dekel我編輯的問題,一點點,請檢查一下。 – paulzaba