Draw a Layering Circle Bubble on the Google Geomap

/* This is for Draw Polygon based on value */
public function drawCircle(lat:Number, lng:Number, radius:Number,strokeColor:Number, strokeWidth:Number, strokeOpacity:Number,fillColor:Number,fillOpacity:Number):Polygon {
var d2r:Number = Math.PI/180;
var r2d:Number = 180/Math.PI;
var circleLat:Number = radius * 0.014483; // Convert statutemiles into degrees latitude
var circleLng:Number = circleLat/Math.cos(lat*d2r);

var circleLatLngs:Array = new Array();
var latLng:LatLng;
for (var i:Number = 0; i < 33; i++) {
var theta:Number = Math.PI * (i/16);
var vertexLat:Number = lat + (circleLat * Math.sin(theta));
var vertexLng:Number = lng + (circleLng * Math.cos(theta));
latLng = new LatLng(vertexLat, vertexLng);
circleLatLngs.push(latLng);
}

var bounds:LatLngBounds = new LatLngBounds();
var j:int;
for (i = 0; i < circleLatLngs.length; i++) {
bounds.extend(circleLatLngs[i]);
}
//var st:String = bounds.getCenter();
var numf:NumberFormatter = new NumberFormatter();
numf.precision = 2;
numf.rounding = "up";

// The Center of the Bermuda Triangle – (25.3939245, -72.473816)
var polygonOptions:PolygonOptions = new PolygonOptions();
var fillStyle:FillStyle = new FillStyle();
fillStyle.alpha = fillOpacity;
fillStyle.color = fillColor;
polygonOptions.fillStyle = fillStyle;

var strokeStyle:StrokeStyle = new StrokeStyle();
strokeStyle.alpha = strokeOpacity;
strokeStyle.color = strokeColor;
strokeStyle.thickness = strokeWidth;
polygonOptions.strokeStyle = strokeStyle;
var polygon:Polygon = new Polygon(circleLatLngs, polygonOptions);
map.addOverlay(polygon);
return polygon;
}

About ashokabhat

I am a C,C ,JAVA,Adobe Flex,.NET Programmer Currently working as a Software Developer
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s