annotate app/view/panel/Map.js @ 635:def8def373e8

Added a toolbar to the OpenLayers map panel.
author Raimund Renkert <raimund.renkert@intevation.de>
date Mon, 16 Mar 2015 17:31:41 +0100
parents 04e380ce4d73
children d21048cbdbb3
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 */
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8 Ext.define('Lada.view.panel.Map', {
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 extend: 'Ext.panel.Panel',
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 alias: 'widget.map',
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11
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
12 record: null,
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
13
605
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 /**
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15 * @cfg
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 * OpenLayers map options.
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 */
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 mapOptions: {
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 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
20 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
21 units: 'dd',
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 projection: new OpenLayers.Projection('EPSG:4326')
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 },
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 /**
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 * Array of OpenLayers.Layer objects.
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
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 /**
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 * @private
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 * Initialize the map panel.
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 initComponent: function() {
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
34 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
35 new OpenLayers.Layer.WMS(
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
36 'Standard' + this.record.get('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
37 '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
38 {
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
39 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
40 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
41 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
42 }, {
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 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
44 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
45 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
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 ];
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 this.map = new OpenLayers.Map('map_' + this.record.get('id'), {
605
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 controls: [],
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 tileManager: null,
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 zoomMethod: null
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 });
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 this.map.setOptions(this.mapOptions);
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 this.map.addLayers(this.layers);
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 var keyControl = new OpenLayers.Control.KeyboardDefaults();
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 this.map.addControl(keyControl);
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 keyControl.activate();
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 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
59 this.initData();
635
def8def373e8 Added a toolbar to the OpenLayers map panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 614
diff changeset
60 this.tbar = Ext.create('Lada.view.widget.MapToolbar');
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
61 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
62 },
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
63
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
64 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
65 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
66 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
67 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
68 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
69 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
70 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
71 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
72 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
73 ),
04e380ce4d73 Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 605
diff changeset
74 {
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 id: this.locationStore.getAt(i).get('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
76 }
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 }
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 this.featureLayer = new OpenLayers.Layer.Vector('vector' + this.record.get('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
80 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
81 '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
82 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
83 graphicOpacity: 1,
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 pointRadius: 10
04e380ce4d73 Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 605
diff changeset
85 }, 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
86 'select': new OpenLayers.Style({
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 externalGraphic: 'resources/lib/OpenLayers/img/marker-blue.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
88 })
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 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
92 this.map.addLayer(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
93 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
94 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
95 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
96 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
97 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
98 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
99 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
100 });
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
101 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
102 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
103 },
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
104
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
105 selectedFeature: function(feature) {
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
106 var record = Ext.data.StoreManager.get('locations').getById(feature.attributes.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
107 this.up('window').down('locationform').setRecord(record);
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 this.up('window').down('ortform').down('combobox').setValue(record.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
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
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 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
112 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
113 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
114 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
115 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
116 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
117 this.selectControl.select(feature[0]);
605
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
118 },
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
119
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120 /**
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
121 * @private
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
122 * 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
123 */
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
124 afterRender: function() {
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
125 this.superclass.afterRender.apply(this, arguments);
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
126 this.map.render(this.body.dom);
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
127 this.map.addControl(new OpenLayers.Control.Navigation());
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
128 this.map.addControl(new OpenLayers.Control.PanZoomBar());
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
129 this.map.addControl(new OpenLayers.Control.ScaleLine());
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
130 if (this.record) {
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.selectFeature(this.record.get('ort'));
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
132 }
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
133 else {
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
134 this.map.zoomToScale(this.mapOptions.scales[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
135 }
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
136 },
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
137
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
138 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
139 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
140 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
141 }
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
142 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
143 this.callParent(arguments);
605
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
144 },
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
145
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
146 /**
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
147 * @private
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
148 * Override to resize the map and reposition the logo.
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
149 */
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
150 onResize: function() {
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
151 this.superclass.onResize.apply(this, arguments);
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
152 this.map.updateSize();
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 });

http://lada.wald.intevation.org