[Lada-commits] [PATCH 08 of 10] Added panel with OpenLayers map
Wald Commits
scm-commit at wald.intevation.org
Thu Mar 12 15:52:40 CET 2015
# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1426171951 -3600
# Node ID c6994912a3267b72e22b05e809a80665b50f462e
# Parent 2f17dd53e69f938b631aba0dcc7b5b47f19d4767
Added panel with OpenLayers map.
diff -r 2f17dd53e69f -r c6994912a326 app/view/panel/Map.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/view/panel/Map.js Thu Mar 12 15:52:31 2015 +0100
@@ -0,0 +1,81 @@
+/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU GPL (v>=3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out
+ * the documentation coming with IMIS-Labordaten-Application for details.
+ */
+Ext.define('Lada.view.panel.Map', {
+ extend: 'Ext.panel.Panel',
+ alias: 'widget.map',
+
+ /**
+ * @cfg
+ * OpenLayers map options.
+ */
+ mapOptions: {
+ maxExtent: new OpenLayers.Bounds(2.9, 42.95, 18.1, 60.6),
+ //scales: [1600000, 600000, 300000, 100000, 30000, 15000, 7000, 3500, 1200, 500],
+ units: 'dd',
+ projection: new OpenLayers.Projection('EPSG:4326')
+ },
+
+ /**
+ * Array of OpenLayers.Layer objects.
+ */
+ layers: [
+ new OpenLayers.Layer.WMS(
+ 'Standard',
+ 'http://osm.intevation.de/cgi-bin/standard.fcgi?',
+ {
+ layers: 'OSM-WMS-Dienst',
+ format: 'image/png',
+ BGCOLOR: '0xFFFFFF'
+ }, {
+ isBaseLayer: true,
+ buffer: 0,
+ visibility: true
+ })
+ ],
+
+ /**
+ * @private
+ * Initialize the map panel.
+ */
+ initComponent: function() {
+ this.map = new OpenLayers.Map('map', {
+ controls: [],
+ tileManager: null,
+ zoomMethod: null
+ });
+ this.map.setOptions(this.mapOptions);
+ this.map.addLayers(this.layers);
+ var keyControl = new OpenLayers.Control.KeyboardDefaults();
+ this.map.addControl(keyControl);
+ keyControl.activate();
+ this.bodyStyle = {background: '#fff'};
+ this.callParent();
+ },
+
+ /**
+ * @private
+ * Override to display and update the map view in the panel.
+ */
+ afterRender: function() {
+ this.superclass.afterRender.apply(this, arguments);
+ this.map.render(this.body.dom);
+ this.map.zoomToExtent(this.mapOptions.Extent);
+ this.map.addControl(new OpenLayers.Control.Navigation());
+ this.map.addControl(new OpenLayers.Control.PanZoomBar());
+ this.map.addControl(new OpenLayers.Control.ScaleLine());
+ },
+
+ /**
+ * @private
+ * Override to resize the map and reposition the logo.
+ */
+ onResize: function() {
+ this.superclass.onResize.apply(this, arguments);
+ this.map.updateSize();
+ }
+});
diff -r 2f17dd53e69f -r c6994912a326 index.html
--- a/index.html Thu Mar 12 15:51:54 2015 +0100
+++ b/index.html Thu Mar 12 15:52:31 2015 +0100
@@ -14,6 +14,8 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all-gray.css">
<link rel="stylesheet" type="text/css" href="resources/css/lada.css">
+
+ <script type="text/javascript" src="resources/lib/OpenLayers/OpenLayers.js"></script>
<!-- <x-compile> -->
<!-- <x-bootstrap> -->
<script type="text/javascript" src="extjs/ext-all-debug.js"></script>
More information about the Lada-commits
mailing list