I am trying to move my code over to version 3 of the API code;
however, I am running into some issues with my MarkerManager that I am
moving over from version 2 of the API. I have an html file as an
embedded object in a c++ application I have been working on and
therefore I don't have a working live link but here is the part of the
code where I create the marker and try to create the marker manager
and add the marker to the manager. I'll omit the trivial parts.
Here is the code that I am having the issues on:
ZoneStartMarkerOptions = { "icon": StartPoint, "clickable": true,
"draggable": true, "title": Number };
ZoneFinishMarkerOptions = { "icon": FinishPoint, "clickable": true,
"draggable": true, "title":Number };
var StartMarker = new google.maps.Marker(point1,
ZoneStartMarkerOptions);
var FinishMarker = new google.maps.Marker(point2,
ZoneFinishMarkerOptions);
ZoneStartFinishMarkers[idStart] = StartMarker;
StartListeners.push(google.maps.event.addListener(ZoneStartFinishMarkers[idStart],
"dragend", (function(){
var Point = StartMarker.getPosition();
var pointb = FinishPoints[idFinish];
ZoneID = StartMarker.getTitle();
Distance = point1.distanceFrom(pointb);
UpdateString = "S," + ZoneID + Point + Distance +
pointb;
} )));
ZoneStartFinishMarkers[idFinish] = FinishMarker;
// Adds
to our ZoneStartFinishMarkers at our Number* 2 + 1
FinishListeners.push(google.maps.event.addListener(ZoneStartFinishMarkers[idFinish],
"dragend", (function() {
var Point = FinishMarker.getPosition();
var pointb = StartPoints[idStart];
ZoneID = FinishMarker.getTitle();
Distance = point1.distanceFrom(pointb);
UpdateString = "F," + ZoneID + pointb + Distance +
Point;;
} )));
//
========================================================================================================================
// Set the options for the BreadCrumb Marker Manager
//------------------------------------------------------------------------------------------------------------------------------------------------
ZoneStartFinishMMOptions = { borderPadding: 50, maxZoom: 20,
trackMarkers: true };
//
========================================================================================================================
Okay I get to this point and it fails to create the MarkerManager, it
registers that the MM doesn't exist and hits the else condition:
//
========================================================================================================================
// Check to see if the MM exists
// If it does then we don't want to overwrite it
// Instead we just add our new markers
//------------------------------------------------------------------------------------------------------------------------------------------------
try {
if (ZoneStartFinishMM) {
ZoneStartFinishMM.addMarker(ZoneStartFinishMarkers[idStart], 0);
ZoneStartFinishMM.addMarker(ZoneStartFinishMarkers[idFinish], 0);
ZoneStartFinishMM.refresh();
} // End if ZoneStartFinishMM
//------------------------------------------------------------------------------------------------------------------------------------------------
// If it doesn't exist then we create a new one and then add
our
markers
//------------------------------------------------------------------------------------------------------------------------------------------------
else {
alert("!ZoneStartFinishMM");
try {
ZoneStartFinishMM = new MarkerManager(map,
ZoneStartFinishMMOptions);
}
catch(error) {
alert("Error creating MarkerManager");
}
try {
ZoneStartFinishMM.addMarker(ZoneStartFinishMarkers[idStart], 0);
ZoneStartFinishMM.addMarker(ZoneStartFinishMarkers[idFinish], 0);
}
catch(error) {
alert("Error adding the markers to the marker
manager");
}
ZoneStartFinishMM.refresh();
} // End else !ZoneStartFinishMM
}
catch(error) {
alert("Error adding Marker to Number: " + Number);
}
//
========================================================================================================================
I am getting hung up on creating the new marker manager. Any ideas?
Thanks in advance,
Nathan
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.