annotate app/view/panel/Map.js @ 605:c6994912a326

Added panel with OpenLayers map.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 12 Mar 2015 15:52:31 +0100
parents
children 04e380ce4d73
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
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 /**
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 * @cfg
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 * OpenLayers map options.
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15 */
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 mapOptions: {
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 maxExtent: new OpenLayers.Bounds(2.9, 42.95, 18.1, 60.6),
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 //scales: [1600000, 600000, 300000, 100000, 30000, 15000, 7000, 3500, 1200, 500],
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 units: 'dd',
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 projection: new OpenLayers.Projection('EPSG:4326')
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
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 * Array of OpenLayers.Layer objects.
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 layers: [
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 new OpenLayers.Layer.WMS(
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 'Standard',
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 'http://osm.intevation.de/cgi-bin/standard.fcgi?',
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 layers: 'OSM-WMS-Dienst',
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 format: 'image/png',
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 BGCOLOR: '0xFFFFFF'
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 isBaseLayer: true,
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 buffer: 0,
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 visibility: true
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() {
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 this.map = new OpenLayers.Map('map', {
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 controls: [],
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 tileManager: null,
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 zoomMethod: null
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 });
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 this.map.setOptions(this.mapOptions);
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 this.map.addLayers(this.layers);
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 var keyControl = new OpenLayers.Control.KeyboardDefaults();
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 this.map.addControl(keyControl);
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 keyControl.activate();
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 this.bodyStyle = {background: '#fff'};
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 this.callParent();
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 },
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59
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 * @private
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 * 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
63 */
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 afterRender: function() {
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 this.superclass.afterRender.apply(this, arguments);
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 this.map.render(this.body.dom);
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 this.map.zoomToExtent(this.mapOptions.Extent);
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 this.map.addControl(new OpenLayers.Control.Navigation());
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 this.map.addControl(new OpenLayers.Control.PanZoomBar());
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 this.map.addControl(new OpenLayers.Control.ScaleLine());
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 },
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 /**
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 * @private
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 * Override to resize the map and reposition the logo.
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 */
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 onResize: function() {
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 this.superclass.onResize.apply(this, arguments);
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79 this.map.updateSize();
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80 }
c6994912a326 Added panel with OpenLayers map.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 });

http://lada.wald.intevation.org