annotate gnv/src/main/webapp/scripts/olutils.js @ 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 96db238fc5ab
children ebc3d018af6a
rev   line source
975
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1 function handleMeasurements(event) {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
2 var geometry = event.geometry;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
3 var units = event.units;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
4 var order = event.order;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
5 var measure = event.measure;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
6 var element = document.getElementById('measurements');
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
7
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
8 var out = "";
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
9 if(order == 1) {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
10 out += "L\u00e4nge: " + measure.toFixed(3) + " " + units;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
11 } else {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
12 out += "Fl\u00e4che: " + measure.toFixed(3) + " " + units + "<sup>2</sup>";
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
13 }
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
14
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
15 element.innerHTML=out;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
16 };
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
17
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
18
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
19
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
20 function readWMC(merge) {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
21 var layers = mapPanel.layers;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
22 map = mapPanel.map;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
23
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
24 var format = new OpenLayers.Format.WMC({'layerOptions': {buffer: 0}});
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
25 var text = document.getElementById("wmc").value;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
26
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
27 merge = true;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
28 if(merge) {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
29 try {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
30 map = format.read(text, {map: map});
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
31 } catch(err) {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
32 document.getElementById("wmc").value = err;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
33 }
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
34 } else {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
35 map.destroy();
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
36 try {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
37 var jsonFormat = new OpenLayers.Format.JSON();
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
38 var mapOptions = jsonFormat.read();
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
39 map = format.read(text, {map: mapOptions});
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
40 } catch(err) {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
41 document.getElementById("wmc").value = err;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
42 }
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
43 }
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
44
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
45 // create MapPanel
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
46 mapPanel = new GeoExt.MapPanel({
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
47 border: true,
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
48 title: "Karte",
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
49 region: "center",
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
50 map: map,
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
51 zoom: 1,
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
52 layers: map.layers
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
53 });
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
54 }
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
55
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
56
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
57 function writeWMC(merge) {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
58 var format = new OpenLayers.Format.WMC({'layerOptions': {buffer: 0}});
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
59
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
60 try {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
61 var text = format.write(map);
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
62 document.getElementById("wmc").value = text;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
63 } catch(err) {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
64 document.getElementById("wmc").value = err;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
65 }
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
66 }
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
67
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
68
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
69
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
70 function toggleGetFeatureInfo(evt) {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
71 if (infoActive) {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
72 infoControls.click.deactivate();
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
73 infoActive = false;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
74 }
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
75 else {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
76 infoControls.click.activate();
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
77 infoActive = true;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
78 }
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
79 }
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
80
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
81
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
82 function showInfo(evt) {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
83 }
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
84
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
85
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
86 function addLayer() {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
87 var record = grid.getSelectionModel().getSelected();
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
88
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
89 if (record) {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
90 var copy = record.copy();
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
91 copy.set("layer", record.get("layer"));
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
92 copy.get("layer").mergeNewParams({
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
93 format: "image/png",
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
94 transparent: true
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
95 });
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
96
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
97 mapPanel.layers.add(copy);
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
98 mapPanel.map.zoomToExtent(OpenLayers.Bounds.fromArray(copy.get("llbbox")));
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
99 }
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
100 }
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
101
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
102
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
103 // this is just copied from OpenLayers.Util
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
104 function urlAppend(url, paramStr) {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
105 var newUrl = url;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
106 if(paramStr) {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
107 var parts = (url + " ").split(/[?&]/);
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
108 newUrl += (parts.pop() === " " ?
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
109 paramStr :
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
110 parts.length ? "&" + paramStr : "?" + paramStr);
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
111 }
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
112 return newUrl;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
113 }
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
114
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
115
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
116 function updateCapabilities() {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
117 var ele = Ext.Element.get('capfield');
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
118
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
119 var url = ele.getValue();
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
120 var service = "SERVICE=WMS";
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
121 var request = "REQUEST=GetCapabilities";
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
122 url = urlAppend(url, service);
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
123 url = urlAppend(url, request);
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
124
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
125 store = new GeoExt.data.WMSCapabilitiesStore({
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
126 url: url
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
127 });
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
128 store.load();
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
129
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
130 grid.destroy();
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
131 grid = new Ext.grid.GridPanel({
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
132 id: 'wmsgrid',
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
133 collapsible: false,
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
134 split: false,
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
135 border: true,
979
96db238fc5ab Fixed bug that the 'Add Layer'-Button was not correctly displayed if a new WMS-Capabilities-Document was loaded.
Tim Englich <tim.englich@intevation.de>
parents: 975
diff changeset
136 // TODO: autoHeight might cause trouble
96db238fc5ab Fixed bug that the 'Add Layer'-Button was not correctly displayed if a new WMS-Capabilities-Document was loaded.
Tim Englich <tim.englich@intevation.de>
parents: 975
diff changeset
137 autoHeight: true,
96db238fc5ab Fixed bug that the 'Add Layer'-Button was not correctly displayed if a new WMS-Capabilities-Document was loaded.
Tim Englich <tim.englich@intevation.de>
parents: 975
diff changeset
138 overflow: 'auto',
975
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
139 store: store,
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
140 cm: new Ext.grid.ColumnModel([
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
141 {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
142 header: 'Name',
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
143 dataIndex: 'name',
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
144 sortable: true
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
145 },
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
146 {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
147 id: 'title',
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
148 header: 'Title',
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
149 dataIndex: 'title',
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
150 sortable: true
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
151 }]),
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
152 renderTo: 'capgrid',
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
153 bbar: [{
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
154 text: 'Add Layer',
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
155 handler: addLayer
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
156 }]
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
157 });
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
158 }
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
159
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
160
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
161 function editFeature(e) {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
162 var feature = e.feature;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
163
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
164 // TODO SET FEATURE ATTRIBUTES
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
165 //feature.attributes['lawa'] = 999;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
166 //feature.attributes['lawa_id'] = 999;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
167 //feature.attributes['w_gwk_lawa'] = 999;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
168 //feature.attributes['w_wrrl'] = 999;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
169 //feature.attributes['length_fee'] = 999;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
170 }
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
171
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
172 function updateControls() {
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
173 var controls = panel.controls;
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
174
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
175 controls.remove(drawPointControl);
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
176 controls.remove(drawPathControl);
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
177 controls.remove(drawPolygonControl);
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
178
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
179 panel.destroy();
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
180 panel = new OpenLayers.Control.Panel();
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
181 panel.addControls(controls);
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
182
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
183 if (points.getVisibility())
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
184 panel.addControls(drawPointControl);
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
185 if (lines.getVisibility())
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
186 panel.addControls(drawPathControl);
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
187 if (polygons.getVisibility())
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
188 panel.addControls(drawPolygonControl);
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
189
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
190 map.addControl(panel);
5779220ebb80 Added functionality to read WMS-Capabilities-Documents
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
191 }

http://dive4elements.wald.intevation.org