geoportal-data-viewer-app/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/LayerManager.java

1070 lines
38 KiB
Java
Raw Normal View History

2020-11-19 15:19:27 +01:00
/*
*
*/
2020-10-27 16:04:34 +01:00
package org.gcube.portlets.user.geoportaldataviewer.client;
import java.util.ArrayList;
import java.util.Collection;
2020-10-27 16:04:34 +01:00
import java.util.HashMap;
2022-11-07 17:58:06 +01:00
import java.util.LinkedHashMap;
2020-10-27 16:04:34 +01:00
import java.util.List;
import java.util.Map;
2022-10-19 17:51:13 +02:00
import java.util.Set;
2020-10-27 16:04:34 +01:00
2022-10-18 14:17:41 +02:00
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
2022-10-14 15:31:32 +02:00
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
2022-10-19 17:51:13 +02:00
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV;
2022-10-24 12:23:52 +02:00
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
2020-10-27 16:04:34 +01:00
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.LayerType;
2021-09-01 12:51:06 +02:00
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
2022-10-18 14:17:41 +02:00
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
2020-11-19 15:19:27 +01:00
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler;
2020-10-29 15:18:14 +01:00
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
2020-11-19 15:19:27 +01:00
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
2021-11-12 14:54:54 +01:00
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.ModalWindow;
2022-10-25 14:53:56 +02:00
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil;
2020-11-19 15:19:27 +01:00
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
2020-10-27 16:04:34 +01:00
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
2020-11-19 15:19:27 +01:00
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
2020-10-29 15:18:14 +01:00
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
2020-10-27 16:04:34 +01:00
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
2020-11-19 15:19:27 +01:00
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObjectType;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
2020-10-27 16:04:34 +01:00
import com.github.gwtbootstrap.client.ui.Button;
2022-10-20 18:01:54 +02:00
import com.github.gwtbootstrap.client.ui.Label;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconType;
2022-10-20 18:01:54 +02:00
import com.github.gwtbootstrap.client.ui.constants.LabelType;
2020-10-27 16:04:34 +01:00
import com.google.gwt.core.client.GWT;
2020-11-03 18:04:47 +01:00
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
2022-10-20 18:01:54 +02:00
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
2020-10-29 15:18:14 +01:00
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONParser;
2020-11-03 18:04:47 +01:00
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.EventListener;
2022-10-20 18:01:54 +02:00
import com.google.gwt.user.client.Random;
2020-10-27 16:04:34 +01:00
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.FlexTable;
2021-09-09 15:55:33 +02:00
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
2022-11-15 10:08:02 +01:00
import com.google.gwt.user.client.ui.RootPanel;
2021-09-07 17:29:56 +02:00
import com.google.gwt.user.client.ui.ScrollPanel;
2020-11-03 18:04:47 +01:00
import com.google.gwt.user.client.ui.VerticalPanel;
2020-10-27 16:04:34 +01:00
2020-10-29 17:08:29 +01:00
import ol.Coordinate;
import ol.Extent;
import ol.OLFactory;
import ol.format.GeoJson;
import ol.geom.Geometry;
2020-10-29 17:08:29 +01:00
2020-10-27 16:04:34 +01:00
/**
* The Class LayerManager.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 27, 2020
2020-10-27 16:04:34 +01:00
*/
public class LayerManager {
2020-12-04 15:06:32 +01:00
2020-10-27 16:04:34 +01:00
/** The ol map. */
2021-11-12 14:54:54 +01:00
private OpenLayerMap olMap;
2020-11-19 15:19:27 +01:00
2022-10-19 17:51:13 +02:00
private Map<String, LayerObject> mapOtherLayerObjects = new HashMap<String, LayerObject>();
2022-10-17 16:52:22 +02:00
private Map<String, LayerObject> mapIndexLayerObjects = new HashMap<String, LayerObject>();
2020-11-19 15:19:27 +01:00
private HandlerManager layerManagerBus = new HandlerManager("");
2020-10-27 16:04:34 +01:00
private HandlerManager applicationBus;
private OverlayLayerManager overlayLayerManager;
2020-10-27 16:04:34 +01:00
/**
* Instantiates a new layer manager.
2020-11-19 15:19:27 +01:00
*
* @param applicationBus the application bus
2020-10-27 16:04:34 +01:00
*/
public LayerManager(HandlerManager applicationBus) {
this.applicationBus = applicationBus;
overlayLayerManager = new OverlayLayerManager(applicationBus);
2020-10-29 15:18:14 +01:00
bindEvents();
2020-10-27 16:04:34 +01:00
}
2020-11-19 15:19:27 +01:00
/**
* Bind events.
*/
2020-10-29 15:18:14 +01:00
private void bindEvents() {
2020-11-19 15:19:27 +01:00
layerManagerBus.addHandler(QueryDataEvent.TYPE, new QueryDataEventHandler() {
2020-10-29 15:18:14 +01:00
@Override
public void onQueryInteraction(final QueryDataEvent queryEvent) {
// GeoportalDataViewerConstants.print("fired QueryDataEvent:
// "+queryEvent.toString());
if (queryEvent.getGeoQuery() != null) {
2020-10-29 15:18:14 +01:00
GeoQuery selectDataInfo = queryEvent.getGeoQuery();
2022-10-19 17:51:13 +02:00
final String productID = queryEvent.getProductID();
GWT.log("(" + selectDataInfo.getX1() + "," + selectDataInfo.getY1() + ")(" + selectDataInfo.getX2()
+ "," + selectDataInfo.getY2() + ")");
2020-10-29 15:18:14 +01:00
BoundsMap mapBBOX = new BoundsMap();
2020-10-29 17:48:20 +01:00
double minX = queryEvent.getGeoQuery().getX1();
double minY = queryEvent.getGeoQuery().getY1();
2020-10-29 17:08:29 +01:00
Coordinate centerCoordinate = new Coordinate(minX, minY);
2021-09-01 12:51:06 +02:00
centerCoordinate = olMap.transform(centerCoordinate, MAP_PROJECTION.EPSG_3857.getName(),
MAP_PROJECTION.EPSG_4326.getName());
2020-10-29 17:08:29 +01:00
mapBBOX.setLowerLeftX(centerCoordinate.getX());
mapBBOX.setLowerLeftY(centerCoordinate.getY());
2020-10-29 17:48:20 +01:00
// double maxX = olMap.getExtent().getUpperRightX();
// double maxY = olMap.getExtent().getUpperRightY();
double maxX = queryEvent.getGeoQuery().getX2();
double maxY = queryEvent.getGeoQuery().getY2();
centerCoordinate = new Coordinate(maxX, maxY);
2021-09-01 12:51:06 +02:00
centerCoordinate = olMap.transform(centerCoordinate, MAP_PROJECTION.EPSG_3857.getName(),
MAP_PROJECTION.EPSG_4326.getName());
2020-10-29 17:08:29 +01:00
mapBBOX.setUpperRightX(centerCoordinate.getX());
mapBBOX.setUpperRightY(centerCoordinate.getY());
2021-09-01 12:51:06 +02:00
mapBBOX.setCrs(MAP_PROJECTION.EPSG_4326.getName());
GWT.log("Bounds is: " + mapBBOX);
GWT.log("MAX_WFS_FEATURES is: " + GeoportalDataViewerConstants.MAX_WFS_FEATURES);
// GeoportalDataViewerConstants.print("calling getDataResult");
2021-09-07 17:29:56 +02:00
2021-09-08 14:40:36 +02:00
List<LayerObject> listLO = new ArrayList<LayerObject>();
2021-09-09 15:55:33 +02:00
// for querying base layers
2022-10-19 17:51:13 +02:00
listLO.addAll(mapIndexLayerObjects.values());
2021-09-09 15:55:33 +02:00
// for querying detail layers only in this case
if (olMap.getCurrentResolution() < OLMapManager.LAYER_DETAIL_MAX_RESOLUTION) {
2022-10-19 17:51:13 +02:00
Collection<LayerObject> collLO = mapOtherLayerObjects.values();
listLO.addAll(collLO);
2022-09-06 14:53:19 +02:00
ArrayList<LayerObject> layerVisibility = new ArrayList<LayerObject>(collLO.size());
layerVisibility.addAll(collLO);
2022-09-06 14:53:19 +02:00
// Managing layer visibility. If a layer is not visible has to be not queryable
for (LayerObject layerObject : layerVisibility) {
String layerName = layerObject.getLayerItem().getName();
boolean isLayerVisible = olMap.isLayerVisible(layerName);
2022-09-06 14:53:19 +02:00
if (!isLayerVisible) {
GWT.log("From querying removing layername: " + layerName + ", it is not visible");
listLO.remove(layerObject);
}
// else {
// ExtentWrapped layerExtent = olMap.getSourceExtentForLayer(layerName);
// if(layerExtent!=null) {
// ExtentWrapped centerQueryPoint = new ExtentWrapped(minX, minY, maxX,maxY);
//
// boolean contains = layerExtent.containsExtent(centerQueryPoint);
// GWT.log("layer: "+layerName + " contains the queried BBOX: "+contains);
// }
// }
//
}
2021-09-08 14:40:36 +02:00
}
2021-09-09 15:55:33 +02:00
2021-08-31 18:21:17 +02:00
GeoportalDataViewerServiceAsync.Util.getInstance().getDataResult(listLO, olMap.getProjectionCode(),
mapBBOX, GeoportalDataViewerConstants.MAX_WFS_FEATURES, olMap.getCurrentZoomLevel(),
new AsyncCallback<List<GeoNaSpatialQueryResult>>() {
@Override
public void onFailure(Throwable caught) {
// GeoportalDataViewerConstants.print("on Failure DataResult:
// "+caught.getMessage());
}
@Override
public void onSuccess(List<GeoNaSpatialQueryResult> listGeonaDataObjects) {
2021-08-02 16:45:05 +02:00
GWT.log("GeoNaDataObject's is/are " + listGeonaDataObjects.size());
2022-10-18 14:17:41 +02:00
if (listGeonaDataObjects == null || listGeonaDataObjects.isEmpty())
return;
2022-09-06 14:53:19 +02:00
List<FeatureRow> theFeatures = null;
2021-09-09 15:55:33 +02:00
2021-09-08 17:13:59 +02:00
MapEventType sourceEvent = queryEvent.getSourceMapEventType();
2021-08-31 18:21:17 +02:00
// TODO SWTCH FOR EARCH ITEM TYPE
2022-10-25 11:35:03 +02:00
for (final GeoNaSpatialQueryResult geoNaDataObject : listGeonaDataObjects) {
2022-09-06 14:53:19 +02:00
GWT.log("GeoNaDataObject: " + geoNaDataObject);
List<FeatureRow> features = geoNaDataObject.getFeatures();
2022-09-06 14:53:19 +02:00
LayerItem layerItem = geoNaDataObject.getSourceLayerObject().getLayerItem();
GWT.log(" features: " + features);
GWT.log(" layerItem: " + layerItem);
2022-09-06 14:53:19 +02:00
GWT.log("GeoNaDataObject Source layer item name: " + layerItem.getName());
2021-09-07 17:29:56 +02:00
2022-09-06 14:53:19 +02:00
HashMap<String, List<FeatureRow>> listUniqueProducts = new HashMap<String, List<FeatureRow>>();
// Clustering features for productId
if (features != null && features.size() > 0) {
2021-07-30 15:57:25 +02:00
String theProductId = null;
2022-09-06 14:53:19 +02:00
for (FeatureRow fRow : features) {
2022-10-19 17:51:13 +02:00
List<String> productIdLst = fRow.getMapProperties().get("projectid");
2022-09-06 14:53:19 +02:00
if (productIdLst != null) {
2021-07-30 15:57:25 +02:00
theProductId = productIdLst.get(0);
2022-09-06 14:53:19 +02:00
if (theProductId != null) {
List<FeatureRow> listFeatures = listUniqueProducts
.get(theProductId);
if (listFeatures == null) {
listFeatures = new ArrayList<FeatureRow>();
}
2022-09-06 14:53:19 +02:00
listFeatures.add(fRow);
listUniqueProducts.put(theProductId, listFeatures);
}
}
}
2022-09-06 14:53:19 +02:00
}
GWT.log("listUniqueProducts keyset: " + listUniqueProducts.keySet());
// USING ONLY THE FIRST FEATURE IN THE LIST
if (features != null && features.size() > 0) {
// I need to show exactly the feature with produc_id == recordId
2022-10-19 17:51:13 +02:00
if (productID != null) {
GWT.log("productID is not null: " + productID);
2022-09-06 14:53:19 +02:00
// Searching mongoItemId in the list of product
2022-10-19 17:51:13 +02:00
theFeatures = listUniqueProducts.get(productID);
GWT.log("Loaded productid == product_id with id: " + productID
2022-09-06 14:53:19 +02:00
+ ", the features are: " + theFeatures);
// the recordId/mongoItemId to show has been passed but not found into
// list of
// FeatureRow
if (theFeatures == null || theFeatures.isEmpty()) {
return;
}
}
// If mongoItemId not passed
2022-10-19 17:51:13 +02:00
if (productID == null) {
GWT.log("productID is null");
2022-09-06 14:53:19 +02:00
// Checking if the features returned belonging to detail layers (not
// centroids).
if (listUniqueProducts.isEmpty()) {
2021-09-07 17:29:56 +02:00
// in this case the feature/s returned is/are a (detail) layer/s
// belonging
2021-08-31 18:21:17 +02:00
// to a record/concessione (not centroid layer),
2021-09-07 17:29:56 +02:00
// so calling show popuup info on detail layers if the
// following events are true.
2021-09-09 15:55:33 +02:00
if (sourceEvent.equals(MapEventType.MOUSE_CLICK) && olMap
.getCurrentZoomLevel() > OLMapManager.QUERY_MIN_ZOOM_LEVEL) {
// Here I need to pass only the visible layers
2021-09-07 17:29:56 +02:00
showPopupInfoForLayer(listGeonaDataObjects,
2021-09-08 14:40:36 +02:00
queryEvent.getQueryClickExtent());
2021-09-07 17:29:56 +02:00
}
2021-08-31 18:21:17 +02:00
return;
}
2022-09-06 14:53:19 +02:00
}
// The features of the first centroid layer selected
if (theFeatures == null || theFeatures.size() == 0) {
for (String theProductId : listUniqueProducts.keySet()) {
theFeatures = listUniqueProducts.get(theProductId);
if (theFeatures.size() > 0)
break;
}
}
2021-07-30 15:57:25 +02:00
2022-09-06 14:53:19 +02:00
// Displaying popup info for centroid layer passing the first feature
2021-09-09 15:55:33 +02:00
if (sourceEvent.equals(MapEventType.MOUSE_CLICK)
|| sourceEvent.equals(MapEventType.ADDED_CENTROID_LAYER_TO_MAP)) {
2022-09-06 14:53:19 +02:00
GWT.log("Source event is: " + MapEventType.MOUSE_CLICK + ", or "
+ MapEventType.ADDED_CENTROID_LAYER_TO_MAP);
// Displaying popup info for centroid layer passing the first feature
showPopupInfoForCentroidLayer(geoNaDataObject, theFeatures.get(0),
2021-09-08 14:40:36 +02:00
queryEvent.getQueryClickExtent().getCenter());
}
2021-07-30 15:57:25 +02:00
2021-08-31 18:21:17 +02:00
if (olMap.getCurrentZoomLevel() > OLMapManager.QUERY_MIN_ZOOM_LEVEL) {
2022-09-06 14:53:19 +02:00
GWT.log("Current zoom level is less than QUERY_MIN_ZOOM_LEVEL, Loading all layers of any product");
2022-10-18 14:17:41 +02:00
for (final String theProductID : listUniqueProducts.keySet()) {
GWT.log("Loading layers of theProductId: " + theProductID);
2022-09-06 14:53:19 +02:00
// retrieving and showing WMS layers of a concessione if the ZOOM
// level
// is >
// QUERY_MIN_ZOOM_LEVEL
final String theProfileID = geoNaDataObject.getSourceLayerObject()
.getProfileID();
addLayerToMapForProject(theProfileID, theProductID,
geoNaDataObject.getSourceLayerObject().getProjectDV(),
false);
2022-09-06 14:53:19 +02:00
}
2021-08-31 18:21:17 +02:00
} else {
// removing all WMS detail layers if the ZOOM level is <
// QUERY_MIN_ZOOM_LEVEL
2021-09-08 14:40:36 +02:00
removeAllDetailLayers();
2021-08-31 18:21:17 +02:00
}
}
2020-11-24 12:58:13 +01:00
}
2022-10-18 14:17:41 +02:00
2020-11-24 12:58:13 +01:00
}
});
2020-10-29 15:18:14 +01:00
}
}
});
2020-11-19 15:19:27 +01:00
layerManagerBus.addHandler(AddedLayerToMapEvent.TYPE, new AddedLayerToMapEventHandler() {
2020-11-19 15:19:27 +01:00
@Override
public void onLayerRendered(AddedLayerToMapEvent addedLayerToMapEvent) {
GWT.log("Fired into layerManagerBus " + addedLayerToMapEvent);
2020-11-19 15:19:27 +01:00
applicationBus.fireEvent(addedLayerToMapEvent);
}
});
2020-11-19 15:19:27 +01:00
layerManagerBus.addHandler(ZoomOutOverMinimumEvent.TYPE, new ZoomOutOverMinimumEventHandler() {
2020-11-19 15:19:27 +01:00
@Override
public void onZoomOut(ZoomOutOverMinimumEvent zoomOutEvent) {
GWT.log("Fired into layerManagerBus " + zoomOutEvent);
2021-09-08 14:40:36 +02:00
removeAllDetailLayers();
2020-11-19 15:19:27 +01:00
applicationBus.fireEvent(zoomOutEvent);
}
});
2020-10-29 15:18:14 +01:00
}
2022-11-15 10:08:02 +01:00
/**
* Adds the layer to map for project.
*
* @param theProfileID the the profile ID
* @param theProductID the the product ID
* @param theProjectDV the the project DV
2022-11-15 10:08:02 +01:00
* @param notifyLayerAlreadyAdded the notify layer already added
*/
public void addLayerToMapForProject(String theProfileID, String theProductID, ProjectDV theProjectDV,
final boolean notifyLayerAlreadyAdded) {
GeoportalDataViewerServiceAsync.Util.getInstance().getLayersForId(theProfileID, theProductID,
new AsyncCallback<List<GCubeSDIViewerLayerDV>>() {
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
@Override
public void onSuccess(List<GCubeSDIViewerLayerDV> result) {
for (GCubeSDIViewerLayerDV layer : result) {
GWT.log("Adding layer: " + layer.getLayerName());
addLayer(LayerObjectType.PROJECT_LAYER, layer.getLayerName(), layer.getLayerName(),
layer.getWMSLink(), false, false, null, true,
OLMapManager.LAYER_DETAIL_MIN_RESOLUTION, OLMapManager.LAYER_DETAIL_MAX_RESOLUTION,
theProfileID, theProductID, theProjectDV, notifyLayerAlreadyAdded);
}
}
});
}
2021-09-09 15:55:33 +02:00
/**
* Removes the all detail layers.
*/
2021-09-08 14:40:36 +02:00
public void removeAllDetailLayers() {
2022-10-19 17:51:13 +02:00
mapOtherLayerObjects.clear();
2021-09-08 14:40:36 +02:00
olMap.removeAllDetailLayers();
overlayLayerManager.resetLayers();
2021-09-08 14:40:36 +02:00
}
2020-10-27 16:04:34 +01:00
/**
2020-11-19 15:19:27 +01:00
* Parses the geona references.
2020-10-27 16:04:34 +01:00
*
* @param layerObject the layer object
2022-10-18 14:17:41 +02:00
* @param fRow the f row
2020-11-19 15:19:27 +01:00
* @return the show details event
2020-10-27 16:04:34 +01:00
*/
private ShowDetailsEvent parseGeonaReferences(LayerObject layerObject, FeatureRow fRow) {
if (fRow == null)
2020-11-19 15:19:27 +01:00
return null;
2022-10-19 17:51:13 +02:00
List<String> productIds = fRow.getMapProperties().get("projectid");
if (productIds != null && productIds.size() > 0) {
String productId = productIds.get(0);
LayerObjectType layerObjectType = layerObject.getType();
2022-10-19 17:51:13 +02:00
return new ShowDetailsEvent(layerObjectType != null ? layerObjectType.name() : null,
2022-11-14 16:24:49 +01:00
layerObject.getProfileID(), productId, fRow, true);
2020-11-19 15:19:27 +01:00
}
2020-11-19 15:19:27 +01:00
return null;
}
2020-10-27 16:04:34 +01:00
// ******************************** LAYERS Management
/**
* Adds the layer.
*
* @param object the object
*/
public void addLayer(LayerObject object) {
GWT.log("Layers management : Add layer " + object);
switch (object.getType()) {
case GENERIC_LAYER: {
GWT.log("SUPPORT TO EXTERNAL LAYERS TO BE IMPLEMENTED");
break;
}
case PROJECT_LAYER: {
break;
}
case INDEX_LAYER: {
break;
}
}
}
2020-10-27 16:04:34 +01:00
/**
2020-11-19 15:19:27 +01:00
* Adds the layer.
2020-10-27 16:04:34 +01:00
*
2022-10-18 14:17:41 +02:00
* @param lot the lot
* @param layerTitle the layer title
* @param layerName the layer name
* @param wmsLink the wms link
* @param isBase the is base
* @param displayInLayerSwitcher the display in layer switcher
2022-10-18 14:17:41 +02:00
* @param UUID the uuid
* @param asDetailLayer the as detail layer
* @param minResolution the min resolution
* @param maxResolution the max resolution
* @param profileID the profile ID
* @param projectID the project ID
* @param projectDV the project DV
2020-10-27 16:04:34 +01:00
*/
private void addLayer(final LayerObjectType lot, final String layerTitle, final String layerName,
final String wmsLink, final boolean isBase, final boolean displayInLayerSwitcher, final String UUID,
2022-10-19 17:51:13 +02:00
final boolean asDetailLayer, Double minResolution, Double maxResolution, final String profileID,
2022-11-15 10:08:02 +01:00
final String projectID, final ProjectDV projectDV, final boolean notifyLayerAlreadyAdded) {
GWT.log("addLayer called for profileID: " + profileID + ", projectID: " + projectID + ", projectDV: "
+ projectDV);
2020-10-27 16:04:34 +01:00
final LayerType featureType = isBase ? LayerType.RASTER_BASELAYER : LayerType.FEATURE_TYPE;
if (wmsLink == null || wmsLink.isEmpty()) {
2021-08-31 18:21:17 +02:00
GeoportalDataViewerConstants.printJs("Skipping add layer for wmsLink as null or empty");
return;
}
GeoportalDataViewerServiceAsync.Util.getInstance().parseWmsRequest(wmsLink, layerName,
new AsyncCallback<GeoInformationForWMSRequest>() {
2020-10-27 16:04:34 +01:00
@Override
public void onFailure(Throwable caught) {
2020-10-27 16:04:34 +01:00
Window.alert(caught.getMessage());
}
2020-10-27 16:04:34 +01:00
@Override
public void onSuccess(GeoInformationForWMSRequest geoInfoWMS) {
GWT.log("Parsed WMS Request returned: " + geoInfoWMS);
LayerItem layerItem = toLayerItem(featureType, layerTitle, geoInfoWMS.getLayerName(),
geoInfoWMS.getWmsRequest(), geoInfoWMS.getBaseWmsServiceHost(), true, isBase,
displayInLayerSwitcher, (ArrayList<String>) geoInfoWMS.getStyles().getGeoStyles(),
geoInfoWMS.getWmsRequest(), false, geoInfoWMS.getMapWMSNoStandard(),
geoInfoWMS.isNcWMS(), UUID, geoInfoWMS.getZAxis(), minResolution, maxResolution);
2021-09-09 15:55:33 +02:00
LayerObject lo = new LayerObject();
lo.setLayerItem(layerItem);
lo.setType(lot);
2022-10-19 17:51:13 +02:00
lo.setProjectID(projectID);
lo.setProfileID(profileID);
2022-10-25 11:35:03 +02:00
lo.setProjectDV(projectDV);
2022-10-18 17:32:12 +02:00
2022-10-19 17:51:13 +02:00
String layerNameKey = layerItem.getName();
2021-09-09 15:55:33 +02:00
2022-10-19 17:51:13 +02:00
LayerObject theLo;
switch (lo.getType()) {
case INDEX_LAYER:
theLo = mapIndexLayerObjects.get(layerNameKey);
if (theLo == null) {
theLo = lo;
mapIndexLayerObjects.put(layerNameKey, theLo);
GWT.log("INDEX_LAYER mapIndexLayerObjects is: " + mapIndexLayerObjects);
2021-08-31 18:21:17 +02:00
olMap.addWMSLayer(layerItem);
2021-09-09 15:55:33 +02:00
} else {
2022-10-19 17:51:13 +02:00
GWT.log("Skipping " + lo.getType() + " layer " + theLo.getLayerItem().getName()
+ " already added to Map");
2021-09-08 14:40:36 +02:00
}
2022-10-19 17:51:13 +02:00
break;
case PROJECT_LAYER:
theLo = mapOtherLayerObjects.get(layerNameKey);
if (theLo == null) {
theLo = lo;
mapOtherLayerObjects.put(layerNameKey, theLo);
GWT.log("PROJECT_LAYER mapOtherLayerObjects is: " + mapOtherLayerObjects);
2021-08-31 18:21:17 +02:00
olMap.addWMSDetailLayer(layerItem);
2022-10-25 11:35:03 +02:00
overlayLayerManager.addLayerItem(theLo);
2022-10-19 17:51:13 +02:00
} else {
GWT.log("Skipping " + lo.getType() + " layer " + theLo.getLayerItem().getName()
+ " already added to Map");
if (notifyLayerAlreadyAdded) {
2022-11-15 10:08:02 +01:00
GeoportalDataViewer.showPopover(RootPanel.get(GeoportalDataViewer.APP_NOTIFIER),
"Layers from the selected project are already displayed",
"Layers displayed");
2022-11-15 10:08:02 +01:00
}
2021-09-08 14:40:36 +02:00
}
2022-10-19 17:51:13 +02:00
break;
default:
break;
}
}
});
2020-10-27 16:04:34 +01:00
}
2020-11-19 15:19:27 +01:00
/**
* Adds the index layer.
*
* @param layer the layer
2022-10-25 11:35:03 +02:00
* @param profileID the profile ID
* @param projectDV the project DV
*/
public void addIndexLayer(IndexLayerDV layer, String profileID) {
2022-10-19 17:51:13 +02:00
GWT.log("Adding index layer: " + layer);
String wmsLink = layer.getLayer().getOgcLinks().get("wms");
GWT.log("index layer wmsLink: " + wmsLink);
addLayer(LayerObjectType.INDEX_LAYER, null, null, wmsLink, false, false, null, false, null, null, profileID,
2022-11-15 10:08:02 +01:00
null, null, false);
2022-10-18 14:17:41 +02:00
}
public void removeIndexLayer(IndexLayerDV layer) {
2022-11-07 17:58:06 +01:00
String wmsLink = layer.getLayer().getOgcLinks().get("wms");
GWT.log("index layer wmsLink: " + wmsLink);
2022-11-07 17:58:06 +01:00
String layerNameKey = URLUtil.getValueOfParameter("layers", wmsLink);
olMap.removeWMSLayer(layerNameKey);
mapIndexLayerObjects.remove(layerNameKey);
GWT.log("New INDEX_LAYER mapIndexLayerObjects is: " + mapIndexLayerObjects);
2022-11-07 17:58:06 +01:00
}
2020-10-27 16:04:34 +01:00
/**
2020-11-19 15:19:27 +01:00
* To layer item.
2020-10-27 16:04:34 +01:00
*
* @param layerType the layer type
* @param layerTitle the layer title
* @param layerName the layer name
* @param layerURL the layer URL
* @param mapServerHost the map server host
* @param isExternal the is external
* @param isBase the is base
2020-10-27 16:04:34 +01:00
* @param displayInLayerSwitcher the display in layer switcher
* @param styles the styles
* @param wmsLink the wms link
* @param onTop the on top
* @param wmsNotStandardParams the wms not standard params
* @param isNcWms the is nc wms
* @param UUID the uuid
* @param zAxis the z axis
* @param minResolution the min resolution
* @param maxResolution the max resolution
2020-11-19 15:19:27 +01:00
* @return the layer item
2020-10-27 16:04:34 +01:00
*/
private LayerItem toLayerItem(LayerType layerType, String layerTitle, String layerName, String layerURL,
String mapServerHost, boolean isExternal, boolean isBase, boolean displayInLayerSwitcher,
ArrayList<String> styles, String wmsLink, boolean onTop, HashMap<String, String> wmsNotStandardParams,
boolean isNcWms, String UUID, ZAxis zAxis, Double minResolution, Double maxResolution) {
2020-10-27 16:04:34 +01:00
// GWT.log("Add addLayerByWms 1");
2020-10-29 15:18:14 +01:00
LayerItem layerItem = new LayerItem();
layerItem.setBaseLayer(isBase);
layerItem.setTitle(layerTitle);
layerItem.setName(layerName);
layerItem.setUrl(layerURL);
layerItem.setMapServerHost(mapServerHost);
// l.setExternal(isExternal);
2020-10-29 15:18:14 +01:00
layerItem.setOpacity(1d);
layerItem.setBuffer(2);
2020-11-19 15:19:27 +01:00
layerItem.setWmsLink(wmsLink);
2020-10-29 15:18:14 +01:00
layerItem.setWmsNotStandardParams(wmsNotStandardParams);
layerItem.setNcWms(isNcWms);
layerItem.setUUID(UUID);
layerItem.setZAxis(zAxis);
layerItem.setMinResolution(minResolution);
layerItem.setMaxResolution(maxResolution);
2020-10-27 16:04:34 +01:00
switch (layerType) {
// TODO IMPLEMENT THIS CASE
case RASTER_BASELAYER:
2020-10-27 16:04:34 +01:00
// l.setHasLegend(false);
layerItem.setBaseLayer(true);
layerItem.setTrasparent(false);
layerItem.setClickData(false);
break;
2020-10-27 16:04:34 +01:00
case FEATURE_TYPE:
2020-10-27 16:04:34 +01:00
// CASE FEATURE TYPE
layerItem.setBaseLayer(false);
layerItem.setClickData(true);
layerItem.setTrasparent(true);
break;
2020-10-27 16:04:34 +01:00
}
GWT.log("styles " + styles);
2020-10-27 16:04:34 +01:00
if (styles != null && styles.size() > 0) {
2020-10-29 15:18:14 +01:00
layerItem.setHasLegend(true);
layerItem.setDefaultStyle(styles.get(0));
layerItem.setStyle(styles.get(0));
layerItem.setStyles(styles);
} else {
2020-11-19 15:19:27 +01:00
String style = URLUtil.getValueOfParameter("styles", wmsLink);
if (style != null) { // CASE OF STYLE ="";
// TENTATIVE TO GET LEGEND
2020-10-29 15:18:14 +01:00
layerItem.setHasLegend(true);
2020-10-27 16:04:34 +01:00
}
}
GWT.log("Built layer: " + layerItem);
2020-11-19 15:19:27 +01:00
return layerItem;
2020-10-27 16:04:34 +01:00
}
2021-09-07 17:29:56 +02:00
/**
* Show popup info for layer.
*
* @param listGeoNaDataObject the list geo na data object
2022-09-06 14:53:19 +02:00
* @param queryClick the query click
2021-09-07 17:29:56 +02:00
*/
2021-09-09 15:55:33 +02:00
public void showPopupInfoForLayer(List<GeoNaSpatialQueryResult> listGeoNaDataObject, ExtentWrapped queryClick) {
2022-10-20 18:01:54 +02:00
GWT.log("showPopupInfoForLayer called for " + listGeoNaDataObject);
2021-09-07 17:29:56 +02:00
ScrollPanel scrollPanel = new ScrollPanel();
final FlowPanel flowPanel = new FlowPanel();
flowPanel.getElement().getStyle().setProperty("maxHeight", "600px");
2021-09-09 15:55:33 +02:00
scrollPanel.add(flowPanel);
2022-09-06 14:53:19 +02:00
List<Button> listOpenProject = new ArrayList<Button>();
2022-09-06 14:53:19 +02:00
final Button expandButton = new Button("Expand");
expandButton.setType(ButtonType.LINK);
expandButton.setIcon(IconType.EXPAND);
expandButton.getElement().setId("expand-query");
expandButton.setTitle("Show this view in new Window");
2021-09-09 15:55:33 +02:00
flowPanel.add(expandButton);
2022-09-06 14:53:19 +02:00
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
Element buttonElement = DOM.getElementById("expand-query");
Event.sinkEvents(buttonElement, Event.ONCLICK);
Event.setEventListener(buttonElement, new EventListener() {
@Override
public void onBrowserEvent(Event event) {
if (Event.ONCLICK == event.getTypeInt()) {
expandButton.setVisible(false);
2022-09-06 14:53:19 +02:00
// hiding the Open Project in expand mode (Modal Window)
for (Button butt : listOpenProject) {
butt.setVisible(false);
}
flowPanel.getElement().getStyle().setProperty("maxHeight", "100%");
int width = Window.getClientWidth() * 75 / 100;
int height = Window.getClientHeight() * 70 / 100;
Coordinate center = queryClick.getCenter();
double x = center.getX();
double y = center.getY();
2022-09-06 14:53:19 +02:00
// "with center x: "+x +", y: "+y;
2021-10-18 10:11:21 +02:00
ModalWindow mw = new ModalWindow("Query results...", width, height);
mw.add(flowPanel);
mw.show();
}
}
});
}
});
2022-09-06 14:53:19 +02:00
2022-10-20 18:01:54 +02:00
String prevProjectId = "";
2021-09-07 17:29:56 +02:00
for (GeoNaSpatialQueryResult geoNaSpatialQueryResult : listGeoNaDataObject) {
2021-09-09 15:55:33 +02:00
try {
2022-10-20 18:01:54 +02:00
2022-10-19 17:51:13 +02:00
Set<String> indexLayers = mapIndexLayerObjects.keySet();
2021-09-09 15:55:33 +02:00
LayerObject lo = geoNaSpatialQueryResult.getSourceLayerObject();
LayerItem sourceLI = lo.getLayerItem();
String layerSourceName = sourceLI.getName();
// skipping centroid layer
2022-10-20 18:01:54 +02:00
if (layerSourceName == null || indexLayers.contains(layerSourceName)
|| lo.getType().equals(LayerObjectType.INDEX_LAYER)) {
2021-09-09 15:55:33 +02:00
continue;
}
2022-09-06 14:53:19 +02:00
List<FeatureRow> features = geoNaSpatialQueryResult.getFeatures();
2022-09-06 14:53:19 +02:00
if (features == null || features.isEmpty()) {
continue;
}
2022-09-06 14:53:19 +02:00
2022-10-20 18:01:54 +02:00
String newProjectID = lo.getProjectID();
if (prevProjectId.compareTo(newProjectID) != 0) {
2022-10-24 12:23:52 +02:00
ProjectDV projectDV = lo.getProjectDV();
2022-10-25 14:53:56 +02:00
String htmlMsg = ProjectUtil.toHMLCode(projectDV.getTheDocument());
String projectIntro = htmlMsg.length() > 100 ? StringUtil.ellipsize(htmlMsg, 100) : htmlMsg;
Label headingProfileName = new Label(lo.getProjectDV().getProfileName());
headingProfileName.setType(LabelType.WARNING);
headingProfileName.setTitle("Project ID: " + newProjectID);
headingProfileName.getElement().getStyle().setMarginBottom(10, Unit.PX);
FlowPanel headingPanel = new FlowPanel();
headingPanel.add(headingProfileName);
flowPanel.add(headingPanel);
2022-10-24 12:23:52 +02:00
flowPanel.add(new HTML(projectIntro));
TemporalReferenceDV tempRef = projectDV.getTemporalReference();
if (tempRef != null) {
flowPanel.add(new HTML(ProjectUtil.toHTMLCode(tempRef)));
}
2022-10-20 18:01:54 +02:00
Button buttOpenProject = new Button("Open Project");
final String buttId = "open-details-" + Random.nextInt();
Element bEl = buttOpenProject.getElement();
bEl.setId(buttId);
bEl.getStyle().setPaddingLeft(0, Unit.PX);
buttOpenProject.setType(ButtonType.LINK);
if (buttOpenProject != null) {
flowPanel.add(buttOpenProject);
buttOpenProject.setType(ButtonType.LINK);
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
Element buttonElement = DOM.getElementById(buttId);
Event.sinkEvents(buttonElement, Event.ONCLICK);
Event.setEventListener(buttonElement, new EventListener() {
@Override
public void onBrowserEvent(Event event) {
if (Event.ONCLICK == event.getTypeInt()) {
applicationBus.fireEvent(new ShowDetailsEvent(lo.getType().name(),
2022-11-14 16:24:49 +01:00
lo.getProfileID(), newProjectID, null, true));
2022-10-20 18:01:54 +02:00
}
}
});
}
});
}
listOpenProject.add(buttOpenProject);
HTML subText = new HTML(
"<p style=\"color:#999; font-size:14px; margin:5px 0 5px 0;\">Layers and Properties</p>");
flowPanel.add(subText);
}
prevProjectId = newProjectID;
Label layerLabel = new Label();
layerLabel.setType(LabelType.INFO);
String layerName = StringUtil.fullNameToLayerName(layerSourceName, ":");
layerLabel.setText(layerName);
layerLabel.setTitle(layerSourceName);
layerLabel.getElement().getStyle().setMarginTop(10, Unit.PX);
layerLabel.getElement().getStyle().setMarginBottom(5, Unit.PX);
flowPanel.add(layerLabel);
GWT.log("Displaying " + features.size() + " features");
FlexTable intFlex = new FlexTable();
intFlex.setCellPadding(1);
intFlex.setCellSpacing(1);
intFlex.getElement().addClassName("table-feature");
intFlex.setHTML(0, 0, new HTML("Feature Id").toString());
int i = 0;
for (FeatureRow feature : features) {
intFlex.setHTML(i + 1, 0, new HTML(feature.getId()).toString());
// Showing properties belonging to concessioni layer
Map<String, List<String>> entries = feature.getMapProperties();
if (entries.size() == 0) {
// Adding this row to show "no property" for feature
// intFlex.setHTML(i + 1, 1, new HTML("<i>No property</i>").toString());
}
int j = 0;
for (String key : entries.keySet()) {
List<String> theValues = entries.get(key);
String valueToDisplay = "";
for (String value : theValues) {
valueToDisplay += value + ", ";
}
valueToDisplay = valueToDisplay.substring(0, valueToDisplay.length() - 2);
// adding the keys only of first feature row. They are equal for all features
// (beloning to same layer).
if (i == 0)
intFlex.setHTML(0, j + 1, new HTML(key).toString());
intFlex.setHTML(i + 1, j + 1, new HTML(valueToDisplay).toString());
j++;
}
i++;
}
flowPanel.add(intFlex);
2021-09-09 15:55:33 +02:00
} catch (Exception e) {
GeoportalDataViewerConstants.printJs("Error: " + e.getMessage());
2021-09-07 17:29:56 +02:00
}
}
2021-09-08 14:40:36 +02:00
olMap.showPopup(scrollPanel.toString(), queryClick.getCenter());
2021-09-07 17:29:56 +02:00
}
2022-09-06 14:53:19 +02:00
/**
* Show popup info for centroid layer.
*
2021-09-07 17:29:56 +02:00
* @param geoNaDataObject the geo na data object
* @param feature the feature
* @param onFailureCenterTo the on failure center to
*/
public void showPopupInfoForCentroidLayer(GeoNaSpatialQueryResult geoNaDataObject, FeatureRow feature,
Coordinate onFailureCenterTo) {
2022-11-07 17:58:06 +01:00
GWT.log("showPopupInfoForCentroidLayer showing feature: " + feature);
GWT.log("showPopupInfoForCentroidLayer showing layerObject: " + geoNaDataObject.getSourceLayerObject());
2022-10-19 17:51:13 +02:00
FlexTable flex = new FlexTable();
flex.setCellPadding(1);
flex.setCellSpacing(1);
flex.getElement().addClassName("popup-table");
VerticalPanel vpPanel = new VerticalPanel();
vpPanel.add(flex);
if (feature == null) {
flex.setHTML(0, 0, new HTML("No data available").toString());
2021-09-07 17:29:56 +02:00
olMap.showPopup(vpPanel.toString(), onFailureCenterTo);
return;
}
2022-11-07 17:58:06 +01:00
ProjectDV projectDV = geoNaDataObject.getSourceLayerObject().getProjectDV();
if (projectDV != null) {
2022-11-07 17:58:06 +01:00
FlexTable intFlex = new FlexTable();
intFlex.setCellPadding(1);
intFlex.setCellSpacing(1);
if (projectDV.getTheDocument() != null) {
LinkedHashMap<String, Object> map = projectDV.getTheDocument().getDocumentAsMap();
// my-html-table
// intFlex.getElement().addClassName("my-html-table");
// int i = 0;
for (String key : map.keySet()) {
try {
Object theValue = map.get(key);
String toStringValue = theValue + "";
// intFlex.setHTML(i, 0, key);
intFlex.setHTML(intFlex.getRowCount() + 1, 0,
"<span title='"+toStringValue+"'>" + StringUtil.ellipsize(toStringValue, 100) + "</span>");
// i++;
} catch (Exception e) {
// TODO: handle exception
}
2022-11-07 17:58:06 +01:00
}
flex.setHTML(flex.getRowCount() + 1, 0, intFlex.getElement().getString());
}
TemporalReferenceDV tempRef = projectDV.getTemporalReference();
if (tempRef != null) {
flex.setHTML(flex.getRowCount() + 1, 0, ProjectUtil.toHTMLCode(tempRef));
}
}
2022-11-07 17:58:06 +01:00
// Showing properties belonging to centroid layer, ignoring this
// Map<String, List<String>> entries = feature.getMapProperties();
if (geoNaDataObject.getMapImages() != null) {
for (String key : geoNaDataObject.getMapImages().keySet()) {
2022-10-19 17:51:13 +02:00
List<PayloadDV> listUI = geoNaDataObject.getMapImages().get(key);
GWT.log("Adding images: " + listUI);
if (listUI != null && listUI.size() > 0) {
2022-10-19 17:51:13 +02:00
PayloadDV img = listUI.get(0);
if (img != null && img.getLink() != null) {
2022-10-20 18:01:54 +02:00
String theImgHTML = "<img src=\"" + img.getLink() + "\"></img>";
GWT.log("theImgHTML: " + theImgHTML);
// GeoportalDataViewerConstants.print("The row are:
// "+flex.getRowCount());
flex.setHTML(flex.getRowCount() + 1, 0, theImgHTML);
}
}
}
}
GWT.log("The selected Feature is: " + feature);
// GeoportalDataViewerConstants.print("The selected Feature is: "+feature);
FeatureRow theFeature = feature;
Button button = new Button("Open Details");
button.getElement().setId("open-details");
button.setType(ButtonType.LINK);
if (button != null) {
vpPanel.add(button);
button.setType(ButtonType.LINK);
button.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
ShowDetailsEvent toEvent = parseGeonaReferences(geoNaDataObject.getSourceLayerObject(), theFeature);
applicationBus.fireEvent(toEvent);
}
});
}
Coordinate centerTo = null;
GWT.log("geometry is: " + feature.getGeometry());
if (feature.getGeometry() != null) {
GWT.log("trasforming geometry: " + feature.getGeometry().getToJSONObject());
Geometry geom = new GeoJson().readGeometry(feature.getGeometry().getToJSONObject(), null);
// POINT
if (geom.getType().equalsIgnoreCase("Point")) {
GWT.log("geometry: is a point");
String coordinateJSON = feature.getGeometry().getCoordinatesJSON();
JSONArray centerJSON = (JSONArray) JSONParser.parseStrict(coordinateJSON);
// Coordinate center = OLFactory.createCoordinate(
// new Double(centerJSON.get(0).toString()),
// new Double(centerJSON.get(1).toString()));
Coordinate center = new Coordinate(new Double(centerJSON.get(0).toString()),
new Double(centerJSON.get(1).toString()));
if (feature.getCrsName() != null && feature.getCrsName().endsWith(MAP_PROJECTION.EPSG_4326.getId())) {
center = MapUtils.transformCoordiante(center, MAP_PROJECTION.EPSG_4326.getName(),
MAP_PROJECTION.EPSG_3857.getName());
}
centerTo = center;
} else {
Extent geomExtent = geom.getExtent();
Coordinate lower = OLFactory.createCoordinate(geomExtent.getLowerLeftX(), geomExtent.getLowerLeftY());
Coordinate upper = OLFactory.createCoordinate(geomExtent.getUpperRightX(), geomExtent.getUpperRightY());
Coordinate lowerCoord = lower;
Coordinate upperCoord = upper;
if (feature.getCrsName() != null && feature.getCrsName().endsWith(MAP_PROJECTION.EPSG_4326.getId())) {
lowerCoord = MapUtils.transformCoordiante(lower, MAP_PROJECTION.EPSG_4326.getName(),
MAP_PROJECTION.EPSG_3857.getName());
upperCoord = MapUtils.transformCoordiante(upper, MAP_PROJECTION.EPSG_4326.getName(),
MAP_PROJECTION.EPSG_3857.getName());
}
ExtentWrapped ew = new ExtentWrapped(lowerCoord.getX(), lowerCoord.getY(), upperCoord.getX(),
upperCoord.getY());
centerTo = new Coordinate(ew.getCenter().getX(), ew.getCenter().getY());
}
GWT.log("center is: " + centerTo);
}
// fallback
if (centerTo == null)
centerTo = onFailureCenterTo;
olMap.showPopup(vpPanel.toString(), centerTo);
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
Element buttonElement = DOM.getElementById("open-details");
Event.sinkEvents(buttonElement, Event.ONCLICK);
Event.setEventListener(buttonElement, new EventListener() {
@Override
public void onBrowserEvent(Event event) {
if (Event.ONCLICK == event.getTypeInt()) {
ShowDetailsEvent toEvent = parseGeonaReferences(geoNaDataObject.getSourceLayerObject(),
theFeature);
applicationBus.fireEvent(toEvent);
}
}
});
}
2022-09-06 14:53:19 +02:00
});
}
2020-10-27 16:41:30 +01:00
/**
* Sets the ol map.
*
* @param olMap the new ol map
*/
public void setOLMap(OpenLayerMap olMap) {
2020-10-27 16:41:30 +01:00
this.olMap = olMap;
}
2020-10-27 16:04:34 +01:00
2020-11-19 15:19:27 +01:00
/**
* Gets the layer manager bus.
*
* @return the layer manager bus
*/
public HandlerManager getLayerManagerBus() {
return layerManagerBus;
}
2020-10-27 16:04:34 +01:00
/**
* Gets the overlay layer manager.
*
* @return the overlay layer manager
*/
public OverlayLayerManager getOverlayLayerManager() {
return overlayLayerManager;
}
2020-10-27 16:04:34 +01:00
}