On Feb 2, 5:16 am, Leonardo Ribeiro <[email protected]> wrote:
> Ohh thanks! Its working very well.
> My last problem now is just to know how can I remove a circle from map.
> In the center of circle there is a GMarker.
> So, I need that when rightclick on the marker, it removes the circle and
> marker too.
> My current function is:
>
> --------------------------------------------------------------------------- 
> --------------------------
>         GEvent.addListener(map, "singlerightclick",
> function(point,src,overlay)
>         {
>             if (overlay instanceof GMarker)
>             {
>                 //polys is a array of my circles. example:
>                 //var circle = new GPolygon(circlePoints, '#000000', 2, 1,
> '#000000', 0.25);
>                 //polys.push(circle);
>                 //and currentcircle = 1...2...3...
>                 map.removeOverlay(polys[currentcircle]);
>                 map.removeOverlay(overlay);
>             }
> --------------------------------------------------------------------------- 
> --------------------------
>
> This function not works. Just the marker is removed.
> How can I remove the circle?



That probably means that polys[currentcircle} is not a valid reference
to the circle you want to remove.  If you post a link to your map as
recommended in the posting guidelines, we could tell for sure and
possible recommend a solution.

  -- Larry



> Thanks again!!!
>
> On Mon, Feb 2, 2009 at 9:20 AM, Rossko <[email protected]> wrote:
>
> > > Keep your circle centres and radii in an array, then loop through that
> > > array testing each circle.
>
> > I think that was the important part of Mike's hint.
>
> > Something like -
> > Plot circles and remember centres and radius
> >  mycentres[n] = xxx
> >  myradius[n] = rrr
> >  next circle, increment n
>
> > Test on click by looping through circles ...
> > For each [n]
> > Test if clicked point is within myradius[n] from mycentres[n]
> > If yes, alert ('circle' + n + 'clicked')
>
> > Take care about whether you are working in pixels or lat/longs
>
> > cheers, Ross K
--~--~---------~--~----~------------~-------~--~----~
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