Merged with branch `locate_layer_geometry`
This commit is contained in:
parent
5221d2a6b5
commit
d81ca374dc
|
@ -4,6 +4,12 @@
|
|||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [v3.2.0-SNAPSHOT] - 2023-01-31
|
||||
|
||||
#### Enhancements
|
||||
|
||||
- [#24506] Added Locate/Highlight the Layer facility on the Map
|
||||
|
||||
## [v3.1.0] - 2023-01-12
|
||||
|
||||
#### Enhancements
|
||||
|
|
4
pom.xml
4
pom.xml
|
@ -14,13 +14,13 @@
|
|||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>geoportal-data-viewer-app</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>3.1.0</version>
|
||||
<version>3.2.0-SNAPSHOT</version>
|
||||
<name>GeoPortal Data Viewer App</name>
|
||||
<description>The GeoPortal Data Viewer App is an application to access, discovery and navigate the Geoportal projects/documents by a Web-Map Interface</description>
|
||||
|
||||
<properties>
|
||||
<!-- Convenience property to set the GWT version -->
|
||||
<gwt.version>2.9.0</gwt.version>
|
||||
<gwt.version>2.10.0</gwt.version>
|
||||
<gwt.compiler.style>PRETTY</gwt.compiler.style>
|
||||
<gson.version>2.6.2</gson.version>
|
||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||
|
|
|
@ -2,13 +2,16 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||
|
@ -59,6 +62,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
|
|||
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Popover;
|
||||
import com.github.gwtbootstrap.client.ui.constants.Placement;
|
||||
|
@ -80,6 +84,13 @@ import com.google.gwt.user.client.ui.RootPanel;
|
|||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
import ol.Coordinate;
|
||||
import ol.Feature;
|
||||
import ol.OLFactory;
|
||||
import ol.format.GeoJson;
|
||||
import ol.format.GeoJsonFeatureOptions;
|
||||
import ol.format.GeoJsonOptions;
|
||||
import ol.proj.Projection;
|
||||
import ol.proj.ProjectionOptions;
|
||||
|
||||
/**
|
||||
* Entry point classes define <code>onModuleLoad()</code>.
|
||||
|
@ -140,6 +151,9 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
private boolean initApplication;
|
||||
|
||||
// A cache (Layer_ID, GeoJSON) of layer features loaded via GetFeature Request
|
||||
private HashMap<String, String> layerFeaturesCache = new HashMap<String, String>();
|
||||
|
||||
/**
|
||||
* This is the entry point method.
|
||||
*/
|
||||
|
@ -185,6 +199,9 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Inits the application.
|
||||
*/
|
||||
private void initApplication() {
|
||||
|
||||
initApplication = true;
|
||||
|
@ -285,10 +302,20 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
RootPanel.get(APP_DIV).add(attributionDiv);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the status.
|
||||
*
|
||||
* @return the status
|
||||
*/
|
||||
public static ViewerStatus getStatus() {
|
||||
return viewerStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list base map layers.
|
||||
*
|
||||
* @return the list base map layers
|
||||
*/
|
||||
public static List<BaseMapLayer> getListBaseMapLayers() {
|
||||
return listBaseMapLayers;
|
||||
}
|
||||
|
@ -305,6 +332,11 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the client height.
|
||||
*
|
||||
* @return the client height
|
||||
*/
|
||||
public int getClientHeight() {
|
||||
RootPanel principalDiv = RootPanel.get(APP_DIV);
|
||||
int topBorder = principalDiv.getAbsoluteTop();
|
||||
|
@ -542,7 +574,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
applicationBus.addHandler(DoActionOnDetailLayersEvent.TYPE, new DoActionOnDetailLayersEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onDoActionOnDetailLayers(DoActionOnDetailLayersEvent doLayerActionEvent) {
|
||||
public void onDoActionOnDetailLayers(final DoActionOnDetailLayersEvent doLayerActionEvent) {
|
||||
|
||||
DO_LAYER_ACTION doAction = doLayerActionEvent.getDoAction();
|
||||
GWT.log("event: " + doAction);
|
||||
|
@ -569,6 +601,56 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
doLayerActionEvent.getVisibility());
|
||||
|
||||
break;
|
||||
case LOCATE_LAYER:
|
||||
|
||||
final LayerItem layerItem = doLayerActionEvent.getLayerItem();
|
||||
|
||||
boolean layerHighlighted = olMap.areLayerFeaturesAsHighlight(layerItem);
|
||||
|
||||
if (layerHighlighted) {
|
||||
doLayerActionEvent.getSourceEventUI().setVisibleLoaderFeatures(false, null);
|
||||
olMap.removeLayerFeaturesAsHighlight(layerItem.getName());
|
||||
return;
|
||||
}
|
||||
|
||||
final String geoJSONFeatures = layerFeaturesCache.get(layerItem.getName());
|
||||
|
||||
if (geoJSONFeatures == null) {
|
||||
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().getWFSResponse(layerItem,
|
||||
olMap.getProjectionCode(), null, 0, "json", new AsyncCallback<String>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
doLayerActionEvent.getSourceEventUI().setVisibleLoaderFeatures(false, null);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String geoJSONFeaturesResp) {
|
||||
doLayerActionEvent.getSourceEventUI().setVisibleLoaderFeatures(false, null);
|
||||
|
||||
if (geoJSONFeaturesResp != null && !geoJSONFeaturesResp.isEmpty()) {
|
||||
layerFeaturesCache.put(layerItem.getName(), geoJSONFeaturesResp);
|
||||
|
||||
GWT.log("GeoJSON: " + geoJSONFeaturesResp);
|
||||
|
||||
showLayerFeatures(layerItem, geoJSONFeaturesResp,
|
||||
doLayerActionEvent.getLayerObject().getProjectDV());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
} else {
|
||||
|
||||
doLayerActionEvent.getSourceEventUI().setVisibleLoaderFeatures(false, null);
|
||||
showLayerFeatures(layerItem, geoJSONFeatures,
|
||||
doLayerActionEvent.getLayerObject().getProjectDV());
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -686,6 +768,17 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the.
|
||||
*
|
||||
* @param json the json
|
||||
* @return the object
|
||||
*/
|
||||
public static native Object toJSON(String json) /*-{
|
||||
var jsonObj = JSON.parse(json);
|
||||
//console.log("jsonObj: "+jsonObj);
|
||||
return jsonObj;
|
||||
}-*/;
|
||||
// /**
|
||||
// * Handler popu closer.
|
||||
// *
|
||||
|
@ -703,6 +796,13 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
//
|
||||
// }-*/;
|
||||
|
||||
/**
|
||||
* Perform WFS query on centroid.
|
||||
*
|
||||
* @param projectID the project ID
|
||||
* @param centroidLong the centroid long
|
||||
* @param centroidLat the centroid lat
|
||||
*/
|
||||
private void performWFSQueryOnCentroid(String projectID, Double centroidLong, Double centroidLat) {
|
||||
GWT.log("Perform performWFSQueryOnCentroid: " + projectID + " long: " + centroidLong + ", lat: " + centroidLat);
|
||||
if (projectID != null) {
|
||||
|
@ -727,6 +827,13 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show popover.
|
||||
*
|
||||
* @param w the w
|
||||
* @param message the message
|
||||
* @param heading the heading
|
||||
*/
|
||||
public static void showPopover(final Widget w, String message, String heading) {
|
||||
|
||||
final Popover popover = new Popover();
|
||||
|
@ -748,6 +855,11 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
timer.schedule(3000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the general error panel.
|
||||
*
|
||||
* @return the general error panel
|
||||
*/
|
||||
private FlowPanel getGeneralErrorPanel() {
|
||||
Image geoportalError = new Image(GNAImages.ICONS.geoportaServiceError());
|
||||
FlowPanel errorPanelMsg = new FlowPanel();
|
||||
|
@ -760,4 +872,41 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
return errorPanelMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show layer features.
|
||||
*
|
||||
* @param layerItem the layer item
|
||||
* @param geoJSONFeatures the geo JSON features
|
||||
* @param projectDV the project DV
|
||||
*/
|
||||
private void showLayerFeatures(LayerItem layerItem, String geoJSONFeatures, ProjectDV projectDV) {
|
||||
|
||||
GeoJsonFeatureOptions fo = new GeoJsonFeatureOptions();
|
||||
ProjectionOptions projectionOptions = new ProjectionOptions();
|
||||
projectionOptions.setCode(MAP_PROJECTION.EPSG_4326.getName());
|
||||
Projection fp = new Projection(projectionOptions);
|
||||
fo.setFeatureProjection(fp);
|
||||
fo.setDataProjection(fp);
|
||||
GeoJsonOptions geoJsonOpt = new GeoJsonOptions();
|
||||
geoJsonOpt.setDefaultDataProjection(fp);
|
||||
geoJsonOpt.setFeatureProjection(fp);
|
||||
GeoJson geoJson = OLFactory.createGeoJSON(geoJsonOpt);
|
||||
|
||||
Feature[] features = geoJson.readFeatures(geoJSONFeatures);
|
||||
|
||||
GWT.log("features: " + features);
|
||||
olMapMng.getOLMap().addLayerFeaturesAsHighlight(layerItem, features);
|
||||
|
||||
if (projectDV != null) {
|
||||
GeoJSON spatialReference = projectDV.getSpatialReference();
|
||||
|
||||
GWT.log("spatialReference is: " + spatialReference);
|
||||
Coordinate transfCoord = MapUtils.geoJSONTToBBoxCenter(spatialReference, MAP_PROJECTION.EPSG_4326.getName(),
|
||||
MAP_PROJECTION.EPSG_3857.getName());
|
||||
GWT.log("transfCoord is: " + transfCoord);
|
||||
if (transfCoord != null)
|
||||
olMapMng.getOLMap().setCenter(transfCoord);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
|
|||
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
||||
|
||||
|
@ -179,4 +180,30 @@ public interface GeoportalDataViewerService extends RemoteService {
|
|||
*/
|
||||
GeoJSON getSpatialReference(String profileID, String projectID);
|
||||
|
||||
/**
|
||||
* Gets the WFS request.
|
||||
*
|
||||
* @param layerItem the layer item
|
||||
* @param mapSrsName the map srs name
|
||||
* @param mapBBOX the map BBOX
|
||||
* @param maxFeatures the max features. If 0 means all feature
|
||||
* @param outputFormat the output format
|
||||
* @return the WFS request
|
||||
*/
|
||||
String getWFSRequest(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures,
|
||||
String outputFormat);
|
||||
|
||||
/**
|
||||
* Gets the WFS response.
|
||||
*
|
||||
* @param layerItem the layer item
|
||||
* @param mapSrsName the map srs name
|
||||
* @param mapBBOX the map BBOX
|
||||
* @param maxFeatures the max features
|
||||
* @param outputFormat the output format
|
||||
* @return the WFS response
|
||||
*/
|
||||
String getWFSResponse(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures,
|
||||
String outputFormat);
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
|
|||
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
||||
|
||||
|
@ -75,4 +76,10 @@ public interface GeoportalDataViewerServiceAsync {
|
|||
|
||||
void getSpatialReference(String profileID, String projectID, AsyncCallback<GeoJSON> callback);
|
||||
|
||||
void getWFSRequest(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures, String outputFormat,
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
void getWFSResponse(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures, String outputFormat,
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
}
|
||||
|
|
|
@ -412,6 +412,7 @@ public class LayerManager {
|
|||
public void removeAllDetailLayers() {
|
||||
mapOtherLayerObjects.clear();
|
||||
olMap.removeAllDetailLayers();
|
||||
olMap.removeAllLayerFeaturesAsHighlight();
|
||||
overlayLayerManager.resetLayers();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd.DragDropLayer;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
@ -22,7 +24,7 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
|
|||
* Oct 12, 2021
|
||||
*/
|
||||
public static enum DO_LAYER_ACTION {
|
||||
VISIBILITY, SWAP, OPACITY
|
||||
VISIBILITY, SWAP, OPACITY, LOCATE_LAYER
|
||||
}
|
||||
|
||||
private DO_LAYER_ACTION doAction;
|
||||
|
@ -31,15 +33,17 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
|
|||
private boolean visibility;
|
||||
private SwapLayer sourceLayerSwap;
|
||||
private SwapLayer targetLayerSwap;
|
||||
private LayerObject layerObject;
|
||||
private DragDropLayer sourceEventUI;
|
||||
|
||||
/**
|
||||
* The Class SwapLayer.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Oct 15, 2021
|
||||
* Oct 15, 2021
|
||||
*/
|
||||
public static class SwapLayer{
|
||||
public static class SwapLayer {
|
||||
private LayerItem layerItem;
|
||||
private int position;
|
||||
|
||||
|
@ -47,9 +51,9 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
|
|||
* Instantiates a new swap layer.
|
||||
*
|
||||
* @param layerItem the layer item
|
||||
* @param position the position
|
||||
* @param position the position
|
||||
*/
|
||||
public SwapLayer(LayerItem layerItem, int position){
|
||||
public SwapLayer(LayerItem layerItem, int position) {
|
||||
this.layerItem = layerItem;
|
||||
this.position = position;
|
||||
}
|
||||
|
@ -76,11 +80,14 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
|
|||
/**
|
||||
* Instantiates a new do action on detail layers event.
|
||||
*
|
||||
* @param action the action
|
||||
* @param layerItem the layer item
|
||||
* @param action the action
|
||||
* @param layerItem the layer item
|
||||
* @param layerObject the layer object
|
||||
* @param layerObject the layer object
|
||||
*/
|
||||
public DoActionOnDetailLayersEvent(DO_LAYER_ACTION action, LayerItem layerItem) {
|
||||
public DoActionOnDetailLayersEvent(DO_LAYER_ACTION action, LayerItem layerItem, LayerObject layerObject) {
|
||||
this.layerItem = layerItem;
|
||||
this.layerObject = layerObject;
|
||||
this.doAction = action;
|
||||
}
|
||||
|
||||
|
@ -135,6 +142,24 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the layer object.
|
||||
*
|
||||
* @return the layer object
|
||||
*/
|
||||
public LayerObject getLayerObject() {
|
||||
return layerObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the layer object.
|
||||
*
|
||||
* @param layerObject the new layer object
|
||||
*/
|
||||
public void setLayerObject(LayerObject layerObject) {
|
||||
this.layerObject = layerObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the do action.
|
||||
*
|
||||
|
@ -189,6 +214,25 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
|
|||
return visibility;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the UI event source.
|
||||
*
|
||||
* @param sourceEventUI the new UI event source
|
||||
*/
|
||||
public void setUIEventSource(DragDropLayer sourceEventUI) {
|
||||
this.sourceEventUI = sourceEventUI;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the source event UI.
|
||||
*
|
||||
* @return the source event UI
|
||||
*/
|
||||
public DragDropLayer getSourceEventUI() {
|
||||
return sourceEventUI;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
|
|
|
@ -37,6 +37,7 @@ import ol.Size;
|
|||
import ol.View;
|
||||
import ol.ViewOptions;
|
||||
import ol.animation.AnimationOptions;
|
||||
import ol.color.Color;
|
||||
import ol.event.EventListener;
|
||||
import ol.geom.Geometry;
|
||||
import ol.interaction.Draw;
|
||||
|
@ -62,6 +63,11 @@ import ol.source.Source;
|
|||
import ol.source.Vector;
|
||||
import ol.source.Xyz;
|
||||
import ol.source.XyzOptions;
|
||||
import ol.style.Fill;
|
||||
import ol.style.FillOptions;
|
||||
import ol.style.Stroke;
|
||||
import ol.style.StrokeOptions;
|
||||
import ol.style.Style;
|
||||
|
||||
/**
|
||||
* The Class OpenLayerMap.
|
||||
|
@ -72,7 +78,7 @@ import ol.source.XyzOptions;
|
|||
*/
|
||||
public abstract class OpenLayerMap {
|
||||
|
||||
private static final int MAX_LENGHT_CQL_FOR_GET_REQUEST = 1600; //1600 characters
|
||||
private static final int MAX_LENGHT_CQL_FOR_GET_REQUEST = 1600; // 1600 characters
|
||||
|
||||
public static final int SET_CENTER_ANIMATED_DURATION = 500;
|
||||
|
||||
|
@ -145,6 +151,8 @@ public abstract class OpenLayerMap {
|
|||
|
||||
private LinkedHashMap<String, Image> wmsLayerMap;
|
||||
|
||||
private LinkedHashMap<String, ol.layer.Vector> vectorLayersHighlighted = new LinkedHashMap<String, ol.layer.Vector>();
|
||||
|
||||
private Layer baseLayerTile;
|
||||
|
||||
private LayerOrder layerOrder = new LayerOrder();
|
||||
|
@ -310,7 +318,7 @@ public abstract class OpenLayerMap {
|
|||
animations.setDuration(SET_CENTER_ANIMATED_DURATION);
|
||||
view.animate(animations);
|
||||
|
||||
//view.setCenter(centerCoordinate);
|
||||
// view.setCenter(centerCoordinate);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -323,7 +331,7 @@ public abstract class OpenLayerMap {
|
|||
animations.setDuration(ZOOM_ANIMATED_DURATION);
|
||||
animations.setZoom(zoom);
|
||||
view.animate(animations);
|
||||
//view.setZoom(zoom);
|
||||
// view.setZoom(zoom);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -447,6 +455,12 @@ public abstract class OpenLayerMap {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the CQL filter to WMS layer.
|
||||
*
|
||||
* @param key the key
|
||||
* @param cqlFilterExpression the cql filter expression
|
||||
*/
|
||||
public void setCQLFilterToWMSLayer(String key, String cqlFilterExpression) {
|
||||
|
||||
GWT.log("Getting key: " + key);
|
||||
|
@ -472,6 +486,8 @@ public abstract class OpenLayerMap {
|
|||
|
||||
wmsLayer.changed();
|
||||
|
||||
wmsLayer.changed();
|
||||
|
||||
//map.addLayer(wmsLayer);
|
||||
|
||||
}
|
||||
|
@ -528,6 +544,8 @@ public abstract class OpenLayerMap {
|
|||
|
||||
/**
|
||||
* Removes the all detail layers.
|
||||
*
|
||||
* @param layerName the layer name
|
||||
*/
|
||||
public void removeWMSLayer(String layerName) {
|
||||
GWT.log("Removing layerName: " + layerName + " from map: " + wmsLayerMap);
|
||||
|
@ -552,8 +570,6 @@ public abstract class OpenLayerMap {
|
|||
*/
|
||||
public void removeAllDetailLayers() {
|
||||
|
||||
// NOT NEEDED ANYMORE.. I'M USING MIN/MAX LAYER RESOLUTION
|
||||
|
||||
if (wmsDetailsLayerMap == null)
|
||||
return;
|
||||
|
||||
|
@ -568,6 +584,24 @@ public abstract class OpenLayerMap {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the all layer features as highlight.
|
||||
*/
|
||||
public void removeAllLayerFeaturesAsHighlight() {
|
||||
|
||||
if (vectorLayersHighlighted == null)
|
||||
return;
|
||||
|
||||
GWT.log("Removing vectorLayersHighlighted: " + vectorLayersHighlighted.keySet() + " from map");
|
||||
|
||||
for (String layerName : vectorLayersHighlighted.keySet()) {
|
||||
removeLayerFeaturesAsHighlight(layerName);
|
||||
}
|
||||
|
||||
vectorLayersHighlighted.clear();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the vector.
|
||||
*
|
||||
|
@ -578,12 +612,12 @@ public abstract class OpenLayerMap {
|
|||
VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
|
||||
vectorLayerOptions.setMap(map);
|
||||
|
||||
// Style style = new Style();
|
||||
// FillOptions fillOptions = new FillOptions();
|
||||
// Color color = new Color(0, 0, 255, 1.0);
|
||||
// fillOptions.setColor(color);
|
||||
// Fill fill = new Fill(fillOptions);
|
||||
// style.setFill(fill);
|
||||
Style style = new Style();
|
||||
FillOptions fillOptions = new FillOptions();
|
||||
Color color = new Color(0, 0, 255, 1.0);
|
||||
fillOptions.setColor(color);
|
||||
Fill fill = new Fill(fillOptions);
|
||||
style.setFill(fill);
|
||||
|
||||
FeatureOptions featureOptions = new FeatureOptions();
|
||||
featureOptions.setGeometry(geometry);
|
||||
|
@ -595,12 +629,87 @@ public abstract class OpenLayerMap {
|
|||
|
||||
ol.layer.Vector vector = OLFactory.createVector(vectorLayerOptions);
|
||||
|
||||
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.VECTOR) + 1;
|
||||
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.VECTOR) + 1000;
|
||||
vector.setZIndex(zIndex);
|
||||
|
||||
map.addLayer(vector);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the vector.
|
||||
*
|
||||
* @param layerItem the layer item
|
||||
* @param features the features
|
||||
*/
|
||||
public void addLayerFeaturesAsHighlight(LayerItem layerItem, Feature[] features) {
|
||||
|
||||
removeLayerFeaturesAsHighlight(layerItem.getName());
|
||||
|
||||
Style style = new Style();
|
||||
StrokeOptions strokeOptions = new StrokeOptions();
|
||||
strokeOptions.setColor(new Color(255, 255, 0, 0.8));
|
||||
strokeOptions.setWidth(5);
|
||||
Stroke stroke = new Stroke(strokeOptions);
|
||||
stroke.setWidth(2);
|
||||
style.setStroke(stroke);
|
||||
|
||||
Vector vectorSource = OLFactory.createVectorSource();
|
||||
vectorSource.addFeatures(features);
|
||||
|
||||
GWT.log("features: " + features);
|
||||
|
||||
VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
|
||||
vectorLayerOptions.setSource(vectorSource);
|
||||
vectorLayerOptions.setStyle(style);
|
||||
|
||||
// vectorLayerOptions.setMap(map);
|
||||
|
||||
GWT.log("vectorLayerOptions: " + vectorLayerOptions);
|
||||
|
||||
ol.layer.Vector vector = OLFactory.createVector(vectorLayerOptions);
|
||||
// vector.setStyle(style);
|
||||
vector.setVisible(true);
|
||||
vector.setZIndex(5000);
|
||||
|
||||
vectorLayersHighlighted.put(layerItem.getName(), vector);
|
||||
|
||||
map.addLayer(vector);
|
||||
}
|
||||
|
||||
/**
|
||||
* Are layer features A as highlight.
|
||||
*
|
||||
* @param layerItem the layer item
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean areLayerFeaturesAsHighlight(LayerItem layerItem) {
|
||||
return vectorLayersHighlighted.get(layerItem.getName()) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the layer features A as highlight.
|
||||
*
|
||||
* @param layerName the layer name
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean removeLayerFeaturesAsHighlight(String layerName) {
|
||||
|
||||
try {
|
||||
|
||||
ol.layer.Vector vl = vectorLayersHighlighted.get(layerName);
|
||||
|
||||
if (vl != null) {
|
||||
map.removeLayer(vl);
|
||||
vectorLayersHighlighted.remove(layerName);
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the point vector source.
|
||||
*
|
||||
|
@ -971,6 +1080,4 @@ public abstract class OpenLayerMap {
|
|||
return map.get((map.keySet().toArray())[index]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -47,6 +47,12 @@ public interface GNAImages extends ClientBundle {
|
|||
@Source("layer_invisible.png")
|
||||
ImageResource layerInvisible();
|
||||
|
||||
@Source("locate.png")
|
||||
ImageResource locate();
|
||||
|
||||
@Source("locate_none.png")
|
||||
ImageResource locateNone();
|
||||
|
||||
@Source("spinner_earth.gif")
|
||||
ImageResource spinnerEarth();
|
||||
|
||||
|
|
|
@ -144,7 +144,8 @@ public class TimelineRelationPanel extends Composite {
|
|||
final String thePofileID = references[0];
|
||||
final String theProjectID = references[1];
|
||||
GeoportalItemReferences gir = new GeoportalItemReferences(theProjectID, thePofileID);
|
||||
ShowDetailsEvent showDetailsEvent = new ShowDetailsEvent(gir, null, false, false, EVENT_SOURCE.LOCATE_FROM_TIMELINE);
|
||||
ShowDetailsEvent showDetailsEvent = new ShowDetailsEvent(gir, null, false, false,
|
||||
EVENT_SOURCE.LOCATE_FROM_TIMELINE);
|
||||
showDetailsEvent.setEventFromTimeline(true);
|
||||
GWT.log("fireEvent: " + showDetailsEvent);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd;
|
|||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent;
|
||||
|
@ -9,6 +10,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetai
|
|||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||
|
@ -19,6 +21,7 @@ import com.github.gwtbootstrap.client.ui.constants.IconType;
|
|||
import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.dom.client.Style.FontWeight;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
|
@ -32,21 +35,33 @@ import com.google.gwt.event.dom.client.DropEvent;
|
|||
import com.google.gwt.event.dom.client.DropHandler;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.FlexTable;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.SimplePanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class DragDropLayer extends FlowPanel {
|
||||
|
||||
private static final String _22PX = "22px";
|
||||
private static DragDropLayer dragging = null;
|
||||
private static DragDropLayer draggingTarget = null;
|
||||
final boolean droppable;
|
||||
private Label labelLayerName;
|
||||
private Image imgLayerVisible = new Image(GNAImages.ICONS.layerVisible());
|
||||
private Image imgLayerInvisible = new Image(GNAImages.ICONS.layerInvisible());
|
||||
|
||||
private Image imgLocate = new Image(GNAImages.ICONS.locate());
|
||||
private Image imgLocateNone = new Image(GNAImages.ICONS.locateNone());
|
||||
private boolean locateEnabled = false;
|
||||
private HTML buttonLocate = new HTML();
|
||||
|
||||
private DragDropLayer INSTANCE = this;
|
||||
|
||||
private LoaderIcon loaderIcon = new LoaderIcon("Loading features", null);
|
||||
|
||||
private Button draggableButton = new Button();
|
||||
private HandlerManager applicationBus;
|
||||
private LayerObject layerObject;
|
||||
|
@ -61,6 +76,26 @@ public class DragDropLayer extends FlowPanel {
|
|||
this.layerItem = layerObject.getLayerItem();
|
||||
GWT.log("DragDropLayer for projectDV: " + layerObject.getProjectDV());
|
||||
|
||||
// Checking the spatial reference
|
||||
if (layerObject.getProjectDV() != null && layerObject.getProjectDV().getSpatialReference() == null) {
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().getSpatialReference(layerObject.getProfileID(),
|
||||
layerObject.getProjectID(), new AsyncCallback<GeoJSON>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(GeoJSON result) {
|
||||
if (result != null)
|
||||
layerObject.getProjectDV().setSpatialReference(result);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
String referProjectID = "Project ID: " + layerObject.getProjectDV().getId();
|
||||
labelProject = new com.google.gwt.user.client.ui.Label("");
|
||||
labelProject.setTitle(referProjectID);
|
||||
|
@ -119,26 +154,57 @@ public class DragDropLayer extends FlowPanel {
|
|||
|
||||
RangeSlider rs = new RangeSlider(applicationBus, layerItem);
|
||||
rs.getElement().addClassName("range-slider");
|
||||
FlexTable ft = new FlexTable();
|
||||
ft.setWidget(0, 0, draggableButton);
|
||||
|
||||
// FlexTable ft = new FlexTable();
|
||||
// ft.setWidget(0, 0, draggableButton);
|
||||
draggableButton.setTitle("Drag and Drop me up or down to change my position on the Map");
|
||||
|
||||
imgLayerVisible.getElement().addClassName("layer-visibility-st");
|
||||
imgLayerInvisible.getElement().addClassName("layer-visibility-st");
|
||||
|
||||
imgLocate.setWidth(_22PX);
|
||||
imgLocate.setHeight(_22PX);
|
||||
imgLocateNone.setWidth(_22PX);
|
||||
imgLocateNone.setHeight(_22PX);
|
||||
imgLocate.getElement().addClassName("layer-visibility-st");
|
||||
imgLocateNone.getElement().addClassName("layer-visibility-st");
|
||||
setLocateEnabledButtonImage();
|
||||
|
||||
setLayerVisibilityButtonImage();
|
||||
|
||||
// labelLayerName.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
||||
ft.setWidget(0, 1, buttonLayerVisibility);
|
||||
ft.setWidget(0, 2, labelProject);
|
||||
VerticalPanel vp = new VerticalPanel();
|
||||
VerticalPanel vpInner = new VerticalPanel();
|
||||
HorizontalPanel hp0 = new HorizontalPanel();
|
||||
HorizontalPanel hpFunct = new HorizontalPanel();
|
||||
vpInner.getElement().getStyle().setMarginLeft(47, Unit.PX);
|
||||
|
||||
hp0.add(draggableButton);
|
||||
labelProject.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
||||
labelProject.getElement().getStyle().setFontWeight(FontWeight.BOLD);
|
||||
hp0.add(labelProject);
|
||||
hpFunct.add(buttonLayerVisibility);
|
||||
hpFunct.add(buttonLocate);
|
||||
hpFunct.add(loaderIcon);
|
||||
setVisibleLoaderFeatures(false, null);
|
||||
|
||||
if(layerObject.getProjectDV().getTemporalReference()!=null) {
|
||||
TemporalReferenceDV tempRef = layerObject.getProjectDV().getTemporalReference();
|
||||
ft.setWidget(ft.getRowCount()+1, 2, new HTML(ProjectUtil.toHTMLCode(tempRef)));
|
||||
// ft.setWidget(ft.getRowCount() + 1, 2, new HTML(ProjectUtil.toHTMLCode(tempRef)));
|
||||
vpInner.add(new HTML(ProjectUtil.toHTMLCode(tempRef)));
|
||||
}
|
||||
|
||||
ft.setWidget(ft.getRowCount()+1, 2, labelLayerName);
|
||||
ft.setWidget(ft.getRowCount()+1, 2, new SimplePanel(rs));
|
||||
add(ft);
|
||||
vpInner.add(labelLayerName);
|
||||
// vpInner.add(new SimplePanel(rs));
|
||||
|
||||
vp.add(hp0);
|
||||
hpFunct.getElement().getStyle().setMarginTop(5, Unit.PX);
|
||||
vpInner.add(hpFunct);
|
||||
vpInner.add(new SimplePanel(rs));
|
||||
vp.add(vpInner);
|
||||
|
||||
add(vp);
|
||||
|
||||
// add(ft);
|
||||
draggableButton.setIcon(IconType.MOVE);
|
||||
|
||||
buttonLayerVisibility.addClickHandler(new ClickHandler() {
|
||||
|
@ -147,20 +213,48 @@ public class DragDropLayer extends FlowPanel {
|
|||
public void onClick(ClickEvent event) {
|
||||
layerVisibility = !layerVisibility;
|
||||
setLayerVisibilityButtonImage();
|
||||
DoActionOnDetailLayersEvent dae = new DoActionOnDetailLayersEvent(DO_LAYER_ACTION.VISIBILITY,
|
||||
layerItem);
|
||||
DoActionOnDetailLayersEvent dae = new DoActionOnDetailLayersEvent(DO_LAYER_ACTION.VISIBILITY, layerItem,
|
||||
layerObject);
|
||||
dae.setVisibility(layerVisibility);
|
||||
applicationBus.fireEvent(dae);
|
||||
}
|
||||
});
|
||||
|
||||
buttonLocate.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
locateEnabled = !locateEnabled;
|
||||
setLocateEnabledButtonImage();
|
||||
DoActionOnDetailLayersEvent dae = new DoActionOnDetailLayersEvent(DO_LAYER_ACTION.LOCATE_LAYER,
|
||||
layerItem, layerObject);
|
||||
dae.setUIEventSource(INSTANCE);
|
||||
setVisibleLoaderFeatures(true, null);
|
||||
applicationBus.fireEvent(dae);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setLayerVisibilityButtonImage() {
|
||||
buttonLayerVisibility.getElement().removeAllChildren();
|
||||
if (layerVisibility) {
|
||||
buttonLayerVisibility.getElement().appendChild(imgLayerVisible.getElement());
|
||||
buttonLayerVisibility.setTitle("Hide the layer");
|
||||
} else {
|
||||
buttonLayerVisibility.getElement().appendChild(imgLayerInvisible.getElement());
|
||||
buttonLayerVisibility.setTitle("Show the layer");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setLocateEnabledButtonImage() {
|
||||
buttonLocate.getElement().removeAllChildren();
|
||||
if (locateEnabled) {
|
||||
buttonLocate.getElement().appendChild(imgLocate.getElement());
|
||||
buttonLocate.setTitle("Unselect the layer features");
|
||||
} else {
|
||||
buttonLocate.getElement().appendChild(imgLocateNone.getElement());
|
||||
buttonLocate.setTitle("Highlight the layer features");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -226,7 +320,7 @@ public class DragDropLayer extends FlowPanel {
|
|||
tree.insert(source, targetIndex);
|
||||
// target.setState(true);
|
||||
DoActionOnDetailLayersEvent actionSwapLayers = new DoActionOnDetailLayersEvent(
|
||||
DO_LAYER_ACTION.SWAP, layerItem);
|
||||
DO_LAYER_ACTION.SWAP, layerItem, layerObject);
|
||||
SwapLayer swapLS = new DoActionOnDetailLayersEvent.SwapLayer(dragging.getLayerItem(),
|
||||
sourceIndex);
|
||||
SwapLayer swapLT = new DoActionOnDetailLayersEvent.SwapLayer(draggingTarget.getLayerItem(),
|
||||
|
@ -245,4 +339,17 @@ public class DragDropLayer extends FlowPanel {
|
|||
return layerItem;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the visible loader features.
|
||||
*
|
||||
* @param bool the bool
|
||||
* @param msg the msg
|
||||
*/
|
||||
public void setVisibleLoaderFeatures(boolean bool, String msg) {
|
||||
loaderIcon.setVisible(bool);
|
||||
if(msg!=null)
|
||||
loaderIcon.setText(msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class RangeSlider extends Composite {
|
|||
if (Event.ONMOUSEUP == event.getTypeInt()) {
|
||||
GWT.log("Event.ONMOUSEUP");
|
||||
DoActionOnDetailLayersEvent actionChangeOpacity = new DoActionOnDetailLayersEvent(
|
||||
DO_LAYER_ACTION.OPACITY, layer);
|
||||
DO_LAYER_ACTION.OPACITY, layer, null);
|
||||
int value = Integer.parseInt((String) theSlider.getPropertyObject("value"));
|
||||
//GWT.log("opacity int value: "+value);
|
||||
double opacity = (double) ((double) value/100);
|
||||
|
|
|
@ -3,6 +3,10 @@ package org.gcube.portlets.user.geoportaldataviewer.server;
|
|||
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.projects;
|
||||
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.useCaseDescriptors;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
@ -60,6 +64,7 @@ import org.gcube.application.geoportalcommon.util.URLParserUtil;
|
|||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerService;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.gis.FeatureParser;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.gis.GisMakers;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.gis.WMSUrlValidator;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.GeoportalServiceIdentityProxy;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.util.ContextRequest;
|
||||
|
@ -72,6 +77,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedData
|
|||
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.faults.ControlledError;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||
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;
|
||||
|
@ -347,7 +353,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
* @param layerObjects the layer objects
|
||||
* @param mapSrsName the map srs name
|
||||
* @param selectBBOX the select BBOX
|
||||
* @param maxWFSFeature the max WFS feature
|
||||
* @param maxWFSFeature the max WFS feature. If 0 means all feature
|
||||
* @param zoomLevel the zoom level
|
||||
* @return the WFS features
|
||||
*/
|
||||
|
@ -772,7 +778,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
|
||||
//(see ticket #24390)
|
||||
if (accessPolicy.equals(ACCESS_POLICY.OPEN)) {
|
||||
// Filtering for ACCESS_POLICY.OPEN from the fileset when the username is not in session. IAM
|
||||
// Filtering for ACCESS_POLICY.OPEN from the fileset when the username is not in
|
||||
// session. IAM
|
||||
// identity is running, no logged in user.
|
||||
filesetParentJSONPath = String.format("%s..%s[?(@._access._policy=='%s')]",
|
||||
Geoportal_JSON_Mapper.JSON_$_POINTER, Geoportal_JSON_Mapper.FILESET, accessPolicy);
|
||||
|
@ -1539,4 +1546,84 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the WFS request.
|
||||
*
|
||||
* @param layerItem the layer item
|
||||
* @param mapSrsName the map srs name
|
||||
* @param mapBBOX the map BBOX
|
||||
* @param maxFeatures the max features. If 0 means all feature
|
||||
* @param outputFormat the output format
|
||||
* @return the WFS request
|
||||
*/
|
||||
@Override
|
||||
public String getWFSRequest(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures,
|
||||
String outputFormat) {
|
||||
LOG.info("getWFSRequest called");
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("getWFSRequest parameters layerItem name: " + layerItem.getName(), ", mapSrsName: " + mapSrsName
|
||||
+ ", mapBBOX: " + mapBBOX + ", maxFeatures: " + maxFeatures + ", outputFormat: " + outputFormat);
|
||||
}
|
||||
String url = GisMakers.buildWFSFeatureQuery(layerItem, mapSrsName, mapBBOX, maxFeatures, outputFormat);
|
||||
LOG.info("returning WFSRequest: " + url);
|
||||
return url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the WFS response.
|
||||
*
|
||||
* @param layerItem the layer item
|
||||
* @param mapSrsName the map srs name
|
||||
* @param mapBBOX the map BBOX
|
||||
* @param maxFeatures the max features
|
||||
* @param outputFormat the output format
|
||||
* @return the WFS response
|
||||
*/
|
||||
@Override
|
||||
public String getWFSResponse(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures,
|
||||
String outputFormat) {
|
||||
LOG.info("getWFSResponse called");
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("getWFSResponse parameters layerItem name: " + layerItem.getName(), ", mapSrsName: " + mapSrsName
|
||||
+ ", mapBBOX: " + mapBBOX + ", maxFeatures: " + maxFeatures + ", outputFormat: " + outputFormat);
|
||||
}
|
||||
|
||||
String url = getWFSRequest(layerItem, mapSrsName, mapBBOX, maxFeatures, outputFormat);
|
||||
StringBuffer response = new StringBuffer();
|
||||
String theResponseString = "";
|
||||
HttpURLConnection con = null;
|
||||
LOG.debug("Built URL: " + url);
|
||||
try {
|
||||
URL obj = new URL(url);
|
||||
con = (HttpURLConnection) obj.openConnection();
|
||||
con.setRequestMethod("GET");
|
||||
int responseCode = con.getResponseCode();
|
||||
LOG.debug("GET Response Code: " + responseCode);
|
||||
if (responseCode == HttpURLConnection.HTTP_OK) { // success
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
|
||||
String inputLine;
|
||||
while ((inputLine = in.readLine()) != null) {
|
||||
response.append(inputLine);
|
||||
}
|
||||
in.close();
|
||||
} else {
|
||||
LOG.info("GET request did not work.");
|
||||
}
|
||||
|
||||
theResponseString = response.toString();
|
||||
//LOG.trace(theResponseString);
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("getWFSResponse is empty? " + theResponseString.isEmpty());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error on performing the request to URL: " + url, e);
|
||||
} finally {
|
||||
|
||||
}
|
||||
return theResponseString;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -57,15 +57,18 @@ public class GisMakers {
|
|||
* @param outputFormat the output format
|
||||
* @return the string
|
||||
*/
|
||||
public static String buildWFSFeatureQuery(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures, String outputFormat) {
|
||||
public static String buildWFSFeatureQuery(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX,
|
||||
int maxFeatures, String outputFormat) {
|
||||
|
||||
String link = layerItem.getMapServerHost();
|
||||
LOG.debug("Map server host URL: " + link);
|
||||
LOG.debug("CQL filter is: " + layerItem.getCqlFilter());
|
||||
LOG.debug("MAX FEATURES: " + maxFeatures);
|
||||
LOG.debug("BBOX: " + mapBBOX);
|
||||
LOG.debug("Output Format: " + outputFormat);
|
||||
|
||||
String outputformat = null;
|
||||
String boundingBox = "";
|
||||
String boundingBox = null;
|
||||
|
||||
// CASE MAP SERVER
|
||||
SERVERTYPE mapserverType = MapServerRecognize.recongnize(layerItem);
|
||||
|
@ -76,7 +79,9 @@ public class GisMakers {
|
|||
if (mapserverType.equals(SERVERTYPE.MAPSERVER)) {
|
||||
LOG.debug("wms url contains wxs is a map server? no appending /wfs ");
|
||||
outputformat = MapServerRecognize.outputFormatRecognize(SERVERTYPE.MAPSERVER, outputFormat);
|
||||
boundingBox = BBOX_FORMAT(COORDINATE_FORMAT.YX, ",",mapBBOX.getLowerLeftX(),mapBBOX.getLowerLeftY(),mapBBOX.getUpperRightX(),mapBBOX.getUpperRightY()); // USE AXIS XY
|
||||
if (mapBBOX != null)
|
||||
boundingBox = BBOX_FORMAT(COORDINATE_FORMAT.YX, ",", mapBBOX.getLowerLeftX(),
|
||||
mapBBOX.getLowerLeftY(), mapBBOX.getUpperRightX(), mapBBOX.getUpperRightY()); // USE AXIS XY
|
||||
// DEBUG
|
||||
LOG.debug("SERVERTYPE.MAPSERVER outputformat: " + outputformat);
|
||||
LOG.debug("SERVERTYPE.MAPSERVER srsName: " + mapSrsName);
|
||||
|
@ -86,7 +91,9 @@ public class GisMakers {
|
|||
link += link.endsWith("wfs") ? "" : "/wfs";
|
||||
outputformat = MapServerRecognize.outputFormatRecognize(SERVERTYPE.GEOSEVER, outputFormat);
|
||||
mapSrsName = "urn:x-ogc:def:crs:"+mapSrsName;
|
||||
boundingBox = BBOX_FORMAT(COORDINATE_FORMAT.YX, ",",mapBBOX.getLowerLeftX(),mapBBOX.getLowerLeftY(),mapBBOX.getUpperRightX(),mapBBOX.getUpperRightY()); // USE AXIS XY
|
||||
if (mapBBOX != null)
|
||||
boundingBox = BBOX_FORMAT(COORDINATE_FORMAT.YX, ",", mapBBOX.getLowerLeftX(),
|
||||
mapBBOX.getLowerLeftY(), mapBBOX.getUpperRightX(), mapBBOX.getUpperRightY()); // USE AXIS XY
|
||||
// DEBUG
|
||||
LOG.debug("SERVERTYPE.GEOSEVER outputformat: " + outputformat);
|
||||
LOG.debug("SERVERTYPE.GEOSEVER srsName: " + mapSrsName);
|
||||
|
@ -98,15 +105,22 @@ public class GisMakers {
|
|||
// + (outputformat == null ? "" : "&OUTPUTFORMAT=" + outputformat);
|
||||
//
|
||||
|
||||
link += "?"+
|
||||
URLParserUtil.addParameterToQueryString(WFSGetFeature.SERVICE.getParameter(), WFSGetFeature.SERVICE.getValue(), false, true)+
|
||||
URLParserUtil.addParameterToQueryString(WFSGetFeature.VERSION.getParameter(), WFSGetFeature.VERSION.getValue(), false, true)+
|
||||
URLParserUtil.addParameterToQueryString(WFSGetFeature.REQUEST.getParameter(), WFSGetFeature.REQUEST.getValue(), false, true)+
|
||||
URLParserUtil.addParameterToQueryString(WFSGetFeature.SRSNAME.getParameter(), mapSrsName, false, true)+
|
||||
URLParserUtil.addParameterToQueryString(WFSGetFeature.TYPENAME.getParameter(), layerItem.getName(), false, true)+
|
||||
(maxFeatures == 0 ? "" : URLParserUtil.addParameterToQueryString(WFSGetFeature.MAXFEATURES.getParameter(), maxFeatures+"", false, true))+
|
||||
(outputformat == null ? "" : URLParserUtil.addParameterToQueryString(WFSGetFeature.OUTPUTFORMAT.getParameter(), outputformat, false, false));
|
||||
|
||||
link += "?"
|
||||
+ URLParserUtil.addParameterToQueryString(WFSGetFeature.SERVICE.getParameter(),
|
||||
WFSGetFeature.SERVICE.getValue(), false, true)
|
||||
+ URLParserUtil.addParameterToQueryString(WFSGetFeature.VERSION.getParameter(),
|
||||
WFSGetFeature.VERSION.getValue(), false, true)
|
||||
+ URLParserUtil.addParameterToQueryString(WFSGetFeature.REQUEST.getParameter(),
|
||||
WFSGetFeature.REQUEST.getValue(), false, true)
|
||||
+ URLParserUtil.addParameterToQueryString(WFSGetFeature.SRSNAME.getParameter(), mapSrsName, false, true)
|
||||
+ URLParserUtil.addParameterToQueryString(WFSGetFeature.TYPENAME.getParameter(), layerItem.getName(),
|
||||
false, true)
|
||||
+ (maxFeatures == 0 ? ""
|
||||
: URLParserUtil.addParameterToQueryString(WFSGetFeature.MAXFEATURES.getParameter(),
|
||||
maxFeatures + "", false, true))
|
||||
+ (outputformat == null ? ""
|
||||
: URLParserUtil.addParameterToQueryString(WFSGetFeature.OUTPUTFORMAT.getParameter(),
|
||||
outputformat, false, false));
|
||||
|
||||
if (layerItem.getCqlFilter() != null && !layerItem.getCqlFilter().isEmpty()) {
|
||||
if (layerItem.getCqlFilter().contains("BBOX("+GEOM_NAME_BOUNDED+"")) {
|
||||
|
@ -114,7 +128,8 @@ public class GisMakers {
|
|||
link += "&" + CQL_FILTER_PARAMETER + "=" + layerItem.getCqlFilter();
|
||||
} else {
|
||||
// I NEED TO ENCODE THE BBOX INTO CQL FILTERING,
|
||||
String cqlFilterValue = "BBOX("+GEOM_NAME_BOUNDED+"," + boundingBox + ")" + " AND " + layerItem.getCqlFilter();
|
||||
String cqlFilterValue = "BBOX(" + GEOM_NAME_BOUNDED + "," + boundingBox + ")" + " AND "
|
||||
+ layerItem.getCqlFilter();
|
||||
|
||||
link += "&" + CQL_FILTER_PARAMETER + "=" + cqlFilterValue;
|
||||
}
|
||||
|
@ -181,7 +196,8 @@ public class GisMakers {
|
|||
* @param separator the separator
|
||||
* @return the string
|
||||
*/
|
||||
public static String BBOX_FORMAT(COORDINATE_FORMAT format, String separator, double lowerLeftX, double lowerLeftY, double upperRightX, double upperRightY) {
|
||||
public static String BBOX_FORMAT(COORDINATE_FORMAT format, String separator, double lowerLeftX, double lowerLeftY,
|
||||
double upperRightX, double upperRightY) {
|
||||
|
||||
if(format==null)
|
||||
format = COORDINATE_FORMAT.XY;
|
||||
|
@ -191,25 +207,11 @@ public class GisMakers {
|
|||
|
||||
switch (format) {
|
||||
case XY:
|
||||
return String.format("%s%s%s%s%s%s%s",
|
||||
String.valueOf(lowerLeftX),
|
||||
separator,
|
||||
String.valueOf(lowerLeftY),
|
||||
separator,
|
||||
String.valueOf(upperRightX),
|
||||
separator,
|
||||
String.valueOf(upperRightY)
|
||||
);
|
||||
return String.format("%s%s%s%s%s%s%s", String.valueOf(lowerLeftX), separator, String.valueOf(lowerLeftY),
|
||||
separator, String.valueOf(upperRightX), separator, String.valueOf(upperRightY));
|
||||
case YX:
|
||||
return String.format("%s%s%s%s%s%s%s",
|
||||
String.valueOf(lowerLeftY),
|
||||
separator,
|
||||
String.valueOf(lowerLeftX),
|
||||
separator,
|
||||
String.valueOf(upperRightY),
|
||||
separator,
|
||||
String.valueOf(upperRightX)
|
||||
);
|
||||
return String.format("%s%s%s%s%s%s%s", String.valueOf(lowerLeftY), separator, String.valueOf(lowerLeftX),
|
||||
separator, String.valueOf(upperRightY), separator, String.valueOf(upperRightX));
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -363,6 +363,9 @@ body {
|
|||
|
||||
.dand-layer {
|
||||
width: 400px;
|
||||
border: 1px solid #ccc !important;
|
||||
padding: 5px 0px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.range-slider {
|
||||
|
|
|
@ -59,13 +59,13 @@ public class GeoportalViewer_Tests {
|
|||
|
||||
//private static String CONTEXT = "/pred4s/preprod/preVRE";
|
||||
private static String CONTEXT = "/d4science.research-infrastructures.eu/D4OS/GNA";
|
||||
private static String TOKEN = "ae9c0e67-68ca-42de-899b-015a98e4619b-843339462"; //GNA
|
||||
private static String TOKEN = ""; //GNA
|
||||
|
||||
//private static String CONTEXT = "/gcube/devsec/devVRE";
|
||||
//private static String TOKEN = ""; // devVRE
|
||||
|
||||
private static String PROFILE_ID = "profiledConcessioni";
|
||||
private static String PROJECT_ID = "63c6c0f1a1e60e66b7b588fe";
|
||||
private static String PROJECT_ID = "6388ea6ca1e60e66b7b584e0";
|
||||
|
||||
private static String USERNAME = "francesco.mangiacrapa";
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class GeoportalViewer_Tests {
|
|||
clientProjects = GeoportalClientCaller.projects();
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
public void getProjectViewForID() {
|
||||
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue