var map; var marker; var lat; var lon; var latOffset; var lonOffset; var polygon; var pos; var point; var range = 500; function nodeAdd() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("mapcanvas")); map.setCenter(new GLatLng(52.162687, 4.493294), 14); map.setUIToDefault(); marker = new GMarker(new GLatLng(52.165700, 4.483499)); GEvent.addListener(marker, "click", function () { marker.openInfoWindowHtml("Test, Test, You suck! Eindelijk, het werkt!!!!"); }); //Added mouseover listener that calls on our mouseOver function when the mouse moves over a marker on the map GEvent.addListener(marker, "mouseover", function() { map.addOverlay(cirkel);; }); //mouseout listener that removes the cirkel once the user moves his mouse off the designated marker GEvent.addListener(marker, "mouseout", function() { map.removeOverlay(cirkel); }); //adds a cirkel when the user clicks on the marker GEvent.addListener(marker, "click", function() { map.addOverlay(cirkel1); }); GPolygon.Shape = function(point,r1,r2,r3,r4,rotation,vertexCount, strokeColour,strokeWeight,Strokepacity,fillColour,fillOpacity,opts,tilt) { var rot = -rotation*Math.PI/180; var points = []; var latConv = point.distanceFrom(new GLatLng(point.lat()+0.1,point.lng()))*10; var lngConv = point.distanceFrom(new GLatLng(point.lat(),point.lng()+0.1))*10; var step = (360/vertexCount)||10; var flop = -1; if (tilt) { var I1=180/vertexCount; } else { var I1=0; } for(var i=I1; i<=360.001+I1; i+=step) { var r1a = flop?r1:r3; var r2a = flop?r2:r4; flop = -1-flop; var y = r1a * Math.cos(i * Math.PI/180); var x = r2a * Math.sin(i * Math.PI/180); var lng = (x*Math.cos(rot)-y*Math.sin(rot))/lngConv; var lat = (y*Math.cos(rot)+x*Math.sin(rot))/latConv; points.push(new GLatLng(point.lat()+lat,point.lng()+lng)); } return (new GPolygon(points,strokeColour,strokeWeight,Strokepacity,fillColour,fillOpacity,opts)) } GPolygon.Circle = function(point,radius,strokeColour,strokeWeight,Strokepacity,fillColour,fillOpacity,opts) { return GPolygon.Shape(point,radius,radius,radius,radius,0,100,strokeColour,strokeWeight,Strokepacity,fillColour,fillOpacity,opts) } // http://econym.org.uk/gmap/eshapes.htm voorbeeld. // de locatie van de cirkel // locatie, doorsnee (in meters), kleur omtrek, dikte omtrek, ??, kleur opvulling, doorzichtigheid. map.addOverlay(marker); cirkel = new GPolygon.Circle(marker.getLatLng(),range,"#000000",0,1,"#00ff00",0.5) cirkel1 = new GPolygon.Circle(marker.getLatLng(),range,"#000000",0,1,"#00ff00",0.5) } }