| 1 | var map;
|
|---|
| 2 | var marker;
|
|---|
| 3 | var lat;
|
|---|
| 4 | var lon;
|
|---|
| 5 | var latOffset;
|
|---|
| 6 | var lonOffset;
|
|---|
| 7 | var polygon;
|
|---|
| 8 | var pos;
|
|---|
| 9 | var point;
|
|---|
| 10 | var range = 500;
|
|---|
| 11 |
|
|---|
| 12 | function nodeAdd() {
|
|---|
| 13 | if (GBrowserIsCompatible()) {
|
|---|
| 14 | map = new GMap2(document.getElementById("mapcanvas"));
|
|---|
| 15 | map.setCenter(new GLatLng(52.162687, 4.493294), 14);
|
|---|
| 16 | map.setUIToDefault();
|
|---|
| 17 |
|
|---|
| 18 | marker = new GMarker(new GLatLng(52.165700, 4.483499));
|
|---|
| 19 | GEvent.addListener(marker, "click", function () {
|
|---|
| 20 | marker.openInfoWindowHtml("Test, Test, You suck! Eindelijk, het werkt!!!!");
|
|---|
| 21 | });
|
|---|
| 22 |
|
|---|
| 23 | //Added mouseover listener that calls on our mouseOver function when the mouse moves over a marker on the map
|
|---|
| 24 | GEvent.addListener(marker, "mouseover", function() {
|
|---|
| 25 | map.addOverlay(cirkel);;
|
|---|
| 26 | });
|
|---|
| 27 |
|
|---|
| 28 | //mouseout listener that removes the cirkel once the user moves his mouse off the designated marker
|
|---|
| 29 | GEvent.addListener(marker, "mouseout", function() {
|
|---|
| 30 | map.removeOverlay(cirkel);
|
|---|
| 31 | });
|
|---|
| 32 |
|
|---|
| 33 | //adds a cirkel when the user clicks on the marker
|
|---|
| 34 | GEvent.addListener(marker, "click", function() {
|
|---|
| 35 | map.addOverlay(cirkel1);
|
|---|
| 36 | });
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 | GPolygon.Shape = function(point,r1,r2,r3,r4,rotation,vertexCount, strokeColour,strokeWeight,Strokepacity,fillColour,fillOpacity,opts,tilt) {
|
|---|
| 40 | var rot = -rotation*Math.PI/180;
|
|---|
| 41 | var points = [];
|
|---|
| 42 | var latConv = point.distanceFrom(new GLatLng(point.lat()+0.1,point.lng()))*10;
|
|---|
| 43 | var lngConv = point.distanceFrom(new GLatLng(point.lat(),point.lng()+0.1))*10;
|
|---|
| 44 | var step = (360/vertexCount)||10;
|
|---|
| 45 |
|
|---|
| 46 | var flop = -1;
|
|---|
| 47 | if (tilt) {
|
|---|
| 48 | var I1=180/vertexCount;
|
|---|
| 49 | } else {
|
|---|
| 50 | var I1=0;
|
|---|
| 51 | }
|
|---|
| 52 | for(var i=I1; i<=360.001+I1; i+=step) {
|
|---|
| 53 | var r1a = flop?r1:r3;
|
|---|
| 54 | var r2a = flop?r2:r4;
|
|---|
| 55 | flop = -1-flop;
|
|---|
| 56 | var y = r1a * Math.cos(i * Math.PI/180);
|
|---|
| 57 | var x = r2a * Math.sin(i * Math.PI/180);
|
|---|
| 58 | var lng = (x*Math.cos(rot)-y*Math.sin(rot))/lngConv;
|
|---|
| 59 | var lat = (y*Math.cos(rot)+x*Math.sin(rot))/latConv;
|
|---|
| 60 |
|
|---|
| 61 | points.push(new GLatLng(point.lat()+lat,point.lng()+lng));
|
|---|
| 62 | }
|
|---|
| 63 | return (new GPolygon(points,strokeColour,strokeWeight,Strokepacity,fillColour,fillOpacity,opts))
|
|---|
| 64 | }
|
|---|
| 65 |
|
|---|
| 66 | GPolygon.Circle = function(point,radius,strokeColour,strokeWeight,Strokepacity,fillColour,fillOpacity,opts) {
|
|---|
| 67 | return GPolygon.Shape(point,radius,radius,radius,radius,0,100,strokeColour,strokeWeight,Strokepacity,fillColour,fillOpacity,opts)
|
|---|
| 68 | }
|
|---|
| 69 |
|
|---|
| 70 | // http://econym.org.uk/gmap/eshapes.htm voorbeeld.
|
|---|
| 71 | // de locatie van de cirkel
|
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 | // locatie, doorsnee (in meters), kleur omtrek, dikte omtrek, ??, kleur opvulling, doorzichtigheid.
|
|---|
| 75 | map.addOverlay(marker);
|
|---|
| 76 | cirkel = new GPolygon.Circle(marker.getLatLng(),range,"#000000",0,1,"#00ff00",0.5)
|
|---|
| 77 | cirkel1 = new GPolygon.Circle(marker.getLatLng(),range,"#000000",0,1,"#00ff00",0.5)
|
|---|
| 78 |
|
|---|
| 79 | }
|
|---|
| 80 | }
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
|
|---|