|
|
|
@ -636,7 +636,7 @@ public abstract class OpenLayerMap {
|
|
|
|
|
* @param layerItem the layer item
|
|
|
|
|
* @param features the features
|
|
|
|
|
*/
|
|
|
|
|
public void addLayerFeaturesAsHighlight(LayerItem layerItem, Feature[] features) {
|
|
|
|
|
public void addLayerFeaturesAsHighlight(LayerItem layerItem, Feature[] features, boolean fitMapToFeaturesExtent) {
|
|
|
|
|
|
|
|
|
|
removeLayerFeaturesAsHighlight(layerItem.getName());
|
|
|
|
|
|
|
|
|
@ -649,17 +649,30 @@ public abstract class OpenLayerMap {
|
|
|
|
|
style.setStroke(stroke);
|
|
|
|
|
|
|
|
|
|
Vector vectorSource = OLFactory.createVectorSource();
|
|
|
|
|
|
|
|
|
|
EventListener<ol.events.Event> listenerE = new EventListener<ol.events.Event>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onEvent(ol.events.Event event) {
|
|
|
|
|
ol.Extent theExtent = vectorSource.getExtent();
|
|
|
|
|
//GWT.log(theExtent.toString());
|
|
|
|
|
map.getView().fit(theExtent);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (fitMapToFeaturesExtent)
|
|
|
|
|
vectorSource.addChangeListener(listenerE);
|
|
|
|
|
|
|
|
|
|
vectorSource.addFeatures(features);
|
|
|
|
|
|
|
|
|
|
GWT.log("features: " + features);
|
|
|
|
|
// GWT.log("features: " + features);
|
|
|
|
|
|
|
|
|
|
VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
|
|
|
|
|
vectorLayerOptions.setSource(vectorSource);
|
|
|
|
|
vectorLayerOptions.setStyle(style);
|
|
|
|
|
|
|
|
|
|
// vectorLayerOptions.setMap(map);
|
|
|
|
|
|
|
|
|
|
GWT.log("vectorLayerOptions: " + vectorLayerOptions);
|
|
|
|
|
// GWT.log("vectorLayerOptions: " + vectorLayerOptions);
|
|
|
|
|
|
|
|
|
|
ol.layer.Vector vector = OLFactory.createVector(vectorLayerOptions);
|
|
|
|
|
// vector.setStyle(style);
|
|
|
|
@ -669,6 +682,7 @@ public abstract class OpenLayerMap {
|
|
|
|
|
vectorLayersHighlighted.put(layerItem.getName(), vector);
|
|
|
|
|
|
|
|
|
|
map.addLayer(vector);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|