X-Git-Url: https://dev.renevier.net/?a=blobdiff_plain;f=public%2Fjs%2Fsyjraw.js;h=46a44c255e12e5a60a0b51a456259eda11d09705;hb=facf74e6972eafb727833b85b38b061215dea833;hp=8a77bb0ee948faf92d9495aa8ea27e07e8d7733c;hpb=4022a532856c006efc57fbd8830bde4607c0114d;p=syj.git diff --git a/public/js/syjraw.js b/public/js/syjraw.js index 8a77bb0..46a44c2 100644 --- a/public/js/syjraw.js +++ b/public/js/syjraw.js @@ -1,3 +1,5 @@ +"use strict"; + var WGS84 = new OpenLayers.Projection("EPSG:4326"); var Mercator = new OpenLayers.Projection("EPSG:900913"); @@ -17,30 +19,15 @@ function resizeMap() { map.style.height = map.offsetHeight.toString() + 'px'; } -function mapquestLayer() { - return new OpenLayers.Layer.OSM("Mapquest", [ - 'http://otile1.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png', - 'http://otile2.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png', - 'http://otile3.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png', - 'http://otile4.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png'], - { attribution: SyjStrings.mapquestAttribution}); -} - -function osmLayer() { - return new OpenLayers.Layer.OSM("OSM", [ - 'http://a.tile.openstreetmap.org/${z}/${x}/${y}.png', - 'http://b.tile.openstreetmap.org/${z}/${x}/${y}.png', - 'http://c.tile.openstreetmap.org/${z}/${x}/${y}.png'], - { attribution: SyjStrings.osmAttribution}); -} - function init() { var map = new OpenLayers.Map('map', { - controls: [ new OpenLayers.Control.Attribution() ], + controls: [ + new OpenLayers.Control.Navigation(), + new OpenLayers.Control.Attribution() + ], theme: null}), - parameters = OpenLayers.Util.getParameters(window.location.href), - baseLayer = null, + baseLayer = new OpenLayers.Layer.OSM("OSM", null, { attribution: SyjStrings.osmAttribution }), layerOptions = {format: OpenLayers.Format.WKT, projection: WGS84, @@ -50,24 +37,9 @@ function init() { viewLayer = new OpenLayers.Layer.Vector("View Layer", layerOptions), wkt = new OpenLayers.Format.WKT({ internalProjection: Mercator, externalProjection: WGS84 }); - if (parameters.layer) { - switch (parameters.layer.toUpperCase()) { - case 'M': - baseLayer = mapquestLayer(); - break; - case 'O': - baseLayer = osmLayer(); - break; - } - } - - if (!baseLayer) { - baseLayer = osmLayer(); - } - map.addLayers([baseLayer, viewLayer]); viewLayer.addFeatures([wkt.read(gInitialGeom.data)]); - extent = viewLayer.getDataExtent(); + var extent = viewLayer.getDataExtent(); map.updateSize(); map.zoomToExtent(extent); resizeMap();