diff gnv/src/main/webapp/scripts/viewport.jsp @ 984:cfc7bd35ee0b

Set the map to the extent which was sent by the rest-server gnv/trunk@1167 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Mon, 07 Jun 2010 14:52:45 +0000
parents 45ea5feb94c0
children f55692e3e0ce
line wrap: on
line diff
--- a/gnv/src/main/webapp/scripts/viewport.jsp	Mon Jun 07 12:35:49 2010 +0000
+++ b/gnv/src/main/webapp/scripts/viewport.jsp	Mon Jun 07 14:52:45 2010 +0000
@@ -1,9 +1,11 @@
 <%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%>
 <%@page import="de.intevation.gnv.action.MapClientStandaloneAction"%>
+<%@page import="de.intevation.gnv.artifactdatabase.objects.map.MapService"%>
 <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
 <%
 boolean standalone = request.getParameter(MapClientStandaloneAction.MAPCLIENTSTANDALONE_KEY) != null &&
 request.getParameter(MapClientStandaloneAction.MAPCLIENTSTANDALONE_KEY).equals("true");
+MapService mapService = SessionModelFactory.getInstance().getSessionModel(request).getLocalMapService();
 %>
 OpenLayers.ProxyHost= "/cgi-bin/proxy.cgi?url=";
 OpenLayers.Lang.setCode('<%=SessionModelFactory.getInstance().getSessionModel(request).getCurrentLocale().getLanguage() %>');
@@ -15,9 +17,10 @@
  * settings inline the code!
  */
 PROJECTION     = "EPSG:4326";
-MAX_EXTENT     = new OpenLayers.Bounds(-17.44,29.41,40.04,77.66);
+MAX_EXTENT     = new OpenLayers.Bounds(-90,-180,90,180);
+CURRENT_EXTENT = new OpenLayers.Bounds(<%=mapService.getBBoxValue().replace(' ',',')%>);
 INITIAL_CENTER = new OpenLayers.LonLat(5, 55);
-GETFEATUREINFO_URL = "<%=SessionModelFactory.getInstance().getSessionModel(request).getLocalMapService().getURL()%>";
+GETFEATUREINFO_URL = "<%=mapService.getURL()%>";
 
 Ext.onReady(function() {
 
@@ -31,7 +34,6 @@
     var options = {
         maxExtent: MAX_EXTENT,
         projection: PROJECTION,
-        zoom: 5,
         controls: [],
         units: 'm'
     };
@@ -110,7 +112,8 @@
         
     });
 
-    map.setCenter(INITIAL_CENTER);
+    //map.setCenter(INITIAL_CENTER);
+
 
     store = new GeoExt.data.WMSCapabilitiesStore({
     });
@@ -284,4 +287,5 @@
         ]
     });
     <%}%>
+    map.zoomToExtent(CURRENT_EXTENT);
 });

http://dive4elements.wald.intevation.org