Hi again,
I think I've understood your idea: I first create the route, with the
GDirections class, and then I create my own markers, wich give me more
flexibility. The case is that if I try to hide the markers of the
GDirections object, then the route disappears!
var mapa;
var directions;
function iniciar(){
if (GBrowserIsCompatible()){
mapa = new GMap2(document.getElementById("division_mapa"));
mapa.setCenter(new GLatLng(40.419769,-3.703766), 15);
mapa.addControl(new GSmallMapControl());
directions = new GDirections(mapa);
directions.load("from: 40.419769,-3.703766 to:
40.43,-3.703766");
var marcador01 = new GMarker(new GLatLng
(40.419769,-3.703766));
var marcador02 = new GMarker(new GLatLng(40.43,-3.703766));
GEvent.addListener(marcador01, "click", function()
{marcador01.openInfoWindowHtml('Soy el marcador01, que pasa');});
GEvent.addListener(marcador02, "click", function()
{marcador02.openInfoWindowHtml('Soy el marcador02, que pasa');});
mapa.addOverlay(marcador01);
mapa.addOverlay(marcador02);
// directions.getMarker(0).hide();
}
}
*If the script executes the last instruction, directions.getMarker
(0).hide, then, the route disappears. I'd like to preserve the route
and my own markers: marcador01 and marcador02. Thanks a lot for your
help.
On 26 ene, 12:47, Mike Williams <[email protected]> wrote:
> Wait for the GDirections call to complete, then use
> directions.getMarker() to obtain a reference to the markers.
>
> It's probably best to .hide() those markers and add your own markers in
> the same place with the info window content that you want. Just adding
> your own listeners that open your own info window would leave the
> markers with calls to create both the GDirections info window details
> and your info window details, so it might look odd as one info window
> pops up and gets immediately replaced by the other.
>
> --http://econym.org.uk/gmap
> The Blackpool Community Church Javascript Team
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---