Directions in Google Maps V3: several directions on the map

I'm trying to make several directions (well, their Polyline, essentially) on one copy of the map. In the previous version of the map API, I did something like

//directions[] stores the GDirections objects
//x[] is an array of Elements extracted from an XMLHTTPResponse object
//iterating over the values in x[]
GEvent.addListener(directions[i], "load", function() {
 var polyline = this.getPolyline();
 map.addOverlay(polyline);
 polyline.setStrokeStyle({opacity:0.2})
 });

directions[i].load("from:here to:"+x[i].childNodes[0].nodeValue,{getPolyline:true});

Now that there are DirectionsService and DirectionsRenderer classes, I don’t know which best practices do the same. Create multiple instances of the DirectionsRenderer class and force them to do setMap () on the main map instance? I am creating several instances of the DirectionsServices class.

I am very new to javascript and functional languages ​​in general and barely had time to figure out how to close functional locks, as they relate to callbacks. Sorry for the formatting.

Any help would be appreciated, I will try to clarify any points that you can raise.

+1
2

, , , , DirectionsRenderer ( !) DirectionsService INSIDE . .

+1

@ifaour, . , , : ... .: D

( )... , ,

0

All Articles