[Lada-commits] [PATCH] Fixed Map layer display of selected Ort
Wald Commits
scm-commit at wald.intevation.org
Thu Feb 2 15:46:09 CET 2017
# HG changeset patch
# User Maximilian Krambach <mkrambach at intevation.de>
# Date 1486046765 -3600
# Node ID 152fca74a83905a8a7d08ddb6cc11545a831966e
# Parent c86fd69762644579f978774abef670046a2bd29a
Fixed Map layer display of selected Ort
diff -r c86fd6976264 -r 152fca74a839 app/view/panel/Map.js
--- 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() {
diff -r c86fd6976264 -r 152fca74a839 app/view/window/Ortszuordnung.js
--- 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');
More information about the Lada-commits
mailing list