diff options
author | Manuel Munz <freifunk@somakoma.de> | 2011-03-12 17:13:36 +0000 |
---|---|---|
committer | Manuel Munz <freifunk@somakoma.de> | 2011-03-12 17:13:36 +0000 |
commit | 945076c895cce30a862c68bd32205b74f30098cd (patch) | |
tree | cc5e6d3620cae3e805bd303b71a3e1b49f256638 /applications/luci-ffwizard/htdocs/luci-static | |
parent | 3b4450a58bbdd026306cc3778314998c08f6c753 (diff) |
modules/freifunk: OSM in basics fixed thanks to Andreas Pittrich
Diffstat (limited to 'applications/luci-ffwizard/htdocs/luci-static')
-rw-r--r-- | applications/luci-ffwizard/htdocs/luci-static/resources/OSMLatLon.htm | 20 | ||||
-rw-r--r-- | applications/luci-ffwizard/htdocs/luci-static/resources/osm.js | 130 |
2 files changed, 0 insertions, 150 deletions
diff --git a/applications/luci-ffwizard/htdocs/luci-static/resources/OSMLatLon.htm b/applications/luci-ffwizard/htdocs/luci-static/resources/OSMLatLon.htm deleted file mode 100644 index 30ad5bc34d..0000000000 --- a/applications/luci-ffwizard/htdocs/luci-static/resources/OSMLatLon.htm +++ /dev/null @@ -1,20 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> - -<head> - <title>OpenStreetMap</title> - <script type="text/javascript" src="http://www.openlayers.org/api/OpenLayers.js"></script> - <script type="text/javascript" src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"></script> - <script type="text/javascript" src="osm.js"></script> -</head> -<body onload="init();drawmap();" style="padding:0px; margin:0px"> - <div id="map"></div> - <div style="position:absolute; bottom:0%; width:100%; background:url('cbi/black_60.png'); font-size:10px; color:#fff;z-index:1000"> - Map by <a href="http://www.openstreetmap.org" title="www.openstreetmap.org" style="color:#fff;" >openstreetmap.org</a>, License CC-BY-SA - - <span id="osm"> - Latitude: <input id="osmlat" name="osmlat" type="text" size="20" style="font-size:10px;"> - Longitude: <input id="osmlon" name="osmlon" type="text" size="20" style="font-size:10px;"> - </span> - </div> - -</body> diff --git a/applications/luci-ffwizard/htdocs/luci-static/resources/osm.js b/applications/luci-ffwizard/htdocs/luci-static/resources/osm.js deleted file mode 100644 index 4138ef6ad2..0000000000 --- a/applications/luci-ffwizard/htdocs/luci-static/resources/osm.js +++ /dev/null @@ -1,130 +0,0 @@ -var map; -var layer_mapnik; -var layer_tah; -var layer_markers; -var PI = Math.PI; -var latfield = ''; -var lonfield = ''; -var latfield_id=''; -var lonfield_id=''; -var centerlon = 10; -var centerlat = 52; -var zoom = 6; - -function lon2merc(lon) { - return 20037508.34 * lon / 180; -} - -function lat2merc(lat) { - lat = Math.log(Math.tan( (90 + lat) * PI / 360)) / PI; - return 20037508.34 * lat; -} - -function merc2lon(lon) { - return lon*180/20037508.34; -}; - -function merc2lat(lat) { - return Math.atan(Math.exp(lat*PI/20037508.34))*360/PI-90; -}; - -OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, { - defaultHandlerOptions: { - 'single': true, - 'double': false, - 'pixelTolerance': 0, - 'stopSingle': false, - 'stopDouble': false - }, - - initialize: function(options) { - this.handlerOptions = OpenLayers.Util.extend( - {}, this.defaultHandlerOptions - ); - OpenLayers.Control.prototype.initialize.apply( - this, arguments - ); - this.handler = new OpenLayers.Handler.Click( - this, { - 'click': this.trigger - }, this.handlerOptions - ); - }, - - trigger: function(e) { - var lonlat = map.getLonLatFromViewPortPx(e.xy); - lat=merc2lat(lonlat.lat); - lon=merc2lon(lonlat.lon); - if(parent.document.getElementById(latfield_id)==null){ - latfield=document.getElementById('osmlat'); - }else{ - latfield=parent.document.getElementById(latfield_id); - } - if(parent.document.getElementById(lonfield_id)==null){ - lonfield=document.getElementById('osmlon'); - }else{ - lonfield=parent.document.getElementById(lonfield_id); - } - latfield.value = lat; - lonfield.value = lon; - } -}); - -function init(){ - var field = window.name.substring(0, window.name.lastIndexOf(".")); - if(parent.document.getElementById(field+".latfield")!=null){ - latfield_id = parent.document.getElementById(field+".latfield").value; - document.getElementById('osm').style.display="none"; - } - if(parent.document.getElementById(field+".lonfield")!=null){ - lonfield_id = parent.document.getElementById(field+".lonfield").value; - } - if(parent.document.getElementById(field+".centerlat")!=null){ - centerlat =parseFloat(parent.document.getElementById(field+".centerlat").value); - } - if(parent.document.getElementById(field+".centerlon")!=null){ - centerlon = parseFloat(parent.document.getElementById(field+".centerlon").value); - } - if(parent.document.getElementById(field+".zoom")!=null){ - zoom = parseFloat(parent.document.getElementById(field+".zoom").value); - } -} - -function drawmap() { - OpenLayers.Lang.setCode('de'); - mapdiv=document.getElementById('map'); - mapdiv.style.height=window.innerHeight+"px"; - mapdiv.style.width=window.innerWidth+"px"; - map = new OpenLayers.Map('map', { - projection: new OpenLayers.Projection("EPSG:900913"), - displayProjection: new OpenLayers.Projection("EPSG:4326"), - controls: [ - new OpenLayers.Control.MouseDefaults(), - new OpenLayers.Control.PanZoomBar()], - maxExtent: - new OpenLayers.Bounds(-20037508.34,-20037508.34, 20037508.34, 20037508.34), - numZoomLevels: 18, - maxResolution: 156543, - units: 'meters' - }); - - layer_mapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik"); - - map.addLayers([layer_mapnik]); - var y =lat2merc(centerlat); - var x =lon2merc(centerlon); - map.setCenter(new OpenLayers.LonLat(x, y), zoom); - - // Check for geolocation support - if(navigator.geolocation){ - navigator.geolocation.getCurrentPosition(function(position){ - var y =lat2merc(position.coords.latitude); - var x =lon2merc(position.coords.longitude); - map.setCenter(new OpenLayers.LonLat(x, y), '17'); - }); - } - - var click = new OpenLayers.Control.Click(); - map.addControl(click); - click.activate(); -} |