Mercurial > lada > lada-client
annotate app/view/panel/Map.js @ 1051:981339d774b8
merged stammdatengrids to default.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Tue, 01 Mar 2016 14:12:39 +0100 |
parents | 1bd4c0709bd6 |
children | 65ea1c2a8c98 |
rev | line source |
---|---|
605
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 * |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 */ |
893
07dfcdf5b41f
jsduck for grids and panels
Dustin Demuth <dustin@intevation.de>
parents:
879
diff
changeset
|
8 |
07dfcdf5b41f
jsduck for grids and panels
Dustin Demuth <dustin@intevation.de>
parents:
879
diff
changeset
|
9 |
07dfcdf5b41f
jsduck for grids and panels
Dustin Demuth <dustin@intevation.de>
parents:
879
diff
changeset
|
10 /** |
07dfcdf5b41f
jsduck for grids and panels
Dustin Demuth <dustin@intevation.de>
parents:
879
diff
changeset
|
11 * This is the MapPanel. |
07dfcdf5b41f
jsduck for grids and panels
Dustin Demuth <dustin@intevation.de>
parents:
879
diff
changeset
|
12 * It uses OpenLayers to display the map |
07dfcdf5b41f
jsduck for grids and panels
Dustin Demuth <dustin@intevation.de>
parents:
879
diff
changeset
|
13 */ |
605
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 Ext.define('Lada.view.panel.Map', { |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 extend: 'Ext.panel.Panel', |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 alias: 'widget.map', |
1021
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
17 name: 'map', |
605
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 |
614
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
19 record: null, |
638
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
20 locationRecord: null, |
1021
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
21 externalOrteStore: false, |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
22 /* |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
23 * if externalOrteStore is true, the mappanel will not load the orte |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
24 * store on it's own; it expects an already loaded store instead |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
25 */ |
614
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
26 |
605
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 /** |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 * @cfg |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 * OpenLayers map options. |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 */ |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 mapOptions: { |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 maxExtent: new OpenLayers.Bounds(2.9, 42.95, 18.1, 60.6), |
614
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
33 scales: [5000000, 3000000, 2000000, 1000000, 500000, 250000, 100000, 25000], |
605
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 units: 'dd', |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 projection: new OpenLayers.Projection('EPSG:4326') |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 }, |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 /** |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 * @private |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 * Initialize the map panel. |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 */ |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 initComponent: function() { |
796
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
643
diff
changeset
|
44 var id = Ext.id(); |
614
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
45 this.layers = [ |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
46 new OpenLayers.Layer.WMS( |
643
477379250512
Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
638
diff
changeset
|
47 'Standard' + id, |
614
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
48 'http://osm.intevation.de/cgi-bin/standard.fcgi?', |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
49 { |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
50 layers: 'OSM-WMS-Dienst', |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
51 format: 'image/png', |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
52 BGCOLOR: '0xFFFFFF' |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
53 }, { |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
54 isBaseLayer: true, |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
55 buffer: 0, |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
56 visibility: true |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
57 }) |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
58 ]; |
643
477379250512
Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
638
diff
changeset
|
59 this.map = new OpenLayers.Map('map_' + id, { |
605
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 controls: [], |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 tileManager: null, |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 zoomMethod: null |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 }); |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 this.map.setOptions(this.mapOptions); |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 this.map.addLayers(this.layers); |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 var keyControl = new OpenLayers.Control.KeyboardDefaults(); |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 this.map.addControl(keyControl); |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 keyControl.activate(); |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 this.bodyStyle = {background: '#fff'}; |
614
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
70 this.initData(); |
796
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
643
diff
changeset
|
71 this.addEvents('featureselected'); |
614
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
72 this.callParent(arguments); |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
73 }, |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
74 |
895 | 75 /** |
76 * Initialise the Data and Create an | |
77 * Array of OpenLayers.Layer objects. | |
78 */ | |
614
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
79 initData: function() { |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
80 var me = this; |
1021
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
81 |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
82 if (!this.externalOrteStore) { |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
83 this.locationStore = Ext.data.StoreManager.get('orte'); |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
84 this.addLocations(locationStore); |
614
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
85 } |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
86 }, |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
87 |
1049
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
88 selectFeature: function(model, record) { |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
89 var feature = this.featureLayer.getFeaturesByAttribute('id', record.get('id')); |
614
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
90 this.map.setCenter( |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
91 new OpenLayers.LonLat(feature[0].geometry.x, feature[0].geometry.y)); |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
92 this.map.zoomToScale(this.mapOptions.scales[5]); |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
93 this.selectControl.unselectAll(); |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
94 this.selectControl.select(feature[0]); |
605
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
95 }, |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
96 |
638
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
97 activateDraw: function(record) { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
98 this.locationRecord = record; |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
99 if (!this.drawPoint) { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
100 this.drawPoint = new OpenLayers.Control.DrawFeature(this.featureLayer, |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
101 OpenLayers.Handler.Point); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
102 this.map.addControl(this.drawPoint); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
103 } |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
104 this.drawPoint.activate(); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
105 this.drawPoint.events.register('featureadded', this, this.featureAdded); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
106 }, |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
107 |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
108 featureAdded: function(features) { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
109 this.locationRecord.set('latitude', features.feature.geometry.y); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
110 this.locationRecord.set('longitude', features.feature.geometry.x); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
111 this.drawPoint.deactivate(); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
112 this.selectControl.unselectAll(); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
113 this.selectControl.select(features.feature); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
114 }, |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
115 |
1021
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
116 addLocations: function(locationStore) { |
1049
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
117 var me = this; |
1021
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
118 locationFeatures = []; |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
119 |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
120 // Iterate the Store and create features from it |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
121 for (var i = 0; i < locationStore.count(); i++) { |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
122 locationFeatures.push(new OpenLayers.Feature.Vector( |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
123 new OpenLayers.Geometry.Point( |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
124 locationStore.getAt(i).get('longitude'), |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
125 locationStore.getAt(i).get('latitude') |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
126 ), |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
127 { |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
128 id: locationStore.getAt(i).get('id'), |
1049
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
129 bez: locationStore.getAt(i).get('ortId') |
1021
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
130 } |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
131 )); |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
132 } |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
133 |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
134 // Create a new Feature Layer and add it to the map |
1049
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
135 if (!this.featureLayer) { |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
136 this.featureLayer = new OpenLayers.Layer.Vector('vector_' + this.map.name, { |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
137 styleMap: new OpenLayers.StyleMap({ |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
138 'default': new OpenLayers.Style(OpenLayers.Util.applyDefaults({ |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
139 externalGraphic: 'resources/lib/OpenLayers/img/marker-green.png', |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
140 graphicOpacity: 1, |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
141 pointRadius: 10, |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
142 label: '${bez}', |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
143 labelAlign: 'rt', |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
144 fontColor: 'green', |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
145 fontWeight: 'bold' |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
146 }, OpenLayers.Feature.Vector.style['default'])), |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
147 'select': new OpenLayers.Style({ |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
148 externalGraphic: 'resources/lib/OpenLayers/img/marker-blue.png', |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
149 pointRadius: 15, |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
150 label: '${bez}', |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
151 labelAlign: 'rt', |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
152 fontColor: 'blue', |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
153 fontWeight: 'bold' |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
154 }) |
1021
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
155 }) |
1049
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
156 }); |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
157 this.selectControl = new OpenLayers.Control.SelectFeature(this.featureLayer, { |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
158 clickout: false, |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
159 toggle: false, |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
160 multiple: false, |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
161 hover: false, |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
162 onSelect: me.selectedFeature, |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
163 scope: me |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
164 }); |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
165 this.map.addControl(this.selectControl); |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
166 this.selectControl.activate(); |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
167 } |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
168 this.featureLayer.removeAllFeatures(); |
1021
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
169 this.featureLayer.addFeatures(locationFeatures); |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
170 this.map.addLayer(this.featureLayer); |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
171 |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
172 }, |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
173 |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
174 |
605
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
175 /** |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
176 * @private |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
177 * Override to display and update the map view in the panel. |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
178 */ |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
179 afterRender: function() { |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
180 this.superclass.afterRender.apply(this, arguments); |
796
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
643
diff
changeset
|
181 |
605
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
182 this.map.render(this.body.dom); |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
183 this.map.addControl(new OpenLayers.Control.Navigation()); |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
184 this.map.addControl(new OpenLayers.Control.PanZoomBar()); |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
185 this.map.addControl(new OpenLayers.Control.ScaleLine()); |
796
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
643
diff
changeset
|
186 }, |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
643
diff
changeset
|
187 |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
643
diff
changeset
|
188 /** |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
643
diff
changeset
|
189 * Forward OpenlayersEvent to EXT |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
643
diff
changeset
|
190 */ |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
643
diff
changeset
|
191 selectedFeature: function() { |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
643
diff
changeset
|
192 this.fireEvent('featureselected', this, arguments); |
614
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
193 }, |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
194 |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
195 beforeDestroy: function() { |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
196 if (this.map) { |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
197 this.map.destroy(); |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
198 } |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
199 delete this.map; |
04e380ce4d73
Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
605
diff
changeset
|
200 this.callParent(arguments); |
605
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
201 }, |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
202 |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
203 /** |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
204 * @private |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
205 * Override to resize the map and reposition the logo. |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
206 */ |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
207 onResize: function() { |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
208 this.superclass.onResize.apply(this, arguments); |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
209 this.map.updateSize(); |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
210 } |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
211 }); |