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.

Here is the code that I am having the issues on:
function AddMarkers(Number){
var idStart = (Number * 2); //  This is going to keep track of the array
location for our Start
var idFinish = (idStart + 1); //  This is going to keep track of the array
location for our Finish
 var point1 = new google.maps.LatLng(StartLat[idStart],StartLon[idStart]); //
 Our start marker location
var point2 = new google.maps.LatLng(FinishLat[idFinish],
FinishLon[idFinish]); //  Our finish marker location
 StartPoints[idStart] = point1;
FinishPoints[idFinish] = point2;

//============================================================================================================================================
try { // Start try to set the Marker options for Start and Finish
ZoneStartMarkerOptions = { "icon": StartPoint, "clickable": true,
"draggable": true, "title": Number };
ZoneFinishMarkerOptions = { "icon": FinishPoint, "clickable": true,
"draggable": true, "title":Number };
} //  End try to set the Marker options for Start of the Zone
//--------------------------------------------------------------------------------------------------------------------------------------------
catch(error) { //  Start catch for setting the Marker options for Start and
Finish
alert("Error Setting zone start and finish marker options!");
} //  End catch for setting the Marker options for Start of the Zone
//============================================================================================================================================
 try {
var StartMarker = new google.maps.Marker(point1, ZoneStartMarkerOptions);
var FinishMarker = new google.maps.Marker(point2, ZoneFinishMarkerOptions);
}
catch(error) {
alert("Error creating Start and Finish Markers");
}
 ZoneStartFinishMarkers[idStart] = StartMarker; //  Adds to our
ZoneStartFinishMarkers at our Number* 2
try {
StartListeners.push(google.maps.event.addListener(ZoneStartFinishMarkers[idStart],
"dragend", (function(){ //  Creates the Listener for the StartMarker
var Point = StartMarker.getPosition(); //  Gets the new location of the
marker
var pointb = FinishPoints[idFinish];         //  Gets the Point of the
FinishMarker
ZoneID = StartMarker.getTitle();         //  Sets the title
Distance = point1.distanceFrom(pointb); //  Gets the Distance From the
Finish Marker
UpdateString = "S," + ZoneID + Point + Distance + pointb;                 //
 Sets the update string
} )));
}
catch(error) {
alert("Error Setting up StartListener in
AddStartFinishMarkersForIntersection");
}
 ZoneStartFinishMarkers[idFinish] = FinishMarker; //  Adds to our
ZoneStartFinishMarkers at our Number* 2 + 1
try {
FinishListeners.push(google.maps.event.addListener(ZoneStartFinishMarkers[idFinish],
"dragend", (function() { //  Creates the Listener for the FinishMarker
var Point = FinishMarker.getPosition();         //  Gets the new location of
the marker
var pointb = StartPoints[idStart];         //  Gets the Point of the
StartMarker
ZoneID = FinishMarker.getTitle();         //  Sets the title
Distance = point1.distanceFrom(pointb); //  Gets the Distance From the Start
Marker
UpdateString = "F," + ZoneID + pointb + Distance + Point;;
 //  Sets the update string
} )));
}
catch(error) {
alert("Error Setting up FinishListener in
AddStartFinishMarkersForIntersection");
}

//================================================================================================================================================
//  Set the options for the BreadCrumb Marker Manager
//------------------------------------------------------------------------------------------------------------------------------------------------
try {
ZoneStartFinishMMOptions = { borderPadding: 50, maxZoom: 20, trackMarkers:
true };
}
catch(error) {
alert("Error setting up MarkerManager options");
}
//================================================================================================================================================


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);
}
//================================================================================================================================================
 //StartListeners.push(idStart);
//FinishListeners.push(idFinish);
 StartFinishCounter++;

//================================================================================================================================================
}

Any ideas?

Thanks in advance,
Nathan

-- 
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.

Reply via email to