diff gnv/src/main/webapp/scripts/layers.jsp @ 971:a0e6566cd111

Integrated Openlayers using ext and geoext into the GNV-WebClient gnv/trunk@1139 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 01 Jun 2010 12:55:24 +0000
parents
children 556e16cc4da5
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/scripts/layers.jsp	Tue Jun 01 12:55:24 2010 +0000
@@ -0,0 +1,60 @@
+
+<%@page import="java.util.Iterator"%>
+<%@page import="de.intevation.gnv.artifactdatabase.objects.map.Layer"%>
+<%@page import="de.intevation.gnv.artifactdatabase.objects.map.MapService"%>
+<%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%>
+<%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%>/**
+ * This function is called while initializing the application. You are allowed
+ * to change/add/remove layers. But be are of the comments inline this code!
+ */
+function initLayers() {
+    /**
+     * XXX This application needs a layer that is stored in a variable called 
+     * 'layer'. So do not change the name of this variable. Just change the WMS
+     * layer itself.
+     */
+    layer = new OpenLayers.Layer.WMS.Untiled(
+            "Background1",
+            "http://gdisrv.bsh.de/arcgis/services/Background/Background/MapServer/WMSServer?",
+            {
+                layers: '0',
+                format: 'image/png',
+                transparent: false
+            },
+            {
+                isBaseLayer: true
+            }
+
+    );
+     /**
+     * XXX This application needs an ARRAY that stores some layers (or a single
+     * layer). Do not change the name of the following variable 'layers'.
+     */    
+    layers = [];
+    layers[0] = layer;
+    
+    <%
+    SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request);
+    MapService localMapService = sm.getLocalMapService();
+    Iterator<Layer> it = localMapService.getLayer().iterator();
+    int i = 1;
+    while (it.hasNext()){
+        Layer layer = it.next();
+    %>
+    layer<%=i%> = new OpenLayers.Layer.WMS.Untiled(
+            "<%=layer.getID() %>",
+            "<%=localMapService.getURL() %>",
+            {
+                layers: '<%=layer.getName()%>',
+                format: 'image/png',
+                transparent: true
+            },
+            {
+                isBaseLayer: false
+            }
+
+    );
+    layers[<%=i%>] = layer<%=i++%>;
+    <%}%>
+
+}

http://dive4elements.wald.intevation.org