annotate app/view/panel/Map.js @ 1367:d2a0cb1e5596

fix validity of oz-Id in Ortserstellung
author Maximilian Krambach <mkrambach@intevation.de>
date Wed, 08 Feb 2017 15:46:58 +0100
parents 5c2d6812d85a
children 94d35d5a7913
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
2b7bcb778f0a Jsduck debug
Dustin Demuth <dustin@intevation.de>
parents: 893
diff changeset
79 /**
2b7bcb778f0a Jsduck debug
Dustin Demuth <dustin@intevation.de>
parents: 893
diff changeset
80 * Initialise the Data and Create an
2b7bcb778f0a Jsduck debug
Dustin Demuth <dustin@intevation.de>
parents: 893
diff changeset
81 * Array of OpenLayers.Layer objects.
2b7bcb778f0a Jsduck debug
Dustin Demuth <dustin@intevation.de>
parents: 893
diff changeset
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
1361
5c2d6812d85a Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents: 1348
diff changeset
123 activateDraw: function() {
638
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 635
diff changeset
124 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
125 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
126 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
127 this.map.addControl(this.drawPoint);
1361
5c2d6812d85a Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents: 1348
diff changeset
128 this.drawPoint.events.register('featureadded', this, this.featureAdded);
638
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 },
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 featureAdded: function(features) {
1348
26e0aec2eb31 corrected created coordinates in Stammdaten view from EPSG 3857 to EPSG 4326
Maximilian Krambach <mkrambach@intevation.de>
parents: 1335
diff changeset
134 features.feature.geometry.transform(new OpenLayers.Projection('EPSG:3857'),
26e0aec2eb31 corrected created coordinates in Stammdaten view from EPSG 3857 to EPSG 4326
Maximilian Krambach <mkrambach@intevation.de>
parents: 1335
diff changeset
135 new OpenLayers.Projection('EPSG:4326'));
1361
5c2d6812d85a Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents: 1348
diff changeset
136 var parent = this.up('ortszuordnungwindow') || this.up('ortpanel');
5c2d6812d85a Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents: 1348
diff changeset
137 Ext.create('Lada.view.window.Ortserstellung', {
5c2d6812d85a Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents: 1348
diff changeset
138 record: Ext.create('Lada.model.Ort',{
5c2d6812d85a Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents: 1348
diff changeset
139 koordXExtern: features.feature.geometry.x,
5c2d6812d85a Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents: 1348
diff changeset
140 koordYExtern: features.feature.geometry.y,
5c2d6812d85a Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents: 1348
diff changeset
141 kdaId : 4,
5c2d6812d85a Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents: 1348
diff changeset
142 ortTyp: 1
5c2d6812d85a Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents: 1348
diff changeset
143 }),
5c2d6812d85a Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents: 1348
diff changeset
144 parentWindow: parent
5c2d6812d85a Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents: 1348
diff changeset
145 }).show();
638
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 635
diff changeset
146 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
147 },
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 635
diff changeset
148
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
149 addLocations: function(locationStore) {
1049
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
150 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
151 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
152
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 // 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
154 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
155 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
156 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
157 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
158 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
159 ),
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 895
diff changeset
160 {
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 895
diff changeset
161 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
162 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
163 }
1307
152fca74a839 Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
164 );
152fca74a839 Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
165 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
166 new OpenLayers.Projection('EPSG:3857'));
152fca74a839 Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
167 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
168 }
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
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 // 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
171 if (!this.featureLayer) {
1279
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
172 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
173 styleMap: new OpenLayers.StyleMap({
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
174 '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
175 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
176 graphicOpacity: 1,
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
177 pointRadius: 10,
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
178 label: '${bez}',
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
179 labelAlign: 'rt',
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
180 fontColor: 'green',
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
181 fontWeight: 'bold'
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
182 }, 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
183 'select': new OpenLayers.Style({
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
184 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
185 pointRadius: 12,
1049
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
186 label: '${bez}',
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
187 labelAlign: 'rt',
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
188 fontColor: 'blue',
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
189 fontWeight: 'bold'
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
190 })
1274
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1263
diff changeset
191 }),
1307
152fca74a839 Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
192 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
193 });
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
194 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
195 clickout: false,
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
196 toggle: false,
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
197 multiple: false,
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
198 hover: false,
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
199 onSelect: me.selectedFeature,
1279
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
200 layers: [me.featureLayer],
1049
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
201 scope: me
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
202 });
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
203 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
204 this.selectControl.activate();
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
205 }
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
206 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
207 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
208 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
209 },
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 895
diff changeset
210
605
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
211 /**
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
212 * @private
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
213 * 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
214 */
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
215 afterRender: function() {
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
216 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
217
605
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
218 this.map.render(this.body.dom);
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
219 this.map.addControl(new OpenLayers.Control.Navigation());
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
220 this.map.addControl(new OpenLayers.Control.PanZoomBar());
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
221 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
222 },
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 643
diff changeset
223
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 643
diff changeset
224 /**
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 643
diff changeset
225 * Forward OpenlayersEvent to EXT
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 643
diff changeset
226 */
1279
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
227 selectedFeature: function(feature) {
796
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 643
diff changeset
228 this.fireEvent('featureselected', this, arguments);
1307
152fca74a839 Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
229 this.featureLayer.refresh({force: true});
152fca74a839 Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
230 if (this.selectedFeatureLayer) {
152fca74a839 Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
231 this.selectedFeatureLayer.refresh({force: true});
152fca74a839 Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
232
152fca74a839 Fixed Map layer display of selected Ort
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
233 }
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
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
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 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
237 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
238 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
239 }
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
240 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
241 this.callParent(arguments);
605
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
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
244 /**
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
245 * @private
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
246 * Override to resize the map and reposition the logo.
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
247 */
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
248 onResize: function() {
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
249 this.superclass.onResize.apply(this, arguments);
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
250 this.map.updateSize();
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
251 }
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
252 });

http://lada.wald.intevation.org