|
Last change
on this file since 7797 was 7793, checked in by janveeden, 16 years ago |
|
David: Fixed the lat long issue. Typecast to number was need. Your circles are now on map. Please fix them to the background, and make the hiding at start.
|
|
File size:
685 bytes
|
| Line | |
|---|
| 1 | function drawCircle(lat, lng, radius, strokeColor, strokeWidth, strokeOpacity, fillColor, fillOpacity) {
|
|---|
| 2 |
|
|---|
| 3 | var d2r = Math.PI/180;
|
|---|
| 4 | var r2d = 180/Math.PI;
|
|---|
| 5 | var Clat = radius * 0.0089437672; // Convert statute kilometers into degrees latitude
|
|---|
| 6 | var Clng = Clat/Math.cos(lat*d2r);
|
|---|
| 7 | var Cpoints = [];
|
|---|
| 8 | for (var i=0; i < 33; i++) {
|
|---|
| 9 | var theta = Math.PI * (i/16);
|
|---|
| 10 | Cy = lat + (Clat * Math.sin(theta));
|
|---|
| 11 | Cx = lng + (Clng * Math.cos(theta));
|
|---|
| 12 | var P = new GLatLng(Cy, Cx);
|
|---|
| 13 | Cpoints.push(P);
|
|---|
| 14 | }
|
|---|
| 15 |
|
|---|
| 16 | polygon = new GPolygon(Cpoints, strokeColor, strokeWidth, strokeOpacity, fillColor, fillOpacity);
|
|---|
| 17 | return polygon;
|
|---|
| 18 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.