raimund@605: /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz raimund@605: * Software engineering by Intevation GmbH raimund@605: * raimund@605: * This file is Free Software under the GNU GPL (v>=3) raimund@605: * and comes with ABSOLUTELY NO WARRANTY! Check out raimund@605: * the documentation coming with IMIS-Labordaten-Application for details. raimund@605: */ raimund@605: Ext.define('Lada.view.panel.Map', { raimund@605: extend: 'Ext.panel.Panel', raimund@605: alias: 'widget.map', raimund@605: raimund@605: /** raimund@605: * @cfg raimund@605: * OpenLayers map options. raimund@605: */ raimund@605: mapOptions: { raimund@605: maxExtent: new OpenLayers.Bounds(2.9, 42.95, 18.1, 60.6), raimund@605: //scales: [1600000, 600000, 300000, 100000, 30000, 15000, 7000, 3500, 1200, 500], raimund@605: units: 'dd', raimund@605: projection: new OpenLayers.Projection('EPSG:4326') raimund@605: }, raimund@605: raimund@605: /** raimund@605: * Array of OpenLayers.Layer objects. raimund@605: */ raimund@605: layers: [ raimund@605: new OpenLayers.Layer.WMS( raimund@605: 'Standard', raimund@605: 'http://osm.intevation.de/cgi-bin/standard.fcgi?', raimund@605: { raimund@605: layers: 'OSM-WMS-Dienst', raimund@605: format: 'image/png', raimund@605: BGCOLOR: '0xFFFFFF' raimund@605: }, { raimund@605: isBaseLayer: true, raimund@605: buffer: 0, raimund@605: visibility: true raimund@605: }) raimund@605: ], raimund@605: raimund@605: /** raimund@605: * @private raimund@605: * Initialize the map panel. raimund@605: */ raimund@605: initComponent: function() { raimund@605: this.map = new OpenLayers.Map('map', { raimund@605: controls: [], raimund@605: tileManager: null, raimund@605: zoomMethod: null raimund@605: }); raimund@605: this.map.setOptions(this.mapOptions); raimund@605: this.map.addLayers(this.layers); raimund@605: var keyControl = new OpenLayers.Control.KeyboardDefaults(); raimund@605: this.map.addControl(keyControl); raimund@605: keyControl.activate(); raimund@605: this.bodyStyle = {background: '#fff'}; raimund@605: this.callParent(); raimund@605: }, raimund@605: raimund@605: /** raimund@605: * @private raimund@605: * Override to display and update the map view in the panel. raimund@605: */ raimund@605: afterRender: function() { raimund@605: this.superclass.afterRender.apply(this, arguments); raimund@605: this.map.render(this.body.dom); raimund@605: this.map.zoomToExtent(this.mapOptions.Extent); raimund@605: this.map.addControl(new OpenLayers.Control.Navigation()); raimund@605: this.map.addControl(new OpenLayers.Control.PanZoomBar()); raimund@605: this.map.addControl(new OpenLayers.Control.ScaleLine()); raimund@605: }, raimund@605: raimund@605: /** raimund@605: * @private raimund@605: * Override to resize the map and reposition the logo. raimund@605: */ raimund@605: onResize: function() { raimund@605: this.superclass.onResize.apply(this, arguments); raimund@605: this.map.updateSize(); raimund@605: } raimund@605: });