Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Selection layer now properly updates on projection change

Mike McGannd08d9c4715c9
diff --git a/web/js/data/wv.data.map.js b/web/js/data/wv.data.map.js
index a0f3eb6c4..ae3e89425 100644
--- a/web/js/data/wv.data.map.js
+++ b/web/js/data/wv.data.map.js
@@ -117,12 +117,9 @@ wv.data.map = wv.data.map || function(model, maps, config) {
selectionLayer = new ol.layer.Vector({
source: new ol.source.Vector(),
style: new ol.style.Style({
- fill: new ol.style.Fill({color: "rgba(127, 127, 127, 0.6)"}),
- stroke: new ol.style.Stroke({
- color: "rgba(127, 127, 127, 0.6)",
- width: 3
- })
- })
+ fill: new ol.style.Fill({color: "rgb(127, 127, 127)"}),
+ }),
+ opacity: 0.6
});
map.addLayer(selectionLayer);
};
@@ -149,6 +146,9 @@ wv.data.map = wv.data.map || function(model, maps, config) {
var updateGranules = function(results) {
granules = results.granules;
updateButtons();
+ _.each(model.selectedGranules, function(granule) {
+ selectGranule(granule);
+ });
};
var updateButtons = function() {
@@ -173,10 +173,10 @@ wv.data.map = wv.data.map || function(model, maps, config) {
var selectGranule = function(granule) {
granule.feature.changed();
- var feature = new ol.Feature(granule.geometry[model.crs]);
- feature.granule = granule;
- granule.selectedFeature = feature;
- selectionLayer.getSource().addFeature(feature);
+ var select = new ol.Feature(granule.geometry[model.crs]);
+ select.granule = granule;
+ granule.selectedFeature = select;
+ selectionLayer.getSource().addFeature(select);
};
var unselectGranule = function(granule) {
@@ -189,7 +189,6 @@ wv.data.map = wv.data.map || function(model, maps, config) {
dispose();
map = maps.selected;
create();
- updateButtons();
};
var clear = function() {
diff --git a/web/js/data/wv.data.model.js b/web/js/data/wv.data.model.js
index c9eb753ae..ce9490fef 100644
--- a/web/js/data/wv.data.model.js
+++ b/web/js/data/wv.data.model.js
@@ -431,8 +431,8 @@ wv.data.model = wv.data.model || function(models, config) {
var updateProjection = function() {
updateProjectionInfo();
- self.events.trigger("projectionUpdate");
updateLayers();
+ self.events.trigger("projectionUpdate");
query();
};
// FIXME: This is a hack
diff --git a/web/js/data/wv.data.results.js b/web/js/data/wv.data.results.js
index af3074e6b..04cd1b439 100644
--- a/web/js/data/wv.data.results.js
+++ b/web/js/data/wv.data.results.js
@@ -743,7 +743,7 @@ wv.data.results.transform = function(projection) {
var projGeom = geom.clone()
.transform(wv.map.CRS_WGS_84, projection);
granule.geometry[projection] = projGeom;
- granule.centroid[projection] = projGeom.getCentroid();
+ granule.centroid[projection] = projGeom.getInteriorPoint();
return granule;
};