comparison 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
comparison
equal deleted inserted replaced
983:45ea5feb94c0 984:cfc7bd35ee0b
1 <%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> 1 <%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%>
2 <%@page import="de.intevation.gnv.action.MapClientStandaloneAction"%> 2 <%@page import="de.intevation.gnv.action.MapClientStandaloneAction"%>
3 <%@page import="de.intevation.gnv.artifactdatabase.objects.map.MapService"%>
3 <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> 4 <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
4 <% 5 <%
5 boolean standalone = request.getParameter(MapClientStandaloneAction.MAPCLIENTSTANDALONE_KEY) != null && 6 boolean standalone = request.getParameter(MapClientStandaloneAction.MAPCLIENTSTANDALONE_KEY) != null &&
6 request.getParameter(MapClientStandaloneAction.MAPCLIENTSTANDALONE_KEY).equals("true"); 7 request.getParameter(MapClientStandaloneAction.MAPCLIENTSTANDALONE_KEY).equals("true");
8 MapService mapService = SessionModelFactory.getInstance().getSessionModel(request).getLocalMapService();
7 %> 9 %>
8 OpenLayers.ProxyHost= "/cgi-bin/proxy.cgi?url="; 10 OpenLayers.ProxyHost= "/cgi-bin/proxy.cgi?url=";
9 OpenLayers.Lang.setCode('<%=SessionModelFactory.getInstance().getSessionModel(request).getCurrentLocale().getLanguage() %>'); 11 OpenLayers.Lang.setCode('<%=SessionModelFactory.getInstance().getSessionModel(request).getCurrentLocale().getLanguage() %>');
10 Ext.BLANK_IMAGE_URL = "scripts/openlayers/OpenLayers-2.9/theme/default/img/blank.gif"; 12 Ext.BLANK_IMAGE_URL = "scripts/openlayers/OpenLayers-2.9/theme/default/img/blank.gif";
11 13
13 * XXX 15 * XXX
14 * Change specific attributes for map, wfs-t, etc here. Do not change these 16 * Change specific attributes for map, wfs-t, etc here. Do not change these
15 * settings inline the code! 17 * settings inline the code!
16 */ 18 */
17 PROJECTION = "EPSG:4326"; 19 PROJECTION = "EPSG:4326";
18 MAX_EXTENT = new OpenLayers.Bounds(-17.44,29.41,40.04,77.66); 20 MAX_EXTENT = new OpenLayers.Bounds(-90,-180,90,180);
21 CURRENT_EXTENT = new OpenLayers.Bounds(<%=mapService.getBBoxValue().replace(' ',',')%>);
19 INITIAL_CENTER = new OpenLayers.LonLat(5, 55); 22 INITIAL_CENTER = new OpenLayers.LonLat(5, 55);
20 GETFEATUREINFO_URL = "<%=SessionModelFactory.getInstance().getSessionModel(request).getLocalMapService().getURL()%>"; 23 GETFEATUREINFO_URL = "<%=mapService.getURL()%>";
21 24
22 Ext.onReady(function() { 25 Ext.onReady(function() {
23 26
24 /* this function call initialized the layers that are defined by the user. 27 /* this function call initialized the layers that are defined by the user.
25 * The variable 'layer' and 'layers' are initialized in this function as 28 * The variable 'layer' and 'layers' are initialized in this function as
29 initLayers(); 32 initLayers();
30 33
31 var options = { 34 var options = {
32 maxExtent: MAX_EXTENT, 35 maxExtent: MAX_EXTENT,
33 projection: PROJECTION, 36 projection: PROJECTION,
34 zoom: 5,
35 controls: [], 37 controls: [],
36 units: 'm' 38 units: 'm'
37 }; 39 };
38 40
39 41
108 map: map, 110 map: map,
109 layers: layers 111 layers: layers
110 112
111 }); 113 });
112 114
113 map.setCenter(INITIAL_CENTER); 115 //map.setCenter(INITIAL_CENTER);
116
114 117
115 store = new GeoExt.data.WMSCapabilitiesStore({ 118 store = new GeoExt.data.WMSCapabilitiesStore({
116 }); 119 });
117 store.load(); 120 store.load();
118 121
282 mylegend, 285 mylegend,
283 mapPanel 286 mapPanel
284 ] 287 ]
285 }); 288 });
286 <%}%> 289 <%}%>
290 map.zoomToExtent(CURRENT_EXTENT);
287 }); 291 });

http://dive4elements.wald.intevation.org