Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/11/2009, 06:12
RhOsS
 
Fecha de Ingreso: noviembre-2007
Mensajes: 65
Antigüedad: 16 años, 5 meses
Puntos: 0
Circulos en API google Maps

Buenos dias a todos,

estoy intentando dibujar un circulo que sea de radio constante con el zoom, he sacado el codigo de por ahi, pero no consigo hacerlo correr en un mapa sencillo:

A ver si alguien puede echarme una manita.

Gracias y un saludo.

Código:
var lastPointx = 37.352692;
var lastPointy = -4.746093;
	
  var polySmallRadius = 200;
  var polyNumSides = 20;
  var polySideLength = 18;

  for (var a=0;a<21;a++)
  {
    var aRad = polySideLength*a* (3.14/180);
    var polyRadius = polySmallRadius;
    var pixelX = lastPointx + polyRadius * Math.cos(aRad);
    var pixelY = lastPointy + polyRadius * Math.sin(aRad);
    var polyPixel = new GPoint(pixelX, pixelY);
    var polyPoint = map.fromPixelToLatLng(polyPixel,8);
    polyPoints.push(polyPoint);
  }

  var polygon = new GPolygon(polyPoints, "#000000", 1, 1, "#000000",0.1);

  aPolygons.push(polygon);
  map.addOverlay(polygon);