Changeset 7710 for trunk/src/map
- Timestamp:
- Apr 9, 2010, 6:00:55 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/map/inc/overlay.js
r7708 r7710 6 6 var lonOffset; 7 7 var polygon; 8 var pos; 9 var point; 8 10 9 /*function nodeAdd() { 11 /* 12 function nodeAdd() { 10 13 if (GBrowserIsCompatible()) { 11 14 map = new GMap2(document.getElementById("mapcanvas")); 12 15 map.setCenter(new GLatLng(52.162687, 4.493294), 12); 13 16 map.setUIToDefault(); 14 17 15 18 marker = new GMarker(map.getCenter()); 16 19 GEvent.addListener(marker, "click", function () { 17 20 marker.openInfoWindowHtml("Test, Test, You suck! Eindelijk, het werkt!!!!"); 18 21 }); 22 23 24 25 26 GPolygon.Shape = function(point,r1,r2,r3,r4,rotation,vertexCount, strokeColour,strokeWeight,Strokepacity,fillColour,fillOpacity,opts,tilt) { 27 var rot = -rotation*Math.PI/180; 28 var points = []; 29 var latConv = point.distanceFrom(new GLatLng(point.lat()+0.1,point.lng()))*10; 30 var lngConv = point.distanceFrom(new GLatLng(point.lat(),point.lng()+0.1))*10; 31 var step = (360/vertexCount)||10; 32 33 var flop = -1; 34 if (tilt) { 35 var I1=180/vertexCount; 36 } else { 37 var I1=0; 38 } 39 for(var i=I1; i<=360.001+I1; i+=step) { 40 var r1a = flop?r1:r3; 41 var r2a = flop?r2:r4; 42 flop = -1-flop; 43 var y = r1a * Math.cos(i * Math.PI/180); 44 var x = r2a * Math.sin(i * Math.PI/180); 45 var lng = (x*Math.cos(rot)-y*Math.sin(rot))/lngConv; 46 var lat = (y*Math.cos(rot)+x*Math.sin(rot))/latConv; 47 48 points.push(new GLatLng(point.lat()+lat,point.lng()+lng)); 49 } 50 return (new GPolygon(points,strokeColour,strokeWeight,Strokepacity,fillColour,fillOpacity,opts)) 51 } 52 53 GPolygon.Circle = function(point,radius,strokeColour,strokeWeight,Strokepacity,fillColour,fillOpacity,opts) { 54 return GPolygon.Shape(point,radius,radius,radius,radius,0,100,strokeColour,strokeWeight,Strokepacity,fillColour,fillOpacity,opts) 55 } 56 57 // http://econym.org.uk/gmap/eshapes.htm voorbeeld. 58 var point = new GLatLng(52.162687, 4.493294); 59 map.addOverlay(GPolygon.Circle(point,500,"#000000",1,1,"#00ff00",0.5)); 19 60 map.addOverlay(marker); 20 21 GEvent.addListener(map, "click", function(overlay,latlng) {22 lat = latlng.lat();23 lon = latlng.lng();24 latOffset = 0.01;25 lonOffset = 0.01;26 polygon = new GPolygon([27 new GLatLng(lat, lon - lonOffset),28 new GLatLng(lat + latOffset, lon),29 new GLatLng(lat, lon + lonOffset),30 new GLatLng(lat - latOffset, lon),31 new GLatLng(lat, lon - lonOffset)32 ], "#f33f00", 5, 1, "#ff0000", 0.2);33 map.addOverlay(polygon);34 });*/35 36 61 37 62 } 38 63 } 39 64 65 */ 66 67 68 69 70
Note:
See TracChangeset
for help on using the changeset viewer.