task_25066 #15
|
@ -1,12 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/geoportal-data-viewer-app-3.4.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/geoportal-data-viewer-app-3.5.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-3.4.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
<classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-3.5.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
@ -35,5 +35,5 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/geoportal-data-viewer-app-3.4.0-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/geoportal-data-viewer-app-3.5.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-3.4.0-SNAPSHOT
|
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-3.5.0-SNAPSHOT
|
||||||
warSrcDir=src/main/webapp
|
warSrcDir=src/main/webapp
|
||||||
warSrcDirIsOutput=false
|
warSrcDirIsOutput=false
|
||||||
|
|
|
@ -78,7 +78,17 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-module deploy-name="geoportal-data-viewer-app-3.4.0-SNAPSHOT">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<wb-module deploy-name="geoportal-data-viewer-app-3.5.0-SNAPSHOT">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -217,6 +227,11 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -297,6 +312,11 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -377,6 +397,11 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -457,6 +482,11 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -479,6 +509,14 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||||
|
<dependent-module archiveName="geoportal-data-mapper-1.0.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-mapper/geoportal-data-mapper">
|
||||||
|
<dependency-type>uses</dependency-type>
|
||||||
|
</dependent-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -617,6 +655,11 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -697,6 +740,11 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -777,6 +825,11 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,11 @@
|
||||||
All notable changes to this project will be documented in this file.
|
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).
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [v3.5.0-SNAPSHOT]
|
||||||
|
|
||||||
|
- Supported the cross-filtering [#25074]
|
||||||
|
- Supported the grouped custom layers [#25110]
|
||||||
|
|
||||||
## [v3.4.0] - 2023-05-11
|
## [v3.4.0] - 2023-05-11
|
||||||
|
|
||||||
- Integrated the geoportal-data-mapper component [#24978]
|
- Integrated the geoportal-data-mapper component [#24978]
|
||||||
|
|
4
pom.xml
4
pom.xml
|
@ -14,13 +14,13 @@
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>geoportal-data-viewer-app</artifactId>
|
<artifactId>geoportal-data-viewer-app</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<version>3.4.0</version>
|
<version>3.5.0-SNAPSHOT</version>
|
||||||
<name>GeoPortal Data Viewer App</name>
|
<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>
|
<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>
|
<properties>
|
||||||
<!-- Convenience property to set the GWT version -->
|
<!-- 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>
|
<gwt.compiler.style>PRETTY</gwt.compiler.style>
|
||||||
<gson.version>2.6.2</gson.version>
|
<gson.version>2.6.2</gson.version>
|
||||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||||
|
|
|
@ -5,13 +5,18 @@ import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.GroupedLayersDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.LayerIDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDILayer;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
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.ProjectDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
|
||||||
|
@ -20,6 +25,8 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.AddLayerToMapEv
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent.LAYER_TYPE;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent.LAYER_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ApplyCQLToLayerOnMapEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ApplyCQLToLayerOnMapEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent;
|
||||||
|
@ -28,8 +35,12 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetai
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEventHandler;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.FitMapToExtentEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.FitMapToExtentEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEventHandler;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.OverlayCustomLayerToMapEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.OverlayCustomLayerToMapEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEventHandler;
|
||||||
|
@ -50,9 +61,11 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.Ope
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap.CQL_FACILITY_ORIGIN;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPanel;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPanel;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation.TimelineManagerStatus;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation.TimelineManagerStatus;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.OLGeoJSONUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.ControlledCallBack;
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.ControlledCallBack;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
||||||
|
@ -85,12 +98,6 @@ import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
import ol.Coordinate;
|
import ol.Coordinate;
|
||||||
import ol.Feature;
|
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>.
|
* Entry point classes define <code>onModuleLoad()</code>.
|
||||||
|
@ -154,6 +161,8 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
// A cache (Layer_ID, GeoJSON) of layer features loaded via GetFeature Request
|
// A cache (Layer_ID, GeoJSON) of layer features loaded via GetFeature Request
|
||||||
private HashMap<String, String> layerFeaturesCache = new HashMap<String, String>();
|
private HashMap<String, String> layerFeaturesCache = new HashMap<String, String>();
|
||||||
|
|
||||||
|
private ViewerConfiguration viewerConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the entry point method.
|
* This is the entry point method.
|
||||||
*/
|
*/
|
||||||
|
@ -228,6 +237,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(ViewerConfiguration result) {
|
public void onSuccess(ViewerConfiguration result) {
|
||||||
super.onSuccess(result);
|
super.onSuccess(result);
|
||||||
|
viewerConfiguration = result;
|
||||||
|
|
||||||
GWT.log("Received init config : " + result);
|
GWT.log("Received init config : " + result);
|
||||||
GWT.log("Loading base layers, count : " + result.getBaseLayers().size());
|
GWT.log("Loading base layers, count : " + result.getBaseLayers().size());
|
||||||
|
@ -282,6 +292,8 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
mainPanel.openCollectionMenu();
|
mainPanel.openCollectionMenu();
|
||||||
|
|
||||||
|
loadConfigureduGroupedLayersForUCD();
|
||||||
|
|
||||||
GWT.log("DONE INIT LOAD");
|
GWT.log("DONE INIT LOAD");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -302,6 +314,77 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
RootPanel.get(APP_DIV).add(attributionDiv);
|
RootPanel.get(APP_DIV).add(attributionDiv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load Overlay Layers and Cross-Filtering layers for UCD
|
||||||
|
*
|
||||||
|
* Load configuredu grouped layers for UCD.
|
||||||
|
*/
|
||||||
|
public void loadConfigureduGroupedLayersForUCD() {
|
||||||
|
|
||||||
|
GeoportalDataViewerServiceAsync.Util.getInstance().getAvaiableCustomGroupedLayersForUCD(
|
||||||
|
GEOPORTAL_DATA_HANDLER.geoportal_grouped_overlay_layers,
|
||||||
|
new AsyncCallback<Map<String, List<GroupedLayersDV<? extends LayerIDV>>>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
GWT.log("loadConfigureduGroupedLayersForUCD error for "
|
||||||
|
+ GEOPORTAL_DATA_HANDLER.geoportal_grouped_overlay_layers + ": " + caught.getMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Map<String, List<GroupedLayersDV<? extends LayerIDV>>> result) {
|
||||||
|
GWT.log(GEOPORTAL_DATA_HANDLER.geoportal_grouped_overlay_layers + " returned: " + result);
|
||||||
|
if (result != null && result.size() > 0) {
|
||||||
|
|
||||||
|
Map<String, GCubeCollection> collections = viewerConfiguration.getAvailableCollections();
|
||||||
|
|
||||||
|
for (String profileId : result.keySet()) {
|
||||||
|
List<GroupedLayersDV<? extends LayerIDV>> list = result.get(profileId);
|
||||||
|
if (list != null && list.size() > 0) {
|
||||||
|
GCubeCollection collection = collections.get(profileId);
|
||||||
|
mainPanel.addOverlayLayers(collection, list);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
GeoportalDataViewerServiceAsync.Util.getInstance().getAvaiableCustomGroupedLayersForUCD(
|
||||||
|
GEOPORTAL_DATA_HANDLER.geoportal_grouped_cross_filtering,
|
||||||
|
new AsyncCallback<Map<String, List<GroupedLayersDV<? extends LayerIDV>>>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
GWT.log("loadConfigureduGroupedLayersForUCD error for "
|
||||||
|
+ GEOPORTAL_DATA_HANDLER.geoportal_grouped_cross_filtering + ": "
|
||||||
|
+ caught.getMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Map<String, List<GroupedLayersDV<? extends LayerIDV>>> result) {
|
||||||
|
GWT.log(GEOPORTAL_DATA_HANDLER.geoportal_grouped_cross_filtering + " returned: " + result);
|
||||||
|
if (result != null && result.size() > 0) {
|
||||||
|
|
||||||
|
Map<String, GCubeCollection> collections = viewerConfiguration.getAvailableCollections();
|
||||||
|
|
||||||
|
for (String profileId : result.keySet()) {
|
||||||
|
List<GroupedLayersDV<? extends LayerIDV>> list = result.get(profileId);
|
||||||
|
if (list != null && list.size() > 0) {
|
||||||
|
GCubeCollection collection = collections.get(profileId);
|
||||||
|
mainPanel.addCrossFilteringLayers(collection, list);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the status.
|
* Gets the status.
|
||||||
*
|
*
|
||||||
|
@ -672,6 +755,24 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
applicationBus.addHandler(OverlayCustomLayerToMapEvent.TYPE, new OverlayCustomLayerToMapEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCustomOverlayLayerAction(OverlayCustomLayerToMapEvent customOverLayerToMapEvent) {
|
||||||
|
|
||||||
|
if (customOverLayerToMapEvent.getLayerItem() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (customOverLayerToMapEvent.getActionType()
|
||||||
|
.equals(OverlayCustomLayerToMapEvent.ACTION_TYPE.VISIBILITY)) {
|
||||||
|
OpenLayerMap olMap = olMapMng.getOLMap();
|
||||||
|
olMap.setWMSGroupedCustomLayerVisible(customOverLayerToMapEvent.getLayerItem(),
|
||||||
|
customOverLayerToMapEvent.isEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
applicationBus.addHandler(ChangeMapLayerEvent.TYPE, new ChangeMapLayerEventHandler() {
|
applicationBus.addHandler(ChangeMapLayerEvent.TYPE, new ChangeMapLayerEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -703,8 +804,8 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
// Showing popup after clicking on map
|
// Showing popup after clicking on map
|
||||||
if (showPopupOnCentroiEvent.getProfileID() != null && showPopupOnCentroiEvent.getProjectID() != null) {
|
if (showPopupOnCentroiEvent.getProfileID() != null && showPopupOnCentroiEvent.getProjectID() != null) {
|
||||||
Coordinate transfCoord = MapUtils
|
Coordinate transfCoord = MapUtils.geoJSONToBBOXCenter(showPopupOnCentroiEvent.getSpatialReference(),
|
||||||
.geoJSONTToBBoxCenter(showPopupOnCentroiEvent.getSpatialReference(), null, null);
|
null, null);
|
||||||
|
|
||||||
performWFSQueryOnCentroid(showPopupOnCentroiEvent.getProjectID(), transfCoord.getX(),
|
performWFSQueryOnCentroid(showPopupOnCentroiEvent.getProjectID(), transfCoord.getX(),
|
||||||
transfCoord.getY());
|
transfCoord.getY());
|
||||||
|
@ -725,7 +826,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
if (searchPerformedEvent != null) {
|
if (searchPerformedEvent != null) {
|
||||||
|
|
||||||
LinkedHashMap<String, ol.layer.Image> wmsMap = olMapMng.getOLMap().getWmsLayerMap();
|
LinkedHashMap<String, ol.layer.Image> wmsMap = olMapMng.getOLMap().getWmsLayerMap();
|
||||||
String firstWMSKey = wmsMap.keySet().iterator().next();
|
// String firstWMSKey = wmsMap.keySet().iterator().next();
|
||||||
List<String> result = searchPerformedEvent.getListProjectIDs();
|
List<String> result = searchPerformedEvent.getListProjectIDs();
|
||||||
ViewerConfiguration viewerConfig = GeoportalDataViewer.getStatus().getViewerConfig();
|
ViewerConfiguration viewerConfig = GeoportalDataViewer.getStatus().getViewerConfig();
|
||||||
|
|
||||||
|
@ -750,30 +851,97 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
}
|
}
|
||||||
|
|
||||||
String setCqlFilter = null; // default
|
String newCqlFilter = null; // default
|
||||||
|
|
||||||
if (result != null && result.size() > 0) {
|
if (layerName == null) {
|
||||||
|
GWT.log("CQL FILTER skipped, layerName is NULL!!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Applying CQL filter only if there are results and its number are less or
|
||||||
|
// equal to SEARCH_LIMIT_RESULTS_TO_MAXIMUM
|
||||||
|
if (result != null && result.size() > 0
|
||||||
|
&& result.size() <= GeoportalDataViewerConstants.SEARCH_LIMIT_RESULTS_TO_MAXIMUM) {
|
||||||
String cqlFilter = GeoportalDataViewerConstants.PROJECT_ID_KEY_FEATURE + " IN(";
|
String cqlFilter = GeoportalDataViewerConstants.PROJECT_ID_KEY_FEATURE + " IN(";
|
||||||
for (String projectId : result) {
|
for (String projectId : result) {
|
||||||
cqlFilter += "'" + projectId + "',";
|
cqlFilter += "'" + projectId + "',";
|
||||||
}
|
}
|
||||||
cqlFilter = cqlFilter.substring(0, cqlFilter.length() - 1) + ")";
|
cqlFilter = cqlFilter.substring(0, cqlFilter.length() - 1) + ")";
|
||||||
setCqlFilter = cqlFilter;
|
|
||||||
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, cqlFilter);
|
newCqlFilter = olMapMng.getOLMap().setCQLFilterToWMSLayer(CQL_FACILITY_ORIGIN.SEARCH, layerName,
|
||||||
|
cqlFilter);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null);
|
newCqlFilter = olMapMng.getOLMap().setCQLFilterToWMSLayer(CQL_FACILITY_ORIGIN.SEARCH, layerName,
|
||||||
setCqlFilter = null; // is already null
|
null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchPerformedEvent.isSearchReset()) {
|
if (searchPerformedEvent.isSearchReset()) {
|
||||||
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null);
|
newCqlFilter = olMapMng.getOLMap().setCQLFilterToWMSLayer(CQL_FACILITY_ORIGIN.SEARCH, layerName,
|
||||||
setCqlFilter = null; // is already null
|
null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layerName != null)
|
GWT.log("New CQL Filter is: " + newCqlFilter);
|
||||||
layerManager.setCQLForLayerToIndexLayer(layerName, setCqlFilter);
|
|
||||||
|
|
||||||
|
// Resetting CQL Filter
|
||||||
|
if (layerName != null)
|
||||||
|
layerManager.setCQLForLayerToIndexLayer(layerName, newCqlFilter);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
applicationBus.addHandler(ApplyCQLToLayerOnMapEvent.TYPE, new ApplyCQLToLayerOnMapEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onApplyCQL(ApplyCQLToLayerOnMapEvent applyCQLToLayerMapEvent) {
|
||||||
|
GWT.log("Fired: " + applyCQLToLayerMapEvent);
|
||||||
|
|
||||||
|
if (applyCQLToLayerMapEvent != null) {
|
||||||
|
|
||||||
|
String layerName = null;
|
||||||
|
|
||||||
|
GCubeSDILayer layer = applyCQLToLayerMapEvent.getTheIndeLayer().getLayer();
|
||||||
|
|
||||||
|
try {
|
||||||
|
String wmsLink = layer.getOgcLinks().get("wms");
|
||||||
|
layerName = URLUtil.extractValueOfParameterFromURL("layers", wmsLink);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
}
|
||||||
|
|
||||||
|
String setCqlFilter = null;
|
||||||
|
|
||||||
|
if (layerName != null) {
|
||||||
|
|
||||||
|
GWT.log("ApplyCQLToLayerOnMapEvent: " + layerName + ", filter : "
|
||||||
|
+ applyCQLToLayerMapEvent.getCqlFilterValue());
|
||||||
|
|
||||||
|
if (applyCQLToLayerMapEvent.getCqlFilterValue() == null) {
|
||||||
|
olMapMng.getOLMap().setCQLFilterToWMSLayer(CQL_FACILITY_ORIGIN.CROSS_FILTERING, layerName,
|
||||||
|
null);
|
||||||
|
setCqlFilter = null; // is already null
|
||||||
|
} else {
|
||||||
|
setCqlFilter = applyCQLToLayerMapEvent.getCqlFilterValue();
|
||||||
|
olMapMng.getOLMap().setCQLFilterToWMSLayer(CQL_FACILITY_ORIGIN.CROSS_FILTERING, layerName,
|
||||||
|
setCqlFilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
layerManager.setCQLForLayerToIndexLayer(layerName, setCqlFilter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
applicationBus.addHandler(FitMapToExtentEvent.TYPE, new FitMapToExtentEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFitToMap(FitMapToExtentEvent fitMapToExtentEvent) {
|
||||||
|
|
||||||
|
if (fitMapToExtentEvent.getExtent() != null) {
|
||||||
|
olMapMng.getOLMap().fitToExtent(fitMapToExtentEvent.getExtent());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -895,34 +1063,10 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
*/
|
*/
|
||||||
private void showLayerFeatures(LayerItem layerItem, String geoJSONFeatures, ProjectDV projectDV) {
|
private void showLayerFeatures(LayerItem layerItem, String geoJSONFeatures, ProjectDV projectDV) {
|
||||||
|
|
||||||
GeoJsonFeatureOptions fo = new GeoJsonFeatureOptions();
|
Feature[] features = OLGeoJSONUtil.readGeoJsonFeatures(MAP_PROJECTION.EPSG_4326, geoJSONFeatures);
|
||||||
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);
|
GWT.log("features: " + features);
|
||||||
olMapMng.getOLMap().addLayerFeaturesAsHighlight(layerItem, features, true);
|
olMapMng.getOLMap().addLayerFeaturesAsHighlight(layerItem, features, true);
|
||||||
|
|
||||||
/* Fit to extent calculating the features extent
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,8 @@ public class GeoportalDataViewerConstants {
|
||||||
public static final String GET_ZOOM = OpenLayersMapParameters.OL_MAP_PARAM.zoom.name();
|
public static final String GET_ZOOM = OpenLayersMapParameters.OL_MAP_PARAM.zoom.name();
|
||||||
public static final String GET_CENTER_MAP_TO_LONG_LAT = OpenLayersMapParameters.OL_MAP_PARAM.centermap.name();
|
public static final String GET_CENTER_MAP_TO_LONG_LAT = OpenLayersMapParameters.OL_MAP_PARAM.centermap.name();
|
||||||
|
|
||||||
|
public static final int SEARCH_LIMIT_RESULTS_TO_MAXIMUM = 50;
|
||||||
|
|
||||||
public static final DateTimeFormat DATE_TIME_FORMAT = DateTimeFormat.getFormat("dd MMMM yyyy");
|
public static final DateTimeFormat DATE_TIME_FORMAT = DateTimeFormat.getFormat("dd MMMM yyyy");
|
||||||
|
|
||||||
public static enum MapEventType {
|
public static enum MapEventType {
|
||||||
|
@ -152,7 +154,8 @@ public class GeoportalDataViewerConstants {
|
||||||
var tabCell = tr.insertCell(-1);
|
var tabCell = tr.insertCell(-1);
|
||||||
var theValue = jsonObj[j][col[i]];
|
var theValue = jsonObj[j][col[i]];
|
||||||
//console.log("the value: "+theValue);
|
//console.log("the value: "+theValue);
|
||||||
if (theValue !== null && Object.prototype.toString.call(theValue) === '[object Array]') {
|
if (theValue !== null
|
||||||
|
&& Object.prototype.toString.call(theValue) === '[object Array]') {
|
||||||
var formattedValueArray = "";
|
var formattedValueArray = "";
|
||||||
for (var k = 0; k < theValue.length; k++) {
|
for (var k = 0; k < theValue.length; k++) {
|
||||||
var theValueArray = theValue[k];
|
var theValueArray = theValue[k];
|
||||||
|
|
|
@ -2,12 +2,16 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.GroupedLayersDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.LayerIDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
||||||
|
@ -183,10 +187,10 @@ public interface GeoportalDataViewerService extends RemoteService {
|
||||||
/**
|
/**
|
||||||
* Gets the WFS request.
|
* Gets the WFS request.
|
||||||
*
|
*
|
||||||
* @param layerItem the layer item
|
* @param layerItem the layer item
|
||||||
* @param mapSrsName the map srs name
|
* @param mapSrsName the map srs name
|
||||||
* @param mapBBOX the map BBOX
|
* @param mapBBOX the map BBOX
|
||||||
* @param maxFeatures the max features. If 0 means all feature
|
* @param maxFeatures the max features. If 0 means all feature
|
||||||
* @param outputFormat the output format
|
* @param outputFormat the output format
|
||||||
* @return the WFS request
|
* @return the WFS request
|
||||||
*/
|
*/
|
||||||
|
@ -206,4 +210,21 @@ public interface GeoportalDataViewerService extends RemoteService {
|
||||||
String getWFSResponse(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures,
|
String getWFSResponse(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures,
|
||||||
String outputFormat);
|
String outputFormat);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the avaiable custom grouped layers for UCD.
|
||||||
|
*
|
||||||
|
* @param theHandler the the handler
|
||||||
|
* @return the avaiable custom grouped layers for UCD
|
||||||
|
*/
|
||||||
|
Map<String, List<GroupedLayersDV<? extends LayerIDV>>> getAvaiableCustomGroupedLayersForUCD(
|
||||||
|
GEOPORTAL_DATA_HANDLER theHandler);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the HTTP response for URL.
|
||||||
|
*
|
||||||
|
* @param url the url
|
||||||
|
* @return the HTTP response for URL
|
||||||
|
*/
|
||||||
|
String getHTTPResponseForURL(String url);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,16 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.GroupedLayersDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.LayerIDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
||||||
|
@ -82,4 +86,9 @@ public interface GeoportalDataViewerServiceAsync {
|
||||||
void getWFSResponse(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures, String outputFormat,
|
void getWFSResponse(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures, String outputFormat,
|
||||||
AsyncCallback<String> callback);
|
AsyncCallback<String> callback);
|
||||||
|
|
||||||
|
void getAvaiableCustomGroupedLayersForUCD(GEOPORTAL_DATA_HANDLER theHandler,
|
||||||
|
AsyncCallback<Map<String, List<GroupedLayersDV<? extends LayerIDV>>>> callback);
|
||||||
|
|
||||||
|
void getHTTPResponseForURL(String url, AsyncCallback<String> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -582,9 +582,7 @@ public class LayerManager {
|
||||||
public void setCQLForLayerToIndexLayer(String layerName, String cqlFilter) {
|
public void setCQLForLayerToIndexLayer(String layerName, String cqlFilter) {
|
||||||
LayerObject theLo = mapIndexLayerObjects.get(layerName);
|
LayerObject theLo = mapIndexLayerObjects.get(layerName);
|
||||||
if (theLo != null) {
|
if (theLo != null) {
|
||||||
boolean isCQLFilter = cqlFilter != null;
|
|
||||||
theLo.getLayerItem().setCqlFilter(cqlFilter);
|
theLo.getLayerItem().setCqlFilter(cqlFilter);
|
||||||
theLo.getLayerItem().setCqlFilterAvailable(isCQLFilter);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class AddedLayerToMapEvent.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
|
*
|
||||||
|
* Nov 18, 2020
|
||||||
|
*/
|
||||||
|
public class ApplyCQLToLayerOnMapEvent extends GwtEvent<ApplyCQLToLayerOnMapEventHandler> {
|
||||||
|
public static Type<ApplyCQLToLayerOnMapEventHandler> TYPE = new Type<ApplyCQLToLayerOnMapEventHandler>();
|
||||||
|
private IndexLayerDV theIndeLayer;
|
||||||
|
private String cqlFilterValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new apply CQL to layer map event.
|
||||||
|
*
|
||||||
|
* @param theIndeLayer the the inde layer
|
||||||
|
* @param cqlFilter the cql filter
|
||||||
|
*/
|
||||||
|
public ApplyCQLToLayerOnMapEvent(IndexLayerDV theIndeLayer, String cqlFilterValue) {
|
||||||
|
this.theIndeLayer = theIndeLayer;
|
||||||
|
this.cqlFilterValue = cqlFilterValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the associated type.
|
||||||
|
*
|
||||||
|
* @return the associated type
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Type<ApplyCQLToLayerOnMapEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch.
|
||||||
|
*
|
||||||
|
* @param handler the handler
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void dispatch(ApplyCQLToLayerOnMapEventHandler handler) {
|
||||||
|
handler.onApplyCQL(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexLayerDV getTheIndeLayer() {
|
||||||
|
return theIndeLayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCqlFilterValue() {
|
||||||
|
return cqlFilterValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("ApplyCQLToLayerOnMapEvent [theIndeLayer=");
|
||||||
|
builder.append(theIndeLayer);
|
||||||
|
builder.append(", cqlFilterValue=");
|
||||||
|
builder.append(cqlFilterValue);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface ApplyCQLToLayerOnMapEventHandler.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* May 31, 2023
|
||||||
|
*/
|
||||||
|
public interface ApplyCQLToLayerOnMapEventHandler extends EventHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On apply CQL.
|
||||||
|
*
|
||||||
|
* @param applyCQLToLayerMapEvent the apply CQL to layer map event
|
||||||
|
*/
|
||||||
|
void onApplyCQL(ApplyCQLToLayerOnMapEvent applyCQLToLayerMapEvent);
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
import ol.Extent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class FitMapToExtentEvent.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Jun 6, 2023
|
||||||
|
*/
|
||||||
|
public class FitMapToExtentEvent extends GwtEvent<FitMapToExtentEventHandler> {
|
||||||
|
public static Type<FitMapToExtentEventHandler> TYPE = new Type<FitMapToExtentEventHandler>();
|
||||||
|
private Extent extent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new fit map to extent event.
|
||||||
|
*
|
||||||
|
* @param extent the extent
|
||||||
|
*/
|
||||||
|
public FitMapToExtentEvent(Extent extent) {
|
||||||
|
this.extent = extent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the associated type.
|
||||||
|
*
|
||||||
|
* @return the associated type
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Type<FitMapToExtentEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch.
|
||||||
|
*
|
||||||
|
* @param handler the handler
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void dispatch(FitMapToExtentEventHandler handler) {
|
||||||
|
handler.onFitToMap(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Extent getExtent() {
|
||||||
|
return extent;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface FitMapToExtentEventHandler.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Jun 6, 2023
|
||||||
|
*/
|
||||||
|
public interface FitMapToExtentEventHandler extends EventHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On fit to map.
|
||||||
|
*
|
||||||
|
* @param fitMapToExtentEvent the fit map to extent event
|
||||||
|
*/
|
||||||
|
void onFitToMap(FitMapToExtentEvent fitMapToExtentEvent);
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class OverlayCustomLayerToMapEvent.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* May 15, 2023
|
||||||
|
*/
|
||||||
|
public class OverlayCustomLayerToMapEvent extends GwtEvent<OverlayCustomLayerToMapEventHandler> {
|
||||||
|
public static Type<OverlayCustomLayerToMapEventHandler> TYPE = new Type<OverlayCustomLayerToMapEventHandler>();
|
||||||
|
private LayerItem layerItem;
|
||||||
|
private ACTION_TYPE actionType;
|
||||||
|
private boolean enabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Enum ACTION_TYPE.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* May 15, 2023
|
||||||
|
*/
|
||||||
|
public enum ACTION_TYPE {
|
||||||
|
VISIBILITY
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new overlay custom layer to map event.
|
||||||
|
*
|
||||||
|
* @param layerItem the layer item
|
||||||
|
* @param actionType the action type
|
||||||
|
* @param enabled the enabled
|
||||||
|
*/
|
||||||
|
public OverlayCustomLayerToMapEvent(LayerItem layerItem, ACTION_TYPE actionType, boolean enabled) {
|
||||||
|
this.layerItem = layerItem;
|
||||||
|
this.actionType = actionType;
|
||||||
|
this.enabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the associated type.
|
||||||
|
*
|
||||||
|
* @return the associated type
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Type<OverlayCustomLayerToMapEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch.
|
||||||
|
*
|
||||||
|
* @param handler the handler
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void dispatch(OverlayCustomLayerToMapEventHandler handler) {
|
||||||
|
handler.onCustomOverlayLayerAction(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the layer item.
|
||||||
|
*
|
||||||
|
* @return the layer item
|
||||||
|
*/
|
||||||
|
public LayerItem getLayerItem() {
|
||||||
|
return layerItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the action type.
|
||||||
|
*
|
||||||
|
* @return the action type
|
||||||
|
*/
|
||||||
|
public ACTION_TYPE getActionType() {
|
||||||
|
return actionType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is enabled.
|
||||||
|
*
|
||||||
|
* @return true, if is enabled
|
||||||
|
*/
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface OverlayCustomLayerToMapEventHandler.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* May 15, 2023
|
||||||
|
*/
|
||||||
|
public interface OverlayCustomLayerToMapEventHandler extends EventHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On custom overlay layer action.
|
||||||
|
*
|
||||||
|
* @param customOverLayerToMapEvent the custom over layer to map event
|
||||||
|
*/
|
||||||
|
void onCustomOverlayLayerAction(OverlayCustomLayerToMapEvent customOverLayerToMapEvent);
|
||||||
|
}
|
|
@ -19,17 +19,18 @@ public class LayerOrder {
|
||||||
* Nov 12, 2021
|
* Nov 12, 2021
|
||||||
*/
|
*/
|
||||||
public static enum LAYER_TYPE {
|
public static enum LAYER_TYPE {
|
||||||
BASE_MAP, BASE_WMS, WMS_DETAIL, VECTOR
|
BASE_MAP, CUSTOM_WMS_DETAIL, BASE_WMS, WMS_DETAIL, VECTOR
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final HashMap<LAYER_TYPE, Integer> LAYER_OFFSET = new HashMap<LAYER_TYPE, Integer>(5);
|
public static final HashMap<LAYER_TYPE, Integer> LAYER_OFFSET = new HashMap<LAYER_TYPE, Integer>(5);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
||||||
LAYER_OFFSET.put(LAYER_TYPE.BASE_MAP, 0);
|
LAYER_OFFSET.put(LAYER_TYPE.BASE_MAP, 0); //Base OL or MapBox
|
||||||
LAYER_OFFSET.put(LAYER_TYPE.BASE_WMS, 70);
|
LAYER_OFFSET.put(LAYER_TYPE.CUSTOM_WMS_DETAIL, 70); //WMS custom Overlay. Es. Layer "Limiti Amministrativi"
|
||||||
LAYER_OFFSET.put(LAYER_TYPE.WMS_DETAIL, 140);
|
LAYER_OFFSET.put(LAYER_TYPE.BASE_WMS, 210); // Index layers (i.e. centroids for UCD)
|
||||||
LAYER_OFFSET.put(LAYER_TYPE.VECTOR, 210);
|
LAYER_OFFSET.put(LAYER_TYPE.WMS_DETAIL, 140); //Layer/s belonging to a Project (materialized layers. Ex. "Posizionamento Scavo")
|
||||||
|
LAYER_OFFSET.put(LAYER_TYPE.VECTOR, 320); //Vector layer to show other info. Ex. Pointer with coordinates (x,y) in the Light OL Map.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.google.gwt.core.client.GWT;
|
||||||
|
|
||||||
import ol.Collection;
|
import ol.Collection;
|
||||||
import ol.Coordinate;
|
import ol.Coordinate;
|
||||||
|
import ol.Extent;
|
||||||
import ol.control.Attribution;
|
import ol.control.Attribution;
|
||||||
import ol.control.Control;
|
import ol.control.Control;
|
||||||
import ol.control.FullScreen;
|
import ol.control.FullScreen;
|
||||||
|
@ -55,6 +56,18 @@ public final class MapUtils {
|
||||||
return Projection.transform(centerCoordinate, source, target);
|
return Projection.transform(centerCoordinate, source, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transform extent.
|
||||||
|
*
|
||||||
|
* @param extent the extent
|
||||||
|
* @param source the source
|
||||||
|
* @param target the target
|
||||||
|
* @return the extent
|
||||||
|
*/
|
||||||
|
public static Extent transformExtent(Extent extent, String source, String target) {
|
||||||
|
return Projection.transformExtent(extent, source, target);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Distance between centroid.
|
* Distance between centroid.
|
||||||
*
|
*
|
||||||
|
@ -95,14 +108,14 @@ public final class MapUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Geo JSONT to B box center.
|
* Geo JSON to B box center.
|
||||||
*
|
*
|
||||||
* @param spatialReference the spatial reference
|
* @param spatialReference the spatial reference
|
||||||
* @param transforFrom the transfor from
|
* @param transforFrom the transfor from
|
||||||
* @param transformTo the transform to
|
* @param transformTo the transform to
|
||||||
* @return the coordinate
|
* @return the coordinate
|
||||||
*/
|
*/
|
||||||
public static Coordinate geoJSONTToBBoxCenter(GeoJSON spatialReference, String transforFrom, String transformTo) {
|
public static Coordinate geoJSONToBBOXCenter(GeoJSON spatialReference, String transforFrom, String transformTo) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (spatialReference != null) {
|
if (spatialReference != null) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
|
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
|
@ -8,6 +9,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerCon
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent.LAYER_TYPE;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent.LAYER_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.WFSMakerUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
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.LayerItem;
|
||||||
|
|
||||||
|
@ -35,6 +37,7 @@ import ol.Overlay;
|
||||||
import ol.OverlayOptions;
|
import ol.OverlayOptions;
|
||||||
import ol.Size;
|
import ol.Size;
|
||||||
import ol.View;
|
import ol.View;
|
||||||
|
import ol.ViewFitOptions;
|
||||||
import ol.ViewOptions;
|
import ol.ViewOptions;
|
||||||
import ol.animation.AnimationOptions;
|
import ol.animation.AnimationOptions;
|
||||||
import ol.color.Color;
|
import ol.color.Color;
|
||||||
|
@ -78,6 +81,8 @@ import ol.style.Style;
|
||||||
*/
|
*/
|
||||||
public abstract class OpenLayerMap {
|
public abstract class OpenLayerMap {
|
||||||
|
|
||||||
|
public static final String CQL_FILTER_PARAMETER = WFSMakerUtil.CQL_FILTER_PARAMETER;
|
||||||
|
|
||||||
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;
|
public static final int SET_CENTER_ANIMATED_DURATION = 500;
|
||||||
|
@ -86,6 +91,19 @@ public abstract class OpenLayerMap {
|
||||||
|
|
||||||
public static final int MAX_ZOOM = 21;
|
public static final int MAX_ZOOM = 21;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Enum CQL_FACILITY_ORIGIN.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Jun 6, 2023
|
||||||
|
*/
|
||||||
|
public static enum CQL_FACILITY_ORIGIN {
|
||||||
|
SEARCH, CROSS_FILTERING
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap<CQL_FACILITY_ORIGIN, String> cqlFilterMap = new HashMap<CQL_FACILITY_ORIGIN, String>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Click listener.
|
* Click listener.
|
||||||
*
|
*
|
||||||
|
@ -149,6 +167,8 @@ public abstract class OpenLayerMap {
|
||||||
|
|
||||||
private LinkedHashMap<String, Image> wmsDetailsLayerMap;
|
private LinkedHashMap<String, Image> wmsDetailsLayerMap;
|
||||||
|
|
||||||
|
private LinkedHashMap<String, Image> wmsGroupedCustomLayerMap;
|
||||||
|
|
||||||
private LinkedHashMap<String, Image> wmsLayerMap;
|
private LinkedHashMap<String, Image> wmsLayerMap;
|
||||||
|
|
||||||
private LinkedHashMap<String, ol.layer.Vector> vectorLayersHighlighted = new LinkedHashMap<String, ol.layer.Vector>();
|
private LinkedHashMap<String, ol.layer.Vector> vectorLayersHighlighted = new LinkedHashMap<String, ol.layer.Vector>();
|
||||||
|
@ -417,8 +437,6 @@ public abstract class OpenLayerMap {
|
||||||
if (layer == null) {
|
if (layer == null) {
|
||||||
ImageWmsParams imageWMSParams = OLFactory.createOptions();
|
ImageWmsParams imageWMSParams = OLFactory.createOptions();
|
||||||
imageWMSParams.setLayers(layerItem.getName());
|
imageWMSParams.setLayers(layerItem.getName());
|
||||||
// imageWMSParams.set("CQL_FILTER", "product_id
|
|
||||||
// IN('6165b07202ad3d60e1d26f42','6166ff8002ad3d60e1d26fb7')");
|
|
||||||
|
|
||||||
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
||||||
imageWMSOptions.setUrl(layerItem.getMapServerHost());
|
imageWMSOptions.setUrl(layerItem.getMapServerHost());
|
||||||
|
@ -458,33 +476,51 @@ public abstract class OpenLayerMap {
|
||||||
/**
|
/**
|
||||||
* Sets the CQL filter to WMS layer.
|
* Sets the CQL filter to WMS layer.
|
||||||
*
|
*
|
||||||
* @param key the key
|
* @param origin the origin
|
||||||
* @param cqlFilterExpression the cql filter expression
|
* @param layerName the key
|
||||||
|
* @param newCQLFilterExpression the cql filter expression
|
||||||
|
* @return the new CQL Filter
|
||||||
*/
|
*/
|
||||||
public void setCQLFilterToWMSLayer(String key, String cqlFilterExpression) {
|
public String setCQLFilterToWMSLayer(CQL_FACILITY_ORIGIN origin, String layerName, String newCQLFilterExpression) {
|
||||||
|
GWT.log("Getting key (layerName): " + layerName);
|
||||||
GWT.log("Getting key: " + key);
|
GWT.log("Adding CQL FILTER: " + newCQLFilterExpression);
|
||||||
|
|
||||||
GWT.log("Setting CQL FILTER: " + cqlFilterExpression);
|
|
||||||
Image wmsLayer = wmsLayerMap.get(key);
|
|
||||||
|
|
||||||
|
Image wmsLayer = wmsLayerMap.get(layerName);
|
||||||
GWT.log("WMS layer is: " + wmsLayer);
|
GWT.log("WMS layer is: " + wmsLayer);
|
||||||
|
|
||||||
// map.removeLayer(wmsLayer);
|
|
||||||
|
|
||||||
ImageWms imageWMSSource = wmsLayer.getSource();
|
ImageWms imageWMSSource = wmsLayer.getSource();
|
||||||
ImageWmsParams imageWMSParams = imageWMSSource.getParams();
|
ImageWmsParams imageWMSParams = imageWMSSource.getParams();
|
||||||
|
|
||||||
if (cqlFilterExpression == null || cqlFilterExpression.length() > MAX_LENGHT_CQL_FOR_GET_REQUEST) {
|
// Setting new CQL filter for Origin
|
||||||
imageWMSParams.delete("CQL_FILTER");
|
cqlFilterMap.put(origin, newCQLFilterExpression);
|
||||||
} else {
|
|
||||||
imageWMSParams.set("CQL_FILTER", cqlFilterExpression);
|
String setCQLFilter = "";
|
||||||
|
|
||||||
|
// Building new CQL filter
|
||||||
|
for (CQL_FACILITY_ORIGIN originKey : cqlFilterMap.keySet()) {
|
||||||
|
|
||||||
|
String originCQLFilter = cqlFilterMap.get(originKey);
|
||||||
|
if (originCQLFilter != null) {
|
||||||
|
if (setCQLFilter.isEmpty()) {
|
||||||
|
setCQLFilter = originCQLFilter;
|
||||||
|
} else {
|
||||||
|
setCQLFilter += " AND " + originCQLFilter;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (setCQLFilter.isEmpty())
|
||||||
|
imageWMSParams.delete(CQL_FILTER_PARAMETER);
|
||||||
|
else
|
||||||
|
imageWMSParams.set(CQL_FILTER_PARAMETER, setCQLFilter);
|
||||||
|
|
||||||
imageWMSSource.updateParams(imageWMSParams);
|
imageWMSSource.updateParams(imageWMSParams);
|
||||||
wmsLayer.setSource(imageWMSSource);
|
wmsLayer.setSource(imageWMSSource);
|
||||||
|
|
||||||
wmsLayer.changed();
|
wmsLayer.changed();
|
||||||
|
|
||||||
|
GWT.log("returning " + CQL_FILTER_PARAMETER + ": " + setCQLFilter);
|
||||||
|
return setCQLFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -537,6 +573,57 @@ public abstract class OpenLayerMap {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the custom WMS detail layer.
|
||||||
|
*
|
||||||
|
* @param layerItem the layer item
|
||||||
|
*/
|
||||||
|
public void addGroupedCustomWMSLayer(LayerItem layerItem) {
|
||||||
|
|
||||||
|
if (wmsGroupedCustomLayerMap == null)
|
||||||
|
wmsGroupedCustomLayerMap = new LinkedHashMap<String, Image>();
|
||||||
|
|
||||||
|
String key = layerItem.getName();
|
||||||
|
|
||||||
|
Image layer = wmsGroupedCustomLayerMap.get(key);
|
||||||
|
|
||||||
|
if (layer == null) {
|
||||||
|
GWT.log("The grouped custom layer with key: " + key + " does not exist, creating and adding it to map");
|
||||||
|
ImageWmsParams imageWMSParams = OLFactory.createOptions();
|
||||||
|
imageWMSParams.setLayers(layerItem.getName());
|
||||||
|
|
||||||
|
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
||||||
|
imageWMSOptions.setUrl(layerItem.getMapServerHost());
|
||||||
|
imageWMSOptions.setParams(imageWMSParams);
|
||||||
|
// imageWMSOptions.setRatio(1.5f);
|
||||||
|
|
||||||
|
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
|
||||||
|
LayerOptions layerOptions = OLFactory.createOptions();
|
||||||
|
layerOptions.setSource(imageWMSSource);
|
||||||
|
|
||||||
|
// Settings MIN and MAX Resolution
|
||||||
|
if (layerItem.getMinResolution() != null) {
|
||||||
|
layerOptions.setMinResolution(layerItem.getMinResolution());
|
||||||
|
}
|
||||||
|
if (layerItem.getMaxResolution() != null) {
|
||||||
|
layerOptions.setMaxResolution(layerItem.getMaxResolution());
|
||||||
|
}
|
||||||
|
|
||||||
|
Image wmsLayer = new Image(layerOptions);
|
||||||
|
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.CUSTOM_WMS_DETAIL) + wmsGroupedCustomLayerMap.size()
|
||||||
|
+ 1;
|
||||||
|
wmsLayer.setZIndex(zIndex);
|
||||||
|
map.addLayer(wmsLayer);
|
||||||
|
wmsGroupedCustomLayerMap.put(key, wmsLayer);
|
||||||
|
|
||||||
|
GWT.log("Added GroupedCustomWMSLayer for layer name: " + layerItem.getName());
|
||||||
|
eventBus.fireEvent(new AddedLayerToMapEvent(layerItem, LAYER_TYPE.OVERLAY));
|
||||||
|
} else {
|
||||||
|
GWT.log("The WMS detail layer with key: " + key + " already exists, skipping");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the all detail layers.
|
* Removes the all detail layers.
|
||||||
*
|
*
|
||||||
|
@ -633,8 +720,8 @@ public abstract class OpenLayerMap {
|
||||||
/**
|
/**
|
||||||
* Adds the vector.
|
* Adds the vector.
|
||||||
*
|
*
|
||||||
* @param layerItem the layer item
|
* @param layerItem the layer item
|
||||||
* @param features the features
|
* @param features the features
|
||||||
* @param fitMapToFeaturesExtent the fit map to features extent
|
* @param fitMapToFeaturesExtent the fit map to features extent
|
||||||
*/
|
*/
|
||||||
public void addLayerFeaturesAsHighlight(LayerItem layerItem, Feature[] features, boolean fitMapToFeaturesExtent) {
|
public void addLayerFeaturesAsHighlight(LayerItem layerItem, Feature[] features, boolean fitMapToFeaturesExtent) {
|
||||||
|
@ -656,7 +743,7 @@ public abstract class OpenLayerMap {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(ol.events.Event event) {
|
public void onEvent(ol.events.Event event) {
|
||||||
ol.Extent theExtent = vectorSource.getExtent();
|
ol.Extent theExtent = vectorSource.getExtent();
|
||||||
//GWT.log(theExtent.toString());
|
// GWT.log(theExtent.toString());
|
||||||
map.getView().fit(theExtent);
|
map.getView().fit(theExtent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1050,7 +1137,21 @@ public abstract class OpenLayerMap {
|
||||||
public void setWMSDetailLayerOpacity(LayerItem layerItem, double opacity) {
|
public void setWMSDetailLayerOpacity(LayerItem layerItem, double opacity) {
|
||||||
String key = layerItem.getName();
|
String key = layerItem.getName();
|
||||||
Image layer = wmsDetailsLayerMap.get(key);
|
Image layer = wmsDetailsLayerMap.get(key);
|
||||||
layer.setOpacity(opacity);
|
if (layer != null)
|
||||||
|
layer.setOpacity(opacity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the WMS detail layer visible.
|
||||||
|
*
|
||||||
|
* @param layerItem the layer item
|
||||||
|
* @param visible the visible
|
||||||
|
*/
|
||||||
|
public void setWMSGroupedCustomLayerVisible(LayerItem layerItem, boolean visible) {
|
||||||
|
String key = layerItem.getName();
|
||||||
|
Image layer = wmsGroupedCustomLayerMap.get(key);
|
||||||
|
if (layer != null)
|
||||||
|
layer.setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1090,4 +1191,17 @@ public abstract class OpenLayerMap {
|
||||||
return map.get((map.keySet().toArray())[index]);
|
return map.get((map.keySet().toArray())[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fit to extent.
|
||||||
|
*
|
||||||
|
* @param extent the extent
|
||||||
|
*/
|
||||||
|
public void fitToExtent(ol.Extent extent) {
|
||||||
|
ViewFitOptions opt = new ViewFitOptions();
|
||||||
|
opt.setMaxZoom(16);
|
||||||
|
opt.setDuration(SET_CENTER_ANIMATED_DURATION*5);
|
||||||
|
map.getView().fit(extent, opt);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,10 @@ import java.util.List;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.GroupedLayersDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.ConfiguredLayerDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.LayerIDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
|
@ -20,12 +23,16 @@ import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAIcons;
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAIcons;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.search.SearchFacilityUI;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.search.SearchFacilityUI;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.crossfiltering.CrossFilteringLayerPanel;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.customoverlays.OverlayCustomLayerPanel;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.layercollection.LayerCollectionPanel;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.layercollection.LayerCollectionPanel;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Button;
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
import com.github.gwtbootstrap.client.ui.CheckBox;
|
import com.github.gwtbootstrap.client.ui.CheckBox;
|
||||||
|
@ -34,6 +41,7 @@ import com.github.gwtbootstrap.client.ui.ListBox;
|
||||||
import com.github.gwtbootstrap.client.ui.NavLink;
|
import com.github.gwtbootstrap.client.ui.NavLink;
|
||||||
import com.github.gwtbootstrap.client.ui.Paragraph;
|
import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
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.core.client.GWT;
|
||||||
import com.google.gwt.core.client.Scheduler;
|
import com.google.gwt.core.client.Scheduler;
|
||||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||||
|
@ -50,9 +58,11 @@ import com.google.gwt.uibinder.client.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.FlowPanel;
|
import com.google.gwt.user.client.ui.FlowPanel;
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||||
import com.google.gwt.user.client.ui.Image;
|
import com.google.gwt.user.client.ui.Image;
|
||||||
import com.google.gwt.user.client.ui.Label;
|
import com.google.gwt.user.client.ui.Label;
|
||||||
|
import com.google.gwt.user.client.ui.LayoutPanel;
|
||||||
import com.google.gwt.user.client.ui.RadioButton;
|
import com.google.gwt.user.client.ui.RadioButton;
|
||||||
import com.google.gwt.user.client.ui.ScrollPanel;
|
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||||
import com.google.gwt.user.client.ui.SimplePanel;
|
import com.google.gwt.user.client.ui.SimplePanel;
|
||||||
|
@ -111,6 +121,18 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
@UiField
|
@UiField
|
||||||
DropdownButton openCollectionDropDown;
|
DropdownButton openCollectionDropDown;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
DropdownButton linkCustomOverlayLayers;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
DropdownButton linkCrossFilteringLayers;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
HTMLPanel panelCustomOverlayLayers;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
HTMLPanel panelCrossFilteringLayers;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
HTMLPanel openCollectionPanel;
|
HTMLPanel openCollectionPanel;
|
||||||
|
|
||||||
|
@ -173,7 +195,7 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
extentToEarth.getElement().appendChild(worldImg.getElement());
|
extentToEarth.getElement().appendChild(worldImg.getElement());
|
||||||
extentToEarth.setWidth("140px");
|
extentToEarth.setWidth("140px");
|
||||||
|
|
||||||
linkMap.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
|
// linkMap.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
|
||||||
linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get());
|
linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get());
|
||||||
linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
|
linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
|
||||||
|
|
||||||
|
@ -188,14 +210,6 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
navListSearch.getElement().getFirstChildElement().setAttribute("disabled", "disabled");
|
navListSearch.getElement().getFirstChildElement().setAttribute("disabled", "disabled");
|
||||||
|
|
||||||
// List<UseCaseDescriptorDV> listUCDs = new ArrayList<UseCaseDescriptorDV>();
|
|
||||||
//
|
|
||||||
// for (ItemFieldsResponse itemFieldsResponse : itemFieldsReponse) {
|
|
||||||
// listUCDs.add(itemFieldsResponse.getUseCaseDescriptorDV());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Collections.sort(listUCDs);
|
|
||||||
|
|
||||||
for (final ItemFieldsResponse itemFieldResp : itemFieldsReponse) {
|
for (final ItemFieldsResponse itemFieldResp : itemFieldsReponse) {
|
||||||
|
|
||||||
UseCaseDescriptorDV ucd = itemFieldResp.getUseCaseDescriptorDV();
|
UseCaseDescriptorDV ucd = itemFieldResp.getUseCaseDescriptorDV();
|
||||||
|
@ -260,7 +274,9 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
searchFacilityPanel.getElement().getParentElement().getStyle().setOpacity(0.9);
|
searchFacilityPanel.getElement().getParentElement().addClassName("opacity-09");
|
||||||
|
panelCustomOverlayLayers.getElement().getParentElement().addClassName("opacity-09");
|
||||||
|
panelCrossFilteringLayers.getElement().getParentElement().addClassName("opacity-09");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,6 +326,26 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
}
|
}
|
||||||
}, ClickEvent.getType());
|
}, ClickEvent.getType());
|
||||||
|
|
||||||
|
linkCustomOverlayLayers.addDomHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
// event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
}
|
||||||
|
}, ClickEvent.getType());
|
||||||
|
|
||||||
|
linkCrossFilteringLayers.addDomHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
// event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
}
|
||||||
|
}, ClickEvent.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -608,4 +644,105 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addOverlayLayers(GCubeCollection collection,
|
||||||
|
List<GroupedLayersDV<? extends LayerIDV>> listGroupedLayers) {
|
||||||
|
|
||||||
|
if (listGroupedLayers == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
com.github.gwtbootstrap.client.ui.Label collectionGroup = new com.github.gwtbootstrap.client.ui.Label(
|
||||||
|
collection.getUcd().getName());
|
||||||
|
collectionGroup.setType(LabelType.WARNING);
|
||||||
|
LayoutPanel lc = new LayoutPanel();
|
||||||
|
lc.add(collectionGroup);
|
||||||
|
panelCustomOverlayLayers.add(lc);
|
||||||
|
|
||||||
|
for (GroupedLayersDV gCustomLayerDV : listGroupedLayers) {
|
||||||
|
if (gCustomLayerDV.getListCustomLayers() != null) {
|
||||||
|
FlowPanel lcInner = new FlowPanel();
|
||||||
|
lcInner.getElement().getStyle().setMarginLeft(5.0, Unit.PX);
|
||||||
|
com.github.gwtbootstrap.client.ui.Label labelGroup = new com.github.gwtbootstrap.client.ui.Label(
|
||||||
|
gCustomLayerDV.getName());
|
||||||
|
labelGroup.setType(LabelType.INFO);
|
||||||
|
String descr = gCustomLayerDV.getDescription() != null && !gCustomLayerDV.getDescription().isEmpty()
|
||||||
|
? gCustomLayerDV.getDescription()
|
||||||
|
: gCustomLayerDV.getName();
|
||||||
|
labelGroup.setTitle(descr);
|
||||||
|
lcInner.add(labelGroup);
|
||||||
|
if (descr.compareTo(gCustomLayerDV.getName()) != 0) {
|
||||||
|
HTML overlayGroupDescr = new HTML();
|
||||||
|
overlayGroupDescr.getElement().setClassName("overlay-panel-style-description");
|
||||||
|
overlayGroupDescr.setHTML(descr);
|
||||||
|
lcInner.add(overlayGroupDescr);
|
||||||
|
}
|
||||||
|
List<ConfiguredLayerDV> list = gCustomLayerDV.getListCustomLayers();
|
||||||
|
for (ConfiguredLayerDV customLayer : list) {
|
||||||
|
|
||||||
|
if (customLayer.isDisplay()) {
|
||||||
|
LayerItem layerItem = new LayerItem();
|
||||||
|
if (customLayer.getWMS_URL() != null) {
|
||||||
|
final String mapServerHost = URLUtil.getPathURL(customLayer.getWMS_URL());
|
||||||
|
GWT.log("mapServerHost: " + mapServerHost);
|
||||||
|
layerItem.setMapServerHost(mapServerHost);
|
||||||
|
layerItem.setBaseLayer(false);
|
||||||
|
layerItem.setName(customLayer.getName());
|
||||||
|
layerItem.setTitle(customLayer.getTitle());
|
||||||
|
layerItem.setWmsLink(customLayer.getWMS_URL());
|
||||||
|
// panelCustomOverlayLayers.add(new CrossFilteringLayerPanel(layerItem,
|
||||||
|
// applicationBus));
|
||||||
|
lcInner.add(new OverlayCustomLayerPanel(layerItem, applicationBus));
|
||||||
|
map.addGroupedCustomWMSLayer(layerItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
panelCustomOverlayLayers.add(lcInner);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
linkCustomOverlayLayers.setVisible(listGroupedLayers.size() > 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addCrossFilteringLayers(GCubeCollection collection,
|
||||||
|
List<GroupedLayersDV<? extends LayerIDV>> listGroupedLayers) {
|
||||||
|
|
||||||
|
if (listGroupedLayers == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
com.github.gwtbootstrap.client.ui.Label collectionGroup = new com.github.gwtbootstrap.client.ui.Label(
|
||||||
|
collection.getUcd().getName());
|
||||||
|
collectionGroup.setType(LabelType.WARNING);
|
||||||
|
LayoutPanel lc = new LayoutPanel();
|
||||||
|
lc.add(collectionGroup);
|
||||||
|
panelCrossFilteringLayers.add(lc);
|
||||||
|
for (GroupedLayersDV<? extends LayerIDV> groupedLayerDV : listGroupedLayers) {
|
||||||
|
FlowPanel lcInner = new FlowPanel();
|
||||||
|
lcInner.getElement().getStyle().setMarginLeft(5.0, Unit.PX);
|
||||||
|
com.github.gwtbootstrap.client.ui.Label labelGroup = new com.github.gwtbootstrap.client.ui.Label(
|
||||||
|
groupedLayerDV.getName());
|
||||||
|
labelGroup.setType(LabelType.INFO);
|
||||||
|
String descr = groupedLayerDV.getDescription() != null && !groupedLayerDV.getDescription().isEmpty()
|
||||||
|
? groupedLayerDV.getDescription()
|
||||||
|
: groupedLayerDV.getName();
|
||||||
|
labelGroup.setTitle(descr);
|
||||||
|
lcInner.add(labelGroup);
|
||||||
|
// panelCustomOverlayLayers.add(labelGroup);
|
||||||
|
if (descr.compareTo(groupedLayerDV.getName()) != 0) {
|
||||||
|
HTML overlayGroupDescr = new HTML();
|
||||||
|
overlayGroupDescr.getElement().setClassName("filter-panel-style-description");
|
||||||
|
overlayGroupDescr.setHTML(descr);
|
||||||
|
lcInner.add(overlayGroupDescr);
|
||||||
|
// panelCustomOverlayLayers.add(overlayGroupDescr);
|
||||||
|
}
|
||||||
|
CrossFilteringLayerPanel cfp = new CrossFilteringLayerPanel(collection, groupedLayerDV, applicationBus);
|
||||||
|
cfp.setFilterButton(linkCrossFilteringLayers);
|
||||||
|
lcInner.add(cfp);
|
||||||
|
panelCrossFilteringLayers.add(lcInner);
|
||||||
|
}
|
||||||
|
|
||||||
|
linkCrossFilteringLayers.setVisible(listGroupedLayers.size() > 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,17 +49,27 @@
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
</b:DropdownButton>
|
</b:DropdownButton>
|
||||||
<b:DropdownButton type="LINK"
|
<b:DropdownButton type="LINK" text="Collection"
|
||||||
text="Open Collection" ui:field="openCollectionDropDown">
|
ui:field="openCollectionDropDown">
|
||||||
<g:HTMLPanel ui:field="openCollectionPanel"
|
<g:HTMLPanel ui:field="openCollectionPanel"
|
||||||
addStyleNames="open-collection-style">
|
addStyleNames="open-collection-style">
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
</b:DropdownButton>
|
</b:DropdownButton>
|
||||||
<b:DropdownButton type="LINK"
|
<b:DropdownButton type="LINK"
|
||||||
title="Select the Map" text="Map" ui:field="linkMap">
|
title="Select the base Map" text="Map" ui:field="linkMap" icon="GLOBE">
|
||||||
<g:HTMLPanel ui:field="panelBaseLayers">
|
<g:HTMLPanel ui:field="panelBaseLayers">
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
</b:DropdownButton>
|
</b:DropdownButton>
|
||||||
|
<b:DropdownButton type="LINK" visible="false"
|
||||||
|
title="Add overlay layers.." text="Overlay" ui:field="linkCustomOverlayLayers" icon="REORDER">
|
||||||
|
<g:HTMLPanel ui:field="panelCustomOverlayLayers" addStyleNames="overlay-panel-style">
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</b:DropdownButton>
|
||||||
|
<b:DropdownButton type="LINK" visible="false"
|
||||||
|
title="Apply spatial filtering.." text="Filter" ui:field="linkCrossFilteringLayers" icon="FILTER">
|
||||||
|
<g:HTMLPanel ui:field="panelCrossFilteringLayers" addStyleNames="filter-panel-style">
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</b:DropdownButton>
|
||||||
<b:DropdownButton type="LINK" text="Search"
|
<b:DropdownButton type="LINK" text="Search"
|
||||||
ui:field="searchFacilityButton">
|
ui:field="searchFacilityButton">
|
||||||
<g:FlowPanel addStyleNames="search-field">
|
<g:FlowPanel addStyleNames="search-field">
|
||||||
|
@ -75,7 +85,7 @@
|
||||||
</b:DropdownButton>
|
</b:DropdownButton>
|
||||||
<b:DropdownButton type="LINK"
|
<b:DropdownButton type="LINK"
|
||||||
title="Center Map to Location" text="Preset Location"
|
title="Center Map to Location" text="Preset Location"
|
||||||
ui:field="linkPresetLocation">
|
ui:field="linkPresetLocation" addStyleNames="preset-location">
|
||||||
<b:Nav>
|
<b:Nav>
|
||||||
<b:Button type="LINK" ui:field="extentToItaly"
|
<b:Button type="LINK" ui:field="extentToItaly"
|
||||||
text="Italy" title="Center to Italy"></b:Button>
|
text="Italy" title="Center to Italy"></b:Button>
|
||||||
|
|
|
@ -304,7 +304,7 @@ public class ProjectViewer extends Composite {
|
||||||
|
|
||||||
GeoJSON spatialReference = theProjectView.getTheProjectDV().getSpatialReference();
|
GeoJSON spatialReference = theProjectView.getTheProjectDV().getSpatialReference();
|
||||||
|
|
||||||
Coordinate transfCoord = MapUtils.geoJSONTToBBoxCenter(spatialReference, MAP_PROJECTION.EPSG_4326.getName(),
|
Coordinate transfCoord = MapUtils.geoJSONToBBOXCenter(spatialReference, MAP_PROJECTION.EPSG_4326.getName(),
|
||||||
MAP_PROJECTION.EPSG_3857.getName());
|
MAP_PROJECTION.EPSG_3857.getName());
|
||||||
|
|
||||||
if (transfCoord != null) {
|
if (transfCoord != null) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.gcube.application.geoportalcommon.shared.WhereClause;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEvent;
|
||||||
|
@ -61,8 +62,6 @@ import com.google.gwt.user.client.ui.Widget;
|
||||||
*/
|
*/
|
||||||
public class SearchFacilityUI extends Composite {
|
public class SearchFacilityUI extends Composite {
|
||||||
|
|
||||||
private static final int SEARCHING_LIMIT_RESULTS_TO = 50;
|
|
||||||
|
|
||||||
private static SearchFacilityPanelUiBinder uiBinder = GWT.create(SearchFacilityPanelUiBinder.class);
|
private static SearchFacilityPanelUiBinder uiBinder = GWT.create(SearchFacilityPanelUiBinder.class);
|
||||||
|
|
||||||
protected static final int MIN_LENGHT_SERCHING_STRING = 3;
|
protected static final int MIN_LENGHT_SERCHING_STRING = 3;
|
||||||
|
@ -127,6 +126,7 @@ public class SearchFacilityUI extends Composite {
|
||||||
*
|
*
|
||||||
* @param profileID the profile ID
|
* @param profileID the profile ID
|
||||||
* @param appManagerBus the app manager bus
|
* @param appManagerBus the app manager bus
|
||||||
|
* @param displayByFields the display by fields
|
||||||
* @param sortByFields the sort by fields
|
* @param sortByFields the sort by fields
|
||||||
* @param searchForFields the search for fields
|
* @param searchForFields the search for fields
|
||||||
* @param initialSortFilter the initial sort filter
|
* @param initialSortFilter the initial sort filter
|
||||||
|
@ -237,6 +237,9 @@ public class SearchFacilityUI extends Composite {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset current search.
|
||||||
|
*/
|
||||||
public void resetCurrentSearch() {
|
public void resetCurrentSearch() {
|
||||||
searchField.setText("");
|
searchField.setText("");
|
||||||
resetSearch.setVisible(false);
|
resetSearch.setVisible(false);
|
||||||
|
@ -268,8 +271,9 @@ public class SearchFacilityUI extends Composite {
|
||||||
panelResults.clear();
|
panelResults.clear();
|
||||||
panelResults.add(new HTML("<hr>"));
|
panelResults.add(new HTML("<hr>"));
|
||||||
panelResults.add(new LoaderIcon("Searching..."));
|
panelResults.add(new LoaderIcon("Searching..."));
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance().getListProjects(profileID, 0, SEARCHING_LIMIT_RESULTS_TO,
|
GeoportalDataViewerServiceAsync.Util.getInstance().getListProjects(profileID, 0,
|
||||||
filter, false, new AsyncCallback<ResultSetPaginatedDataIDs>() {
|
GeoportalDataViewerConstants.SEARCH_LIMIT_RESULTS_TO_MAXIMUM, filter, false,
|
||||||
|
new AsyncCallback<ResultSetPaginatedDataIDs>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
@ -309,13 +313,14 @@ public class SearchFacilityUI extends Composite {
|
||||||
+ "). Please find below the top " + returnedItems + ".<br>";
|
+ "). Please find below the top " + returnedItems + ".<br>";
|
||||||
} else if (returnedItems > 0) {
|
} else if (returnedItems > 0) {
|
||||||
message = "Found " + returnedItems;
|
message = "Found " + returnedItems;
|
||||||
message += returnedItems > 0 ? " items" : " item";
|
message += returnedItems > 0 ? " projects" : " project";
|
||||||
message += ". ";
|
message += ".";
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (returnedItems > 0) {
|
if (returnedItems > 0
|
||||||
// message += "On the map you can see all the projects with a centroid matching the query";
|
&& returnedItems <= GeoportalDataViewerConstants.SEARCH_LIMIT_RESULTS_TO_MAXIMUM) {
|
||||||
// }
|
message += "On the map you can see all the projects with a centroid matching the query";
|
||||||
|
}
|
||||||
|
|
||||||
HTML resultMessage = new HTML(message);
|
HTML resultMessage = new HTML(message);
|
||||||
resultMessage.getElement().addClassName("search_result_msg");
|
resultMessage.getElement().addClassName("search_result_msg");
|
||||||
|
@ -356,7 +361,8 @@ public class SearchFacilityUI extends Composite {
|
||||||
profileID);
|
profileID);
|
||||||
// here
|
// here
|
||||||
appManagerBus.fireEvent(new ClosedViewDetailsEvent());
|
appManagerBus.fireEvent(new ClosedViewDetailsEvent());
|
||||||
appManagerBus.fireEvent(new ShowDetailsEvent(gir, null, true, true, EVENT_SOURCE.LOCATE_SEARCHED));
|
appManagerBus.fireEvent(
|
||||||
|
new ShowDetailsEvent(gir, null, true, true, EVENT_SOURCE.LOCATE_SEARCHED));
|
||||||
// appManagerBus.fireEvent(new ShowPopupOnCentroidEvent(profileID,
|
// appManagerBus.fireEvent(new ShowPopupOnCentroidEvent(profileID,
|
||||||
// resultDoc.getProjectID(), resultDoc.getSpatialReference()));
|
// resultDoc.getProjectID(), resultDoc.getSpatialReference()));
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,672 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui.crossfiltering;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.GroupedLayersDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.CrossFilteringLayerDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.LayerIDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDILayer;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.BBOXDV;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ApplyCQLToLayerOnMapEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.FitMapToExtentEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.OLGeoJSONUtil;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.WFSMakerUtil;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Alert;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
|
import com.github.gwtbootstrap.client.ui.CheckBox;
|
||||||
|
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||||
|
import com.github.gwtbootstrap.client.ui.ControlLabel;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Controls;
|
||||||
|
import com.github.gwtbootstrap.client.ui.DropdownButton;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Fieldset;
|
||||||
|
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||||
|
import com.google.gwt.event.dom.client.ChangeHandler;
|
||||||
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
|
import com.google.gwt.http.client.URL;
|
||||||
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.FlexTable;
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
|
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
import jsinterop.base.JsPropertyMap;
|
||||||
|
import ol.Extent;
|
||||||
|
import ol.Feature;
|
||||||
|
import ol.source.Vector;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class CrossFilteringLayerPanel.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* May 15, 2023
|
||||||
|
*/
|
||||||
|
public class CrossFilteringLayerPanel extends Composite {
|
||||||
|
|
||||||
|
private static final double BBOX_OFFESET_ON_FEATURES = 18000.0;
|
||||||
|
|
||||||
|
private static final String ITEM_LABEL = "centroid";
|
||||||
|
|
||||||
|
public static String COLORSCALERANGE = "COLORSCALERANGE";
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Fieldset fieldSet;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
HTMLPanel panelResults;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Button buttonReset;
|
||||||
|
|
||||||
|
private CheckBox checkbox;
|
||||||
|
|
||||||
|
private GeoInformationForWMSRequest geoInformation;
|
||||||
|
|
||||||
|
private static CrossFilteringLayerPanelUiBinder uiBinder = GWT.create(CrossFilteringLayerPanelUiBinder.class);
|
||||||
|
|
||||||
|
private HandlerManager applicationBus;
|
||||||
|
|
||||||
|
private LayerItem layerItem;
|
||||||
|
|
||||||
|
private LinkedHashMap<Integer, List<? extends LayerIDV>> mapInnestedFiltering = new LinkedHashMap<Integer, List<? extends LayerIDV>>();
|
||||||
|
|
||||||
|
private LinkedHashMap<Integer, HashMap<String, SelectableItem>> mapInnestedFeatures = new LinkedHashMap<Integer, HashMap<String, SelectableItem>>();
|
||||||
|
|
||||||
|
private LinkedHashMap<Integer, List<ListBox>> mapInnestedListBoxes = new LinkedHashMap<Integer, List<ListBox>>();
|
||||||
|
|
||||||
|
private GroupedLayersDV<? extends LayerIDV> groupedLayersDV;
|
||||||
|
|
||||||
|
private GCubeCollection gCubeCollection;
|
||||||
|
|
||||||
|
private DropdownButton filterButton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface LayerCollectionPanelUiBinder.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Jan 16, 2023
|
||||||
|
*/
|
||||||
|
interface CrossFilteringLayerPanelUiBinder extends UiBinder<Widget, CrossFilteringLayerPanel> {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new overlay custom layer panel.
|
||||||
|
*
|
||||||
|
* @param gCubeCollection the g cube collection
|
||||||
|
* @param groupedLayersDV the grouped layers DV
|
||||||
|
* @param applicationBus the application bus
|
||||||
|
*/
|
||||||
|
public CrossFilteringLayerPanel(GCubeCollection gCubeCollection,
|
||||||
|
GroupedLayersDV<? extends LayerIDV> groupedLayersDV, HandlerManager applicationBus) {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
this.applicationBus = applicationBus;
|
||||||
|
this.groupedLayersDV = groupedLayersDV;
|
||||||
|
this.gCubeCollection = gCubeCollection;
|
||||||
|
GWT.log("Building cross-filtering for: " + groupedLayersDV);
|
||||||
|
|
||||||
|
buttonReset.setType(ButtonType.LINK);
|
||||||
|
|
||||||
|
int level = 0;
|
||||||
|
// Building mapInnestedFiltering
|
||||||
|
recursivelyBuildSelectableLevels(level, groupedLayersDV.getListCustomLayers());
|
||||||
|
|
||||||
|
GWT.log("cross-filtering mapInnestedFiltering: " + mapInnestedFiltering);
|
||||||
|
|
||||||
|
for (Integer theLevel : mapInnestedFiltering.keySet()) {
|
||||||
|
addListBoxesLevelToPanel(theLevel, mapInnestedFiltering.get(theLevel));
|
||||||
|
}
|
||||||
|
|
||||||
|
fillSelectableLevel(level, null);
|
||||||
|
|
||||||
|
bindEvents();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bind events.
|
||||||
|
*/
|
||||||
|
private void bindEvents() {
|
||||||
|
|
||||||
|
buttonReset.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
panelResults.clear();
|
||||||
|
for (int i = 1; i < mapInnestedListBoxes.size(); i++) {
|
||||||
|
resetListBoxLevel(i);
|
||||||
|
}
|
||||||
|
// Selecting the placeholder of the fist list box
|
||||||
|
List<ListBox> listBox = mapInnestedListBoxes.get(0);
|
||||||
|
listBox.get(0).setSelectedIndex(0);
|
||||||
|
// Resetting CQL filtering
|
||||||
|
applicationBus.fireEvent(new ApplyCQLToLayerOnMapEvent(gCubeCollection.getIndexes().get(0), null));
|
||||||
|
setFilterHighLighted(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursively build selectable levels.
|
||||||
|
*
|
||||||
|
* @param level the level
|
||||||
|
* @param layersIDV the layers IDV
|
||||||
|
*/
|
||||||
|
private void recursivelyBuildSelectableLevels(int level, List<? extends LayerIDV> layersIDV) {
|
||||||
|
|
||||||
|
if (layersIDV == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
mapInnestedFiltering.put(level, layersIDV);
|
||||||
|
|
||||||
|
for (LayerIDV layerIDV : layersIDV) {
|
||||||
|
if (layerIDV instanceof CrossFilteringLayerDV) {
|
||||||
|
CrossFilteringLayerDV crossFilteringLayer = (CrossFilteringLayerDV) layerIDV;
|
||||||
|
|
||||||
|
if (crossFilteringLayer.getRelated_to() != null) {
|
||||||
|
recursivelyBuildSelectableLevels(++level, crossFilteringLayer.getRelated_to());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fill selectable level.
|
||||||
|
*
|
||||||
|
* @param level the level
|
||||||
|
* @param selectedItem the selected item
|
||||||
|
*/
|
||||||
|
private void fillSelectableLevel(int level, SelectableItem selectedItem) {
|
||||||
|
|
||||||
|
List<? extends LayerIDV> layersIDV = mapInnestedFiltering.get(level);
|
||||||
|
List<ListBox> listBoxes = mapInnestedListBoxes.get(level);
|
||||||
|
|
||||||
|
if (layersIDV == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
final HashMap<String, SelectableItem> mapSelectableFeatures = new HashMap<String, CrossFilteringLayerPanel.SelectableItem>();
|
||||||
|
|
||||||
|
LayerIDV layerIDV = layersIDV.get(0); // Expected one
|
||||||
|
|
||||||
|
if (layerIDV instanceof CrossFilteringLayerDV) {
|
||||||
|
CrossFilteringLayerDV crossFilteringLayer = (CrossFilteringLayerDV) layerIDV;
|
||||||
|
String wfsURL = crossFilteringLayer.getWFS_URL();
|
||||||
|
|
||||||
|
if (selectedItem != null) {
|
||||||
|
|
||||||
|
String cqlFilterValue = crossFilteringLayer.getTable_parent_key_field() + "=" + selectedItem.keyValue;
|
||||||
|
wfsURL += "&" + WFSMakerUtil.CQL_FILTER_PARAMETER + "=" + URL.encode(cqlFilterValue);
|
||||||
|
|
||||||
|
}
|
||||||
|
GWT.log("wfsURL request: " + wfsURL);
|
||||||
|
|
||||||
|
GeoportalDataViewerServiceAsync.Util.getInstance().getHTTPResponseForURL(wfsURL,
|
||||||
|
new AsyncCallback<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String response) {
|
||||||
|
GWT.log("wfsURL response: " + response);
|
||||||
|
Feature[] features = OLGeoJSONUtil.readGeoJsonFeatures(MAP_PROJECTION.EPSG_4326, response);
|
||||||
|
|
||||||
|
for (Feature feature : features) {
|
||||||
|
JsPropertyMap<Object> properties = feature.getProperties();
|
||||||
|
Object keyValue = properties.get(crossFilteringLayer.getTable_key_field());
|
||||||
|
Object itemField = properties.get(crossFilteringLayer.getTable_show_field());
|
||||||
|
|
||||||
|
Object parentKey = null;
|
||||||
|
if (crossFilteringLayer.getTable_parent_key_field() != null
|
||||||
|
&& !crossFilteringLayer.getTable_parent_key_field().isEmpty())
|
||||||
|
parentKey = properties.get(crossFilteringLayer.getTable_parent_key_field());
|
||||||
|
|
||||||
|
parentKey = parentKey == null ? "" : parentKey;
|
||||||
|
|
||||||
|
SelectableItem selectableItem = new SelectableItem(
|
||||||
|
crossFilteringLayer.getTable_key_field() + "", keyValue + "",
|
||||||
|
crossFilteringLayer.getTable_parent_key_field(), itemField + "",
|
||||||
|
crossFilteringLayer.getName(), crossFilteringLayer.getTable_geometry_name());
|
||||||
|
GWT.log("selectableItem: " + selectableItem);
|
||||||
|
|
||||||
|
String pathFeatureKey = pathFeatureKey(selectableItem);
|
||||||
|
mapSelectableFeatures.put(pathFeatureKey, selectableItem);
|
||||||
|
|
||||||
|
}
|
||||||
|
GWT.log("mapSelectableFeatures: " + mapSelectableFeatures);
|
||||||
|
mapInnestedFeatures.put(level, mapSelectableFeatures);
|
||||||
|
String placholder = placeholderLayer(layersIDV.get(0)); // Expected one
|
||||||
|
fillListBoxLevel(level, mapSelectableFeatures, listBoxes, placholder);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
panelResults.clear();
|
||||||
|
HTML error = new HTML(
|
||||||
|
"Sorry, an issue is occurred on loading data for cross-filtering facility. Error is: "
|
||||||
|
+ caught.getMessage());
|
||||||
|
panelResults.add(error);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path feature key.
|
||||||
|
*
|
||||||
|
* @param selectableItem the selectable item
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
|
private String pathFeatureKey(SelectableItem selectableItem) {
|
||||||
|
return "root_" + selectableItem.parentKeyField + "_" + selectableItem.keyField + "_" + selectableItem.keyValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Placeholder layer.
|
||||||
|
*
|
||||||
|
* @param layersIDV the layers IDV
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
|
private String placeholderLayer(LayerIDV layersIDV) {
|
||||||
|
String placeholder = "Select";
|
||||||
|
// if (layersIDV != null)
|
||||||
|
// placeholder += " " + layersIDV.getTitle();
|
||||||
|
|
||||||
|
placeholder += " ...";
|
||||||
|
return placeholder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the list boxes level to panel.
|
||||||
|
*
|
||||||
|
* @param level the level
|
||||||
|
* @param layersIDV the layers IDV
|
||||||
|
*/
|
||||||
|
private void addListBoxesLevelToPanel(int level, List<? extends LayerIDV> layersIDV) {
|
||||||
|
|
||||||
|
if (layersIDV == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
List<ListBox> listBoxes = new ArrayList<ListBox>(layersIDV.size());
|
||||||
|
|
||||||
|
for (LayerIDV layerIDV : layersIDV) {
|
||||||
|
ControlGroup cg = new ControlGroup();
|
||||||
|
ControlLabel cl = new ControlLabel(layerIDV.getTitle());
|
||||||
|
Controls controls = new Controls();
|
||||||
|
ListBox listBox = new ListBox();
|
||||||
|
String placeholder = placeholderLayer(layerIDV);
|
||||||
|
listBox.addItem(placeholder);
|
||||||
|
setEnabledBox(listBox, false);
|
||||||
|
listBoxes.add(listBox);
|
||||||
|
controls.add(listBox);
|
||||||
|
cg.add(cl);
|
||||||
|
cg.add(controls);
|
||||||
|
|
||||||
|
fieldSet.add(cg);
|
||||||
|
}
|
||||||
|
|
||||||
|
mapInnestedListBoxes.put(level, listBoxes);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the enabled box.
|
||||||
|
*
|
||||||
|
* @param listBox the list box
|
||||||
|
* @param bool the bool
|
||||||
|
*/
|
||||||
|
public void setEnabledBox(ListBox listBox, boolean bool) {
|
||||||
|
listBox.setEnabled(bool);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear list box.
|
||||||
|
*
|
||||||
|
* @param listBox the list box
|
||||||
|
* @param bool the bool
|
||||||
|
*/
|
||||||
|
public void clearListBox(ListBox listBox, boolean bool) {
|
||||||
|
listBox.setEnabled(bool);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset list box level.
|
||||||
|
*
|
||||||
|
* @param level the level
|
||||||
|
*/
|
||||||
|
private void resetListBoxLevel(int level) {
|
||||||
|
|
||||||
|
List<ListBox> listBoxes = mapInnestedListBoxes.get(level);
|
||||||
|
if (listBoxes != null) {
|
||||||
|
for (ListBox listBox : listBoxes) {
|
||||||
|
listBox.clear();
|
||||||
|
setEnabledBox(listBox, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fill list box level.
|
||||||
|
*
|
||||||
|
* @param level the level
|
||||||
|
* @param mapSelectableFeatures the map selectable features
|
||||||
|
* @param listBoxes the list boxes
|
||||||
|
* @param placeholder the placeholder
|
||||||
|
*/
|
||||||
|
private void fillListBoxLevel(int level, HashMap<String, SelectableItem> mapSelectableFeatures,
|
||||||
|
List<ListBox> listBoxes, String placeholder) {
|
||||||
|
// GWT.log("fillBox level: " + level + " map: " + mapSelectableFeatures);
|
||||||
|
|
||||||
|
if (mapSelectableFeatures == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ListBox listBox = listBoxes.get(0); // Expected one
|
||||||
|
listBox.clear();
|
||||||
|
listBox.addItem(placeholder);
|
||||||
|
listBox.getElement().getFirstChildElement().setAttribute("disabled", "disabled");
|
||||||
|
|
||||||
|
for (String key : mapSelectableFeatures.keySet()) {
|
||||||
|
SelectableItem selItem = mapSelectableFeatures.get(key);
|
||||||
|
listBox.addItem(selItem.itemValue, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
listBox.addChangeHandler(new ChangeHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChange(ChangeEvent event) {
|
||||||
|
loadInnerLevel(level, listBox.getSelectedValue());
|
||||||
|
|
||||||
|
for (int i = level + 1; i < mapInnestedListBoxes.size(); i++) {
|
||||||
|
resetListBoxLevel(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
String key = listBox.getSelectedValue();
|
||||||
|
SelectableItem selectableItem = mapSelectableFeatures.get(key);
|
||||||
|
buildCrossFilteringCQLAndFireEvent(selectableItem);
|
||||||
|
setFilterHighLighted(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
setEnabledBox(listBox, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the cross filtering CQL and fire event.
|
||||||
|
*
|
||||||
|
* @param selectableItem the selectable item
|
||||||
|
*/
|
||||||
|
private void buildCrossFilteringCQLAndFireEvent(SelectableItem selectableItem) {
|
||||||
|
String setCqlFilter = "INTERSECTS(geom,querySingle('" + selectableItem.layername + "','"
|
||||||
|
+ selectableItem.theGeometryName + "','" + selectableItem.keyField + "=''" + selectableItem.keyValue
|
||||||
|
+ "'''))";
|
||||||
|
// setCqlFilter = URL.encode(setCqlFilter);
|
||||||
|
GWT.log("CQL FILTER built: " + setCqlFilter);
|
||||||
|
|
||||||
|
IndexLayerDV indexLayer = gCubeCollection.getIndexes().get(0);
|
||||||
|
|
||||||
|
try {
|
||||||
|
GCubeSDILayer layer = indexLayer.getLayer();
|
||||||
|
String wmsLink = layer.getOgcLinks().get("wms");
|
||||||
|
String layerName = URLUtil.extractValueOfParameterFromURL("layers", wmsLink);
|
||||||
|
String serviceURL = URLUtil.getPathURL(wmsLink);
|
||||||
|
String toLServiceURL = serviceURL.toLowerCase();
|
||||||
|
if (toLServiceURL.endsWith("wms")) {
|
||||||
|
toLServiceURL = toLServiceURL.substring(0, toLServiceURL.length() - 3) + "ows";
|
||||||
|
}
|
||||||
|
String wfsCrossFilteringQuery = WFSMakerUtil.buildWFSRequest(toLServiceURL, layerName, 1000, "geom",
|
||||||
|
setCqlFilter);
|
||||||
|
GWT.log("wfsCrossFilteringQuery: " + wfsCrossFilteringQuery);
|
||||||
|
showCountResultsOfWFSCrossFiltering(wfsCrossFilteringQuery);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
}
|
||||||
|
|
||||||
|
applicationBus.fireEvent(new ApplyCQLToLayerOnMapEvent(indexLayer, setCqlFilter));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showCountResultsOfWFSCrossFiltering(String wfsQuery) {
|
||||||
|
|
||||||
|
panelResults.clear();
|
||||||
|
panelResults.add(new HTML("<hr>"));
|
||||||
|
panelResults.add(new LoaderIcon("Applying spatial filter..."));
|
||||||
|
|
||||||
|
GeoportalDataViewerServiceAsync.Util.getInstance().getHTTPResponseForURL(wfsQuery, new AsyncCallback<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
panelResults.clear();
|
||||||
|
panelResults.add(new HTML("<hr>"));
|
||||||
|
Alert alert = new Alert("Error on returning number of items");
|
||||||
|
alert.setType(AlertType.ERROR);
|
||||||
|
alert.setClose(false);
|
||||||
|
panelResults.add(alert);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String response) {
|
||||||
|
Feature[] features = OLGeoJSONUtil.readGeoJsonFeatures(MAP_PROJECTION.EPSG_4326, response);
|
||||||
|
|
||||||
|
if (features != null) {
|
||||||
|
int dataCount = features.length;
|
||||||
|
|
||||||
|
panelResults.clear();
|
||||||
|
panelResults.add(new HTML("<hr>"));
|
||||||
|
|
||||||
|
FlexTable flexTable = new FlexTable();
|
||||||
|
|
||||||
|
String message = "";
|
||||||
|
|
||||||
|
if (dataCount <= 0) {
|
||||||
|
message = "No " + ITEM_LABEL + " found";
|
||||||
|
} else {
|
||||||
|
|
||||||
|
message = "Found " + dataCount;
|
||||||
|
message += dataCount > 1 ? " " + ITEM_LABEL + "s" : " " + ITEM_LABEL;
|
||||||
|
}
|
||||||
|
HTML resultMessage = new HTML();
|
||||||
|
resultMessage.getElement().addClassName("search_result_msg");
|
||||||
|
resultMessage.setHTML(message);
|
||||||
|
flexTable.setWidget(0, 0, resultMessage.asWidget());
|
||||||
|
panelResults.add(flexTable);
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (features.length > 0) {
|
||||||
|
// Calculating Extend of the selected Features
|
||||||
|
Vector vector = new Vector();
|
||||||
|
vector.addFeatures(features);
|
||||||
|
Extent theExtent = vector.getExtent();
|
||||||
|
GWT.log("Extent from features is: " + theExtent);
|
||||||
|
theExtent = MapUtils.transformExtent(theExtent, MAP_PROJECTION.EPSG_4326.getName(),
|
||||||
|
MAP_PROJECTION.EPSG_3857.getName());
|
||||||
|
|
||||||
|
double bboxOffset = features.length>1?BBOX_OFFESET_ON_FEATURES:0;
|
||||||
|
|
||||||
|
final Extent transfExtent = new ExtentWrapped(theExtent.getLowerLeftX() - bboxOffset,
|
||||||
|
theExtent.getLowerLeftY() - bboxOffset, theExtent.getUpperRightX() + bboxOffset,
|
||||||
|
theExtent.getUpperRightY() + bboxOffset);
|
||||||
|
GWT.log("Zoom to selected - transf extent: " + transfExtent);
|
||||||
|
|
||||||
|
Button selectTo = new Button("Zoom to selected");
|
||||||
|
selectTo.setTitle("Zoom to select centroids...");
|
||||||
|
selectTo.setType(ButtonType.DEFAULT);
|
||||||
|
selectTo.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
applicationBus.fireEvent(new FitMapToExtentEvent(transfExtent));
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
flexTable.setWidget(1, 0, selectTo);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final BBOXDV fromGeoJSON(double[] coords) {
|
||||||
|
BBOXDV toReturn = new BBOXDV();
|
||||||
|
toReturn.setMaxX(coords[0]);
|
||||||
|
toReturn.setMinY(coords[1]);
|
||||||
|
|
||||||
|
if (coords.length == 6) {
|
||||||
|
// 3D
|
||||||
|
toReturn.setMinZ(coords[2]);
|
||||||
|
toReturn.setMinX(coords[3]);
|
||||||
|
toReturn.setMaxY(coords[4]);
|
||||||
|
toReturn.setMaxZ(coords[5]);
|
||||||
|
} else {
|
||||||
|
toReturn.setMinX(coords[2]);
|
||||||
|
toReturn.setMaxY(coords[3]);
|
||||||
|
}
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load inner level.
|
||||||
|
*
|
||||||
|
* @param level the level
|
||||||
|
* @param selectableItemValue the selectable item value
|
||||||
|
*/
|
||||||
|
private void loadInnerLevel(int level, String selectableItemValue) {
|
||||||
|
// GWT.log("selected level " + level + " selectableItemValue " +
|
||||||
|
// selectableItemValue);
|
||||||
|
HashMap<String, SelectableItem> mapSelectableItem = mapInnestedFeatures.get(level);
|
||||||
|
SelectableItem selectedItem = mapSelectableItem.get(selectableItemValue);
|
||||||
|
|
||||||
|
// GWT.log("selected selectableItem " + selectedItem);
|
||||||
|
int innerLevel = level + 1;
|
||||||
|
List<? extends LayerIDV> selectedLayers = mapInnestedFiltering.get(innerLevel);
|
||||||
|
|
||||||
|
// if layer filtering exists at this level
|
||||||
|
if (selectedLayers != null) {
|
||||||
|
|
||||||
|
List<ListBox> selectedListBoxes = mapInnestedListBoxes.get(innerLevel);
|
||||||
|
GWT.log("loading inner layers " + selectedLayers);
|
||||||
|
GWT.log("loading selectedListBoxes " + selectedListBoxes);
|
||||||
|
fillSelectableLevel(innerLevel, selectedItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the filter high lighted.
|
||||||
|
*
|
||||||
|
* @param bool the new filter high lighted
|
||||||
|
*/
|
||||||
|
private void setFilterHighLighted(boolean bool) {
|
||||||
|
if (bool) {
|
||||||
|
filterButton.getElement().addClassName("highlight-button");
|
||||||
|
} else {
|
||||||
|
filterButton.getElement().removeClassName("highlight-button");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the search button.
|
||||||
|
*
|
||||||
|
* @param searchFacilityButton the new search button
|
||||||
|
*/
|
||||||
|
public void setFilterButton(DropdownButton searchFacilityButton) {
|
||||||
|
this.filterButton = searchFacilityButton;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class SelectableItem.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* May 31, 2023
|
||||||
|
*/
|
||||||
|
public class SelectableItem {
|
||||||
|
protected String keyField;
|
||||||
|
protected String keyValue;
|
||||||
|
protected String parentKeyField;
|
||||||
|
protected String itemValue;
|
||||||
|
protected String layername;
|
||||||
|
protected String theGeometryName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new selectable item.
|
||||||
|
*/
|
||||||
|
SelectableItem() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new selectable item.
|
||||||
|
*
|
||||||
|
* @param keyField the key field
|
||||||
|
* @param keyValue the key value
|
||||||
|
* @param parentKeyField the parent key field
|
||||||
|
* @param itemValue the item value
|
||||||
|
* @param layername the layername
|
||||||
|
* @param theGeometryName the the geometry name
|
||||||
|
*/
|
||||||
|
public SelectableItem(String keyField, String keyValue, String parentKeyField, String itemValue,
|
||||||
|
String layername, String theGeometryName) {
|
||||||
|
super();
|
||||||
|
this.keyField = keyField;
|
||||||
|
this.keyValue = keyValue;
|
||||||
|
this.parentKeyField = parentKeyField;
|
||||||
|
this.itemValue = itemValue;
|
||||||
|
this.layername = layername;
|
||||||
|
this.theGeometryName = theGeometryName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To string.
|
||||||
|
*
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("SelectableItem [keyField=");
|
||||||
|
builder.append(keyField);
|
||||||
|
builder.append(", keyValue=");
|
||||||
|
builder.append(keyValue);
|
||||||
|
builder.append(", parentKeyField=");
|
||||||
|
builder.append(parentKeyField);
|
||||||
|
builder.append(", itemValue=");
|
||||||
|
builder.append(itemValue);
|
||||||
|
builder.append(", layername=");
|
||||||
|
builder.append(layername);
|
||||||
|
builder.append(", theGeometryName=");
|
||||||
|
builder.append(theGeometryName);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||||
|
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||||
|
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||||
|
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||||
|
<ui:style>
|
||||||
|
.important {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.margin-left-10 {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
</ui:style>
|
||||||
|
<g:HTMLPanel>
|
||||||
|
<g:ScrollPanel>
|
||||||
|
<g:HTMLPanel>
|
||||||
|
<b:Form ui:field="panelForm">
|
||||||
|
<b:Fieldset ui:field="fieldSet">
|
||||||
|
</b:Fieldset>
|
||||||
|
</b:Form>
|
||||||
|
<g:HTMLPanel ui:field="panelResults">
|
||||||
|
</g:HTMLPanel>
|
||||||
|
<b:Button icon="REMOVE_CIRCLE" ui:field="buttonReset"
|
||||||
|
title="Reset the filter">Reset</b:Button>
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</g:ScrollPanel>
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</ui:UiBinder>
|
|
@ -0,0 +1,278 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui.customoverlays;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.OverlayCustomLayerToMapEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
|
import com.github.gwtbootstrap.client.ui.CheckBox;
|
||||||
|
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.dom.client.Style.FontWeight;
|
||||||
|
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||||
|
import com.google.gwt.event.dom.client.ChangeHandler;
|
||||||
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
import com.google.gwt.event.dom.client.ErrorEvent;
|
||||||
|
import com.google.gwt.event.dom.client.ErrorHandler;
|
||||||
|
import com.google.gwt.event.dom.client.LoadEvent;
|
||||||
|
import com.google.gwt.event.dom.client.LoadHandler;
|
||||||
|
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||||
|
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||||
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
|
import com.google.gwt.user.client.Window;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
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.HTMLPanel;
|
||||||
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Image;
|
||||||
|
import com.google.gwt.user.client.ui.Label;
|
||||||
|
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class OverlayCustomLayerPanel.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* May 15, 2023
|
||||||
|
*/
|
||||||
|
public class OverlayCustomLayerPanel extends Composite {
|
||||||
|
|
||||||
|
public static String COLORSCALERANGE = "COLORSCALERANGE";
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
HTMLPanel basePanel;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
HTMLPanel stylePanel;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
HTMLPanel styleListPanel;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Button buttonLegend;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
ScrollPanel legendPanel;
|
||||||
|
|
||||||
|
private CheckBox checkbox;
|
||||||
|
|
||||||
|
private GeoInformationForWMSRequest geoInformation;
|
||||||
|
|
||||||
|
private static OverlayCustomLayerPanelUiBinder uiBinder = GWT.create(OverlayCustomLayerPanelUiBinder.class);
|
||||||
|
|
||||||
|
private ListBox listBoxStyles = new ListBox();
|
||||||
|
|
||||||
|
private HandlerManager applicationBus;
|
||||||
|
|
||||||
|
private LayerItem layerItem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface LayerCollectionPanelUiBinder.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Jan 16, 2023
|
||||||
|
*/
|
||||||
|
interface OverlayCustomLayerPanelUiBinder extends UiBinder<Widget, OverlayCustomLayerPanel> {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new overlay custom layer panel.
|
||||||
|
*
|
||||||
|
* @param layerItem the layer item
|
||||||
|
* @param applicationBus the application bus
|
||||||
|
*/
|
||||||
|
public OverlayCustomLayerPanel(LayerItem layerItem, HandlerManager applicationBus) {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
this.applicationBus = applicationBus;
|
||||||
|
this.layerItem = layerItem;
|
||||||
|
|
||||||
|
buttonLegend.setType(ButtonType.LINK);
|
||||||
|
legendPanel.setVisible(false);
|
||||||
|
|
||||||
|
GWT.log("Found available layerItem " + layerItem);
|
||||||
|
String label = layerItem.getTitle();
|
||||||
|
final String layerName = layerItem.getName();
|
||||||
|
|
||||||
|
checkbox = new CheckBox(label);
|
||||||
|
checkbox.setId("gcubeCustomLayerSelector_" + layerName);
|
||||||
|
checkbox.getElement().getStyle().setFontWeight(FontWeight.BOLD);
|
||||||
|
checkbox.setChecked(true);
|
||||||
|
|
||||||
|
checkbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||||
|
GWT.log("CustomLayer selector flag changed to value : " + event.toDebugString());
|
||||||
|
if (event.getValue()) {
|
||||||
|
// OPEN COLLECTION
|
||||||
|
applicationBus.fireEvent(new OverlayCustomLayerToMapEvent(layerItem, OverlayCustomLayerToMapEvent.ACTION_TYPE.VISIBILITY, true));
|
||||||
|
} else {
|
||||||
|
// CLOSE COLLECTION
|
||||||
|
legendPanel.clear();
|
||||||
|
legendPanel.setVisible(false);
|
||||||
|
applicationBus.fireEvent(new OverlayCustomLayerToMapEvent(layerItem, OverlayCustomLayerToMapEvent.ACTION_TYPE.VISIBILITY, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
basePanel.add(checkbox);
|
||||||
|
|
||||||
|
final String wmsLink = layerItem.getWmsLink();
|
||||||
|
GeoportalDataViewerServiceAsync.Util.getInstance().parseWmsRequest(wmsLink, layerName,
|
||||||
|
new AsyncCallback<GeoInformationForWMSRequest>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
|
||||||
|
Window.alert(caught.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(GeoInformationForWMSRequest geoInfoWMS) {
|
||||||
|
geoInformation = geoInfoWMS;
|
||||||
|
GWT.log("Parsed WMS Request returned: " + geoInfoWMS);
|
||||||
|
|
||||||
|
if (geoInfoWMS.getStyles() != null && geoInfoWMS.getStyles().getGeoStyles() != null) {
|
||||||
|
if (geoInfoWMS.getStyles().getGeoStyles().size() > 0) {
|
||||||
|
stylePanel.setVisible(true);
|
||||||
|
listBoxStyles.clear();
|
||||||
|
for (String styleName : geoInfoWMS.getStyles().getGeoStyles()) {
|
||||||
|
listBoxStyles.addItem(styleName, styleName);
|
||||||
|
}
|
||||||
|
|
||||||
|
styleListPanel.add(listBoxStyles);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
listBoxStyles.addChangeHandler(new ChangeHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChange(ChangeEvent event) {
|
||||||
|
legendPanel.clear();
|
||||||
|
legendPanel.setVisible(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
buttonLegend.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
GWT.log("is isToggle: " + buttonLegend.isToggle());
|
||||||
|
GWT.log("is isToggled: " + buttonLegend.isToggled());
|
||||||
|
if (legendPanel.isVisible()) {
|
||||||
|
legendPanel.clear();
|
||||||
|
legendPanel.setVisible(false);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
legendPanel.setVisible(true);
|
||||||
|
loadLegend(wmsLink);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the checkbox.
|
||||||
|
*
|
||||||
|
* @return the checkbox
|
||||||
|
*/
|
||||||
|
public CheckBox getCheckbox() {
|
||||||
|
return checkbox;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load legend.
|
||||||
|
*
|
||||||
|
* @param wmsLink the wms link
|
||||||
|
*/
|
||||||
|
private void loadLegend(String wmsLink) {
|
||||||
|
|
||||||
|
legendPanel.clear();
|
||||||
|
String theLayerName = geoInformation.getLayerName();
|
||||||
|
final FlexTable flexTable = new FlexTable();
|
||||||
|
legendPanel.add(flexTable);
|
||||||
|
|
||||||
|
// Case no style found
|
||||||
|
if (listBoxStyles.getSelectedValue() == null) {
|
||||||
|
flexTable.setWidget(0, 0, new HTML("No style found"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FlowPanel flow = new FlowPanel();
|
||||||
|
flow.add(new HTMLPanel("Legend for: " + theLayerName));
|
||||||
|
final HorizontalPanel hpLegend = new HorizontalPanel();
|
||||||
|
|
||||||
|
String url = geoInformation.getBaseWmsServiceHost() + "?service=WMS&" + "version="
|
||||||
|
+ URLUtil.getValueOfParameter("version", wmsLink) + "&" + "request=GetLegendGraphic&" + "layer="
|
||||||
|
+ theLayerName;
|
||||||
|
|
||||||
|
String styleName = null;
|
||||||
|
try {
|
||||||
|
styleName = listBoxStyles.getSelectedValue();
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
styleName = styleName != null && !styleName.isEmpty() ? styleName : "";
|
||||||
|
|
||||||
|
if (!geoInformation.isNcWMS()) {
|
||||||
|
|
||||||
|
url += "&format=image/png" + "&STYLE=" + styleName
|
||||||
|
+ "&LEGEND_OPTIONS=forceRule:True;dx:0.2;dy:0.2;mx:0.2;my:0.2;fontStyle:bold;"
|
||||||
|
+ "borderColor:000000;border:true;fontColor:000000;fontSize:14";
|
||||||
|
} else {
|
||||||
|
|
||||||
|
int isNcWmsStyle = styleName.indexOf("/");
|
||||||
|
if (isNcWmsStyle != -1) {
|
||||||
|
styleName = styleName.substring(isNcWmsStyle + 1, styleName.length());
|
||||||
|
}
|
||||||
|
url += "&palette=" + styleName;
|
||||||
|
if (geoInformation.getMapWMSNoStandard() != null) {
|
||||||
|
for (String key : geoInformation.getMapWMSNoStandard().keySet()) { // ADDING COLORSCALERANGE?
|
||||||
|
if (key.compareToIgnoreCase(COLORSCALERANGE) == 0) {
|
||||||
|
url += "&" + key + "=" + geoInformation.getMapWMSNoStandard().get(key);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GWT.log(url);
|
||||||
|
flexTable.setStyleName("layer-style-panel-table-legend");
|
||||||
|
flexTable.setWidget(0, 0, new Label("Legend"));
|
||||||
|
final Image legendImage = new Image(url);
|
||||||
|
legendImage.addLoadHandler(new LoadHandler() {
|
||||||
|
@Override
|
||||||
|
public void onLoad(LoadEvent event) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
legendImage.addErrorHandler(new ErrorHandler() {
|
||||||
|
@Override
|
||||||
|
public void onError(ErrorEvent event) {
|
||||||
|
GWT.log("ErrorEvent ");
|
||||||
|
flexTable.setWidget(0, 1, new HTML("Error on loading the style"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
hpLegend.add(legendImage);
|
||||||
|
flexTable.setWidget(0, 1, hpLegend);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||||
|
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||||
|
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||||
|
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||||
|
<ui:style>
|
||||||
|
.important {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.margin-left-10 {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
</ui:style>
|
||||||
|
<g:HTMLPanel addStyleNames="{style.margin-left-10}">
|
||||||
|
<g:HTMLPanel ui:field="basePanel">
|
||||||
|
</g:HTMLPanel>
|
||||||
|
<g:HTMLPanel ui:field="stylePanel" visible="false"
|
||||||
|
addStyleNames="layer-style-panel">
|
||||||
|
Layer Style
|
||||||
|
<g:HorizontalPanel>
|
||||||
|
<g:HTMLPanel ui:field="styleListPanel"></g:HTMLPanel>
|
||||||
|
<b:Button icon="BAR_CHART" ui:field="buttonLegend"
|
||||||
|
title="Show the Legend"></b:Button>
|
||||||
|
</g:HorizontalPanel>
|
||||||
|
|
||||||
|
<g:ScrollPanel ui:field="legendPanel"></g:ScrollPanel>
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</ui:UiBinder>
|
|
@ -42,12 +42,13 @@ import com.google.gwt.user.client.ui.Label;
|
||||||
import com.google.gwt.user.client.ui.ScrollPanel;
|
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class LayerCollectionPanel.
|
* The Class LayerCollectionPanel.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
* Jan 16, 2023
|
* May 15, 2023
|
||||||
*/
|
*/
|
||||||
public class LayerCollectionPanel extends Composite {
|
public class LayerCollectionPanel extends Composite {
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui.util;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class OLGeoJSONUtil.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* May 25, 2023
|
||||||
|
*/
|
||||||
|
public class OLGeoJSONUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the geo JSON.
|
||||||
|
*
|
||||||
|
* @param projection the projection
|
||||||
|
* @return the geo json
|
||||||
|
*/
|
||||||
|
public static GeoJson buildGeoJSON(MAP_PROJECTION projection) {
|
||||||
|
try {
|
||||||
|
GeoJsonFeatureOptions fo = new GeoJsonFeatureOptions();
|
||||||
|
ProjectionOptions projectionOptions = new ProjectionOptions();
|
||||||
|
projectionOptions.setCode(projection.getName());
|
||||||
|
Projection fp = new Projection(projectionOptions);
|
||||||
|
fo.setFeatureProjection(fp);
|
||||||
|
fo.setDataProjection(fp);
|
||||||
|
GeoJsonOptions geoJsonOpt = new GeoJsonOptions();
|
||||||
|
geoJsonOpt.setDefaultDataProjection(fp);
|
||||||
|
geoJsonOpt.setFeatureProjection(fp);
|
||||||
|
return OLFactory.createGeoJSON(geoJsonOpt);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// silent
|
||||||
|
return OLFactory.createGeoJSON();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read geo json features.
|
||||||
|
*
|
||||||
|
* @param projection the projection
|
||||||
|
* @param geoJSONString the geo JSON string
|
||||||
|
* @return the feature[]
|
||||||
|
*/
|
||||||
|
public static Feature[] readGeoJsonFeatures(MAP_PROJECTION projection, String geoJSONString) {
|
||||||
|
GeoJson geoJson = buildGeoJSON(projection);
|
||||||
|
return geoJson.readFeatures(geoJSONString);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.util;
|
package org.gcube.portlets.user.geoportaldataviewer.client.util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class URLUtil.
|
* The Class HTTPRequestUtil.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
|
@ -35,6 +35,20 @@ public class URLUtil {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the path URL.
|
||||||
|
*
|
||||||
|
* @param url the url
|
||||||
|
* @return the path URL
|
||||||
|
*/
|
||||||
|
public static String getPathURL(String url) {
|
||||||
|
int index = url.toLowerCase().indexOf("?");
|
||||||
|
if (index > -1) {
|
||||||
|
return url.substring(0, index);
|
||||||
|
} else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the parameter to query string.
|
* Adds the parameter to query string.
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.util;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.WFSGetFeature;
|
||||||
|
|
||||||
|
import com.google.gwt.http.client.URL;
|
||||||
|
|
||||||
|
public class WFSMakerUtil {
|
||||||
|
|
||||||
|
public static final String CQL_FILTER_PARAMETER = "CQL_FILTER";
|
||||||
|
|
||||||
|
public static String buildWFSRequest(String webserviceURL, String layerName, int maxFeatures, String propertyName,
|
||||||
|
String cqlFilter) throws Exception {
|
||||||
|
|
||||||
|
if (layerName == null)
|
||||||
|
throw new Exception("Bad parameter layerName is null");
|
||||||
|
|
||||||
|
if (webserviceURL == null)
|
||||||
|
throw new Exception("Bad parameter webserviceURL is null");
|
||||||
|
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append(webserviceURL);
|
||||||
|
builder.append("?");
|
||||||
|
builder.append(WFSGetFeature.SERVICE.getParameter() + "=" + WFSGetFeature.SERVICE.getValue());
|
||||||
|
builder.append("&");
|
||||||
|
builder.append(WFSGetFeature.VERSION.getParameter() + "=" + WFSGetFeature.VERSION.getValue());
|
||||||
|
builder.append("&");
|
||||||
|
builder.append(WFSGetFeature.REQUEST.getParameter() + "=" + WFSGetFeature.REQUEST.getValue());
|
||||||
|
builder.append("&");
|
||||||
|
builder.append(WFSGetFeature.OUTPUTFORMAT.getParameter() + "=" + URL.encode("application/json"));
|
||||||
|
builder.append("&");
|
||||||
|
builder.append(WFSGetFeature.TYPENAME.getParameter() + "=" + layerName);
|
||||||
|
builder.append("&");
|
||||||
|
|
||||||
|
if (maxFeatures > 0) {
|
||||||
|
builder.append(WFSGetFeature.MAXFEATURES.getParameter() + "=" + maxFeatures);
|
||||||
|
builder.append("&");
|
||||||
|
}
|
||||||
|
if (propertyName != null) {
|
||||||
|
builder.append(WFSGetFeature.PROPERTYNAME.getParameter() + "=" + propertyName);
|
||||||
|
builder.append("&");
|
||||||
|
}
|
||||||
|
if (cqlFilter != null) {
|
||||||
|
builder.append(CQL_FILTER_PARAMETER + "=" + cqlFilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -3,10 +3,6 @@ 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.projects;
|
||||||
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.useCaseDescriptors;
|
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.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -31,6 +27,7 @@ import org.gcube.application.geoportal.common.model.document.identification.Iden
|
||||||
import org.gcube.application.geoportal.common.model.document.relationships.Relationship;
|
import org.gcube.application.geoportal.common.model.document.relationships.Relationship;
|
||||||
import org.gcube.application.geoportal.common.model.document.relationships.RelationshipNavigationObject;
|
import org.gcube.application.geoportal.common.model.document.relationships.RelationshipNavigationObject;
|
||||||
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
||||||
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.HandlerDeclaration;
|
||||||
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
||||||
import org.gcube.application.geoportal.common.rest.Projects;
|
import org.gcube.application.geoportal.common.rest.Projects;
|
||||||
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
||||||
|
@ -47,14 +44,22 @@ import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.GeoportalConfigurationID;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.GroupedLayersDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.ConfiguredLayerDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.CrossFilteringLayerDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.LayerIDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDILayer;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GeoServerPlatformInfoDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.IdentificationReferencesTYPE;
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.IdentificationReferencesTYPE;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_CONFIGURATION_TYPE;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||||
|
@ -70,6 +75,7 @@ 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.gis.WMSUrlValidator;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.GeoportalServiceIdentityProxy;
|
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.GeoportalServiceIdentityProxy;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.util.ContextRequest;
|
import org.gcube.portlets.user.geoportaldataviewer.server.util.ContextRequest;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.server.util.HTTPRequestUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.util.TemporalComparatorUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.server.util.TemporalComparatorUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
|
||||||
|
@ -120,19 +126,41 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
gif, png, jpeg, jpg, bmp, tif, tiff, svg, avif, webp
|
gif, png, jpeg, jpg, bmp, tif, tiff, svg, avif, webp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Enum CENTROID_LAYER_INDEX_FLAG.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* May 25, 2023
|
||||||
|
*/
|
||||||
public static enum CENTROID_LAYER_INDEX_FLAG {
|
public static enum CENTROID_LAYER_INDEX_FLAG {
|
||||||
PUBLIC("public"), PRIVATE("internal");
|
PUBLIC("public"), PRIVATE("internal");
|
||||||
|
|
||||||
String id;
|
String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new centroid layer index flag.
|
||||||
|
*
|
||||||
|
* @param id the id
|
||||||
|
*/
|
||||||
CENTROID_LAYER_INDEX_FLAG(String id) {
|
CENTROID_LAYER_INDEX_FLAG(String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the id.
|
||||||
|
*
|
||||||
|
* @return the id
|
||||||
|
*/
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To string.
|
||||||
|
*
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
@ -468,12 +496,14 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
try {
|
try {
|
||||||
LOG.debug("Checking configuration for collection " + u.getId());
|
LOG.debug("Checking configuration for collection " + u.getId());
|
||||||
|
|
||||||
|
SessionUtil.addCollectionToSession(getThreadLocalRequest(), u);
|
||||||
|
|
||||||
Projects<Project> p = projects(u.getId()).build();
|
Projects<Project> p = projects(u.getId()).build();
|
||||||
|
|
||||||
UseCaseDescriptorDV ucd = ConvertToDataValueObjectModel.toUseCaseDescriptorDV(u, null);
|
UseCaseDescriptorDV ucdDV = ConvertToDataValueObjectModel.toUseCaseDescriptorDV(u, null);
|
||||||
Configuration ucdConfig = p.getConfiguration();
|
Configuration ucdConfig = p.getConfiguration();
|
||||||
GCubeCollection coll = new GCubeCollection();
|
GCubeCollection coll = new GCubeCollection();
|
||||||
coll.setUcd(ucd);
|
coll.setUcd(ucdDV);
|
||||||
|
|
||||||
// TODO TO Check index flag should be in configuration or evaluated according to
|
// TODO TO Check index flag should be in configuration or evaluated according to
|
||||||
// user credentials
|
// user credentials
|
||||||
|
@ -532,11 +562,123 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
}.execute().getResult();
|
}.execute().getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the avaiable custom grouped layers for UCD.
|
||||||
|
*
|
||||||
|
* @param theHandler the the handler
|
||||||
|
* @return the avaiable custom grouped layers for UCD
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<String, List<GroupedLayersDV<? extends LayerIDV>>> getAvaiableCustomGroupedLayersForUCD(
|
||||||
|
GEOPORTAL_DATA_HANDLER theHandler) {
|
||||||
|
LOG.debug("getAvaiableCustomGroupedLayersForUCD called");
|
||||||
|
|
||||||
|
Map<String, List<GroupedLayersDV<? extends LayerIDV>>> mapProfileIDCustomGroupedLayers = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
// Reading UCDs Collections from the session
|
||||||
|
Map<String, UseCaseDescriptor> ucdCollections = SessionUtil.getAvailableCollections(getThreadLocalRequest());
|
||||||
|
LOG.debug("ucdCollections in session are: " + ucdCollections.size());
|
||||||
|
|
||||||
|
for (String profileId : ucdCollections.keySet()) {
|
||||||
|
|
||||||
|
UseCaseDescriptor u = ucdCollections.get(profileId);
|
||||||
|
|
||||||
|
// Loading geoportal_grouped_overlay_layers if exists
|
||||||
|
List<HandlerDeclaration> handlers = u.getHandlersByType(theHandler.getType());
|
||||||
|
|
||||||
|
GEOPORTAL_CONFIGURATION_TYPE configurationType = null;
|
||||||
|
switch (theHandler) {
|
||||||
|
case geoportal_grouped_overlay_layers:
|
||||||
|
configurationType = GEOPORTAL_CONFIGURATION_TYPE.grouped_overlay_layers;
|
||||||
|
break;
|
||||||
|
case geoportal_grouped_cross_filtering:
|
||||||
|
configurationType = GEOPORTAL_CONFIGURATION_TYPE.grouped_cross_filtering_layers;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (configurationType != null && handlers != null && handlers.size() > 0) {
|
||||||
|
// Loading Handler gcube_profiles
|
||||||
|
HandlerDeclaration handler = handlers.get(0);
|
||||||
|
List<GroupedLayersDV<? extends LayerIDV>> listGroupedCustomLayers = (List<GroupedLayersDV<? extends LayerIDV>>) getGroupedLayers(
|
||||||
|
u, handler, configurationType);
|
||||||
|
LOG.debug("listGroupedCustomLayers for type '{}' are: {}", configurationType, listGroupedCustomLayers);
|
||||||
|
mapProfileIDCustomGroupedLayers.put(profileId, listGroupedCustomLayers);
|
||||||
|
} else {
|
||||||
|
LOG.info("No handler '{}' found into UCD {}, continue...", theHandler, u.getId());
|
||||||
|
mapProfileIDCustomGroupedLayers.put(profileId, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG.debug("mapProfileIDCustomGroupedLayers returned: " + mapProfileIDCustomGroupedLayers);
|
||||||
|
LOG.info("mapProfileIDCustomGroupedLayers returned are: " + mapProfileIDCustomGroupedLayers.size());
|
||||||
|
return mapProfileIDCustomGroupedLayers;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// public Map<String, List<GroupedLayersDV>> getAvaiableCrossFilteringLayers() {
|
||||||
|
//
|
||||||
|
// Map<String, List<GroupedLayersDV>> mapProfileIDOvelayLayers = new LinkedHashMap<>();
|
||||||
|
//
|
||||||
|
// // Reading UCDs Collections from the session
|
||||||
|
// Map<String, UseCaseDescriptor> ucdCollections = SessionUtil.getAvailableCollections(getThreadLocalRequest());
|
||||||
|
//
|
||||||
|
// for (String profileId : ucdCollections.keySet()) {
|
||||||
|
//
|
||||||
|
// UseCaseDescriptor u = ucdCollections.get(profileId);
|
||||||
|
//
|
||||||
|
// // Loading geoportal_grouped_overlay_layers if exists
|
||||||
|
// GEOPORTAL_DATA_HANDLER theHandler = GEOPORTAL_DATA_HANDLER.geoportal_grouped_cross_filtering;
|
||||||
|
// List<HandlerDeclaration> handlers = u.getHandlersByType(theHandler.getType());
|
||||||
|
//
|
||||||
|
// if (handlers != null && handlers.size() > 0) {
|
||||||
|
// // Loading Handler gcube_profiles
|
||||||
|
// HandlerDeclaration handler = handlers.get(0);
|
||||||
|
// List<GroupedLayersDV> listGroupedCustomLayers = null;
|
||||||
|
// try {
|
||||||
|
//
|
||||||
|
// HandlerDeclarationDV handlerDV = ConvertToDataValueObjectModel.toHandlerDeclarationDV(handler, u,
|
||||||
|
// GEOPORTAL_CONFIGURATION_TYPE.grouped_overlay_layers);
|
||||||
|
//
|
||||||
|
// if (handler != null) {
|
||||||
|
// ConfigurationDV<?> config = handlerDV.getConfiguration();
|
||||||
|
// switch (config.getConfigurationType()) {
|
||||||
|
// case grouped_overlay_layers:
|
||||||
|
// listGroupedCustomLayers = (List<GroupedLayersDV>) config.getConfiguration();
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// LOG.error("Error on loading {} config for ucd Id {}. Returning null",
|
||||||
|
// GEOPORTAL_CONFIGURATION_TYPE.grouped_overlay_layers, u.getId());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// mapProfileIDOvelayLayers.put(profileId, listGroupedCustomLayers);
|
||||||
|
// } else {
|
||||||
|
// LOG.warn("No handler " + theHandler + "found into UCD " + u.getId() + ", continue...");
|
||||||
|
// mapProfileIDOvelayLayers.put(profileId, null);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return mapProfileIDOvelayLayers;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the layer index.
|
||||||
|
*
|
||||||
|
* @param ucdConfig the ucd config
|
||||||
|
* @param flag the flag
|
||||||
|
* @return the layer index
|
||||||
|
*/
|
||||||
private IndexLayerDV getLayerIndex(Configuration ucdConfig, CENTROID_LAYER_INDEX_FLAG flag) {
|
private IndexLayerDV getLayerIndex(Configuration ucdConfig, CENTROID_LAYER_INDEX_FLAG flag) {
|
||||||
|
|
||||||
for (Index index : ucdConfig.getIndexes()) {
|
for (Index index : ucdConfig.getIndexes()) {
|
||||||
try {
|
try {
|
||||||
IndexLayerDV toAdd = ConvertToDataValueObjectModel.convert(index);
|
IndexLayerDV toAdd = ConvertToDataValueObjectModel.convert(index);
|
||||||
|
toAdd = removeGSWorkspaceFromWMSPathOfOGCLinks(toAdd);
|
||||||
LOG.trace("Discovered index: " + toAdd);
|
LOG.trace("Discovered index: " + toAdd);
|
||||||
if (toAdd.getFlag().compareToIgnoreCase(flag.getId()) == 0) {
|
if (toAdd.getFlag().compareToIgnoreCase(flag.getId()) == 0) {
|
||||||
LOG.debug("Layer index found for flag: " + flag + ", returning");
|
LOG.debug("Layer index found for flag: " + flag + ", returning");
|
||||||
|
@ -552,6 +694,69 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the GS workspace from WMS path of OGC links.
|
||||||
|
*
|
||||||
|
* @param index the index
|
||||||
|
* @return the index layer DV
|
||||||
|
*/
|
||||||
|
private IndexLayerDV removeGSWorkspaceFromWMSPathOfOGCLinks(IndexLayerDV index) {
|
||||||
|
LOG.info("removeGSWorkspaceFromWMSPathOfOGCLinks called");
|
||||||
|
GCubeSDILayer indexLayer = index.getLayer();
|
||||||
|
HashMap<String, String> ogcLinks = indexLayer.getOgcLinks();
|
||||||
|
String wmsLink = ogcLinks.get("wms");
|
||||||
|
LOG.info("wms link is {}", wmsLink);
|
||||||
|
int lastCharOfthePath = wmsLink.indexOf("?");
|
||||||
|
String wmsPath = wmsLink.substring(0, lastCharOfthePath);
|
||||||
|
for (GeoServerPlatformInfoDV geoserver : indexLayer.getPlatformInfos()) {
|
||||||
|
// removing "workspace/" from the wms path
|
||||||
|
if (wmsPath.contains(geoserver.getWorkspace())) {
|
||||||
|
wmsPath = wmsPath.replace(geoserver.getWorkspace() + "/", "");
|
||||||
|
LOG.debug("purged wmsPath from the 'workspace' is {}", wmsPath);
|
||||||
|
wmsLink = wmsPath + wmsLink.substring(lastCharOfthePath, wmsLink.length());
|
||||||
|
ogcLinks.put("wms", wmsLink);
|
||||||
|
LOG.info("wms link without {} is {}", geoserver.getWorkspace(), wmsLink);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return index;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the grouped layers.
|
||||||
|
*
|
||||||
|
* @param ucd the ucd
|
||||||
|
* @param handler the handler
|
||||||
|
* @param type the type
|
||||||
|
* @return the grouped layers
|
||||||
|
*/
|
||||||
|
private List<? extends GeoportalConfigurationID> getGroupedLayers(UseCaseDescriptor ucd, HandlerDeclaration handler,
|
||||||
|
GEOPORTAL_CONFIGURATION_TYPE type) {
|
||||||
|
|
||||||
|
List<? extends GeoportalConfigurationID> listGroupedCustomLayers = null;
|
||||||
|
try {
|
||||||
|
|
||||||
|
HandlerDeclarationDV handlerDV = ConvertToDataValueObjectModel.toHandlerDeclarationDV(handler, ucd, type);
|
||||||
|
|
||||||
|
if (handler != null) {
|
||||||
|
ConfigurationDV<?> config = handlerDV.getConfiguration();
|
||||||
|
switch (config.getConfigurationType()) {
|
||||||
|
case grouped_overlay_layers:
|
||||||
|
listGroupedCustomLayers = (List<GroupedLayersDV<ConfiguredLayerDV>>) config.getConfiguration();
|
||||||
|
break;
|
||||||
|
case grouped_cross_filtering_layers:
|
||||||
|
listGroupedCustomLayers = (List<GroupedLayersDV<CrossFilteringLayerDV>>) config.getConfiguration();
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.error("Error on loading {} config for ucd Id {}. Returning null", type, ucd.getId());
|
||||||
|
}
|
||||||
|
return listGroupedCustomLayers;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the config list of fields for searching.
|
* Gets the config list of fields for searching.
|
||||||
*
|
*
|
||||||
|
@ -1617,6 +1822,22 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the HTTP response for URL.
|
||||||
|
*
|
||||||
|
* @param url the url
|
||||||
|
* @return the HTTP response for URL
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getHTTPResponseForURL(String url) {
|
||||||
|
LOG.info("getHTTPResponseForURL called");
|
||||||
|
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("getHTTPResponseForURL for URL {} ", url);
|
||||||
|
}
|
||||||
|
return HTTPRequestUtil.getResponse(url);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the WFS response.
|
* Gets the WFS response.
|
||||||
*
|
*
|
||||||
|
@ -1638,39 +1859,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
}
|
}
|
||||||
|
|
||||||
String url = getWFSRequest(layerItem, mapSrsName, mapBBOX, maxFeatures, outputFormat);
|
String url = getWFSRequest(layerItem, mapSrsName, mapBBOX, maxFeatures, outputFormat);
|
||||||
StringBuffer response = new StringBuffer();
|
return HTTPRequestUtil.getResponse(url);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4,6 +4,7 @@ import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||||
import org.gcube.application.geoportalcommon.util.URLParserUtil;
|
import org.gcube.application.geoportalcommon.util.URLParserUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.gis.MapServerRecognize.SERVERTYPE;
|
import org.gcube.portlets.user.geoportaldataviewer.server.gis.MapServerRecognize.SERVERTYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.WFSGetFeature;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,10 @@ import org.gcube.spatial.data.geoutility.wms.WmsUrlValidator;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class GisViewerWMSUrlValidator.
|
* The Class GisViewerWMSUrlValidator.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Jan 28, 2016
|
||||||
* Jan 28, 2016
|
|
||||||
*/
|
*/
|
||||||
public class WMSUrlValidator {
|
public class WMSUrlValidator {
|
||||||
|
|
||||||
|
@ -35,57 +33,56 @@ public class WMSUrlValidator {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(WMSUrlValidator.class);
|
private static final Logger LOG = LoggerFactory.getLogger(WMSUrlValidator.class);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new WMS url validator.
|
* Instantiates a new WMS url validator.
|
||||||
*
|
*
|
||||||
* @param wmsRequest the wms request
|
* @param wmsRequest the wms request
|
||||||
* @param inputLayerName the input layer name
|
* @param inputLayerName the input layer name
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public WMSUrlValidator(String wmsRequest, String inputLayerName) throws Exception{
|
public WMSUrlValidator(String wmsRequest, String inputLayerName) throws Exception {
|
||||||
LOG.debug("WMSURLValidator wmsRequest: "+wmsRequest);
|
LOG.debug("WMSURLValidator wmsRequest: " + wmsRequest);
|
||||||
LOG.debug("WMSURLValidator layerName: "+inputLayerName);
|
LOG.debug("WMSURLValidator layerName: " + inputLayerName);
|
||||||
|
|
||||||
|
if (wmsRequest == null || wmsRequest.isEmpty())
|
||||||
if(wmsRequest==null || wmsRequest.isEmpty())
|
|
||||||
throw new Exception("WMS request is null or empty");
|
throw new Exception("WMS request is null or empty");
|
||||||
|
|
||||||
this.wmsRequestURI = wmsRequest.trim();
|
this.wmsRequestURI = wmsRequest.trim();
|
||||||
boolean isOwsService = GeoWmsServiceUtility.isOWSSerice(this.wmsRequestURI);
|
boolean isOwsService = GeoWmsServiceUtility.isOWSSerice(this.wmsRequestURI);
|
||||||
WebMapServerHost webMapServerHost;
|
WebMapServerHost webMapServerHost;
|
||||||
|
|
||||||
//IS WMS?
|
// IS WMS?
|
||||||
if(GeoWmsServiceUtility.isWMSService(wmsRequestURI)){
|
if (GeoWmsServiceUtility.isWMSService(wmsRequestURI)) {
|
||||||
LOG.trace("found "+GeoWmsServiceUtility.SERVICE_WMS+" in wms request: "+wmsRequestURI);
|
LOG.trace("found " + GeoWmsServiceUtility.SERVICE_WMS + " in wms request: " + wmsRequestURI);
|
||||||
webMapServerHost = getWebMapServerHost(wmsRequestURI);
|
webMapServerHost = getWebMapServerHost(wmsRequestURI);
|
||||||
}else
|
} else
|
||||||
throw new Exception("WMS service not found for layer: "+inputLayerName);
|
throw new Exception("WMS service not found for layer: " + inputLayerName);
|
||||||
|
|
||||||
//VALIDATION WMS
|
// VALIDATION WMS
|
||||||
String baseWmsService = webMapServerHost.getHost();
|
String baseWmsService = webMapServerHost.getHost();
|
||||||
//IS OWS OR WMS?
|
// IS OWS OR WMS?
|
||||||
this.wmsServiceHost = appendWmsServiceToBaseUrl(wmsRequest.substring(0, wmsRequest.indexOf("?")),isOwsService);
|
this.wmsServiceHost = appendWmsServiceToBaseUrl(wmsRequest.substring(0, wmsRequest.indexOf("?")), isOwsService);
|
||||||
this.layerName = inputLayerName;
|
this.layerName = inputLayerName;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//VALIDATE WMS SERVICE FOR WEB MAP SERVER
|
// VALIDATE WMS SERVICE FOR WEB MAP SERVER
|
||||||
if(!HttpRequestUtil.urlExists(this.wmsServiceHost, true)){
|
if (!HttpRequestUtil.urlExists(this.wmsServiceHost, true)) {
|
||||||
LOG.info("baseWmsServiceUrl: "+wmsServiceHost +" is not a geoserver, setting as input base wms server: "+baseWmsService);
|
LOG.info("baseWmsServiceUrl: " + wmsServiceHost
|
||||||
|
+ " is not a geoserver, setting as input base wms server: " + baseWmsService);
|
||||||
this.wmsServiceHost = baseWmsService;
|
this.wmsServiceHost = baseWmsService;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("error on validating geoserver wms service: "+e);
|
LOG.error("error on validating geoserver wms service: " + e);
|
||||||
LOG.info("setting baseWmsService as input base wms server: "+baseWmsService);
|
LOG.info("setting baseWmsService as input base wms server: " + baseWmsService);
|
||||||
this.wmsServiceHost = baseWmsService;
|
this.wmsServiceHost = baseWmsService;
|
||||||
}
|
}
|
||||||
|
|
||||||
//VALIDATION FOR THREDDS - FIND LAYER NAME INTO WMS PATH
|
// VALIDATION FOR THREDDS - FIND LAYER NAME INTO WMS PATH
|
||||||
if(this.layerName==null || this.layerName.isEmpty()){
|
if (this.layerName == null || this.layerName.isEmpty()) {
|
||||||
|
|
||||||
this.layerName = WmsUrlValidator.getValueOfParameter(WmsParameters.LAYERS, wmsRequest);
|
this.layerName = WmsUrlValidator.getValueOfParameter(WmsParameters.LAYERS, wmsRequest);
|
||||||
if(this.layerName==null || this.layerName.isEmpty())
|
if (this.layerName == null || this.layerName.isEmpty())
|
||||||
throw new Exception("Layer name is null or empty");
|
throw new Exception("Layer name is null or empty");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -93,42 +90,42 @@ public class WMSUrlValidator {
|
||||||
parametersValue.put(WmsParameters.LAYERS.getParameter(), this.layerName);
|
parametersValue.put(WmsParameters.LAYERS.getParameter(), this.layerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append wms service to base url.
|
* Append wms service to base url.
|
||||||
*
|
*
|
||||||
* @param url the url
|
* @param url the url
|
||||||
* @param isOwsServer the is ows server
|
* @param isOwsServer the is ows server
|
||||||
* @return the string
|
* @return the string
|
||||||
*/
|
*/
|
||||||
public String appendWmsServiceToBaseUrl(String url, boolean isOwsServer){
|
public String appendWmsServiceToBaseUrl(String url, boolean isOwsServer) {
|
||||||
|
|
||||||
if(url.contains("/"+WMS) || url.contains("/"+OWS))
|
if (url.contains("/" + WMS) || url.contains("/" + OWS))
|
||||||
return url;
|
return url;
|
||||||
|
|
||||||
if(url.lastIndexOf("/") != url.length()){
|
if (url.lastIndexOf("/") != url.length()) {
|
||||||
url+="/";
|
url += "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isOwsServer)
|
if (isOwsServer)
|
||||||
return url+=OWS;
|
return url += OWS;
|
||||||
else
|
else
|
||||||
return url+=WMS;
|
return url += WMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: getFullWmsUrlRequest
|
* Method: getFullWmsUrlRequest Create a correct wms url request Returns:
|
||||||
* Create a correct wms url request
|
|
||||||
* Returns:
|
|
||||||
* {String}.
|
* {String}.
|
||||||
*
|
*
|
||||||
* @param returnEmptyParameter if true the wms url returned contains also wms parameter with empty value, none otherwise.
|
* @param returnEmptyParameter if true the wms url returned contains also
|
||||||
* and mandatory wms parameters that does not found are filled with empty values
|
* wms parameter with empty value, none
|
||||||
|
* otherwise. and mandatory wms parameters
|
||||||
|
* that does not found are filled with empty
|
||||||
|
* values
|
||||||
* @param fillEmptyParameterAsDefault the fill empty parameter as default
|
* @param fillEmptyParameterAsDefault the fill empty parameter as default
|
||||||
* @return a correct wms url request in formatted string like this:
|
* @return a correct wms url request in formatted string like this:
|
||||||
* "wmsserver?key1=value1&key2=value2&key3=value3"
|
* "wmsserver?key1=value1&key2=value2&key3=value3"
|
||||||
*/
|
*/
|
||||||
public String parseWMSRequest(boolean returnEmptyParameter, boolean fillEmptyParameterAsDefault){
|
public String parseWMSRequest(boolean returnEmptyParameter, boolean fillEmptyParameterAsDefault) {
|
||||||
|
|
||||||
urlValidator = new org.gcube.spatial.data.geoutility.wms.WmsUrlValidator(wmsRequestURI);
|
urlValidator = new org.gcube.spatial.data.geoutility.wms.WmsUrlValidator(wmsRequestURI);
|
||||||
String fullWmsUrlBuilded;
|
String fullWmsUrlBuilded;
|
||||||
|
@ -138,98 +135,100 @@ public class WMSUrlValidator {
|
||||||
parametersValue.putAll(urlValidator.getMapWmsParameters());
|
parametersValue.putAll(urlValidator.getMapWmsParameters());
|
||||||
|
|
||||||
String ln = parametersValue.get(WmsParameters.LAYERS.name());
|
String ln = parametersValue.get(WmsParameters.LAYERS.name());
|
||||||
LOG.debug("Comparing layer name from Wms request: "+ln +", with OnLineResource layerName: "+this.layerName);
|
LOG.debug("Comparing layer name from Wms request: " + ln + ", with OnLineResource layerName: "
|
||||||
if(ln==null || ln.isEmpty() || ln.compareTo(this.layerName)!=0){
|
+ this.layerName);
|
||||||
LOG.info("Layer name into wms request is different to OnLineResource layers name, replacing layer name: "+this.layerName);
|
if (ln == null || ln.isEmpty() || ln.compareTo(this.layerName) != 0) {
|
||||||
|
LOG.info(
|
||||||
|
"Layer name into wms request is different to OnLineResource layers name, replacing layer name: "
|
||||||
|
+ this.layerName);
|
||||||
parametersValue.put(WmsParameters.LAYERS.getParameter(), this.layerName);
|
parametersValue.put(WmsParameters.LAYERS.getParameter(), this.layerName);
|
||||||
urlValidator.getMapWmsParameters().put(org.gcube.spatial.data.geoutility.bean.WmsParameters.LAYERS.getParameter(), this.layerName);
|
urlValidator.getMapWmsParameters().put(
|
||||||
fullWmsUrlBuilded = org.gcube.spatial.data.geoutility.wms.WmsUrlValidator.setValueOfParameter(org.gcube.spatial.data.geoutility.bean.WmsParameters.LAYERS, fullWmsUrlBuilded, this.layerName, true);
|
org.gcube.spatial.data.geoutility.bean.WmsParameters.LAYERS.getParameter(), this.layerName);
|
||||||
|
fullWmsUrlBuilded = org.gcube.spatial.data.geoutility.wms.WmsUrlValidator.setValueOfParameter(
|
||||||
|
org.gcube.spatial.data.geoutility.bean.WmsParameters.LAYERS, fullWmsUrlBuilded, this.layerName,
|
||||||
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// logger.trace("parametersValue: "+parametersValue);
|
// logger.trace("parametersValue: "+parametersValue);
|
||||||
mapWmsNoStandardParams = new HashMap<String, String>(urlValidator.getMapWmsNoStandardParams().size());
|
mapWmsNoStandardParams = new HashMap<String, String>(urlValidator.getMapWmsNoStandardParams().size());
|
||||||
mapWmsNoStandardParams.putAll(urlValidator.getMapWmsNoStandardParams());
|
mapWmsNoStandardParams.putAll(urlValidator.getMapWmsNoStandardParams());
|
||||||
wmsNoStandardParameters = urlValidator.getWmsNoStandardParameters();
|
wmsNoStandardParameters = urlValidator.getWmsNoStandardParameters();
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
LOG.error("An error occurred during wms uri build, returning uri: " + wmsRequestURI, e);
|
||||||
LOG.error("An error occurred during wms uri build, returning uri: "+wmsRequestURI, e);
|
|
||||||
fullWmsUrlBuilded = wmsRequestURI;
|
fullWmsUrlBuilded = wmsRequestURI;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.trace("GisViewerWMSUrlValidator parseWMSRequest returning full wms url: "+fullWmsUrlBuilded);
|
LOG.trace("GisViewerWMSUrlValidator parseWMSRequest returning full wms url: " + fullWmsUrlBuilded);
|
||||||
return fullWmsUrlBuilded;
|
return fullWmsUrlBuilded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the web map server host.
|
* Gets the web map server host.
|
||||||
*
|
*
|
||||||
* @param wmsRequest the wms request
|
* @param wmsRequest the wms request
|
||||||
* @return the web map server host, (geoserver URI or the wmsRequest substring from start to index of '?' char (if exists))
|
* @return the web map server host, (geoserver URI or the wmsRequest substring
|
||||||
|
* from start to index of '?' char (if exists))
|
||||||
*/
|
*/
|
||||||
public WebMapServerHost getWebMapServerHost(String wmsRequest){
|
public WebMapServerHost getWebMapServerHost(String wmsRequest) {
|
||||||
|
|
||||||
WebMapServerHost webMapServerHost = new WebMapServerHost();
|
WebMapServerHost webMapServerHost = new WebMapServerHost();
|
||||||
|
|
||||||
if(wmsRequest==null)
|
if (wmsRequest == null)
|
||||||
return webMapServerHost; //uri is empty
|
return webMapServerHost; // uri is empty
|
||||||
|
|
||||||
|
|
||||||
int end = wmsRequest.toLowerCase().lastIndexOf("?");
|
int end = wmsRequest.toLowerCase().lastIndexOf("?");
|
||||||
|
|
||||||
if(end==-1){
|
if (end == -1) {
|
||||||
LOG.trace("char ? not found in geoserver uri, return: "+wmsRequest);
|
LOG.trace("char ? not found in geoserver uri, return: " + wmsRequest);
|
||||||
return webMapServerHost; //uri is empty
|
return webMapServerHost; // uri is empty
|
||||||
}
|
}
|
||||||
|
|
||||||
String webMapServerBaseURL = wmsRequest.substring(0, wmsRequest.toLowerCase().lastIndexOf("?"));
|
String webMapServerBaseURL = wmsRequest.substring(0, wmsRequest.toLowerCase().lastIndexOf("?"));
|
||||||
int index = webMapServerBaseURL.lastIndexOf(GEOSERVER);
|
int index = webMapServerBaseURL.lastIndexOf(GEOSERVER);
|
||||||
|
|
||||||
if(index>-1){ //FOUND the string GEOSERVER into URL
|
if (index > -1) { // FOUND the string GEOSERVER into URL
|
||||||
LOG.trace("found geoserver string: "+GEOSERVER+" in "+webMapServerBaseURL);
|
LOG.trace("found geoserver string: " + GEOSERVER + " in " + webMapServerBaseURL);
|
||||||
|
|
||||||
//THERE IS SCOPE?
|
// THERE IS SCOPE?
|
||||||
int lastSlash = webMapServerBaseURL.lastIndexOf("/");
|
int lastSlash = webMapServerBaseURL.lastIndexOf("/");
|
||||||
int includeGeoserverString = index+GEOSERVER.length();
|
int includeGeoserverString = index + GEOSERVER.length();
|
||||||
int endUrl = lastSlash>includeGeoserverString?lastSlash:includeGeoserverString;
|
int endUrl = lastSlash > includeGeoserverString ? lastSlash : includeGeoserverString;
|
||||||
LOG.trace("indexs - lastSlash: ["+lastSlash+"], includeGeoserverString: ["+includeGeoserverString+"], endUrl: ["+endUrl+"]");
|
LOG.trace("indexs - lastSlash: [" + lastSlash + "], includeGeoserverString: [" + includeGeoserverString
|
||||||
int startScope = includeGeoserverString+1<endUrl?includeGeoserverString+1:endUrl; //INCLUDE SLASH
|
+ "], endUrl: [" + endUrl + "]");
|
||||||
|
int startScope = includeGeoserverString + 1 < endUrl ? includeGeoserverString + 1 : endUrl; // INCLUDE SLASH
|
||||||
String scope = webMapServerBaseURL.substring(startScope, endUrl);
|
String scope = webMapServerBaseURL.substring(startScope, endUrl);
|
||||||
LOG.trace("geoserver url include scope: "+webMapServerBaseURL.substring(includeGeoserverString, endUrl));
|
LOG.trace("geoserver url include scope: " + webMapServerBaseURL.substring(includeGeoserverString, endUrl));
|
||||||
webMapServerHost.setHost(webMapServerBaseURL.substring(0, endUrl));
|
webMapServerHost.setHost(webMapServerBaseURL.substring(0, endUrl));
|
||||||
webMapServerHost.setScope(scope);
|
webMapServerHost.setScope(scope);
|
||||||
|
|
||||||
return webMapServerHost;
|
return webMapServerHost;
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
LOG.trace("the string 'geoserver' not found in "+webMapServerBaseURL);
|
LOG.trace("the string 'geoserver' not found in " + webMapServerBaseURL);
|
||||||
// GET LAST INDEX OF '/' AND CONCATENATE GEOSERVER
|
// GET LAST INDEX OF '/' AND CONCATENATE GEOSERVER
|
||||||
String urlConn = webMapServerBaseURL.substring(0, webMapServerBaseURL.lastIndexOf("/"))+GEOSERVER;
|
String urlConn = webMapServerBaseURL.substring(0, webMapServerBaseURL.lastIndexOf("/")) + GEOSERVER;
|
||||||
LOG.trace("tentative concatenating string 'geoserver' at http url "+urlConn);
|
LOG.trace("tentative concatenating string 'geoserver' at http url " + urlConn);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if(HttpRequestUtil.urlExists(urlConn, false)){
|
if (HttpRequestUtil.urlExists(urlConn, false)) {
|
||||||
LOG.trace("url: "+urlConn+" - open a connection, return "+urlConn);
|
LOG.trace("url: " + urlConn + " - open a connection, return " + urlConn);
|
||||||
webMapServerHost.setHost(urlConn);
|
webMapServerHost.setHost(urlConn);
|
||||||
return webMapServerHost;
|
return webMapServerHost;
|
||||||
}
|
} else
|
||||||
else
|
LOG.trace("url: " + urlConn + " - not open a connection");
|
||||||
LOG.trace("url: "+urlConn+" - not open a connection");
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("url connection is wrong at :"+urlConn);
|
LOG.error("url connection is wrong at :" + urlConn);
|
||||||
}
|
}
|
||||||
|
|
||||||
String uriWithoutParameters = wmsRequest.substring(0, end);
|
String uriWithoutParameters = wmsRequest.substring(0, end);
|
||||||
LOG.trace("url connection, returned: "+uriWithoutParameters);
|
LOG.trace("url connection, returned: " + uriWithoutParameters);
|
||||||
webMapServerHost.setHost(uriWithoutParameters);
|
webMapServerHost.setHost(uriWithoutParameters);
|
||||||
return webMapServerHost;
|
return webMapServerHost;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the wms service host.
|
* Gets the wms service host.
|
||||||
*
|
*
|
||||||
|
@ -260,42 +259,40 @@ public class WMSUrlValidator {
|
||||||
return wmsNoStandardParameters;
|
return wmsNoStandardParameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value of parsed wms parameter.
|
* Gets the value of parsed wms parameter.
|
||||||
*
|
*
|
||||||
* @param parameter the parameter
|
* @param parameter the parameter
|
||||||
* @return the value of parsed wms parameter parsed from wms request.
|
* @return the value of parsed wms parameter parsed from wms request.
|
||||||
*/
|
*/
|
||||||
public String getValueOfParsedWMSParameter(WmsParameters parameter){
|
public String getValueOfParsedWMSParameter(WmsParameters parameter) {
|
||||||
|
|
||||||
return parametersValue.get(parameter.getParameter());
|
return parametersValue.get(parameter.getParameter());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value of parameter.
|
* Gets the value of parameter.
|
||||||
*
|
*
|
||||||
* @param wmsParam the wms param
|
* @param wmsParam the wms param
|
||||||
* @param wmsUrlParameters the wms url parameters
|
* @param wmsUrlParameters the wms url parameters
|
||||||
* @return the value of parameter
|
* @return the value of parameter
|
||||||
*/
|
*/
|
||||||
public static String getValueOfParameter(WmsParameters wmsParam, String wmsUrlParameters){
|
public static String getValueOfParameter(WmsParameters wmsParam, String wmsUrlParameters) {
|
||||||
|
|
||||||
return WmsUrlValidator.getValueOfParameter(wmsParam, wmsUrlParameters);
|
return WmsUrlValidator.getValueOfParameter(wmsParam, wmsUrlParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value of parameter.
|
* Sets the value of parameter.
|
||||||
*
|
*
|
||||||
* @param wmsParam the wms param
|
* @param wmsParam the wms param
|
||||||
* @param wmsUrlParameters the wms url parameters
|
* @param wmsUrlParameters the wms url parameters
|
||||||
* @param newValue the new value
|
* @param newValue the new value
|
||||||
* @param addIfNotExists the add if not exists
|
* @param addIfNotExists the add if not exists
|
||||||
* @return the string
|
* @return the string
|
||||||
*/
|
*/
|
||||||
public static String setValueOfParameter(WmsParameters wmsParam, String wmsUrlParameters, String newValue, boolean addIfNotExists){
|
public static String setValueOfParameter(WmsParameters wmsParam, String wmsUrlParameters, String newValue,
|
||||||
|
boolean addIfNotExists) {
|
||||||
|
|
||||||
return WmsUrlValidator.setValueOfParameter(wmsParam, wmsUrlParameters, newValue, addIfNotExists);
|
return WmsUrlValidator.setValueOfParameter(wmsParam, wmsUrlParameters, newValue, addIfNotExists);
|
||||||
}
|
}
|
||||||
|
@ -309,8 +306,6 @@ public class WMSUrlValidator {
|
||||||
return layerName;
|
return layerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the styles as list.
|
* Gets the styles as list.
|
||||||
*
|
*
|
||||||
|
@ -321,18 +316,17 @@ public class WMSUrlValidator {
|
||||||
List<String> listStyles = new ArrayList<String>();
|
List<String> listStyles = new ArrayList<String>();
|
||||||
String styles = getValueOfParsedWMSParameter(WmsParameters.STYLES);
|
String styles = getValueOfParsedWMSParameter(WmsParameters.STYLES);
|
||||||
|
|
||||||
if(styles!=null && !styles.isEmpty()){
|
if (styles != null && !styles.isEmpty()) {
|
||||||
|
|
||||||
String[] arrayStyle = styles.split(",");
|
String[] arrayStyle = styles.split(",");
|
||||||
for (String style : arrayStyle) {
|
for (String style : arrayStyle) {
|
||||||
if(style!=null && !style.isEmpty())
|
if (style != null && !style.isEmpty())
|
||||||
listStyles.add(style);
|
listStyles.add(style);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return listStyles;
|
return listStyles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the map wms no standard params.
|
* Gets the map wms no standard params.
|
||||||
*
|
*
|
||||||
|
@ -342,63 +336,4 @@ public class WMSUrlValidator {
|
||||||
return mapWmsNoStandardParams;
|
return mapWmsNoStandardParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The main method.
|
|
||||||
*
|
|
||||||
* @param args the arguments
|
|
||||||
*/
|
|
||||||
public static void main(String[] args) {
|
|
||||||
|
|
||||||
// String baseGeoserverUrl = "http://repoigg.services.iit.cnr.it:8080/geoserver/IGG/ows";
|
|
||||||
// String baseGeoserverUrl = "http://www.fao.org/figis/geoserver/species";
|
|
||||||
// String fullPath = "http://www.fao.org/figis/geoserver/species?SERVICE=WMS&BBOX=-176.0,-90.0,180.0,90&styles=Species_prob, puppa&layers=layerName&FORMAT=image/gif";
|
|
||||||
// String fullPath = "http://repoigg.services.iit.cnr.it:8080/geoserver/IGG/ows?service=wms&version=1.1.0&request=GetMap&layers==IGG:area_temp_1000&width=676&height=330&srs=EPSG:4326&crs=EPSG:4326&format=application/openlayers&bbox=-85.5,-180.0,90.0,180.0";
|
|
||||||
// String baseGeoserverUrl = "http://thredds-d-d4s.d4science.org/thredds/wms/public/netcdf/test20.nc";
|
|
||||||
// String fullPath = "http://thredds-d-d4s.d4science.org/thredds/wms/public/netcdf/test20.nc?service=wms&version=1.3.0&request=GetMap&layers=analyzed_field&bbox=-85.0,-180.0,85.0,180.0&styles=&width=640&height=480&srs=EPSG:4326&CRS=EPSG:4326&format=image/png&COLORSCALERANGE=auto";
|
|
||||||
// WmsUrlValidator validator = new WmsUrlValidator(baseGeoserverUrl, fullPath , "", false);
|
|
||||||
// logger.trace("base wms service url: "+validator.getBaseWmsServiceUrl());
|
|
||||||
// logger.trace("layer name: "+validator.getLayerName());
|
|
||||||
// logger.trace("full wms url: "+validator.getFullWmsUrlRequest(false, true));
|
|
||||||
// logger.trace("style: "+validator.getStyles());
|
|
||||||
// logger.trace("not standard parameter: "+validator.getWmsNotStandardParameters());
|
|
||||||
// String[] arrayStyle = validator.getStyles().split(",");
|
|
||||||
//
|
|
||||||
// if(arrayStyle!=null && arrayStyle.length>0){
|
|
||||||
//
|
|
||||||
// for (String style : arrayStyle) {
|
|
||||||
// if(style!=null && !style.isEmpty())
|
|
||||||
//
|
|
||||||
// System.out.println("Style: "+style.trim());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// String fullPath = "http://thredds-d-d4s.d4science.org/thredds/wms/public/netcdf/test20.nc?service=wms&version=1.3.0&request=GetMap&layers=analyzed_field&bbox=-85.0,-180.0,85.0,180.0&styles=&width=640&height=480&srs=EPSG:4326&CRS=EPSG:4326&format=image/png&COLORSCALERANGE=auto";
|
|
||||||
//
|
|
||||||
// WmsGeoExplorerUrlValidator validator = new WmsGeoExplorerUrlValidator("http://thredds-d-d4s.d4science.org/thredds/wms/public/netcdf/test20.nc", fullPath , "", false);
|
|
||||||
// validator.getFullWmsUrlRequest(false,true);
|
|
||||||
//
|
|
||||||
// System.out.println(validator.getWmsNoStandardParameters());
|
|
||||||
// System.out.println(validator.getMapWmsNoStandardParams());
|
|
||||||
|
|
||||||
// fullPath = WmsUrlValidator.setValueOfParameter(WmsParameters.STYLES, fullPath, "123", true);
|
|
||||||
//
|
|
||||||
|
|
||||||
// MapPreviewGenerator map = new MapPreviewGenerator();
|
|
||||||
// fullPath = map.buildWmsRequestMapPreview(fullPath, "-85.0,-180.0,85.0,180.0");
|
|
||||||
// System.out.println(fullPath);
|
|
||||||
|
|
||||||
String wmsRequest = "http://geoserver-dev.d4science-ii.research-infrastructures.eu/geoserver/wms?CRS=EPSG:4326&BBOX=-85.5,-180.0,90.0,180.0&VERSION=1.1.0&FORMAT=application/openlayers&SERVICE=wms&HEIGHT=330&LAYERS=aquamaps:lsoleasolea20130716162322254cest&REQUEST=GetMap&STYLES=Species_prob&SRS=EPSG:4326&WIDTH=676";
|
|
||||||
// String wmsRequest = "http://thredds-d-d4s.d4science.org/thredds/wms/public/netcdf/test20.nc?service=wms&version=1.3.0&request=GetMap&layers=analyzed_field&styles=&width=640&height=480&srs=EPSG:4326&CRS=EPSG:4326&format=image/png&COLORSCALERANGE=auto&bbox=-85.0,-180.0,85.0,180.0";
|
|
||||||
WmsUrlValidator wms;
|
|
||||||
try {
|
|
||||||
wms = new WmsUrlValidator(wmsRequest);
|
|
||||||
System.out.println("Returned wms: "+wms.toString());
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.server.util;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.server.GeoportalDataViewerServiceImpl;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class HTTPRequestUtil.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Jun 5, 2023
|
||||||
|
*/
|
||||||
|
public class HTTPRequestUtil {
|
||||||
|
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(GeoportalDataViewerServiceImpl.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the response.
|
||||||
|
*
|
||||||
|
* @param url the url
|
||||||
|
* @return the response
|
||||||
|
*/
|
||||||
|
public static String getResponse(String url) {
|
||||||
|
if (url == null || url.isEmpty())
|
||||||
|
return null;
|
||||||
|
|
||||||
|
StringBuffer response = new StringBuffer();
|
||||||
|
String theResponseString = "";
|
||||||
|
HttpURLConnection con = null;
|
||||||
|
LOG.debug("Calling 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("getResponse is empty? " + theResponseString.isEmpty());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.error("Error on performing the request to URL: " + url, e);
|
||||||
|
} finally {
|
||||||
|
|
||||||
|
}
|
||||||
|
LOG.debug("returning response with size: " + theResponseString.length());
|
||||||
|
return theResponseString;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -3,7 +3,9 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.server.util;
|
package org.gcube.portlets.user.geoportaldataviewer.server.util;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
@ -51,6 +53,8 @@ public class SessionUtil {
|
||||||
|
|
||||||
private static final String COUNT_DOCS_FOR_PROFILE_ID = "GNA_DATAVIEWER_COUNT_DOCS_FOR_PROFILE_ID";
|
private static final String COUNT_DOCS_FOR_PROFILE_ID = "GNA_DATAVIEWER_COUNT_DOCS_FOR_PROFILE_ID";
|
||||||
|
|
||||||
|
private static final String UCD_COLLECTIONS_SESSION = "THE_UCD_COLLECTIONS";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is into portal.
|
* Checks if is into portal.
|
||||||
*
|
*
|
||||||
|
@ -136,7 +140,7 @@ public class SessionUtil {
|
||||||
|
|
||||||
if (token != null) {
|
if (token != null) {
|
||||||
LOG.debug("Returning token " + token.substring(1, 10) + "_MASKED_TOKEN_");
|
LOG.debug("Returning token " + token.substring(1, 10) + "_MASKED_TOKEN_");
|
||||||
if(setInThread)
|
if (setInThread)
|
||||||
SecurityTokenProvider.instance.set(token);
|
SecurityTokenProvider.instance.set(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,33 +277,6 @@ public class SessionUtil {
|
||||||
HttpSession session = httpServletRequest.getSession();
|
HttpSession session = httpServletRequest.getSession();
|
||||||
List<Concessione> listOfConcessioni = (List<Concessione>) session.getAttribute(LIST_OF_CONCESSIONI);
|
List<Concessione> listOfConcessioni = (List<Concessione>) session.getAttribute(LIST_OF_CONCESSIONI);
|
||||||
throw new Exception("getListConcessioni must be revisited!!!!");
|
throw new Exception("getListConcessioni must be revisited!!!!");
|
||||||
/*
|
|
||||||
* // setting null to force reloading from service if (reloadFromService)
|
|
||||||
* listOfConcessioni = null;
|
|
||||||
*
|
|
||||||
* if (listOfConcessioni == null) { listOfConcessioni = new
|
|
||||||
* ArrayList<Concessione>();
|
|
||||||
* LOG.info("Loading list of concessione from client mongo");
|
|
||||||
* SessionUtil.getCurrentContext(httpServletRequest, true); MongoServiceCommon
|
|
||||||
* serviceUtil = new MongoServiceCommon(); MongoConcessioni clientMongo =
|
|
||||||
* serviceUtil.getInstanceMongoConcessioni();
|
|
||||||
*
|
|
||||||
* Iterator<Concessione> concessioni = clientMongo.getList(); if (concessioni !=
|
|
||||||
* null) { while (concessioni.hasNext()) { Concessione concessione =
|
|
||||||
* (Concessione) concessioni.next(); listOfConcessioni.add(concessione);
|
|
||||||
*
|
|
||||||
* } } // LOG.debug("Got list of concessioni from client mongo: " +
|
|
||||||
* listOfConcessioni); session.setAttribute(LIST_OF_CONCESSIONI,
|
|
||||||
* listOfConcessioni);
|
|
||||||
* LOG.info("Saved in session list of concessioni from client mongo with size: "
|
|
||||||
* + listOfConcessioni.size());
|
|
||||||
*
|
|
||||||
* } else LOG.info("list of concessioni presents in session, using it");
|
|
||||||
*
|
|
||||||
* LOG.info("read list of concessioni with size: " + listOfConcessioni.size());
|
|
||||||
* return listOfConcessioni;
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -352,4 +329,20 @@ public class SessionUtil {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void addCollectionToSession(HttpServletRequest httpServletRequest, UseCaseDescriptor u) {
|
||||||
|
HttpSession session = httpServletRequest.getSession();
|
||||||
|
Map<String, UseCaseDescriptor> ucds = (Map<String, UseCaseDescriptor>) session
|
||||||
|
.getAttribute(UCD_COLLECTIONS_SESSION);
|
||||||
|
if (ucds == null) {
|
||||||
|
ucds = new HashMap<String, UseCaseDescriptor>();
|
||||||
|
}
|
||||||
|
ucds.put(u.getId(), u);
|
||||||
|
session.setAttribute(UCD_COLLECTIONS_SESSION, ucds);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<String, UseCaseDescriptor> getAvailableCollections(HttpServletRequest httpServletRequest) {
|
||||||
|
HttpSession session = httpServletRequest.getSession();
|
||||||
|
return (Map<String, UseCaseDescriptor>) session.getAttribute(UCD_COLLECTIONS_SESSION);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class URLUtil.
|
* The Class URLParserUtil.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.shared.gis;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Data
|
||||||
|
public class DisplayCategory implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
String title;
|
||||||
|
String description;
|
||||||
|
|
||||||
|
}
|
|
@ -23,7 +23,6 @@ import com.google.gwt.core.client.GWT;
|
||||||
*/
|
*/
|
||||||
public class LayerItem implements Serializable, Cloneable {
|
public class LayerItem implements Serializable, Cloneable {
|
||||||
|
|
||||||
|
|
||||||
/** The Constant serialVersionUID. */
|
/** The Constant serialVersionUID. */
|
||||||
private static final long serialVersionUID = 1664082688635256899L;
|
private static final long serialVersionUID = 1664082688635256899L;
|
||||||
|
|
||||||
|
@ -102,9 +101,6 @@ public class LayerItem implements Serializable, Cloneable {
|
||||||
/** The server wms request. */
|
/** The server wms request. */
|
||||||
public String wmsLink;
|
public String wmsLink;
|
||||||
|
|
||||||
/** The cql filter available. */
|
|
||||||
private boolean cqlFilterAvailable = false;
|
|
||||||
|
|
||||||
/** The uuid. */
|
/** The uuid. */
|
||||||
private String UUID;
|
private String UUID;
|
||||||
|
|
||||||
|
@ -756,16 +752,7 @@ public class LayerItem implements Serializable, Cloneable {
|
||||||
* @return true, if is cql filter available
|
* @return true, if is cql filter available
|
||||||
*/
|
*/
|
||||||
public boolean isCqlFilterAvailable() {
|
public boolean isCqlFilterAvailable() {
|
||||||
return cqlFilterAvailable;
|
return (cqlFilter != null) && (!cqlFilter.isEmpty());
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the cql filter available.
|
|
||||||
*
|
|
||||||
* @param cqlFilterAvailable the new cql filter available
|
|
||||||
*/
|
|
||||||
public void setCqlFilterAvailable(boolean cqlFilterAvailable) {
|
|
||||||
this.cqlFilterAvailable = cqlFilterAvailable;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -894,11 +881,6 @@ public class LayerItem implements Serializable, Cloneable {
|
||||||
return maxResolution;
|
return maxResolution;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* To string.
|
|
||||||
*
|
|
||||||
* @return the string
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
@ -952,8 +934,6 @@ public class LayerItem implements Serializable, Cloneable {
|
||||||
builder.append(isNcWms);
|
builder.append(isNcWms);
|
||||||
builder.append(", wmsLink=");
|
builder.append(", wmsLink=");
|
||||||
builder.append(wmsLink);
|
builder.append(wmsLink);
|
||||||
builder.append(", cqlFilterAvailable=");
|
|
||||||
builder.append(cqlFilterAvailable);
|
|
||||||
builder.append(", UUID=");
|
builder.append(", UUID=");
|
||||||
builder.append(UUID);
|
builder.append(UUID);
|
||||||
builder.append(", zAxis=");
|
builder.append(", zAxis=");
|
||||||
|
@ -968,7 +948,6 @@ public class LayerItem implements Serializable, Cloneable {
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To layer item.
|
* To layer item.
|
||||||
*
|
*
|
||||||
|
@ -992,7 +971,6 @@ public class LayerItem implements Serializable, Cloneable {
|
||||||
* @return the layer item
|
* @return the layer item
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// TODO Constructor from IndexLayerDV, GCUBESDILAeryDV or direct info
|
// TODO Constructor from IndexLayerDV, GCUBESDILAeryDV or direct info
|
||||||
private LayerItem toLayerItem(LayerType layerType, String layerTitle, String layerName, String layerURL,
|
private LayerItem toLayerItem(LayerType layerType, String layerTitle, String layerName, String layerURL,
|
||||||
String mapServerHost, boolean isExternal, boolean isBase, boolean displayInLayerSwitcher,
|
String mapServerHost, boolean isExternal, boolean isBase, boolean displayInLayerSwitcher,
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.shared.gis;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class OverlayWMSLayer {
|
||||||
|
|
||||||
|
private String title;
|
||||||
|
private String name;
|
||||||
|
private String wmsServiceBaseURL;
|
||||||
|
private boolean display;
|
||||||
|
private Map<String, String> mapProperties;
|
||||||
|
|
||||||
|
}
|
|
@ -1,6 +1,4 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.server.gis;
|
package org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Enum WfsParameters.
|
* The Enum WfsParameters.
|
||||||
|
@ -20,6 +18,7 @@ public enum WFSGetFeature {
|
||||||
WIDTH("WIDTH","676"),
|
WIDTH("WIDTH","676"),
|
||||||
HEIGHT("HEIGHT","230"),
|
HEIGHT("HEIGHT","230"),
|
||||||
SRSNAME("srsName","EPSG:4326"),
|
SRSNAME("srsName","EPSG:4326"),
|
||||||
|
PROPERTYNAME("propertyName", ""),
|
||||||
// CRS("CRS","EPSG:4326"), //WMS 1.3.0 COMPLIANT
|
// CRS("CRS","EPSG:4326"), //WMS 1.3.0 COMPLIANT
|
||||||
OUTPUTFORMAT("OUTPUTFORMAT","json"),
|
OUTPUTFORMAT("OUTPUTFORMAT","json"),
|
||||||
MAXFEATURES("MAXFEATURES","");
|
MAXFEATURES("MAXFEATURES","");
|
|
@ -26,7 +26,7 @@ body {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
|
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border-radius: 2px;
|
border-radius: 10px;
|
||||||
border: 1px solid #cccccc;
|
border: 1px solid #cccccc;
|
||||||
bottom: 12px;
|
bottom: 12px;
|
||||||
left: -50px;
|
left: -50px;
|
||||||
|
@ -158,6 +158,11 @@ body {
|
||||||
padding-top: 1px;
|
padding-top: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.preset-location ul a {
|
||||||
|
margin: 5px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.my-control-group .controls {
|
.my-control-group .controls {
|
||||||
margin-left: 70px !important;
|
margin-left: 70px !important;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +216,7 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.inner-toolbar .btn-group {
|
.inner-toolbar .btn-group {
|
||||||
margin-left: 0px !important;
|
margin-left: 2px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.inner-toolbar .btn-link {
|
.inner-toolbar .btn-link {
|
||||||
|
@ -426,6 +431,7 @@ body {
|
||||||
.map-layers-radio label {
|
.map-layers-radio label {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -825,3 +831,69 @@ RESPONSIVE
|
||||||
.layer-style-panel-table-legend table td {
|
.layer-style-panel-table-legend table td {
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* CUSTOM OVERLAY UI */
|
||||||
|
.overlay-panel-style {
|
||||||
|
padding-left: 10px;
|
||||||
|
padding-right: 10px;
|
||||||
|
max-width: 350px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overlay-panel-style-description {
|
||||||
|
border: none !important;
|
||||||
|
white-space: pre-line;
|
||||||
|
padding: 10px 0px;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overlay-panel-style > div {
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* FILTER PANEL UI */
|
||||||
|
.filter-panel-style {
|
||||||
|
padding-left: 10px;
|
||||||
|
padding-right: 10px;
|
||||||
|
max-width: 350px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-panel-style .control-group {
|
||||||
|
margin-bottom: 5px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-panel-style select {
|
||||||
|
min-width: 310px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-panel-style-description {
|
||||||
|
border: none !important;
|
||||||
|
white-space: pre-line;
|
||||||
|
padding: 10px 0px;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-panel-style > div {
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-panel-style a {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-panel-style label {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
/* END CUSTOM OVERLAY UI */
|
||||||
|
|
||||||
|
.opacity-09 {
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.gcube.spatial.data.geoutility.GeoWmsServiceUtility;
|
||||||
|
import org.gcube.spatial.data.geoutility.bean.WmsParameters;
|
||||||
|
import org.gcube.spatial.data.geoutility.util.HttpRequestUtil;
|
||||||
|
import org.gcube.spatial.data.geoutility.wms.WmsUrlValidator;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class WMSUrlValidatorTest.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Jun 1, 2023
|
||||||
|
*/
|
||||||
|
public class WMSUrlValidatorTest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The main method.
|
||||||
|
*
|
||||||
|
* @param args the arguments
|
||||||
|
*/
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// String baseGeoserverUrl = "http://repoigg.services.iit.cnr.it:8080/geoserver/IGG/ows";
|
||||||
|
// String baseGeoserverUrl = "http://www.fao.org/figis/geoserver/species";
|
||||||
|
// String fullPath = "http://www.fao.org/figis/geoserver/species?SERVICE=WMS&BBOX=-176.0,-90.0,180.0,90&styles=Species_prob, puppa&layers=layerName&FORMAT=image/gif";
|
||||||
|
// String fullPath = "http://repoigg.services.iit.cnr.it:8080/geoserver/IGG/ows?service=wms&version=1.1.0&request=GetMap&layers==IGG:area_temp_1000&width=676&height=330&srs=EPSG:4326&crs=EPSG:4326&format=application/openlayers&bbox=-85.5,-180.0,90.0,180.0";
|
||||||
|
// String baseGeoserverUrl = "http://thredds-d-d4s.d4science.org/thredds/wms/public/netcdf/test20.nc";
|
||||||
|
// String fullPath = "http://thredds-d-d4s.d4science.org/thredds/wms/public/netcdf/test20.nc?service=wms&version=1.3.0&request=GetMap&layers=analyzed_field&bbox=-85.0,-180.0,85.0,180.0&styles=&width=640&height=480&srs=EPSG:4326&CRS=EPSG:4326&format=image/png&COLORSCALERANGE=auto";
|
||||||
|
// WmsUrlValidator validator = new WmsUrlValidator(baseGeoserverUrl, fullPath , "", false);
|
||||||
|
// logger.trace("base wms service url: "+validator.getBaseWmsServiceUrl());
|
||||||
|
// logger.trace("layer name: "+validator.getLayerName());
|
||||||
|
// logger.trace("full wms url: "+validator.getFullWmsUrlRequest(false, true));
|
||||||
|
// logger.trace("style: "+validator.getStyles());
|
||||||
|
// logger.trace("not standard parameter: "+validator.getWmsNotStandardParameters());
|
||||||
|
// String[] arrayStyle = validator.getStyles().split(",");
|
||||||
|
//
|
||||||
|
// if(arrayStyle!=null && arrayStyle.length>0){
|
||||||
|
//
|
||||||
|
// for (String style : arrayStyle) {
|
||||||
|
// if(style!=null && !style.isEmpty())
|
||||||
|
//
|
||||||
|
// System.out.println("Style: "+style.trim());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// String fullPath = "http://thredds-d-d4s.d4science.org/thredds/wms/public/netcdf/test20.nc?service=wms&version=1.3.0&request=GetMap&layers=analyzed_field&bbox=-85.0,-180.0,85.0,180.0&styles=&width=640&height=480&srs=EPSG:4326&CRS=EPSG:4326&format=image/png&COLORSCALERANGE=auto";
|
||||||
|
//
|
||||||
|
// WmsGeoExplorerUrlValidator validator = new WmsGeoExplorerUrlValidator("http://thredds-d-d4s.d4science.org/thredds/wms/public/netcdf/test20.nc", fullPath , "", false);
|
||||||
|
// validator.getFullWmsUrlRequest(false,true);
|
||||||
|
//
|
||||||
|
// System.out.println(validator.getWmsNoStandardParameters());
|
||||||
|
// System.out.println(validator.getMapWmsNoStandardParams());
|
||||||
|
|
||||||
|
// fullPath = WmsUrlValidator.setValueOfParameter(WmsParameters.STYLES, fullPath, "123", true);
|
||||||
|
//
|
||||||
|
|
||||||
|
// MapPreviewGenerator map = new MapPreviewGenerator();
|
||||||
|
// fullPath = map.buildWmsRequestMapPreview(fullPath, "-85.0,-180.0,85.0,180.0");
|
||||||
|
// System.out.println(fullPath);
|
||||||
|
|
||||||
|
String wmsRequest = "http://geoserver-dev.d4science-ii.research-infrastructures.eu/geoserver/wms?CRS=EPSG:4326&BBOX=-85.5,-180.0,90.0,180.0&VERSION=1.1.0&FORMAT=application/openlayers&SERVICE=wms&HEIGHT=330&LAYERS=aquamaps:lsoleasolea20130716162322254cest&REQUEST=GetMap&STYLES=Species_prob&SRS=EPSG:4326&WIDTH=676";
|
||||||
|
// String wmsRequest = "http://thredds-d-d4s.d4science.org/thredds/wms/public/netcdf/test20.nc?service=wms&version=1.3.0&request=GetMap&layers=analyzed_field&styles=&width=640&height=480&srs=EPSG:4326&CRS=EPSG:4326&format=image/png&COLORSCALERANGE=auto&bbox=-85.0,-180.0,85.0,180.0";
|
||||||
|
WmsUrlValidator wms;
|
||||||
|
try {
|
||||||
|
wms = new WmsUrlValidator(wmsRequest);
|
||||||
|
System.out.println("Returned wms: "+wms.toString());
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue