Compare commits
125 Commits
animated_m
...
master
14
.classpath
|
@ -1,16 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/geoportal-data-viewer-app-3.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<classpathentry kind="src" output="target/geoportal-data-viewer-app-3.7.0/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-3.1.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">
|
||||
<attributes>
|
||||
<attribute name="test" value="true"/>
|
||||
|
@ -35,5 +30,10 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/geoportal-data-viewer-app-3.1.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
<classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-3.7.0/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/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
eclipse.preferences.version=1
|
||||
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-3.1.0-SNAPSHOT
|
||||
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-3.7.0
|
||||
warSrcDir=src/main/webapp
|
||||
warSrcDirIsOutput=false
|
||||
|
|
53
CHANGELOG.md
|
@ -4,9 +4,57 @@
|
|||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [v3.1.0-SNAPSHOT] - 2023-01-11
|
||||
## [v3.7.0]
|
||||
|
||||
#### Enhancement
|
||||
- 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
|
||||
|
||||
#### Enhancements
|
||||
|
||||
- [#24506] Added facility: Locate/Highlight the Layer on the Map
|
||||
|
||||
## [v3.1.0] - 2023-01-12
|
||||
|
||||
#### Enhancements
|
||||
- [#24300] Improved the GUI of the search functionality when multiple collections are available
|
||||
- [#24404] Improved the handlers of events: Search, Locate
|
||||
- Improved the user experience providing an animated map and zoom to layers facility
|
||||
|
@ -15,6 +63,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
- Reduced the BBOX when resolving a project by share link
|
||||
- GNA Project binding with automatically adding of the layers to Map
|
||||
- [#24390] Read the access policy from the fileset json section
|
||||
- [#24432] Fixing serialization issue using LinkedHashMap<String, String> instead of LinkedHashMap<String, Object>
|
||||
|
||||
## [v3.0.0] - 2022-11-28
|
||||
|
||||
|
|
36
README.md
|
@ -1,6 +1,6 @@
|
|||
# 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
|
||||
|
||||
|
@ -9,16 +9,44 @@ The GeoPortal Data Viewer App is an application to access, discovery and navigat
|
|||
|
||||
**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-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)
|
||||
* 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
|
||||
* 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
|
||||
|
||||
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
|
||||
|
||||
|
|
84
pom.xml
|
@ -7,22 +7,23 @@
|
|||
<parent>
|
||||
<artifactId>maven-parent</artifactId>
|
||||
<groupId>org.gcube.tools</groupId>
|
||||
<version>1.1.0</version>
|
||||
<version>1.2.0</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>geoportal-data-viewer-app</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>3.1.0-SNAPSHOT</version>
|
||||
<version>3.7.0</version>
|
||||
<name>GeoPortal Data Viewer App</name>
|
||||
<description>The GeoPortal Data Viewer App is an application to access, discovery and navigate the Geoportal projects/documents by a Web-Map Interface</description>
|
||||
|
||||
<properties>
|
||||
<!-- Convenience property to set the GWT version -->
|
||||
<gwt.version>2.9.0</gwt.version>
|
||||
<gwt.version>2.10.0</gwt.version>
|
||||
<gwt.compiler.style>PRETTY</gwt.compiler.style>
|
||||
<gson.version>2.6.2</gson.version>
|
||||
<gwt.ol.version>8.5.0</gwt.ol.version>
|
||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||
<!-- GWT 2.9 support 8, 9 and 11 -->
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
|
@ -55,21 +56,41 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>maven-portal-bom</artifactId>
|
||||
<version>3.6.4</version>
|
||||
<version>${gcube-portal-bom-version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<profiles>
|
||||
<!-- PROD profile -->
|
||||
<profile>
|
||||
<id>geoportal-data-viewer-app-release-profile</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>Release</name>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<gcube-portal-bom-version>4.0.0</gcube-portal-bom-version>
|
||||
</properties>
|
||||
</profile>
|
||||
<!-- DEV profile -->
|
||||
<profile>
|
||||
<id>geoportal-data-viewer-app-snapshot-profile</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>!Release</name>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<gcube-portal-bom-version>4.0.0-SNAPSHOT</gcube-portal-bom-version>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<!-- <dependency> -->
|
||||
<!-- <groupId>javax.servlet</groupId> -->
|
||||
<!-- <artifactId>javax.servlet-api</artifactId> -->
|
||||
<!-- <version>3.1.0</version> -->
|
||||
<!-- <scope>provided</scope> -->
|
||||
<!-- </dependency> -->
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>xml-apis</groupId>
|
||||
|
@ -109,7 +130,7 @@
|
|||
<dependency>
|
||||
<groupId>com.github.tdesjardins</groupId>
|
||||
<artifactId>gwt-ol3</artifactId>
|
||||
<version>8.1.0-gwt2_9</version>
|
||||
<version>${gwt.ol.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.gwtbootstrap</groupId>
|
||||
|
@ -142,13 +163,6 @@
|
|||
<artifactId>usermanagement-core</artifactId>
|
||||
<scope>provided</scope>
|
||||
</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 -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
|
@ -157,34 +171,16 @@
|
|||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- END -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>metadata-profile-form-builder-widget</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
<groupId>org.gcube.application</groupId>
|
||||
<artifactId>geoportal-data-mapper</artifactId>
|
||||
<version>[1.0.1, 2.0.0-SNAPSHOT)</version>
|
||||
<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>
|
||||
<groupId>org.gcube.application</groupId>
|
||||
<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>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -206,30 +202,26 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<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>
|
||||
<groupId>com.liferay.portal</groupId>
|
||||
<artifactId>portal-service</artifactId>
|
||||
<!-- <version>6.2.5</version> -->
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.portlet</groupId>
|
||||
<artifactId>portlet-api</artifactId>
|
||||
<!-- <version>2.0</version> -->
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<!-- <version>1.6.4</version> -->
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<!-- <version>1.6.4</version> -->
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
|
|
@ -17,11 +17,17 @@
|
|||
|
||||
<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.dark.Dark'/> -->
|
||||
|
||||
<!-- Other module inherits -->
|
||||
|
||||
<servlet path="/geoportalexporterservice"
|
||||
class="org.gcube.portlets.user.geoportaldataviewer.server.GeoportalExporterActionServlet" />
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
<entry-point
|
||||
class='org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer' />
|
||||
|
|
|
@ -1,13 +1,22 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.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.project.ProjectDV;
|
||||
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.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
|
||||
|
@ -16,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.LAYER_TYPE;
|
||||
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.ChangeMapLayerEventHandler;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent;
|
||||
|
@ -24,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.SwapLayer;
|
||||
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.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.SearchPerformedEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEventHandler;
|
||||
|
@ -37,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.EVENT_TYPE;
|
||||
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.ZoomOutOverMinimumEventHandler;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.CloseCollectionEvent;
|
||||
|
@ -46,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.MapUtils;
|
||||
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.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.LoaderIcon;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
||||
|
@ -57,7 +76,9 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
|
|||
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Modal;
|
||||
import com.github.gwtbootstrap.client.ui.Popover;
|
||||
import com.github.gwtbootstrap.client.ui.constants.Placement;
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
|
@ -78,6 +99,7 @@ import com.google.gwt.user.client.ui.RootPanel;
|
|||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
import ol.Coordinate;
|
||||
import ol.Feature;
|
||||
|
||||
/**
|
||||
* Entry point classes define <code>onModuleLoad()</code>.
|
||||
|
@ -90,6 +112,8 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
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";
|
||||
|
||||
/** The Constant APP_DIV. */
|
||||
|
@ -126,7 +150,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
int attempt = 0;
|
||||
|
||||
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();
|
||||
|
||||
|
@ -138,6 +162,11 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
private boolean initApplication;
|
||||
|
||||
// A cache (Layer_ID, GeoJSON) of layer features loaded via GetFeature Request
|
||||
private HashMap<String, String> layerFeaturesCache = new HashMap<String, String>();
|
||||
|
||||
private ViewerConfiguration viewerConfiguration;
|
||||
|
||||
/**
|
||||
* This is the entry point method.
|
||||
*/
|
||||
|
@ -166,6 +195,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
public void onFailure(Throwable caught) {
|
||||
RootPanel.get(APP_DIV).remove(loaderApp);
|
||||
Window.alert(caught.getMessage());
|
||||
RootPanel.get(APP_DIV).setHeight("800px");
|
||||
RootPanel.get(APP_DIV).add(getGeneralErrorPanel());
|
||||
}
|
||||
|
||||
|
@ -182,6 +212,9 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Inits the application.
|
||||
*/
|
||||
private void initApplication() {
|
||||
|
||||
initApplication = true;
|
||||
|
@ -208,6 +241,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
@Override
|
||||
public void onSuccess(ViewerConfiguration result) {
|
||||
super.onSuccess(result);
|
||||
viewerConfiguration = result;
|
||||
|
||||
GWT.log("Received init config : " + result);
|
||||
GWT.log("Loading base layers, count : " + result.getBaseLayers().size());
|
||||
|
@ -231,10 +265,20 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
"//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js")
|
||||
.setWindow(ScriptInjector.TOP_WINDOW).inject();
|
||||
|
||||
if (result.getAvailableCollections() == null
|
||||
|| result.getAvailableCollections().size() == 0) {
|
||||
RootPanel.get(APP_DIV).remove(loaderApp);
|
||||
Window.alert("No available collection in this context");
|
||||
RootPanel.get(APP_DIV).add(getGeneralErrorPanel());
|
||||
return;
|
||||
}
|
||||
|
||||
GWT.log("Loading collections, count " + result.getAvailableCollections().size());
|
||||
|
||||
mainPanel.setAvailableCollections(result.getAvailableCollections().values(),
|
||||
paramGeonaItemType);
|
||||
ArrayList<GCubeCollection> listColl = new ArrayList<GCubeCollection>();
|
||||
listColl.addAll(result.getAvailableCollections().values());
|
||||
Collections.sort(listColl);
|
||||
mainPanel.setAvailableCollections(listColl, paramGeonaItemType);
|
||||
|
||||
if (paramGeonaItemID != null) {
|
||||
if (paramGeonaItemType == null) {
|
||||
|
@ -252,6 +296,8 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
mainPanel.openCollectionMenu();
|
||||
|
||||
loadConfigureduGroupedLayersForUCD();
|
||||
|
||||
GWT.log("DONE INIT LOAD");
|
||||
|
||||
}
|
||||
|
@ -272,10 +318,91 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
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.
|
||||
*
|
||||
* @return the status
|
||||
*/
|
||||
public static ViewerStatus getStatus() {
|
||||
return viewerStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list base map layers.
|
||||
*
|
||||
* @return the list base map layers
|
||||
*/
|
||||
public static List<BaseMapLayer> getListBaseMapLayers() {
|
||||
return listBaseMapLayers;
|
||||
}
|
||||
|
@ -290,8 +417,14 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
mainPanel.setPanelsHeight(height);
|
||||
GWT.log("Set height: " + height);
|
||||
|
||||
mainPanel.setPanelsWidth(Window.getClientWidth());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the client height.
|
||||
*
|
||||
* @return the client height
|
||||
*/
|
||||
public int getClientHeight() {
|
||||
RootPanel principalDiv = RootPanel.get(APP_DIV);
|
||||
int topBorder = principalDiv.getAbsoluteTop();
|
||||
|
@ -317,7 +450,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
if (!ucdIds.contains(collId)) {
|
||||
GWT.log("!! Collection " + collId + " is not available");
|
||||
Window.alert("Collection " + collId + " is not found.");
|
||||
Window.alert("Collection " + collId + " not found.");
|
||||
} else {
|
||||
GCubeCollection toOpen = theConfig.getAvailableCollections().get(collId);
|
||||
|
||||
|
@ -404,9 +537,22 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Window.alert(caught.getMessage());
|
||||
// Window.alert(caught.getMessage());
|
||||
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
|
||||
|
@ -529,7 +675,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
applicationBus.addHandler(DoActionOnDetailLayersEvent.TYPE, new DoActionOnDetailLayersEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onDoActionOnDetailLayers(DoActionOnDetailLayersEvent doLayerActionEvent) {
|
||||
public void onDoActionOnDetailLayers(final DoActionOnDetailLayersEvent doLayerActionEvent) {
|
||||
|
||||
DO_LAYER_ACTION doAction = doLayerActionEvent.getDoAction();
|
||||
GWT.log("event: " + doAction);
|
||||
|
@ -556,6 +702,56 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
doLayerActionEvent.getVisibility());
|
||||
|
||||
break;
|
||||
case LOCATE_LAYER:
|
||||
|
||||
final LayerItem layerItem = doLayerActionEvent.getLayerItem();
|
||||
|
||||
boolean layerHighlighted = olMap.areLayerFeaturesAsHighlight(layerItem);
|
||||
|
||||
if (layerHighlighted) {
|
||||
doLayerActionEvent.getSourceEventUI().setVisibleLoaderFeatures(false, null);
|
||||
olMap.removeLayerFeaturesAsHighlight(layerItem.getName());
|
||||
return;
|
||||
}
|
||||
|
||||
final String geoJSONFeatures = layerFeaturesCache.get(layerItem.getName());
|
||||
|
||||
if (geoJSONFeatures == null) {
|
||||
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().getWFSResponse(layerItem,
|
||||
olMap.getProjectionCode(), null, 0, "json", new AsyncCallback<String>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
doLayerActionEvent.getSourceEventUI().setVisibleLoaderFeatures(false, null);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String geoJSONFeaturesResp) {
|
||||
doLayerActionEvent.getSourceEventUI().setVisibleLoaderFeatures(false, null);
|
||||
|
||||
if (geoJSONFeaturesResp != null && !geoJSONFeaturesResp.isEmpty()) {
|
||||
layerFeaturesCache.put(layerItem.getName(), geoJSONFeaturesResp);
|
||||
|
||||
GWT.log("GeoJSON: " + geoJSONFeaturesResp);
|
||||
|
||||
showLayerFeatures(layerItem, geoJSONFeaturesResp,
|
||||
doLayerActionEvent.getLayerObject().getProjectDV());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
} else {
|
||||
|
||||
doLayerActionEvent.getSourceEventUI().setVisibleLoaderFeatures(false, null);
|
||||
showLayerFeatures(layerItem, geoJSONFeatures,
|
||||
doLayerActionEvent.getLayerObject().getProjectDV());
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -564,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() {
|
||||
|
||||
@Override
|
||||
|
@ -593,16 +807,16 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
public void onShowPopup(ShowPopupOnCentroidEvent showPopupOnCentroiEvent) {
|
||||
GWT.log("ShowPopupOnCentroidEvent: " + showPopupOnCentroiEvent);
|
||||
|
||||
//Showing popup after clicking on map
|
||||
// Showing popup after clicking on map
|
||||
if (showPopupOnCentroiEvent.getProfileID() != null && showPopupOnCentroiEvent.getProjectID() != null) {
|
||||
Coordinate transfCoord = MapUtils
|
||||
.geoJSONTToBBoxCenter(showPopupOnCentroiEvent.getSpatialReference(), null, null);
|
||||
Coordinate transfCoord = MapUtils.geoJSONToBBOXCenter(showPopupOnCentroiEvent.getSpatialReference(),
|
||||
null, null);
|
||||
|
||||
performWFSQueryOnCentroid(showPopupOnCentroiEvent.getProjectID(), transfCoord.getX(),
|
||||
transfCoord.getY());
|
||||
|
||||
//Showing popup after locate on Map
|
||||
}else if(showPopupOnCentroiEvent.getProjectView()!=null) {
|
||||
// Showing popup after locate on Map
|
||||
} else if (showPopupOnCentroiEvent.getProjectView() != null) {
|
||||
layerManager.showPopupInfoForCentroidLayer(showPopupOnCentroiEvent.getProjectView());
|
||||
}
|
||||
|
||||
|
@ -617,7 +831,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
if (searchPerformedEvent != null) {
|
||||
|
||||
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();
|
||||
ViewerConfiguration viewerConfig = GeoportalDataViewer.getStatus().getViewerConfig();
|
||||
|
||||
|
@ -642,39 +856,142 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
// 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(";
|
||||
for (String projectId : result) {
|
||||
cqlFilter += "'" + projectId + "',";
|
||||
}
|
||||
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 {
|
||||
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null);
|
||||
setCqlFilter = null; // is already null
|
||||
newCqlFilter = olMapMng.getOLMap().setCQLFilterToWMSLayer(CQL_FACILITY_ORIGIN.SEARCH, layerName,
|
||||
null);
|
||||
}
|
||||
|
||||
if (searchPerformedEvent.isSearchReset()) {
|
||||
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null);
|
||||
setCqlFilter = null; // is already null
|
||||
newCqlFilter = olMapMng.getOLMap().setCQLFilterToWMSLayer(CQL_FACILITY_ORIGIN.SEARCH, layerName,
|
||||
null);
|
||||
}
|
||||
|
||||
GWT.log("New CQL Filter is: " + newCqlFilter);
|
||||
|
||||
// Resetting CQL Filter
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the.
|
||||
*
|
||||
* @param json the json
|
||||
* @return the object
|
||||
*/
|
||||
public static native Object toJSON(String json) /*-{
|
||||
var jsonObj = JSON.parse(json);
|
||||
//console.log("jsonObj: "+jsonObj);
|
||||
return jsonObj;
|
||||
}-*/;
|
||||
|
||||
// /**
|
||||
// * Handler popu closer.
|
||||
// * Handler popup closer.
|
||||
// *
|
||||
// * @param divId the div id
|
||||
// * @param overlayId the overlay id
|
||||
|
@ -690,6 +1007,13 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
//
|
||||
// }-*/;
|
||||
|
||||
/**
|
||||
* Perform WFS query on centroid.
|
||||
*
|
||||
* @param projectID the project ID
|
||||
* @param centroidLong the centroid long
|
||||
* @param centroidLat the centroid lat
|
||||
*/
|
||||
private void performWFSQueryOnCentroid(String projectID, Double centroidLong, Double centroidLat) {
|
||||
GWT.log("Perform performWFSQueryOnCentroid: " + projectID + " long: " + centroidLong + ", lat: " + centroidLat);
|
||||
if (projectID != null) {
|
||||
|
@ -714,6 +1038,13 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show popover.
|
||||
*
|
||||
* @param w the w
|
||||
* @param message the message
|
||||
* @param heading the heading
|
||||
*/
|
||||
public static void showPopover(final Widget w, String message, String heading) {
|
||||
|
||||
final Popover popover = new Popover();
|
||||
|
@ -735,8 +1066,13 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
timer.schedule(3000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the general error panel.
|
||||
*
|
||||
* @return the general error panel
|
||||
*/
|
||||
private FlowPanel getGeneralErrorPanel() {
|
||||
Image geoportalError = new Image(GNAImages.ICONS.geoportaServiceError());
|
||||
Image geoportalError = new Image(GeoportalImages.ICONS.geoportaServiceError());
|
||||
FlowPanel errorPanelMsg = new FlowPanel();
|
||||
errorPanelMsg.getElement().addClassName("general_error");
|
||||
errorPanelMsg.add(geoportalError);
|
||||
|
@ -747,4 +1083,19 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
return errorPanelMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show layer features.
|
||||
*
|
||||
* @param layerItem the layer item
|
||||
* @param geoJSONFeatures the geo JSON features
|
||||
* @param projectDV the project DV
|
||||
*/
|
||||
private void showLayerFeatures(LayerItem layerItem, String geoJSONFeatures, ProjectDV projectDV) {
|
||||
|
||||
Feature[] features = OLGeoJSONUtil.readGeoJsonFeatures(MAP_PROJECTION.EPSG_4326, geoJSONFeatures);
|
||||
|
||||
GWT.log("features: " + features);
|
||||
olMapMng.getOLMap().addLayerFeaturesAsHighlight(layerItem, features, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
|
|||
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
||||
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.i18n.client.DateTimeFormat;
|
||||
|
||||
|
@ -15,6 +16,17 @@ import com.google.gwt.i18n.client.DateTimeFormat;
|
|||
*/
|
||||
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 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_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 enum MapEventType {
|
||||
|
@ -34,6 +49,29 @@ public class GeoportalDataViewerConstants {
|
|||
|
||||
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.
|
||||
*
|
||||
|
@ -87,7 +125,7 @@ public class GeoportalDataViewerConstants {
|
|||
* @param msg the msg
|
||||
*/
|
||||
public static native void printJs(String msg)/*-{
|
||||
console.log("js console: " + msg);
|
||||
//console.log("js console: " + msg);
|
||||
}-*/;
|
||||
|
||||
/**
|
||||
|
@ -96,7 +134,7 @@ public class GeoportalDataViewerConstants {
|
|||
* @param msg the msg
|
||||
*/
|
||||
public static native void printJsObj(Object object)/*-{
|
||||
console.log("js obj: " + JSON.stringify(object, null, 4));
|
||||
//console.log("js obj: " + JSON.stringify(object, null, 4));
|
||||
}-*/;
|
||||
|
||||
/**
|
||||
|
@ -152,7 +190,8 @@ public class GeoportalDataViewerConstants {
|
|||
var tabCell = tr.insertCell(-1);
|
||||
var theValue = jsonObj[j][col[i]];
|
||||
//console.log("the value: "+theValue);
|
||||
if (Object.prototype.toString.call(theValue) === '[object Array]') {
|
||||
if (theValue !== null
|
||||
&& Object.prototype.toString.call(theValue) === '[object Array]') {
|
||||
var formattedValueArray = "";
|
||||
for (var k = 0; k < theValue.length; k++) {
|
||||
var theValueArray = theValue[k];
|
||||
|
|
|
@ -2,19 +2,24 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
|
|||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||
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.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.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.ResultSetPaginatedDataIDs;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
||||
|
||||
|
@ -52,8 +57,8 @@ public interface GeoportalDataViewerService extends RemoteService {
|
|||
* @return the data result
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
List<GeoNaSpatialQueryResult> getDataResult(List<LayerObject> layerObjects, String mapSrsName, BoundsMap mapBBOX,
|
||||
int maxWFSFeature, double zoomLevel) throws Exception;
|
||||
List<GeoportalSpatialQueryResult> getDataResult(List<LayerObject> layerObjects, String mapSrsName,
|
||||
BoundsMap mapBBOX, int maxWFSFeature, double zoomLevel) throws Exception;
|
||||
|
||||
/**
|
||||
* Gets the my login.
|
||||
|
@ -99,7 +104,7 @@ public interface GeoportalDataViewerService extends RemoteService {
|
|||
* @param zoomLevel the zoom level
|
||||
* @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);
|
||||
|
||||
/**
|
||||
|
@ -179,4 +184,51 @@ public interface GeoportalDataViewerService extends RemoteService {
|
|||
*/
|
||||
GeoJSON getSpatialReference(String profileID, String projectID);
|
||||
|
||||
/**
|
||||
* Gets the WFS request.
|
||||
*
|
||||
* @param layerItem the layer item
|
||||
* @param mapSrsName the map srs name
|
||||
* @param mapBBOX the map BBOX
|
||||
* @param maxFeatures the max features. If 0 means all feature
|
||||
* @param outputFormat the output format
|
||||
* @return the WFS request
|
||||
*/
|
||||
String getWFSRequest(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures,
|
||||
String outputFormat);
|
||||
|
||||
/**
|
||||
* Gets the WFS response.
|
||||
*
|
||||
* @param layerItem the layer item
|
||||
* @param mapSrsName the map srs name
|
||||
* @param mapBBOX the map BBOX
|
||||
* @param maxFeatures the max features
|
||||
* @param outputFormat the output format
|
||||
* @return the WFS response
|
||||
*/
|
||||
String getWFSResponse(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures,
|
||||
String outputFormat);
|
||||
|
||||
/**
|
||||
* 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,19 +2,24 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
|
|||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||
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.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.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.ResultSetPaginatedDataIDs;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
||||
|
||||
|
@ -43,7 +48,7 @@ public interface GeoportalDataViewerServiceAsync {
|
|||
void parseWmsRequest(String wmsRequest, String layerName, AsyncCallback<GeoInformationForWMSRequest> callback);
|
||||
|
||||
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);
|
||||
|
||||
|
@ -55,7 +60,7 @@ public interface GeoportalDataViewerServiceAsync {
|
|||
AsyncCallback<List<GCubeSDIViewerLayerDV>> asyncCallback);
|
||||
|
||||
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);
|
||||
|
||||
|
@ -75,4 +80,19 @@ public interface GeoportalDataViewerServiceAsync {
|
|||
|
||||
void getSpatialReference(String profileID, String projectID, AsyncCallback<GeoJSON> callback);
|
||||
|
||||
void getWFSRequest(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures, String outputFormat,
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
void getWFSResponse(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures, String outputFormat,
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
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.util.StringUtil;
|
||||
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.LayerItem;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||
|
@ -94,6 +94,9 @@ import ol.geom.Geometry;
|
|||
*/
|
||||
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. */
|
||||
private OpenLayerMap olMap;
|
||||
|
||||
|
@ -187,7 +190,7 @@ public class LayerManager {
|
|||
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().getDataResult(listLO, olMap.getProjectionCode(),
|
||||
mapBBOX, GeoportalDataViewerConstants.MAX_WFS_FEATURES, olMap.getCurrentZoomLevel(),
|
||||
new AsyncCallback<List<GeoNaSpatialQueryResult>>() {
|
||||
new AsyncCallback<List<GeoportalSpatialQueryResult>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -196,7 +199,7 @@ public class LayerManager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<GeoNaSpatialQueryResult> listGeonaDataObjects) {
|
||||
public void onSuccess(List<GeoportalSpatialQueryResult> listGeonaDataObjects) {
|
||||
|
||||
if (listGeonaDataObjects == null)
|
||||
return;
|
||||
|
@ -218,7 +221,7 @@ public class LayerManager {
|
|||
List<FeatureRow> theFeatures = null;
|
||||
|
||||
// TODO SWTCH FOR EARCH ITEM TYPE
|
||||
for (final GeoNaSpatialQueryResult geoNaDataObject : listGeonaDataObjects) {
|
||||
for (final GeoportalSpatialQueryResult geoNaDataObject : listGeonaDataObjects) {
|
||||
GWT.log("GeoNaDataObject: " + geoNaDataObject);
|
||||
List<FeatureRow> features = geoNaDataObject.getFeatures();
|
||||
LayerItem layerItem = geoNaDataObject.getSourceLayerObject().getLayerItem();
|
||||
|
@ -412,6 +415,7 @@ public class LayerManager {
|
|||
public void removeAllDetailLayers() {
|
||||
mapOtherLayerObjects.clear();
|
||||
olMap.removeAllDetailLayers();
|
||||
olMap.removeAllLayerFeaturesAsHighlight();
|
||||
overlayLayerManager.resetLayers();
|
||||
}
|
||||
|
||||
|
@ -511,7 +515,7 @@ public class LayerManager {
|
|||
GWT.log("Parsed WMS Request returned: " + geoInfoWMS);
|
||||
|
||||
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(),
|
||||
geoInfoWMS.getWmsRequest(), false, geoInfoWMS.getMapWMSNoStandard(),
|
||||
geoInfoWMS.isNcWMS(), UUID, geoInfoWMS.getZAxis(), minResolution, maxResolution);
|
||||
|
@ -549,7 +553,7 @@ public class LayerManager {
|
|||
theLo = lo;
|
||||
mapOtherLayerObjects.put(layerNameKey, theLo);
|
||||
GWT.log("PROJECT_LAYER mapOtherLayerObjects is: " + mapOtherLayerObjects);
|
||||
olMap.addWMSDetailLayer(layerItem);
|
||||
olMap.addWMSDetailLayer(layerItem, GeoportalDataViewerConstants.INITIAL_LAYER_OPACITY);
|
||||
overlayLayerManager.addLayerItem(theLo);
|
||||
} else {
|
||||
GWT.log("Skipping " + lo.getType() + " layer " + theLo.getLayerItem().getName()
|
||||
|
@ -578,9 +582,7 @@ public class LayerManager {
|
|||
public void setCQLForLayerToIndexLayer(String layerName, String cqlFilter) {
|
||||
LayerObject theLo = mapIndexLayerObjects.get(layerName);
|
||||
if (theLo != null) {
|
||||
boolean isCQLFilter = cqlFilter != null;
|
||||
theLo.getLayerItem().setCqlFilter(cqlFilter);
|
||||
theLo.getLayerItem().setCqlFilterAvailable(isCQLFilter);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -707,7 +709,7 @@ public class LayerManager {
|
|||
* @param listGeoNaDataObject the list geo na data object
|
||||
* @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);
|
||||
|
||||
ScrollPanel scrollPanel = new ScrollPanel();
|
||||
|
@ -765,7 +767,7 @@ public class LayerManager {
|
|||
// }
|
||||
|
||||
String prevProjectId = "";
|
||||
for (GeoNaSpatialQueryResult geoNaSpatialQueryResult : listGeoNaDataObject) {
|
||||
for (GeoportalSpatialQueryResult geoNaSpatialQueryResult : listGeoNaDataObject) {
|
||||
try {
|
||||
|
||||
Set<String> indexLayers = mapIndexLayerObjects.keySet();
|
||||
|
@ -805,6 +807,7 @@ public class LayerManager {
|
|||
|
||||
TemporalReferenceDV tempRef = projectDV.getTemporalReference();
|
||||
if (tempRef != null) {
|
||||
if(tempRef.getStart()!=null || tempRef.getEnd()!=null)
|
||||
flowPanel.add(new HTML(ProjectUtil.toHTMLCode(tempRef)));
|
||||
}
|
||||
|
||||
|
@ -953,8 +956,10 @@ public class LayerManager {
|
|||
}
|
||||
|
||||
TemporalReferenceDV tempRef = projectDV.getTemporalReference();
|
||||
GWT.log("Temporal reference is: "+tempRef);
|
||||
if (tempRef != null) {
|
||||
|
||||
if(tempRef.getStart()!=null || tempRef.getEnd()!=null)
|
||||
flex.setHTML(flex.getRowCount() + 1, 0, ProjectUtil.toHTMLCode(tempRef));
|
||||
}
|
||||
|
||||
|
@ -971,7 +976,7 @@ public class LayerManager {
|
|||
if (payloads != null && payloads.size() > 0) {
|
||||
PayloadDV img = payloads.get(0);
|
||||
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);
|
||||
flex.setHTML(flex.getRowCount() + 1, 0, theImgHTML);
|
||||
firstImageFound = true;
|
||||
|
@ -1006,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().setTitle("Zoom to Layers");
|
||||
buttonViewLayers.getElement().setTitle(ZOOM_TO_LAYERS_TITLE);
|
||||
buttonViewLayers.setType(ButtonType.LINK);
|
||||
|
||||
if (olMap.getCurrentZoomLevel() >= OLMapManager.LAYER_DETAIL_MAX_RESOLUTION) {
|
||||
|
@ -1118,7 +1123,7 @@ public class LayerManager {
|
|||
* @param feature the feature
|
||||
* @param onFailureCenterTo the on failure center to
|
||||
*/
|
||||
public void showPopupInfoForCentroidLayer(GeoNaSpatialQueryResult geoNaDataObject, FeatureRow feature,
|
||||
public void showPopupInfoForCentroidLayer(GeoportalSpatialQueryResult geoNaDataObject, FeatureRow feature,
|
||||
Coordinate onFailureCenterTo) {
|
||||
GWT.log("showPopupInfoForCentroidLayer showing feature: " + feature);
|
||||
GWT.log("showPopupInfoForCentroidLayer showing layerObject: " + geoNaDataObject.getSourceLayerObject());
|
||||
|
@ -1137,6 +1142,7 @@ public class LayerManager {
|
|||
FlexTable intFlex = new FlexTable();
|
||||
intFlex.setCellPadding(1);
|
||||
intFlex.setCellSpacing(1);
|
||||
intFlex.getElement().addClassName("thePopDataTable");
|
||||
if (projectDV.getTheDocument() != null) {
|
||||
LinkedHashMap<String, Object> map = projectDV.getTheDocument().getDocumentAsMap();
|
||||
// my-html-table
|
||||
|
@ -1160,7 +1166,7 @@ public class LayerManager {
|
|||
|
||||
TemporalReferenceDV tempRef = projectDV.getTemporalReference();
|
||||
if (tempRef != null) {
|
||||
|
||||
if(tempRef.getStart()!=null || tempRef.getEnd()!=null)
|
||||
flex.setHTML(flex.getRowCount() + 1, 0, ProjectUtil.toHTMLCode(tempRef));
|
||||
}
|
||||
}
|
||||
|
@ -1172,7 +1178,7 @@ public class LayerManager {
|
|||
if (listUI != null && listUI.size() > 0) {
|
||||
PayloadDV img = listUI.get(0);
|
||||
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);
|
||||
// GeoportalDataViewerConstants.print("The row are:
|
||||
// "+flex.getRowCount());
|
||||
|
@ -1198,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().setTitle("Zoom to Layers");
|
||||
buttonViewLayers.getElement().setTitle(ZOOM_TO_LAYERS_TITLE);
|
||||
buttonViewLayers.setType(ButtonType.LINK);
|
||||
|
||||
if (olMap.getCurrentZoomLevel() >= OLMapManager.LAYER_DETAIL_MAX_RESOLUTION) {
|
||||
|
@ -1343,7 +1349,7 @@ public class LayerManager {
|
|||
* Fire go to layers.
|
||||
*/
|
||||
protected void fireGoToLayers() {
|
||||
int zoomValue = (int) (OLMapManager.LAYER_DETAIL_MAX_RESOLUTION + 1);
|
||||
int zoomValue = (int) (OLMapManager.LAYER_DETAIL_MAX_RESOLUTION + 0.1);
|
||||
olMap.setZoom(zoomValue);
|
||||
try {
|
||||
Element buttonElement = DOM.getElementById("go-to-layers");
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd.DragDropLayer;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
@ -22,7 +24,7 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
|
|||
* Oct 12, 2021
|
||||
*/
|
||||
public static enum DO_LAYER_ACTION {
|
||||
VISIBILITY, SWAP, OPACITY
|
||||
VISIBILITY, SWAP, OPACITY, LOCATE_LAYER
|
||||
}
|
||||
|
||||
private DO_LAYER_ACTION doAction;
|
||||
|
@ -31,6 +33,8 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
|
|||
private boolean visibility;
|
||||
private SwapLayer sourceLayerSwap;
|
||||
private SwapLayer targetLayerSwap;
|
||||
private LayerObject layerObject;
|
||||
private DragDropLayer sourceEventUI;
|
||||
|
||||
/**
|
||||
* The Class SwapLayer.
|
||||
|
@ -39,7 +43,7 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
|
|||
*
|
||||
* Oct 15, 2021
|
||||
*/
|
||||
public static class SwapLayer{
|
||||
public static class SwapLayer {
|
||||
private LayerItem layerItem;
|
||||
private int position;
|
||||
|
||||
|
@ -49,7 +53,7 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
|
|||
* @param layerItem the layer item
|
||||
* @param position the position
|
||||
*/
|
||||
public SwapLayer(LayerItem layerItem, int position){
|
||||
public SwapLayer(LayerItem layerItem, int position) {
|
||||
this.layerItem = layerItem;
|
||||
this.position = position;
|
||||
}
|
||||
|
@ -78,9 +82,12 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
|
|||
*
|
||||
* @param action the action
|
||||
* @param layerItem the layer item
|
||||
* @param layerObject the layer object
|
||||
* @param layerObject the layer object
|
||||
*/
|
||||
public DoActionOnDetailLayersEvent(DO_LAYER_ACTION action, LayerItem layerItem) {
|
||||
public DoActionOnDetailLayersEvent(DO_LAYER_ACTION action, LayerItem layerItem, LayerObject layerObject) {
|
||||
this.layerItem = layerItem;
|
||||
this.layerObject = layerObject;
|
||||
this.doAction = action;
|
||||
}
|
||||
|
||||
|
@ -135,6 +142,24 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the layer object.
|
||||
*
|
||||
* @return the layer object
|
||||
*/
|
||||
public LayerObject getLayerObject() {
|
||||
return layerObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the layer object.
|
||||
*
|
||||
* @param layerObject the new layer object
|
||||
*/
|
||||
public void setLayerObject(LayerObject layerObject) {
|
||||
this.layerObject = layerObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the do action.
|
||||
*
|
||||
|
@ -189,6 +214,25 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
|
|||
return visibility;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the UI event source.
|
||||
*
|
||||
* @param sourceEventUI the new UI event source
|
||||
*/
|
||||
public void setUIEventSource(DragDropLayer sourceEventUI) {
|
||||
this.sourceEventUI = sourceEventUI;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the source event UI.
|
||||
*
|
||||
* @return the source event UI
|
||||
*/
|
||||
public DragDropLayer getSourceEventUI() {
|
||||
return sourceEventUI;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param coordinate coordinate to check.
|
||||
* @return true if the passed coordinate is contained or on the edge of the
|
||||
* extent.
|
||||
*/
|
||||
@JsOverlay
|
||||
public final Coordinate getCenter() {
|
||||
return getCenter((ol.Extent) this);
|
||||
}
|
||||
// /**
|
||||
// * @param coordinate coordinate to check.
|
||||
// * @return true if the passed coordinate is contained or on the edge of the
|
||||
// * extent.
|
||||
// */
|
||||
// @JsOverlay
|
||||
// public final Coordinate getCenter() {
|
||||
// return getCenter((ol.Extent) this);
|
||||
// }
|
||||
|
||||
@JsMethod(name = "getCenter", namespace = PACKAGE_EXTENT)
|
||||
private static native Coordinate getCenter(Extent extent);
|
||||
|
|
|
@ -19,17 +19,18 @@ public class LayerOrder {
|
|||
* Nov 12, 2021
|
||||
*/
|
||||
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);
|
||||
|
||||
static {
|
||||
|
||||
LAYER_OFFSET.put(LAYER_TYPE.BASE_MAP, 0);
|
||||
LAYER_OFFSET.put(LAYER_TYPE.BASE_WMS, 70);
|
||||
LAYER_OFFSET.put(LAYER_TYPE.WMS_DETAIL, 140);
|
||||
LAYER_OFFSET.put(LAYER_TYPE.VECTOR, 210);
|
||||
LAYER_OFFSET.put(LAYER_TYPE.BASE_MAP, 0); //Base OL or MapBox
|
||||
LAYER_OFFSET.put(LAYER_TYPE.CUSTOM_WMS_DETAIL, 70); //WMS custom Overlay. Es. Layer "Limiti Amministrativi"
|
||||
LAYER_OFFSET.put(LAYER_TYPE.BASE_WMS, 210); // Index layers (i.e. centroids for UCD)
|
||||
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.GeoportalDataViewerConstants;
|
||||
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.GeoQuery;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE;
|
||||
|
@ -87,7 +87,7 @@ public class LightOpenLayerMap {
|
|||
|
||||
private ol.layer.Vector geometryLayer;
|
||||
|
||||
private String markerURL = GNAImages.ICONS.mapMarkerIcon().getURL();
|
||||
private String markerURL = GeoportalImages.ICONS.mapMarkerIcon().getURL();
|
||||
|
||||
private LayerOrder layerOrder = new LayerOrder();
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.google.gwt.core.client.GWT;
|
|||
|
||||
import ol.Collection;
|
||||
import ol.Coordinate;
|
||||
import ol.Extent;
|
||||
import ol.control.Attribution;
|
||||
import ol.control.Control;
|
||||
import ol.control.FullScreen;
|
||||
|
@ -55,6 +56,18 @@ public final class MapUtils {
|
|||
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.
|
||||
*
|
||||
|
@ -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 transforFrom the transfor from
|
||||
* @param transformTo the transform to
|
||||
* @return the coordinate
|
||||
*/
|
||||
public static Coordinate geoJSONTToBBoxCenter(GeoJSON spatialReference, String transforFrom, String transformTo) {
|
||||
public static Coordinate geoJSONToBBOXCenter(GeoJSON spatialReference, String transforFrom, String transformTo) {
|
||||
|
||||
try {
|
||||
if (spatialReference != null) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
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.LAYER_TYPE;
|
||||
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.LayerItem;
|
||||
|
||||
|
@ -35,8 +37,10 @@ import ol.Overlay;
|
|||
import ol.OverlayOptions;
|
||||
import ol.Size;
|
||||
import ol.View;
|
||||
import ol.ViewFitOptions;
|
||||
import ol.ViewOptions;
|
||||
import ol.animation.AnimationOptions;
|
||||
import ol.color.Color;
|
||||
import ol.event.EventListener;
|
||||
import ol.geom.Geometry;
|
||||
import ol.interaction.Draw;
|
||||
|
@ -62,6 +66,11 @@ import ol.source.Source;
|
|||
import ol.source.Vector;
|
||||
import ol.source.Xyz;
|
||||
import ol.source.XyzOptions;
|
||||
import ol.style.Fill;
|
||||
import ol.style.FillOptions;
|
||||
import ol.style.Stroke;
|
||||
import ol.style.StrokeOptions;
|
||||
import ol.style.Style;
|
||||
|
||||
/**
|
||||
* The Class OpenLayerMap.
|
||||
|
@ -72,12 +81,29 @@ import ol.source.XyzOptions;
|
|||
*/
|
||||
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
|
||||
|
||||
public static final int SET_CENTER_ANIMATED_DURATION = 500;
|
||||
|
||||
public static final int ZOOM_ANIMATED_DURATION = 3000;
|
||||
|
||||
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.
|
||||
*
|
||||
|
@ -141,8 +167,12 @@ public abstract class OpenLayerMap {
|
|||
|
||||
private LinkedHashMap<String, Image> wmsDetailsLayerMap;
|
||||
|
||||
private LinkedHashMap<String, Image> wmsGroupedCustomLayerMap;
|
||||
|
||||
private LinkedHashMap<String, Image> wmsLayerMap;
|
||||
|
||||
private LinkedHashMap<String, ol.layer.Vector> vectorLayersHighlighted = new LinkedHashMap<String, ol.layer.Vector>();
|
||||
|
||||
private Layer baseLayerTile;
|
||||
|
||||
private LayerOrder layerOrder = new LayerOrder();
|
||||
|
@ -308,7 +338,7 @@ public abstract class OpenLayerMap {
|
|||
animations.setDuration(SET_CENTER_ANIMATED_DURATION);
|
||||
view.animate(animations);
|
||||
|
||||
//view.setCenter(centerCoordinate);
|
||||
// view.setCenter(centerCoordinate);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -321,7 +351,7 @@ public abstract class OpenLayerMap {
|
|||
animations.setDuration(ZOOM_ANIMATED_DURATION);
|
||||
animations.setZoom(zoom);
|
||||
view.animate(animations);
|
||||
//view.setZoom(zoom);
|
||||
// view.setZoom(zoom);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -337,7 +367,7 @@ public abstract class OpenLayerMap {
|
|||
elPopup.getStyle().setVisibility(Visibility.VISIBLE);
|
||||
if (popupOverlay == null) {
|
||||
popupOverlay = addOverlay(elPopup);
|
||||
addPopupCloserHandelr(popupOverlay);
|
||||
addPopupCloserHandler(popupOverlay);
|
||||
}
|
||||
Element popContent = DOM.getElementById("popup-content");
|
||||
popContent.setInnerHTML(html);
|
||||
|
@ -355,11 +385,11 @@ public abstract class OpenLayerMap {
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds the popup closer handelr.
|
||||
* Adds the popup closer handler.
|
||||
*
|
||||
* @param popupOverlay the popup overlay
|
||||
*/
|
||||
private void addPopupCloserHandelr(Overlay popupOverlay) {
|
||||
private void addPopupCloserHandler(Overlay popupOverlay) {
|
||||
Element elPopupCloser = DOM.getElementById("popup-closer");
|
||||
Event.sinkEvents(elPopupCloser, Event.ONCLICK);
|
||||
Event.setEventListener(elPopupCloser, new com.google.gwt.user.client.EventListener() {
|
||||
|
@ -407,11 +437,9 @@ public abstract class OpenLayerMap {
|
|||
if (layer == null) {
|
||||
ImageWmsParams imageWMSParams = OLFactory.createOptions();
|
||||
imageWMSParams.setLayers(layerItem.getName());
|
||||
// imageWMSParams.set("CQL_FILTER", "product_id
|
||||
// IN('6165b07202ad3d60e1d26f42','6166ff8002ad3d60e1d26fb7')");
|
||||
|
||||
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
||||
imageWMSOptions.setUrl(layerItem.getMapServerHost());
|
||||
imageWMSOptions.setUrl(layerItem.getMapServerEndpoint());
|
||||
|
||||
imageWMSOptions.setParams(imageWMSParams);
|
||||
// imageWMSOptions.setRatio(1.5f);
|
||||
|
@ -445,39 +473,63 @@ public abstract class OpenLayerMap {
|
|||
|
||||
}
|
||||
|
||||
public void setCQLFilterToWMSLayer(String key, String cqlFilterExpression) {
|
||||
|
||||
GWT.log("Getting key: " + key);
|
||||
|
||||
GWT.log("Setting CQL FILTER: " + cqlFilterExpression);
|
||||
Image wmsLayer = wmsLayerMap.get(key);
|
||||
/**
|
||||
* Sets the CQL filter to WMS layer.
|
||||
*
|
||||
* @param origin the origin
|
||||
* @param layerName the key
|
||||
* @param newCQLFilterExpression the cql filter expression
|
||||
* @return the new CQL Filter
|
||||
*/
|
||||
public String setCQLFilterToWMSLayer(CQL_FACILITY_ORIGIN origin, String layerName, String newCQLFilterExpression) {
|
||||
GWT.log("Getting key (layerName): " + layerName);
|
||||
GWT.log("Adding CQL FILTER: " + newCQLFilterExpression);
|
||||
|
||||
Image wmsLayer = wmsLayerMap.get(layerName);
|
||||
GWT.log("WMS layer is: " + wmsLayer);
|
||||
|
||||
// map.removeLayer(wmsLayer);
|
||||
|
||||
ImageWms imageWMSSource = wmsLayer.getSource();
|
||||
ImageWmsParams imageWMSParams = imageWMSSource.getParams();
|
||||
|
||||
if (cqlFilterExpression == null) {
|
||||
imageWMSParams.delete("CQL_FILTER");
|
||||
// Setting new CQL filter for Origin
|
||||
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 {
|
||||
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);
|
||||
wmsLayer.setSource(imageWMSSource);
|
||||
|
||||
// map.addLayer(wmsLayer);
|
||||
wmsLayer.changed();
|
||||
|
||||
GWT.log("returning " + CQL_FILTER_PARAMETER + ": " + setCQLFilter);
|
||||
return setCQLFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the WMS detail layer.
|
||||
*
|
||||
* @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)
|
||||
wmsDetailsLayerMap = new LinkedHashMap<String, Image>();
|
||||
|
@ -492,7 +544,7 @@ public abstract class OpenLayerMap {
|
|||
imageWMSParams.setLayers(layerItem.getName());
|
||||
|
||||
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
||||
imageWMSOptions.setUrl(layerItem.getMapServerHost());
|
||||
imageWMSOptions.setUrl(layerItem.getMapServerEndpoint());
|
||||
imageWMSOptions.setParams(imageWMSParams);
|
||||
// imageWMSOptions.setRatio(1.5f);
|
||||
|
||||
|
@ -511,6 +563,7 @@ public abstract class OpenLayerMap {
|
|||
Image wmsLayer = new Image(layerOptions);
|
||||
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.WMS_DETAIL) + wmsDetailsLayerMap.size() + 1;
|
||||
wmsLayer.setZIndex(zIndex);
|
||||
wmsLayer.setOpacity(initialOpacity);
|
||||
map.addLayer(wmsLayer);
|
||||
wmsDetailsLayerMap.put(key, wmsLayer);
|
||||
|
||||
|
@ -522,8 +575,61 @@ 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.
|
||||
*
|
||||
* @param layerName the layer name
|
||||
*/
|
||||
public void removeWMSLayer(String layerName) {
|
||||
GWT.log("Removing layerName: " + layerName + " from map: " + wmsLayerMap);
|
||||
|
@ -548,8 +654,6 @@ public abstract class OpenLayerMap {
|
|||
*/
|
||||
public void removeAllDetailLayers() {
|
||||
|
||||
// NOT NEEDED ANYMORE.. I'M USING MIN/MAX LAYER RESOLUTION
|
||||
|
||||
if (wmsDetailsLayerMap == null)
|
||||
return;
|
||||
|
||||
|
@ -564,6 +668,24 @@ public abstract class OpenLayerMap {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the all layer features as highlight.
|
||||
*/
|
||||
public void removeAllLayerFeaturesAsHighlight() {
|
||||
|
||||
if (vectorLayersHighlighted == null)
|
||||
return;
|
||||
|
||||
GWT.log("Removing vectorLayersHighlighted: " + vectorLayersHighlighted.keySet() + " from map");
|
||||
|
||||
for (String layerName : vectorLayersHighlighted.keySet()) {
|
||||
removeLayerFeaturesAsHighlight(layerName);
|
||||
}
|
||||
|
||||
vectorLayersHighlighted.clear();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the vector.
|
||||
*
|
||||
|
@ -574,12 +696,12 @@ public abstract class OpenLayerMap {
|
|||
VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
|
||||
vectorLayerOptions.setMap(map);
|
||||
|
||||
// Style style = new Style();
|
||||
// FillOptions fillOptions = new FillOptions();
|
||||
// Color color = new Color(0, 0, 255, 1.0);
|
||||
// fillOptions.setColor(color);
|
||||
// Fill fill = new Fill(fillOptions);
|
||||
// style.setFill(fill);
|
||||
Style style = new Style();
|
||||
FillOptions fillOptions = new FillOptions();
|
||||
Color color = new Color(0, 0, 255, 1.0);
|
||||
fillOptions.setColor(color);
|
||||
Fill fill = new Fill(fillOptions);
|
||||
style.setFill(fill);
|
||||
|
||||
FeatureOptions featureOptions = new FeatureOptions();
|
||||
featureOptions.setGeometry(geometry);
|
||||
|
@ -591,12 +713,102 @@ public abstract class OpenLayerMap {
|
|||
|
||||
ol.layer.Vector vector = OLFactory.createVector(vectorLayerOptions);
|
||||
|
||||
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.VECTOR) + 1;
|
||||
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.VECTOR) + 1000;
|
||||
vector.setZIndex(zIndex);
|
||||
|
||||
map.addLayer(vector);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the vector.
|
||||
*
|
||||
* @param layerItem the layer item
|
||||
* @param features the features
|
||||
* @param fitMapToFeaturesExtent the fit map to features extent
|
||||
*/
|
||||
public void addLayerFeaturesAsHighlight(LayerItem layerItem, Feature[] features, boolean fitMapToFeaturesExtent) {
|
||||
|
||||
removeLayerFeaturesAsHighlight(layerItem.getName());
|
||||
|
||||
Style style = new Style();
|
||||
StrokeOptions strokeOptions = new StrokeOptions();
|
||||
strokeOptions.setColor(new Color(255, 69, 0, 0.8));
|
||||
strokeOptions.setWidth(5);
|
||||
Stroke stroke = new Stroke(strokeOptions);
|
||||
stroke.setWidth(2);
|
||||
style.setStroke(stroke);
|
||||
|
||||
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);
|
||||
|
||||
// GWT.log("features: " + features);
|
||||
|
||||
VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
|
||||
vectorLayerOptions.setSource(vectorSource);
|
||||
vectorLayerOptions.setStyle(style);
|
||||
|
||||
// GWT.log("vectorLayerOptions: " + vectorLayerOptions);
|
||||
|
||||
ol.layer.Vector vector = OLFactory.createVector(vectorLayerOptions);
|
||||
// vector.setStyle(style);
|
||||
vector.setVisible(true);
|
||||
vector.setZIndex(5000);
|
||||
|
||||
vectorLayersHighlighted.put(layerItem.getName(), vector);
|
||||
|
||||
map.addLayer(vector);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Are layer features A as highlight.
|
||||
*
|
||||
* @param layerItem the layer item
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean areLayerFeaturesAsHighlight(LayerItem layerItem) {
|
||||
return vectorLayersHighlighted.get(layerItem.getName()) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the layer features A as highlight.
|
||||
*
|
||||
* @param layerName the layer name
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean removeLayerFeaturesAsHighlight(String layerName) {
|
||||
|
||||
try {
|
||||
|
||||
ol.layer.Vector vl = vectorLayersHighlighted.get(layerName);
|
||||
|
||||
if (vl != null) {
|
||||
map.removeLayer(vl);
|
||||
vectorLayersHighlighted.remove(layerName);
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the point vector source.
|
||||
*
|
||||
|
@ -918,6 +1130,23 @@ public abstract class OpenLayerMap {
|
|||
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.
|
||||
*
|
||||
|
@ -927,9 +1156,23 @@ public abstract class OpenLayerMap {
|
|||
public void setWMSDetailLayerOpacity(LayerItem layerItem, double opacity) {
|
||||
String key = layerItem.getName();
|
||||
Image layer = wmsDetailsLayerMap.get(key);
|
||||
if (layer != null)
|
||||
layer.setOpacity(opacity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the WMS detail layer visible.
|
||||
*
|
||||
* @param layerItem the layer item
|
||||
* @param visible the visible
|
||||
*/
|
||||
public void setWMSGroupedCustomLayerVisible(LayerItem layerItem, boolean visible) {
|
||||
String key = layerItem.getName();
|
||||
Image layer = wmsGroupedCustomLayerMap.get(key);
|
||||
if (layer != null)
|
||||
layer.setVisible(visible);
|
||||
}
|
||||
|
||||
/**
|
||||
* Swap details layers.
|
||||
*
|
||||
|
@ -967,6 +1210,17 @@ public abstract class OpenLayerMap {
|
|||
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.resources.client.ClientBundle;
|
||||
|
||||
public interface GNAIcons extends ClientBundle {
|
||||
public interface GeoportalIcons extends ClientBundle {
|
||||
|
||||
/** My custom base icon collection */
|
||||
public enum CustomIconType implements BaseIconType {
|
||||
|
@ -15,7 +15,7 @@ public interface GNAIcons extends ClientBundle {
|
|||
|
||||
/** Inject the icon's css once at first usage */
|
||||
static {
|
||||
GNAImages icons = GWT.create(GNAImages.class);
|
||||
GeoportalImages icons = GWT.create(GeoportalImages.class);
|
||||
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.ImageResource;
|
||||
|
||||
public interface GNAImages extends ClientBundle {
|
||||
public interface GeoportalImages extends ClientBundle {
|
||||
|
||||
/** Get access to the css resource during gwt compilation */
|
||||
@Source("baseIcons.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
|
||||
|
@ -47,13 +47,22 @@ public interface GNAImages extends ClientBundle {
|
|||
@Source("layer_invisible.png")
|
||||
ImageResource layerInvisible();
|
||||
|
||||
@Source("locate.png")
|
||||
ImageResource locate();
|
||||
|
||||
@Source("locate_none.png")
|
||||
ImageResource locateNone();
|
||||
|
||||
@Source("spinner_earth.gif")
|
||||
ImageResource spinnerEarth();
|
||||
|
||||
@Source("spinner_clock.gif")
|
||||
ImageResource spinnerClock();
|
||||
|
||||
@Source("geoporta_error.png")
|
||||
@Source("geoportal_error.png")
|
||||
ImageResource geoportaServiceError();
|
||||
|
||||
@Source("warning_error.png")
|
||||
ImageResource warningError();
|
||||
|
||||
}
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 2.7 KiB |
|
@ -11,9 +11,20 @@
|
|||
top: 50px;
|
||||
right: 10px;
|
||||
}
|
||||
|
||||
.to-align-left {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
color: white !important;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
.to-align-left :hover {
|
||||
color: #F5F5F5;
|
||||
}
|
||||
</ui:style>
|
||||
<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:UiBinder>
|
|
@ -8,24 +8,33 @@ import java.util.List;
|
|||
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||
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.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.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.GisToolbarFacilities;
|
||||
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.MapExtentToEvent;
|
||||
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.gis.OpenLayerMap;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAIcons;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GeoportalIcons;
|
||||
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.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.map.ExtentMapUtil;
|
||||
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.ItemFieldsResponse;
|
||||
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.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.Paragraph;
|
||||
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.Scheduler;
|
||||
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.user.client.ui.Composite;
|
||||
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.Image;
|
||||
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.RootPanel;
|
||||
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||
import com.google.gwt.user.client.ui.SimplePanel;
|
||||
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 {
|
||||
|
||||
|
||||
|
||||
private static final String PLACEHOLDER_SELECT_SEARCH_IN = "Select Collection...";
|
||||
|
||||
private static GeonaDataViewMainPanelUiBinder uiBinder = GWT.create(GeonaDataViewMainPanelUiBinder.class);
|
||||
|
@ -111,6 +126,18 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
@UiField
|
||||
DropdownButton openCollectionDropDown;
|
||||
|
||||
@UiField
|
||||
DropdownButton linkCustomOverlayLayers;
|
||||
|
||||
@UiField
|
||||
DropdownButton linkCrossFilteringLayers;
|
||||
|
||||
@UiField
|
||||
HTMLPanel panelCustomOverlayLayers;
|
||||
|
||||
@UiField
|
||||
HTMLPanel panelCrossFilteringLayers;
|
||||
|
||||
@UiField
|
||||
HTMLPanel openCollectionPanel;
|
||||
|
||||
|
@ -120,8 +147,10 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
@UiField
|
||||
ListBox navListSearch;
|
||||
|
||||
@UiField
|
||||
ScrollPanel overlayLayersPanel;
|
||||
//@UiField
|
||||
//ScrollPanel overlayLayersPanel;
|
||||
|
||||
RootPanel overlayLayersPanel = RootPanel.get(GeoportalDataViewer.DIV_LAYER_VIEW);
|
||||
|
||||
@UiField
|
||||
ScrollPanel searchFacilityPanel;
|
||||
|
@ -157,25 +186,26 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
mapPanel = new MapPanel(mapHeight + "px");
|
||||
detailsPanel.setHeight(mapHeight + "px");
|
||||
detailsPanel.setApplicationBus(applicationBus);
|
||||
overlayLayersPanel.setVisible(false);
|
||||
mainContainerPanel.add(mapPanel);
|
||||
bindHandlers();
|
||||
dataPointSelection.setIcon(IconType.SCREENSHOT);
|
||||
dataBoxSelection.setIcon(IconType.BOOKMARK);
|
||||
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);
|
||||
extentToItaly.getElement().appendChild(italyImg.getElement());
|
||||
extentToItaly.setWidth("140px");
|
||||
|
||||
Image worldImg = new Image(GNAImages.ICONS.worldIcon());
|
||||
Image worldImg = new Image(GeoportalImages.ICONS.worldIcon());
|
||||
worldImg.getElement().getStyle().setPaddingLeft(20, Unit.PX);
|
||||
extentToEarth.getElement().appendChild(worldImg.getElement());
|
||||
extentToEarth.setWidth("140px");
|
||||
|
||||
linkMap.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
|
||||
linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get());
|
||||
linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
|
||||
// linkMap.setCustomIconStyle(GeoportalIcons.CustomIconType.MAP.get());
|
||||
linkPresetLocation.setCustomIconStyle(GeoportalIcons.CustomIconType.PRESET_LOCATION.get());
|
||||
linkLayers.setCustomIconStyle(GeoportalIcons.CustomIconType.LAYERS.get());
|
||||
|
||||
openCollectionDropDown.setIcon(IconType.COMPASS);
|
||||
|
||||
|
@ -252,15 +282,24 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
|
||||
@Override
|
||||
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);
|
||||
bindEvents();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -302,6 +341,26 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
|
||||
}
|
||||
}, 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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -318,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.
|
||||
*/
|
||||
|
@ -521,44 +601,22 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
|
||||
for (GCubeCollection coll : collection) {
|
||||
GWT.log("Found available collection " + coll);
|
||||
String label = coll.getUcd().getName();
|
||||
final String collectionID = coll.getUcd().getId(); // collectionID == UCD_Id
|
||||
|
||||
CheckBox checkbox = new CheckBox(label);
|
||||
checkbox.setId("gcubeCollectionSelector_" + collectionID);
|
||||
LayerCollectionPanel lcp = new LayerCollectionPanel(coll, applicationBus);
|
||||
|
||||
checkbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||
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());
|
||||
if (event.getValue()) {
|
||||
// OPEN COLLECTION
|
||||
applicationBus.fireEvent(new OpenCollectionEvent(collectionID));
|
||||
} else {
|
||||
// CLOSE COLLECTION
|
||||
applicationBus.fireEvent(new CloseCollectionEvent(collectionID));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
openCollectionPanel.add(checkbox);
|
||||
openCollectionPanel.add(lcp);
|
||||
|
||||
List<CheckBox> listCollections = mapCollectionCheckBoxes.get(collectionID);
|
||||
if (listCollections == null)
|
||||
listCollections = new ArrayList<CheckBox>();
|
||||
|
||||
listCollections.add(checkbox);
|
||||
listCollections.add(lcp.getCheckbox());
|
||||
mapCollectionCheckBoxes.put(collectionID, listCollections);
|
||||
|
||||
// Opening All Collections if openCollectionID is null
|
||||
if (openCollectionID == null) {
|
||||
checkbox.setValue(true, true);
|
||||
lcp.getCheckbox().setValue(true, true);
|
||||
// String collectionID = checkbox.getId().replace("gcubeCollectionSelector_",
|
||||
// "");
|
||||
GWT.log("Opening the collection: " + collectionID);
|
||||
|
@ -622,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>
|
||||
</b:DropdownButton>
|
||||
<b:DropdownButton type="LINK"
|
||||
text="Open Collection" ui:field="openCollectionDropDown">
|
||||
<b:DropdownButton type="LINK" text="Collection"
|
||||
ui:field="openCollectionDropDown">
|
||||
<g:HTMLPanel ui:field="openCollectionPanel"
|
||||
addStyleNames="{style.open-collection-style}">
|
||||
addStyleNames="open-collection-style">
|
||||
</g:HTMLPanel>
|
||||
</b:DropdownButton>
|
||||
<b:DropdownButton type="LINK"
|
||||
title="Select the Map" text="Map" ui:field="linkMap">
|
||||
<b:DropdownButton type="LINK" text="Map" ui:field="linkMap" icon="GLOBE">
|
||||
<g:HTMLPanel ui:field="panelBaseLayers">
|
||||
</g:HTMLPanel>
|
||||
</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"
|
||||
ui:field="searchFacilityButton">
|
||||
<g:FlowPanel addStyleNames="search-field">
|
||||
|
@ -73,9 +80,8 @@
|
|||
<g:ScrollPanel ui:field="searchFacilityPanel"
|
||||
addStyleNames="search-facility"></g:ScrollPanel>
|
||||
</b:DropdownButton>
|
||||
<b:DropdownButton type="LINK"
|
||||
title="Center Map to Location" text="Preset Location"
|
||||
ui:field="linkPresetLocation">
|
||||
<b:DropdownButton type="LINK" text="Preset Location"
|
||||
ui:field="linkPresetLocation" addStyleNames="preset-location">
|
||||
<b:Nav>
|
||||
<b:Button type="LINK" ui:field="extentToItaly"
|
||||
text="Italy" title="Center to Italy"></b:Button>
|
||||
|
@ -99,8 +105,8 @@
|
|||
text="Remove Query" visible="false"></b:Button>
|
||||
<b:Button type="LINK" text="Layers" ui:field="linkLayers">
|
||||
</b:Button>
|
||||
<g:ScrollPanel ui:field="overlayLayersPanel"
|
||||
addStyleNames="layers-panel" visible="false"></g:ScrollPanel>
|
||||
<!-- <g:ScrollPanel ui:field="overlayLayersPanel"
|
||||
addStyleNames="layers-panel" visible="false"></g:ScrollPanel> -->
|
||||
</g:HTMLPanel>
|
||||
</g:HTMLPanel>
|
||||
<c:DetailsPanel ui:field="detailsPanel"
|
||||
|
|
|
@ -49,7 +49,7 @@ public class ImagesSectionGallery {
|
|||
*/
|
||||
private native void showGallery(JavaScriptObject json_array_images, String galleryDivId) /*-{
|
||||
|
||||
console.log("showing: " + json_array_images)
|
||||
//console.log("showing: " + json_array_images)
|
||||
var waitForJQuery = setInterval(
|
||||
function() {
|
||||
if (typeof $wnd.$ != 'undefined') {
|
||||
|
|
|
@ -101,9 +101,11 @@ public class LayersSectionViewer extends Composite {
|
|||
|
||||
BBOXDV bbox = layer.getBbox();
|
||||
|
||||
if(bbox!=null) {
|
||||
try {
|
||||
|
||||
if(!GWT.isProdMode()) {
|
||||
if (bbox != null) {
|
||||
|
||||
if (!GWT.isProdMode()) {
|
||||
GWT.log("bbox: " + bbox);
|
||||
// GWT.log("bbox keys: " + bbox.keySet());
|
||||
// GWT.log("bbox values: " + bbox.values());
|
||||
|
@ -116,7 +118,7 @@ public class LayersSectionViewer extends Composite {
|
|||
BoundsMap bounds = new BoundsMap(bbox.getMinX(), bbox.getMinY(), bbox.getMaxX(), bbox.getMaxY(), "");
|
||||
GWT.log("bounds: " + bounds);
|
||||
mapView.addWMSLayer(mapServerHost, layerName, bounds);
|
||||
}else {
|
||||
} else {
|
||||
Alert alert = new Alert();
|
||||
alert.setType(AlertType.ERROR);
|
||||
alert.setText("No BBOX found for this layer");
|
||||
|
@ -124,6 +126,15 @@ public class LayersSectionViewer extends Composite {
|
|||
layerPanel.add(alert);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Alert alert = new Alert();
|
||||
alert.setType(AlertType.ERROR);
|
||||
alert.setHTML("Error on adding the layer to Map. Please check its WMS link: <br/>"+layer.getWMSLink());
|
||||
alert.getElement().getStyle().setProperty("wordBreak", "break-all");
|
||||
alert.setClose(false);
|
||||
layerPanel.add(alert);
|
||||
}
|
||||
|
||||
|
||||
String htmlLinkId = mapView.getPanelMapElementId() + "-image-download";
|
||||
|
||||
|
@ -138,18 +149,6 @@ public class LayersSectionViewer extends Composite {
|
|||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
// DOWNLOAD only the layer by Geoserver
|
||||
/*
|
||||
* Map<String, String> mapLayerURLs =
|
||||
* mapView.getLightOLSM().getLayerURLsProperty(); Collection<String> layerURLs =
|
||||
* mapLayerURLs.values(); ArrayList<String> layers = new
|
||||
* ArrayList<String>(layerURLs); exportPDF(layers.get(0)); String layerURL =
|
||||
* mapLayerURLs.get(layerDV.getLayerName()); GWT.log("layerDV name is: " +
|
||||
* layerDV.getLayerName()); if (layerURL != null) Window.open(layerURL,
|
||||
* "_blank", null);
|
||||
*/
|
||||
|
||||
downloadAttempt++;
|
||||
|
||||
if (downloadAttempt > 3) {
|
||||
|
@ -160,7 +159,6 @@ public class LayersSectionViewer extends Composite {
|
|||
// DOWNLOAD the OSM + layer by canvas
|
||||
downloadMap(mapView.getLightOLM().getMap(), mapView.getPanelMapElementId(), htmlLinkId, filename,
|
||||
mimeType);
|
||||
// mapExport(mapView.getLightOLSM().getMap(), mapView.getPanelMapElementId());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -189,7 +187,7 @@ public class LayersSectionViewer extends Composite {
|
|||
*/
|
||||
public static native void downloadMap(ol.Map map, String mapPanelId, String linkId, String filename,
|
||||
String mimeType)/*-{
|
||||
console.log("map: " + map);
|
||||
//console.log("map: " + map);
|
||||
|
||||
map.once('rendercomplete', function() {
|
||||
var mapCanvas = $doc.createElement('canvas');
|
||||
|
|
|
@ -4,9 +4,11 @@ import java.util.List;
|
|||
|
||||
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||
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.view.ProjectView;
|
||||
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.MAP_PROJECTION;
|
||||
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.IconType;
|
||||
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.event.dom.client.ClickEvent;
|
||||
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.rpc.AsyncCallback;
|
||||
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.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 ol.Coordinate;
|
||||
|
@ -83,6 +94,9 @@ public class ProjectViewer extends Composite {
|
|||
@UiField
|
||||
Button expandButton;
|
||||
|
||||
@UiField
|
||||
Button exportButton;
|
||||
|
||||
@UiField
|
||||
Button relationshipsButton;
|
||||
|
||||
|
@ -136,6 +150,22 @@ public class ProjectViewer extends Composite {
|
|||
this.geoportalItemReferences = geoportalItemRefs;
|
||||
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
|
||||
? projectView.getTheProjectDV().getProfileName()
|
||||
: "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.setIcon(IconType.LINK);
|
||||
relationshipsButton.setTitle("Show Relationships of this Project");
|
||||
|
@ -240,14 +343,6 @@ public class ProjectViewer extends Composite {
|
|||
public void onClick(ClickEvent event) {
|
||||
boolean visible = toc_list_container.isVisible();
|
||||
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();
|
||||
|
||||
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());
|
||||
|
||||
if (transfCoord != null) {
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
color: white;
|
||||
padding: 10px 10px;
|
||||
font-size: 14px;
|
||||
padding-left: 40px;
|
||||
}
|
||||
|
||||
.width-100 {
|
||||
|
@ -43,9 +44,10 @@
|
|||
<g:HorizontalPanel
|
||||
addStyleNames="functionalities-style">
|
||||
<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="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:HTMLPanel ui:field="centroidPanel"></g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="tableOfContentPanel"
|
||||
|
|
|
@ -17,6 +17,8 @@ import com.github.gwtbootstrap.client.ui.PageHeader;
|
|||
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
|
@ -48,18 +50,24 @@ public class SectionViewer extends Composite {
|
|||
sectionTitle.setTitle(sectionView.getSectionTitle());
|
||||
sectionTitle.setText(sectionView.getSectionTitle());
|
||||
|
||||
if (subDocuments == null)
|
||||
return;
|
||||
|
||||
Button goToTop = new Button("");
|
||||
goToTop.setType(ButtonType.LINK);
|
||||
goToTop.setIcon(IconType.DOUBLE_ANGLE_UP);
|
||||
goToTop.setHref("#"+topTargetId);
|
||||
goToTop.setHref("#" + topTargetId);
|
||||
goToTop.setTitle("Go to top");
|
||||
goToTop.getElement().setClassName("go-top-right");
|
||||
|
||||
sectionTitle.add(goToTop);
|
||||
|
||||
boolean displayAsGallery = false;
|
||||
|
||||
try {
|
||||
for (SubDocumentView subDocumentView : subDocuments) {
|
||||
if (subDocumentView.getListImages() != null && subDocumentView.getListImages().size() > 0) {
|
||||
GWT.log("Section with images: " + subDocumentView.getListImages());
|
||||
displayAsGallery = true;
|
||||
break;
|
||||
}
|
||||
|
@ -68,6 +76,7 @@ public class SectionViewer extends Composite {
|
|||
boolean displayAsMapOfLayers = false;
|
||||
for (SubDocumentView subDocumentView : subDocuments) {
|
||||
if (subDocumentView.getListLayers() != null && subDocumentView.getListLayers().size() > 0) {
|
||||
GWT.log("Section with layers: " + subDocumentView.getListImages());
|
||||
displayAsMapOfLayers = true;
|
||||
break;
|
||||
}
|
||||
|
@ -75,14 +84,22 @@ public class SectionViewer extends Composite {
|
|||
|
||||
// Displaying the whole section as a Gallery
|
||||
if (displayAsGallery) {
|
||||
GWT.log("displayAsGallery the: "+sectionView);
|
||||
GWT.log("displayAsGallery the: " + sectionView);
|
||||
ImagesSectionGallery sectionGallery = new ImagesSectionGallery(sectionView);
|
||||
sectionPanelContainer.add(sectionGallery.getGalleryPanel());
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
sectionGallery.fillGallery();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Displaying the whole section as a Map of Layers
|
||||
} else if (displayAsMapOfLayers) {
|
||||
GWT.log("displayAsMapOfLayers the: "+sectionView);
|
||||
GWT.log("displayAsMapOfLayers the: " + sectionView);
|
||||
for (SubDocumentView subDocumentView : subDocuments) {
|
||||
// String table = GeoportalDataViewerConstants.jsonToTableHTML(subDocumentView.getMetadataAsJSON());
|
||||
// sectionPanelContainer.add(new HTML(table));
|
||||
|
@ -90,15 +107,16 @@ public class SectionViewer extends Composite {
|
|||
List<GCubeSDIViewerLayerDV> layers = subDocumentView.getListLayers();
|
||||
if (layers != null) {
|
||||
for (GCubeSDIViewerLayerDV gCubeLayer : layers) {
|
||||
LayersSectionViewer layerSectionViewer = new LayersSectionViewer(gCubeLayer, subDocumentView);
|
||||
LayersSectionViewer layerSectionViewer = new LayersSectionViewer(gCubeLayer,
|
||||
subDocumentView);
|
||||
sectionPanelContainer.add(layerSectionViewer);
|
||||
//showLinkToDownloadWsContent(fileset.getName(), fileset.getListPayload());
|
||||
// showLinkToDownloadWsContent(fileset.getName(), fileset.getListPayload());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
GWT.log("displaying default the: "+sectionView);
|
||||
} else {
|
||||
GWT.log("displaying default the: " + sectionView);
|
||||
for (SubDocumentView subDocumentView : subDocuments) {
|
||||
String table = GeoportalDataViewerConstants.jsonToTableHTML(subDocumentView.getMetadataAsJSON());
|
||||
sectionPanelContainer.add(new HTML(table));
|
||||
|
@ -106,11 +124,14 @@ public class SectionViewer extends Composite {
|
|||
List<FilesetDV> files = subDocumentView.getListFiles();
|
||||
if (files != null) {
|
||||
for (FilesetDV fileset : files) {
|
||||
showLinkToDownloadWsContent(fileset.getName(), fileset.getListPayload());
|
||||
showLinkToDownloadWsContent(fileset.getGcubeProfileFieldName(), fileset.getListPayload());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
GWT.log("Error on rendering the section: "+e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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.events.ShowDetailsEvent;
|
||||
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.util.LoaderIcon;
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class TimelineRelationPanel extends Composite {
|
|||
Anchor timelinePopupCloser;
|
||||
|
||||
private LoaderIcon loaderData = new LoaderIcon("Loading data... please wait",
|
||||
new Image(GNAImages.ICONS.spinnerClock()));
|
||||
new Image(GeoportalImages.ICONS.spinnerClock()));
|
||||
|
||||
private TimelineRelationPanel instance = this;
|
||||
|
||||
|
@ -144,7 +144,8 @@ public class TimelineRelationPanel extends Composite {
|
|||
final String thePofileID = references[0];
|
||||
final String theProjectID = references[1];
|
||||
GeoportalItemReferences gir = new GeoportalItemReferences(theProjectID, thePofileID);
|
||||
ShowDetailsEvent showDetailsEvent = new ShowDetailsEvent(gir, null, false, false, EVENT_SOURCE.LOCATE_FROM_TIMELINE);
|
||||
ShowDetailsEvent showDetailsEvent = new ShowDetailsEvent(gir, null, false, false,
|
||||
EVENT_SOURCE.LOCATE_FROM_TIMELINE);
|
||||
showDetailsEvent.setEventFromTimeline(true);
|
||||
GWT.log("fireEvent: " + showDetailsEvent);
|
||||
|
||||
|
@ -157,19 +158,19 @@ public class TimelineRelationPanel extends Composite {
|
|||
|
||||
public static native String instanceTimeline(String idDivContainer, JSONArray jsonItems,
|
||||
TimelineRelationPanel instance) /*-{
|
||||
console.log('showTimeline_instanceTimeline for json items: '
|
||||
+ jsonItems);
|
||||
console.log('showing timeline');
|
||||
//console.log('showTimeline_instanceTimeline for json items: '+jsonItems);
|
||||
|
||||
console.log("showTimeline_template: " + $wnd.templateHandlebars);
|
||||
//console.log("showTimeline_template: " + $wnd.templateHandlebars);
|
||||
|
||||
// DOM element where the Timeline will be attached
|
||||
var container = $doc.getElementById(idDivContainer);
|
||||
|
||||
console.log("showTimeline_container: " + container);
|
||||
//console.log("showTimeline_container: " + container);
|
||||
|
||||
var myArray = $wnd.JSON.parse(jsonItems);
|
||||
|
||||
console.log("showTimeline_jsonItems: " + myArray);
|
||||
//console.log("showTimeline_jsonItems: " + myArray);
|
||||
|
||||
var container = $doc.getElementById(idDivContainer);
|
||||
|
||||
|
|
|
@ -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.ResultDocumentDV;
|
||||
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.events.ClosedViewDetailsEvent;
|
||||
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 {
|
||||
|
||||
private static final int SEARCHING_LIMIT_RESULTS_TO = 50;
|
||||
|
||||
private static SearchFacilityPanelUiBinder uiBinder = GWT.create(SearchFacilityPanelUiBinder.class);
|
||||
|
||||
protected static final int MIN_LENGHT_SERCHING_STRING = 3;
|
||||
|
@ -127,6 +126,7 @@ public class SearchFacilityUI extends Composite {
|
|||
*
|
||||
* @param profileID the profile ID
|
||||
* @param appManagerBus the app manager bus
|
||||
* @param displayByFields the display by fields
|
||||
* @param sortByFields the sort by fields
|
||||
* @param searchForFields the search for fields
|
||||
* @param initialSortFilter the initial sort filter
|
||||
|
@ -237,6 +237,9 @@ public class SearchFacilityUI extends Composite {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset current search.
|
||||
*/
|
||||
public void resetCurrentSearch() {
|
||||
searchField.setText("");
|
||||
resetSearch.setVisible(false);
|
||||
|
@ -268,8 +271,9 @@ public class SearchFacilityUI extends Composite {
|
|||
panelResults.clear();
|
||||
panelResults.add(new HTML("<hr>"));
|
||||
panelResults.add(new LoaderIcon("Searching..."));
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().getListProjects(profileID, 0, SEARCHING_LIMIT_RESULTS_TO,
|
||||
filter, false, new AsyncCallback<ResultSetPaginatedDataIDs>() {
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().getListProjects(profileID, 0,
|
||||
GeoportalDataViewerConstants.SEARCH_LIMIT_RESULTS_TO_MAXIMUM, filter, false,
|
||||
new AsyncCallback<ResultSetPaginatedDataIDs>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -309,11 +313,12 @@ public class SearchFacilityUI extends Composite {
|
|||
+ "). Please find below the top " + returnedItems + ".<br>";
|
||||
} else if (returnedItems > 0) {
|
||||
message = "Found " + returnedItems;
|
||||
message += returnedItems > 0 ? " items" : " item";
|
||||
message += ". ";
|
||||
message += returnedItems > 0 ? " projects" : " project";
|
||||
message += ".";
|
||||
}
|
||||
|
||||
if (returnedItems > 0) {
|
||||
if (returnedItems > 0
|
||||
&& returnedItems <= GeoportalDataViewerConstants.SEARCH_LIMIT_RESULTS_TO_MAXIMUM) {
|
||||
message += "On the map you can see all the projects with a centroid matching the query";
|
||||
}
|
||||
|
||||
|
@ -356,7 +361,8 @@ public class SearchFacilityUI extends Composite {
|
|||
profileID);
|
||||
// here
|
||||
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,
|
||||
// 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>
|
|
@ -2,13 +2,15 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd;
|
|||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent;
|
||||
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.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.util.LoaderIcon;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||
|
@ -19,6 +21,7 @@ import com.github.gwtbootstrap.client.ui.constants.IconType;
|
|||
import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.dom.client.Style.FontWeight;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
|
@ -32,21 +35,33 @@ import com.google.gwt.event.dom.client.DropEvent;
|
|||
import com.google.gwt.event.dom.client.DropHandler;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.FlexTable;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.SimplePanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class DragDropLayer extends FlowPanel {
|
||||
|
||||
private static final String _22PX = "22px";
|
||||
private static DragDropLayer dragging = null;
|
||||
private static DragDropLayer draggingTarget = null;
|
||||
final boolean droppable;
|
||||
private Label labelLayerName;
|
||||
private Image imgLayerVisible = new Image(GNAImages.ICONS.layerVisible());
|
||||
private Image imgLayerInvisible = new Image(GNAImages.ICONS.layerInvisible());
|
||||
private Image imgLayerVisible = new Image(GeoportalImages.ICONS.layerVisible());
|
||||
private Image imgLayerInvisible = new Image(GeoportalImages.ICONS.layerInvisible());
|
||||
|
||||
private Image imgLocate = new Image(GeoportalImages.ICONS.locate());
|
||||
private Image imgLocateNone = new Image(GeoportalImages.ICONS.locateNone());
|
||||
private boolean locateEnabled = false;
|
||||
private HTML buttonLocate = new HTML();
|
||||
|
||||
private DragDropLayer INSTANCE = this;
|
||||
|
||||
private LoaderIcon loaderIcon = new LoaderIcon("Loading features", null);
|
||||
|
||||
private Button draggableButton = new Button();
|
||||
private HandlerManager applicationBus;
|
||||
private LayerObject layerObject;
|
||||
|
@ -61,6 +76,26 @@ public class DragDropLayer extends FlowPanel {
|
|||
this.layerItem = layerObject.getLayerItem();
|
||||
GWT.log("DragDropLayer for projectDV: " + layerObject.getProjectDV());
|
||||
|
||||
// Checking the spatial reference
|
||||
if (layerObject.getProjectDV() != null && layerObject.getProjectDV().getSpatialReference() == null) {
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().getSpatialReference(layerObject.getProfileID(),
|
||||
layerObject.getProjectID(), new AsyncCallback<GeoJSON>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(GeoJSON result) {
|
||||
if (result != null)
|
||||
layerObject.getProjectDV().setSpatialReference(result);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
String referProjectID = "Project ID: " + layerObject.getProjectDV().getId();
|
||||
labelProject = new com.google.gwt.user.client.ui.Label("");
|
||||
labelProject.setTitle(referProjectID);
|
||||
|
@ -119,26 +154,57 @@ public class DragDropLayer extends FlowPanel {
|
|||
|
||||
RangeSlider rs = new RangeSlider(applicationBus, layerItem);
|
||||
rs.getElement().addClassName("range-slider");
|
||||
FlexTable ft = new FlexTable();
|
||||
ft.setWidget(0, 0, draggableButton);
|
||||
|
||||
// FlexTable ft = new FlexTable();
|
||||
// ft.setWidget(0, 0, draggableButton);
|
||||
draggableButton.setTitle("Drag and Drop me up or down to change my position on the Map");
|
||||
|
||||
imgLayerVisible.getElement().addClassName("layer-visibility-st");
|
||||
imgLayerInvisible.getElement().addClassName("layer-visibility-st");
|
||||
|
||||
imgLocate.setWidth(_22PX);
|
||||
imgLocate.setHeight(_22PX);
|
||||
imgLocateNone.setWidth(_22PX);
|
||||
imgLocateNone.setHeight(_22PX);
|
||||
imgLocate.getElement().addClassName("layer-visibility-st");
|
||||
imgLocateNone.getElement().addClassName("layer-visibility-st");
|
||||
setLocateEnabledButtonImage();
|
||||
|
||||
setLayerVisibilityButtonImage();
|
||||
|
||||
// labelLayerName.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
||||
ft.setWidget(0, 1, buttonLayerVisibility);
|
||||
ft.setWidget(0, 2, labelProject);
|
||||
VerticalPanel vp = new VerticalPanel();
|
||||
VerticalPanel vpInner = new VerticalPanel();
|
||||
HorizontalPanel hp0 = new HorizontalPanel();
|
||||
HorizontalPanel hpFunct = new HorizontalPanel();
|
||||
vpInner.getElement().getStyle().setMarginLeft(47, Unit.PX);
|
||||
|
||||
hp0.add(draggableButton);
|
||||
labelProject.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
||||
labelProject.getElement().getStyle().setFontWeight(FontWeight.BOLD);
|
||||
hp0.add(labelProject);
|
||||
hpFunct.add(buttonLayerVisibility);
|
||||
hpFunct.add(buttonLocate);
|
||||
hpFunct.add(loaderIcon);
|
||||
setVisibleLoaderFeatures(false, null);
|
||||
|
||||
if(layerObject.getProjectDV().getTemporalReference()!=null) {
|
||||
TemporalReferenceDV tempRef = layerObject.getProjectDV().getTemporalReference();
|
||||
ft.setWidget(ft.getRowCount()+1, 2, new HTML(ProjectUtil.toHTMLCode(tempRef)));
|
||||
if(tempRef.getStart()!=null || tempRef.getEnd()!=null)
|
||||
vpInner.add(new HTML(ProjectUtil.toHTMLCode(tempRef)));
|
||||
}
|
||||
|
||||
ft.setWidget(ft.getRowCount()+1, 2, labelLayerName);
|
||||
ft.setWidget(ft.getRowCount()+1, 2, new SimplePanel(rs));
|
||||
add(ft);
|
||||
vpInner.add(labelLayerName);
|
||||
// vpInner.add(new SimplePanel(rs));
|
||||
|
||||
vp.add(hp0);
|
||||
hpFunct.getElement().getStyle().setMarginTop(5, Unit.PX);
|
||||
vpInner.add(hpFunct);
|
||||
vpInner.add(new SimplePanel(rs));
|
||||
vp.add(vpInner);
|
||||
|
||||
add(vp);
|
||||
|
||||
// add(ft);
|
||||
draggableButton.setIcon(IconType.MOVE);
|
||||
|
||||
buttonLayerVisibility.addClickHandler(new ClickHandler() {
|
||||
|
@ -147,20 +213,48 @@ public class DragDropLayer extends FlowPanel {
|
|||
public void onClick(ClickEvent event) {
|
||||
layerVisibility = !layerVisibility;
|
||||
setLayerVisibilityButtonImage();
|
||||
DoActionOnDetailLayersEvent dae = new DoActionOnDetailLayersEvent(DO_LAYER_ACTION.VISIBILITY,
|
||||
layerItem);
|
||||
DoActionOnDetailLayersEvent dae = new DoActionOnDetailLayersEvent(DO_LAYER_ACTION.VISIBILITY, layerItem,
|
||||
layerObject);
|
||||
dae.setVisibility(layerVisibility);
|
||||
applicationBus.fireEvent(dae);
|
||||
}
|
||||
});
|
||||
|
||||
buttonLocate.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
locateEnabled = !locateEnabled;
|
||||
setLocateEnabledButtonImage();
|
||||
DoActionOnDetailLayersEvent dae = new DoActionOnDetailLayersEvent(DO_LAYER_ACTION.LOCATE_LAYER,
|
||||
layerItem, layerObject);
|
||||
dae.setUIEventSource(INSTANCE);
|
||||
setVisibleLoaderFeatures(true, null);
|
||||
applicationBus.fireEvent(dae);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setLayerVisibilityButtonImage() {
|
||||
buttonLayerVisibility.getElement().removeAllChildren();
|
||||
if (layerVisibility) {
|
||||
buttonLayerVisibility.getElement().appendChild(imgLayerVisible.getElement());
|
||||
buttonLayerVisibility.setTitle("Hide the layer");
|
||||
} else {
|
||||
buttonLayerVisibility.getElement().appendChild(imgLayerInvisible.getElement());
|
||||
buttonLayerVisibility.setTitle("Show the layer");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setLocateEnabledButtonImage() {
|
||||
buttonLocate.getElement().removeAllChildren();
|
||||
if (locateEnabled) {
|
||||
buttonLocate.getElement().appendChild(imgLocate.getElement());
|
||||
buttonLocate.setTitle("Unselect the layer features");
|
||||
} else {
|
||||
buttonLocate.getElement().appendChild(imgLocateNone.getElement());
|
||||
buttonLocate.setTitle("Highlight the layer features");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -226,7 +320,7 @@ public class DragDropLayer extends FlowPanel {
|
|||
tree.insert(source, targetIndex);
|
||||
// target.setState(true);
|
||||
DoActionOnDetailLayersEvent actionSwapLayers = new DoActionOnDetailLayersEvent(
|
||||
DO_LAYER_ACTION.SWAP, layerItem);
|
||||
DO_LAYER_ACTION.SWAP, layerItem, layerObject);
|
||||
SwapLayer swapLS = new DoActionOnDetailLayersEvent.SwapLayer(dragging.getLayerItem(),
|
||||
sourceIndex);
|
||||
SwapLayer swapLT = new DoActionOnDetailLayersEvent.SwapLayer(draggingTarget.getLayerItem(),
|
||||
|
@ -245,4 +339,17 @@ public class DragDropLayer extends FlowPanel {
|
|||
return layerItem;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the visible loader features.
|
||||
*
|
||||
* @param bool the bool
|
||||
* @param msg the msg
|
||||
*/
|
||||
public void setVisibleLoaderFeatures(boolean bool, String msg) {
|
||||
loaderIcon.setVisible(bool);
|
||||
if(msg!=null)
|
||||
loaderIcon.setText(msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
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.DO_LAYER_ACTION;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||
|
@ -38,8 +39,8 @@ public class RangeSlider extends Composite {
|
|||
sliderId = "slider-" + Random.nextInt();
|
||||
theSlider.addClassName("slider");
|
||||
theSlider.setId(sliderId);
|
||||
|
||||
theSlider.setTitle("Set opacity of "+layer.getName());
|
||||
theSlider.setTitle("Set opacity of the layer");
|
||||
theSlider.setPropertyObject("value", GeoportalDataViewerConstants.INITIAL_LAYER_OPACITY*100);
|
||||
|
||||
bindEvents();
|
||||
}
|
||||
|
@ -54,11 +55,11 @@ public class RangeSlider extends Composite {
|
|||
if (Event.ONMOUSEUP == event.getTypeInt()) {
|
||||
GWT.log("Event.ONMOUSEUP");
|
||||
DoActionOnDetailLayersEvent actionChangeOpacity = new DoActionOnDetailLayersEvent(
|
||||
DO_LAYER_ACTION.OPACITY, layer);
|
||||
DO_LAYER_ACTION.OPACITY, layer, null);
|
||||
int value = Integer.parseInt((String) theSlider.getPropertyObject("value"));
|
||||
//GWT.log("opacity int value: "+value);
|
||||
double opacity = (double) ((double) value/100);
|
||||
GWT.log("opacity double value: "+opacity);
|
||||
// GWT.log("opacity int value: "+value);
|
||||
double opacity = (double) ((double) value / 100);
|
||||
GWT.log("opacity double value: " + opacity);
|
||||
actionChangeOpacity.setOpacity(opacity);
|
||||
applicationBus.fireEvent(actionChangeOpacity);
|
||||
}
|
||||
|
|
|
@ -146,13 +146,13 @@ public class DialogShareableLink extends Composite {
|
|||
/**
|
||||
* Instantiates a new dialog shareable link.
|
||||
*
|
||||
* @param item the item
|
||||
* @param itemRef the item ref
|
||||
* @param version the version
|
||||
*/
|
||||
public DialogShareableLink(GeoportalItemReferences item, String version) {
|
||||
public DialogShareableLink(GeoportalItemReferences itemRef, String version) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
||||
this.geonItemRef = item;
|
||||
this.geonItemRef = itemRef;
|
||||
this.fileVersion = version;
|
||||
this.actionAlert.setAnimation(true);
|
||||
|
||||
|
@ -186,7 +186,7 @@ public class DialogShareableLink extends Composite {
|
|||
showLoadingIcon(true);
|
||||
|
||||
// alertFilePublicLink.setVisible(true);
|
||||
loadAndShowPublicLinksForItem(item);
|
||||
loadAndShowPublicLinksForItem(itemRef);
|
||||
// getElement().setClassName("gwt-DialogBoxNew");
|
||||
modalBox.setTitle("Share Link...");
|
||||
ModalFooter modalFooter = new ModalFooter();
|
||||
|
@ -396,7 +396,7 @@ public class DialogShareableLink extends Composite {
|
|||
private native void copyToClipboard(String myDivId) /*-{
|
||||
|
||||
var copyText = $doc.getElementById(myDivId);
|
||||
console.log("text copied is :" + copyText.value);
|
||||
//console.log("text copied is :" + copyText.value);
|
||||
copyText.select();
|
||||
//For mobile devices
|
||||
copyText.setSelectionRange(0, 99999);
|
||||
|
|
|
@ -0,0 +1,359 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.layercollection;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer;
|
||||
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.OpenCollectionEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||
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 LayerCollectionPanel.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* May 15, 2023
|
||||
*/
|
||||
public class LayerCollectionPanel extends Composite {
|
||||
|
||||
public static String COLORSCALERANGE = "COLORSCALERANGE";
|
||||
|
||||
@UiField
|
||||
HTMLPanel basePanel;
|
||||
|
||||
@UiField
|
||||
HTMLPanel stylePanel;
|
||||
|
||||
@UiField
|
||||
HTMLPanel styleListPanel;
|
||||
|
||||
@UiField
|
||||
HTMLPanel statisticPanel;
|
||||
|
||||
@UiField
|
||||
Button buttonLegend;
|
||||
|
||||
@UiField
|
||||
ScrollPanel legendPanel;
|
||||
|
||||
private CheckBox checkbox;
|
||||
|
||||
private GeoInformationForWMSRequest geoInformation;
|
||||
|
||||
private static LayerCollectionPanelUiBinder uiBinder = GWT.create(LayerCollectionPanelUiBinder.class);
|
||||
|
||||
private ListBox listBoxStyles = new ListBox();
|
||||
|
||||
private String layerName;
|
||||
|
||||
private GCubeCollection gcubeCollection;
|
||||
|
||||
private HandlerManager applicationBus;
|
||||
|
||||
/**
|
||||
* The Interface LayerCollectionPanelUiBinder.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Jan 16, 2023
|
||||
*/
|
||||
interface LayerCollectionPanelUiBinder extends UiBinder<Widget, LayerCollectionPanel> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new layer collection panel.
|
||||
*
|
||||
* @param coll the coll
|
||||
* @param applicationBus the application bus
|
||||
*/
|
||||
public LayerCollectionPanel(final GCubeCollection coll, HandlerManager applicationBus) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.applicationBus = applicationBus;
|
||||
|
||||
buttonLegend.setType(ButtonType.LINK);
|
||||
legendPanel.setVisible(false);
|
||||
statisticPanel.setVisible(false);
|
||||
|
||||
GWT.log("Found available collection " + coll);
|
||||
String label = coll.getUcd().getName();
|
||||
final String collectionID = coll.getUcd().getId(); // collectionID == UCD_Id
|
||||
|
||||
checkbox = new CheckBox(label);
|
||||
checkbox.setId("gcubeCollectionSelector_" + collectionID);
|
||||
checkbox.getElement().getStyle().setFontWeight(FontWeight.BOLD);
|
||||
|
||||
checkbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||
GWT.log("Collection selector flag changed to value : " + event.toDebugString());
|
||||
GWT.log("Collection ID is : " + collectionID + ", event value: " + event.getValue());
|
||||
if (event.getValue()) {
|
||||
// OPEN COLLECTION
|
||||
applicationBus.fireEvent(new OpenCollectionEvent(collectionID));
|
||||
enableLayerStyle(true);
|
||||
} else {
|
||||
// CLOSE COLLECTION
|
||||
hideStyleLegend();
|
||||
resetLayerStyle();
|
||||
enableLayerStyle(false);
|
||||
applicationBus.fireEvent(new CloseCollectionEvent(collectionID));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
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();
|
||||
final GCubeCollection toOpen = theConfig.getAvailableCollections().get(collectionID);
|
||||
|
||||
// Check if indexes is empty
|
||||
if (toOpen.getIndexes() == null || toOpen.getIndexes().isEmpty()) {
|
||||
GWT.log("Unexpected empty indexes in collection " + toOpen);
|
||||
Window.alert("Cannot open collection index layer for " + toOpen.getUcd().getName() + ".");
|
||||
return;
|
||||
}
|
||||
this.gcubeCollection = toOpen;
|
||||
// TODO Get Default Index Layer
|
||||
// For now we just take the first - only 1 is expected
|
||||
IndexLayerDV layer = toOpen.getIndexes().get(0);
|
||||
// Open Index Layer
|
||||
|
||||
HashMap<String, String> ogcLinks = layer.getLayer().getOgcLinks();
|
||||
final String wmsLink = ogcLinks.get("wms");
|
||||
this.layerName = URLUtil.getValueOfParameter("layers", wmsLink);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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()) {
|
||||
hideStyleLegend();
|
||||
} else {
|
||||
legendPanel.setVisible(true);
|
||||
loadLegend(wmsLink);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
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.
|
||||
*
|
||||
* @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,25 @@
|
|||
<!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;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="basePanel">
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="statisticPanel" addStyleNames="statistic-style-panel">
|
||||
</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>
|
|
@ -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.LightOpenLayerMap;
|
||||
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.PLACE;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||
|
@ -86,7 +86,7 @@ public class MapView extends Composite {
|
|||
theMapPanel.setWidth(internalMapWidth);
|
||||
theMapPanel.setHeight(internalMapHeight);
|
||||
|
||||
linkMap.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
|
||||
linkMap.setCustomIconStyle(GeoportalIcons.CustomIconType.MAP.get());
|
||||
|
||||
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;
|
||||
|
||||
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.HorizontalPanel;
|
||||
|
@ -18,7 +18,7 @@ import com.google.gwt.user.client.ui.Image;
|
|||
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("");
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
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
|
||||
*
|
||||
|
@ -35,6 +35,20 @@ public class URLUtil {
|
|||
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.
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -27,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.RelationshipNavigationObject;
|
||||
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.rest.Projects;
|
||||
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
||||
|
@ -43,35 +44,50 @@ import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
|||
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||
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.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.materialization.GCubeSDILayer;
|
||||
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.innerobject.PayloadDV;
|
||||
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.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.HandlerDeclarationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||
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.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.GeoportalDataViewerService;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.gis.FeatureParser;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.gis.GisMakers;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.gis.WMSUrlValidator;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.GeoportalServiceIdentityProxy;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.util.ContextRequest;
|
||||
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.TemporalComparatorUtil;
|
||||
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.ResultSetPaginatedDataIDs;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.faults.ControlledError;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObjectType;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
|
||||
|
@ -112,6 +128,52 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
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.
|
||||
*
|
||||
|
@ -202,7 +264,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
public GeoInformationForWMSRequest loadGeoInfoForWmsRequest(String wmsLink, String layerName) throws Exception {
|
||||
try {
|
||||
WMSUrlValidator validator = new WMSUrlValidator(wmsLink, layerName);
|
||||
String wmsServiceHost = validator.getWmsServiceHost();
|
||||
String wmsServiceServiceEndpoint = validator.getWmsServiceEndPoint();
|
||||
String validWMSRequest = validator.parseWMSRequest(true, true);
|
||||
layerName = validator.getLayerName();
|
||||
String versionWms = validator.getValueOfParsedWMSParameter(WmsParameters.VERSION);
|
||||
|
@ -229,8 +291,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
? new ZAxis(layerZAxis.getUnits(), layerZAxis.isPositive(), layerZAxis.getValues())
|
||||
: null;
|
||||
|
||||
return new GeoInformationForWMSRequest(wmsServiceHost, validWMSRequest, layerName, versionWms, crs,
|
||||
mapWmsNotStandard, styles, styles.isNcWms(), zAxis);
|
||||
return new GeoInformationForWMSRequest(wmsServiceServiceEndpoint, validWMSRequest, layerName, versionWms,
|
||||
crs, mapWmsNotStandard, styles, styles.isNcWms(), zAxis);
|
||||
} catch (Exception e) {
|
||||
String msg = "An error occurred during wms request validation for layer: " + layerName;
|
||||
LOG.error(msg, e);
|
||||
|
@ -320,9 +382,9 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
if (item.getProfileID() == 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();
|
||||
return gc.getPublicLinksFor(item, true);
|
||||
return gc.getPublicLinksFor(gcubeScope, item, true);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error on getPublicLinksFor for: " + item, e);
|
||||
|
@ -347,19 +409,19 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
* @param layerObjects the layer objects
|
||||
* @param mapSrsName the map srs name
|
||||
* @param selectBBOX the select BBOX
|
||||
* @param maxWFSFeature the max WFS feature
|
||||
* @param maxWFSFeature the max WFS feature. If 0 means all feature
|
||||
* @param zoomLevel the zoom level
|
||||
* @return the WFS features
|
||||
*/
|
||||
@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) {
|
||||
LOG.info("getWFSFeatures called");
|
||||
|
||||
List<GeoNaSpatialQueryResult> listDAO = new ArrayList<GeoNaSpatialQueryResult>(layerObjects.size());
|
||||
List<GeoportalSpatialQueryResult> listDAO = new ArrayList<GeoportalSpatialQueryResult>(layerObjects.size());
|
||||
|
||||
for (LayerObject layerObject : layerObjects) {
|
||||
GeoNaSpatialQueryResult geoDAO = new GeoNaSpatialQueryResult();
|
||||
GeoportalSpatialQueryResult geoDAO = new GeoportalSpatialQueryResult();
|
||||
List<FeatureRow> features = FeatureParser.getWFSFeatures(layerObject.getLayerItem(), mapSrsName, selectBBOX,
|
||||
maxWFSFeature);
|
||||
LOG.debug("For layer name: " + layerObject.getLayerItem().getName() + " got features: " + features);
|
||||
|
@ -436,50 +498,53 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
try {
|
||||
LOG.debug("Checking configuration for collection " + u.getId());
|
||||
|
||||
SessionUtil.addCollectionToSession(getThreadLocalRequest(), u);
|
||||
|
||||
Projects<Project> p = projects(u.getId()).build();
|
||||
|
||||
UseCaseDescriptorDV ucd = ConvertToDataValueObjectModel.toUseCaseDescriptorDV(u, null);
|
||||
UseCaseDescriptorDV ucdDV = ConvertToDataValueObjectModel.toUseCaseDescriptorDV(u, null);
|
||||
Configuration ucdConfig = p.getConfiguration();
|
||||
GCubeCollection coll = new GCubeCollection();
|
||||
coll.setUcd(ucd);
|
||||
coll.setUcd(ucdDV);
|
||||
|
||||
// TODO TO Check index flag should be in configuration or evaluated according to
|
||||
// user credentials
|
||||
|
||||
String indexFlag = "public"; // default
|
||||
CENTROID_LAYER_INDEX_FLAG setIndexFlag = null;
|
||||
|
||||
GeoportalServiceIdentityProxy gsp = getGeoportalServiceProxy();
|
||||
if (gsp.isUser()) {
|
||||
indexFlag = "internal";
|
||||
LOG.info("user logged - using indexFlag: " + indexFlag);
|
||||
setIndexFlag = CENTROID_LAYER_INDEX_FLAG.PRIVATE;
|
||||
LOG.info("user logged - using indexFlag: " + setIndexFlag);
|
||||
} else if (gsp.isIAMClient()) {
|
||||
indexFlag = "public";
|
||||
LOG.info("user not logged - using indexFlag: " + indexFlag);
|
||||
setIndexFlag = CENTROID_LAYER_INDEX_FLAG.PUBLIC;
|
||||
LOG.info("user not logged - using indexFlag: " + setIndexFlag);
|
||||
}
|
||||
|
||||
// TODO constant
|
||||
coll.setIndexes(new ArrayList());
|
||||
|
||||
LOG.debug(
|
||||
"Checking if " + u.getId() + " is GIS Indexed. Index flag needed is " + indexFlag);
|
||||
|
||||
for (Index index : ucdConfig.getIndexes()) {
|
||||
try {
|
||||
IndexLayerDV toAdd = ConvertToDataValueObjectModel.convert(index);
|
||||
if (toAdd.getFlag().equals(indexFlag)) {
|
||||
LOG.debug("Checking if " + u.getId() + " is GIS Indexed. Index flag needed is '"
|
||||
+ setIndexFlag + "'");
|
||||
IndexLayerDV toAdd = getLayerIndex(ucdConfig, setIndexFlag);
|
||||
if (toAdd != null) {
|
||||
coll.getIndexes().add(toAdd);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.debug("Skipping invalid index ", e);
|
||||
} catch (Throwable t) {
|
||||
LOG.error("Unable to check index ", t);
|
||||
|
||||
// Using the public centroid layer as default
|
||||
if (coll.getIndexes().isEmpty()) {
|
||||
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())
|
||||
LOG.info("No available GIS Index for collection " + coll.getUcd().getName());
|
||||
else
|
||||
if (!coll.getIndexes().isEmpty())
|
||||
config.getAvailableCollections().put(coll.getUcd().getId(), coll);
|
||||
|
||||
} catch (Throwable t) {
|
||||
|
@ -499,6 +564,151 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
}.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.
|
||||
*
|
||||
|
@ -605,7 +815,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
*/
|
||||
@Override
|
||||
protected void onBeforeRequestDeserialized(String serializedRequest) {
|
||||
LOG.info("onBeforeRequestDeserialized called");
|
||||
LOG.debug("onBeforeRequestDeserialized called");
|
||||
String scope = "";
|
||||
|
||||
try {
|
||||
|
@ -770,9 +980,10 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
|
||||
String filesetParentJSONPath = null;
|
||||
|
||||
//(see ticket #24390)
|
||||
// (see ticket #24390)
|
||||
if (accessPolicy.equals(ACCESS_POLICY.OPEN)) {
|
||||
// Filtering for ACCESS_POLICY.OPEN from the fileset when the username is not in session. IAM
|
||||
// Filtering for ACCESS_POLICY.OPEN from the fileset when the username is not in
|
||||
// session. IAM
|
||||
// identity is running, no logged in user.
|
||||
filesetParentJSONPath = String.format("%s..%s[?(@._access._policy=='%s')]",
|
||||
Geoportal_JSON_Mapper.JSON_$_POINTER, Geoportal_JSON_Mapper.FILESET, accessPolicy);
|
||||
|
@ -894,8 +1105,10 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
theProjectDV.setProfileName(ucd.getName());
|
||||
|
||||
TemporalReferenceDV temporalReference = temporalReferenceForProject(theProject);
|
||||
|
||||
if (temporalReference == null)
|
||||
temporalReference = new TemporalReferenceDV();
|
||||
|
||||
theProjectDV.setTemporalReference(temporalReference);
|
||||
|
||||
ProjectView projectView = Geoportal_JSON_Mapper.loadProjectView(theProjectDV, scope, userName);
|
||||
|
@ -986,7 +1199,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@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 {
|
||||
LOG.info("getDataResult called");
|
||||
|
||||
|
@ -1001,13 +1214,13 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
+ ", zoomLevel: " + zoomLevel);
|
||||
}
|
||||
|
||||
List<GeoNaSpatialQueryResult> listDAO = new ArrayList<GeoNaSpatialQueryResult>(layerObjects.size());
|
||||
List<GeoportalSpatialQueryResult> listDAO = new ArrayList<GeoportalSpatialQueryResult>(layerObjects.size());
|
||||
|
||||
try {
|
||||
new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
|
||||
|
||||
for (LayerObject layerObject : layerObjects) {
|
||||
GeoNaSpatialQueryResult geoDAO = new GeoNaSpatialQueryResult();
|
||||
GeoportalSpatialQueryResult geoDAO = new GeoportalSpatialQueryResult();
|
||||
List<FeatureRow> features = FeatureParser.getWFSFeatures(layerObject.getLayerItem(), mapSrsName,
|
||||
selectBBOX, maxWFSFeature);
|
||||
LOG.debug("For layer name: " + layerObject.getLayerItem().getName() + " got features: " + features);
|
||||
|
@ -1267,7 +1480,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
break;
|
||||
|
||||
Entry<String, Object> entry = entrySetsIt.next();
|
||||
documentAsMap.put(entry.getKey(), entry.getValue());
|
||||
documentAsMap.put(entry.getKey(), entry.getValue() != null ? entry.getValue().toString() : null);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
@ -1537,4 +1750,103 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the WFS request.
|
||||
*
|
||||
* @param layerItem the layer item
|
||||
* @param mapSrsName the map srs name
|
||||
* @param mapBBOX the map BBOX
|
||||
* @param maxFeatures the max features. If 0 means all feature
|
||||
* @param outputFormat the output format
|
||||
* @return the WFS request
|
||||
*/
|
||||
@Override
|
||||
public String getWFSRequest(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures,
|
||||
String outputFormat) {
|
||||
LOG.info("getWFSRequest called");
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("getWFSRequest parameters layerItem name: " + layerItem.getName(), ", mapSrsName: " + mapSrsName
|
||||
+ ", mapBBOX: " + mapBBOX + ", maxFeatures: " + maxFeatures + ", outputFormat: " + outputFormat);
|
||||
}
|
||||
String url = GisMakers.buildWFSFeatureQuery(layerItem, mapSrsName, mapBBOX, maxFeatures, outputFormat);
|
||||
LOG.info("returning WFSRequest: " + url);
|
||||
return url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the 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.
|
||||
*
|
||||
* @param layerItem the layer item
|
||||
* @param mapSrsName the map srs name
|
||||
* @param mapBBOX the map BBOX
|
||||
* @param maxFeatures the max features
|
||||
* @param outputFormat the output format
|
||||
* @return the WFS response
|
||||
*/
|
||||
@Override
|
||||
public String getWFSResponse(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures,
|
||||
String outputFormat) {
|
||||
LOG.info("getWFSResponse called");
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("getWFSResponse parameters layerItem name: " + layerItem.getName(), ", mapSrsName: " + mapSrsName
|
||||
+ ", mapBBOX: " + mapBBOX + ", maxFeatures: " + maxFeatures + ", outputFormat: " + outputFormat);
|
||||
}
|
||||
|
||||
String url = getWFSRequest(layerItem, mapSrsName, mapBBOX, maxFeatures, outputFormat);
|
||||
return HTTPRequestUtil.getResponse(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 {
|
||||
new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
|
||||
integer = GeoportalClientCaller.projects().getCountByPhaseFor(profileID, phase, status);
|
||||
LOG.info("getCountFor profileID: " + profileID + ", phase: " + phase + ", status: " + status
|
||||
+ " returning: " + integer);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error occurred in getCountFor for profileID: " + profileID, e);
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
|
@ -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.portlets.user.geoportaldataviewer.server.gis.MapServerRecognize.SERVERTYPE;
|
||||
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.LoggerFactory;
|
||||
|
||||
|
@ -57,15 +58,18 @@ public class GisMakers {
|
|||
* @param outputFormat the output format
|
||||
* @return the string
|
||||
*/
|
||||
public static String buildWFSFeatureQuery(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures, String outputFormat) {
|
||||
public static String buildWFSFeatureQuery(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX,
|
||||
int maxFeatures, String outputFormat) {
|
||||
|
||||
String link = layerItem.getMapServerHost();
|
||||
LOG.debug("Map server host URL: " + link);
|
||||
String link = layerItem.getMapServerEndpoint();
|
||||
LOG.debug("Map server endpoint: " + link);
|
||||
LOG.debug("CQL filter is: " + layerItem.getCqlFilter());
|
||||
LOG.debug("MAX FEATURES: " + maxFeatures);
|
||||
LOG.debug("BBOX: " + mapBBOX);
|
||||
LOG.debug("Output Format: " + outputFormat);
|
||||
|
||||
String outputformat = null;
|
||||
String boundingBox = "";
|
||||
String boundingBox = null;
|
||||
|
||||
// CASE MAP SERVER
|
||||
SERVERTYPE mapserverType = MapServerRecognize.recongnize(layerItem);
|
||||
|
@ -76,7 +80,9 @@ public class GisMakers {
|
|||
if (mapserverType.equals(SERVERTYPE.MAPSERVER)) {
|
||||
LOG.debug("wms url contains wxs is a map server? no appending /wfs ");
|
||||
outputformat = MapServerRecognize.outputFormatRecognize(SERVERTYPE.MAPSERVER, outputFormat);
|
||||
boundingBox = BBOX_FORMAT(COORDINATE_FORMAT.YX, ",",mapBBOX.getLowerLeftX(),mapBBOX.getLowerLeftY(),mapBBOX.getUpperRightX(),mapBBOX.getUpperRightY()); // USE AXIS XY
|
||||
if (mapBBOX != null)
|
||||
boundingBox = BBOX_FORMAT(COORDINATE_FORMAT.YX, ",", mapBBOX.getLowerLeftX(),
|
||||
mapBBOX.getLowerLeftY(), mapBBOX.getUpperRightX(), mapBBOX.getUpperRightY()); // USE AXIS XY
|
||||
// DEBUG
|
||||
LOG.debug("SERVERTYPE.MAPSERVER outputformat: " + outputformat);
|
||||
LOG.debug("SERVERTYPE.MAPSERVER srsName: " + mapSrsName);
|
||||
|
@ -86,7 +92,9 @@ public class GisMakers {
|
|||
link += link.endsWith("wfs") ? "" : "/wfs";
|
||||
outputformat = MapServerRecognize.outputFormatRecognize(SERVERTYPE.GEOSEVER, outputFormat);
|
||||
mapSrsName = "urn:x-ogc:def:crs:"+mapSrsName;
|
||||
boundingBox = BBOX_FORMAT(COORDINATE_FORMAT.YX, ",",mapBBOX.getLowerLeftX(),mapBBOX.getLowerLeftY(),mapBBOX.getUpperRightX(),mapBBOX.getUpperRightY()); // USE AXIS XY
|
||||
if (mapBBOX != null)
|
||||
boundingBox = BBOX_FORMAT(COORDINATE_FORMAT.YX, ",", mapBBOX.getLowerLeftX(),
|
||||
mapBBOX.getLowerLeftY(), mapBBOX.getUpperRightX(), mapBBOX.getUpperRightY()); // USE AXIS XY
|
||||
// DEBUG
|
||||
LOG.debug("SERVERTYPE.GEOSEVER outputformat: " + outputformat);
|
||||
LOG.debug("SERVERTYPE.GEOSEVER srsName: " + mapSrsName);
|
||||
|
@ -98,15 +106,22 @@ public class GisMakers {
|
|||
// + (outputformat == null ? "" : "&OUTPUTFORMAT=" + outputformat);
|
||||
//
|
||||
|
||||
link += "?"+
|
||||
URLParserUtil.addParameterToQueryString(WFSGetFeature.SERVICE.getParameter(), WFSGetFeature.SERVICE.getValue(), false, true)+
|
||||
URLParserUtil.addParameterToQueryString(WFSGetFeature.VERSION.getParameter(), WFSGetFeature.VERSION.getValue(), false, true)+
|
||||
URLParserUtil.addParameterToQueryString(WFSGetFeature.REQUEST.getParameter(), WFSGetFeature.REQUEST.getValue(), false, true)+
|
||||
URLParserUtil.addParameterToQueryString(WFSGetFeature.SRSNAME.getParameter(), mapSrsName, false, true)+
|
||||
URLParserUtil.addParameterToQueryString(WFSGetFeature.TYPENAME.getParameter(), layerItem.getName(), false, true)+
|
||||
(maxFeatures == 0 ? "" : URLParserUtil.addParameterToQueryString(WFSGetFeature.MAXFEATURES.getParameter(), maxFeatures+"", false, true))+
|
||||
(outputformat == null ? "" : URLParserUtil.addParameterToQueryString(WFSGetFeature.OUTPUTFORMAT.getParameter(), outputformat, false, false));
|
||||
|
||||
link += "?"
|
||||
+ URLParserUtil.addParameterToQueryString(WFSGetFeature.SERVICE.getParameter(),
|
||||
WFSGetFeature.SERVICE.getValue(), false, true)
|
||||
+ URLParserUtil.addParameterToQueryString(WFSGetFeature.VERSION.getParameter(),
|
||||
WFSGetFeature.VERSION.getValue(), false, true)
|
||||
+ URLParserUtil.addParameterToQueryString(WFSGetFeature.REQUEST.getParameter(),
|
||||
WFSGetFeature.REQUEST.getValue(), false, true)
|
||||
+ URLParserUtil.addParameterToQueryString(WFSGetFeature.SRSNAME.getParameter(), mapSrsName, false, true)
|
||||
+ URLParserUtil.addParameterToQueryString(WFSGetFeature.TYPENAME.getParameter(), layerItem.getName(),
|
||||
false, true)
|
||||
+ (maxFeatures == 0 ? ""
|
||||
: URLParserUtil.addParameterToQueryString(WFSGetFeature.MAXFEATURES.getParameter(),
|
||||
maxFeatures + "", false, true))
|
||||
+ (outputformat == null ? ""
|
||||
: URLParserUtil.addParameterToQueryString(WFSGetFeature.OUTPUTFORMAT.getParameter(),
|
||||
outputformat, false, false));
|
||||
|
||||
if (layerItem.getCqlFilter() != null && !layerItem.getCqlFilter().isEmpty()) {
|
||||
if (layerItem.getCqlFilter().contains("BBOX("+GEOM_NAME_BOUNDED+"")) {
|
||||
|
@ -114,7 +129,8 @@ public class GisMakers {
|
|||
link += "&" + CQL_FILTER_PARAMETER + "=" + layerItem.getCqlFilter();
|
||||
} else {
|
||||
// I NEED TO ENCODE THE BBOX INTO CQL FILTERING,
|
||||
String cqlFilterValue = "BBOX("+GEOM_NAME_BOUNDED+"," + boundingBox + ")" + " AND " + layerItem.getCqlFilter();
|
||||
String cqlFilterValue = "BBOX(" + GEOM_NAME_BOUNDED + "," + boundingBox + ")" + " AND "
|
||||
+ layerItem.getCqlFilter();
|
||||
|
||||
link += "&" + CQL_FILTER_PARAMETER + "=" + cqlFilterValue;
|
||||
}
|
||||
|
@ -181,7 +197,8 @@ public class GisMakers {
|
|||
* @param separator the separator
|
||||
* @return the string
|
||||
*/
|
||||
public static String BBOX_FORMAT(COORDINATE_FORMAT format, String separator, double lowerLeftX, double lowerLeftY, double upperRightX, double upperRightY) {
|
||||
public static String BBOX_FORMAT(COORDINATE_FORMAT format, String separator, double lowerLeftX, double lowerLeftY,
|
||||
double upperRightX, double upperRightY) {
|
||||
|
||||
if(format==null)
|
||||
format = COORDINATE_FORMAT.XY;
|
||||
|
@ -191,25 +208,11 @@ public class GisMakers {
|
|||
|
||||
switch (format) {
|
||||
case XY:
|
||||
return String.format("%s%s%s%s%s%s%s",
|
||||
String.valueOf(lowerLeftX),
|
||||
separator,
|
||||
String.valueOf(lowerLeftY),
|
||||
separator,
|
||||
String.valueOf(upperRightX),
|
||||
separator,
|
||||
String.valueOf(upperRightY)
|
||||
);
|
||||
return String.format("%s%s%s%s%s%s%s", String.valueOf(lowerLeftX), separator, String.valueOf(lowerLeftY),
|
||||
separator, String.valueOf(upperRightX), separator, String.valueOf(upperRightY));
|
||||
case YX:
|
||||
return String.format("%s%s%s%s%s%s%s",
|
||||
String.valueOf(lowerLeftY),
|
||||
separator,
|
||||
String.valueOf(lowerLeftX),
|
||||
separator,
|
||||
String.valueOf(upperRightY),
|
||||
separator,
|
||||
String.valueOf(upperRightX)
|
||||
);
|
||||
return String.format("%s%s%s%s%s%s%s", String.valueOf(lowerLeftY), separator, String.valueOf(lowerLeftX),
|
||||
separator, String.valueOf(upperRightY), separator, String.valueOf(upperRightX));
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -12,12 +12,10 @@ import org.gcube.spatial.data.geoutility.wms.WmsUrlValidator;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
* The Class GisViewerWMSUrlValidator.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Jan 28, 2016
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Jan 28, 2016
|
||||
*/
|
||||
public class WMSUrlValidator {
|
||||
|
||||
|
@ -26,7 +24,7 @@ public class WMSUrlValidator {
|
|||
private static final String OWS = "ows";
|
||||
private HashMap<String, String> parametersValue = new HashMap<String, String>();
|
||||
private String wmsRequestURI;
|
||||
private String wmsServiceHost;
|
||||
private String wmsServiceEndPoint;
|
||||
private String layerName;
|
||||
|
||||
private String wmsNoStandardParameters = "";
|
||||
|
@ -35,7 +33,6 @@ public class WMSUrlValidator {
|
|||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(WMSUrlValidator.class);
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new WMS url validator.
|
||||
*
|
||||
|
@ -43,57 +40,52 @@ public class WMSUrlValidator {
|
|||
* @param inputLayerName the input layer name
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public WMSUrlValidator(String wmsRequest, String inputLayerName) throws Exception{
|
||||
LOG.debug("WMSURLValidator wmsRequest: "+wmsRequest);
|
||||
LOG.debug("WMSURLValidator layerName: "+inputLayerName);
|
||||
public WMSUrlValidator(String wmsRequest, String inputLayerName) throws Exception {
|
||||
LOG.debug("WMSURLValidator wmsRequest: " + wmsRequest);
|
||||
LOG.debug("WMSURLValidator layerName: " + inputLayerName);
|
||||
|
||||
|
||||
if(wmsRequest==null || wmsRequest.isEmpty())
|
||||
if (wmsRequest == null || wmsRequest.isEmpty())
|
||||
throw new Exception("WMS request is null or empty");
|
||||
|
||||
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 {
|
||||
//VALIDATE WMS SERVICE FOR WEB MAP SERVER
|
||||
if(!HttpRequestUtil.urlExists(this.wmsServiceHost, true)){
|
||||
LOG.info("baseWmsServiceUrl: "+wmsServiceHost +" is not a geoserver, setting as input base wms server: "+baseWmsService);
|
||||
this.wmsServiceHost = baseWmsService;
|
||||
// VALIDATE WMS SERVICE FOR WEB MAP SERVER
|
||||
if (!HttpRequestUtil.urlExists(this.wmsServiceEndPoint, true)) {
|
||||
LOG.warn("baseWmsServiceUrl: " + wmsServiceEndPoint + " is not valid URL!!");
|
||||
this.wmsServiceEndPoint = readWMSServiceEndpoint;
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
LOG.error("error on validating geoserver wms service: "+e);
|
||||
LOG.info("setting baseWmsService as input base wms server: "+baseWmsService);
|
||||
this.wmsServiceHost = baseWmsService;
|
||||
LOG.error("Error on validating the endpoint: " + this.wmsServiceEndPoint, e);
|
||||
boolean isOwsService = GeoWmsServiceUtility.isOWSSerice(this.wmsRequestURI);
|
||||
LOG.info("Retrying by appending suffix WMS or WFS...");
|
||||
this.wmsServiceEndPoint = appendWmsServiceToBaseUrl(readWMSServiceEndpoint, isOwsService);
|
||||
}
|
||||
|
||||
//VALIDATION FOR THREDDS - FIND LAYER NAME INTO WMS PATH
|
||||
if(this.layerName==null || this.layerName.isEmpty()){
|
||||
// VALIDATION FOR THREDDS - FIND LAYER NAME INTO WMS PATH
|
||||
if (this.layerName == null || this.layerName.isEmpty()) {
|
||||
|
||||
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");
|
||||
|
||||
}
|
||||
|
||||
LOG.info("WMSURLValidator found endpoint: " + wmsServiceEndPoint);
|
||||
parametersValue.put(WmsParameters.LAYERS.getParameter(), this.layerName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Append wms service to base url.
|
||||
*
|
||||
|
@ -101,34 +93,35 @@ public class WMSUrlValidator {
|
|||
* @param isOwsServer the is ows server
|
||||
* @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;
|
||||
|
||||
if(url.lastIndexOf("/") != url.length()){
|
||||
url+="/";
|
||||
if (url.lastIndexOf("/") != url.length()) {
|
||||
url += "/";
|
||||
}
|
||||
|
||||
if(isOwsServer)
|
||||
return url+=OWS;
|
||||
if (isOwsServer)
|
||||
return url += OWS;
|
||||
else
|
||||
return url+=WMS;
|
||||
return url += WMS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method: getFullWmsUrlRequest
|
||||
* Create a correct wms url request
|
||||
* Returns:
|
||||
* Method: getFullWmsUrlRequest Create a correct wms url request Returns:
|
||||
* {String}.
|
||||
*
|
||||
* @param returnEmptyParameter if true the wms url returned contains also wms parameter with empty value, none otherwise.
|
||||
* and mandatory wms parameters that does not found are filled with empty values
|
||||
* @param returnEmptyParameter if true the wms url returned contains also
|
||||
* 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
|
||||
* @return a correct wms url request in formatted string like this:
|
||||
* "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);
|
||||
String fullWmsUrlBuilded;
|
||||
|
@ -138,106 +131,108 @@ public class WMSUrlValidator {
|
|||
parametersValue.putAll(urlValidator.getMapWmsParameters());
|
||||
|
||||
String ln = parametersValue.get(WmsParameters.LAYERS.name());
|
||||
LOG.debug("Comparing layer name from Wms request: "+ln +", with OnLineResource layerName: "+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);
|
||||
LOG.debug("Comparing layer name from Wms request: " + ln + ", with OnLineResource layerName: "
|
||||
+ 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);
|
||||
urlValidator.getMapWmsParameters().put(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);
|
||||
urlValidator.getMapWmsParameters().put(
|
||||
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);
|
||||
mapWmsNoStandardParams = new HashMap<String, String>(urlValidator.getMapWmsNoStandardParams().size());
|
||||
mapWmsNoStandardParams.putAll(urlValidator.getMapWmsNoStandardParams());
|
||||
wmsNoStandardParameters = urlValidator.getWmsNoStandardParameters();
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error("An error occurred during wms uri build, returning uri: "+wmsRequestURI, e);
|
||||
} catch (Exception e) {
|
||||
LOG.error("An error occurred during wms uri build, returning uri: " + wmsRequestURI, e);
|
||||
fullWmsUrlBuilded = wmsRequestURI;
|
||||
}
|
||||
|
||||
LOG.trace("GisViewerWMSUrlValidator parseWMSRequest returning full wms url: "+fullWmsUrlBuilded);
|
||||
LOG.trace("GisViewerWMSUrlValidator parseWMSRequest returning full wms url: " + fullWmsUrlBuilded);
|
||||
return fullWmsUrlBuilded;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the web map server host.
|
||||
*
|
||||
* @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();
|
||||
|
||||
if(wmsRequest==null)
|
||||
return webMapServerHost; //uri is empty
|
||||
|
||||
if (wmsRequest == null)
|
||||
return webMapServerHost; // uri is empty
|
||||
|
||||
int end = wmsRequest.toLowerCase().lastIndexOf("?");
|
||||
|
||||
if(end==-1){
|
||||
LOG.trace("char ? not found in geoserver uri, return: "+wmsRequest);
|
||||
return webMapServerHost; //uri is empty
|
||||
if (end == -1) {
|
||||
LOG.trace("char ? not found in geoserver uri, return: " + wmsRequest);
|
||||
return webMapServerHost; // uri is empty
|
||||
}
|
||||
|
||||
String webMapServerBaseURL = wmsRequest.substring(0, wmsRequest.toLowerCase().lastIndexOf("?"));
|
||||
int index = webMapServerBaseURL.lastIndexOf(GEOSERVER);
|
||||
|
||||
if(index>-1){ //FOUND the string GEOSERVER into URL
|
||||
LOG.trace("found geoserver string: "+GEOSERVER+" in "+webMapServerBaseURL);
|
||||
if (index > -1) { // FOUND the string GEOSERVER into URL
|
||||
LOG.trace("found geoserver string: " + GEOSERVER + " in " + webMapServerBaseURL);
|
||||
|
||||
//THERE IS SCOPE?
|
||||
// THERE IS SCOPE?
|
||||
int lastSlash = webMapServerBaseURL.lastIndexOf("/");
|
||||
int includeGeoserverString = index+GEOSERVER.length();
|
||||
int endUrl = lastSlash>includeGeoserverString?lastSlash:includeGeoserverString;
|
||||
LOG.trace("indexs - lastSlash: ["+lastSlash+"], includeGeoserverString: ["+includeGeoserverString+"], endUrl: ["+endUrl+"]");
|
||||
int startScope = includeGeoserverString+1<endUrl?includeGeoserverString+1:endUrl; //INCLUDE SLASH
|
||||
int includeGeoserverString = index + GEOSERVER.length();
|
||||
int endUrl = lastSlash > includeGeoserverString ? lastSlash : includeGeoserverString;
|
||||
LOG.trace("indexs - lastSlash: [" + lastSlash + "], includeGeoserverString: [" + includeGeoserverString
|
||||
+ "], endUrl: [" + endUrl + "]");
|
||||
int startScope = includeGeoserverString + 1 < endUrl ? includeGeoserverString + 1 : endUrl; // INCLUDE SLASH
|
||||
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.setScope(scope);
|
||||
|
||||
return webMapServerHost;
|
||||
|
||||
}else{
|
||||
LOG.trace("the string 'geoserver' not found in "+webMapServerBaseURL);
|
||||
} else {
|
||||
LOG.trace("the string 'geoserver' not found in " + webMapServerBaseURL);
|
||||
// GET LAST INDEX OF '/' AND CONCATENATE GEOSERVER
|
||||
String urlConn = webMapServerBaseURL.substring(0, webMapServerBaseURL.lastIndexOf("/"))+GEOSERVER;
|
||||
LOG.trace("tentative concatenating string 'geoserver' at http url "+urlConn);
|
||||
String urlConn = webMapServerBaseURL.substring(0, webMapServerBaseURL.lastIndexOf("/")) + GEOSERVER;
|
||||
LOG.trace("tentative concatenating string 'geoserver' at http url " + urlConn);
|
||||
|
||||
try {
|
||||
|
||||
if(HttpRequestUtil.urlExists(urlConn, false)){
|
||||
LOG.trace("url: "+urlConn+" - open a connection, return "+urlConn);
|
||||
if (HttpRequestUtil.urlExists(urlConn, false)) {
|
||||
LOG.trace("url: " + urlConn + " - open a connection, return " + urlConn);
|
||||
webMapServerHost.setHost(urlConn);
|
||||
return webMapServerHost;
|
||||
}
|
||||
else
|
||||
LOG.trace("url: "+urlConn+" - not open a connection");
|
||||
} else
|
||||
LOG.trace("url: " + urlConn + " - not open a connection");
|
||||
|
||||
} 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);
|
||||
LOG.trace("url connection, returned: "+uriWithoutParameters);
|
||||
LOG.trace("url connection, returned: " + uriWithoutParameters);
|
||||
webMapServerHost.setHost(uriWithoutParameters);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value of parsed wms parameter.
|
||||
*
|
||||
* @param parameter the parameter
|
||||
* @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());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value of parameter.
|
||||
*
|
||||
|
@ -280,12 +273,11 @@ public class WMSUrlValidator {
|
|||
* @param wmsUrlParameters the wms url parameters
|
||||
* @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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the value of parameter.
|
||||
*
|
||||
|
@ -295,7 +287,8 @@ public class WMSUrlValidator {
|
|||
* @param addIfNotExists the add if not exists
|
||||
* @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);
|
||||
}
|
||||
|
@ -309,8 +302,6 @@ public class WMSUrlValidator {
|
|||
return layerName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the styles as list.
|
||||
*
|
||||
|
@ -321,18 +312,17 @@ public class WMSUrlValidator {
|
|||
List<String> listStyles = new ArrayList<String>();
|
||||
String styles = getValueOfParsedWMSParameter(WmsParameters.STYLES);
|
||||
|
||||
if(styles!=null && !styles.isEmpty()){
|
||||
if (styles != null && !styles.isEmpty()) {
|
||||
|
||||
String[] arrayStyle = styles.split(",");
|
||||
for (String style : arrayStyle) {
|
||||
if(style!=null && !style.isEmpty())
|
||||
if (style != null && !style.isEmpty())
|
||||
listStyles.add(style);
|
||||
}
|
||||
}
|
||||
return listStyles;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the map wms no standard params.
|
||||
*
|
||||
|
@ -342,63 +332,4 @@ public class WMSUrlValidator {
|
|||
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() {
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* The Interface GcubeIdentity.
|
||||
*
|
||||
|
@ -25,4 +24,26 @@ public interface GcubeIdentity {
|
|||
*/
|
||||
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 currentUMAToken = null;
|
||||
|
||||
private String clientId = null;
|
||||
|
||||
private static final String IAM_CLIENT_CREDENTIALS = "IAM_CLIENT_CREDENTIALS";
|
||||
|
||||
@Override
|
||||
public void setIdentity(HttpServletRequest httpRequest) throws Exception {
|
||||
LOG.info("setIdentity called");
|
||||
String currentScope = SessionUtil.getCurrentContext(httpRequest, true);
|
||||
LOG.info("the scope is {}", currentScope);
|
||||
IAMClientCredentials credentials = sessionGetIAMClientCredentials(httpRequest);
|
||||
try {
|
||||
if(credentials==null) {
|
||||
if (credentials == null) {
|
||||
credentials = IAMClientCredentialsReader.getCredentials();
|
||||
sessionSetIAMClientCredentials(httpRequest,credentials);
|
||||
sessionSetIAMClientCredentials(httpRequest, credentials);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error on discovering IAM Client credentials", e);
|
||||
|
@ -35,16 +40,16 @@ public class IAMClientIdentity implements GcubeIdentity {
|
|||
}
|
||||
|
||||
LOG.trace("Read credentials: " + credentials);
|
||||
String umaAcessToken = null;
|
||||
String clientId = credentials.getClientId();
|
||||
clientId = credentials.getClientId();
|
||||
String clientSecret = credentials.getClientSecret();
|
||||
try {
|
||||
|
||||
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);
|
||||
umaAcessToken = tr.getAccessToken();
|
||||
if (umaAcessToken != null && !umaAcessToken.isEmpty()) {
|
||||
|
||||
currentUMAToken = tr.getAccessToken();
|
||||
if (currentUMAToken != null && !currentUMAToken.isEmpty()) {
|
||||
LOG.info("UMA Access Token read correctly");
|
||||
} else {
|
||||
LOG.error("UMA Access Token NOT RETRIEVED!!!");
|
||||
|
@ -56,6 +61,8 @@ public class IAMClientIdentity implements GcubeIdentity {
|
|||
|
||||
try {
|
||||
|
||||
LOG.debug("JWT token: " + currentUMAToken.substring(0, 20) + "_MASKED_TOKEN_");
|
||||
|
||||
try {
|
||||
// Here the previousUMAToken should be null
|
||||
previousUMAToken = AccessTokenProvider.instance.get();
|
||||
|
@ -64,10 +71,9 @@ public class IAMClientIdentity implements GcubeIdentity {
|
|||
// silent
|
||||
}
|
||||
|
||||
LOG.debug("JWT token: " + umaAcessToken.substring(0, 20) + "_MASKED_TOKEN_");
|
||||
LOG.info("Setting clientId '" + clientId + "' identity by JWT token in the "
|
||||
+ AccessTokenProvider.class.getSimpleName());
|
||||
AccessTokenProvider.instance.set(umaAcessToken);
|
||||
AccessTokenProvider.instance.set(currentUMAToken);
|
||||
} catch (Exception e) {
|
||||
LOG.error(e.getMessage(), e);
|
||||
throw new Exception(e.getMessage());
|
||||
|
@ -75,6 +81,11 @@ public class IAMClientIdentity implements GcubeIdentity {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToken() {
|
||||
return currentUMAToken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetIdentity() {
|
||||
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 org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -10,13 +11,19 @@ public class UserIdentity implements GcubeIdentity {
|
|||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(UserIdentity.class);
|
||||
|
||||
private HttpServletRequest httpRequest;
|
||||
|
||||
private GCubeUser user;
|
||||
|
||||
public UserIdentity() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIdentity(HttpServletRequest httpRequest) throws Exception {
|
||||
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");
|
||||
// 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;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
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 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.
|
||||
*
|
||||
|
@ -136,7 +142,7 @@ public class SessionUtil {
|
|||
|
||||
if (token != null) {
|
||||
LOG.debug("Returning token " + token.substring(1, 10) + "_MASKED_TOKEN_");
|
||||
if(setInThread)
|
||||
if (setInThread)
|
||||
SecurityTokenProvider.instance.set(token);
|
||||
}
|
||||
|
||||
|
@ -273,33 +279,6 @@ public class SessionUtil {
|
|||
HttpSession session = httpServletRequest.getSession();
|
||||
List<Concessione> listOfConcessioni = (List<Concessione>) session.getAttribute(LIST_OF_CONCESSIONI);
|
||||
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 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.
|
||||
|
@ -12,7 +12,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResul
|
|||
*
|
||||
* Nov 18, 2022
|
||||
*/
|
||||
public class TemporalComparatorUtil implements Comparator<GeoNaSpatialQueryResult> {
|
||||
public class TemporalComparatorUtil implements Comparator<GeoportalSpatialQueryResult> {
|
||||
|
||||
/**
|
||||
* Compare.
|
||||
|
@ -22,7 +22,7 @@ public class TemporalComparatorUtil implements Comparator<GeoNaSpatialQueryResul
|
|||
* @return the int
|
||||
*/
|
||||
@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) {
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The Class URLUtil.
|
||||
* The Class URLParserUtil.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.shared;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||
|
||||
|
||||
public class GCubeCollection implements Serializable {
|
||||
public class GCubeCollection implements Serializable, Comparable<GCubeCollection> {
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -29,7 +27,6 @@ public class GCubeCollection implements Serializable {
|
|||
return indexes;
|
||||
}
|
||||
|
||||
|
||||
public void setUcd(UseCaseDescriptorDV ucd) {
|
||||
this.ucd = ucd;
|
||||
}
|
||||
|
@ -43,5 +40,23 @@ public class GCubeCollection implements Serializable {
|
|||
return "GCubeCollection [ucd=" + ucd + ", indexes=" + indexes + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(GCubeCollection o) {
|
||||
|
||||
if (this == null || this.ucd == null)
|
||||
return 1;
|
||||
|
||||
if (o == null || o.getUcd() == null)
|
||||
return -1;
|
||||
|
||||
if (this.ucd.getName() == null)
|
||||
return 1;
|
||||
|
||||
if (o.getUcd().getName() == null)
|
||||
return -1;
|
||||
|
||||
return this.getUcd().getName().compareTo(o.getUcd().getName());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,13 +9,13 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
|||
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
|
||||
*
|
||||
* 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 List<FeatureRow> features;
|
||||
private LayerObject sourceLayerObject;
|
||||
// Map with couple (mongoId concessione, list of uploaded GNAImages for the
|
||||
// concessione)
|
||||
// Map with couple (mongoId project, list of uploaded GeoportalImages for the
|
||||
// project)
|
||||
private Map<String, List<PayloadDV>> mapImages = null;
|
||||
// private ProjectDV projectDV;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
|
@ -101,7 +91,7 @@ public class GeoNaSpatialQueryResult implements Serializable {
|
|||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("GeoNaSpatialQueryResult [features=");
|
||||
builder.append("GeoportalSpatialQueryResult [features=");
|
||||
builder.append(features);
|
||||
builder.append(", sourceLayerObject=");
|
||||
builder.append(sourceLayerObject);
|
|
@ -8,12 +8,13 @@ import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescrip
|
|||
|
||||
public class ItemFieldsResponse implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -8778792633248190350L;
|
||||
UseCaseDescriptorDV useCaseDescriptorDV;
|
||||
List<ItemFieldDV> listItemFields;
|
||||
private static final long serialVersionUID = -6723902864074541278L;
|
||||
private UseCaseDescriptorDV useCaseDescriptorDV;
|
||||
private List<ItemFieldDV> listItemFields;
|
||||
|
||||
public ItemFieldsResponse() {
|
||||
|
||||
|
|
|
@ -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.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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.ZAxis;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
||||
/**
|
||||
* The Class LayerItem.
|
||||
*
|
||||
|
@ -23,7 +18,6 @@ import com.google.gwt.core.client.GWT;
|
|||
*/
|
||||
public class LayerItem implements Serializable, Cloneable {
|
||||
|
||||
|
||||
/** The Constant serialVersionUID. */
|
||||
private static final long serialVersionUID = 1664082688635256899L;
|
||||
|
||||
|
@ -37,7 +31,7 @@ public class LayerItem implements Serializable, Cloneable {
|
|||
private String url;
|
||||
|
||||
/** The base map server URL. */
|
||||
private String mapServerHost;
|
||||
private String mapServerEndpoint;
|
||||
|
||||
/** The style. */
|
||||
private String style;
|
||||
|
@ -102,9 +96,6 @@ public class LayerItem implements Serializable, Cloneable {
|
|||
/** The server wms request. */
|
||||
public String wmsLink;
|
||||
|
||||
/** The cql filter available. */
|
||||
private boolean cqlFilterAvailable = false;
|
||||
|
||||
/** The uuid. */
|
||||
private String UUID;
|
||||
|
||||
|
@ -756,16 +747,7 @@ public class LayerItem implements Serializable, Cloneable {
|
|||
* @return true, if is cql filter available
|
||||
*/
|
||||
public boolean isCqlFilterAvailable() {
|
||||
return cqlFilterAvailable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cql filter available.
|
||||
*
|
||||
* @param cqlFilterAvailable the new cql filter available
|
||||
*/
|
||||
public void setCqlFilterAvailable(boolean cqlFilterAvailable) {
|
||||
this.cqlFilterAvailable = cqlFilterAvailable;
|
||||
return (cqlFilter != null) && (!cqlFilter.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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() {
|
||||
return mapServerHost;
|
||||
public String getMapServerEndpoint() {
|
||||
return mapServerEndpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the map server host.
|
||||
*
|
||||
* @param mapServerHost the new map server host
|
||||
* @param mapServerEndpoint the new map server host
|
||||
*/
|
||||
public void setMapServerHost(String mapServerHost) {
|
||||
this.mapServerHost = mapServerHost;
|
||||
public void setMapServerHost(String mapServerEndpoint) {
|
||||
this.mapServerEndpoint = mapServerEndpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -908,8 +890,8 @@ public class LayerItem implements Serializable, Cloneable {
|
|||
builder.append(title);
|
||||
builder.append(", url=");
|
||||
builder.append(url);
|
||||
builder.append(", mapServerHost=");
|
||||
builder.append(mapServerHost);
|
||||
builder.append(", mapServerEndpoint=");
|
||||
builder.append(mapServerEndpoint);
|
||||
builder.append(", style=");
|
||||
builder.append(style);
|
||||
builder.append(", isTrasparent=");
|
||||
|
@ -952,8 +934,6 @@ public class LayerItem implements Serializable, Cloneable {
|
|||
builder.append(isNcWms);
|
||||
builder.append(", wmsLink=");
|
||||
builder.append(wmsLink);
|
||||
builder.append(", cqlFilterAvailable=");
|
||||
builder.append(cqlFilterAvailable);
|
||||
builder.append(", UUID=");
|
||||
builder.append(UUID);
|
||||
builder.append(", zAxis=");
|
||||
|
@ -968,92 +948,4 @@ public class LayerItem implements Serializable, Cloneable {
|
|||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ public class LayerObject implements Serializable {
|
|||
private ProjectDV projectDV;
|
||||
|
||||
public LayerObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
public LayerObject(LayerObjectType type, LayerItem item) {
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.server.gis;
|
||||
|
||||
|
||||
package org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs;
|
||||
|
||||
/**
|
||||
* The Enum WfsParameters.
|
||||
|
@ -20,6 +18,7 @@ public enum WFSGetFeature {
|
|||
WIDTH("WIDTH","676"),
|
||||
HEIGHT("HEIGHT","230"),
|
||||
SRSNAME("srsName","EPSG:4326"),
|
||||
PROPERTYNAME("propertyName", ""),
|
||||
// CRS("CRS","EPSG:4326"), //WMS 1.3.0 COMPLIANT
|
||||
OUTPUTFORMAT("OUTPUTFORMAT","json"),
|
||||
MAXFEATURES("MAXFEATURES","");
|
|
@ -15,8 +15,7 @@ public class GeoInformationForWMSRequest implements Serializable {
|
|||
/** The Constant serialVersionUID. */
|
||||
private static final long serialVersionUID = -6846636281073641003L;
|
||||
|
||||
/** The base wms service host. */
|
||||
private String baseWmsServiceHost;
|
||||
private String serviceEndPoint;
|
||||
|
||||
/** The wms request. */
|
||||
private String wmsRequest;
|
||||
|
@ -53,7 +52,7 @@ public class GeoInformationForWMSRequest implements Serializable {
|
|||
/**
|
||||
* 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 layerName the layer name
|
||||
* @param versionWms the version wms
|
||||
|
@ -63,10 +62,9 @@ public class GeoInformationForWMSRequest implements Serializable {
|
|||
* @param isNcWMS the is nc WMS
|
||||
* @param zAxis the z axis
|
||||
*/
|
||||
public GeoInformationForWMSRequest(String baseWmsServiceHost, String wmsRequest, String layerName,
|
||||
String versionWms, String crs, HashMap<String, String> mapWmsNoStandard, Styles styles, boolean isNcWMS,
|
||||
ZAxis zAxis) {
|
||||
this.baseWmsServiceHost = baseWmsServiceHost;
|
||||
public GeoInformationForWMSRequest(String serviceEndPoint, String wmsRequest, String layerName, String versionWms,
|
||||
String crs, HashMap<String, String> mapWmsNoStandard, Styles styles, boolean isNcWMS, ZAxis zAxis) {
|
||||
this.serviceEndPoint = serviceEndPoint;
|
||||
this.wmsRequest = wmsRequest;
|
||||
this.layerName = layerName;
|
||||
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.
|
||||
*
|
||||
* @param baseWmsServiceHost the baseWmsServiceHost to set
|
||||
* @param baseWmsServiceHost the new base wms service host
|
||||
*/
|
||||
public void setBaseWmsServiceHost(String baseWmsServiceHost) {
|
||||
|
||||
this.baseWmsServiceHost = baseWmsServiceHost;
|
||||
this.serviceEndPoint = baseWmsServiceHost;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -271,8 +277,8 @@ public class GeoInformationForWMSRequest implements Serializable {
|
|||
public String toString() {
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("GeoInformationForWMSRequest [baseWmsServiceHost=");
|
||||
builder.append(baseWmsServiceHost);
|
||||
builder.append("GeoInformationForWMSRequest [serviceEndPoint=");
|
||||
builder.append(serviceEndPoint);
|
||||
builder.append(", wmsRequest=");
|
||||
builder.append(wmsRequest);
|
||||
builder.append(", layerName=");
|
||||
|
|
|
@ -17,11 +17,17 @@
|
|||
|
||||
<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.dark.Dark'/> -->
|
||||
|
||||
<!-- Other module inherits -->
|
||||
|
||||
<servlet path="/geoportalexporterservice"
|
||||
class="org.gcube.portlets.user.geoportaldataviewer.server.GeoportalExporterActionServlet" />
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
<entry-point
|
||||
class='org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer' />
|
||||
|
|
|
@ -26,7 +26,7 @@ body {
|
|||
background-color: white;
|
||||
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
|
||||
padding: 10px;
|
||||
border-radius: 2px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid #cccccc;
|
||||
bottom: 12px;
|
||||
left: -50px;
|
||||
|
@ -34,11 +34,16 @@ body {
|
|||
max-width: 500px;
|
||||
visibility: hidden;
|
||||
padding-top: 20px;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.ol-popup #pop-img {
|
||||
max-height: 130px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.ol-popup img {
|
||||
width: 100%;
|
||||
max-height: 200px;
|
||||
}
|
||||
|
||||
.ol-popup:after, .ol-popup:before {
|
||||
|
@ -153,6 +158,11 @@ body {
|
|||
padding-top: 1px;
|
||||
}
|
||||
|
||||
.preset-location ul a {
|
||||
margin: 5px !important;
|
||||
}
|
||||
|
||||
|
||||
.my-control-group .controls {
|
||||
margin-left: 70px !important;
|
||||
}
|
||||
|
@ -190,7 +200,7 @@ body {
|
|||
/*margin-top: 30px;*/
|
||||
overflow-y: auto;
|
||||
transition: width 0.5s;
|
||||
z-index: 999;
|
||||
z-index: 950;
|
||||
}
|
||||
|
||||
.overlay {
|
||||
|
@ -206,7 +216,7 @@ body {
|
|||
}
|
||||
|
||||
.inner-toolbar .btn-group {
|
||||
margin-left: 0px !important;
|
||||
margin-left: 2px !important;
|
||||
}
|
||||
|
||||
.inner-toolbar .btn-link {
|
||||
|
@ -353,16 +363,23 @@ body {
|
|||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.layers-panel {
|
||||
margin-top: 10px;
|
||||
.layer-panel {
|
||||
margin-top: 43px;
|
||||
background-color: white;
|
||||
opacity: 90%;
|
||||
padding: 10px;
|
||||
width: 410px;
|
||||
max-width: 430px;
|
||||
z-index: 500;
|
||||
overflow-y: auto;
|
||||
position: absolute;
|
||||
left: 52px;
|
||||
}
|
||||
|
||||
.dand-layer {
|
||||
width: 400px;
|
||||
border: 1px solid #ccc !important;
|
||||
padding: 5px 0px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.range-slider {
|
||||
|
@ -418,6 +435,7 @@ body {
|
|||
.map-layers-radio label {
|
||||
margin-left: 5px;
|
||||
padding-top: 5px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
|
@ -729,6 +747,114 @@ Table Of Contents (TOC)
|
|||
}
|
||||
|
||||
|
||||
.general_warning {
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.general_warning div {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
/* OPEN COLLECTION UI */
|
||||
.open-collection-style {
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.open-collection-style > div {
|
||||
border: 1px solid #ccc !important;
|
||||
border-radius: 5px;
|
||||
padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.layer-style-panel {
|
||||
margin-left: 25px;
|
||||
font-size: 13px;
|
||||
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 {
|
||||
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
|
||||
*******************************/
|
||||
|
@ -748,10 +874,37 @@ RESPONSIVE
|
|||
}
|
||||
|
||||
.details-panel {
|
||||
width: 600px;
|
||||
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;
|
||||
|
@ -762,10 +915,27 @@ RESPONSIVE
|
|||
width: 400px;
|
||||
}
|
||||
.search-facility {
|
||||
width: 250px;
|
||||
max-width: 300px;
|
||||
/*width: 250px;
|
||||
max-width: 300px;*/
|
||||
}
|
||||
.inner-toolbar {
|
||||
width: 100px;
|
||||
/*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">
|
||||
|
||||
<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">
|
||||
<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>
|
||||
|
||||
<link
|
||||
|
@ -75,7 +75,7 @@
|
|||
|
||||
return [ year, month, day ].join('-');
|
||||
}
|
||||
return "";
|
||||
return date + "";
|
||||
} catch (err) {
|
||||
return date + "";
|
||||
}
|
||||
|
@ -138,6 +138,7 @@
|
|||
application to display correctly.</div>
|
||||
</noscript>
|
||||
<div id="app-notifier" class="app-notifier"></div>
|
||||
<div id="layer-viewer" class="layer-panel"></div>
|
||||
<div id="geoportal-data-viewer"></div>
|
||||
<div class="timeline-container">
|
||||
<div id="timeline-data"></div>
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
src='<%=request.getContextPath()%>/GeoportalDataViewer/js/bootstrap.min.js'></script>
|
||||
|
||||
<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">
|
||||
|
||||
<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>
|
||||
|
||||
<link
|
||||
|
@ -111,6 +111,7 @@
|
|||
</script>
|
||||
|
||||
<div id="app-notifier" class="app-notifier"></div>
|
||||
<div id="layer-viewer" class="layer-panel"></div>
|
||||
<div id="geoportal-data-viewer"></div>
|
||||
<div class="timeline-container">
|
||||
<div id="timeline-data"></div>
|
||||
|
|
|
@ -16,6 +16,16 @@
|
|||
<servlet-class>org.gcube.portlets.user.geoportaldataviewer.server.GeoportalDataViewerServiceImpl</servlet-class>
|
||||
</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-name>mpformbuilderServlet</servlet-name>
|
||||
<servlet-class>org.gcube.portlets.widgets.mpformbuilder.server.MetadataProfileFormBuilderServiceImpl</servlet-class>
|
||||
|
@ -32,4 +42,14 @@
|
|||
<url-pattern>/GeoportalDataViewer/geoportaldataviewerservice</url-pattern>
|
||||
</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>
|
||||
|
|
After Width: | Height: | Size: 55 KiB |
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.TemporalReferenceDV;
|
||||
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.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.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* The Class GeoportalViewer_Tests.
|
||||
|
@ -57,15 +55,15 @@ public class GeoportalViewer_Tests {
|
|||
|
||||
private ProjectsCaller clientProjects;
|
||||
|
||||
//private static String CONTEXT = "/pred4s/preprod/preVRE";
|
||||
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 CONTEXT = "/pred4s/preprod/preVRE";
|
||||
// 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 PROJECT_ID = "6388ea6ca1e60e66b7b584e0";
|
||||
private static String PROJECT_ID = "63d011c4dcac4551b9a6b930";
|
||||
|
||||
private static String USERNAME = "francesco.mangiacrapa";
|
||||
|
||||
|
@ -74,7 +72,7 @@ public class GeoportalViewer_Tests {
|
|||
*
|
||||
* @return the client
|
||||
*/
|
||||
@Before
|
||||
//@Before
|
||||
public void getClient() {
|
||||
// assumeTrue(GCubeTest.isTestInfrastructureEnabled());
|
||||
ScopeProvider.instance.set(CONTEXT);
|
||||
|
@ -83,7 +81,7 @@ public class GeoportalViewer_Tests {
|
|||
clientProjects = GeoportalClientCaller.projects();
|
||||
}
|
||||
|
||||
// @Test
|
||||
//@Test
|
||||
public void getProjectViewForID() {
|
||||
|
||||
try {
|
||||
|
@ -103,7 +101,7 @@ public class GeoportalViewer_Tests {
|
|||
}
|
||||
}
|
||||
|
||||
//@Test
|
||||
// @Test
|
||||
public void getLayersForId() {
|
||||
System.out.println("getLayersForId [profileID: " + PROFILE_ID + ", projectID: " + PROJECT_ID + "] called");
|
||||
|
||||
|
@ -121,17 +119,18 @@ public class GeoportalViewer_Tests {
|
|||
|
||||
String materializationParentJSONPath = null;
|
||||
|
||||
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.
|
||||
materializationParentJSONPath = String.format("%s..%s[?(@._access._policy=='%s')]", Geoportal_JSON_Mapper.JSON_$_POINTER,
|
||||
Geoportal_JSON_Mapper.FILESET, accessPolicy);
|
||||
}else {
|
||||
//Accessing to all fileset (with any ACCESS_POLICY) when the user is logged in.
|
||||
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.
|
||||
materializationParentJSONPath = String.format("%s..%s[?(@._access._policy=='%s')]",
|
||||
Geoportal_JSON_Mapper.JSON_$_POINTER, Geoportal_JSON_Mapper.FILESET, accessPolicy);
|
||||
} 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,
|
||||
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,
|
||||
// Geoportal_JSON_Mapper.FILESET);
|
||||
|
@ -238,7 +237,7 @@ public class GeoportalViewer_Tests {
|
|||
}
|
||||
}
|
||||
|
||||
//@Test
|
||||
// @Test
|
||||
public void testReadProjectEdit() {
|
||||
|
||||
try {
|
||||
|
@ -261,7 +260,7 @@ public class GeoportalViewer_Tests {
|
|||
}
|
||||
}
|
||||
|
||||
//@Test
|
||||
// @Test
|
||||
public void testTemporalReference() {
|
||||
try {
|
||||
ScopeProvider.instance.set(CONTEXT);
|
||||
|
@ -271,7 +270,8 @@ public class GeoportalViewer_Tests {
|
|||
.readTemporalDimensionTemplate(theProject.getProfileID());
|
||||
|
||||
// String template = "{\"content\": \"$.nome\"," + "\"title\": \"$.nome\","
|
||||
// + "\"start\" : \"$.dataInizioProgetto\"," + "\"end\" : \"$.dataFineProgetto\"}";
|
||||
// + "\"start\" : \"$.dataInizioProgetto\"," + "\"end\" :
|
||||
// \"$.dataFineProgetto\"}";
|
||||
|
||||
if (temporalJsonTemplate != null) {
|
||||
|
||||
|
@ -292,13 +292,12 @@ public class GeoportalViewer_Tests {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//@Test
|
||||
// @Test
|
||||
public void getResultsWithSize() throws Exception {
|
||||
// List<Project> listOfProjects = client.getListForProfileID(PROFILE_ID);
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
System.out.println("start at: "+start);
|
||||
System.out.println("start at: " + start);
|
||||
SearchingFilter filter = new SearchingFilter();
|
||||
|
||||
// Where Clause
|
||||
|
@ -310,32 +309,32 @@ public class GeoportalViewer_Tests {
|
|||
conditions.add(whereClause);
|
||||
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>();
|
||||
projectionForIDs.put(Project.ID, 1);
|
||||
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);
|
||||
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;
|
||||
Stream<Project> targetStream = StreamSupport.stream(itP.spliterator(), false);
|
||||
List<String> listProjectIDs = targetStream.map(Project::getId).collect(Collectors.toList());
|
||||
|
||||
System.out.println("Total Ids are: "+listProjectIDs.size());
|
||||
//listProjectIDs.stream().forEach(p -> System.out.println(p));
|
||||
System.out.println("Total Ids are: " + listProjectIDs.size());
|
||||
// listProjectIDs.stream().forEach(p -> System.out.println(p));
|
||||
|
||||
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>();
|
||||
// default
|
||||
//PROJECTION
|
||||
// PROJECTION
|
||||
projection.put(Project.ID, 1);
|
||||
projection.put("_theDocument.nome", 1);
|
||||
projection.put("_profileID", 1);
|
||||
|
@ -353,20 +352,20 @@ public class GeoportalViewer_Tests {
|
|||
projection.put("_theDocument.dataInizioProgetto", 1);
|
||||
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);
|
||||
|
||||
List<ResultDocumentDV> results = ConvertToDataValueObjectModel.toListResultDocument(itProjects);
|
||||
int i = 0;
|
||||
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();
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|