annotate app/view/panel/Map.js @ 893:07dfcdf5b41f

jsduck for grids and panels
author Dustin Demuth <dustin@intevation.de>
date Thu, 23 Jul 2015 17:02:28 +0200
parents 729bfea7e8b1
children 2b7bcb778f0a
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',
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17
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
18 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
19 locationRecord: null,
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
20
605
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 /**
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 * @cfg
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 * OpenLayers map options.
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 */
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 mapOptions: {
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 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
27 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
28 units: 'dd',
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 projection: new OpenLayers.Projection('EPSG:4326')
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
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 * Array of OpenLayers.Layer objects.
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 */
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35
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 * @private
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 * Initialize the map panel.
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 initComponent: function() {
796
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 643
diff changeset
41 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
42 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
43 new OpenLayers.Layer.WMS(
643
477379250512 Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 638
diff changeset
44 '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
45 '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
46 {
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 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
48 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
49 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
50 }, {
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 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
52 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
53 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
54 })
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 ];
643
477379250512 Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 638
diff changeset
56 this.map = new OpenLayers.Map('map_' + id, {
605
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 controls: [],
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 tileManager: null,
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 zoomMethod: null
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 });
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 this.map.setOptions(this.mapOptions);
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 this.map.addLayers(this.layers);
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 var keyControl = new OpenLayers.Control.KeyboardDefaults();
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 this.map.addControl(keyControl);
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 keyControl.activate();
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 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
67 this.initData();
635
def8def373e8 Added a toolbar to the OpenLayers map panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 614
diff changeset
68 this.tbar = Ext.create('Lada.view.widget.MapToolbar');
796
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 643
diff changeset
69 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
70 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
71 },
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
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 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
74 var me = this;
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
75 this.locationFeatures = [];
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.locationStore = Ext.data.StoreManager.get('locations');
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 for (var i = 0; i < this.locationStore.count(); i++) {
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 this.locationFeatures.push(new OpenLayers.Feature.Vector(
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 new OpenLayers.Geometry.Point(
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 this.locationStore.getAt(i).get('longitude'),
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
81 this.locationStore.getAt(i).get('latitude')
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
82 ),
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 {
879
729bfea7e8b1 Re-Styled the markers in the map: Increased icon-size of selected-marker to 15px, added colored labels to the markers showing the bezeichnung of the location
Dustin Demuth <dustin@intevation.de>
parents: 803
diff changeset
84 id: this.locationStore.getAt(i).get('id'),
729bfea7e8b1 Re-Styled the markers in the map: Increased icon-size of selected-marker to 15px, added colored labels to the markers showing the bezeichnung of the location
Dustin Demuth <dustin@intevation.de>
parents: 803
diff changeset
85 bez: this.locationStore.getAt(i).get('bezeichnung')
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
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 ));
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
88 }
643
477379250512 Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 638
diff changeset
89 this.featureLayer = new OpenLayers.Layer.Vector('vector_' + this.map.name, {
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 styleMap: new OpenLayers.StyleMap({
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 'default': new OpenLayers.Style(OpenLayers.Util.applyDefaults({
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 externalGraphic: 'resources/lib/OpenLayers/img/marker-green.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
93 graphicOpacity: 1,
879
729bfea7e8b1 Re-Styled the markers in the map: Increased icon-size of selected-marker to 15px, added colored labels to the markers showing the bezeichnung of the location
Dustin Demuth <dustin@intevation.de>
parents: 803
diff changeset
94 pointRadius: 10,
729bfea7e8b1 Re-Styled the markers in the map: Increased icon-size of selected-marker to 15px, added colored labels to the markers showing the bezeichnung of the location
Dustin Demuth <dustin@intevation.de>
parents: 803
diff changeset
95 label: '${bez}',
729bfea7e8b1 Re-Styled the markers in the map: Increased icon-size of selected-marker to 15px, added colored labels to the markers showing the bezeichnung of the location
Dustin Demuth <dustin@intevation.de>
parents: 803
diff changeset
96 labelAlign: 'rt',
729bfea7e8b1 Re-Styled the markers in the map: Increased icon-size of selected-marker to 15px, added colored labels to the markers showing the bezeichnung of the location
Dustin Demuth <dustin@intevation.de>
parents: 803
diff changeset
97 fontColor: 'green',
729bfea7e8b1 Re-Styled the markers in the map: Increased icon-size of selected-marker to 15px, added colored labels to the markers showing the bezeichnung of the location
Dustin Demuth <dustin@intevation.de>
parents: 803
diff changeset
98 fontWeight: 'bold'
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
99 }, OpenLayers.Feature.Vector.style['default'])),
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
100 'select': new OpenLayers.Style({
879
729bfea7e8b1 Re-Styled the markers in the map: Increased icon-size of selected-marker to 15px, added colored labels to the markers showing the bezeichnung of the location
Dustin Demuth <dustin@intevation.de>
parents: 803
diff changeset
101 externalGraphic: 'resources/lib/OpenLayers/img/marker-blue.png',
729bfea7e8b1 Re-Styled the markers in the map: Increased icon-size of selected-marker to 15px, added colored labels to the markers showing the bezeichnung of the location
Dustin Demuth <dustin@intevation.de>
parents: 803
diff changeset
102 pointRadius: 15,
729bfea7e8b1 Re-Styled the markers in the map: Increased icon-size of selected-marker to 15px, added colored labels to the markers showing the bezeichnung of the location
Dustin Demuth <dustin@intevation.de>
parents: 803
diff changeset
103 label: '${bez}',
729bfea7e8b1 Re-Styled the markers in the map: Increased icon-size of selected-marker to 15px, added colored labels to the markers showing the bezeichnung of the location
Dustin Demuth <dustin@intevation.de>
parents: 803
diff changeset
104 labelAlign: 'rt',
729bfea7e8b1 Re-Styled the markers in the map: Increased icon-size of selected-marker to 15px, added colored labels to the markers showing the bezeichnung of the location
Dustin Demuth <dustin@intevation.de>
parents: 803
diff changeset
105 fontColor: 'blue',
729bfea7e8b1 Re-Styled the markers in the map: Increased icon-size of selected-marker to 15px, added colored labels to the markers showing the bezeichnung of the location
Dustin Demuth <dustin@intevation.de>
parents: 803
diff changeset
106 fontWeight: 'bold'
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
107 })
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
108 })
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
109 });
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
110 this.featureLayer.addFeatures(this.locationFeatures);
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
111 this.map.addLayer(this.featureLayer);
796
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 643
diff changeset
112
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
113 this.selectControl = new OpenLayers.Control.SelectFeature(this.featureLayer, {
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
114 clickout: false,
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
115 toggle: false,
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
116 multiple: false,
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
117 hover: false,
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
118 onSelect: me.selectedFeature,
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
119 scope: me
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
120 });
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
121 this.map.addControl(this.selectControl);
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
122 this.selectControl.activate();
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
123 },
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
124
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
125 selectFeature: function(id) {
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
126 var feature = this.featureLayer.getFeaturesByAttribute('id', id);
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
127 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
128 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
129 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
130 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
131 this.selectControl.select(feature[0]);
605
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
132 },
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
133
638
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 635
diff changeset
134 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
135 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
136 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
137 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
138 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
139 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
140 }
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 635
diff changeset
141 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
142 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
143 },
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 635
diff changeset
144
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 635
diff changeset
145 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
146 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
147 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
148 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
149 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
150 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
151 },
d21048cbdbb3 Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 635
diff changeset
152
605
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
153 /**
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
154 * @private
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
155 * 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
156 */
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
157 afterRender: function() {
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
158 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
159
605
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
160 this.map.render(this.body.dom);
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
161 this.map.addControl(new OpenLayers.Control.Navigation());
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
162 this.map.addControl(new OpenLayers.Control.PanZoomBar());
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
163 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
164 },
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 643
diff changeset
165
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 643
diff changeset
166 /**
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 643
diff changeset
167 * Forward OpenlayersEvent to EXT
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 643
diff changeset
168 */
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 643
diff changeset
169 selectedFeature: function() {
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 643
diff changeset
170 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
171 },
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
172
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
173 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
174 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
175 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
176 }
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
177 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
178 this.callParent(arguments);
605
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
179 },
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
180
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
181 /**
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
182 * @private
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
183 * Override to resize the map and reposition the logo.
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
184 */
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
185 onResize: function() {
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
186 this.superclass.onResize.apply(this, arguments);
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
187 this.map.updateSize();
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
188 }
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
189 });

http://lada.wald.intevation.org