Mercurial > lada > lada-client
changeset 1307:152fca74a839
Fixed Map layer display of selected Ort
author | Maximilian Krambach <mkrambach@intevation.de> |
---|---|
date | Thu, 02 Feb 2017 15:46:05 +0100 |
parents | c86fd6976264 |
children | 6075731bc4f1 |
files | app/view/panel/Map.js app/view/window/Ortszuordnung.js |
diffstat | 2 files changed, 22 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/app/view/panel/Map.js Thu Feb 02 15:17:44 2017 +0100 +++ b/app/view/panel/Map.js Thu Feb 02 15:46:05 2017 +0100 @@ -62,7 +62,7 @@ tileManager: null, zoomMethod: null, // initializing with view centered on germany - center: new OpenLayers.LonLat(1160000,6694000), + center: new OpenLayers.LonLat(1160000,6694000) }); this.map.setOptions(this.mapOptions); this.map.addLayers(this.layers); @@ -102,8 +102,15 @@ this.map.zoomTo(12); if (this.selectedFeatureLayer) { this.selectControl.unselectAll(); + var prev = this.selectedFeatureLayer.features[0]; + if (prev){ + this.featureLayer.addFeatures([prev.clone()]); + } this.selectedFeatureLayer.removeAllFeatures(); - this.selectedFeatureLayer.addFeatures(feature); + this.selectedFeatureLayer.addFeatures(feature.clone()); + this.featureLayer.removeFeatures([feature]); + this.selectedFeatureLayer.refresh({force: true}); + this.featureLayer.refresh({force: true}); } else { this.selectControl.unselectAll(); this.selectControl.select(feature); @@ -137,7 +144,7 @@ // Iterate the Store and create features from it for (var i = 0; i < locationStore.count(); i++) { - locationFeatures.push(new OpenLayers.Feature.Vector( + var feature = new OpenLayers.Feature.Vector( new OpenLayers.Geometry.Point( locationStore.getAt(i).get('longitude'), locationStore.getAt(i).get('latitude') @@ -146,7 +153,10 @@ id: locationStore.getAt(i).get('id'), bez: locationStore.getAt(i).get('ortId') } - )); + ); + feature.geometry.transform(new OpenLayers.Projection('EPSG:4326'), + new OpenLayers.Projection('EPSG:3857')); + locationFeatures.push(feature); } // Create a new Feature Layer and add it to the map @@ -171,11 +181,7 @@ fontWeight: 'bold' }) }), - projection: new OpenLayers.Projection('EPSG:3857'), - preFeatureInsert: function(feature) { - feature.geometry.transform(new OpenLayers.Projection('EPSG:4326'), - new OpenLayers.Projection('EPSG:3857')); - } + projection: new OpenLayers.Projection('EPSG:3857') }); this.selectControl = new OpenLayers.Control.SelectFeature(this.featureLayer, { clickout: false, @@ -192,7 +198,6 @@ this.featureLayer.removeAllFeatures(); this.featureLayer.addFeatures(locationFeatures); this.map.addLayer(this.featureLayer); - this.featureLayer.setZIndex(500); }, /** @@ -213,6 +218,11 @@ */ selectedFeature: function(feature) { this.fireEvent('featureselected', this, arguments); + this.featureLayer.refresh({force: true}); + if (this.selectedFeatureLayer) { + this.selectedFeatureLayer.refresh({force: true}); + + } }, beforeDestroy: function() {
--- a/app/view/window/Ortszuordnung.js Thu Feb 02 15:17:44 2017 +0100 +++ b/app/view/window/Ortszuordnung.js Thu Feb 02 15:46:05 2017 +0100 @@ -269,12 +269,13 @@ labelAlign: 'rt', fontColor: 'blue', fontWeight: 'bold', + labelOutlineColor: 'white', + labelOutlineWidth: 3 }), displayInLayerSwitcher: false, projection: new OpenLayers.Projection('EPSG:3857') }); map.map.addLayer(map.selectedFeatureLayer); - map.selectedFeatureLayer.setZIndex(499); var ortId; if (this.messprogramm) { ortId = this.record.get('ort');