Mercurial > dive4elements > gnv-client
annotate gnv/src/main/webapp/scripts/layers.jsp @ 989:e3301755bd3c
Improved the workflow for inserting new layer into the client.
gnv/trunk@1178 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Tue, 08 Jun 2010 14:49:11 +0000 |
parents | 556e16cc4da5 |
children | a406d8807e5d |
rev | line source |
---|---|
971
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
1 |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
2 <%@page import="java.util.Iterator"%> |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
3 <%@page import="de.intevation.gnv.artifactdatabase.objects.map.Layer"%> |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
4 <%@page import="de.intevation.gnv.artifactdatabase.objects.map.MapService"%> |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
5 <%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
6 <%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%>/** |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
7 * This function is called while initializing the application. You are allowed |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
8 * to change/add/remove layers. But be are of the comments inline this code! |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
9 */ |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
10 function initLayers() { |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
11 /** |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
12 * XXX This application needs a layer that is stored in a variable called |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
13 * 'layer'. So do not change the name of this variable. Just change the WMS |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
14 * layer itself. |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
15 */ |
988
556e16cc4da5
Switch to tiled layers with one tile to prevent problems in the layertree and the legendgraphicpanel
Tim Englich <tim.englich@intevation.de>
parents:
971
diff
changeset
|
16 layer = new OpenLayers.Layer.WMS( |
971
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
17 "Background1", |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
18 "http://gdisrv.bsh.de/arcgis/services/Background/Background/MapServer/WMSServer?", |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
19 { |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
20 layers: '0', |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
21 format: 'image/png', |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
22 transparent: false |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
23 }, |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
24 { |
988
556e16cc4da5
Switch to tiled layers with one tile to prevent problems in the layertree and the legendgraphicpanel
Tim Englich <tim.englich@intevation.de>
parents:
971
diff
changeset
|
25 isBaseLayer: true, |
556e16cc4da5
Switch to tiled layers with one tile to prevent problems in the layertree and the legendgraphicpanel
Tim Englich <tim.englich@intevation.de>
parents:
971
diff
changeset
|
26 singletile: true |
971
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
27 } |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
28 |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
29 ); |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
30 /** |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
31 * XXX This application needs an ARRAY that stores some layers (or a single |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
32 * layer). Do not change the name of the following variable 'layers'. |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
33 */ |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
34 layers = []; |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
35 layers[0] = layer; |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
36 |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
37 <% |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
38 SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
39 MapService localMapService = sm.getLocalMapService(); |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
40 Iterator<Layer> it = localMapService.getLayer().iterator(); |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
41 int i = 1; |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
42 while (it.hasNext()){ |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
43 Layer layer = it.next(); |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
44 %> |
988
556e16cc4da5
Switch to tiled layers with one tile to prevent problems in the layertree and the legendgraphicpanel
Tim Englich <tim.englich@intevation.de>
parents:
971
diff
changeset
|
45 layer<%=i%> = new OpenLayers.Layer.WMS( |
971
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
46 "<%=layer.getID() %>", |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
47 "<%=localMapService.getURL() %>", |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
48 { |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
49 layers: '<%=layer.getName()%>', |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
50 format: 'image/png', |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
51 transparent: true |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
52 }, |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
53 { |
988
556e16cc4da5
Switch to tiled layers with one tile to prevent problems in the layertree and the legendgraphicpanel
Tim Englich <tim.englich@intevation.de>
parents:
971
diff
changeset
|
54 isBaseLayer: false, |
556e16cc4da5
Switch to tiled layers with one tile to prevent problems in the layertree and the legendgraphicpanel
Tim Englich <tim.englich@intevation.de>
parents:
971
diff
changeset
|
55 singletile: true |
971
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
56 } |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
57 |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
58 ); |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
59 layers[<%=i%>] = layer<%=i++%>; |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
60 <%}%> |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
61 |
a0e6566cd111
Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
62 } |