Remove collection from Map, implemented.
This commit is contained in:
parent
941805a596
commit
819032fb13
|
@ -302,43 +302,30 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
IndexLayerDV layer = toOpen.getIndexes().get(0);
|
IndexLayerDV layer = toOpen.getIndexes().get(0);
|
||||||
// Open Index Layer
|
// Open Index Layer
|
||||||
|
|
||||||
layerManager.addIndexLayer(layer, toOpen.getUcd().getProfileID(), null);
|
layerManager.addIndexLayer(layer, toOpen.getUcd().getProfileID());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
applicationBus.addHandler(CloseCollectionEvent.TYPE, new CloseCollectionEventHandler() {
|
applicationBus.addHandler(CloseCollectionEvent.TYPE, new CloseCollectionEventHandler() {
|
||||||
|
|
||||||
});
|
@Override
|
||||||
|
public void onCloseCollection(CloseCollectionEvent closeCollectionEvent) {
|
||||||
|
|
||||||
// applicationBus.addHandler(OpenCollectionEvent.TYPE, openCollectionEvent -> {
|
String collId = closeCollectionEvent.getCollectionId();
|
||||||
// GWT.log("Fired event: " + openCollectionEvent);
|
|
||||||
// // Check if ID is available
|
if (collId != null) {
|
||||||
// String collId = openCollectionEvent.getCollectionId();
|
|
||||||
// ViewerConfiguration theConfig = GeoportalDataViewer.getStatus().getViewerConfig();
|
ViewerConfiguration theConfig = GeoportalDataViewer.getStatus().getViewerConfig();
|
||||||
//
|
GCubeCollection toCLose = theConfig.getAvailableCollections().get(collId);
|
||||||
// Set<String> ucdIds = theConfig.getAvailableCollections().keySet();
|
IndexLayerDV layer = toCLose.getIndexes().get(0);
|
||||||
//
|
layerManager.removeIndexLayer(layer);
|
||||||
// if (!ucdIds.contains(collId)) {
|
}
|
||||||
// GWT.log("!! Collection " + collId + " is not available");
|
|
||||||
// Window.alert("Collection " + collId + " is not found.");
|
}
|
||||||
// } else {
|
|
||||||
// GCubeCollection toOpen = theConfig.getAvailableCollections().get(collId);
|
});
|
||||||
//
|
|
||||||
// // Check if indexes is empty
|
|
||||||
// if (toOpen.getIndexes() == null || toOpen.getIndexes().isEmpty()) {
|
|
||||||
// GWT.log("Unexpected empty indexes in collection " + toOpen);
|
|
||||||
// Window.alert("Cannot open collection index layer for " + toOpen.getUcd().getName() + ".");
|
|
||||||
// }
|
|
||||||
// // TODO Get Default Index Layer
|
|
||||||
// // For now we just take the first - only 1 is expected
|
|
||||||
// IndexLayerDV layer = toOpen.getIndexes().get(0);
|
|
||||||
// // Open Index Layer
|
|
||||||
//
|
|
||||||
// layerManager.addIndexLayer(layer);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
applicationBus.addHandler(ShowDetailsEvent.TYPE, new ShowDetailsEventHandler() {
|
applicationBus.addHandler(ShowDetailsEvent.TYPE, new ShowDetailsEventHandler() {
|
||||||
|
|
||||||
|
|
|
@ -578,12 +578,24 @@ public class LayerManager {
|
||||||
* @param profileID the profile ID
|
* @param profileID the profile ID
|
||||||
* @param projectDV the project DV
|
* @param projectDV the project DV
|
||||||
*/
|
*/
|
||||||
public void addIndexLayer(IndexLayerDV layer, String profileID, ProjectDV projectDV) {
|
public void addIndexLayer(IndexLayerDV layer, String profileID) {
|
||||||
GWT.log("Adding index layer: " + layer);
|
GWT.log("Adding index layer: " + layer);
|
||||||
String wmsLink = layer.getLayer().getOgcLinks().get("wms");
|
String wmsLink = layer.getLayer().getOgcLinks().get("wms");
|
||||||
GWT.log("index layer wmsLink: " + wmsLink);
|
GWT.log("index layer wmsLink: " + wmsLink);
|
||||||
addLayer(LayerObjectType.INDEX_LAYER, null, null, wmsLink, false, false, null, false, null, null, profileID,
|
addLayer(LayerObjectType.INDEX_LAYER, null, null, wmsLink, false, false, null, false, null, null, profileID,
|
||||||
null, projectDV);
|
null, null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeIndexLayer(IndexLayerDV layer) {
|
||||||
|
|
||||||
|
String wmsLink = layer.getLayer().getOgcLinks().get("wms");
|
||||||
|
GWT.log("index layer wmsLink: " + wmsLink);
|
||||||
|
|
||||||
|
String layerNameKey = URLUtil.getValueOfParameter("layers", wmsLink);
|
||||||
|
olMap.removeWMSLayer(layerNameKey);
|
||||||
|
mapIndexLayerObjects.remove(layerNameKey);
|
||||||
|
GWT.log("New INDEX_LAYER mapIndexLayerObjects is: " + mapIndexLayerObjects);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1073,4 +1085,6 @@ public class LayerManager {
|
||||||
return overlayLayerManager;
|
return overlayLayerManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,8 @@ public class CloseCollectionEvent extends GwtEvent<CloseCollectionEventHandler>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void dispatch(CloseCollectionEventHandler h) {
|
protected void dispatch(CloseCollectionEventHandler handler) {
|
||||||
|
handler.onCloseCollection(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CloseCollectionEvent(String collectionId) {
|
public CloseCollectionEvent(String collectionId) {
|
||||||
|
|
|
@ -4,4 +4,6 @@ import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
public interface CloseCollectionEventHandler extends EventHandler{
|
public interface CloseCollectionEventHandler extends EventHandler{
|
||||||
|
|
||||||
|
void onCloseCollection(CloseCollectionEvent closeCollectionEvent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,7 +142,6 @@ public abstract class OpenLayerMap {
|
||||||
|
|
||||||
private LayerOrder layerOrder = new LayerOrder();
|
private LayerOrder layerOrder = new LayerOrder();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new open layer OSM.
|
* Instantiates a new open layer OSM.
|
||||||
*
|
*
|
||||||
|
@ -153,7 +152,6 @@ public abstract class OpenLayerMap {
|
||||||
public OpenLayerMap(String divTargetId, HandlerManager eventBus, BaseMapLayer baseLayer) {
|
public OpenLayerMap(String divTargetId, HandlerManager eventBus, BaseMapLayer baseLayer) {
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
|
|
||||||
|
|
||||||
// create a projection
|
// create a projection
|
||||||
projectionOptions.setCode(MAP_PROJECTION.EPSG_3857.getName());
|
projectionOptions.setCode(MAP_PROJECTION.EPSG_3857.getName());
|
||||||
projectionOptions.setUnits("m");
|
projectionOptions.setUnits("m");
|
||||||
|
@ -236,7 +234,6 @@ public abstract class OpenLayerMap {
|
||||||
layerOptions2.setZIndex(zIndex);
|
layerOptions2.setZIndex(zIndex);
|
||||||
baseLayerTile = new Tile(layerOptions2);
|
baseLayerTile = new Tile(layerOptions2);
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -395,7 +392,8 @@ public abstract class OpenLayerMap {
|
||||||
if (layer == null) {
|
if (layer == null) {
|
||||||
ImageWmsParams imageWMSParams = OLFactory.createOptions();
|
ImageWmsParams imageWMSParams = OLFactory.createOptions();
|
||||||
imageWMSParams.setLayers(layerItem.getName());
|
imageWMSParams.setLayers(layerItem.getName());
|
||||||
//imageWMSParams.set("CQL_FILTER", "product_id IN('6165b07202ad3d60e1d26f42','6166ff8002ad3d60e1d26fb7')");
|
// imageWMSParams.set("CQL_FILTER", "product_id
|
||||||
|
// IN('6165b07202ad3d60e1d26f42','6166ff8002ad3d60e1d26fb7')");
|
||||||
|
|
||||||
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
||||||
imageWMSOptions.setUrl(layerItem.getMapServerHost());
|
imageWMSOptions.setUrl(layerItem.getMapServerHost());
|
||||||
|
@ -407,7 +405,6 @@ public abstract class OpenLayerMap {
|
||||||
LayerOptions layerOptions = OLFactory.createOptions();
|
LayerOptions layerOptions = OLFactory.createOptions();
|
||||||
layerOptions.setSource(imageWMSSource);
|
layerOptions.setSource(imageWMSSource);
|
||||||
|
|
||||||
|
|
||||||
// Settings MIN and MAX Resolution
|
// Settings MIN and MAX Resolution
|
||||||
if (layerItem.getMinResolution() != null) {
|
if (layerItem.getMinResolution() != null) {
|
||||||
layerOptions.setMinResolution(layerItem.getMinResolution());
|
layerOptions.setMinResolution(layerItem.getMinResolution());
|
||||||
|
@ -510,6 +507,27 @@ public abstract class OpenLayerMap {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the all detail layers.
|
||||||
|
*/
|
||||||
|
public void removeWMSLayer(String layerName) {
|
||||||
|
GWT.log("Removing layerName: " + layerName + " from map: " + wmsLayerMap);
|
||||||
|
|
||||||
|
// NOT NEEDED ANYMORE.. I'M USING MIN/MAX LAYER RESOLUTION
|
||||||
|
|
||||||
|
if (wmsLayerMap == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Image layer = wmsLayerMap.get(layerName);
|
||||||
|
|
||||||
|
if (layer != null) {
|
||||||
|
map.removeLayer(layer);
|
||||||
|
wmsLayerMap.remove(layerName);
|
||||||
|
GWT.log("Removed layerName: " + layerName + " from map: " + wmsLayerMap.keySet());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the all detail layers.
|
* Removes the all detail layers.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue