diff app/view/panel/Map.js @ 643:477379250512

Open the ort create window on button click.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 17 Mar 2015 16:05:52 +0100
parents d21048cbdbb3
children 7267bae1d43f
line wrap: on
line diff
--- a/app/view/panel/Map.js	Tue Mar 17 16:05:04 2015 +0100
+++ b/app/view/panel/Map.js	Tue Mar 17 16:05:52 2015 +0100
@@ -32,9 +32,10 @@
      * Initialize the map panel.
      */
     initComponent: function() {
+        var id = this.record ? this.record.get('id') : Math.floor(Math.random() * 100);
         this.layers = [
             new OpenLayers.Layer.WMS(
-                'Standard' + this.record.get('id'),
+                'Standard' + id,
                 'http://osm.intevation.de/cgi-bin/standard.fcgi?',
                 {
                     layers: 'OSM-WMS-Dienst',
@@ -46,7 +47,7 @@
                     visibility: true
                 })
         ];
-        this.map = new OpenLayers.Map('map_' + this.record.get('id'), {
+        this.map = new OpenLayers.Map('map_' + id, {
             controls: [],
             tileManager: null,
             zoomMethod: null
@@ -77,7 +78,7 @@
                 }
             ));
         }
-        this.featureLayer = new OpenLayers.Layer.Vector('vector' + this.record.get('id'), {
+        this.featureLayer = new OpenLayers.Layer.Vector('vector_' + this.map.name, {
             styleMap: new OpenLayers.StyleMap({
                 'default': new OpenLayers.Style(OpenLayers.Util.applyDefaults({
                     externalGraphic: 'resources/lib/OpenLayers/img/marker-green.png',
@@ -160,7 +161,7 @@
             this.selectFeature(this.record.get('ort'));
         }
         else {
-            this.map.zoomToScale(this.mapOptions.scales[0]);
+            this.map.zoomToMaxExtent();
         }
     },
 

http://lada.wald.intevation.org