[7703] | 1 | var map;
|
---|
[7707] | 2 | var marker;
|
---|
| 3 | var lat;
|
---|
| 4 | var lon;
|
---|
| 5 | var latOffset;
|
---|
| 6 | var lonOffset;
|
---|
| 7 | var polygon;
|
---|
[7710] | 8 | var pos;
|
---|
| 9 | var point;
|
---|
[7740] | 10 | var range = 500;
|
---|
[7703] | 11 |
|
---|
[7710] | 12 | function nodeAdd() {
|
---|
[7707] | 13 | if (GBrowserIsCompatible()) {
|
---|
[7703] | 14 | map = new GMap2(document.getElementById("mapcanvas"));
|
---|
[7751] | 15 | map.setCenter(new GLatLng(52.162687, 4.493294), 14);
|
---|
[7703] | 16 | map.setUIToDefault();
|
---|
[7710] | 17 |
|
---|
[7751] | 18 | marker = new GMarker(new GLatLng(52.165700, 4.483499));
|
---|
[7707] | 19 | GEvent.addListener(marker, "click", function () {
|
---|
| 20 | marker.openInfoWindowHtml("Test, Test, You suck! Eindelijk, het werkt!!!!");
|
---|
| 21 | });
|
---|
[7710] | 22 |
|
---|
[7740] | 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 | });
|
---|
[7710] | 27 |
|
---|
[7740] | 28 | GEvent.addListener(marker, "mouseout", function() {
|
---|
| 29 | map.removeOverlay(cirkel);
|
---|
| 30 | });
|
---|
[7710] | 31 |
|
---|
[7740] | 32 |
|
---|
| 33 |
|
---|
| 34 |
|
---|
[7710] | 35 | GPolygon.Shape = function(point,r1,r2,r3,r4,rotation,vertexCount, strokeColour,strokeWeight,Strokepacity,fillColour,fillOpacity,opts,tilt) {
|
---|
| 36 | var rot = -rotation*Math.PI/180;
|
---|
| 37 | var points = [];
|
---|
| 38 | var latConv = point.distanceFrom(new GLatLng(point.lat()+0.1,point.lng()))*10;
|
---|
| 39 | var lngConv = point.distanceFrom(new GLatLng(point.lat(),point.lng()+0.1))*10;
|
---|
| 40 | var step = (360/vertexCount)||10;
|
---|
| 41 |
|
---|
| 42 | var flop = -1;
|
---|
| 43 | if (tilt) {
|
---|
| 44 | var I1=180/vertexCount;
|
---|
| 45 | } else {
|
---|
| 46 | var I1=0;
|
---|
| 47 | }
|
---|
| 48 | for(var i=I1; i<=360.001+I1; i+=step) {
|
---|
| 49 | var r1a = flop?r1:r3;
|
---|
| 50 | var r2a = flop?r2:r4;
|
---|
| 51 | flop = -1-flop;
|
---|
| 52 | var y = r1a * Math.cos(i * Math.PI/180);
|
---|
| 53 | var x = r2a * Math.sin(i * Math.PI/180);
|
---|
| 54 | var lng = (x*Math.cos(rot)-y*Math.sin(rot))/lngConv;
|
---|
| 55 | var lat = (y*Math.cos(rot)+x*Math.sin(rot))/latConv;
|
---|
| 56 |
|
---|
| 57 | points.push(new GLatLng(point.lat()+lat,point.lng()+lng));
|
---|
| 58 | }
|
---|
| 59 | return (new GPolygon(points,strokeColour,strokeWeight,Strokepacity,fillColour,fillOpacity,opts))
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | GPolygon.Circle = function(point,radius,strokeColour,strokeWeight,Strokepacity,fillColour,fillOpacity,opts) {
|
---|
| 63 | return GPolygon.Shape(point,radius,radius,radius,radius,0,100,strokeColour,strokeWeight,Strokepacity,fillColour,fillOpacity,opts)
|
---|
| 64 | }
|
---|
| 65 |
|
---|
| 66 | // http://econym.org.uk/gmap/eshapes.htm voorbeeld.
|
---|
[7740] | 67 | // de locatie van de cirkel
|
---|
[7751] | 68 |
|
---|
| 69 |
|
---|
[7740] | 70 | // locatie, doorsnee (in meters), kleur omtrek, dikte omtrek, doorzichtigheid opvulling, kleur opvulling, doorzichtigheid.
|
---|
[7707] | 71 | map.addOverlay(marker);
|
---|
[7751] | 72 | cirkel = new GPolygon.Circle(marker.getLatLng(),range,"#000000",1,1,"#00ff00",0.5)
|
---|
[7707] | 73 |
|
---|
| 74 | }
|
---|
[7703] | 75 | }
|
---|
[7710] | 76 |
|
---|
[7740] | 77 | //Our mouseover function
|
---|
| 78 | /*function mouseOver(dekking)
|
---|
| 79 | {
|
---|
| 80 | //For now we only post the id(We made ourself in kmlHandler) and the name of the node
|
---|
| 81 | map.addOverlay(GPolygon.Circle(point,500,"#000000",1,1,"#00ff00",0.5));
|
---|
| 82 | //We will replace this function with a httprequest to a php file in the future
|
---|
| 83 | }
|
---|
[7710] | 84 | */
|
---|
| 85 |
|
---|
| 86 |
|
---|
| 87 |
|
---|
| 88 |
|
---|
[7740] | 89 |
|
---|
| 90 |
|
---|
| 91 |
|
---|
[7707] | 92 |
|
---|