tim@971: tim@971: <%@page import="java.util.Iterator"%> tim@971: <%@page import="de.intevation.gnv.artifactdatabase.objects.map.Layer"%> tim@971: <%@page import="de.intevation.gnv.artifactdatabase.objects.map.MapService"%> tim@971: <%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> tim@971: <%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%>/** tim@971: * This function is called while initializing the application. You are allowed tim@971: * to change/add/remove layers. But be are of the comments inline this code! tim@971: */ tim@971: function initLayers() { tim@971: /** tim@971: * XXX This application needs a layer that is stored in a variable called tim@971: * 'layer'. So do not change the name of this variable. Just change the WMS tim@971: * layer itself. tim@971: */ tim@988: layer = new OpenLayers.Layer.WMS( tim@971: "Background1", tim@971: "http://gdisrv.bsh.de/arcgis/services/Background/Background/MapServer/WMSServer?", tim@971: { tim@971: layers: '0', tim@971: format: 'image/png', tim@971: transparent: false tim@971: }, tim@971: { tim@988: isBaseLayer: true, tim@988: singletile: true tim@971: } tim@971: tim@971: ); tim@971: /** tim@971: * XXX This application needs an ARRAY that stores some layers (or a single tim@971: * layer). Do not change the name of the following variable 'layers'. tim@971: */ tim@971: layers = []; tim@971: layers[0] = layer; tim@971: tim@971: <% tim@971: SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); tim@971: MapService localMapService = sm.getLocalMapService(); tim@971: Iterator it = localMapService.getLayer().iterator(); tim@971: int i = 1; tim@971: while (it.hasNext()){ tim@971: Layer layer = it.next(); tim@971: %> tim@988: layer<%=i%> = new OpenLayers.Layer.WMS( tim@971: "<%=layer.getID() %>", tim@971: "<%=localMapService.getURL() %>", tim@971: { tim@971: layers: '<%=layer.getName()%>', tim@971: format: 'image/png', tim@971: transparent: true tim@971: }, tim@971: { tim@988: isBaseLayer: false, tim@988: singletile: true tim@971: } tim@971: tim@971: ); tim@971: layers[<%=i%>] = layer<%=i++%>; tim@971: <%}%> tim@971: tim@971: }