Hey Phil,
The code I posted was for google maps api2 (I also wrote in my first
post: "In gmaps2 I was using"..).

I saw this example you are referring to, but the problem is that I
want a circle that is restricted by pixels, so it won't change with
each zoom level.

With the default api3 circle object - the radius is given in km and
when I zoom in, the circle becomes bigger and bigger.

I could use the getZoom function on the map and change the radius of
the circle every time when the user zooms in or out, but I find this
somehow stupid.

On Dec 24, 12:59 pm, Pil <[email protected]> wrote:
> This code is unclear: is it v2 or v3 or a mix of both?
>
> If you want to use v3 there is already an example within the code
> samples - although it's not been seen in the documentation. But it's
> documented in the v3 reference.
>
> http://gmaps-samples-v3.googlecode.com/svn/trunk/circle-overlay/circl...
>
> On Dec 24, 11:43 am, THE_AI <[email protected]> wrote:
>
> > Hey guys!
> > In gmaps2 I was using the following code to draw a circle around the
> > marker the user mouse is currently on:
>
> > //currentMarker is a marker object
> > var markerPoint = currentMarker.getPoint();
>
> >                 var polyPoints = Array();
>
> >                 if (highlightCircle) {
> >                         map.removeOverlay(highlightCircle);
> >                 }
>
> >                 var mapNormalProj = G_NORMAL_MAP.getProjection();
> >                 var mapZoom = map.getZoom();
> >                 var clickedPixel = 
> > mapNormalProj.fromLatLngToPixel(markerPoint,
> > mapZoom);
>
> >                 var polySmallRadius = 20;
>
> >                 var polyNumSides = 20;
> >                 var polySideLength = 18;
>
> >                 for (var a = 0; a<(polyNumSides+1); a++) {
> >                         var aRad = polySideLength*a*(Math.PI/180);
> >                         var polyRadius = polySmallRadius;
> >                         var pixelX = clickedPixel.x + 5 + polyRadius * 
> > Math.cos(aRad);
> >                         var pixelY = clickedPixel.y - 10 + polyRadius * 
> > Math.sin(aRad);
> >                         var polyPixel = new GPoint(pixelX,pixelY);
> >                         var polyPoint = 
> > mapNormalProj.fromPixelToLatLng(polyPixel,mapZoom);
> >                         polyPoints.push(polyPoint);
> >                 }
> >                 // Using GPolygon(points,  strokeColor?,  strokeWeight?,
> > strokeOpacity?,  fillColor?,  fillOpacity?)
> >                 highlightCircle = new 
> > GPolygon(polyPoints,"#000000",2,0.0,"#FF0000",.
> > 5);
> >                 map.addOverlay(highlightCircle);
>
> > In google maps api3 I saw that there is a circle object and it is
> > really easy to use, but it doesn't have the effect I'm looking for.
>
> > The circle size should not change when the user zooms in.
>
> > I tried to transform the above example to api3, but I couldn't find
> > fromLatLngToPixel and fromPixelToLatLng functions.
>
> > What would be the best way to draw a circle and bind it to the
> > currently active marker? Thank you in advance!
>
>

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

Reply via email to