드래그 가능한 웨이 포인트가있는 여러 방향을 표시하고 Route.prototype.setWayPoints()가 호출 될 때마다 객체, 데이터베이스 또는 출발지와 연결된 각 웨이 포인트를 저장하려고합니다.Google Maps v3에서 웨이 포인트로 다중 경로 처리
이 사람은 드래그 가능한 웨이 포인트가있는 단일 경로로이를 수행하고 있습니다 (데이터베이스에 저장).
나는 여러 경로없는 일을합니다. 나는 많이 봤지만 아무것도 찾을 수 없었다!
다음은 내가 시도한 것입니다. 현재 GoogleMap으로의 경로에서 웨이 포인트를 경로 객체에 저장 될 수 있도록
function Route(origin, destination){
this.origin = origin; // LatLng
this.destination = destination; //LatLng
this.way_points = null;
};
Route.prototype.drawRoute = function(){
this.dser.route({'origin': this.origin,
'destination': this.destination,
'waypoints': this.way_points,
'travelMode': google.maps.DirectionsTravelMode.DRIVING},
function(res,sts) {
if(sts=='OK'){
var dren = new google.maps.DirectionsRenderer({ 'draggable':true });
dren.setMap(map); //global variable 'map'
dren.setDirections(res);
}
});
};
Route.prototype.setGMap = function(map){
this.dren.setMap(map);
};
Route.prototype.setWayPoints = function(){
this.way_points = //... what should I do?
};
/* --- main part --- */
r0 = new Route(new google.maps.LatLng(30, 31), new google.maps.LatLng(40, 41));
r0.drawRoute();
// User drags and drops the route on the browser
r0.setWayPoints(); // newly added waypoints should be stored in r0.way_points
r1 = new Route(new google.maps.LatLng(50, 51), new google.maps.LatLng(60, 61));
r1.drawRoute();
// User drags and drops the route on the browser
r1.setWayPoints(); // newly added waypoints should be stored in r1.way_points
는 사람이 어떻게 구현하는 Route.prototype.setWayPoints 말해 주시겠습니까?
!!! 대단히 감사합니다 !!!!! – Ryo