Okay, I couldn't include the map b/c it doesn't work standalone b/c my map
is an embedded cpp web browser component that loads the google map through a
c++ app that I am working with but here is the code I have for adding a
marker.

var idStart = (ZoneNumber * 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 GLatLng(StartLat[idStart],StartLon[idStart]);         //
 Our start marker location
var point2 = new GLatLng(FinishLat[idFinish], FinishLon[idFinish]); //  Our
finish marker location

//======================================================================================================================================
try { // Start try to set the Marker options for Start and Finish of the
Zone
ZoneStartMarkerOptions = { "icon": StartPoint, "clickable": true,
"draggable": true };
ZoneFinishMarkerOptions = { "icon": FinishPoint, "clickable": true,
"draggable": true };
} //  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 of the Zone
alert("Error Setting zone start and finish marker options!");
} //  End catch for setting the Marker options for Start of the Zone
//======================================================================================================================================

var StartMarker = new GMarker(point1, ZoneStartMarkerOptions);
var FinishMarker = new GMarker(point2, ZoneFinishMarkerOptions);
ZoneStartFinishMarkers[idStart] = StartMarker; //  Adds to our
ZoneStartFinishMarkers at our ZoneID * 2
GEvent.addListener(ZoneStartFinishMarkers[idStart], "dragend", function(){
             //  Creates the Listener for the StartMarker
var Point = StartMarker.getPoint();         //  Gets the new location of the
marker
UpdateString = "S," + Point; //  Sets the update string to the new location
- S indicates Start
} );
ZoneStartFinishMarkers[idFinish] = FinishMarker; //  Adds to our
ZoneStartFinishMarkers at our ZoneID * 2 + 1
GEvent.addListener(ZoneStartFinishMarkers[idFinish], "dragend", function() {
             //  Creates the Listener for the FinishMarker
var Point = FinishMarker.getPoint();         //  Gets the new location of
the marker
UpdateString = "F," + Point;         //  Sets the update string to the new
location - F indicates Finish
} );

//======================================================================================================================================
//  Set the options for the BreadCrumb Marker Manager
//------------------------------------------------------------------------------------------------------------------------------------------------
ZoneStartFinishMMOptions = { borderPadding: 50, maxZoom: 20, trackMarkers:
true };
//=====================================================================================================================================
//======================================================================================================================================
//  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
//------------------------------------------------------------------------------------------------------------------------------------------------
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 {
ZoneStartFinishMM = new MarkerManager(Map, ZoneStartFinishMMOptions);
ZoneStartFinishMM.addMarker(ZoneStartFinishMarkers[idStart], 0);
ZoneStartFinishMM.addMarker(ZoneStartFinishMarkers[idFinish], 0);
ZoneStartFinishMM.refresh();
} //  End else !ZoneStartFinishMM
//======================================================================================================================================

I have several functions to add my markers to my map, but I am pretty much
doing the same thing each time.  Now I need each marker to have a unique id
or to be able to call the name or id of the listener for the marker.  I need
to include this into my update string.  Any ideas?

On Fri, May 21, 2010 at 6:41 PM, [email protected]
<[email protected]>wrote:

> On May 21, 2:58 pm, nlraley82 <[email protected]> wrote:
> > Well my markers were created as generic start and finish markers;
> however,
> > they were stored in separate locations in the array.  Each marker does
> have
> > a unique listener event for them though.  Is there a way to pull the id
> of
> > the listener event or do I need to rework the marker names real quick
> during
> > the marker creation?
>
> I would think there would be a way to get an id associated with the
> maker somehow without reworking your existing code, but I can only
> guess as you haven't provided a link to your map as requested in the
> posting guidelines (and I am done guessing)
>
>
> http://groups.google.com/group/google-maps-api/web/suggested-posting-guidelines
>
> http://groups.google.com/group/Google-Maps-API/web/why-including-a-link-is-critical
>
>  -- Larry
>
>
> >
> > Thanks,
> > Nathan
> >
> > On Fri, May 21, 2010 at 4:49 PM, [email protected]
> > <[email protected]>wrote:
> >
> >
> >
> >
> >
> > > On May 21, 2:38 pm, nlraley82 <[email protected]> wrote:
> > > > I have went through and created markers as I have been reading the
> points
> > > > from parts of my code in c++.  I was wandering.  I have created a
> dragend
> > > > event for each marker with the event listener being created
> dynamically
> > > for
> > > > each new marker, ie each marker has its own event listener.
> >
> > > > Is there any way I can retrieve either the id of the marker or
> preferably
> > > > the id of the event listener on this drag end event so I can tell
> which
> > > > item's marker is actually being dragged?
> >
> > > Yes.  If you followed Mike's tutorials and are using function closure,
> > > you should be able to access any properties of the marker and the
> > > values of any variables in the function on which you got closure.
> >
> > >  -- Larry
> >
> > > > --
> > > > 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]<google-maps-api%[email protected]>
> <google-maps-api%2bunsubscr...@­googlegroups.com>
> > > .
> > > > For more options, visit this group athttp://
> > > groups.google.com/group/google-maps-api?hl=en.
> >
> > > --
> > > 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]<google-maps-api%[email protected]>
> <google-maps-api%2bunsubscr...@­googlegroups.com>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-maps-api?hl=en.
> >
> > --
> > 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]<google-maps-api%[email protected]>
> .
> > For more options, visit this group athttp://
> groups.google.com/group/google-maps-api?hl=en.- Hide quoted text -
> >
> > - Show quoted text -
>
> --
> 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]<google-maps-api%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-maps-api?hl=en.
>
>

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