comparison 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
comparison
equal deleted inserted replaced
604:2f17dd53e69f 605:c6994912a326
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
2 * Software engineering by Intevation GmbH
3 *
4 * This file is Free Software under the GNU GPL (v>=3)
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
6 * the documentation coming with IMIS-Labordaten-Application for details.
7 */
8 Ext.define('Lada.view.panel.Map', {
9 extend: 'Ext.panel.Panel',
10 alias: 'widget.map',
11
12 /**
13 * @cfg
14 * OpenLayers map options.
15 */
16 mapOptions: {
17 maxExtent: new OpenLayers.Bounds(2.9, 42.95, 18.1, 60.6),
18 //scales: [1600000, 600000, 300000, 100000, 30000, 15000, 7000, 3500, 1200, 500],
19 units: 'dd',
20 projection: new OpenLayers.Projection('EPSG:4326')
21 },
22
23 /**
24 * Array of OpenLayers.Layer objects.
25 */
26 layers: [
27 new OpenLayers.Layer.WMS(
28 'Standard',
29 'http://osm.intevation.de/cgi-bin/standard.fcgi?',
30 {
31 layers: 'OSM-WMS-Dienst',
32 format: 'image/png',
33 BGCOLOR: '0xFFFFFF'
34 }, {
35 isBaseLayer: true,
36 buffer: 0,
37 visibility: true
38 })
39 ],
40
41 /**
42 * @private
43 * Initialize the map panel.
44 */
45 initComponent: function() {
46 this.map = new OpenLayers.Map('map', {
47 controls: [],
48 tileManager: null,
49 zoomMethod: null
50 });
51 this.map.setOptions(this.mapOptions);
52 this.map.addLayers(this.layers);
53 var keyControl = new OpenLayers.Control.KeyboardDefaults();
54 this.map.addControl(keyControl);
55 keyControl.activate();
56 this.bodyStyle = {background: '#fff'};
57 this.callParent();
58 },
59
60 /**
61 * @private
62 * Override to display and update the map view in the panel.
63 */
64 afterRender: function() {
65 this.superclass.afterRender.apply(this, arguments);
66 this.map.render(this.body.dom);
67 this.map.zoomToExtent(this.mapOptions.Extent);
68 this.map.addControl(new OpenLayers.Control.Navigation());
69 this.map.addControl(new OpenLayers.Control.PanZoomBar());
70 this.map.addControl(new OpenLayers.Control.ScaleLine());
71 },
72
73 /**
74 * @private
75 * Override to resize the map and reposition the logo.
76 */
77 onResize: function() {
78 this.superclass.onResize.apply(this, arguments);
79 this.map.updateSize();
80 }
81 });

http://lada.wald.intevation.org