From 3a8e39a3968703d9c6aa73a26e4f41ff9bbd1e7f Mon Sep 17 00:00:00 2001 From: etienne Date: Wed, 20 Jan 2010 00:20:58 +0000 Subject: Add a configuration option to restric the map to a revelant box - #71 git-svn-id: http://www.peacefrogs.net/svn/chimere/trunk@52 9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864 --- static/edit_map.js | 6 ++++-- static/edit_route_map.js | 7 +++++-- static/main_map.js | 8 +++++--- 3 files changed, 14 insertions(+), 7 deletions(-) (limited to 'static') diff --git a/static/edit_map.js b/static/edit_map.js index d9b9f12..8f37f6b 100644 --- a/static/edit_map.js +++ b/static/edit_map.js @@ -59,7 +59,7 @@ var putMarker = function (lonlat, zoom){ /* main initialisation function */ function init(){ - map = new OpenLayers.Map ('map_edit', { + var options = { controls:[new OpenLayers.Control.Navigation(), new OpenLayers.Control.PanPanel(), new OpenLayers.Control.ZoomPanel(), @@ -68,7 +68,9 @@ function init(){ units: 'm', projection: epsg_projection, displayProjection: epsg_display_projection - } ); + }; + if (restricted_extent){options['restrictedExtent'] = restricted_extent;} + map = new OpenLayers.Map ('map_edit', options); layerMarkers.setOpacity(0.5); map.addLayers([map_layer, layerMarkers]); map.events.register('click', map, setMarker); diff --git a/static/edit_route_map.js b/static/edit_route_map.js index 491f811..dcf7c84 100644 --- a/static/edit_route_map.js +++ b/static/edit_route_map.js @@ -82,7 +82,7 @@ var pathModify = new OpenLayers.Control.ModifyFeature(vectors, /* main initialisation function */ function init(){ - map = new OpenLayers.Map('map_edit', { + var options = { controls:[new OpenLayers.Control.Navigation(), new OpenLayers.Control.PanPanel(), new OpenLayers.Control.ZoomPanel(), @@ -93,7 +93,10 @@ function init(){ units: 'm', projection: epsg_projection, displayProjection: epsg_display_projection, - } ); + }; + if (restricted_extent){options['restrictedExtent'] = restricted_extent;} + map = new OpenLayers.Map('map_edit', options); + vectors.setOpacity(0.5); map.addLayers([map_layer, vectors]); /* zoom to the appropriate extent */ diff --git a/static/main_map.js b/static/main_map.js index 7cc80a6..1849713 100644 --- a/static/main_map.js +++ b/static/main_map.js @@ -357,7 +357,7 @@ function createParams(center, zoom, layers) { /* main initialisation function */ function init(){ /* set the main map */ - map = new OpenLayers.Map('map', { + var options = { controls:[new OpenLayers.Control.Navigation(), new OpenLayers.Control.PanPanel(), new OpenLayers.Control.ZoomPanel(), @@ -365,8 +365,10 @@ function init(){ maxResolution: 156543.0399, units: 'm', projection: new OpenLayers.Projection('EPSG:4326'), - theme:null - }); + theme:null, + }; + if (restricted_extent){options['restrictedExtent'] = restricted_extent;} + map = new OpenLayers.Map('map', options); permalink = new OpenLayers.Control.Permalink("permalink"); permalink.createParams = createParams; map.addControl(permalink); -- cgit v1.2.3