Compare commits
108 Commits
14
.classpath
14
.classpath
|
@ -1,16 +1,11 @@
|
||||||
<?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.2.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/geoportal-data-viewer-app-3.7.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.2.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="test" value="true"/>
|
<attribute name="test" value="true"/>
|
||||||
|
@ -35,5 +30,10 @@
|
||||||
<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.2.0-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-3.7.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="output" path="target/geoportal-data-viewer-app-3.7.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.2.0-SNAPSHOT
|
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-3.7.0-SNAPSHOT
|
||||||
warSrcDir=src/main/webapp
|
warSrcDir=src/main/webapp
|
||||||
warSrcDirIsOutput=false
|
warSrcDirIsOutput=false
|
||||||
|
|
|
@ -46,7 +46,193 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-module deploy-name="geoportal-data-viewer-app-3.2.0-SNAPSHOT">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<wb-module deploy-name="geoportal-data-viewer-app-3.7.0-SNAPSHOT">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,6 +307,99 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -169,6 +448,99 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -217,6 +589,99 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -260,33 +725,111 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<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="metadata-profile-form-builder-widget-2.2.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/metadata-profile-form-builder-widget/metadata-profile-form-builder-widget">
|
||||||
|
<dependency-type>uses</dependency-type>
|
||||||
|
</dependent-module>
|
||||||
|
<dependent-module archiveName="geoportal-client-1.2.2-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-client/geoportal-client">
|
||||||
|
<dependency-type>uses</dependency-type>
|
||||||
|
</dependent-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -361,6 +904,99 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -409,6 +1045,99 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -457,6 +1186,99 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
42
CHANGELOG.md
42
CHANGELOG.md
|
@ -4,6 +4,48 @@
|
||||||
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.7.0]
|
||||||
|
|
||||||
|
- Provided the "Export as PDF" facility [#26026]
|
||||||
|
- Integrated the GeoportalExporter as service [#27321]
|
||||||
|
- Passed to the new KC-client [#27398]
|
||||||
|
|
||||||
|
## [v3.6.0]
|
||||||
|
|
||||||
|
- GUI optimization [#25461]
|
||||||
|
- Using the latest libraries version: gwt-ol.v8.4.1 (with openlayers.v6.6.1) and gwt.v2.10
|
||||||
|
- Showing basic statistics (i.e. "X project published") via 'countByPhase' method [#25598]
|
||||||
|
|
||||||
|
## [v3.5.0]
|
||||||
|
|
||||||
|
- Supported the cross-filtering [#25074]
|
||||||
|
- Supported the grouped custom layers [#25110]
|
||||||
|
- Managed the (WMS) Layer Style facility [#25066]
|
||||||
|
|
||||||
|
## [v3.4.0] - 2023-05-11
|
||||||
|
|
||||||
|
- Integrated the geoportal-data-mapper component [#24978]
|
||||||
|
|
||||||
|
## [v3.3.1] - 2023-03-30
|
||||||
|
|
||||||
|
- Just including new dependencies
|
||||||
|
- Improved css
|
||||||
|
|
||||||
|
## [v3.3.0] - 2023-02-20
|
||||||
|
|
||||||
|
#### Fixes
|
||||||
|
|
||||||
|
- [#24632] Returning the public layer index if the private is missing
|
||||||
|
- [#24632] No temporal info shown if the temporal extent is missing
|
||||||
|
|
||||||
|
## [v3.2.1] - 2023-02-03
|
||||||
|
|
||||||
|
#### Fixes
|
||||||
|
|
||||||
|
- [#24432] Reverting serialization LinkedHashMap<String, String> to LinkedHashMap<String, Object>.
|
||||||
|
- Improved Alert UX in case of broken shared link
|
||||||
|
- Moved to gwt 2.9.0
|
||||||
|
|
||||||
## [v3.2.0] - 2023-01-31
|
## [v3.2.0] - 2023-01-31
|
||||||
|
|
||||||
#### Enhancements
|
#### Enhancements
|
||||||
|
|
36
README.md
36
README.md
|
@ -1,6 +1,6 @@
|
||||||
# GeoPortal Data Viewer App
|
# GeoPortal Data Viewer App
|
||||||
|
|
||||||
The GeoPortal Data Viewer App is an application to access, discovery and navigate the Geoportal projects/documents by a Web-Map Interface
|
The "Geoportal data-viewer" technology allows users to access and search for spatio-temporal documents through a web GIS which allows them to: (i) navigate and select the projects published in the system by "geographical map" (spatial dimension) , (ii) navigate and select the relationships between projects (evolution of over time) via "timeline" (temporal dimension), (iii) view metadata and resources (images, layers, etc. .) of documents via the "project view detail", (iv) export a view of the map with the layer of interest or add the layers of a project to the main map, (v) manage the order and overlapping of the layers, (vi) execute spatial queries on the layers and view the results, (vii) search through metadata or temporal dimension queries for the projects of interest, (vii) apply spatial filters for cross-layer.
|
||||||
|
|
||||||
## Built With
|
## Built With
|
||||||
|
|
||||||
|
@ -9,16 +9,44 @@ The GeoPortal Data Viewer App is an application to access, discovery and navigat
|
||||||
|
|
||||||
**Uses**
|
**Uses**
|
||||||
|
|
||||||
* GWT v.2.9.0. [GWT](http://www.gwtproject.org) is licensed under [Apache License 2.0](http://www.gwtproject.org/terms.html)
|
* GWT v.2.10.0. [GWT](http://www.gwtproject.org) is licensed under [Apache License 2.0](http://www.gwtproject.org/terms.html)
|
||||||
* GWT-Bootstrap v.2.3.2.0. [GWT-Bootstrap](https://github.com/gwtbootstrap) is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
* GWT-Bootstrap v.2.3.2.0. [GWT-Bootstrap](https://github.com/gwtbootstrap) is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
||||||
* GWT-OpenLayers 3+ v.8.1.0-gwt2_9. [GWT-OL3](https://github.com/TDesjardins/gwt-ol)
|
* GWT-OpenLayers 3+ v.8.5.0-gwt2_9. [GWT-OL3](https://github.com/TDesjardins/gwt-ol)
|
||||||
* OpenLayers v.6.x [OpenLayers](https://openlayers.org/) is licensed under [BSD 2-Clause "Simplified"](https://github.com/openlayers/openlayers/blob/main/LICENSE.md)
|
* OpenLayers v.6.x [OpenLayers](https://openlayers.org/) is licensed under [BSD 2-Clause "Simplified"](https://github.com/openlayers/openlayers/blob/main/LICENSE.md)
|
||||||
|
* NanoGallery v2.X [NanoGallery2](https://github.com/nanostudio-org/nanogallery2) is licensed under [GNU General Public License "gplv3"](https://www.gnu.org/licenses/gpl-3.0.html)
|
||||||
* Vis-Timeline v7.x [VisTimeline](https://github.com/visjs/vis-timeline) is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0) and MIT
|
* Vis-Timeline v7.x [VisTimeline](https://github.com/visjs/vis-timeline) is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0) and MIT
|
||||||
* Handlebarsjs v4.x [Handlebarsjs](https://handlebarsjs.com/) is licensed under MIT
|
* Handlebarsjs v4.x [Handlebarsjs](https://handlebarsjs.com/) is licensed under MIT
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
<img src="https://gcube.wiki.gcube-system.org/images_gcube/8/82/GeoPortalDataViewer_Architecture.png" style="max-width:800px;" alt="GeoPortal Data-Viewer - Architecture" />
|
||||||
|
|
||||||
|
## Showcase
|
||||||
|
|
||||||
|
##### D4GNA instance of Geoportal D4Science
|
||||||
|
|
||||||
|
see at [Dataset per il Geoportale Nazionale per l’Archeologia (D4GNA)](https://gna.d4science.org/)
|
||||||
|
|
||||||
|
**D4GNA Viewer - OSM**
|
||||||
|
|
||||||
|
<img src="https://gcube.wiki.gcube-system.org/images_gcube/0/06/D4GNA_Viewer_OSM.png" style="max-width:800px;" alt="Data_Viewer_OSM" />
|
||||||
|
|
||||||
|
**D4GNA Viewer - MapBox**
|
||||||
|
|
||||||
|
<img src="https://gcube.wiki.gcube-system.org/images_gcube/9/9c/D4GNA_Viewer_MapBox.png" style="max-width:800px;" alt="Data_Viewer_MapBox" />
|
||||||
|
|
||||||
|
**D4GNA Viewer - Discovering...**
|
||||||
|
|
||||||
|
<img src="https://gcube.wiki.gcube-system.org/images_gcube/8/85/D4GNA_ERCIM_3.png" style="max-width:800px;" alt="D4GNA_ERCIM_3" />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<img src="https://gcube.wiki.gcube-system.org/images_gcube/9/9c/D4GNA_ERCIM_2.png" style="max-width:800px;" alt="D4GNA_ERCIM_2" />
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
N/A
|
Geoportal Service Documentation is available at [gCube CMS Suite](https://geoportal.d4science.org/geoportal-service/docs/index.html)
|
||||||
|
|
||||||
|
User Guide (DRAFT ITA) is available at [Guida al DataViewer D4GNA (DRAFT-ITA)](https://gcube.wiki.gcube-system.org/images_gcube/b/b3/D4science_Guida_al_DataViewer_D4GNA_bozza.pdf)
|
||||||
|
|
||||||
## Change log
|
## Change log
|
||||||
|
|
||||||
|
|
76
pom.xml
76
pom.xml
|
@ -7,14 +7,14 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>maven-parent</artifactId>
|
<artifactId>maven-parent</artifactId>
|
||||||
<groupId>org.gcube.tools</groupId>
|
<groupId>org.gcube.tools</groupId>
|
||||||
<version>1.1.0</version>
|
<version>1.2.0</version>
|
||||||
<relativePath />
|
<relativePath />
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<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.2.0</version>
|
<version>3.7.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>
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
||||||
<gwt.version>2.10.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>
|
||||||
|
<gwt.ol.version>8.5.0</gwt.ol.version>
|
||||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||||
<!-- GWT 2.9 support 8, 9 and 11 -->
|
<!-- GWT 2.9 support 8, 9 and 11 -->
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
@ -55,13 +56,41 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.distribution</groupId>
|
<groupId>org.gcube.distribution</groupId>
|
||||||
<artifactId>maven-portal-bom</artifactId>
|
<artifactId>maven-portal-bom</artifactId>
|
||||||
<version>3.6.4</version>
|
<version>${maven.portal.bom}</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<!-- PROD profile -->
|
||||||
|
<profile>
|
||||||
|
<id>geoportal-data-viewer-app-release-profile</id>
|
||||||
|
<activation>
|
||||||
|
<property>
|
||||||
|
<name>Release</name>
|
||||||
|
</property>
|
||||||
|
</activation>
|
||||||
|
<properties>
|
||||||
|
<maven.portal.bom>3.7.0</maven.portal.bom>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
<!-- DEV profile -->
|
||||||
|
<profile>
|
||||||
|
<id>geoportal-data-viewer-app-snapshot-profile</id>
|
||||||
|
<activation>
|
||||||
|
<property>
|
||||||
|
<name>!Release</name>
|
||||||
|
</property>
|
||||||
|
</activation>
|
||||||
|
<properties>
|
||||||
|
<maven.portal.bom>3.8.0-SNAPSHOT</maven.portal.bom>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -102,7 +131,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.tdesjardins</groupId>
|
<groupId>com.github.tdesjardins</groupId>
|
||||||
<artifactId>gwt-ol3</artifactId>
|
<artifactId>gwt-ol3</artifactId>
|
||||||
<version>8.1.0-gwt2_9</version>
|
<version>${gwt.ol.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.gwtbootstrap</groupId>
|
<groupId>com.github.gwtbootstrap</groupId>
|
||||||
|
@ -135,13 +164,6 @@
|
||||||
<artifactId>usermanagement-core</artifactId>
|
<artifactId>usermanagement-core</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
|
||||||
<artifactId>gcube-url-shortener</artifactId>
|
|
||||||
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- REQUIRED FOR JDK_11 -->
|
<!-- REQUIRED FOR JDK_11 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
|
@ -150,34 +172,16 @@
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- END -->
|
<!-- END -->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portlets.widgets</groupId>
|
<groupId>org.gcube.application</groupId>
|
||||||
<artifactId>metadata-profile-form-builder-widget</artifactId>
|
<artifactId>geoportal-data-mapper</artifactId>
|
||||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
<version>[1.0.1, 2.0.0-SNAPSHOT)</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<!-- does not remove these exclusions, there are conflict with jackson
|
|
||||||
2.7 used by geo-json dependency -->
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-core</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-databind</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>de.grundid.opendatalab</groupId>
|
|
||||||
<artifactId>geojson-jackson</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.application</groupId>
|
<groupId>org.gcube.application</groupId>
|
||||||
<artifactId>geoportal-data-common</artifactId>
|
<artifactId>geoportal-data-common</artifactId>
|
||||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
<version>[2.0.0, 3.0.0-SNAPSHOT)</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -199,30 +203,26 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.common</groupId>
|
<groupId>org.gcube.common</groupId>
|
||||||
<artifactId>keycloak-client</artifactId>
|
<artifactId>keycloak-client</artifactId>
|
||||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
<version>[2.0.0, 3.0.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.liferay.portal</groupId>
|
<groupId>com.liferay.portal</groupId>
|
||||||
<artifactId>portal-service</artifactId>
|
<artifactId>portal-service</artifactId>
|
||||||
<!-- <version>6.2.5</version> -->
|
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.portlet</groupId>
|
<groupId>javax.portlet</groupId>
|
||||||
<artifactId>portlet-api</artifactId>
|
<artifactId>portlet-api</artifactId>
|
||||||
<!-- <version>2.0</version> -->
|
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-log4j12</artifactId>
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
<!-- <version>1.6.4</version> -->
|
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<!-- <version>1.6.4</version> -->
|
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
|
@ -17,11 +17,17 @@
|
||||||
|
|
||||||
<inherits name="com.google.gwt.json.JSON" />
|
<inherits name="com.google.gwt.json.JSON" />
|
||||||
|
|
||||||
|
<inherits
|
||||||
|
name='org.gcube.portal.clientcontext.GCubeClientContext' />
|
||||||
|
|
||||||
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
|
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
|
||||||
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
|
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
|
||||||
|
|
||||||
<!-- Other module inherits -->
|
<!-- Other module inherits -->
|
||||||
|
|
||||||
|
<servlet path="/geoportalexporterservice"
|
||||||
|
class="org.gcube.portlets.user.geoportaldataviewer.server.GeoportalExporterActionServlet" />
|
||||||
|
|
||||||
<!-- Specify the app entry point class. -->
|
<!-- Specify the app entry point class. -->
|
||||||
<entry-point
|
<entry-point
|
||||||
class='org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer' />
|
class='org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer' />
|
||||||
|
|
|
@ -5,14 +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.geojson.GeoJSON;
|
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;
|
||||||
|
@ -21,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;
|
||||||
|
@ -29,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;
|
||||||
|
@ -42,6 +52,8 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCent
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEvent.EVENT_TYPE;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEvent.EVENT_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEventHandler;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.UpdateLayerToMapEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.UpdateLayerToMapEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.CloseCollectionEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.CloseCollectionEvent;
|
||||||
|
@ -51,9 +63,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.resources.GNAImages;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap.CQL_FACILITY_ORIGIN;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GeoportalImages;
|
||||||
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;
|
||||||
|
@ -64,6 +78,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Modal;
|
||||||
import com.github.gwtbootstrap.client.ui.Popover;
|
import com.github.gwtbootstrap.client.ui.Popover;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.Placement;
|
import com.github.gwtbootstrap.client.ui.constants.Placement;
|
||||||
import com.google.gwt.core.client.EntryPoint;
|
import com.google.gwt.core.client.EntryPoint;
|
||||||
|
@ -85,12 +100,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>.
|
||||||
|
@ -103,6 +112,8 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
public static final String DIV_TIMELINE_DATA = "timeline-data";
|
public static final String DIV_TIMELINE_DATA = "timeline-data";
|
||||||
|
|
||||||
|
public static final String DIV_LAYER_VIEW = "layer-viewer";
|
||||||
|
|
||||||
public static final String APP_NOTIFIER = "app-notifier";
|
public static final String APP_NOTIFIER = "app-notifier";
|
||||||
|
|
||||||
/** The Constant APP_DIV. */
|
/** The Constant APP_DIV. */
|
||||||
|
@ -139,7 +150,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
int attempt = 0;
|
int attempt = 0;
|
||||||
|
|
||||||
private LoaderIcon loaderApp = new LoaderIcon("Loading application... please wait",
|
private LoaderIcon loaderApp = new LoaderIcon("Loading application... please wait",
|
||||||
new com.google.gwt.user.client.ui.Image(GNAImages.ICONS.spinnerEarth()));
|
new com.google.gwt.user.client.ui.Image(GeoportalImages.ICONS.spinnerEarth()));
|
||||||
|
|
||||||
private HTML attributionDiv = new HTML();
|
private HTML attributionDiv = new HTML();
|
||||||
|
|
||||||
|
@ -154,6 +165,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 +241,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 +296,8 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
mainPanel.openCollectionMenu();
|
mainPanel.openCollectionMenu();
|
||||||
|
|
||||||
|
loadConfigureduGroupedLayersForUCD();
|
||||||
|
|
||||||
GWT.log("DONE INIT LOAD");
|
GWT.log("DONE INIT LOAD");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -302,6 +318,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.
|
||||||
*
|
*
|
||||||
|
@ -330,6 +417,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
mainPanel.setPanelsHeight(height);
|
mainPanel.setPanelsHeight(height);
|
||||||
GWT.log("Set height: " + height);
|
GWT.log("Set height: " + height);
|
||||||
|
|
||||||
|
mainPanel.setPanelsWidth(Window.getClientWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -362,7 +450,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
if (!ucdIds.contains(collId)) {
|
if (!ucdIds.contains(collId)) {
|
||||||
GWT.log("!! Collection " + collId + " is not available");
|
GWT.log("!! Collection " + collId + " is not available");
|
||||||
Window.alert("Collection " + collId + " is not found.");
|
Window.alert("Collection " + collId + " not found.");
|
||||||
} else {
|
} else {
|
||||||
GCubeCollection toOpen = theConfig.getAvailableCollections().get(collId);
|
GCubeCollection toOpen = theConfig.getAvailableCollections().get(collId);
|
||||||
|
|
||||||
|
@ -449,9 +537,22 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
Window.alert(caught.getMessage());
|
// Window.alert(caught.getMessage());
|
||||||
mainPanel.hidePanelDetails();
|
mainPanel.hidePanelDetails();
|
||||||
|
|
||||||
|
Modal errorModal = new Modal(true, true);
|
||||||
|
errorModal.setCloseVisible(true);
|
||||||
|
errorModal.setTitle("Oops...");
|
||||||
|
Image geoportalError = new Image(GeoportalImages.ICONS.warningError());
|
||||||
|
FlowPanel errorPanelMsg = new FlowPanel();
|
||||||
|
errorPanelMsg.getElement().addClassName("general_warning");
|
||||||
|
errorPanelMsg.add(geoportalError);
|
||||||
|
errorPanelMsg.add(new HTML("D4S GeoPortal"));
|
||||||
|
HTML erroMessage = new HTML(
|
||||||
|
"Oops something went wrong, either the project does not exist or it has not been published yet");
|
||||||
|
errorPanelMsg.add(erroMessage);
|
||||||
|
errorModal.add(errorPanelMsg);
|
||||||
|
errorModal.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -659,6 +760,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
|
||||||
|
@ -690,8 +809,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());
|
||||||
|
@ -712,7 +831,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();
|
||||||
|
|
||||||
|
@ -737,35 +856,126 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GWT.log("New CQL Filter is: " + newCqlFilter);
|
||||||
|
|
||||||
|
// Resetting CQL Filter
|
||||||
if (layerName != null)
|
if (layerName != null)
|
||||||
layerManager.setCQLForLayerToIndexLayer(layerName, setCqlFilter);
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
applicationBus.addHandler(UpdateLayerToMapEvent.TYPE, new UpdateLayerToMapEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdateLayer(UpdateLayerToMapEvent updateLayerToMapEvent) {
|
||||||
|
|
||||||
|
if (updateLayerToMapEvent != null && updateLayerToMapEvent.getOperation() != null) {
|
||||||
|
|
||||||
|
if (updateLayerToMapEvent.getLayerType().equals(
|
||||||
|
org.gcube.portlets.user.geoportaldataviewer.client.events.UpdateLayerToMapEvent.LAYER_TYPE.INDEX)) {
|
||||||
|
|
||||||
|
switch (updateLayerToMapEvent.getOperation()) {
|
||||||
|
case STYLE:
|
||||||
|
olMapMng.getOLMap().setLayerStyleForIndex(updateLayerToMapEvent.getLayerName(),
|
||||||
|
updateLayerToMapEvent.getValue());
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -779,8 +989,9 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
//console.log("jsonObj: "+jsonObj);
|
//console.log("jsonObj: "+jsonObj);
|
||||||
return jsonObj;
|
return jsonObj;
|
||||||
}-*/;
|
}-*/;
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Handler popu closer.
|
// * Handler popup closer.
|
||||||
// *
|
// *
|
||||||
// * @param divId the div id
|
// * @param divId the div id
|
||||||
// * @param overlayId the overlay id
|
// * @param overlayId the overlay id
|
||||||
|
@ -861,7 +1072,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
* @return the general error panel
|
* @return the general error panel
|
||||||
*/
|
*/
|
||||||
private FlowPanel getGeneralErrorPanel() {
|
private FlowPanel getGeneralErrorPanel() {
|
||||||
Image geoportalError = new Image(GNAImages.ICONS.geoportaServiceError());
|
Image geoportalError = new Image(GeoportalImages.ICONS.geoportaServiceError());
|
||||||
FlowPanel errorPanelMsg = new FlowPanel();
|
FlowPanel errorPanelMsg = new FlowPanel();
|
||||||
errorPanelMsg.getElement().addClassName("general_error");
|
errorPanelMsg.getElement().addClassName("general_error");
|
||||||
errorPanelMsg.add(geoportalError);
|
errorPanelMsg.add(geoportalError);
|
||||||
|
@ -881,32 +1092,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);
|
olMapMng.getOLMap().addLayerFeaturesAsHighlight(layerItem, features, true);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayersMapParameters;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayersMapParameters;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.dom.client.Element;
|
import com.google.gwt.dom.client.Element;
|
||||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||||
|
|
||||||
|
@ -15,6 +16,17 @@ import com.google.gwt.i18n.client.DateTimeFormat;
|
||||||
*/
|
*/
|
||||||
public class GeoportalDataViewerConstants {
|
public class GeoportalDataViewerConstants {
|
||||||
|
|
||||||
|
//Geoportal_Exporter_ACTION_SERVLET
|
||||||
|
public static final String UCD_ID_PARAMETER = "ucdID";
|
||||||
|
public static final String PROIECT_ID_PARAMETER = "projectID";
|
||||||
|
public static final String CONTEXT_ID_PARAMETER = "c_id";
|
||||||
|
public static final String USER_ID_PARAMETER = "u_id";
|
||||||
|
public static final String USERNAME_PARAMETER = "usn";
|
||||||
|
public static final String GEOPORTAL_EXPORT_ACTION_SERVLET = GWT.getModuleBaseURL()
|
||||||
|
+ "geoportalexporterservice";
|
||||||
|
|
||||||
|
public static final int TABLET_WIDTH = 1601;
|
||||||
|
|
||||||
public static final String MAP_DIV = "map";
|
public static final String MAP_DIV = "map";
|
||||||
|
|
||||||
public static final String GET_WMS_PARAMETER = "wmsrequest";
|
public static final String GET_WMS_PARAMETER = "wmsrequest";
|
||||||
|
@ -26,6 +38,9 @@ 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 Double INITIAL_LAYER_OPACITY = 0.8;
|
||||||
|
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 {
|
||||||
|
@ -34,6 +49,29 @@ public class GeoportalDataViewerConstants {
|
||||||
|
|
||||||
public static final String PROJECT_ID_KEY_FEATURE = "projectid";
|
public static final String PROJECT_ID_KEY_FEATURE = "projectid";
|
||||||
|
|
||||||
|
public static enum GisToolbarFacilities {
|
||||||
|
COLLECTION("Collection", "Open the collections"), MAP("Map", "Select the base Map"),
|
||||||
|
OVERLAY("Overlay", "Add overlay layers"), SEARCH("Search", "Search in the collections"),
|
||||||
|
FILTER("Filter", "Apply spatial filtering"), LAYERS("Layers", "Layers added to Map"),
|
||||||
|
PRESET_LOCATION("Preset Location", "Center the Map to Location");
|
||||||
|
|
||||||
|
String name;
|
||||||
|
String tooltip;
|
||||||
|
|
||||||
|
GisToolbarFacilities(String name, String tooltip) {
|
||||||
|
this.name = name;
|
||||||
|
this.tooltip = tooltip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTooltip() {
|
||||||
|
return tooltip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Enum LayerType.
|
* The Enum LayerType.
|
||||||
*
|
*
|
||||||
|
@ -152,7 +190,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,15 +2,19 @@ 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.GeoportalSpatialQueryResult;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||||
|
@ -53,8 +57,8 @@ public interface GeoportalDataViewerService extends RemoteService {
|
||||||
* @return the data result
|
* @return the data result
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
List<GeoNaSpatialQueryResult> getDataResult(List<LayerObject> layerObjects, String mapSrsName, BoundsMap mapBBOX,
|
List<GeoportalSpatialQueryResult> getDataResult(List<LayerObject> layerObjects, String mapSrsName,
|
||||||
int maxWFSFeature, double zoomLevel) throws Exception;
|
BoundsMap mapBBOX, int maxWFSFeature, double zoomLevel) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the my login.
|
* Gets the my login.
|
||||||
|
@ -100,7 +104,7 @@ public interface GeoportalDataViewerService extends RemoteService {
|
||||||
* @param zoomLevel the zoom level
|
* @param zoomLevel the zoom level
|
||||||
* @return the WFS features
|
* @return the WFS features
|
||||||
*/
|
*/
|
||||||
List<GeoNaSpatialQueryResult> getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName,
|
List<GeoportalSpatialQueryResult> getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName,
|
||||||
BoundsMap selectBBOX, int maxWFSFeature, double zoomLevel);
|
BoundsMap selectBBOX, int maxWFSFeature, double zoomLevel);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -159,7 +163,7 @@ public interface GeoportalDataViewerService extends RemoteService {
|
||||||
* @param limit the limit
|
* @param limit the limit
|
||||||
* @return the entry sets document for project ID
|
* @return the entry sets document for project ID
|
||||||
*/
|
*/
|
||||||
LinkedHashMap<String, String> getEntrySetsDocumentForProjectID(String profileID, String projectID, int limit);
|
LinkedHashMap<String, Object> getEntrySetsDocumentForProjectID(String profileID, String projectID, int limit);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the relationships for timeline.
|
* Gets the relationships for timeline.
|
||||||
|
@ -206,4 +210,25 @@ 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);
|
||||||
|
|
||||||
|
Integer getCountFor(String profileID, String phase, String status);
|
||||||
|
|
||||||
|
Boolean checkExportAsPDFConfig();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,15 +2,19 @@ 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.GeoportalSpatialQueryResult;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||||
|
@ -44,7 +48,7 @@ public interface GeoportalDataViewerServiceAsync {
|
||||||
void parseWmsRequest(String wmsRequest, String layerName, AsyncCallback<GeoInformationForWMSRequest> callback);
|
void parseWmsRequest(String wmsRequest, String layerName, AsyncCallback<GeoInformationForWMSRequest> callback);
|
||||||
|
|
||||||
void getDataResult(List<LayerObject> layerObjects, String mapSrsName, BoundsMap mapBBOX, int maxWFSFeature,
|
void getDataResult(List<LayerObject> layerObjects, String mapSrsName, BoundsMap mapBBOX, int maxWFSFeature,
|
||||||
double zoomLevel, AsyncCallback<List<GeoNaSpatialQueryResult>> callback);
|
double zoomLevel, AsyncCallback<List<GeoportalSpatialQueryResult>> callback);
|
||||||
|
|
||||||
void getMyLogin(AsyncCallback<String> callback);
|
void getMyLogin(AsyncCallback<String> callback);
|
||||||
|
|
||||||
|
@ -56,7 +60,7 @@ public interface GeoportalDataViewerServiceAsync {
|
||||||
AsyncCallback<List<GCubeSDIViewerLayerDV>> asyncCallback);
|
AsyncCallback<List<GCubeSDIViewerLayerDV>> asyncCallback);
|
||||||
|
|
||||||
void getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName, BoundsMap selectBBOX, int maxWFSFeature,
|
void getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName, BoundsMap selectBBOX, int maxWFSFeature,
|
||||||
double zoomLevel, AsyncCallback<List<GeoNaSpatialQueryResult>> callback);
|
double zoomLevel, AsyncCallback<List<GeoportalSpatialQueryResult>> callback);
|
||||||
|
|
||||||
void getListBaseLayers(AsyncCallback<List<BaseMapLayer>> callback);
|
void getListBaseLayers(AsyncCallback<List<BaseMapLayer>> callback);
|
||||||
|
|
||||||
|
@ -70,7 +74,7 @@ public interface GeoportalDataViewerServiceAsync {
|
||||||
void getInitialConfiguration(AsyncCallback<ViewerConfiguration> callback);
|
void getInitialConfiguration(AsyncCallback<ViewerConfiguration> callback);
|
||||||
|
|
||||||
void getEntrySetsDocumentForProjectID(String profileID, String projectID, int limit,
|
void getEntrySetsDocumentForProjectID(String profileID, String projectID, int limit,
|
||||||
AsyncCallback<LinkedHashMap<String, String>> callback);
|
AsyncCallback<LinkedHashMap<String, Object>> callback);
|
||||||
|
|
||||||
void getRelationshipsForTimeline(String profileID, String projectID, AsyncCallback<List<String>> callback);
|
void getRelationshipsForTimeline(String profileID, String projectID, AsyncCallback<List<String>> callback);
|
||||||
|
|
||||||
|
@ -82,4 +86,13 @@ 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);
|
||||||
|
|
||||||
|
void getCountFor(String profileID, String phase, String status, AsyncCallback<Integer> callback);
|
||||||
|
|
||||||
|
void checkExportAsPDFConfig(AsyncCallback<Boolean> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.ui.ModalWindow;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoportalSpatialQueryResult;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
||||||
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.LayerObject;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||||
|
@ -94,6 +94,9 @@ import ol.geom.Geometry;
|
||||||
*/
|
*/
|
||||||
public class LayerManager {
|
public class LayerManager {
|
||||||
|
|
||||||
|
private static final String ZOOM_TO_LAYERS_LABEL = "Zoom...";
|
||||||
|
private static final String ZOOM_TO_LAYERS_TITLE = "Zoom to Layers";
|
||||||
|
|
||||||
/** The ol map. */
|
/** The ol map. */
|
||||||
private OpenLayerMap olMap;
|
private OpenLayerMap olMap;
|
||||||
|
|
||||||
|
@ -187,7 +190,7 @@ public class LayerManager {
|
||||||
|
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance().getDataResult(listLO, olMap.getProjectionCode(),
|
GeoportalDataViewerServiceAsync.Util.getInstance().getDataResult(listLO, olMap.getProjectionCode(),
|
||||||
mapBBOX, GeoportalDataViewerConstants.MAX_WFS_FEATURES, olMap.getCurrentZoomLevel(),
|
mapBBOX, GeoportalDataViewerConstants.MAX_WFS_FEATURES, olMap.getCurrentZoomLevel(),
|
||||||
new AsyncCallback<List<GeoNaSpatialQueryResult>>() {
|
new AsyncCallback<List<GeoportalSpatialQueryResult>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
@ -196,7 +199,7 @@ public class LayerManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<GeoNaSpatialQueryResult> listGeonaDataObjects) {
|
public void onSuccess(List<GeoportalSpatialQueryResult> listGeonaDataObjects) {
|
||||||
|
|
||||||
if (listGeonaDataObjects == null)
|
if (listGeonaDataObjects == null)
|
||||||
return;
|
return;
|
||||||
|
@ -218,7 +221,7 @@ public class LayerManager {
|
||||||
List<FeatureRow> theFeatures = null;
|
List<FeatureRow> theFeatures = null;
|
||||||
|
|
||||||
// TODO SWTCH FOR EARCH ITEM TYPE
|
// TODO SWTCH FOR EARCH ITEM TYPE
|
||||||
for (final GeoNaSpatialQueryResult geoNaDataObject : listGeonaDataObjects) {
|
for (final GeoportalSpatialQueryResult geoNaDataObject : listGeonaDataObjects) {
|
||||||
GWT.log("GeoNaDataObject: " + geoNaDataObject);
|
GWT.log("GeoNaDataObject: " + geoNaDataObject);
|
||||||
List<FeatureRow> features = geoNaDataObject.getFeatures();
|
List<FeatureRow> features = geoNaDataObject.getFeatures();
|
||||||
LayerItem layerItem = geoNaDataObject.getSourceLayerObject().getLayerItem();
|
LayerItem layerItem = geoNaDataObject.getSourceLayerObject().getLayerItem();
|
||||||
|
@ -512,7 +515,7 @@ public class LayerManager {
|
||||||
GWT.log("Parsed WMS Request returned: " + geoInfoWMS);
|
GWT.log("Parsed WMS Request returned: " + geoInfoWMS);
|
||||||
|
|
||||||
LayerItem layerItem = toLayerItem(featureType, layerTitle, geoInfoWMS.getLayerName(),
|
LayerItem layerItem = toLayerItem(featureType, layerTitle, geoInfoWMS.getLayerName(),
|
||||||
geoInfoWMS.getWmsRequest(), geoInfoWMS.getBaseWmsServiceHost(), true, isBase,
|
geoInfoWMS.getWmsRequest(), geoInfoWMS.getServiceEndPoint(), true, isBase,
|
||||||
displayInLayerSwitcher, (ArrayList<String>) geoInfoWMS.getStyles().getGeoStyles(),
|
displayInLayerSwitcher, (ArrayList<String>) geoInfoWMS.getStyles().getGeoStyles(),
|
||||||
geoInfoWMS.getWmsRequest(), false, geoInfoWMS.getMapWMSNoStandard(),
|
geoInfoWMS.getWmsRequest(), false, geoInfoWMS.getMapWMSNoStandard(),
|
||||||
geoInfoWMS.isNcWMS(), UUID, geoInfoWMS.getZAxis(), minResolution, maxResolution);
|
geoInfoWMS.isNcWMS(), UUID, geoInfoWMS.getZAxis(), minResolution, maxResolution);
|
||||||
|
@ -550,7 +553,7 @@ public class LayerManager {
|
||||||
theLo = lo;
|
theLo = lo;
|
||||||
mapOtherLayerObjects.put(layerNameKey, theLo);
|
mapOtherLayerObjects.put(layerNameKey, theLo);
|
||||||
GWT.log("PROJECT_LAYER mapOtherLayerObjects is: " + mapOtherLayerObjects);
|
GWT.log("PROJECT_LAYER mapOtherLayerObjects is: " + mapOtherLayerObjects);
|
||||||
olMap.addWMSDetailLayer(layerItem);
|
olMap.addWMSDetailLayer(layerItem, GeoportalDataViewerConstants.INITIAL_LAYER_OPACITY);
|
||||||
overlayLayerManager.addLayerItem(theLo);
|
overlayLayerManager.addLayerItem(theLo);
|
||||||
} else {
|
} else {
|
||||||
GWT.log("Skipping " + lo.getType() + " layer " + theLo.getLayerItem().getName()
|
GWT.log("Skipping " + lo.getType() + " layer " + theLo.getLayerItem().getName()
|
||||||
|
@ -579,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);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -708,7 +709,7 @@ public class LayerManager {
|
||||||
* @param listGeoNaDataObject the list geo na data object
|
* @param listGeoNaDataObject the list geo na data object
|
||||||
* @param queryClick the query click
|
* @param queryClick the query click
|
||||||
*/
|
*/
|
||||||
public void showPopupInfoForLayer(List<GeoNaSpatialQueryResult> listGeoNaDataObject, ExtentWrapped queryClick) {
|
public void showPopupInfoForLayer(List<GeoportalSpatialQueryResult> listGeoNaDataObject, ExtentWrapped queryClick) {
|
||||||
GWT.log("showPopupInfoForLayer called for " + listGeoNaDataObject);
|
GWT.log("showPopupInfoForLayer called for " + listGeoNaDataObject);
|
||||||
|
|
||||||
ScrollPanel scrollPanel = new ScrollPanel();
|
ScrollPanel scrollPanel = new ScrollPanel();
|
||||||
|
@ -766,7 +767,7 @@ public class LayerManager {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
String prevProjectId = "";
|
String prevProjectId = "";
|
||||||
for (GeoNaSpatialQueryResult geoNaSpatialQueryResult : listGeoNaDataObject) {
|
for (GeoportalSpatialQueryResult geoNaSpatialQueryResult : listGeoNaDataObject) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
Set<String> indexLayers = mapIndexLayerObjects.keySet();
|
Set<String> indexLayers = mapIndexLayerObjects.keySet();
|
||||||
|
@ -806,6 +807,7 @@ public class LayerManager {
|
||||||
|
|
||||||
TemporalReferenceDV tempRef = projectDV.getTemporalReference();
|
TemporalReferenceDV tempRef = projectDV.getTemporalReference();
|
||||||
if (tempRef != null) {
|
if (tempRef != null) {
|
||||||
|
if(tempRef.getStart()!=null || tempRef.getEnd()!=null)
|
||||||
flowPanel.add(new HTML(ProjectUtil.toHTMLCode(tempRef)));
|
flowPanel.add(new HTML(ProjectUtil.toHTMLCode(tempRef)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -930,7 +932,7 @@ public class LayerManager {
|
||||||
intFlex.setCellPadding(1);
|
intFlex.setCellPadding(1);
|
||||||
intFlex.setCellSpacing(1);
|
intFlex.setCellSpacing(1);
|
||||||
if (projectDV.getTheDocument() != null) {
|
if (projectDV.getTheDocument() != null) {
|
||||||
LinkedHashMap<String, String> map = projectDV.getTheDocument().getDocumentAsMap();
|
LinkedHashMap<String, Object> map = projectDV.getTheDocument().getDocumentAsMap();
|
||||||
// my-html-table
|
// my-html-table
|
||||||
// intFlex.getElement().addClassName("my-html-table");
|
// intFlex.getElement().addClassName("my-html-table");
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -957,6 +959,7 @@ public class LayerManager {
|
||||||
GWT.log("Temporal reference is: "+tempRef);
|
GWT.log("Temporal reference is: "+tempRef);
|
||||||
if (tempRef != null) {
|
if (tempRef != null) {
|
||||||
|
|
||||||
|
if(tempRef.getStart()!=null || tempRef.getEnd()!=null)
|
||||||
flex.setHTML(flex.getRowCount() + 1, 0, ProjectUtil.toHTMLCode(tempRef));
|
flex.setHTML(flex.getRowCount() + 1, 0, ProjectUtil.toHTMLCode(tempRef));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -973,7 +976,7 @@ public class LayerManager {
|
||||||
if (payloads != null && payloads.size() > 0) {
|
if (payloads != null && payloads.size() > 0) {
|
||||||
PayloadDV img = payloads.get(0);
|
PayloadDV img = payloads.get(0);
|
||||||
if (img != null && img.getLink() != null) {
|
if (img != null && img.getLink() != null) {
|
||||||
String theImgHTML = "<img src=\"" + img.getLink() + "\"></img>";
|
String theImgHTML = "<div id='pop-img'><img src=\"" + img.getLink() + "\"></img></div>";
|
||||||
GWT.log("theImgHTML: " + theImgHTML);
|
GWT.log("theImgHTML: " + theImgHTML);
|
||||||
flex.setHTML(flex.getRowCount() + 1, 0, theImgHTML);
|
flex.setHTML(flex.getRowCount() + 1, 0, theImgHTML);
|
||||||
firstImageFound = true;
|
firstImageFound = true;
|
||||||
|
@ -1008,9 +1011,9 @@ public class LayerManager {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
final Button buttonViewLayers = new Button("Zoom to Layers");
|
final Button buttonViewLayers = new Button(ZOOM_TO_LAYERS_LABEL);
|
||||||
buttonViewLayers.getElement().setId("go-to-layers");
|
buttonViewLayers.getElement().setId("go-to-layers");
|
||||||
buttonViewLayers.getElement().setTitle("Zoom to Layers");
|
buttonViewLayers.getElement().setTitle(ZOOM_TO_LAYERS_TITLE);
|
||||||
buttonViewLayers.setType(ButtonType.LINK);
|
buttonViewLayers.setType(ButtonType.LINK);
|
||||||
|
|
||||||
if (olMap.getCurrentZoomLevel() >= OLMapManager.LAYER_DETAIL_MAX_RESOLUTION) {
|
if (olMap.getCurrentZoomLevel() >= OLMapManager.LAYER_DETAIL_MAX_RESOLUTION) {
|
||||||
|
@ -1120,7 +1123,7 @@ public class LayerManager {
|
||||||
* @param feature the feature
|
* @param feature the feature
|
||||||
* @param onFailureCenterTo the on failure center to
|
* @param onFailureCenterTo the on failure center to
|
||||||
*/
|
*/
|
||||||
public void showPopupInfoForCentroidLayer(GeoNaSpatialQueryResult geoNaDataObject, FeatureRow feature,
|
public void showPopupInfoForCentroidLayer(GeoportalSpatialQueryResult geoNaDataObject, FeatureRow feature,
|
||||||
Coordinate onFailureCenterTo) {
|
Coordinate onFailureCenterTo) {
|
||||||
GWT.log("showPopupInfoForCentroidLayer showing feature: " + feature);
|
GWT.log("showPopupInfoForCentroidLayer showing feature: " + feature);
|
||||||
GWT.log("showPopupInfoForCentroidLayer showing layerObject: " + geoNaDataObject.getSourceLayerObject());
|
GWT.log("showPopupInfoForCentroidLayer showing layerObject: " + geoNaDataObject.getSourceLayerObject());
|
||||||
|
@ -1139,8 +1142,9 @@ public class LayerManager {
|
||||||
FlexTable intFlex = new FlexTable();
|
FlexTable intFlex = new FlexTable();
|
||||||
intFlex.setCellPadding(1);
|
intFlex.setCellPadding(1);
|
||||||
intFlex.setCellSpacing(1);
|
intFlex.setCellSpacing(1);
|
||||||
|
intFlex.getElement().addClassName("thePopDataTable");
|
||||||
if (projectDV.getTheDocument() != null) {
|
if (projectDV.getTheDocument() != null) {
|
||||||
LinkedHashMap<String, String> map = projectDV.getTheDocument().getDocumentAsMap();
|
LinkedHashMap<String, Object> map = projectDV.getTheDocument().getDocumentAsMap();
|
||||||
// my-html-table
|
// my-html-table
|
||||||
// intFlex.getElement().addClassName("my-html-table");
|
// intFlex.getElement().addClassName("my-html-table");
|
||||||
// int i = 0;
|
// int i = 0;
|
||||||
|
@ -1162,7 +1166,7 @@ public class LayerManager {
|
||||||
|
|
||||||
TemporalReferenceDV tempRef = projectDV.getTemporalReference();
|
TemporalReferenceDV tempRef = projectDV.getTemporalReference();
|
||||||
if (tempRef != null) {
|
if (tempRef != null) {
|
||||||
|
if(tempRef.getStart()!=null || tempRef.getEnd()!=null)
|
||||||
flex.setHTML(flex.getRowCount() + 1, 0, ProjectUtil.toHTMLCode(tempRef));
|
flex.setHTML(flex.getRowCount() + 1, 0, ProjectUtil.toHTMLCode(tempRef));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1174,7 +1178,7 @@ public class LayerManager {
|
||||||
if (listUI != null && listUI.size() > 0) {
|
if (listUI != null && listUI.size() > 0) {
|
||||||
PayloadDV img = listUI.get(0);
|
PayloadDV img = listUI.get(0);
|
||||||
if (img != null && img.getLink() != null) {
|
if (img != null && img.getLink() != null) {
|
||||||
String theImgHTML = "<img src=\"" + img.getLink() + "\"></img>";
|
String theImgHTML = "<div id='pop-img'><img src=\"" + img.getLink() + "\"></img></div>";
|
||||||
GWT.log("theImgHTML: " + theImgHTML);
|
GWT.log("theImgHTML: " + theImgHTML);
|
||||||
// GeoportalDataViewerConstants.print("The row are:
|
// GeoportalDataViewerConstants.print("The row are:
|
||||||
// "+flex.getRowCount());
|
// "+flex.getRowCount());
|
||||||
|
@ -1200,9 +1204,9 @@ public class LayerManager {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
final Button buttonViewLayers = new Button("Zoom to Layers");
|
final Button buttonViewLayers = new Button(ZOOM_TO_LAYERS_LABEL);
|
||||||
buttonViewLayers.getElement().setId("go-to-layers");
|
buttonViewLayers.getElement().setId("go-to-layers");
|
||||||
buttonViewLayers.getElement().setTitle("Zoom to Layers");
|
buttonViewLayers.getElement().setTitle(ZOOM_TO_LAYERS_TITLE);
|
||||||
buttonViewLayers.setType(ButtonType.LINK);
|
buttonViewLayers.setType(ButtonType.LINK);
|
||||||
|
|
||||||
if (olMap.getCurrentZoomLevel() >= OLMapManager.LAYER_DETAIL_MAX_RESOLUTION) {
|
if (olMap.getCurrentZoomLevel() >= OLMapManager.LAYER_DETAIL_MAX_RESOLUTION) {
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
|
@ -0,0 +1,134 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class UpdateLayerToMapEvent.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Jun 15, 2023
|
||||||
|
*/
|
||||||
|
public class UpdateLayerToMapEvent extends GwtEvent<UpdateLayerToMapEventHandler> {
|
||||||
|
public static Type<UpdateLayerToMapEventHandler> TYPE = new Type<UpdateLayerToMapEventHandler>();
|
||||||
|
private GCubeCollection collection;
|
||||||
|
private String layerName;
|
||||||
|
private REQUEST_PARAMETER operation;
|
||||||
|
private String value;
|
||||||
|
private LAYER_TYPE layerType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Enum REQUEST_PARAMETER.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Jun 15, 2023
|
||||||
|
*/
|
||||||
|
public static enum REQUEST_PARAMETER {
|
||||||
|
STYLE
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Enum LAYER_TYPE.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Jun 15, 2023
|
||||||
|
*/
|
||||||
|
public static enum LAYER_TYPE {
|
||||||
|
INDEX, DETAILS
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new adds the layer to map event.
|
||||||
|
*
|
||||||
|
* @param collection the collection
|
||||||
|
* @param layerName the layer name
|
||||||
|
* @param type the type
|
||||||
|
*/
|
||||||
|
public UpdateLayerToMapEvent(GCubeCollection collection, String layerName, LAYER_TYPE type) {
|
||||||
|
this.collection = collection;
|
||||||
|
this.layerName = layerName;
|
||||||
|
this.layerType = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the associated type.
|
||||||
|
*
|
||||||
|
* @return the associated type
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Type<UpdateLayerToMapEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the operation.
|
||||||
|
*
|
||||||
|
* @param operation the operation
|
||||||
|
* @param value the value
|
||||||
|
*/
|
||||||
|
public void setOperation(REQUEST_PARAMETER operation, String value) {
|
||||||
|
this.operation = operation;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value.
|
||||||
|
*
|
||||||
|
* @return the value
|
||||||
|
*/
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the layer type.
|
||||||
|
*
|
||||||
|
* @return the layer type
|
||||||
|
*/
|
||||||
|
public LAYER_TYPE getLayerType() {
|
||||||
|
return layerType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the operation.
|
||||||
|
*
|
||||||
|
* @return the operation
|
||||||
|
*/
|
||||||
|
public REQUEST_PARAMETER getOperation() {
|
||||||
|
return operation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the layer name.
|
||||||
|
*
|
||||||
|
* @return the layer name
|
||||||
|
*/
|
||||||
|
public String getLayerName() {
|
||||||
|
return layerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the collection.
|
||||||
|
*
|
||||||
|
* @return the collection
|
||||||
|
*/
|
||||||
|
public GCubeCollection getCollection() {
|
||||||
|
return collection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch.
|
||||||
|
*
|
||||||
|
* @param handler the handler
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void dispatch(UpdateLayerToMapEventHandler handler) {
|
||||||
|
handler.onUpdateLayer(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface UpdateLayerToMapEventHandler.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Jun 15, 2023
|
||||||
|
*/
|
||||||
|
public interface UpdateLayerToMapEventHandler extends EventHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On update layer.
|
||||||
|
*
|
||||||
|
* @param updateLayerToMapEvent the update layer to map event
|
||||||
|
*/
|
||||||
|
void onUpdateLayer(UpdateLayerToMapEvent updateLayerToMapEvent);
|
||||||
|
}
|
|
@ -32,15 +32,15 @@ public class ExtentWrapped extends ol.Extent {
|
||||||
super(minX, minY, maxX, maxY);
|
super(minX, minY, maxX, maxY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* @param coordinate coordinate to check.
|
// * @param coordinate coordinate to check.
|
||||||
* @return true if the passed coordinate is contained or on the edge of the
|
// * @return true if the passed coordinate is contained or on the edge of the
|
||||||
* extent.
|
// * extent.
|
||||||
*/
|
// */
|
||||||
@JsOverlay
|
// @JsOverlay
|
||||||
public final Coordinate getCenter() {
|
// public final Coordinate getCenter() {
|
||||||
return getCenter((ol.Extent) this);
|
// return getCenter((ol.Extent) this);
|
||||||
}
|
// }
|
||||||
|
|
||||||
@JsMethod(name = "getCenter", namespace = PACKAGE_EXTENT)
|
@JsMethod(name = "getCenter", namespace = PACKAGE_EXTENT)
|
||||||
private static native Coordinate getCenter(Extent extent);
|
private static native Coordinate getCenter(Extent extent);
|
||||||
|
|
|
@ -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.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -8,7 +8,7 @@ import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
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.resources.GNAImages;
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GeoportalImages;
|
||||||
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.GeoQuery;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE;
|
||||||
|
@ -87,7 +87,7 @@ public class LightOpenLayerMap {
|
||||||
|
|
||||||
private ol.layer.Vector geometryLayer;
|
private ol.layer.Vector geometryLayer;
|
||||||
|
|
||||||
private String markerURL = GNAImages.ICONS.mapMarkerIcon().getURL();
|
private String markerURL = GeoportalImages.ICONS.mapMarkerIcon().getURL();
|
||||||
|
|
||||||
private LayerOrder layerOrder = new LayerOrder();
|
private LayerOrder layerOrder = new LayerOrder();
|
||||||
|
|
||||||
|
|
|
@ -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>();
|
||||||
|
@ -347,7 +367,7 @@ public abstract class OpenLayerMap {
|
||||||
elPopup.getStyle().setVisibility(Visibility.VISIBLE);
|
elPopup.getStyle().setVisibility(Visibility.VISIBLE);
|
||||||
if (popupOverlay == null) {
|
if (popupOverlay == null) {
|
||||||
popupOverlay = addOverlay(elPopup);
|
popupOverlay = addOverlay(elPopup);
|
||||||
addPopupCloserHandelr(popupOverlay);
|
addPopupCloserHandler(popupOverlay);
|
||||||
}
|
}
|
||||||
Element popContent = DOM.getElementById("popup-content");
|
Element popContent = DOM.getElementById("popup-content");
|
||||||
popContent.setInnerHTML(html);
|
popContent.setInnerHTML(html);
|
||||||
|
@ -365,11 +385,11 @@ public abstract class OpenLayerMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the popup closer handelr.
|
* Adds the popup closer handler.
|
||||||
*
|
*
|
||||||
* @param popupOverlay the popup overlay
|
* @param popupOverlay the popup overlay
|
||||||
*/
|
*/
|
||||||
private void addPopupCloserHandelr(Overlay popupOverlay) {
|
private void addPopupCloserHandler(Overlay popupOverlay) {
|
||||||
Element elPopupCloser = DOM.getElementById("popup-closer");
|
Element elPopupCloser = DOM.getElementById("popup-closer");
|
||||||
Event.sinkEvents(elPopupCloser, Event.ONCLICK);
|
Event.sinkEvents(elPopupCloser, Event.ONCLICK);
|
||||||
Event.setEventListener(elPopupCloser, new com.google.gwt.user.client.EventListener() {
|
Event.setEventListener(elPopupCloser, new com.google.gwt.user.client.EventListener() {
|
||||||
|
@ -417,11 +437,9 @@ 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.getMapServerEndpoint());
|
||||||
|
|
||||||
imageWMSOptions.setParams(imageWMSParams);
|
imageWMSOptions.setParams(imageWMSParams);
|
||||||
// imageWMSOptions.setRatio(1.5f);
|
// imageWMSOptions.setRatio(1.5f);
|
||||||
|
@ -458,46 +476,60 @@ 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);
|
||||||
|
|
||||||
|
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 {
|
} else {
|
||||||
imageWMSParams.set("CQL_FILTER", cqlFilterExpression);
|
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();
|
||||||
|
|
||||||
wmsLayer.changed();
|
GWT.log("returning " + CQL_FILTER_PARAMETER + ": " + setCQLFilter);
|
||||||
|
return setCQLFilter;
|
||||||
//map.addLayer(wmsLayer);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the WMS detail layer.
|
* Adds the WMS detail layer.
|
||||||
*
|
*
|
||||||
* @param layerItem the layer item
|
* @param layerItem the layer item
|
||||||
|
* @param initialOpacity the initial opacity
|
||||||
*/
|
*/
|
||||||
public void addWMSDetailLayer(LayerItem layerItem) {
|
public void addWMSDetailLayer(LayerItem layerItem, double initialOpacity) {
|
||||||
|
|
||||||
if (wmsDetailsLayerMap == null)
|
if (wmsDetailsLayerMap == null)
|
||||||
wmsDetailsLayerMap = new LinkedHashMap<String, Image>();
|
wmsDetailsLayerMap = new LinkedHashMap<String, Image>();
|
||||||
|
@ -512,7 +544,7 @@ public abstract class OpenLayerMap {
|
||||||
imageWMSParams.setLayers(layerItem.getName());
|
imageWMSParams.setLayers(layerItem.getName());
|
||||||
|
|
||||||
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
||||||
imageWMSOptions.setUrl(layerItem.getMapServerHost());
|
imageWMSOptions.setUrl(layerItem.getMapServerEndpoint());
|
||||||
imageWMSOptions.setParams(imageWMSParams);
|
imageWMSOptions.setParams(imageWMSParams);
|
||||||
// imageWMSOptions.setRatio(1.5f);
|
// imageWMSOptions.setRatio(1.5f);
|
||||||
|
|
||||||
|
@ -531,6 +563,7 @@ public abstract class OpenLayerMap {
|
||||||
Image wmsLayer = new Image(layerOptions);
|
Image wmsLayer = new Image(layerOptions);
|
||||||
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.WMS_DETAIL) + wmsDetailsLayerMap.size() + 1;
|
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.WMS_DETAIL) + wmsDetailsLayerMap.size() + 1;
|
||||||
wmsLayer.setZIndex(zIndex);
|
wmsLayer.setZIndex(zIndex);
|
||||||
|
wmsLayer.setOpacity(initialOpacity);
|
||||||
map.addLayer(wmsLayer);
|
map.addLayer(wmsLayer);
|
||||||
wmsDetailsLayerMap.put(key, wmsLayer);
|
wmsDetailsLayerMap.put(key, wmsLayer);
|
||||||
|
|
||||||
|
@ -542,6 +575,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.getMapServerEndpoint());
|
||||||
|
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.
|
||||||
*
|
*
|
||||||
|
@ -640,31 +724,45 @@ public abstract class OpenLayerMap {
|
||||||
*
|
*
|
||||||
* @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
|
||||||
*/
|
*/
|
||||||
public void addLayerFeaturesAsHighlight(LayerItem layerItem, Feature[] features) {
|
public void addLayerFeaturesAsHighlight(LayerItem layerItem, Feature[] features, boolean fitMapToFeaturesExtent) {
|
||||||
|
|
||||||
removeLayerFeaturesAsHighlight(layerItem.getName());
|
removeLayerFeaturesAsHighlight(layerItem.getName());
|
||||||
|
|
||||||
Style style = new Style();
|
Style style = new Style();
|
||||||
StrokeOptions strokeOptions = new StrokeOptions();
|
StrokeOptions strokeOptions = new StrokeOptions();
|
||||||
strokeOptions.setColor(new Color(255, 0, 0, 0.8));
|
strokeOptions.setColor(new Color(255, 69, 0, 0.8));
|
||||||
strokeOptions.setWidth(5);
|
strokeOptions.setWidth(5);
|
||||||
Stroke stroke = new Stroke(strokeOptions);
|
Stroke stroke = new Stroke(strokeOptions);
|
||||||
stroke.setWidth(2);
|
stroke.setWidth(2);
|
||||||
style.setStroke(stroke);
|
style.setStroke(stroke);
|
||||||
|
|
||||||
Vector vectorSource = OLFactory.createVectorSource();
|
Vector vectorSource = OLFactory.createVectorSource();
|
||||||
|
|
||||||
|
EventListener<ol.events.Event> listenerE = new EventListener<ol.events.Event>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(ol.events.Event event) {
|
||||||
|
ol.Extent theExtent = vectorSource.getExtent();
|
||||||
|
// GWT.log(theExtent.toString());
|
||||||
|
map.getView().fit(theExtent);
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (fitMapToFeaturesExtent)
|
||||||
|
vectorSource.addChangeListener(listenerE);
|
||||||
|
|
||||||
vectorSource.addFeatures(features);
|
vectorSource.addFeatures(features);
|
||||||
|
|
||||||
GWT.log("features: " + features);
|
// GWT.log("features: " + features);
|
||||||
|
|
||||||
VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
|
VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
|
||||||
vectorLayerOptions.setSource(vectorSource);
|
vectorLayerOptions.setSource(vectorSource);
|
||||||
vectorLayerOptions.setStyle(style);
|
vectorLayerOptions.setStyle(style);
|
||||||
|
|
||||||
// vectorLayerOptions.setMap(map);
|
// GWT.log("vectorLayerOptions: " + vectorLayerOptions);
|
||||||
|
|
||||||
GWT.log("vectorLayerOptions: " + vectorLayerOptions);
|
|
||||||
|
|
||||||
ol.layer.Vector vector = OLFactory.createVector(vectorLayerOptions);
|
ol.layer.Vector vector = OLFactory.createVector(vectorLayerOptions);
|
||||||
// vector.setStyle(style);
|
// vector.setStyle(style);
|
||||||
|
@ -674,6 +772,7 @@ public abstract class OpenLayerMap {
|
||||||
vectorLayersHighlighted.put(layerItem.getName(), vector);
|
vectorLayersHighlighted.put(layerItem.getName(), vector);
|
||||||
|
|
||||||
map.addLayer(vector);
|
map.addLayer(vector);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1031,6 +1130,23 @@ public abstract class OpenLayerMap {
|
||||||
layer.setVisible(visible);
|
layer.setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLayerStyleForIndex(String layerName, String value) {
|
||||||
|
GWT.log("Setting style " + value + " for " + layerName);
|
||||||
|
|
||||||
|
Image indexWmsLayer = wmsLayerMap.get(layerName);
|
||||||
|
GWT.log("WMS layer is: " + indexWmsLayer);
|
||||||
|
|
||||||
|
if (indexWmsLayer != null) {
|
||||||
|
ImageWms imageWMSSource = indexWmsLayer.getSource();
|
||||||
|
ImageWmsParams imageWMSParams = imageWMSSource.getParams();
|
||||||
|
imageWMSParams.set("STYLES", value);
|
||||||
|
|
||||||
|
imageWMSSource.updateParams(imageWMSParams);
|
||||||
|
indexWmsLayer.setSource(imageWMSSource);
|
||||||
|
indexWmsLayer.changed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the WMS detail layer opacity.
|
* Sets the WMS detail layer opacity.
|
||||||
*
|
*
|
||||||
|
@ -1040,9 +1156,23 @@ 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);
|
||||||
|
if (layer != null)
|
||||||
layer.setOpacity(opacity);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Swap details layers.
|
* Swap details layers.
|
||||||
*
|
*
|
||||||
|
@ -1080,4 +1210,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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.github.gwtbootstrap.client.ui.constants.BaseIconType;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.resources.client.ClientBundle;
|
import com.google.gwt.resources.client.ClientBundle;
|
||||||
|
|
||||||
public interface GNAIcons extends ClientBundle {
|
public interface GeoportalIcons extends ClientBundle {
|
||||||
|
|
||||||
/** My custom base icon collection */
|
/** My custom base icon collection */
|
||||||
public enum CustomIconType implements BaseIconType {
|
public enum CustomIconType implements BaseIconType {
|
||||||
|
@ -15,7 +15,7 @@ public interface GNAIcons extends ClientBundle {
|
||||||
|
|
||||||
/** Inject the icon's css once at first usage */
|
/** Inject the icon's css once at first usage */
|
||||||
static {
|
static {
|
||||||
GNAImages icons = GWT.create(GNAImages.class);
|
GeoportalImages icons = GWT.create(GeoportalImages.class);
|
||||||
icons.css().ensureInjected();
|
icons.css().ensureInjected();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,13 +5,13 @@ import com.google.gwt.resources.client.ClientBundle;
|
||||||
import com.google.gwt.resources.client.CssResource;
|
import com.google.gwt.resources.client.CssResource;
|
||||||
import com.google.gwt.resources.client.ImageResource;
|
import com.google.gwt.resources.client.ImageResource;
|
||||||
|
|
||||||
public interface GNAImages extends ClientBundle {
|
public interface GeoportalImages extends ClientBundle {
|
||||||
|
|
||||||
/** Get access to the css resource during gwt compilation */
|
/** Get access to the css resource during gwt compilation */
|
||||||
@Source("baseIcons.css")
|
@Source("baseIcons.css")
|
||||||
CssResource css();
|
CssResource css();
|
||||||
|
|
||||||
public static final GNAImages ICONS = GWT.create(GNAImages.class);
|
public static final GeoportalImages ICONS = GWT.create(GeoportalImages.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Our sample image icon. Makes the image resource for the gwt-compiler's css
|
* Our sample image icon. Makes the image resource for the gwt-compiler's css
|
||||||
|
@ -59,7 +59,10 @@ public interface GNAImages extends ClientBundle {
|
||||||
@Source("spinner_clock.gif")
|
@Source("spinner_clock.gif")
|
||||||
ImageResource spinnerClock();
|
ImageResource spinnerClock();
|
||||||
|
|
||||||
@Source("geoporta_error.png")
|
@Source("geoportal_error.png")
|
||||||
ImageResource geoportaServiceError();
|
ImageResource geoportaServiceError();
|
||||||
|
|
||||||
|
@Source("warning_error.png")
|
||||||
|
ImageResource warningError();
|
||||||
|
|
||||||
}
|
}
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
|
@ -11,9 +11,20 @@
|
||||||
top: 50px;
|
top: 50px;
|
||||||
right: 10px;
|
right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.to-align-left {
|
||||||
|
position: absolute;
|
||||||
|
top: 5px;
|
||||||
|
color: white !important;
|
||||||
|
text-decoration: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.to-align-left :hover {
|
||||||
|
color: #F5F5F5;
|
||||||
|
}
|
||||||
</ui:style>
|
</ui:style>
|
||||||
<g:HTMLPanel ui:field="detailsHTMLPanel" visible="false">
|
<g:HTMLPanel ui:field="detailsHTMLPanel" visible="false">
|
||||||
<b:Button ui:field="closeButton" addStyleNames="{style.to-align-right}"></b:Button>
|
<b:Button ui:field="closeButton" addStyleNames="{style.to-align-left}"></b:Button>
|
||||||
<g:HTMLPanel ui:field="datailsContainerPanel"></g:HTMLPanel>
|
<g:HTMLPanel ui:field="datailsContainerPanel"></g:HTMLPanel>
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
</ui:UiBinder>
|
</ui:UiBinder>
|
|
@ -8,24 +8,33 @@ 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.GeoportalDataViewer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.GisToolbarFacilities;
|
||||||
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.events.ChangeMapLayerEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEvent;
|
||||||
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.collections.OpenCollectionEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.OpenCollectionEvent;
|
||||||
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.resources.GNAIcons;
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GeoportalIcons;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GeoportalImages;
|
||||||
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 +43,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,10 +60,13 @@ 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.RootPanel;
|
||||||
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;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
@ -67,6 +80,8 @@ import com.google.gwt.user.client.ui.Widget;
|
||||||
*/
|
*/
|
||||||
public class GeonaDataViewMainPanel extends Composite {
|
public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static final String PLACEHOLDER_SELECT_SEARCH_IN = "Select Collection...";
|
private static final String PLACEHOLDER_SELECT_SEARCH_IN = "Select Collection...";
|
||||||
|
|
||||||
private static GeonaDataViewMainPanelUiBinder uiBinder = GWT.create(GeonaDataViewMainPanelUiBinder.class);
|
private static GeonaDataViewMainPanelUiBinder uiBinder = GWT.create(GeonaDataViewMainPanelUiBinder.class);
|
||||||
|
@ -111,6 +126,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;
|
||||||
|
|
||||||
|
@ -120,8 +147,10 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
@UiField
|
@UiField
|
||||||
ListBox navListSearch;
|
ListBox navListSearch;
|
||||||
|
|
||||||
@UiField
|
//@UiField
|
||||||
ScrollPanel overlayLayersPanel;
|
//ScrollPanel overlayLayersPanel;
|
||||||
|
|
||||||
|
RootPanel overlayLayersPanel = RootPanel.get(GeoportalDataViewer.DIV_LAYER_VIEW);
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
ScrollPanel searchFacilityPanel;
|
ScrollPanel searchFacilityPanel;
|
||||||
|
@ -157,25 +186,26 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
mapPanel = new MapPanel(mapHeight + "px");
|
mapPanel = new MapPanel(mapHeight + "px");
|
||||||
detailsPanel.setHeight(mapHeight + "px");
|
detailsPanel.setHeight(mapHeight + "px");
|
||||||
detailsPanel.setApplicationBus(applicationBus);
|
detailsPanel.setApplicationBus(applicationBus);
|
||||||
|
overlayLayersPanel.setVisible(false);
|
||||||
mainContainerPanel.add(mapPanel);
|
mainContainerPanel.add(mapPanel);
|
||||||
bindHandlers();
|
bindHandlers();
|
||||||
dataPointSelection.setIcon(IconType.SCREENSHOT);
|
dataPointSelection.setIcon(IconType.SCREENSHOT);
|
||||||
dataBoxSelection.setIcon(IconType.BOOKMARK);
|
dataBoxSelection.setIcon(IconType.BOOKMARK);
|
||||||
removeQuery.setIcon(IconType.REMOVE);
|
removeQuery.setIcon(IconType.REMOVE);
|
||||||
|
|
||||||
Image italyImg = new Image(GNAImages.ICONS.italyIcon());
|
Image italyImg = new Image(GeoportalImages.ICONS.italyIcon());
|
||||||
italyImg.getElement().getStyle().setPaddingLeft(20, Unit.PX);
|
italyImg.getElement().getStyle().setPaddingLeft(20, Unit.PX);
|
||||||
extentToItaly.getElement().appendChild(italyImg.getElement());
|
extentToItaly.getElement().appendChild(italyImg.getElement());
|
||||||
extentToItaly.setWidth("140px");
|
extentToItaly.setWidth("140px");
|
||||||
|
|
||||||
Image worldImg = new Image(GNAImages.ICONS.worldIcon());
|
Image worldImg = new Image(GeoportalImages.ICONS.worldIcon());
|
||||||
worldImg.getElement().getStyle().setPaddingLeft(20, Unit.PX);
|
worldImg.getElement().getStyle().setPaddingLeft(20, Unit.PX);
|
||||||
extentToEarth.getElement().appendChild(worldImg.getElement());
|
extentToEarth.getElement().appendChild(worldImg.getElement());
|
||||||
extentToEarth.setWidth("140px");
|
extentToEarth.setWidth("140px");
|
||||||
|
|
||||||
linkMap.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
|
// linkMap.setCustomIconStyle(GeoportalIcons.CustomIconType.MAP.get());
|
||||||
linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get());
|
linkPresetLocation.setCustomIconStyle(GeoportalIcons.CustomIconType.PRESET_LOCATION.get());
|
||||||
linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
|
linkLayers.setCustomIconStyle(GeoportalIcons.CustomIconType.LAYERS.get());
|
||||||
|
|
||||||
openCollectionDropDown.setIcon(IconType.COMPASS);
|
openCollectionDropDown.setIcon(IconType.COMPASS);
|
||||||
|
|
||||||
|
@ -188,14 +218,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,15 +282,24 @@ 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");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
openCollectionDropDown.setTitle(GisToolbarFacilities.COLLECTION.getTooltip());
|
||||||
|
linkCustomOverlayLayers.setTitle(GisToolbarFacilities.OVERLAY.getTooltip());
|
||||||
|
linkCrossFilteringLayers.setTitle(GisToolbarFacilities.FILTER.getTooltip());
|
||||||
|
searchFacilityButton.setTitle(GisToolbarFacilities.SEARCH.getTooltip());
|
||||||
|
linkLayers.setTitle(GisToolbarFacilities.LAYERS.getTooltip());
|
||||||
|
linkMap.setTitle(GisToolbarFacilities.MAP.getTooltip());
|
||||||
|
linkPresetLocation.setTitle(GisToolbarFacilities.PRESET_LOCATION.getTooltip());
|
||||||
|
|
||||||
// layersDDB.setToggle(true);
|
// layersDDB.setToggle(true);
|
||||||
bindEvents();
|
bindEvents();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -310,6 +341,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());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -326,6 +377,27 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setPanelsWidth(int clientWidth) {
|
||||||
|
if(clientWidth<GeoportalDataViewerConstants.TABLET_WIDTH) {
|
||||||
|
openCollectionDropDown.setText("");
|
||||||
|
linkCustomOverlayLayers.setText("");
|
||||||
|
linkCrossFilteringLayers.setText("");
|
||||||
|
searchFacilityButton.setText("");
|
||||||
|
linkLayers.setText("");
|
||||||
|
linkPresetLocation.setText("");
|
||||||
|
linkMap.setText("");
|
||||||
|
}else {
|
||||||
|
openCollectionDropDown.setText(GisToolbarFacilities.COLLECTION.getName());
|
||||||
|
linkCustomOverlayLayers.setText(GisToolbarFacilities.OVERLAY.getName());
|
||||||
|
linkCrossFilteringLayers.setText(GisToolbarFacilities.FILTER.getName());
|
||||||
|
searchFacilityButton.setText(GisToolbarFacilities.SEARCH.getName());
|
||||||
|
linkLayers.setText(GisToolbarFacilities.LAYERS.getName());
|
||||||
|
linkMap.setText(GisToolbarFacilities.MAP.getName());
|
||||||
|
linkPresetLocation.setText(GisToolbarFacilities.PRESET_LOCATION.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the overlay panel max height.
|
* Sets the overlay panel max height.
|
||||||
*/
|
*/
|
||||||
|
@ -608,4 +680,107 @@ 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,24 @@
|
||||||
</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" text="Map" ui:field="linkMap" icon="GLOBE">
|
||||||
title="Select the Map" text="Map" ui:field="linkMap">
|
|
||||||
<g:HTMLPanel ui:field="panelBaseLayers">
|
<g:HTMLPanel ui:field="panelBaseLayers">
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
</b:DropdownButton>
|
</b:DropdownButton>
|
||||||
|
<b:DropdownButton type="LINK" visible="false" 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" 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">
|
||||||
|
@ -73,9 +80,8 @@
|
||||||
<g:ScrollPanel ui:field="searchFacilityPanel"
|
<g:ScrollPanel ui:field="searchFacilityPanel"
|
||||||
addStyleNames="search-facility"></g:ScrollPanel>
|
addStyleNames="search-facility"></g:ScrollPanel>
|
||||||
</b:DropdownButton>
|
</b:DropdownButton>
|
||||||
<b:DropdownButton type="LINK"
|
<b:DropdownButton type="LINK" text="Preset Location"
|
||||||
title="Center Map to Location" text="Preset Location"
|
ui:field="linkPresetLocation" addStyleNames="preset-location">
|
||||||
ui:field="linkPresetLocation">
|
|
||||||
<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>
|
||||||
|
@ -99,8 +105,8 @@
|
||||||
text="Remove Query" visible="false"></b:Button>
|
text="Remove Query" visible="false"></b:Button>
|
||||||
<b:Button type="LINK" text="Layers" ui:field="linkLayers">
|
<b:Button type="LINK" text="Layers" ui:field="linkLayers">
|
||||||
</b:Button>
|
</b:Button>
|
||||||
<g:ScrollPanel ui:field="overlayLayersPanel"
|
<!-- <g:ScrollPanel ui:field="overlayLayersPanel"
|
||||||
addStyleNames="layers-panel" visible="false"></g:ScrollPanel>
|
addStyleNames="layers-panel" visible="false"></g:ScrollPanel> -->
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
<c:DetailsPanel ui:field="detailsPanel"
|
<c:DetailsPanel ui:field="detailsPanel"
|
||||||
|
|
|
@ -14,7 +14,7 @@ public class ProjectUtil {
|
||||||
if (document == null)
|
if (document == null)
|
||||||
return htmlCode;
|
return htmlCode;
|
||||||
|
|
||||||
Entry<String, String> firstEntrySet = document.getFirstEntryOfMap();
|
Entry<String, Object> firstEntrySet = document.getFirstEntryOfMap();
|
||||||
if (firstEntrySet != null) {
|
if (firstEntrySet != null) {
|
||||||
htmlCode += firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b>";
|
htmlCode += firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b>";
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public class ProjectUtil {
|
||||||
if (document == null)
|
if (document == null)
|
||||||
return htmlCode;
|
return htmlCode;
|
||||||
|
|
||||||
Entry<String, String> firstEntrySet = document.getFirstEntryOfMap();
|
Entry<String, Object> firstEntrySet = document.getFirstEntryOfMap();
|
||||||
if (firstEntrySet != null) {
|
if (firstEntrySet != null) {
|
||||||
htmlCode += showkey ? firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b>"
|
htmlCode += showkey ? firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b>"
|
||||||
: firstEntrySet.getValue();
|
: firstEntrySet.getValue();
|
||||||
|
@ -51,7 +51,7 @@ public class ProjectUtil {
|
||||||
if (document == null)
|
if (document == null)
|
||||||
return htmlCode;
|
return htmlCode;
|
||||||
|
|
||||||
Entry<String, String> firstEntrySet = document.getFirstEntryOfMap();
|
Entry<String, Object> firstEntrySet = document.getFirstEntryOfMap();
|
||||||
if (firstEntrySet != null) {
|
if (firstEntrySet != null) {
|
||||||
htmlCode += firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b>";
|
htmlCode += firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b>";
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,11 @@ import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||||
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.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.view.ProjectView;
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.SectionView;
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.SectionView;
|
||||||
|
import org.gcube.portal.clientcontext.client.GCubeClientContext;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
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.GeoportalDataViewerServiceAsync;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
||||||
|
@ -25,6 +27,7 @@ import com.github.gwtbootstrap.client.ui.Button;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.dom.client.FormElement;
|
||||||
import com.google.gwt.dom.client.UListElement;
|
import com.google.gwt.dom.client.UListElement;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
@ -35,8 +38,16 @@ import com.google.gwt.user.client.Random;
|
||||||
import com.google.gwt.user.client.Window;
|
import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.FormPanel;
|
||||||
|
import com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent;
|
||||||
|
import com.google.gwt.user.client.ui.FormPanel.SubmitCompleteHandler;
|
||||||
|
import com.google.gwt.user.client.ui.FormPanel.SubmitEvent;
|
||||||
|
import com.google.gwt.user.client.ui.FormPanel.SubmitHandler;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
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.Hidden;
|
||||||
|
import com.google.gwt.user.client.ui.RootPanel;
|
||||||
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
import ol.Coordinate;
|
import ol.Coordinate;
|
||||||
|
@ -83,6 +94,9 @@ public class ProjectViewer extends Composite {
|
||||||
@UiField
|
@UiField
|
||||||
Button expandButton;
|
Button expandButton;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Button exportButton;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
Button relationshipsButton;
|
Button relationshipsButton;
|
||||||
|
|
||||||
|
@ -136,6 +150,22 @@ public class ProjectViewer extends Composite {
|
||||||
this.geoportalItemReferences = geoportalItemRefs;
|
this.geoportalItemReferences = geoportalItemRefs;
|
||||||
this.applicationBus = applicationBus;
|
this.applicationBus = applicationBus;
|
||||||
|
|
||||||
|
GeoportalDataViewerServiceAsync.Util.getInstance().checkExportAsPDFConfig(new AsyncCallback<Boolean>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Boolean result) {
|
||||||
|
GWT.log("Export as PDF visible: " + result);
|
||||||
|
exportButton.setVisible(result);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
final String theTitle = projectView.getTheProjectDV().getProfileName() != null
|
final String theTitle = projectView.getTheProjectDV().getProfileName() != null
|
||||||
? projectView.getTheProjectDV().getProfileName()
|
? projectView.getTheProjectDV().getProfileName()
|
||||||
: "Project ID: " + projectView.getTheProjectDV().getId();
|
: "Project ID: " + projectView.getTheProjectDV().getId();
|
||||||
|
@ -183,6 +213,79 @@ public class ProjectViewer extends Composite {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
exportButton.setType(ButtonType.LINK);
|
||||||
|
exportButton.setIcon(IconType.FILE);
|
||||||
|
exportButton.setTitle("Export as PDF");
|
||||||
|
exportButton.setVisible(false);
|
||||||
|
|
||||||
|
exportButton.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
String theProjectName = "";
|
||||||
|
try {
|
||||||
|
theProjectName = (String) projectView.getTheProjectDV().getTheDocument().getFirstEntryOfMap()
|
||||||
|
.getValue();
|
||||||
|
theProjectName = theProjectName != null ? theProjectName
|
||||||
|
: "Project ID: " + projectView.getTheProjectDV().getId();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reading contextId and userId from GCubeClientContext
|
||||||
|
String currentContextId = GCubeClientContext.getCurrentContextId();
|
||||||
|
String currentUserId = GCubeClientContext.getCurrentUserId();
|
||||||
|
|
||||||
|
ProjectDV thePDV = projectView.getTheProjectDV();
|
||||||
|
|
||||||
|
final String targetWindow = "target_window_" + Random.nextInt() + "_" + Random.nextInt();
|
||||||
|
|
||||||
|
final FormPanel form = new FormPanel();
|
||||||
|
final FormElement fe = form.getElement().cast();
|
||||||
|
//NewBrowserWindow theNewTabWindow = NewBrowserWindow.open("", "", null);
|
||||||
|
RootPanel.get().add(form);
|
||||||
|
VerticalPanel panel = new VerticalPanel();
|
||||||
|
form.setWidget(panel);
|
||||||
|
form.setAction(GeoportalDataViewerConstants.GEOPORTAL_EXPORT_ACTION_SERVLET);
|
||||||
|
form.setEncoding(FormPanel.ENCODING_URLENCODED);
|
||||||
|
form.setMethod(FormPanel.METHOD_POST);
|
||||||
|
panel.add(new Hidden(GeoportalDataViewerConstants.UCD_ID_PARAMETER, thePDV.getProfileID()));
|
||||||
|
panel.add(new Hidden(GeoportalDataViewerConstants.PROIECT_ID_PARAMETER, thePDV.getId()));
|
||||||
|
panel.add(new Hidden(GeoportalDataViewerConstants.CONTEXT_ID_PARAMETER, currentContextId));
|
||||||
|
panel.add(new Hidden(GeoportalDataViewerConstants.USER_ID_PARAMETER, currentUserId));
|
||||||
|
|
||||||
|
if(myLogin!=null) {
|
||||||
|
panel.add(new Hidden(GeoportalDataViewerConstants.USERNAME_PARAMETER, myLogin));
|
||||||
|
}
|
||||||
|
|
||||||
|
// final Modal contactinServiceModal = new Modal(true, true);
|
||||||
|
// contactinServiceModal.setCloseVisible(false);
|
||||||
|
// contactinServiceModal.setTitle("Export");
|
||||||
|
// FlowPanel panelMsg = new FlowPanel();
|
||||||
|
// panelMsg.add(new HTML("Contacting the service..."));
|
||||||
|
// contactinServiceModal.add(panelMsg);
|
||||||
|
// contactinServiceModal.show();
|
||||||
|
|
||||||
|
// Add an event handler to the form.
|
||||||
|
form.addSubmitHandler(new SubmitHandler() {
|
||||||
|
public void onSubmit(SubmitEvent event) {
|
||||||
|
GWT.log("onSubmit done");
|
||||||
|
fe.setTarget(targetWindow);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
form.addSubmitCompleteHandler(new SubmitCompleteHandler() {
|
||||||
|
public void onSubmitComplete(SubmitCompleteEvent event) {
|
||||||
|
GWT.log("onSubmitComplete done");
|
||||||
|
//contactinServiceModal.hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
relationshipsButton.setType(ButtonType.LINK);
|
relationshipsButton.setType(ButtonType.LINK);
|
||||||
relationshipsButton.setIcon(IconType.LINK);
|
relationshipsButton.setIcon(IconType.LINK);
|
||||||
relationshipsButton.setTitle("Show Relationships of this Project");
|
relationshipsButton.setTitle("Show Relationships of this Project");
|
||||||
|
@ -240,14 +343,6 @@ public class ProjectViewer extends Composite {
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
boolean visible = toc_list_container.isVisible();
|
boolean visible = toc_list_container.isVisible();
|
||||||
setTocContentVisible(!visible);
|
setTocContentVisible(!visible);
|
||||||
|
|
||||||
// if (visible) {
|
|
||||||
// toc_list_container.setVisible(false);
|
|
||||||
// reduceToc.setIcon(IconType.PLUS_SIGN_ALT);
|
|
||||||
// } else {
|
|
||||||
// toc_list_container.setVisible(true);
|
|
||||||
// reduceToc.setIcon(IconType.MINUS_SIGN_ALT);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -304,7 +399,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) {
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
color: white;
|
color: white;
|
||||||
padding: 10px 10px;
|
padding: 10px 10px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
padding-left: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.width-100 {
|
.width-100 {
|
||||||
|
@ -43,9 +44,10 @@
|
||||||
<g:HorizontalPanel
|
<g:HorizontalPanel
|
||||||
addStyleNames="functionalities-style">
|
addStyleNames="functionalities-style">
|
||||||
<b:Button ui:field="shareButton">Share</b:Button>
|
<b:Button ui:field="shareButton">Share</b:Button>
|
||||||
|
<b:Button ui:field="exportButton">Export</b:Button>
|
||||||
<b:Button ui:field="expandButton">Expand</b:Button>
|
<b:Button ui:field="expandButton">Expand</b:Button>
|
||||||
<b:Button ui:field="relationshipsButton">Relationships</b:Button>
|
<b:Button ui:field="relationshipsButton">Relationships</b:Button>
|
||||||
<b:Button ui:field="addLayersToMap">Add Layers to Map</b:Button>
|
<b:Button ui:field="addLayersToMap">Add Layers</b:Button>
|
||||||
</g:HorizontalPanel>
|
</g:HorizontalPanel>
|
||||||
<g:HTMLPanel ui:field="centroidPanel"></g:HTMLPanel>
|
<g:HTMLPanel ui:field="centroidPanel"></g:HTMLPanel>
|
||||||
<g:HTMLPanel ui:field="tableOfContentPanel"
|
<g:HTMLPanel ui:field="tableOfContentPanel"
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class SectionViewer extends Composite {
|
||||||
List<FilesetDV> files = subDocumentView.getListFiles();
|
List<FilesetDV> files = subDocumentView.getListFiles();
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
for (FilesetDV fileset : files) {
|
for (FilesetDV fileset : files) {
|
||||||
showLinkToDownloadWsContent(fileset.getName(), fileset.getListPayload());
|
showLinkToDownloadWsContent(fileset.getGcubeProfileFieldName(), fileset.getListPayload());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent.EVENT_SOURCE;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent.EVENT_SOURCE;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GeoportalImages;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class TimelineRelationPanel extends Composite {
|
||||||
Anchor timelinePopupCloser;
|
Anchor timelinePopupCloser;
|
||||||
|
|
||||||
private LoaderIcon loaderData = new LoaderIcon("Loading data... please wait",
|
private LoaderIcon loaderData = new LoaderIcon("Loading data... please wait",
|
||||||
new Image(GNAImages.ICONS.spinnerClock()));
|
new Image(GeoportalImages.ICONS.spinnerClock()));
|
||||||
|
|
||||||
private TimelineRelationPanel instance = this;
|
private TimelineRelationPanel instance = this;
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class ViewRelationshipPanel extends Composite {
|
||||||
firstProjectPanelContainer.clear();
|
firstProjectPanelContainer.clear();
|
||||||
secondProjectPanelContainer.clear();
|
secondProjectPanelContainer.clear();
|
||||||
|
|
||||||
Entry<String, String> firstEntrySet = project.getTheDocument().getFirstEntryOfMap();
|
Entry<String, Object> firstEntrySet = project.getTheDocument().getFirstEntryOfMap();
|
||||||
String htmlMsg = firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b> (id: " + project.getId()
|
String htmlMsg = firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b> (id: " + project.getId()
|
||||||
+ ")";
|
+ ")";
|
||||||
|
|
||||||
|
|
|
@ -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.getServiceEndPoint() + "?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>
|
|
@ -8,7 +8,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerSer
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent;
|
||||||
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.resources.GNAImages;
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GeoportalImages;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
|
||||||
|
@ -50,11 +50,11 @@ public class DragDropLayer extends FlowPanel {
|
||||||
private static DragDropLayer draggingTarget = null;
|
private static DragDropLayer draggingTarget = null;
|
||||||
final boolean droppable;
|
final boolean droppable;
|
||||||
private Label labelLayerName;
|
private Label labelLayerName;
|
||||||
private Image imgLayerVisible = new Image(GNAImages.ICONS.layerVisible());
|
private Image imgLayerVisible = new Image(GeoportalImages.ICONS.layerVisible());
|
||||||
private Image imgLayerInvisible = new Image(GNAImages.ICONS.layerInvisible());
|
private Image imgLayerInvisible = new Image(GeoportalImages.ICONS.layerInvisible());
|
||||||
|
|
||||||
private Image imgLocate = new Image(GNAImages.ICONS.locate());
|
private Image imgLocate = new Image(GeoportalImages.ICONS.locate());
|
||||||
private Image imgLocateNone = new Image(GNAImages.ICONS.locateNone());
|
private Image imgLocateNone = new Image(GeoportalImages.ICONS.locateNone());
|
||||||
private boolean locateEnabled = false;
|
private boolean locateEnabled = false;
|
||||||
private HTML buttonLocate = new HTML();
|
private HTML buttonLocate = new HTML();
|
||||||
|
|
||||||
|
@ -101,10 +101,10 @@ public class DragDropLayer extends FlowPanel {
|
||||||
labelProject.setTitle(referProjectID);
|
labelProject.setTitle(referProjectID);
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance().getEntrySetsDocumentForProjectID(
|
GeoportalDataViewerServiceAsync.Util.getInstance().getEntrySetsDocumentForProjectID(
|
||||||
layerObject.getProjectDV().getProfileID(), layerObject.getProjectDV().getId(), 1,
|
layerObject.getProjectDV().getProfileID(), layerObject.getProjectDV().getId(), 1,
|
||||||
new AsyncCallback<LinkedHashMap<String, String>>() {
|
new AsyncCallback<LinkedHashMap<String, Object>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(LinkedHashMap<String, String> result) {
|
public void onSuccess(LinkedHashMap<String, Object> result) {
|
||||||
String realProjectName = "";
|
String realProjectName = "";
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
for (String key : result.keySet()) {
|
for (String key : result.keySet()) {
|
||||||
|
@ -189,7 +189,7 @@ public class DragDropLayer extends FlowPanel {
|
||||||
|
|
||||||
if(layerObject.getProjectDV().getTemporalReference()!=null) {
|
if(layerObject.getProjectDV().getTemporalReference()!=null) {
|
||||||
TemporalReferenceDV tempRef = layerObject.getProjectDV().getTemporalReference();
|
TemporalReferenceDV tempRef = layerObject.getProjectDV().getTemporalReference();
|
||||||
// ft.setWidget(ft.getRowCount() + 1, 2, new HTML(ProjectUtil.toHTMLCode(tempRef)));
|
if(tempRef.getStart()!=null || tempRef.getEnd()!=null)
|
||||||
vpInner.add(new HTML(ProjectUtil.toHTMLCode(tempRef)));
|
vpInner.add(new HTML(ProjectUtil.toHTMLCode(tempRef)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd;
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent;
|
||||||
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.shared.gis.LayerItem;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
|
@ -38,8 +39,8 @@ public class RangeSlider extends Composite {
|
||||||
sliderId = "slider-" + Random.nextInt();
|
sliderId = "slider-" + Random.nextInt();
|
||||||
theSlider.addClassName("slider");
|
theSlider.addClassName("slider");
|
||||||
theSlider.setId(sliderId);
|
theSlider.setId(sliderId);
|
||||||
|
theSlider.setTitle("Set opacity of the layer");
|
||||||
theSlider.setTitle("Set opacity of "+layer.getName());
|
theSlider.setPropertyObject("value", GeoportalDataViewerConstants.INITIAL_LAYER_OPACITY*100);
|
||||||
|
|
||||||
bindEvents();
|
bindEvents();
|
||||||
}
|
}
|
||||||
|
@ -56,9 +57,9 @@ public class RangeSlider extends Composite {
|
||||||
DoActionOnDetailLayersEvent actionChangeOpacity = new DoActionOnDetailLayersEvent(
|
DoActionOnDetailLayersEvent actionChangeOpacity = new DoActionOnDetailLayersEvent(
|
||||||
DO_LAYER_ACTION.OPACITY, layer, null);
|
DO_LAYER_ACTION.OPACITY, layer, null);
|
||||||
int value = Integer.parseInt((String) theSlider.getPropertyObject("value"));
|
int value = Integer.parseInt((String) theSlider.getPropertyObject("value"));
|
||||||
//GWT.log("opacity int value: "+value);
|
// GWT.log("opacity int value: "+value);
|
||||||
double opacity = (double) ((double) value/100);
|
double opacity = (double) ((double) value / 100);
|
||||||
GWT.log("opacity double value: "+opacity);
|
GWT.log("opacity double value: " + opacity);
|
||||||
actionChangeOpacity.setOpacity(opacity);
|
actionChangeOpacity.setOpacity(opacity);
|
||||||
applicationBus.fireEvent(actionChangeOpacity);
|
applicationBus.fireEvent(actionChangeOpacity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,9 @@ import java.util.HashMap;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.UpdateLayerToMapEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.UpdateLayerToMapEvent.LAYER_TYPE;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.UpdateLayerToMapEvent.REQUEST_PARAMETER;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.CloseCollectionEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.CloseCollectionEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.OpenCollectionEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.OpenCollectionEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
||||||
|
@ -18,6 +21,8 @@ import com.github.gwtbootstrap.client.ui.ListBox;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.dom.client.Style.FontWeight;
|
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.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
import com.google.gwt.event.dom.client.ErrorEvent;
|
import com.google.gwt.event.dom.client.ErrorEvent;
|
||||||
|
@ -47,7 +52,7 @@ import com.google.gwt.user.client.ui.Widget;
|
||||||
*
|
*
|
||||||
* @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 {
|
||||||
|
|
||||||
|
@ -62,6 +67,9 @@ public class LayerCollectionPanel extends Composite {
|
||||||
@UiField
|
@UiField
|
||||||
HTMLPanel styleListPanel;
|
HTMLPanel styleListPanel;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
HTMLPanel statisticPanel;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
Button buttonLegend;
|
Button buttonLegend;
|
||||||
|
|
||||||
|
@ -76,6 +84,12 @@ public class LayerCollectionPanel extends Composite {
|
||||||
|
|
||||||
private ListBox listBoxStyles = new ListBox();
|
private ListBox listBoxStyles = new ListBox();
|
||||||
|
|
||||||
|
private String layerName;
|
||||||
|
|
||||||
|
private GCubeCollection gcubeCollection;
|
||||||
|
|
||||||
|
private HandlerManager applicationBus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Interface LayerCollectionPanelUiBinder.
|
* The Interface LayerCollectionPanelUiBinder.
|
||||||
*
|
*
|
||||||
|
@ -92,11 +106,13 @@ public class LayerCollectionPanel extends Composite {
|
||||||
* @param coll the coll
|
* @param coll the coll
|
||||||
* @param applicationBus the application bus
|
* @param applicationBus the application bus
|
||||||
*/
|
*/
|
||||||
public LayerCollectionPanel(GCubeCollection coll, HandlerManager applicationBus) {
|
public LayerCollectionPanel(final GCubeCollection coll, HandlerManager applicationBus) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
this.applicationBus = applicationBus;
|
||||||
|
|
||||||
buttonLegend.setType(ButtonType.LINK);
|
buttonLegend.setType(ButtonType.LINK);
|
||||||
legendPanel.setVisible(false);
|
legendPanel.setVisible(false);
|
||||||
|
statisticPanel.setVisible(false);
|
||||||
|
|
||||||
GWT.log("Found available collection " + coll);
|
GWT.log("Found available collection " + coll);
|
||||||
String label = coll.getUcd().getName();
|
String label = coll.getUcd().getName();
|
||||||
|
@ -111,18 +127,16 @@ public class LayerCollectionPanel extends Composite {
|
||||||
@Override
|
@Override
|
||||||
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||||
GWT.log("Collection selector flag changed to value : " + event.toDebugString());
|
GWT.log("Collection selector flag changed to value : " + event.toDebugString());
|
||||||
|
|
||||||
// String collectionID = ((CheckBox) event.getSource()).getId().replace("gcubeCollectionSelector_",
|
|
||||||
// "");
|
|
||||||
|
|
||||||
GWT.log("Collection ID is : " + collectionID + ", event value: " + event.getValue());
|
GWT.log("Collection ID is : " + collectionID + ", event value: " + event.getValue());
|
||||||
if (event.getValue()) {
|
if (event.getValue()) {
|
||||||
// OPEN COLLECTION
|
// OPEN COLLECTION
|
||||||
applicationBus.fireEvent(new OpenCollectionEvent(collectionID));
|
applicationBus.fireEvent(new OpenCollectionEvent(collectionID));
|
||||||
|
enableLayerStyle(true);
|
||||||
} else {
|
} else {
|
||||||
// CLOSE COLLECTION
|
// CLOSE COLLECTION
|
||||||
legendPanel.clear();
|
hideStyleLegend();
|
||||||
legendPanel.setVisible(false);
|
resetLayerStyle();
|
||||||
|
enableLayerStyle(false);
|
||||||
applicationBus.fireEvent(new CloseCollectionEvent(collectionID));
|
applicationBus.fireEvent(new CloseCollectionEvent(collectionID));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,8 +144,33 @@ public class LayerCollectionPanel extends Composite {
|
||||||
|
|
||||||
basePanel.add(checkbox);
|
basePanel.add(checkbox);
|
||||||
|
|
||||||
|
GeoportalDataViewerServiceAsync.Util.getInstance().getCountFor(collectionID, "Published", "OK", new AsyncCallback<Integer>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Integer result) {
|
||||||
|
|
||||||
|
if(result!=null) {
|
||||||
|
String resultLabel = result+" project";
|
||||||
|
if(result>1) {
|
||||||
|
resultLabel+="s";
|
||||||
|
}
|
||||||
|
resultLabel+= " published";
|
||||||
|
statisticPanel.setVisible(true);
|
||||||
|
statisticPanel.add(new HTML(resultLabel));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
ViewerConfiguration theConfig = GeoportalDataViewer.getStatus().getViewerConfig();
|
ViewerConfiguration theConfig = GeoportalDataViewer.getStatus().getViewerConfig();
|
||||||
GCubeCollection toOpen = theConfig.getAvailableCollections().get(collectionID);
|
final GCubeCollection toOpen = theConfig.getAvailableCollections().get(collectionID);
|
||||||
|
|
||||||
// Check if indexes is empty
|
// Check if indexes is empty
|
||||||
if (toOpen.getIndexes() == null || toOpen.getIndexes().isEmpty()) {
|
if (toOpen.getIndexes() == null || toOpen.getIndexes().isEmpty()) {
|
||||||
|
@ -139,6 +178,7 @@ public class LayerCollectionPanel extends Composite {
|
||||||
Window.alert("Cannot open collection index layer for " + toOpen.getUcd().getName() + ".");
|
Window.alert("Cannot open collection index layer for " + toOpen.getUcd().getName() + ".");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.gcubeCollection = toOpen;
|
||||||
// TODO Get Default Index Layer
|
// TODO Get Default Index Layer
|
||||||
// For now we just take the first - only 1 is expected
|
// For now we just take the first - only 1 is expected
|
||||||
IndexLayerDV layer = toOpen.getIndexes().get(0);
|
IndexLayerDV layer = toOpen.getIndexes().get(0);
|
||||||
|
@ -146,7 +186,7 @@ public class LayerCollectionPanel extends Composite {
|
||||||
|
|
||||||
HashMap<String, String> ogcLinks = layer.getLayer().getOgcLinks();
|
HashMap<String, String> ogcLinks = layer.getLayer().getOgcLinks();
|
||||||
final String wmsLink = ogcLinks.get("wms");
|
final String wmsLink = ogcLinks.get("wms");
|
||||||
final String layerName = URLUtil.getValueOfParameter("layers", wmsLink);
|
this.layerName = URLUtil.getValueOfParameter("layers", wmsLink);
|
||||||
|
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance().parseWmsRequest(wmsLink, layerName,
|
GeoportalDataViewerServiceAsync.Util.getInstance().parseWmsRequest(wmsLink, layerName,
|
||||||
new AsyncCallback<GeoInformationForWMSRequest>() {
|
new AsyncCallback<GeoInformationForWMSRequest>() {
|
||||||
|
@ -181,9 +221,7 @@ public class LayerCollectionPanel extends Composite {
|
||||||
GWT.log("is isToggle: " + buttonLegend.isToggle());
|
GWT.log("is isToggle: " + buttonLegend.isToggle());
|
||||||
GWT.log("is isToggled: " + buttonLegend.isToggled());
|
GWT.log("is isToggled: " + buttonLegend.isToggled());
|
||||||
if (legendPanel.isVisible()) {
|
if (legendPanel.isVisible()) {
|
||||||
legendPanel.clear();
|
hideStyleLegend();
|
||||||
legendPanel.setVisible(false);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
legendPanel.setVisible(true);
|
legendPanel.setVisible(true);
|
||||||
loadLegend(wmsLink);
|
loadLegend(wmsLink);
|
||||||
|
@ -192,11 +230,45 @@ public class LayerCollectionPanel extends Composite {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
listBoxStyles.addChangeHandler(new ChangeHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChange(ChangeEvent event) {
|
||||||
|
setLayerStyle();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setLayerStyle() {
|
||||||
|
UpdateLayerToMapEvent updateLayer = new UpdateLayerToMapEvent(this.gcubeCollection, this.layerName,
|
||||||
|
LAYER_TYPE.INDEX);
|
||||||
|
updateLayer.setOperation(REQUEST_PARAMETER.STYLE, listBoxStyles.getSelectedValue());
|
||||||
|
applicationBus.fireEvent(updateLayer);
|
||||||
|
if (legendPanel.isVisible()) {
|
||||||
|
legendPanel.clear();
|
||||||
|
legendPanel.setVisible(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resetLayerStyle() {
|
||||||
|
listBoxStyles.setSelectedIndex(0);
|
||||||
|
listBoxStyles.setSelectedValue(listBoxStyles.getSelectedValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void enableLayerStyle(boolean enabled) {
|
||||||
|
listBoxStyles.setEnabled(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void hideStyleLegend() {
|
||||||
|
legendPanel.clear();
|
||||||
|
legendPanel.setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the checkbox.
|
* Gets the checkbox.
|
||||||
*
|
*
|
||||||
|
@ -228,7 +300,7 @@ public class LayerCollectionPanel extends Composite {
|
||||||
flow.add(new HTMLPanel("Legend for: " + theLayerName));
|
flow.add(new HTMLPanel("Legend for: " + theLayerName));
|
||||||
final HorizontalPanel hpLegend = new HorizontalPanel();
|
final HorizontalPanel hpLegend = new HorizontalPanel();
|
||||||
|
|
||||||
String url = geoInformation.getBaseWmsServiceHost() + "?service=WMS&" + "version="
|
String url = geoInformation.getServiceEndPoint() + "?service=WMS&" + "version="
|
||||||
+ URLUtil.getValueOfParameter("version", wmsLink) + "&" + "request=GetLegendGraphic&" + "layer="
|
+ URLUtil.getValueOfParameter("version", wmsLink) + "&" + "request=GetLegendGraphic&" + "layer="
|
||||||
+ theLayerName;
|
+ theLayerName;
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
<g:HTMLPanel>
|
<g:HTMLPanel>
|
||||||
<g:HTMLPanel ui:field="basePanel">
|
<g:HTMLPanel ui:field="basePanel">
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
|
<g:HTMLPanel ui:field="statisticPanel" addStyleNames="statistic-style-panel">
|
||||||
|
</g:HTMLPanel>
|
||||||
<g:HTMLPanel ui:field="stylePanel" visible="false" addStyleNames="layer-style-panel">
|
<g:HTMLPanel ui:field="stylePanel" visible="false" addStyleNames="layer-style-panel">
|
||||||
Layer Style
|
Layer Style
|
||||||
<g:HorizontalPanel>
|
<g:HorizontalPanel>
|
||||||
|
|
|
@ -9,7 +9,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerCon
|
||||||
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.LightOpenLayerMap;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.LightOpenLayerMap;
|
||||||
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.resources.GNAIcons;
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GeoportalIcons;
|
||||||
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.ui.map.ExtentMapUtil.PLACE;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.PLACE;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
|
@ -86,7 +86,7 @@ public class MapView extends Composite {
|
||||||
theMapPanel.setWidth(internalMapWidth);
|
theMapPanel.setWidth(internalMapWidth);
|
||||||
theMapPanel.setHeight(internalMapHeight);
|
theMapPanel.setHeight(internalMapHeight);
|
||||||
|
|
||||||
linkMap.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
|
linkMap.setCustomIconStyle(GeoportalIcons.CustomIconType.MAP.get());
|
||||||
|
|
||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.util;
|
package org.gcube.portlets.user.geoportaldataviewer.client.util;
|
||||||
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GeoportalImages;
|
||||||
|
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
|
@ -18,7 +18,7 @@ import com.google.gwt.user.client.ui.Image;
|
||||||
public class LoaderIcon extends HorizontalPanel{
|
public class LoaderIcon extends HorizontalPanel{
|
||||||
|
|
||||||
|
|
||||||
private Image imgLoading = new Image(GNAImages.ICONS.loading());
|
private Image imgLoading = new Image(GeoportalImages.ICONS.loading());
|
||||||
private HTML txtLoading = new HTML("");
|
private HTML txtLoading = new HTML("");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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,50 @@
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,68 +0,0 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.server;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
|
|
||||||
|
|
||||||
public class GcubeProfilesMetadataForUCD implements Serializable {
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = -8953445402356442872L;
|
|
||||||
private String profileID;
|
|
||||||
private GcubeProfileDV gcubeProfile;
|
|
||||||
private List<MetaDataProfileBean> listMetadataProfileBean;
|
|
||||||
|
|
||||||
public GcubeProfilesMetadataForUCD() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public GcubeProfilesMetadataForUCD(String profileID, GcubeProfileDV gcubeProfile,
|
|
||||||
List<MetaDataProfileBean> listMetadataProfileBean) {
|
|
||||||
|
|
||||||
this.profileID = profileID;
|
|
||||||
this.gcubeProfile = gcubeProfile;
|
|
||||||
this.listMetadataProfileBean = listMetadataProfileBean;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProfileID() {
|
|
||||||
return profileID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GcubeProfileDV getGcubeProfile() {
|
|
||||||
return gcubeProfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MetaDataProfileBean> getListMetadataProfileBean() {
|
|
||||||
return listMetadataProfileBean;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProfileID(String profileID) {
|
|
||||||
this.profileID = profileID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGcubeProfile(GcubeProfileDV gcubeProfile) {
|
|
||||||
this.gcubeProfile = gcubeProfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setListMetadataProfileBean(List<MetaDataProfileBean> listMetadataProfileBean) {
|
|
||||||
this.listMetadataProfileBean = listMetadataProfileBean;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
builder.append("GcubeProfilesMetadataForUCD [profileID=");
|
|
||||||
builder.append(profileID);
|
|
||||||
builder.append(", gcubeProfile=");
|
|
||||||
builder.append(gcubeProfile);
|
|
||||||
builder.append(", listMetadataProfileBean=");
|
|
||||||
builder.append(listMetadataProfileBean);
|
|
||||||
builder.append("]");
|
|
||||||
return builder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,162 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.server;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import org.gcube.application.geoportal.common.model.useCaseDescriptor.HandlerDeclaration;
|
|
||||||
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
|
||||||
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
|
||||||
import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
|
|
||||||
import org.gcube.application.geoportalcommon.geoportal.UseCaseDescriptorCaller;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
|
||||||
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.HandlerDeclarationDV;
|
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.server.MetadataProfileFormBuilderServiceImpl;
|
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import com.google.common.cache.CacheBuilder;
|
|
||||||
import com.google.common.cache.CacheLoader;
|
|
||||||
import com.google.common.cache.LoadingCache;
|
|
||||||
import com.google.common.cache.RemovalListener;
|
|
||||||
import com.google.common.cache.RemovalNotification;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Class GcubeProfilesPerUCDIdCache.
|
|
||||||
*
|
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
|
||||||
*
|
|
||||||
* Oct 12, 2022
|
|
||||||
*/
|
|
||||||
public class GcubeProfilesPerUCDIdCache {
|
|
||||||
|
|
||||||
private static Logger LOG = LoggerFactory.getLogger(GcubeProfilesPerUCDIdCache.class);
|
|
||||||
|
|
||||||
private static LoadingCache<String, LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>>> gCubeProfilesPerProfileIDCache;
|
|
||||||
|
|
||||||
static {
|
|
||||||
|
|
||||||
CacheLoader<String, LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>>> loader = new CacheLoader<String, LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>>>() {
|
|
||||||
@Override
|
|
||||||
public LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>> load(String scope) throws Exception {
|
|
||||||
LOG.info("Loading the cache for scope: " + scope);
|
|
||||||
return loadGcubeProfilesForUCDIdInTheScope(scope);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
RemovalListener<String, LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>>> removalListener = new RemovalListener<String, LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>>>() {
|
|
||||||
public void onRemoval(
|
|
||||||
RemovalNotification<String, LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>>> removal) {
|
|
||||||
LOG.info(GcubeProfilesPerUCDIdCache.class.getSimpleName() + " cache expired");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
gCubeProfilesPerProfileIDCache = CacheBuilder.newBuilder().maximumSize(1000)
|
|
||||||
.expireAfterWrite(30, TimeUnit.MINUTES).removalListener(removalListener).build(loader);
|
|
||||||
|
|
||||||
LOG.info("cache instancied");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the.
|
|
||||||
*
|
|
||||||
* @param scope the scope
|
|
||||||
* @return the geonetwork instance
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>> get(String scope) throws Exception {
|
|
||||||
LOG.info("GcubeProfilesPerUCDIdCache get - called in the scope: " + scope);
|
|
||||||
LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>> map = gCubeProfilesPerProfileIDCache.get(scope);
|
|
||||||
LOG.info("GcubeProfilesPerUCDIdCache returning map null? " + (map==null));
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load geonetwork instance.
|
|
||||||
*
|
|
||||||
* @param scope the scope
|
|
||||||
* @return the linked hash map
|
|
||||||
* @throws Exception the exception
|
|
||||||
*/
|
|
||||||
private static LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>> loadGcubeProfilesForUCDIdInTheScope(
|
|
||||||
String scope) throws Exception {
|
|
||||||
LOG.info("loadGcubeProfilesForUCDIdInTheScope called in the scope: " + scope);
|
|
||||||
|
|
||||||
LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>> linkedMap_UCDId_gCubeProfiles = new LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>>();
|
|
||||||
try {
|
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
UseCaseDescriptorCaller clientUCD = GeoportalClientCaller.useCaseDescriptors();
|
|
||||||
List<UseCaseDescriptor> listUCDs = clientUCD.getList();
|
|
||||||
LOG.debug("listUCDs: " + listUCDs);
|
|
||||||
|
|
||||||
for (UseCaseDescriptor ucd : listUCDs) {
|
|
||||||
|
|
||||||
LOG.info("Loaded UCD for ID: " + ucd.getId());
|
|
||||||
String profileID = ucd.getId();
|
|
||||||
GEOPORTAL_DATA_HANDLER theHandler = GEOPORTAL_DATA_HANDLER.geoportal_data_entry;
|
|
||||||
List<HandlerDeclaration> handlers = ucd.getHandlersByType(theHandler.getType());
|
|
||||||
|
|
||||||
if (handlers.size() == 0) {
|
|
||||||
LOG.warn("No handler " + theHandler + "found into UCD " + ucd.getId() + ", continue...");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Loading Handler gcube_profiles
|
|
||||||
HandlerDeclaration dataEntryHandler = handlers.get(0);
|
|
||||||
HandlerDeclarationDV handlerGcubeProfiles = ConvertToDataValueObjectModel
|
|
||||||
.toHandlerDeclarationDV(dataEntryHandler, ucd, GEOPORTAL_CONFIGURATION_TYPE.gcube_profiles);
|
|
||||||
|
|
||||||
LOG.debug("Handler " + GEOPORTAL_CONFIGURATION_TYPE.gcube_profiles + " for PROFILE_ID: " + ucd.getId());
|
|
||||||
LOG.debug("" + handlerGcubeProfiles);
|
|
||||||
|
|
||||||
ConfigurationDV<?> config = handlerGcubeProfiles.getConfiguration();
|
|
||||||
// List of gCube Profiles defined in the UCD
|
|
||||||
List<GcubeProfileDV> listGcubeProfiles = (List<GcubeProfileDV>) config.getConfiguration();
|
|
||||||
LOG.debug("List of GcubeProfileDV are: " + listGcubeProfiles);
|
|
||||||
|
|
||||||
List<GcubeProfilesMetadataForUCD> listProfilesBean = new ArrayList<GcubeProfilesMetadataForUCD>();
|
|
||||||
// Loading Metadata Profile from IS
|
|
||||||
MetadataProfileFormBuilderServiceImpl metaProfileBUilder = new MetadataProfileFormBuilderServiceImpl();
|
|
||||||
|
|
||||||
for (GcubeProfileDV gcubeProfileDV : listGcubeProfiles) {
|
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
GcubeProfilesMetadataForUCD gCubeProfileMetadataForUCD = new GcubeProfilesMetadataForUCD();
|
|
||||||
List<MetaDataProfileBean> listProfiles = metaProfileBUilder.getProfilesInTheScopeForName(scope,
|
|
||||||
gcubeProfileDV.getGcubeSecondaryType(), gcubeProfileDV.getGcubeName());
|
|
||||||
|
|
||||||
String key = gcubeProfileDV.getGcubeSecondaryType() + gcubeProfileDV.getGcubeName();
|
|
||||||
LOG.debug("for key: " + key + " readi profiles: " + listGcubeProfiles);
|
|
||||||
gCubeProfileMetadataForUCD.setGcubeProfile(gcubeProfileDV);
|
|
||||||
gCubeProfileMetadataForUCD.setListMetadataProfileBean(listProfiles);
|
|
||||||
listProfilesBean.add(gCubeProfileMetadataForUCD);
|
|
||||||
|
|
||||||
}
|
|
||||||
linkedMap_UCDId_gCubeProfiles.put(ucd.getId(), listProfilesBean);
|
|
||||||
|
|
||||||
if (LOG.isDebugEnabled()) {
|
|
||||||
for (String key : linkedMap_UCDId_gCubeProfiles.keySet()) {
|
|
||||||
LOG.debug("For key '" + key + "' got profiles: " + linkedMap_UCDId_gCubeProfiles.get(key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
String erroMsg = "Error occurred on preloadgCubeProfilesForUCDs: ";
|
|
||||||
LOG.error(erroMsg, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG.info("GcubeProfilesPerUCDIdCache loaded with " + linkedMap_UCDId_gCubeProfiles.size() + " item/s");
|
|
||||||
return linkedMap_UCDId_gCubeProfiles;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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,20 +44,32 @@ 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;
|
||||||
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.application.geoportalcommon.util.StringUtil;
|
||||||
import org.gcube.application.geoportalcommon.util.URLParserUtil;
|
import org.gcube.application.geoportalcommon.util.URLParserUtil;
|
||||||
|
import org.gcube.application.geoportaldatamapper.GcubeProfilesPerUCDIdCache;
|
||||||
|
import org.gcube.application.geoportaldatamapper.Geoportal_JSON_Mapper;
|
||||||
|
import org.gcube.application.geoportaldatamapper.exporter.Geoportal_PDF_Exporter;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerService;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerService;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.gis.FeatureParser;
|
import org.gcube.portlets.user.geoportaldataviewer.server.gis.FeatureParser;
|
||||||
|
@ -68,10 +77,11 @@ 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;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoportalSpatialQueryResult;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||||
|
@ -118,6 +128,52 @@ 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("public"), PRIVATE("internal");
|
||||||
|
|
||||||
|
String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new centroid layer index flag.
|
||||||
|
*
|
||||||
|
* @param id the id
|
||||||
|
*/
|
||||||
|
CENTROID_LAYER_INDEX_FLAG(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the id.
|
||||||
|
*
|
||||||
|
* @return the id
|
||||||
|
*/
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To string.
|
||||||
|
*
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("CENTROID_LAYER_INDEX_FLAG [id=");
|
||||||
|
builder.append(id);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class ImageDetector.
|
* The Class ImageDetector.
|
||||||
*
|
*
|
||||||
|
@ -208,7 +264,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
public GeoInformationForWMSRequest loadGeoInfoForWmsRequest(String wmsLink, String layerName) throws Exception {
|
public GeoInformationForWMSRequest loadGeoInfoForWmsRequest(String wmsLink, String layerName) throws Exception {
|
||||||
try {
|
try {
|
||||||
WMSUrlValidator validator = new WMSUrlValidator(wmsLink, layerName);
|
WMSUrlValidator validator = new WMSUrlValidator(wmsLink, layerName);
|
||||||
String wmsServiceHost = validator.getWmsServiceHost();
|
String wmsServiceServiceEndpoint = validator.getWmsServiceEndPoint();
|
||||||
String validWMSRequest = validator.parseWMSRequest(true, true);
|
String validWMSRequest = validator.parseWMSRequest(true, true);
|
||||||
layerName = validator.getLayerName();
|
layerName = validator.getLayerName();
|
||||||
String versionWms = validator.getValueOfParsedWMSParameter(WmsParameters.VERSION);
|
String versionWms = validator.getValueOfParsedWMSParameter(WmsParameters.VERSION);
|
||||||
|
@ -235,8 +291,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
? new ZAxis(layerZAxis.getUnits(), layerZAxis.isPositive(), layerZAxis.getValues())
|
? new ZAxis(layerZAxis.getUnits(), layerZAxis.isPositive(), layerZAxis.getValues())
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
return new GeoInformationForWMSRequest(wmsServiceHost, validWMSRequest, layerName, versionWms, crs,
|
return new GeoInformationForWMSRequest(wmsServiceServiceEndpoint, validWMSRequest, layerName, versionWms,
|
||||||
mapWmsNotStandard, styles, styles.isNcWms(), zAxis);
|
crs, mapWmsNotStandard, styles, styles.isNcWms(), zAxis);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String msg = "An error occurred during wms request validation for layer: " + layerName;
|
String msg = "An error occurred during wms request validation for layer: " + layerName;
|
||||||
LOG.error(msg, e);
|
LOG.error(msg, e);
|
||||||
|
@ -326,9 +382,9 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
if (item.getProfileID() == null)
|
if (item.getProfileID() == null)
|
||||||
throw new Exception("Bad request, the profileID is null");
|
throw new Exception("Bad request, the profileID is null");
|
||||||
|
|
||||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
String gcubeScope = SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
GeoportalCommon gc = new GeoportalCommon();
|
GeoportalCommon gc = new GeoportalCommon();
|
||||||
return gc.getPublicLinksFor(item, true);
|
return gc.getPublicLinksFor(gcubeScope, item, true);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Error on getPublicLinksFor for: " + item, e);
|
LOG.error("Error on getPublicLinksFor for: " + item, e);
|
||||||
|
@ -358,14 +414,14 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
* @return the WFS features
|
* @return the WFS features
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<GeoNaSpatialQueryResult> getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName,
|
public List<GeoportalSpatialQueryResult> getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName,
|
||||||
BoundsMap selectBBOX, int maxWFSFeature, double zoomLevel) {
|
BoundsMap selectBBOX, int maxWFSFeature, double zoomLevel) {
|
||||||
LOG.info("getWFSFeatures called");
|
LOG.info("getWFSFeatures called");
|
||||||
|
|
||||||
List<GeoNaSpatialQueryResult> listDAO = new ArrayList<GeoNaSpatialQueryResult>(layerObjects.size());
|
List<GeoportalSpatialQueryResult> listDAO = new ArrayList<GeoportalSpatialQueryResult>(layerObjects.size());
|
||||||
|
|
||||||
for (LayerObject layerObject : layerObjects) {
|
for (LayerObject layerObject : layerObjects) {
|
||||||
GeoNaSpatialQueryResult geoDAO = new GeoNaSpatialQueryResult();
|
GeoportalSpatialQueryResult geoDAO = new GeoportalSpatialQueryResult();
|
||||||
List<FeatureRow> features = FeatureParser.getWFSFeatures(layerObject.getLayerItem(), mapSrsName, selectBBOX,
|
List<FeatureRow> features = FeatureParser.getWFSFeatures(layerObject.getLayerItem(), mapSrsName, selectBBOX,
|
||||||
maxWFSFeature);
|
maxWFSFeature);
|
||||||
LOG.debug("For layer name: " + layerObject.getLayerItem().getName() + " got features: " + features);
|
LOG.debug("For layer name: " + layerObject.getLayerItem().getName() + " got features: " + features);
|
||||||
|
@ -442,50 +498,53 @@ 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
|
||||||
|
|
||||||
String indexFlag = "public"; // default
|
CENTROID_LAYER_INDEX_FLAG setIndexFlag = null;
|
||||||
|
|
||||||
GeoportalServiceIdentityProxy gsp = getGeoportalServiceProxy();
|
GeoportalServiceIdentityProxy gsp = getGeoportalServiceProxy();
|
||||||
if (gsp.isUser()) {
|
if (gsp.isUser()) {
|
||||||
indexFlag = "internal";
|
setIndexFlag = CENTROID_LAYER_INDEX_FLAG.PRIVATE;
|
||||||
LOG.info("user logged - using indexFlag: " + indexFlag);
|
LOG.info("user logged - using indexFlag: " + setIndexFlag);
|
||||||
} else if (gsp.isIAMClient()) {
|
} else if (gsp.isIAMClient()) {
|
||||||
indexFlag = "public";
|
setIndexFlag = CENTROID_LAYER_INDEX_FLAG.PUBLIC;
|
||||||
LOG.info("user not logged - using indexFlag: " + indexFlag);
|
LOG.info("user not logged - using indexFlag: " + setIndexFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO constant
|
// TODO constant
|
||||||
coll.setIndexes(new ArrayList());
|
coll.setIndexes(new ArrayList());
|
||||||
|
|
||||||
LOG.debug(
|
LOG.debug("Checking if " + u.getId() + " is GIS Indexed. Index flag needed is '"
|
||||||
"Checking if " + u.getId() + " is GIS Indexed. Index flag needed is " + indexFlag);
|
+ setIndexFlag + "'");
|
||||||
|
IndexLayerDV toAdd = getLayerIndex(ucdConfig, setIndexFlag);
|
||||||
for (Index index : ucdConfig.getIndexes()) {
|
if (toAdd != null) {
|
||||||
try {
|
|
||||||
IndexLayerDV toAdd = ConvertToDataValueObjectModel.convert(index);
|
|
||||||
if (toAdd.getFlag().equals(indexFlag)) {
|
|
||||||
coll.getIndexes().add(toAdd);
|
coll.getIndexes().add(toAdd);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
LOG.debug("Skipping invalid index ", e);
|
// Using the public centroid layer as default
|
||||||
} catch (Throwable t) {
|
if (coll.getIndexes().isEmpty()) {
|
||||||
LOG.error("Unable to check index ", t);
|
LOG.info("No available GIS Index for collection " + coll.getUcd().getName()
|
||||||
|
+ " with flag " + setIndexFlag.getId());
|
||||||
|
setIndexFlag = CENTROID_LAYER_INDEX_FLAG.PUBLIC;
|
||||||
|
LOG.info("Prevent fallback - getting the GIS index with flag '" + setIndexFlag.getId()
|
||||||
|
+ "' available");
|
||||||
|
toAdd = getLayerIndex(ucdConfig, setIndexFlag);
|
||||||
|
if (toAdd != null) {
|
||||||
|
coll.getIndexes().add(toAdd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return only if gis indexed
|
if (!coll.getIndexes().isEmpty())
|
||||||
if (coll.getIndexes().isEmpty())
|
|
||||||
LOG.info("No available GIS Index for collection " + coll.getUcd().getName());
|
|
||||||
else
|
|
||||||
config.getAvailableCollections().put(coll.getUcd().getId(), coll);
|
config.getAvailableCollections().put(coll.getUcd().getId(), coll);
|
||||||
|
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
|
@ -505,6 +564,151 @@ 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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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) {
|
||||||
|
|
||||||
|
for (Index index : ucdConfig.getIndexes()) {
|
||||||
|
try {
|
||||||
|
IndexLayerDV toAdd = ConvertToDataValueObjectModel.convert(index);
|
||||||
|
toAdd = removeGSWorkspaceFromWMSPathOfOGCLinks(toAdd);
|
||||||
|
LOG.trace("Discovered index: " + toAdd);
|
||||||
|
if (toAdd.getFlag().compareToIgnoreCase(flag.getId()) == 0) {
|
||||||
|
LOG.debug("Layer index found for flag: " + flag + ", returning");
|
||||||
|
return toAdd;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.debug("Skipping invalid index ", e);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
LOG.error("Unable to check index ", t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {}", StringUtil.ellipsize(wmsLink, 150));
|
||||||
|
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(), StringUtil.ellipsize(wmsLink, 150));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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.
|
||||||
*
|
*
|
||||||
|
@ -611,7 +815,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onBeforeRequestDeserialized(String serializedRequest) {
|
protected void onBeforeRequestDeserialized(String serializedRequest) {
|
||||||
LOG.info("onBeforeRequestDeserialized called");
|
LOG.debug("onBeforeRequestDeserialized called");
|
||||||
String scope = "";
|
String scope = "";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -776,7 +980,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
|
|
||||||
String filesetParentJSONPath = null;
|
String filesetParentJSONPath = null;
|
||||||
|
|
||||||
//(see ticket #24390)
|
// (see ticket #24390)
|
||||||
if (accessPolicy.equals(ACCESS_POLICY.OPEN)) {
|
if (accessPolicy.equals(ACCESS_POLICY.OPEN)) {
|
||||||
// Filtering for ACCESS_POLICY.OPEN from the fileset when the username is not in
|
// Filtering for ACCESS_POLICY.OPEN from the fileset when the username is not in
|
||||||
// session. IAM
|
// session. IAM
|
||||||
|
@ -995,7 +1199,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<GeoNaSpatialQueryResult> getDataResult(List<LayerObject> layerObjects, String mapSrsName,
|
public List<GeoportalSpatialQueryResult> getDataResult(List<LayerObject> layerObjects, String mapSrsName,
|
||||||
BoundsMap selectBBOX, int maxWFSFeature, double zoomLevel) throws Exception {
|
BoundsMap selectBBOX, int maxWFSFeature, double zoomLevel) throws Exception {
|
||||||
LOG.info("getDataResult called");
|
LOG.info("getDataResult called");
|
||||||
|
|
||||||
|
@ -1010,13 +1214,13 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
+ ", zoomLevel: " + zoomLevel);
|
+ ", zoomLevel: " + zoomLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<GeoNaSpatialQueryResult> listDAO = new ArrayList<GeoNaSpatialQueryResult>(layerObjects.size());
|
List<GeoportalSpatialQueryResult> listDAO = new ArrayList<GeoportalSpatialQueryResult>(layerObjects.size());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
|
new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
|
||||||
|
|
||||||
for (LayerObject layerObject : layerObjects) {
|
for (LayerObject layerObject : layerObjects) {
|
||||||
GeoNaSpatialQueryResult geoDAO = new GeoNaSpatialQueryResult();
|
GeoportalSpatialQueryResult geoDAO = new GeoportalSpatialQueryResult();
|
||||||
List<FeatureRow> features = FeatureParser.getWFSFeatures(layerObject.getLayerItem(), mapSrsName,
|
List<FeatureRow> features = FeatureParser.getWFSFeatures(layerObject.getLayerItem(), mapSrsName,
|
||||||
selectBBOX, maxWFSFeature);
|
selectBBOX, maxWFSFeature);
|
||||||
LOG.debug("For layer name: " + layerObject.getLayerItem().getName() + " got features: " + features);
|
LOG.debug("For layer name: " + layerObject.getLayerItem().getName() + " got features: " + features);
|
||||||
|
@ -1111,7 +1315,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
if (layerObject.getProjectDV().getTheDocument() == null) {
|
if (layerObject.getProjectDV().getTheDocument() == null) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
LinkedHashMap<String, String> documentAsMap = getEntrySetsDocumentForProjectID(
|
LinkedHashMap<String, Object> documentAsMap = getEntrySetsDocumentForProjectID(
|
||||||
layerObject.getProfileID(), layerObject.getProjectID(), 1);
|
layerObject.getProfileID(), layerObject.getProjectID(), 1);
|
||||||
DocumentDV documentDV = new DocumentDV();
|
DocumentDV documentDV = new DocumentDV();
|
||||||
documentDV.setDocumentAsMap(documentAsMap);
|
documentDV.setDocumentAsMap(documentAsMap);
|
||||||
|
@ -1207,7 +1411,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
});
|
});
|
||||||
|
|
||||||
if (loadDocument) {
|
if (loadDocument) {
|
||||||
LinkedHashMap<String, String> theDocument = getEntrySetsDocumentForProjectID(profileID, projectID,
|
LinkedHashMap<String, Object> theDocument = getEntrySetsDocumentForProjectID(profileID, projectID,
|
||||||
limitDocumentEntries);
|
limitDocumentEntries);
|
||||||
DocumentDV docDV = new DocumentDV();
|
DocumentDV docDV = new DocumentDV();
|
||||||
docDV.setDocumentAsMap(theDocument);
|
docDV.setDocumentAsMap(theDocument);
|
||||||
|
@ -1256,11 +1460,11 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
* @return the entry sets document for project ID
|
* @return the entry sets document for project ID
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public LinkedHashMap<String, String> getEntrySetsDocumentForProjectID(String profileID, String projectID,
|
public LinkedHashMap<String, Object> getEntrySetsDocumentForProjectID(String profileID, String projectID,
|
||||||
int limit) {
|
int limit) {
|
||||||
LOG.debug("called getEntrySetsDocumentForProjectID for profileID: " + profileID + ", projectID: " + projectID);
|
LOG.debug("called getEntrySetsDocumentForProjectID for profileID: " + profileID + ", projectID: " + projectID);
|
||||||
|
|
||||||
LinkedHashMap<String, String> documentAsMap = new LinkedHashMap<String, String>(limit);
|
LinkedHashMap<String, Object> documentAsMap = new LinkedHashMap<String, Object>(limit);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -1276,7 +1480,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
break;
|
break;
|
||||||
|
|
||||||
Entry<String, Object> entry = entrySetsIt.next();
|
Entry<String, Object> entry = entrySetsIt.next();
|
||||||
documentAsMap.put(entry.getKey(), entry.getValue()!=null?entry.getValue().toString():null);
|
documentAsMap.put(entry.getKey(), entry.getValue() != null ? entry.getValue().toString() : null);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1570,6 +1774,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.
|
||||||
*
|
*
|
||||||
|
@ -1591,39 +1811,42 @@ 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);
|
@Override
|
||||||
|
public Integer getCountFor(String profileID, String phase, String status) {
|
||||||
|
LOG.debug("getCountFor profileID: " + profileID + ", phase: " + phase + ", status: " + status + "called");
|
||||||
|
Integer integer = null;
|
||||||
try {
|
try {
|
||||||
URL obj = new URL(url);
|
new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
|
||||||
con = (HttpURLConnection) obj.openConnection();
|
integer = GeoportalClientCaller.projects().getCountByPhaseFor(profileID, phase, status);
|
||||||
con.setRequestMethod("GET");
|
LOG.info("getCountFor profileID: " + profileID + ", phase: " + phase + ", status: " + status
|
||||||
int responseCode = con.getResponseCode();
|
+ " returning: " + integer);
|
||||||
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) {
|
} catch (Exception e) {
|
||||||
LOG.error("Error on performing the request to URL: " + url, e);
|
LOG.error("Error occurred in getCountFor for profileID: " + profileID, e);
|
||||||
} finally {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return theResponseString;
|
return integer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean checkExportAsPDFConfig() {
|
||||||
|
LOG.debug("checkExportAsPDFConfig called");
|
||||||
|
Boolean configChecked = null;
|
||||||
|
try {
|
||||||
|
new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
|
||||||
|
configChecked = SessionUtil.getCheckConfigForPFDExporter(this.getThreadLocalRequest());
|
||||||
|
if(configChecked==null) {
|
||||||
|
Geoportal_PDF_Exporter gpdfe = new Geoportal_PDF_Exporter();
|
||||||
|
configChecked = gpdfe.checkConfig();
|
||||||
|
SessionUtil.setCheckConfigForPFDExporter(this.getThreadLocalRequest(), configChecked);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG.info("Does the 'Export As PDF' config exists? " + configChecked);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.error("Error occurred in checkExportAsPDFConfig", e);
|
||||||
|
}
|
||||||
|
return configChecked;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,257 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.server;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.http.client.methods.HttpGet;
|
||||||
|
import org.gcube.common.portal.PortalContext;
|
||||||
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.GeoportalServiceIdentityProxy;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
||||||
|
import org.gcube.portlets.user.uriresolvermanager.geoportal.GeoportalExporterAPI;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class GeoportalExporterActionServlet.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Apr 23, 2024
|
||||||
|
*/
|
||||||
|
public class GeoportalExporterActionServlet extends HttpServlet {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 6037090280489238565L;
|
||||||
|
protected static Logger logger = LoggerFactory.getLogger(GeoportalExporterActionServlet.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void init() throws ServletException {
|
||||||
|
super.init();
|
||||||
|
logger.trace(GeoportalExporterActionServlet.class.getSimpleName() + " ready.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||||
|
logger.info("doPost Called");
|
||||||
|
serveRequest(req, resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do get.
|
||||||
|
*
|
||||||
|
* @param req the req
|
||||||
|
* @param resp the resp
|
||||||
|
* @throws IOException Signals that an I/O exception has occurred.
|
||||||
|
* @throws ServletException the servlet exception
|
||||||
|
*/
|
||||||
|
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
|
||||||
|
logger.info("doGet Called");
|
||||||
|
sendError(resp,
|
||||||
|
"The request cannot be served (via http GET). Please retry by using the Export facility provided by Data-Viewer UI");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serve request.
|
||||||
|
*
|
||||||
|
* @param req the req
|
||||||
|
* @param resp the resp
|
||||||
|
* @throws IOException Signals that an I/O exception has occurred.
|
||||||
|
*/
|
||||||
|
public void serveRequest(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||||
|
// setSecretManager();
|
||||||
|
String projectID = req.getParameter(GeoportalDataViewerConstants.PROIECT_ID_PARAMETER);
|
||||||
|
String ucdID = req.getParameter(GeoportalDataViewerConstants.UCD_ID_PARAMETER);
|
||||||
|
String contextID = req.getParameter(GeoportalDataViewerConstants.CONTEXT_ID_PARAMETER);
|
||||||
|
String userID = req.getParameter(GeoportalDataViewerConstants.USER_ID_PARAMETER);
|
||||||
|
String username = req.getParameter(GeoportalDataViewerConstants.USERNAME_PARAMETER);
|
||||||
|
// logger.info("serveRequest called with [projectID: " + projectID + ", ucdID: " + ucdID + ", contextID: " + contextID+"]");
|
||||||
|
logger.info("serveRequest called with [projectID: " + projectID + ", ucdID: " + ucdID + ", contextID: "
|
||||||
|
+ contextID + ", userID: " + userID + ", username: " + username + "]");
|
||||||
|
|
||||||
|
if (contextID == null || contextID.isEmpty())
|
||||||
|
sendError(resp, "Bad Request. No context found!");
|
||||||
|
|
||||||
|
PortalContext pContext = PortalContext.getConfiguration();
|
||||||
|
String scope = pContext.getCurrentScope(contextID);
|
||||||
|
logger.info("The scope is {}", scope);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Setting header required to {@PortalContext}
|
||||||
|
MutableHttpServletRequest mutableRequest = new MutableHttpServletRequest(req);
|
||||||
|
mutableRequest.putHeader(PortalContext.VRE_ID_ATTR_NAME, contextID);
|
||||||
|
// DEV MODE
|
||||||
|
if (!SessionUtil.isIntoPortal()) {
|
||||||
|
logger.info("DEBUG MODE, putting header " + PortalContext.USER_ID_ATTR_NAME);
|
||||||
|
mutableRequest.putHeader(PortalContext.USER_ID_ATTR_NAME, userID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// IF USERNAME exists, add the userID to request. So performing the request to
|
||||||
|
// exporter service on behalf of the user.
|
||||||
|
if (username != null) {
|
||||||
|
logger.info("Username found, putting header " + PortalContext.USER_ID_ATTR_NAME);
|
||||||
|
mutableRequest.putHeader(PortalContext.USER_ID_ATTR_NAME, userID);
|
||||||
|
}
|
||||||
|
|
||||||
|
ScopeProvider.instance.set(scope);
|
||||||
|
GeoportalServiceIdentityProxy identity = new GeoportalServiceIdentityProxy(mutableRequest);
|
||||||
|
String theToken = identity.getToken();
|
||||||
|
String theIdentity = identity.getIdentity();
|
||||||
|
logger.info("The identity is {}", theIdentity);
|
||||||
|
|
||||||
|
GeoportalExporterAPI geoportalExporterAPI = new GeoportalExporterAPI();
|
||||||
|
URL urlRequest = geoportalExporterAPI.exportProject("pdf", ucdID, projectID, false);
|
||||||
|
String urlToRedirect = urlRequest.toString();
|
||||||
|
logger.info("Performing request to {} with identity description {}", urlToRedirect,
|
||||||
|
identity.getDescription());
|
||||||
|
logger.info("Token is {}", theToken.substring(0, 20) + "_MASKED_TOKEN");
|
||||||
|
|
||||||
|
InputStream is = performHttpRequestToSGService(urlToRedirect, theIdentity, theToken);
|
||||||
|
resp.setContentType("text/html; charset=utf-8");
|
||||||
|
IOUtils.copy(is, resp.getOutputStream());
|
||||||
|
resp.flushBuffer();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("Error occurred when exporting the Project with id: " + projectID, e);
|
||||||
|
sendError(resp, "Error occurred when exporting the Project. Error is: " + e.getMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Perform http request to SG service.
|
||||||
|
*
|
||||||
|
* @param urlToService the url to service
|
||||||
|
* @param identity the identity
|
||||||
|
* @param token the token
|
||||||
|
* @return the input stream
|
||||||
|
* @throws IOException Signals that an I/O exception has occurred.
|
||||||
|
*/
|
||||||
|
public static InputStream performHttpRequestToSGService(String urlToService, String identity, String token)
|
||||||
|
throws IOException {
|
||||||
|
logger.debug("performHttpRequestToSGService called");
|
||||||
|
try {
|
||||||
|
|
||||||
|
URL url = new URL(urlToService);
|
||||||
|
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||||
|
// timeout at 60sec
|
||||||
|
conn.setConnectTimeout(6000);
|
||||||
|
conn.setDoOutput(true);
|
||||||
|
|
||||||
|
if (token.length() > 50) {
|
||||||
|
// is JWT TOKEN
|
||||||
|
conn.setRequestProperty("Authorization", "Bearer " + token);
|
||||||
|
} else {
|
||||||
|
// is legacy Token
|
||||||
|
conn.setRequestProperty("gcube-token", token);
|
||||||
|
}
|
||||||
|
|
||||||
|
conn.setRequestProperty("Content-Type", "text/html");
|
||||||
|
conn.setRequestMethod("GET");
|
||||||
|
logger.debug("performHttpRequestToSGService done, returning");
|
||||||
|
return conn.getInputStream();
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.error("Error on performing request to url " + urlToService, e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the headers to target.
|
||||||
|
*
|
||||||
|
* @param httpSource the http source
|
||||||
|
* @param response the response
|
||||||
|
* @return the http servlet response
|
||||||
|
*/
|
||||||
|
public static HttpServletResponse setHeadersToTarget(HttpServletRequest httpSource, HttpServletResponse response) {
|
||||||
|
|
||||||
|
Enumeration<String> headersNames = httpSource.getHeaderNames();
|
||||||
|
while (headersNames.hasMoreElements()) {
|
||||||
|
String headerName = (String) headersNames.nextElement();
|
||||||
|
Enumeration<String> values = httpSource.getHeaders(headerName);
|
||||||
|
while (values.hasMoreElements()) {
|
||||||
|
String value = values.nextElement();
|
||||||
|
logger.info("Copying header {} with value {}", headerName, value);
|
||||||
|
response.addHeader(headerName, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the headers to target.
|
||||||
|
*
|
||||||
|
* @param httpSource the http source
|
||||||
|
* @param httpTarget the http target
|
||||||
|
* @return the http get
|
||||||
|
*/
|
||||||
|
public static HttpGet setHeadersToTarget(HttpServletRequest httpSource, HttpGet httpTarget) {
|
||||||
|
|
||||||
|
Enumeration<String> headersNames = httpSource.getHeaderNames();
|
||||||
|
while (headersNames.hasMoreElements()) {
|
||||||
|
String headerName = (String) headersNames.nextElement();
|
||||||
|
Enumeration<String> values = httpSource.getHeaders(headerName);
|
||||||
|
while (values.hasMoreElements()) {
|
||||||
|
String value = values.nextElement();
|
||||||
|
logger.info("Copying header {} with value {}", headerName, value);
|
||||||
|
httpTarget.addHeader(headerName, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return httpTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the headers to response.
|
||||||
|
*
|
||||||
|
* @param httpSource the http source
|
||||||
|
* @param httpTarget the http target
|
||||||
|
* @return the http get
|
||||||
|
*/
|
||||||
|
public static HttpGet setHeadersToResponse(HttpServletRequest httpSource, HttpGet httpTarget) {
|
||||||
|
|
||||||
|
Enumeration<String> headersNames = httpSource.getHeaderNames();
|
||||||
|
while (headersNames.hasMoreElements()) {
|
||||||
|
String headerName = (String) headersNames.nextElement();
|
||||||
|
Enumeration<String> values = httpSource.getHeaders(headerName);
|
||||||
|
while (values.hasMoreElements()) {
|
||||||
|
String value = values.nextElement();
|
||||||
|
logger.info("Copying header {} with value {}", headerName, value);
|
||||||
|
httpTarget.addHeader(headerName, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return httpTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send response.
|
||||||
|
*
|
||||||
|
* @param response the response
|
||||||
|
* @param message the message
|
||||||
|
* @throws IOException Signals that an I/O exception has occurred.
|
||||||
|
*/
|
||||||
|
protected void sendError(HttpServletResponse response, String message) throws IOException {
|
||||||
|
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||||
|
response.setContentType("text/html");
|
||||||
|
response.getWriter().write("<html><head><title>Error</title></head><body>" + message + "</body></html>");
|
||||||
|
response.flushBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,53 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.server;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletRequestWrapper;
|
||||||
|
|
||||||
|
final class MutableHttpServletRequest extends HttpServletRequestWrapper {
|
||||||
|
// holds custom header and value mapping
|
||||||
|
private final Map<String, String> customHeaders;
|
||||||
|
|
||||||
|
public MutableHttpServletRequest(HttpServletRequest request){
|
||||||
|
super(request);
|
||||||
|
this.customHeaders = new HashMap<String, String>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void putHeader(String name, String value){
|
||||||
|
this.customHeaders.put(name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHeader(String name) {
|
||||||
|
// check the custom headers first
|
||||||
|
String headerValue = customHeaders.get(name);
|
||||||
|
|
||||||
|
if (headerValue != null){
|
||||||
|
return headerValue;
|
||||||
|
}
|
||||||
|
// else return from into the original wrapped object
|
||||||
|
return ((HttpServletRequest) getRequest()).getHeader(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Enumeration<String> getHeaderNames() {
|
||||||
|
// create a set of the custom header names
|
||||||
|
Set<String> set = new HashSet<String>(customHeaders.keySet());
|
||||||
|
|
||||||
|
// now add the headers from the wrapped request object
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
Enumeration<String> e = ((HttpServletRequest) getRequest()).getHeaderNames();
|
||||||
|
while (e.hasMoreElements()) {
|
||||||
|
// add the names of the request headers into the list
|
||||||
|
String n = e.nextElement();
|
||||||
|
set.add(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
// create an enumeration from the set and return
|
||||||
|
return Collections.enumeration(set);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
@ -60,8 +61,8 @@ public class GisMakers {
|
||||||
public static String buildWFSFeatureQuery(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX,
|
public static String buildWFSFeatureQuery(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX,
|
||||||
int maxFeatures, String outputFormat) {
|
int maxFeatures, String outputFormat) {
|
||||||
|
|
||||||
String link = layerItem.getMapServerHost();
|
String link = layerItem.getMapServerEndpoint();
|
||||||
LOG.debug("Map server host URL: " + link);
|
LOG.debug("Map server endpoint: " + link);
|
||||||
LOG.debug("CQL filter is: " + layerItem.getCqlFilter());
|
LOG.debug("CQL filter is: " + layerItem.getCqlFilter());
|
||||||
LOG.debug("MAX FEATURES: " + maxFeatures);
|
LOG.debug("MAX FEATURES: " + maxFeatures);
|
||||||
LOG.debug("BBOX: " + mapBBOX);
|
LOG.debug("BBOX: " + mapBBOX);
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
@ -26,7 +24,7 @@ public class WMSUrlValidator {
|
||||||
private static final String OWS = "ows";
|
private static final String OWS = "ows";
|
||||||
private HashMap<String, String> parametersValue = new HashMap<String, String>();
|
private HashMap<String, String> parametersValue = new HashMap<String, String>();
|
||||||
private String wmsRequestURI;
|
private String wmsRequestURI;
|
||||||
private String wmsServiceHost;
|
private String wmsServiceEndPoint;
|
||||||
private String layerName;
|
private String layerName;
|
||||||
|
|
||||||
private String wmsNoStandardParameters = "";
|
private String wmsNoStandardParameters = "";
|
||||||
|
@ -35,7 +33,6 @@ 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.
|
||||||
*
|
*
|
||||||
|
@ -43,57 +40,52 @@ public class WMSUrlValidator {
|
||||||
* @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);
|
|
||||||
WebMapServerHost webMapServerHost;
|
|
||||||
|
|
||||||
//IS WMS?
|
|
||||||
if(GeoWmsServiceUtility.isWMSService(wmsRequestURI)){
|
|
||||||
LOG.trace("found "+GeoWmsServiceUtility.SERVICE_WMS+" in wms request: "+wmsRequestURI);
|
|
||||||
webMapServerHost = getWebMapServerHost(wmsRequestURI);
|
|
||||||
}else
|
|
||||||
throw new Exception("WMS service not found for layer: "+inputLayerName);
|
|
||||||
|
|
||||||
//VALIDATION WMS
|
|
||||||
String baseWmsService = webMapServerHost.getHost();
|
|
||||||
//IS OWS OR WMS?
|
|
||||||
this.wmsServiceHost = appendWmsServiceToBaseUrl(wmsRequest.substring(0, wmsRequest.indexOf("?")),isOwsService);
|
|
||||||
this.layerName = inputLayerName;
|
|
||||||
|
|
||||||
|
// VALIDATION WMS
|
||||||
|
int endpointLastCharIndex = wmsRequest.lastIndexOf("?");
|
||||||
|
// No '?' char found
|
||||||
|
if (endpointLastCharIndex == -1) {
|
||||||
|
LOG.info("Char '?' not found, setting last index the end of the URI");
|
||||||
|
endpointLastCharIndex = wmsRequest.length();
|
||||||
|
}
|
||||||
|
String readWMSServiceEndpoint = wmsRequest.substring(0, endpointLastCharIndex);
|
||||||
|
this.wmsServiceEndPoint = readWMSServiceEndpoint;
|
||||||
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.wmsServiceEndPoint, true)) {
|
||||||
LOG.info("baseWmsServiceUrl: "+wmsServiceHost +" is not a geoserver, setting as input base wms server: "+baseWmsService);
|
LOG.warn("baseWmsServiceUrl: " + wmsServiceEndPoint + " is not valid URL!!");
|
||||||
this.wmsServiceHost = baseWmsService;
|
this.wmsServiceEndPoint = readWMSServiceEndpoint;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("error on validating geoserver wms service: "+e);
|
LOG.error("Error on validating the endpoint: " + this.wmsServiceEndPoint, e);
|
||||||
LOG.info("setting baseWmsService as input base wms server: "+baseWmsService);
|
boolean isOwsService = GeoWmsServiceUtility.isOWSSerice(this.wmsRequestURI);
|
||||||
this.wmsServiceHost = baseWmsService;
|
LOG.info("Retrying by appending suffix WMS or WFS...");
|
||||||
|
this.wmsServiceEndPoint = appendWmsServiceToBaseUrl(readWMSServiceEndpoint, isOwsService);
|
||||||
}
|
}
|
||||||
|
|
||||||
//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");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG.info("WMSURLValidator found endpoint: " + wmsServiceEndPoint);
|
||||||
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.
|
||||||
*
|
*
|
||||||
|
@ -101,34 +93,35 @@ public class WMSUrlValidator {
|
||||||
* @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,106 +131,108 @@ 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 end point.
|
||||||
*
|
*
|
||||||
* @return the wms service host
|
* @return the wms service end point
|
||||||
*/
|
*/
|
||||||
public String getWmsServiceHost() {
|
public String getWmsServiceEndPoint() {
|
||||||
|
|
||||||
return wmsServiceHost;
|
return wmsServiceEndPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -260,19 +255,17 @@ 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.
|
||||||
*
|
*
|
||||||
|
@ -280,12 +273,11 @@ public class WMSUrlValidator {
|
||||||
* @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.
|
||||||
*
|
*
|
||||||
|
@ -295,7 +287,8 @@ public class WMSUrlValidator {
|
||||||
* @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 +302,6 @@ public class WMSUrlValidator {
|
||||||
return layerName;
|
return layerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the styles as list.
|
* Gets the styles as list.
|
||||||
*
|
*
|
||||||
|
@ -321,18 +312,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 +332,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();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,66 +0,0 @@
|
||||||
//package org.gcube.portlets.user.geoportaldataviewer.server.mongoservice;
|
|
||||||
//
|
|
||||||
//import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni;
|
|
||||||
//
|
|
||||||
//import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
|
|
||||||
//import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
|
||||||
//import org.slf4j.Logger;
|
|
||||||
//import org.slf4j.LoggerFactory;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * The Class ConcessioniMongoService.
|
|
||||||
// *
|
|
||||||
// * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
|
||||||
// *
|
|
||||||
// * Sep 23, 2021
|
|
||||||
// */
|
|
||||||
//public class ConcessioniMongoService {
|
|
||||||
//
|
|
||||||
// private static final Logger LOG = LoggerFactory.getLogger(ConcessioniMongoService.class);
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * Instantiates a new concessioni mongo service.
|
|
||||||
// */
|
|
||||||
// protected ConcessioniMongoService() {
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * Gets the item by id.
|
|
||||||
// *
|
|
||||||
// * @param mongoItemId the mongo item id
|
|
||||||
// * @return the item by id
|
|
||||||
// * @throws Exception the exception
|
|
||||||
// */
|
|
||||||
// protected Concessione getItemById(String mongoItemId) throws Exception {
|
|
||||||
// LOG.info("called getItemById: " + mongoItemId);
|
|
||||||
// ConcessioniManagerI concessioniManager = statefulMongoConcessioni().build();
|
|
||||||
// // Returning item by Id
|
|
||||||
// return concessioniManager.getById(mongoItemId);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * To concessione.
|
|
||||||
// *
|
|
||||||
// * @param jsonString the json string
|
|
||||||
// * @return the concessione
|
|
||||||
// */
|
|
||||||
// protected Concessione toConcessione(String jsonString) {
|
|
||||||
// LOG.info("toConcessione called");
|
|
||||||
// try {
|
|
||||||
// return org.gcube.application.geoportal.client.utils.Serialization.read(jsonString, Concessione.class);
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// LOG.warn("Error on serializing: ", e);
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * For testing public Concessione iamClientGetItemBy(HttpServletRequest request,
|
|
||||||
// * String mongoItemId, String clientId, String secret) throws Exception { String
|
|
||||||
// * scope = SessionUtil.getCurrentContext(request, true); return
|
|
||||||
// * iamClientGetItemBy(scope, mongoItemId, clientId, secret); }
|
|
||||||
// */
|
|
||||||
//
|
|
||||||
//}
|
|
|
@ -65,4 +65,16 @@ public class GeoportalServiceIdentityProxy {
|
||||||
public boolean isIAMClient() {
|
public boolean isIAMClient() {
|
||||||
return isIAMClient;
|
return isIAMClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return gCubeIdentity.getIdentityDescription();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getToken() {
|
||||||
|
return gCubeIdentity.getToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIdentity() {
|
||||||
|
return gCubeIdentity.getIdentity();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.accessid
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Interface GcubeIdentity.
|
* The Interface GcubeIdentity.
|
||||||
*
|
*
|
||||||
|
@ -25,4 +24,26 @@ public interface GcubeIdentity {
|
||||||
*/
|
*/
|
||||||
public void resetIdentity();
|
public void resetIdentity();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the identity description.
|
||||||
|
*
|
||||||
|
* @return the identity description
|
||||||
|
*/
|
||||||
|
public String getIdentityDescription();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the identity.
|
||||||
|
*
|
||||||
|
* @return the identity
|
||||||
|
*/
|
||||||
|
public String getIdentity();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the token.
|
||||||
|
*
|
||||||
|
* @return the token
|
||||||
|
*/
|
||||||
|
public String getToken();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,17 +17,22 @@ public class IAMClientIdentity implements GcubeIdentity {
|
||||||
|
|
||||||
private String previousUMAToken = null;
|
private String previousUMAToken = null;
|
||||||
|
|
||||||
|
private String currentUMAToken = null;
|
||||||
|
|
||||||
|
private String clientId = null;
|
||||||
|
|
||||||
private static final String IAM_CLIENT_CREDENTIALS = "IAM_CLIENT_CREDENTIALS";
|
private static final String IAM_CLIENT_CREDENTIALS = "IAM_CLIENT_CREDENTIALS";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIdentity(HttpServletRequest httpRequest) throws Exception {
|
public void setIdentity(HttpServletRequest httpRequest) throws Exception {
|
||||||
LOG.info("setIdentity called");
|
LOG.info("setIdentity called");
|
||||||
String currentScope = SessionUtil.getCurrentContext(httpRequest, true);
|
String currentScope = SessionUtil.getCurrentContext(httpRequest, true);
|
||||||
|
LOG.info("the scope is {}", currentScope);
|
||||||
IAMClientCredentials credentials = sessionGetIAMClientCredentials(httpRequest);
|
IAMClientCredentials credentials = sessionGetIAMClientCredentials(httpRequest);
|
||||||
try {
|
try {
|
||||||
if(credentials==null) {
|
if (credentials == null) {
|
||||||
credentials = IAMClientCredentialsReader.getCredentials();
|
credentials = IAMClientCredentialsReader.getCredentials();
|
||||||
sessionSetIAMClientCredentials(httpRequest,credentials);
|
sessionSetIAMClientCredentials(httpRequest, credentials);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Error on discovering IAM Client credentials", e);
|
LOG.error("Error on discovering IAM Client credentials", e);
|
||||||
|
@ -35,16 +40,16 @@ public class IAMClientIdentity implements GcubeIdentity {
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.trace("Read credentials: " + credentials);
|
LOG.trace("Read credentials: " + credentials);
|
||||||
String umaAcessToken = null;
|
clientId = credentials.getClientId();
|
||||||
String clientId = credentials.getClientId();
|
|
||||||
String clientSecret = credentials.getClientSecret();
|
String clientSecret = credentials.getClientSecret();
|
||||||
try {
|
try {
|
||||||
|
|
||||||
LOG.info("Querying KeycloakClientFactory to get UMA token..");
|
LOG.info("Querying KeycloakClientFactory to get UMA token..");
|
||||||
TokenResponse tr = KeycloakClientFactory.newInstance().queryUMAToken(clientId, clientSecret, currentScope,
|
TokenResponse tr = KeycloakClientFactory.newInstance().queryUMAToken(currentScope, clientId, clientSecret, currentScope,
|
||||||
null);
|
null);
|
||||||
umaAcessToken = tr.getAccessToken();
|
|
||||||
if (umaAcessToken != null && !umaAcessToken.isEmpty()) {
|
currentUMAToken = tr.getAccessToken();
|
||||||
|
if (currentUMAToken != null && !currentUMAToken.isEmpty()) {
|
||||||
LOG.info("UMA Access Token read correctly");
|
LOG.info("UMA Access Token read correctly");
|
||||||
} else {
|
} else {
|
||||||
LOG.error("UMA Access Token NOT RETRIEVED!!!");
|
LOG.error("UMA Access Token NOT RETRIEVED!!!");
|
||||||
|
@ -56,6 +61,8 @@ public class IAMClientIdentity implements GcubeIdentity {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
LOG.debug("JWT token: " + currentUMAToken.substring(0, 20) + "_MASKED_TOKEN_");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Here the previousUMAToken should be null
|
// Here the previousUMAToken should be null
|
||||||
previousUMAToken = AccessTokenProvider.instance.get();
|
previousUMAToken = AccessTokenProvider.instance.get();
|
||||||
|
@ -64,10 +71,9 @@ public class IAMClientIdentity implements GcubeIdentity {
|
||||||
// silent
|
// silent
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.debug("JWT token: " + umaAcessToken.substring(0, 20) + "_MASKED_TOKEN_");
|
|
||||||
LOG.info("Setting clientId '" + clientId + "' identity by JWT token in the "
|
LOG.info("Setting clientId '" + clientId + "' identity by JWT token in the "
|
||||||
+ AccessTokenProvider.class.getSimpleName());
|
+ AccessTokenProvider.class.getSimpleName());
|
||||||
AccessTokenProvider.instance.set(umaAcessToken);
|
AccessTokenProvider.instance.set(currentUMAToken);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error(e.getMessage(), e);
|
LOG.error(e.getMessage(), e);
|
||||||
throw new Exception(e.getMessage());
|
throw new Exception(e.getMessage());
|
||||||
|
@ -75,6 +81,11 @@ public class IAMClientIdentity implements GcubeIdentity {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getToken() {
|
||||||
|
return currentUMAToken;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resetIdentity() {
|
public void resetIdentity() {
|
||||||
LOG.info("resetIdentity called");
|
LOG.info("resetIdentity called");
|
||||||
|
@ -114,4 +125,15 @@ public class IAMClientIdentity implements GcubeIdentity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdentityDescription() {
|
||||||
|
return "ClientId: " + clientId;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdentity() {
|
||||||
|
return clientId;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.accessid
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
||||||
|
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -10,13 +11,19 @@ public class UserIdentity implements GcubeIdentity {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(UserIdentity.class);
|
private static final Logger LOG = LoggerFactory.getLogger(UserIdentity.class);
|
||||||
|
|
||||||
|
private HttpServletRequest httpRequest;
|
||||||
|
|
||||||
|
private GCubeUser user;
|
||||||
|
|
||||||
public UserIdentity() {
|
public UserIdentity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIdentity(HttpServletRequest httpRequest) throws Exception {
|
public void setIdentity(HttpServletRequest httpRequest) throws Exception {
|
||||||
LOG.info("setIdentity called");
|
LOG.info("setIdentity called");
|
||||||
SessionUtil.getCurrentToken(httpRequest, true);
|
this.httpRequest = httpRequest;
|
||||||
|
SessionUtil.getCurrentToken(this.httpRequest, true);
|
||||||
|
user = SessionUtil.getCurrentUser(this.httpRequest);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,4 +32,20 @@ public class UserIdentity implements GcubeIdentity {
|
||||||
LOG.info("resetIdentity called, doing nothing");
|
LOG.info("resetIdentity called, doing nothing");
|
||||||
// doing nothing
|
// doing nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getToken() {
|
||||||
|
return SessionUtil.getCurrentToken(this.httpRequest, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdentityDescription() {
|
||||||
|
return user != null ? "user: " + user.getUsername() : "null";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdentity() {
|
||||||
|
return user.getUsername();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,93 +0,0 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.accesspolicy;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Class GeoNACheckAccessPolicy.
|
|
||||||
*
|
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
|
||||||
*
|
|
||||||
* Sep 9, 2021
|
|
||||||
*/
|
|
||||||
public class GeoNACheckAccessPolicy {
|
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(GeoNACheckAccessPolicy.class);
|
|
||||||
/**
|
|
||||||
* The Enum ACCESS_POLICY.
|
|
||||||
*
|
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
|
||||||
*
|
|
||||||
* Sep 8, 2021
|
|
||||||
*/
|
|
||||||
public static enum ACCESS_POLICY {
|
|
||||||
OPEN, RESTICTED
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if is open access.
|
|
||||||
*
|
|
||||||
* @param policy the policy
|
|
||||||
* @return true, if is open access
|
|
||||||
*/
|
|
||||||
private static boolean isOpenAccess(String policy) {
|
|
||||||
if (policy == null || policy.equalsIgnoreCase(ACCESS_POLICY.OPEN.name())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if is restricted access.
|
|
||||||
*
|
|
||||||
* @param policy the policy
|
|
||||||
* @return true, if is restricted access
|
|
||||||
*/
|
|
||||||
private static boolean isRestrictedAccess(String policy) {
|
|
||||||
if (policy == null || policy.equalsIgnoreCase(ACCESS_POLICY.RESTICTED.name())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if is accessible accoding to access policies
|
|
||||||
*
|
|
||||||
* @param policy the policy
|
|
||||||
* @param myLogin the my login
|
|
||||||
* @return true, if is accessible
|
|
||||||
*/
|
|
||||||
public static boolean isAccessible(String policy, String myLogin) {
|
|
||||||
|
|
||||||
boolean bool = isOpenAccess(policy);
|
|
||||||
|
|
||||||
if (bool) {
|
|
||||||
// is open access
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//From here managing is NOT OPEN access
|
|
||||||
|
|
||||||
if (myLogin == null || myLogin.isEmpty()) {
|
|
||||||
// here is not open and the user is not authenticated
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Here the login is not null, so checking if the access to item is RESTICTED
|
|
||||||
bool = isRestrictedAccess(policy);
|
|
||||||
|
|
||||||
if (bool) {
|
|
||||||
// is restricted access
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Here the user is authenticated, but the policy is not managed, so returning
|
|
||||||
// true
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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,10 @@ 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";
|
||||||
|
|
||||||
|
private static final String CHECKED_CONFIG_FOR_PDF_EXPORTER = "CHECKED_CONFIG_FOR_PDF_EXPORTER";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is into portal.
|
* Checks if is into portal.
|
||||||
*
|
*
|
||||||
|
@ -136,7 +142,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 +279,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 +331,30 @@ 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getCheckConfigForPFDExporter(HttpServletRequest httpServletRequest) {
|
||||||
|
HttpSession session = httpServletRequest.getSession();
|
||||||
|
return (Boolean) session.getAttribute(CHECKED_CONFIG_FOR_PDF_EXPORTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setCheckConfigForPFDExporter(HttpServletRequest httpServletRequest, Boolean configChecked) {
|
||||||
|
HttpSession session = httpServletRequest.getSession();
|
||||||
|
session.setAttribute(CHECKED_CONFIG_FOR_PDF_EXPORTER, configChecked);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package org.gcube.portlets.user.geoportaldataviewer.server.util;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoportalSpatialQueryResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class TemporalComparatorUtil.
|
* The Class TemporalComparatorUtil.
|
||||||
|
@ -12,7 +12,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResul
|
||||||
*
|
*
|
||||||
* Nov 18, 2022
|
* Nov 18, 2022
|
||||||
*/
|
*/
|
||||||
public class TemporalComparatorUtil implements Comparator<GeoNaSpatialQueryResult> {
|
public class TemporalComparatorUtil implements Comparator<GeoportalSpatialQueryResult> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare.
|
* Compare.
|
||||||
|
@ -22,7 +22,7 @@ public class TemporalComparatorUtil implements Comparator<GeoNaSpatialQueryResul
|
||||||
* @return the int
|
* @return the int
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int compare(GeoNaSpatialQueryResult a, GeoNaSpatialQueryResult b) {
|
public int compare(GeoportalSpatialQueryResult a, GeoportalSpatialQueryResult b) {
|
||||||
if (a == null || a.getSourceLayerObject() == null || a.getSourceLayerObject().getProjectDV() == null) {
|
if (a == null || a.getSourceLayerObject() == null || a.getSourceLayerObject().getProjectDV() == null) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
||||||
*
|
*
|
||||||
|
|
|
@ -9,13 +9,13 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class GeoNaSpatialQueryResult.
|
* The Class GeoportalSpatialQueryResult.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
* Jul 30, 2021
|
* Jul 30, 2021
|
||||||
*/
|
*/
|
||||||
public class GeoNaSpatialQueryResult implements Serializable {
|
public class GeoportalSpatialQueryResult implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -23,27 +23,17 @@ public class GeoNaSpatialQueryResult implements Serializable {
|
||||||
private static final long serialVersionUID = 3513120677727206958L;
|
private static final long serialVersionUID = 3513120677727206958L;
|
||||||
private List<FeatureRow> features;
|
private List<FeatureRow> features;
|
||||||
private LayerObject sourceLayerObject;
|
private LayerObject sourceLayerObject;
|
||||||
// Map with couple (mongoId concessione, list of uploaded GNAImages for the
|
// Map with couple (mongoId project, list of uploaded GeoportalImages for the
|
||||||
// concessione)
|
// project)
|
||||||
private Map<String, List<PayloadDV>> mapImages = null;
|
private Map<String, List<PayloadDV>> mapImages = null;
|
||||||
// private ProjectDV projectDV;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new geo na data object.
|
* Instantiates a new geo na data object.
|
||||||
*/
|
*/
|
||||||
public GeoNaSpatialQueryResult() {
|
public GeoportalSpatialQueryResult() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void setProjectDV(ProjectDV projectDV) {
|
|
||||||
// this.projectDV = projectDV;
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public ProjectDV getProjectDV() {
|
|
||||||
// return projectDV;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the features.
|
* Gets the features.
|
||||||
*
|
*
|
||||||
|
@ -101,7 +91,7 @@ public class GeoNaSpatialQueryResult implements Serializable {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append("GeoNaSpatialQueryResult [features=");
|
builder.append("GeoportalSpatialQueryResult [features=");
|
||||||
builder.append(features);
|
builder.append(features);
|
||||||
builder.append(", sourceLayerObject=");
|
builder.append(", sourceLayerObject=");
|
||||||
builder.append(sourceLayerObject);
|
builder.append(sourceLayerObject);
|
|
@ -1,131 +0,0 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.shared;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.FilesetDV;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV;
|
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.CategoryWrapper;
|
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
|
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetadataFieldWrapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Class MetaDataProfileBeanExt.
|
|
||||||
*
|
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
|
||||||
*
|
|
||||||
* Nov 23, 2022
|
|
||||||
*/
|
|
||||||
public class MetaDataProfileBeanExt extends MetaDataProfileBean implements Cloneable {
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 2518128223147908835L;
|
|
||||||
private List<FilesetDV> listFileset = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new meta data profile bean ext.
|
|
||||||
*/
|
|
||||||
public MetaDataProfileBeanExt() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new meta data profile bean ext.
|
|
||||||
*
|
|
||||||
* @param type the type
|
|
||||||
* @param title the title
|
|
||||||
* @param metadataFields the metadata fields
|
|
||||||
* @param categories the categories
|
|
||||||
*/
|
|
||||||
public MetaDataProfileBeanExt(String type, String title, List<MetadataFieldWrapper> metadataFields,
|
|
||||||
List<CategoryWrapper> categories) {
|
|
||||||
super(type, title, metadataFields, categories);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the list fileset.
|
|
||||||
*
|
|
||||||
* @return the list fileset
|
|
||||||
*/
|
|
||||||
public List<FilesetDV> getListFileset() {
|
|
||||||
if (listFileset == null)
|
|
||||||
listFileset = new ArrayList<FilesetDV>();
|
|
||||||
return listFileset;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the list fileset.
|
|
||||||
*
|
|
||||||
* @param listFileset the new list fileset
|
|
||||||
*/
|
|
||||||
public void setListFileset(List<FilesetDV> listFileset) {
|
|
||||||
this.listFileset = listFileset;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected MetaDataProfileBeanExt clone() throws CloneNotSupportedException {
|
|
||||||
|
|
||||||
MetaDataProfileBeanExt clonedMDPBE = new MetaDataProfileBeanExt();
|
|
||||||
clonedMDPBE.setTitle(this.getTitle());
|
|
||||||
clonedMDPBE.setType(this.getType());
|
|
||||||
ArrayList<FilesetDV> newListFileset = new ArrayList<FilesetDV>();
|
|
||||||
for (FilesetDV filesetDV : this.getListFileset()) {
|
|
||||||
FilesetDV newFileset = new FilesetDV();
|
|
||||||
for (PayloadDV payloadDV : filesetDV.getListPayload()) {
|
|
||||||
PayloadDV newPayloadDV = new PayloadDV();
|
|
||||||
newPayloadDV.setLink(payloadDV.getLink());
|
|
||||||
newPayloadDV.setMimetype(payloadDV.getMimetype());
|
|
||||||
newPayloadDV.setName(payloadDV.getName());
|
|
||||||
newPayloadDV.setStorageID(payloadDV.getStorageID());
|
|
||||||
newFileset.addPayloadDV(newPayloadDV);
|
|
||||||
}
|
|
||||||
|
|
||||||
newListFileset.add(newFileset);
|
|
||||||
}
|
|
||||||
clonedMDPBE.setListFileset(newListFileset);
|
|
||||||
|
|
||||||
ArrayList<MetadataFieldWrapper> newListMetadataFieldWrapper = new ArrayList<MetadataFieldWrapper>();
|
|
||||||
|
|
||||||
for (MetadataFieldWrapper mfw : this.getMetadataFields()) {
|
|
||||||
MetadataFieldWrapper newMfw = new MetadataFieldWrapper();
|
|
||||||
newMfw.setAsGroup(mfw.getAsGroup());
|
|
||||||
newMfw.setAsTag(mfw.getAsTag());
|
|
||||||
newMfw.setCurrentValue(mfw.getCurrentValue());
|
|
||||||
newMfw.setDefaultValue(mfw.getDefaultValue());
|
|
||||||
newMfw.setFieldId(mfw.getFieldId());
|
|
||||||
newMfw.setFieldName(mfw.getFieldName());
|
|
||||||
newMfw.setFieldNameFromCategory(mfw.getFieldNameFromCategory());
|
|
||||||
newMfw.setMandatory(mfw.getMandatory());
|
|
||||||
newMfw.setMaxOccurs(mfw.getMaxOccurs());
|
|
||||||
newMfw.setMultiSelection(mfw.isMultiSelection());
|
|
||||||
newMfw.setNote(mfw.getNote());
|
|
||||||
newMfw.setOwnerCategory(mfw.getOwnerCategory());
|
|
||||||
newMfw.setType(mfw.getType());
|
|
||||||
newMfw.setValidator(mfw.getValidator());
|
|
||||||
newMfw.setVocabulary(mfw.getVocabulary());
|
|
||||||
|
|
||||||
newListMetadataFieldWrapper.add(newMfw);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
clonedMDPBE.setMetadataFields(newListMetadataFieldWrapper);
|
|
||||||
|
|
||||||
return clonedMDPBE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
builder.append("MetaDataProfileBeanExt [getType()=");
|
|
||||||
builder.append(getType());
|
|
||||||
builder.append(", getTitle()=");
|
|
||||||
builder.append(getTitle());
|
|
||||||
builder.append(", getMetadataFields()=");
|
|
||||||
builder.append(getMetadataFields());
|
|
||||||
builder.append("]");
|
|
||||||
return builder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,50 +0,0 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.shared;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
|
||||||
|
|
||||||
public class ProjectEdit implements Serializable {
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 2885327516680245601L;
|
|
||||||
|
|
||||||
private ProjectDV theProjectDV;
|
|
||||||
|
|
||||||
private List<MetaDataProfileBeanExt> theProfileBeans;
|
|
||||||
|
|
||||||
public ProjectEdit() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProjectDV getTheProjectDV() {
|
|
||||||
return theProjectDV;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MetaDataProfileBeanExt> getTheProfileBeans() {
|
|
||||||
return theProfileBeans;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTheProjectDV(ProjectDV theProjectDV) {
|
|
||||||
this.theProjectDV = theProjectDV;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTheProfileBeans(List<MetaDataProfileBeanExt> theProfileBeans) {
|
|
||||||
this.theProfileBeans = theProfileBeans;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
builder.append("ProjectEdit [theProjectDV=");
|
|
||||||
builder.append(theProjectDV);
|
|
||||||
builder.append(", theProfileBeans=");
|
|
||||||
builder.append(theProfileBeans);
|
|
||||||
builder.append("]");
|
|
||||||
return builder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -2,18 +2,13 @@ package org.gcube.portlets.user.geoportaldataviewer.shared.gis;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.LayerType;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.Property;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.Property;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class LayerItem.
|
* The Class LayerItem.
|
||||||
*
|
*
|
||||||
|
@ -23,7 +18,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;
|
||||||
|
|
||||||
|
@ -37,7 +31,7 @@ public class LayerItem implements Serializable, Cloneable {
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
/** The base map server URL. */
|
/** The base map server URL. */
|
||||||
private String mapServerHost;
|
private String mapServerEndpoint;
|
||||||
|
|
||||||
/** The style. */
|
/** The style. */
|
||||||
private String style;
|
private String style;
|
||||||
|
@ -102,9 +96,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 +747,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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -787,21 +769,21 @@ public class LayerItem implements Serializable, Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the map server host.
|
* Gets the map server endpoint.
|
||||||
*
|
*
|
||||||
* @return the map server host
|
* @return the map server endpoint
|
||||||
*/
|
*/
|
||||||
public String getMapServerHost() {
|
public String getMapServerEndpoint() {
|
||||||
return mapServerHost;
|
return mapServerEndpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the map server host.
|
* Sets the map server host.
|
||||||
*
|
*
|
||||||
* @param mapServerHost the new map server host
|
* @param mapServerEndpoint the new map server host
|
||||||
*/
|
*/
|
||||||
public void setMapServerHost(String mapServerHost) {
|
public void setMapServerHost(String mapServerEndpoint) {
|
||||||
this.mapServerHost = mapServerHost;
|
this.mapServerEndpoint = mapServerEndpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -908,8 +890,8 @@ public class LayerItem implements Serializable, Cloneable {
|
||||||
builder.append(title);
|
builder.append(title);
|
||||||
builder.append(", url=");
|
builder.append(", url=");
|
||||||
builder.append(url);
|
builder.append(url);
|
||||||
builder.append(", mapServerHost=");
|
builder.append(", mapServerEndpoint=");
|
||||||
builder.append(mapServerHost);
|
builder.append(mapServerEndpoint);
|
||||||
builder.append(", style=");
|
builder.append(", style=");
|
||||||
builder.append(style);
|
builder.append(style);
|
||||||
builder.append(", isTrasparent=");
|
builder.append(", isTrasparent=");
|
||||||
|
@ -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,92 +948,4 @@ public class LayerItem implements Serializable, Cloneable {
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* To layer item.
|
|
||||||
*
|
|
||||||
* @param layerType the layer type
|
|
||||||
* @param layerTitle the layer title
|
|
||||||
* @param layerName the layer name
|
|
||||||
* @param layerURL the layer URL
|
|
||||||
* @param mapServerHost the map server host
|
|
||||||
* @param isExternal the is external
|
|
||||||
* @param isBase the is base
|
|
||||||
* @param displayInLayerSwitcher the display in layer switcher
|
|
||||||
* @param styles the styles
|
|
||||||
* @param wmsLink the wms link
|
|
||||||
* @param onTop the on top
|
|
||||||
* @param wmsNotStandardParams the wms not standard params
|
|
||||||
* @param isNcWms the is nc wms
|
|
||||||
* @param UUID the uuid
|
|
||||||
* @param zAxis the z axis
|
|
||||||
* @param minResolution the min resolution
|
|
||||||
* @param maxResolution the max resolution
|
|
||||||
* @return the layer item
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// TODO Constructor from IndexLayerDV, GCUBESDILAeryDV or direct info
|
|
||||||
private LayerItem toLayerItem(LayerType layerType, String layerTitle, String layerName, String layerURL,
|
|
||||||
String mapServerHost, boolean isExternal, boolean isBase, boolean displayInLayerSwitcher,
|
|
||||||
ArrayList<String> styles, String wmsLink, boolean onTop, HashMap<String, String> wmsNotStandardParams,
|
|
||||||
boolean isNcWms, String UUID, ZAxis zAxis, Double minResolution, Double maxResolution) {
|
|
||||||
|
|
||||||
// GWT.log("Add addLayerByWms 1");
|
|
||||||
LayerItem layerItem = new LayerItem();
|
|
||||||
layerItem.setBaseLayer(isBase);
|
|
||||||
layerItem.setTitle(layerTitle);
|
|
||||||
layerItem.setName(layerName);
|
|
||||||
layerItem.setUrl(layerURL);
|
|
||||||
layerItem.setMapServerHost(mapServerHost);
|
|
||||||
// l.setExternal(isExternal);
|
|
||||||
layerItem.setOpacity(1d);
|
|
||||||
layerItem.setBuffer(2);
|
|
||||||
layerItem.setWmsLink(wmsLink);
|
|
||||||
layerItem.setWmsNotStandardParams(wmsNotStandardParams);
|
|
||||||
layerItem.setNcWms(isNcWms);
|
|
||||||
layerItem.setUUID(UUID);
|
|
||||||
layerItem.setZAxis(zAxis);
|
|
||||||
layerItem.setMinResolution(minResolution);
|
|
||||||
layerItem.setMaxResolution(maxResolution);
|
|
||||||
|
|
||||||
switch (layerType) {
|
|
||||||
|
|
||||||
// TODO IMPLEMENT THIS CASE
|
|
||||||
case RASTER_BASELAYER:
|
|
||||||
|
|
||||||
// l.setHasLegend(false);
|
|
||||||
layerItem.setBaseLayer(true);
|
|
||||||
layerItem.setTrasparent(false);
|
|
||||||
layerItem.setClickData(false);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FEATURE_TYPE:
|
|
||||||
|
|
||||||
// CASE FEATURE TYPE
|
|
||||||
layerItem.setBaseLayer(false);
|
|
||||||
layerItem.setClickData(true);
|
|
||||||
layerItem.setTrasparent(true);
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
GWT.log("styles " + styles);
|
|
||||||
|
|
||||||
if (styles != null && styles.size() > 0) {
|
|
||||||
layerItem.setHasLegend(true);
|
|
||||||
layerItem.setDefaultStyle(styles.get(0));
|
|
||||||
layerItem.setStyle(styles.get(0));
|
|
||||||
layerItem.setStyles(styles);
|
|
||||||
} else {
|
|
||||||
String style = URLUtil.getValueOfParameter("styles", wmsLink);
|
|
||||||
if (style != null) { // CASE OF STYLE ="";
|
|
||||||
// TENTATIVE TO GET LEGEND
|
|
||||||
layerItem.setHasLegend(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
GWT.log("Built layer: " + layerItem);
|
|
||||||
return layerItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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","");
|
|
@ -15,8 +15,7 @@ public class GeoInformationForWMSRequest implements Serializable {
|
||||||
/** The Constant serialVersionUID. */
|
/** The Constant serialVersionUID. */
|
||||||
private static final long serialVersionUID = -6846636281073641003L;
|
private static final long serialVersionUID = -6846636281073641003L;
|
||||||
|
|
||||||
/** The base wms service host. */
|
private String serviceEndPoint;
|
||||||
private String baseWmsServiceHost;
|
|
||||||
|
|
||||||
/** The wms request. */
|
/** The wms request. */
|
||||||
private String wmsRequest;
|
private String wmsRequest;
|
||||||
|
@ -53,7 +52,7 @@ public class GeoInformationForWMSRequest implements Serializable {
|
||||||
/**
|
/**
|
||||||
* Instantiates a new geo information for wms request.
|
* Instantiates a new geo information for wms request.
|
||||||
*
|
*
|
||||||
* @param baseWmsServiceHost the base wms service host
|
* @param serviceEndPoint the base wms service host
|
||||||
* @param wmsRequest the wms request
|
* @param wmsRequest the wms request
|
||||||
* @param layerName the layer name
|
* @param layerName the layer name
|
||||||
* @param versionWms the version wms
|
* @param versionWms the version wms
|
||||||
|
@ -63,10 +62,9 @@ public class GeoInformationForWMSRequest implements Serializable {
|
||||||
* @param isNcWMS the is nc WMS
|
* @param isNcWMS the is nc WMS
|
||||||
* @param zAxis the z axis
|
* @param zAxis the z axis
|
||||||
*/
|
*/
|
||||||
public GeoInformationForWMSRequest(String baseWmsServiceHost, String wmsRequest, String layerName,
|
public GeoInformationForWMSRequest(String serviceEndPoint, String wmsRequest, String layerName, String versionWms,
|
||||||
String versionWms, String crs, HashMap<String, String> mapWmsNoStandard, Styles styles, boolean isNcWMS,
|
String crs, HashMap<String, String> mapWmsNoStandard, Styles styles, boolean isNcWMS, ZAxis zAxis) {
|
||||||
ZAxis zAxis) {
|
this.serviceEndPoint = serviceEndPoint;
|
||||||
this.baseWmsServiceHost = baseWmsServiceHost;
|
|
||||||
this.wmsRequest = wmsRequest;
|
this.wmsRequest = wmsRequest;
|
||||||
this.layerName = layerName;
|
this.layerName = layerName;
|
||||||
this.versionWMS = versionWms;
|
this.versionWMS = versionWms;
|
||||||
|
@ -98,13 +96,21 @@ public class GeoInformationForWMSRequest implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the base wms service host.
|
* Gets the service end point.
|
||||||
*
|
*
|
||||||
* @return the baseWmsServiceHost
|
* @return the service end point
|
||||||
*/
|
*/
|
||||||
public String getBaseWmsServiceHost() {
|
public String getServiceEndPoint() {
|
||||||
|
return serviceEndPoint;
|
||||||
|
}
|
||||||
|
|
||||||
return baseWmsServiceHost;
|
/**
|
||||||
|
* Sets the service end point.
|
||||||
|
*
|
||||||
|
* @param serviceEndPoint the new service end point
|
||||||
|
*/
|
||||||
|
public void setServiceEndPoint(String serviceEndPoint) {
|
||||||
|
this.serviceEndPoint = serviceEndPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -180,11 +186,11 @@ public class GeoInformationForWMSRequest implements Serializable {
|
||||||
/**
|
/**
|
||||||
* Sets the base wms service host.
|
* Sets the base wms service host.
|
||||||
*
|
*
|
||||||
* @param baseWmsServiceHost the baseWmsServiceHost to set
|
* @param baseWmsServiceHost the new base wms service host
|
||||||
*/
|
*/
|
||||||
public void setBaseWmsServiceHost(String baseWmsServiceHost) {
|
public void setBaseWmsServiceHost(String baseWmsServiceHost) {
|
||||||
|
|
||||||
this.baseWmsServiceHost = baseWmsServiceHost;
|
this.serviceEndPoint = baseWmsServiceHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -271,8 +277,8 @@ public class GeoInformationForWMSRequest implements Serializable {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append("GeoInformationForWMSRequest [baseWmsServiceHost=");
|
builder.append("GeoInformationForWMSRequest [serviceEndPoint=");
|
||||||
builder.append(baseWmsServiceHost);
|
builder.append(serviceEndPoint);
|
||||||
builder.append(", wmsRequest=");
|
builder.append(", wmsRequest=");
|
||||||
builder.append(wmsRequest);
|
builder.append(wmsRequest);
|
||||||
builder.append(", layerName=");
|
builder.append(", layerName=");
|
||||||
|
|
|
@ -17,11 +17,17 @@
|
||||||
|
|
||||||
<inherits name="com.google.gwt.json.JSON" />
|
<inherits name="com.google.gwt.json.JSON" />
|
||||||
|
|
||||||
|
<inherits
|
||||||
|
name='org.gcube.portal.clientcontext.GCubeClientContext' />
|
||||||
|
|
||||||
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
|
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
|
||||||
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
|
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
|
||||||
|
|
||||||
<!-- Other module inherits -->
|
<!-- Other module inherits -->
|
||||||
|
|
||||||
|
<servlet path="/geoportalexporterservice"
|
||||||
|
class="org.gcube.portlets.user.geoportaldataviewer.server.GeoportalExporterActionServlet" />
|
||||||
|
|
||||||
<!-- Specify the app entry point class. -->
|
<!-- Specify the app entry point class. -->
|
||||||
<entry-point
|
<entry-point
|
||||||
class='org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer' />
|
class='org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer' />
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -34,11 +34,16 @@ body {
|
||||||
max-width: 500px;
|
max-width: 500px;
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
padding-top: 20px;
|
padding-top: 20px;
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ol-popup #pop-img {
|
||||||
|
max-height: 130px;
|
||||||
|
overflow-y: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ol-popup img {
|
.ol-popup img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-height: 200px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.ol-popup:after, .ol-popup:before {
|
.ol-popup:after, .ol-popup:before {
|
||||||
|
@ -153,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;
|
||||||
}
|
}
|
||||||
|
@ -190,7 +200,7 @@ body {
|
||||||
/*margin-top: 30px;*/
|
/*margin-top: 30px;*/
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
transition: width 0.5s;
|
transition: width 0.5s;
|
||||||
z-index: 999;
|
z-index: 950;
|
||||||
}
|
}
|
||||||
|
|
||||||
.overlay {
|
.overlay {
|
||||||
|
@ -206,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 {
|
||||||
|
@ -353,12 +363,16 @@ body {
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layers-panel {
|
.layer-panel {
|
||||||
margin-top: 10px;
|
margin-top: 43px;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
opacity: 90%;
|
opacity: 90%;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
width: 410px;
|
max-width: 430px;
|
||||||
|
z-index: 500;
|
||||||
|
overflow-y: auto;
|
||||||
|
position: absolute;
|
||||||
|
left: 52px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dand-layer {
|
.dand-layer {
|
||||||
|
@ -421,6 +435,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -732,45 +747,13 @@ Table Of Contents (TOC)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************
|
.general_warning {
|
||||||
RESPONSIVE
|
text-align: center;
|
||||||
*******************************/
|
font-size: 20px;
|
||||||
|
|
||||||
@media all and (max-width: 2350px) {
|
|
||||||
#timeline-data {
|
|
||||||
width: 700px;
|
|
||||||
left: 550px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media all and (max-width: 2048px) {
|
.general_warning div {
|
||||||
#timeline-data {
|
padding: 20px;
|
||||||
width: 600px;
|
|
||||||
left: 310px;
|
|
||||||
bottom: 50px
|
|
||||||
}
|
|
||||||
|
|
||||||
.details-panel {
|
|
||||||
width: 600px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media all and (max-width: 1024px) {
|
|
||||||
#timeline-data {
|
|
||||||
width: 260px;
|
|
||||||
left: 140px;
|
|
||||||
bottom: 50px
|
|
||||||
}
|
|
||||||
.details-panel {
|
|
||||||
width: 400px;
|
|
||||||
}
|
|
||||||
.search-facility {
|
|
||||||
width: 250px;
|
|
||||||
max-width: 300px;
|
|
||||||
}
|
|
||||||
.inner-toolbar {
|
|
||||||
width: 100px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* OPEN COLLECTION UI */
|
/* OPEN COLLECTION UI */
|
||||||
|
@ -793,6 +776,166 @@ RESPONSIVE
|
||||||
color: gray;
|
color: gray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.statistic-style-panel {
|
||||||
|
margin-left: 25px;
|
||||||
|
font-size: 13px;
|
||||||
|
color: gray;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-top: -3px;
|
||||||
|
}
|
||||||
|
|
||||||
.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/******************************
|
||||||
|
RESPONSIVE
|
||||||
|
*******************************/
|
||||||
|
|
||||||
|
@media all and (max-width: 2350px) {
|
||||||
|
#timeline-data {
|
||||||
|
width: 700px;
|
||||||
|
left: 550px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media all and (max-width: 2048px) {
|
||||||
|
#timeline-data {
|
||||||
|
width: 600px;
|
||||||
|
left: 310px;
|
||||||
|
bottom: 50px
|
||||||
|
}
|
||||||
|
|
||||||
|
.details-panel {
|
||||||
|
width: 530px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media all and (max-width: 1601px) {
|
||||||
|
.layers-panel {
|
||||||
|
width: 350px;
|
||||||
|
}
|
||||||
|
.dand-layer {
|
||||||
|
width: 336px;
|
||||||
|
}
|
||||||
|
.thePopDataTable {
|
||||||
|
|
||||||
|
}
|
||||||
|
.search-facility {
|
||||||
|
max-width: 680px;
|
||||||
|
}
|
||||||
|
.search-field {
|
||||||
|
width: 97%;
|
||||||
|
}
|
||||||
|
.ol-popup {
|
||||||
|
min-width: 220px;
|
||||||
|
width: 220px;
|
||||||
|
}
|
||||||
|
.thePopDataTable tr:last-of-type {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.layer-panel {
|
||||||
|
width: 355px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media all and (max-width: 1024px) {
|
||||||
|
#timeline-data {
|
||||||
|
width: 260px;
|
||||||
|
left: 140px;
|
||||||
|
bottom: 50px
|
||||||
|
}
|
||||||
|
.details-panel {
|
||||||
|
width: 400px;
|
||||||
|
}
|
||||||
|
.search-facility {
|
||||||
|
/*width: 250px;
|
||||||
|
max-width: 300px;*/
|
||||||
|
}
|
||||||
|
.inner-toolbar {
|
||||||
|
/*width: 100px;*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media all and (max-height: 900px) {
|
||||||
|
.ol-popup{
|
||||||
|
min-width: 150px;
|
||||||
|
max-width: 150px;
|
||||||
|
max-height: 150px;
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
.ol-popup img {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 150px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************
|
||||||
|
END RESPONSIVE
|
||||||
|
*******************************/
|
|
@ -10,10 +10,10 @@
|
||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||||
|
|
||||||
<link
|
<link
|
||||||
href="//cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@main/dist/en/v6.4.3/css/ol.css"
|
href="//cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@main/dist/en/v6.6.1/css/ol.css"
|
||||||
rel="stylesheet" type="text/css">
|
rel="stylesheet" type="text/css">
|
||||||
<script
|
<script
|
||||||
src="//cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@main/dist/en/v6.4.3/build/ol.js"
|
src="//cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@main/dist/en/v6.6.1/build/ol.js"
|
||||||
type="text/javascript"></script>
|
type="text/javascript"></script>
|
||||||
|
|
||||||
<link
|
<link
|
||||||
|
@ -138,6 +138,7 @@
|
||||||
application to display correctly.</div>
|
application to display correctly.</div>
|
||||||
</noscript>
|
</noscript>
|
||||||
<div id="app-notifier" class="app-notifier"></div>
|
<div id="app-notifier" class="app-notifier"></div>
|
||||||
|
<div id="layer-viewer" class="layer-panel"></div>
|
||||||
<div id="geoportal-data-viewer"></div>
|
<div id="geoportal-data-viewer"></div>
|
||||||
<div class="timeline-container">
|
<div class="timeline-container">
|
||||||
<div id="timeline-data"></div>
|
<div id="timeline-data"></div>
|
||||||
|
|
|
@ -15,11 +15,11 @@
|
||||||
src='<%=request.getContextPath()%>/GeoportalDataViewer/js/bootstrap.min.js'></script>
|
src='<%=request.getContextPath()%>/GeoportalDataViewer/js/bootstrap.min.js'></script>
|
||||||
|
|
||||||
<link
|
<link
|
||||||
href="//cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@main/dist/en/v6.4.3/css/ol.css"
|
href="//cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@main/dist/en/v6.6.1/css/ol.css"
|
||||||
rel="stylesheet" type="text/css">
|
rel="stylesheet" type="text/css">
|
||||||
|
|
||||||
<script
|
<script
|
||||||
src="//cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@main/dist/en/v6.4.3/build/ol.js"
|
src="//cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@main/dist/en/v6.6.1/build/ol.js"
|
||||||
type="text/javascript"></script>
|
type="text/javascript"></script>
|
||||||
|
|
||||||
<link
|
<link
|
||||||
|
@ -111,6 +111,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="app-notifier" class="app-notifier"></div>
|
<div id="app-notifier" class="app-notifier"></div>
|
||||||
|
<div id="layer-viewer" class="layer-panel"></div>
|
||||||
<div id="geoportal-data-viewer"></div>
|
<div id="geoportal-data-viewer"></div>
|
||||||
<div class="timeline-container">
|
<div class="timeline-container">
|
||||||
<div id="timeline-data"></div>
|
<div id="timeline-data"></div>
|
||||||
|
|
|
@ -16,6 +16,16 @@
|
||||||
<servlet-class>org.gcube.portlets.user.geoportaldataviewer.server.GeoportalDataViewerServiceImpl</servlet-class>
|
<servlet-class>org.gcube.portlets.user.geoportaldataviewer.server.GeoportalDataViewerServiceImpl</servlet-class>
|
||||||
</servlet>
|
</servlet>
|
||||||
|
|
||||||
|
<!-- <servlet> -->
|
||||||
|
<!-- <servlet-name>geoportalWaitingServerActionServlet</servlet-name> -->
|
||||||
|
<!-- <servlet-class>org.gcube.portlets.user.geoportaldataviewer.server.WatingServerActionServlet</servlet-class> -->
|
||||||
|
<!-- </servlet> -->
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>geoportalExporterServerActionServlet</servlet-name>
|
||||||
|
<servlet-class>org.gcube.portlets.user.geoportaldataviewer.server.GeoportalExporterActionServlet</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>mpformbuilderServlet</servlet-name>
|
<servlet-name>mpformbuilderServlet</servlet-name>
|
||||||
<servlet-class>org.gcube.portlets.widgets.mpformbuilder.server.MetadataProfileFormBuilderServiceImpl</servlet-class>
|
<servlet-class>org.gcube.portlets.widgets.mpformbuilder.server.MetadataProfileFormBuilderServiceImpl</servlet-class>
|
||||||
|
@ -32,4 +42,14 @@
|
||||||
<url-pattern>/GeoportalDataViewer/geoportaldataviewerservice</url-pattern>
|
<url-pattern>/GeoportalDataViewer/geoportaldataviewerservice</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<!-- <servlet-mapping> -->
|
||||||
|
<!-- <servlet-name>geoportalWaitingServerActionServlet</servlet-name> -->
|
||||||
|
<!-- <url-pattern>/GeoportalDataViewer/geoportaldataviewerwaitingservice</url-pattern> -->
|
||||||
|
<!-- </servlet-mapping> -->
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>geoportalExporterServerActionServlet</servlet-name>
|
||||||
|
<url-pattern>/GeoportalDataViewer/geoportalexporterservice</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
</web-app>
|
</web-app>
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 55 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
|
@ -0,0 +1,42 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.server.GeoportalExporterActionServlet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class GeoportalExporterActionServletTest.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Apr 24, 2024
|
||||||
|
*/
|
||||||
|
public class GeoportalExporterActionServletTest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The main method.
|
||||||
|
*
|
||||||
|
* @param args the arguments
|
||||||
|
*/
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String url = "https://data.dev.d4science.org/geoportal/export/pdf/profiledConcessioni/661d2c6f8804530afb90b132";
|
||||||
|
String identity = "francesco.mangiacrapa";
|
||||||
|
String token = "";
|
||||||
|
System.out.println("Start");
|
||||||
|
InputStream response;
|
||||||
|
try {
|
||||||
|
response = GeoportalExporterActionServlet.performHttpRequestToSGService(url, identity, token);
|
||||||
|
System.out.println(IOUtils.toString(response));
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
System.out.println("End");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -36,13 +36,11 @@ import org.gcube.application.geoportalcommon.shared.geoportal.materialization.in
|
||||||
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.view.ProjectView;
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||||
|
import org.gcube.application.geoportaldatamapper.Geoportal_JSON_Mapper;
|
||||||
|
import org.gcube.application.geoportaldatamapper.shared.ProjectEdit;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.Geoportal_JSON_Mapper;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ProjectEdit;
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class GeoportalViewer_Tests.
|
* The Class GeoportalViewer_Tests.
|
||||||
|
@ -57,15 +55,15 @@ public class GeoportalViewer_Tests {
|
||||||
|
|
||||||
private ProjectsCaller clientProjects;
|
private ProjectsCaller clientProjects;
|
||||||
|
|
||||||
//private static String CONTEXT = "/pred4s/preprod/preVRE";
|
private static String CONTEXT = "/gcube/devsec/devVRE";
|
||||||
private static String CONTEXT = "/d4science.research-infrastructures.eu/D4OS/GNA";
|
// private static String CONTEXT = "/pred4s/preprod/preVRE";
|
||||||
private static String TOKEN = ""; //GNA
|
// private static String CONTEXT = "/d4science.research-infrastructures.eu/D4OS/GNA";
|
||||||
|
private static String TOKEN = ""; // GNA
|
||||||
|
|
||||||
//private static String CONTEXT = "/gcube/devsec/devVRE";
|
// private static String TOKEN = ""; // devVRE
|
||||||
//private static String TOKEN = ""; // devVRE
|
|
||||||
|
|
||||||
private static String PROFILE_ID = "profiledConcessioni";
|
private static String PROFILE_ID = "profiledConcessioni";
|
||||||
private static String PROJECT_ID = "6388ea6ca1e60e66b7b584e0";
|
private static String PROJECT_ID = "63d011c4dcac4551b9a6b930";
|
||||||
|
|
||||||
private static String USERNAME = "francesco.mangiacrapa";
|
private static String USERNAME = "francesco.mangiacrapa";
|
||||||
|
|
||||||
|
@ -74,7 +72,7 @@ public class GeoportalViewer_Tests {
|
||||||
*
|
*
|
||||||
* @return the client
|
* @return the client
|
||||||
*/
|
*/
|
||||||
@Before
|
//@Before
|
||||||
public void getClient() {
|
public void getClient() {
|
||||||
// assumeTrue(GCubeTest.isTestInfrastructureEnabled());
|
// assumeTrue(GCubeTest.isTestInfrastructureEnabled());
|
||||||
ScopeProvider.instance.set(CONTEXT);
|
ScopeProvider.instance.set(CONTEXT);
|
||||||
|
@ -103,7 +101,7 @@ public class GeoportalViewer_Tests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Test
|
// @Test
|
||||||
public void getLayersForId() {
|
public void getLayersForId() {
|
||||||
System.out.println("getLayersForId [profileID: " + PROFILE_ID + ", projectID: " + PROJECT_ID + "] called");
|
System.out.println("getLayersForId [profileID: " + PROFILE_ID + ", projectID: " + PROJECT_ID + "] called");
|
||||||
|
|
||||||
|
@ -121,17 +119,18 @@ public class GeoportalViewer_Tests {
|
||||||
|
|
||||||
String materializationParentJSONPath = null;
|
String materializationParentJSONPath = null;
|
||||||
|
|
||||||
if(accessPolicy.equals(ACCESS_POLICY.OPEN)) {
|
if (accessPolicy.equals(ACCESS_POLICY.OPEN)) {
|
||||||
//Filtering for ACCESS_POLICY.OPEN when the username is not in session. IAM identity is running, no logged in user.
|
// Filtering for ACCESS_POLICY.OPEN when the username is not in session. IAM
|
||||||
materializationParentJSONPath = String.format("%s..%s[?(@._access._policy=='%s')]", Geoportal_JSON_Mapper.JSON_$_POINTER,
|
// identity is running, no logged in user.
|
||||||
Geoportal_JSON_Mapper.FILESET, accessPolicy);
|
materializationParentJSONPath = String.format("%s..%s[?(@._access._policy=='%s')]",
|
||||||
}else {
|
Geoportal_JSON_Mapper.JSON_$_POINTER, Geoportal_JSON_Mapper.FILESET, accessPolicy);
|
||||||
//Accessing to all fileset (with any ACCESS_POLICY) when the user is logged in.
|
} else {
|
||||||
|
// Accessing to all fileset (with any ACCESS_POLICY) when the user is logged in.
|
||||||
materializationParentJSONPath = String.format("%s..%s", Geoportal_JSON_Mapper.JSON_$_POINTER,
|
materializationParentJSONPath = String.format("%s..%s", Geoportal_JSON_Mapper.JSON_$_POINTER,
|
||||||
Geoportal_JSON_Mapper.FILESET);
|
Geoportal_JSON_Mapper.FILESET);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("jsonPathQuery is: "+materializationParentJSONPath);
|
System.out.println("jsonPathQuery is: " + materializationParentJSONPath);
|
||||||
|
|
||||||
// String materializationParentJSONPath = String.format("%s..%s", Geoportal_JSON_Mapper.JSON_$_POINTER,
|
// String materializationParentJSONPath = String.format("%s..%s", Geoportal_JSON_Mapper.JSON_$_POINTER,
|
||||||
// Geoportal_JSON_Mapper.FILESET);
|
// Geoportal_JSON_Mapper.FILESET);
|
||||||
|
@ -238,7 +237,7 @@ public class GeoportalViewer_Tests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Test
|
// @Test
|
||||||
public void testReadProjectEdit() {
|
public void testReadProjectEdit() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -261,7 +260,7 @@ public class GeoportalViewer_Tests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Test
|
// @Test
|
||||||
public void testTemporalReference() {
|
public void testTemporalReference() {
|
||||||
try {
|
try {
|
||||||
ScopeProvider.instance.set(CONTEXT);
|
ScopeProvider.instance.set(CONTEXT);
|
||||||
|
@ -271,7 +270,8 @@ public class GeoportalViewer_Tests {
|
||||||
.readTemporalDimensionTemplate(theProject.getProfileID());
|
.readTemporalDimensionTemplate(theProject.getProfileID());
|
||||||
|
|
||||||
// String template = "{\"content\": \"$.nome\"," + "\"title\": \"$.nome\","
|
// String template = "{\"content\": \"$.nome\"," + "\"title\": \"$.nome\","
|
||||||
// + "\"start\" : \"$.dataInizioProgetto\"," + "\"end\" : \"$.dataFineProgetto\"}";
|
// + "\"start\" : \"$.dataInizioProgetto\"," + "\"end\" :
|
||||||
|
// \"$.dataFineProgetto\"}";
|
||||||
|
|
||||||
if (temporalJsonTemplate != null) {
|
if (temporalJsonTemplate != null) {
|
||||||
|
|
||||||
|
@ -292,13 +292,12 @@ public class GeoportalViewer_Tests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Test
|
||||||
//@Test
|
|
||||||
public void getResultsWithSize() throws Exception {
|
public void getResultsWithSize() throws Exception {
|
||||||
// List<Project> listOfProjects = client.getListForProfileID(PROFILE_ID);
|
// List<Project> listOfProjects = client.getListForProfileID(PROFILE_ID);
|
||||||
|
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
System.out.println("start at: "+start);
|
System.out.println("start at: " + start);
|
||||||
SearchingFilter filter = new SearchingFilter();
|
SearchingFilter filter = new SearchingFilter();
|
||||||
|
|
||||||
// Where Clause
|
// Where Clause
|
||||||
|
@ -310,32 +309,32 @@ public class GeoportalViewer_Tests {
|
||||||
conditions.add(whereClause);
|
conditions.add(whereClause);
|
||||||
filter.setConditions(conditions);
|
filter.setConditions(conditions);
|
||||||
|
|
||||||
//NEED TO GET projections
|
// NEED TO GET projections
|
||||||
|
|
||||||
//SETTING PROJECTION ONLY FOR PROEJCT ID
|
// SETTING PROJECTION ONLY FOR PROEJCT ID
|
||||||
LinkedHashMap<String, Object> projectionForIDs = new LinkedHashMap<String, Object>();
|
LinkedHashMap<String, Object> projectionForIDs = new LinkedHashMap<String, Object>();
|
||||||
projectionForIDs.put(Project.ID, 1);
|
projectionForIDs.put(Project.ID, 1);
|
||||||
filter.setProjection(projectionForIDs);
|
filter.setProjection(projectionForIDs);
|
||||||
|
|
||||||
//LIMIT IS NULL MEANS THAT IT IS EQUAL TO NUMBER TOTAL OF DOCUMENTS
|
// LIMIT IS NULL MEANS THAT IT IS EQUAL TO NUMBER TOTAL OF DOCUMENTS
|
||||||
Integer totalDocs = clientProjects.getTotalDocument(PROFILE_ID);
|
Integer totalDocs = clientProjects.getTotalDocument(PROFILE_ID);
|
||||||
Iterator<Project> projects = clientProjects.queryOnMongo(PROFILE_ID, totalDocs, 0, null, filter);
|
Iterator<Project> projects = clientProjects.queryOnMongo(PROFILE_ID, totalDocs, 0, null, filter);
|
||||||
|
|
||||||
//CALCULATING SIZE OF THE ITERATOR OF PROJECT IDs
|
// CALCULATING SIZE OF THE ITERATOR OF PROJECT IDs
|
||||||
Iterable<Project> itP = () -> projects;
|
Iterable<Project> itP = () -> projects;
|
||||||
Stream<Project> targetStream = StreamSupport.stream(itP.spliterator(), false);
|
Stream<Project> targetStream = StreamSupport.stream(itP.spliterator(), false);
|
||||||
List<String> listProjectIDs = targetStream.map(Project::getId).collect(Collectors.toList());
|
List<String> listProjectIDs = targetStream.map(Project::getId).collect(Collectors.toList());
|
||||||
|
|
||||||
System.out.println("Total Ids are: "+listProjectIDs.size());
|
System.out.println("Total Ids are: " + listProjectIDs.size());
|
||||||
//listProjectIDs.stream().forEach(p -> System.out.println(p));
|
// listProjectIDs.stream().forEach(p -> System.out.println(p));
|
||||||
|
|
||||||
long end = System.currentTimeMillis();
|
long end = System.currentTimeMillis();
|
||||||
System.out.println("IDS returned in ms: "+(end-start));
|
System.out.println("IDS returned in ms: " + (end - start));
|
||||||
|
|
||||||
//RESETTIG FILTER AND PROJECT TO CLIENT QUERY
|
// RESETTIG FILTER AND PROJECT TO CLIENT QUERY
|
||||||
LinkedHashMap<String, Object> projection = new LinkedHashMap<String, Object>();
|
LinkedHashMap<String, Object> projection = new LinkedHashMap<String, Object>();
|
||||||
// default
|
// default
|
||||||
//PROJECTION
|
// PROJECTION
|
||||||
projection.put(Project.ID, 1);
|
projection.put(Project.ID, 1);
|
||||||
projection.put("_theDocument.nome", 1);
|
projection.put("_theDocument.nome", 1);
|
||||||
projection.put("_profileID", 1);
|
projection.put("_profileID", 1);
|
||||||
|
@ -353,20 +352,20 @@ public class GeoportalViewer_Tests {
|
||||||
projection.put("_theDocument.dataInizioProgetto", 1);
|
projection.put("_theDocument.dataInizioProgetto", 1);
|
||||||
filter.setProjection(projection);
|
filter.setProjection(projection);
|
||||||
|
|
||||||
|
// Integer totalDocs = client.getTotalDocument(PROFILE_ID);
|
||||||
//Integer totalDocs = client.getTotalDocument(PROFILE_ID);
|
|
||||||
Iterator<Project> itProjects = clientProjects.queryOnMongo(PROFILE_ID, totalDocs, 0, 50, filter);
|
Iterator<Project> itProjects = clientProjects.queryOnMongo(PROFILE_ID, totalDocs, 0, 50, filter);
|
||||||
|
|
||||||
List<ResultDocumentDV> results = ConvertToDataValueObjectModel.toListResultDocument(itProjects);
|
List<ResultDocumentDV> results = ConvertToDataValueObjectModel.toListResultDocument(itProjects);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (ResultDocumentDV projectDV : results) {
|
for (ResultDocumentDV projectDV : results) {
|
||||||
System.out.println(++i + ") " + projectDV.getId() + " dataInizioProgetto: "+projectDV.getDocumentAsMap().get("dataInizioProgetto"));
|
System.out.println(++i + ") " + projectDV.getId() + " dataInizioProgetto: "
|
||||||
|
+ projectDV.getDocumentAsMap().get("dataInizioProgetto"));
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Result listed has size: "+results.size());
|
System.out.println("Result listed has size: " + results.size());
|
||||||
|
|
||||||
end = System.currentTimeMillis();
|
end = System.currentTimeMillis();
|
||||||
System.out.println("Result listed in ms: "+(end-start));
|
System.out.println("Result listed in ms: " + (end - start));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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