|
Last change
on this file since 7785 was 7778, checked in by ddboer, 16 years ago |
|
overlay.js has an drawCircle function.
nodeMap:
-Circle drawn on mouseover with a node
-Circle removed on mouseout
-Latitude and Longtitude from node is not being read or drawn correctly
|
|
File size:
694 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 | map.addOverlay(polygon);
|
|---|
| 18 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.