Mercurial > lada > lada-client
annotate app/view/panel/Map.js @ 1336:f879c806f880
Create orte store for grid to have only orte with the correct netzbetreiberId
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 03 Feb 2017 17:43:23 +0100 |
parents | cba4e0b0e336 |
children | 26e0aec2eb31 |
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. |
1279
291df0037835
Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents:
1274
diff
changeset
|
30 * Please note that TMS zoom levels are roughly as this: |
291df0037835
Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents:
1274
diff
changeset
|
31 * 7 = 1:4000000 14 = 1:35000 |
605
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 */ |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 mapOptions: { |
1274
a792eecf1614
Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1263
diff
changeset
|
34 maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34), |
1279
291df0037835
Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents:
1274
diff
changeset
|
35 numZoomLevels: 15, |
1274
a792eecf1614
Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1263
diff
changeset
|
36 projection: 'EPSG:3857', |
a792eecf1614
Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1263
diff
changeset
|
37 displayProjection: new OpenLayers.Projection('EPSG:4326') |
605
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 |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 /** |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 * @private |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 * Initialize the map panel. |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 */ |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 initComponent: function() { |
796
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
643
diff
changeset
|
46 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
|
47 this.layers = [ |
1274
a792eecf1614
Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1263
diff
changeset
|
48 new OpenLayers.Layer.TMS( |
643
477379250512
Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
638
diff
changeset
|
49 'Standard' + id, |
1274
a792eecf1614
Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1263
diff
changeset
|
50 'http://www.imis.bfs.de/mapcache/tms/', |
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
|
51 { |
1274
a792eecf1614
Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1263
diff
changeset
|
52 layername: 'osm_bfs_google@GoogleMapsCompatible', |
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
|
53 isBaseLayer: true, |
1274
a792eecf1614
Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1263
diff
changeset
|
54 displayInLayerSwitcher: false, |
a792eecf1614
Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1263
diff
changeset
|
55 type: 'png', |
a792eecf1614
Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1263
diff
changeset
|
56 visibility: true, |
a792eecf1614
Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1263
diff
changeset
|
57 projection: 'EPSG:3857', |
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
|
58 }) |
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
|
59 ]; |
643
477379250512
Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
638
diff
changeset
|
60 this.map = new OpenLayers.Map('map_' + id, { |
605
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 controls: [], |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 tileManager: null, |
1279
291df0037835
Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents:
1274
diff
changeset
|
63 zoomMethod: null, |
291df0037835
Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents:
1274
diff
changeset
|
64 // initializing with view centered on germany |
1307
152fca74a839
Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents:
1289
diff
changeset
|
65 center: new OpenLayers.LonLat(1160000,6694000) |
605
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 }); |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 this.map.setOptions(this.mapOptions); |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 this.map.addLayers(this.layers); |
1288
08085b7d1d0b
Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents:
1279
diff
changeset
|
69 this.map.zoomTo(6); |
605
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 var keyControl = new OpenLayers.Control.KeyboardDefaults(); |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 this.map.addControl(keyControl); |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 keyControl.activate(); |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 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
|
74 this.initData(); |
796
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
643
diff
changeset
|
75 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
|
76 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
|
77 }, |
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
|
78 |
895 | 79 /** |
80 * Initialise the Data and Create an | |
81 * Array of OpenLayers.Layer objects. | |
82 */ | |
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
|
83 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
|
84 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
|
85 |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
86 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
|
87 this.locationStore = Ext.data.StoreManager.get('orte'); |
1055
65ea1c2a8c98
Updated orte window in messprogramme to new orte model.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1051
diff
changeset
|
88 this.addLocations(this.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
|
89 } |
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 }, |
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 |
1289
bfdc00c24baf
Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents:
1288
diff
changeset
|
92 /** |
bfdc00c24baf
Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents:
1288
diff
changeset
|
93 * Select a feature by record (a Lada.model.Ort) and zoom to this Ort |
bfdc00c24baf
Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents:
1288
diff
changeset
|
94 */ |
1049
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
95 selectFeature: function(model, record) { |
1130
e4952906634d
Implemented insert, edit and delete for stammdaten.ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1055
diff
changeset
|
96 if (!record.get('id') || record.get('id') === '') { |
e4952906634d
Implemented insert, edit and delete for stammdaten.ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1055
diff
changeset
|
97 return; |
e4952906634d
Implemented insert, edit and delete for stammdaten.ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1055
diff
changeset
|
98 } |
1279
291df0037835
Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents:
1274
diff
changeset
|
99 var feature = this.featureLayer.getFeaturesByAttribute('id', record.get('id'))[0]; |
1335
cba4e0b0e336
Fixed ort grid selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1307
diff
changeset
|
100 if (!feature) { |
cba4e0b0e336
Fixed ort grid selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1307
diff
changeset
|
101 return; |
cba4e0b0e336
Fixed ort grid selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1307
diff
changeset
|
102 } |
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
|
103 this.map.setCenter( |
1279
291df0037835
Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents:
1274
diff
changeset
|
104 new OpenLayers.LonLat(feature.geometry.x, feature.geometry.y)); |
291df0037835
Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents:
1274
diff
changeset
|
105 this.map.zoomTo(12); |
291df0037835
Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents:
1274
diff
changeset
|
106 if (this.selectedFeatureLayer) { |
1289
bfdc00c24baf
Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents:
1288
diff
changeset
|
107 this.selectControl.unselectAll(); |
1307
152fca74a839
Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents:
1289
diff
changeset
|
108 var prev = this.selectedFeatureLayer.features[0]; |
152fca74a839
Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents:
1289
diff
changeset
|
109 if (prev){ |
152fca74a839
Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents:
1289
diff
changeset
|
110 this.featureLayer.addFeatures([prev.clone()]); |
152fca74a839
Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents:
1289
diff
changeset
|
111 } |
1289
bfdc00c24baf
Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents:
1288
diff
changeset
|
112 this.selectedFeatureLayer.removeAllFeatures(); |
1307
152fca74a839
Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents:
1289
diff
changeset
|
113 this.selectedFeatureLayer.addFeatures(feature.clone()); |
152fca74a839
Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents:
1289
diff
changeset
|
114 this.featureLayer.removeFeatures([feature]); |
152fca74a839
Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents:
1289
diff
changeset
|
115 this.selectedFeatureLayer.refresh({force: true}); |
152fca74a839
Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents:
1289
diff
changeset
|
116 this.featureLayer.refresh({force: true}); |
1279
291df0037835
Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents:
1274
diff
changeset
|
117 } else { |
1289
bfdc00c24baf
Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents:
1288
diff
changeset
|
118 this.selectControl.unselectAll(); |
1279
291df0037835
Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents:
1274
diff
changeset
|
119 this.selectControl.select(feature); |
291df0037835
Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents:
1274
diff
changeset
|
120 } |
605
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
121 }, |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
122 |
638
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
123 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
|
124 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
|
125 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
|
126 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
|
127 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
|
128 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
|
129 } |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
130 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
|
131 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
|
132 }, |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
133 |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
134 featureAdded: function(features) { |
1263
26197c2d9362
Set values from which the server actually generates a geometry.
Tom Gottfried <tom@intevation.de>
parents:
1130
diff
changeset
|
135 this.locationRecord.set('kdaId', 4); |
26197c2d9362
Set values from which the server actually generates a geometry.
Tom Gottfried <tom@intevation.de>
parents:
1130
diff
changeset
|
136 this.locationRecord.set('koordYExtern', features.feature.geometry.y); |
26197c2d9362
Set values from which the server actually generates a geometry.
Tom Gottfried <tom@intevation.de>
parents:
1130
diff
changeset
|
137 this.locationRecord.set('koordXExtern', features.feature.geometry.x); |
638
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
138 this.drawPoint.deactivate(); |
1130
e4952906634d
Implemented insert, edit and delete for stammdaten.ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1055
diff
changeset
|
139 this.fireEvent('featureadded', this.locationRecord); |
e4952906634d
Implemented insert, edit and delete for stammdaten.ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1055
diff
changeset
|
140 // this.selectControl.unselectAll(); |
e4952906634d
Implemented insert, edit and delete for stammdaten.ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1055
diff
changeset
|
141 // this.selectControl.select(features.feature); |
638
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
142 }, |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
635
diff
changeset
|
143 |
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
|
144 addLocations: function(locationStore) { |
1049
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
145 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
|
146 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
|
147 |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
148 // 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
|
149 for (var i = 0; i < locationStore.count(); i++) { |
1307
152fca74a839
Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents:
1289
diff
changeset
|
150 var feature = new OpenLayers.Feature.Vector( |
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
|
151 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
|
152 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
|
153 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
|
154 ), |
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 { |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
156 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
|
157 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
|
158 } |
1307
152fca74a839
Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents:
1289
diff
changeset
|
159 ); |
152fca74a839
Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents:
1289
diff
changeset
|
160 feature.geometry.transform(new OpenLayers.Projection('EPSG:4326'), |
152fca74a839
Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents:
1289
diff
changeset
|
161 new OpenLayers.Projection('EPSG:3857')); |
152fca74a839
Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents:
1289
diff
changeset
|
162 locationFeatures.push(feature); |
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
|
163 } |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
164 |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
165 // 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
|
166 if (!this.featureLayer) { |
1279
291df0037835
Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents:
1274
diff
changeset
|
167 this.featureLayer = new OpenLayers.Layer.Vector( 'alle Messpunkte', { |
1049
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
168 styleMap: new OpenLayers.StyleMap({ |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
169 '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
|
170 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
|
171 graphicOpacity: 1, |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
172 pointRadius: 10, |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
173 label: '${bez}', |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
174 labelAlign: 'rt', |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
175 fontColor: 'green', |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
176 fontWeight: 'bold' |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
177 }, 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
|
178 'select': new OpenLayers.Style({ |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
179 externalGraphic: 'resources/lib/OpenLayers/img/marker-blue.png', |
1289
bfdc00c24baf
Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents:
1288
diff
changeset
|
180 pointRadius: 12, |
1049
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
181 label: '${bez}', |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
182 labelAlign: 'rt', |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
183 fontColor: 'blue', |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
184 fontWeight: 'bold' |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
185 }) |
1274
a792eecf1614
Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1263
diff
changeset
|
186 }), |
1307
152fca74a839
Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents:
1289
diff
changeset
|
187 projection: new OpenLayers.Projection('EPSG:3857') |
1049
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
188 }); |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
189 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
|
190 clickout: false, |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
191 toggle: false, |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
192 multiple: false, |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
193 hover: false, |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
194 onSelect: me.selectedFeature, |
1279
291df0037835
Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents:
1274
diff
changeset
|
195 layers: [me.featureLayer], |
1049
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
196 scope: me |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
197 }); |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
198 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
|
199 this.selectControl.activate(); |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
200 } |
1bd4c0709bd6
Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1021
diff
changeset
|
201 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
|
202 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
|
203 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
|
204 }, |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
205 |
605
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 * @private |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
208 * 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
|
209 */ |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
210 afterRender: function() { |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
211 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
|
212 |
605
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
213 this.map.render(this.body.dom); |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
214 this.map.addControl(new OpenLayers.Control.Navigation()); |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
215 this.map.addControl(new OpenLayers.Control.PanZoomBar()); |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
216 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
|
217 }, |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
643
diff
changeset
|
218 |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
643
diff
changeset
|
219 /** |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
643
diff
changeset
|
220 * Forward OpenlayersEvent to EXT |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
643
diff
changeset
|
221 */ |
1279
291df0037835
Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents:
1274
diff
changeset
|
222 selectedFeature: function(feature) { |
796
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
643
diff
changeset
|
223 this.fireEvent('featureselected', this, arguments); |
1307
152fca74a839
Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents:
1289
diff
changeset
|
224 this.featureLayer.refresh({force: true}); |
152fca74a839
Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents:
1289
diff
changeset
|
225 if (this.selectedFeatureLayer) { |
152fca74a839
Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents:
1289
diff
changeset
|
226 this.selectedFeatureLayer.refresh({force: true}); |
152fca74a839
Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents:
1289
diff
changeset
|
227 |
152fca74a839
Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents:
1289
diff
changeset
|
228 } |
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
|
229 }, |
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
|
230 |
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
|
231 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
|
232 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
|
233 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
|
234 } |
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
|
235 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
|
236 this.callParent(arguments); |
605
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
237 }, |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
238 |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
239 /** |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
240 * @private |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
241 * Override to resize the map and reposition the logo. |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
242 */ |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
243 onResize: function() { |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
244 this.superclass.onResize.apply(this, arguments); |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
245 this.map.updateSize(); |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
246 } |
c6994912a326
Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
247 }); |