annotate gnv/src/main/webapp/scripts/viewport.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 1bb54da8c8ed
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 OpenLayers.ProxyHost= "/cgi-bin/proxy.cgi?url=";
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
2 Ext.BLANK_IMAGE_URL = "scripts/openlayers/OpenLayers-2.9/theme/default/img/blank.gif";
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
3
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
4 /**
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
5 * XXX
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
6 * Change specific attributes for map, wfs-t, etc here. Do not change these
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
7 * settings inline the code!
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
8 */
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
9 PROJECTION = "EPSG:4326";
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
10 PROJECTIONS = [PROJECTION, 'EPSG:4326'] // Projection used in projection selector
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
11 MAX_EXTENT = new OpenLayers.Bounds(-17.44,29.41,40.04,77.66);
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
12 INITIAL_CENTER = new OpenLayers.LonLat(5, 55);
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
13
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
14 Ext.onReady(function() {
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
15
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
16 /* this function call initialized the layers that are defined by the user.
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
17 * The variable 'layer' and 'layers' are initialized in this function as
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
18 * well, that are used in the following code! So do not remove this function
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
19 * call.
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
20 */
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
21 initLayers();
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
22
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
23 var options = {
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
24 maxExtent: MAX_EXTENT,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
25 projection: PROJECTION,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
26 zoom: 5,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
27 controls: [],
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
28 units: 'm'
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
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
32 /* ------------------------ Create map and add controls ---------------------*/
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
33 // create map
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
34 map = new OpenLayers.Map(options);
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
35 map.displayProjection = new OpenLayers.Projection(PROJECTION);
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 // add controls
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
38
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
39
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
40 var nav = new OpenLayers.Control.NavigationHistory();
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
41 map.addControl(nav);
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
42
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
43 panel = new OpenLayers.Control.Panel();
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
44 controls = {
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
45 previous: nav.previous,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
46 next : nav.next,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
47 navigate: new OpenLayers.Control.MouseDefaults(
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 displayClass: 'olControlPan',
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
50 title:'Verschieben der Karte'
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
51 }
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 zoombox: new OpenLayers.Control.ZoomBox(
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
54 {
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
55 displayClass: 'olControlZoomBox',
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
56 title: 'Zum Zoomen ziehen Sie eine Box auf, indem Sie klicken und ziehen'
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 info : new OpenLayers.Control.WMSGetFeatureInfo({
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
60 displayClass: "olControlFeatureInfo",
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
61 url: 'http://fluggs.wupperverband.de/wmsconnector/com.esri.wms.Esrimap/WV_WMS',
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
62 title: 'Identify features by clicking',
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
63 queryVisible: true,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
64 eventListeners: {
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
65 getfeatureinfo: function(event) {
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
66 mapPanel.map.addPopup(new OpenLayers.Popup.FramedCloud(
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
67 "chicken",
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
68 mapPanel.map.getLonLatFromPixel(event.xy),
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
69 null,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
70 event.text,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
71 null,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
72 true
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
73 ));
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
74 }
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
75 }
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
76 })
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
77 };
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
78
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
79 for (var key in controls) {
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
80 panel.addControls([controls[key]]);
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
81 }
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
82
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
83 map.addControl(panel);
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
84 map.addControl(new OpenLayers.Control.PanZoomBar({zoomWorldIcon: 'true'}));
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
85 map.addControl(new OpenLayers.Control.MouseDefaults());
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
86 map.addControl(new OpenLayers.Control.ScaleLine());
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
87 // Displaying the mouse postion
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
88 mousePosition = new OpenLayers.Control.MousePosition();
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
89 map.addControl(mousePosition);
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
90
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
91 /* --------------------------------------------------------------------------- */
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
92
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
93 // Scale Chooser
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
94 var scaleStore = new GeoExt.data.ScaleStore({map: map});
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
95 var zoomSelector = new Ext.form.ComboBox({
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
96 store: scaleStore,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
97 emptyText: "Zoom Level",
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
98 tpl: '<tpl for="."><div class="x-combo-list-item">1 : {[parseInt(values.scale)]}</div></tpl>',
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
99 editable: false,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
100 triggerAction: 'all', // needed so that the combo box doesn't filter by its current content
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
101 mode: 'local' // keep the combo box from forcing a lot of unneeded data refreshes
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
102 });
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
103
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
104 zoomSelector.on('select',
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
105 function(combo, record, index) {
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
106 map.zoomTo(record.data.level);
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
107 },
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
108 this
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
109 );
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
110
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
111 map.events.register('zoomend', this, function() {
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
112 var scale = scaleStore.queryBy(function(record){
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
113 return this.map.getZoom() == record.data.level;
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
114 });
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
115
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
116 if (scale.length > 0) {
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
117 scale = scale.items[0];
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
118 zoomSelector.setValue("1 : " + parseInt(scale.data.scale));
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
119 } else {
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
120 if (!zoomSelector.rendered) return;
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
121 zoomSelector.clearValue();
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
122 }
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
123 });
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
124
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
125
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
126 // create MapPanel
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
127 mapPanel = new GeoExt.MapPanel({
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
128 border: true,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
129 title: "Karte mit GeoNames Suche",
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
130 region: "center",
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
131 map: map,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
132 layers: layers,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
133 bbar: [zoomSelector]
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
134 });
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
135
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
136 // map.setCenter(INITIAL_CENTER);
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
137
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
138 /* --------------------------- Layer Tree ----------------------------------- */
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
139
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
140
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
141 // LayerTree
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
142 var tree = new Ext.tree.TreePanel({
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
143 border: true,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
144 enableDD: true,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
145 region: "east",
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
146 title: "LayerTree",
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
147 width: 200,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
148 split: true,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
149 collapsible: false,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
150 collapseMode: "mini",
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
151 autoScroll: true,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
152 loader: new Ext.tree.TreeLoader({
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
153 applyLoader: false,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
154 }),
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
155 root: {
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
156 nodeType: "async",
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
157 children: [{
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
158 nodeType: "gx_baselayercontainer",
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
159 expanded: true
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
160 }, {
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
161 nodeType: "gx_overlaylayercontainer",
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
162 expanded: true,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
163 loader: {
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
164 filter: function(record) {
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
165 var layer = record.get("layer");
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
166 return layer.displayInLayerSwitcher === true &&
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
167 layer.isBaseLayer === false;
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
168 }
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
169 }
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
170 }]
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
171 },
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
172 rootVisible: false,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
173 lines: false
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
174 });
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
175
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
176 /*-------------------------------- Feature grid -------------------------------*/
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
177
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
178 // create legend panel
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
179 legendPanel = new GeoExt.LegendPanel({
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
180 id: 'legendpanel',
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
181 dynamic: true,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
182 border: true,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
183 title: 'Legende',
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
184 collapsible: false,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
185 split: false,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
186 defaults: {
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
187 labelCls: 'legend',
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
188 style: 'padding: 5px'
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
189 },
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
190 bodyStyle: 'padding:5px',
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
191 width: 250,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
192 autoScroll: true,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
193 region: 'east'
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
194 //layerStore: mapPanel.layers
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
195 });
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
196
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
197
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
198 // use separate panels
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
199 // Create GUI
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
200
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
201 var mylegend = new Ext.Panel(
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
202 {
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
203 region: "west",
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
204 title: '',
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
205 split: true,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
206 width: 250,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
207 minSize: 225,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
208 maxSize: 400,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
209 collapsible: false,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
210 overflow: 'auto',
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
211 margins: '0 0 0 5',
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
212 layout: 'accordion',
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
213 layoutConfig: {
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
214 animate: true,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
215 activeOnTop: false
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
216 },
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
217 items: [
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
218 tree,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
219 legendPanel
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
220 ]
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
221 }
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
222 );
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
223
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
224 // The main panel
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
225 new Ext.Panel({
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
226 renderTo: "mapcontainer",
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
227 layout: "border",
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
228 width: 700,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
229 height: 420,
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
230 items: [mapPanel, mylegend]
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
231 });
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
232
a0e6566cd111 Integrated Openlayers using ext and geoext into the GNV-WebClient
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
233 });

http://dive4elements.wald.intevation.org