Compare commits

...

81 Commits

Author SHA1 Message Date
Francesco Mangiacrapa 52ea4f5130 reverted to v3.6.0 2024-04-30 11:20:02 +02:00
Francesco Mangiacrapa 66d1baa4ee just to rebuild v3.6.0-SNAPSHOT 2024-04-30 11:13:10 +02:00
Francesco Mangiacrapa 8a3c4437a0 just to rebuild the SNAPSHOT 2024-04-30 11:10:54 +02:00
Francesco Mangiacrapa 8cf6d178b1 geoportal-data-mapper range updated at [1.0.1-SNAPSHOT, 2.0.0-SNAPSHOT) 2023-09-14 16:41:58 +02:00
Francesco Mangiacrapa 0733a62801 removed -SNAPSHOT 2023-09-11 15:08:50 +02:00
Francesco Mangiacrapa dea11a7b95 Merge pull request 'feature_25598' (!17) from feature_25598 into master
Reviewed-on: #17
2023-09-11 15:06:52 +02:00
Francesco Mangiacrapa b3555f4d98 improved CSS 2023-09-11 11:21:02 +02:00
Francesco Mangiacrapa eb92bc685c added -SNAPSHOT 2023-09-11 10:55:34 +02:00
Francesco Mangiacrapa 3099a31e32 Showing basic statistics (i.e. "X project published") via
'countByPhase'method [#25598]
2023-09-11 10:48:34 +02:00
Francesco Mangiacrapa 5cef21b4f0 Update README 2023-09-06 17:15:42 +02:00
Francesco Mangiacrapa e94532f04f removed -SNAPSHOT to be released 2023-09-05 15:20:17 +02:00
Francesco Mangiacrapa b57091278e Merge pull request 'gui_optimization_25461' (!16) from gui_optimization_25461 into master
Reviewed-on: #16
2023-09-05 15:16:50 +02:00
Francesco Mangiacrapa 5cde386089 moved details-panel at z-index: 950. Required for screen < 900px in
width (e.g. tablet)
2023-09-04 11:16:40 +02:00
Francesco Mangiacrapa ba9c8aee78 Using the latest libraries version: gwt-ol.v8.4.1 (with
openlayers.v6.6.1) and gwt.v2.10
2023-08-31 17:21:15 +02:00
Francesco Mangiacrapa 8967184d3c Optimized the UI for screen size 1200x1200 2023-08-31 15:17:21 +02:00
Francesco Mangiacrapa 6338792427 UI optimized for less than 1600w screen resolution 2023-08-29 14:41:32 +02:00
Francesco Mangiacrapa 34f2ba4c7e Media with max-width 2048px the details-panel has width 530px 2023-07-31 12:37:31 +02:00
Francesco Mangiacrapa 6c5c584c0f bug fixing #25293 2023-07-31 12:15:06 +02:00
Francesco Mangiacrapa 4d87eaf5a2 Updated README 2023-07-25 11:36:59 +02:00
Francesco Mangiacrapa 1781488971 Update 'README.md' 2023-07-12 23:43:33 +02:00
Francesco Mangiacrapa a399dbb912 Updated README 2023-07-08 18:38:23 +02:00
Francesco Mangiacrapa dd056fdc9e Updated README 2023-07-08 18:37:50 +02:00
Francesco Mangiacrapa d0271d662c Updated README 2023-07-08 18:36:28 +02:00
Francesco Mangiacrapa d5f2bf9a67 Updated README 2023-07-08 18:35:59 +02:00
Francesco Mangiacrapa a6ac952994 removed -SNAPSHOT to be released 2023-06-15 11:57:14 +02:00
Francesco Mangiacrapa 7383b01aa9 Fixed an issue regarding the set Layer Style facility, #25066?#note-7.
Moved to -SNAPSHOT
2023-06-15 11:56:46 +02:00
Francesco Mangiacrapa 9d92b14378 removed -SNAPSHOT to be released 2023-06-09 13:55:13 +02:00
Francesco Mangiacrapa 23feb1a3c8 Setting initial layer opacity at 0.8 2023-06-09 13:54:45 +02:00
Francesco Mangiacrapa b7885b3b72 removed -SNAPSHOT to be released 2023-06-09 11:08:42 +02:00
Francesco Mangiacrapa 0093af4cdf Added -SNAPSHOT and maven-parent 1.2.0 2023-06-09 11:07:43 +02:00
Francesco Mangiacrapa 412878f323 Removed -SNAPSHOT to be released 2023-06-09 10:45:05 +02:00
Francesco Mangiacrapa bb33754558 Merge pull request 'task_25066' (!15) from task_25066 into master
Reviewed-on: #15
2023-06-09 10:37:45 +02:00
Francesco Mangiacrapa 3644685fe5 Improved search facility 2023-06-09 10:28:46 +02:00
Francesco Mangiacrapa 6361c1c0b9 #25074 cross-filtering completed 2023-06-08 17:03:42 +02:00
Francesco Mangiacrapa a7680ffb46 Added "Fit map to Extent" facility 2023-06-07 14:26:57 +02:00
Francesco Mangiacrapa 1002111ca8 Fixing label 2023-06-06 14:50:06 +02:00
Francesco Mangiacrapa f3e3ca5eb9 Updated label and css 2023-06-06 14:38:30 +02:00
Francesco Mangiacrapa e76448d10a Updated border radius 2023-06-06 12:04:25 +02:00
Francesco Mangiacrapa e73c3a0202 Improved CQL filtering. Now is working in combination with SEARCH and
CROSS_Filtering
2023-06-06 11:49:31 +02:00
Francesco Mangiacrapa a28d2433a0 Passing WFS requests from the servlet due to CORS issue, see
#25074?#note-7
2023-06-05 16:54:40 +02:00
Francesco Mangiacrapa 36bfcd2b9e Added WFS cross filtering results 2023-06-01 16:26:34 +02:00
Francesco Mangiacrapa dcca1afba1 fixed cross filtering select 2023-05-31 17:15:04 +02:00
Francesco Mangiacrapa 33d6dbc89f Applied CQL_Filter for cross filtering 2023-05-31 17:02:03 +02:00
Francesco Mangiacrapa 9d48e78fac in progress cross filtering 2023-05-26 17:49:59 +02:00
Francesco Mangiacrapa a208b37791 in progress cross-filtering 2023-05-26 14:45:47 +02:00
Francesco Mangiacrapa 16d9feffe0 Implement generic method to load grouped configured layers for Overlay
and Cross-Filtering facilities
2023-05-25 11:28:25 +02:00
Francesco Mangiacrapa d1ec08c70f added comments 2023-05-19 15:12:46 +02:00
Francesco Mangiacrapa b3dd9126b9 Fixing layer order 2023-05-19 14:59:55 +02:00
Francesco Mangiacrapa f86988f8c7 Improved Overlay Custom Layer Panel and CSS 2023-05-15 17:11:37 +02:00
Francesco Mangiacrapa 7dc1343f1b Supported the grouped custom layers [#25110] 2023-05-15 16:19:40 +02:00
Francesco Mangiacrapa 647ddfb2d8 Added constant 2023-05-12 11:12:39 +02:00
Francesco Mangiacrapa 16eb79cf32 Updated README 2023-05-12 10:45:44 +02:00
Francesco Mangiacrapa f104c100d8 removed -SNAPSHOT to be released 2023-05-11 15:55:46 +02:00
Francesco Mangiacrapa 2cdc97e70d Merge pull request 'task_24166' (!14) from task_24166 into master
Reviewed-on: #14
2023-05-11 15:53:48 +02:00
Francesco Mangiacrapa 18fe9c40ea Added -SNAPSHOT 2023-05-11 15:53:08 +02:00
Francesco Mangiacrapa c4e9ca93b6 removed -SNAPSHOT to be released 2023-05-11 15:16:28 +02:00
Francesco Mangiacrapa 293bfabfa8 Removed unused cache. Updated pom 2023-05-08 11:37:27 +02:00
Francesco Mangiacrapa d0be59234a Updated README. Fixed pom 2023-05-05 17:40:55 +02:00
Francesco Mangiacrapa 9d059ca4e9 Passed to the geoportal-data-mapper component [#24978] 2023-05-05 17:23:11 +02:00
Francesco Mangiacrapa 2d4bfbee38 Starting integration of the geoportal-data-mapper library 2023-04-13 11:46:17 +02:00
Francesco Mangiacrapa 031ba50a03 Upgraded maven-portal-bom version at 3.7.0 2023-04-04 14:56:37 +02:00
Francesco Mangiacrapa ad7de9f7dc removed -SNAPSHOT to be released 2023-03-30 16:36:19 +02:00
Francesco Mangiacrapa e09bb18614 Improved css 2023-03-30 16:21:49 +02:00
Francesco Mangiacrapa 60f4569518 updated css 2023-03-30 15:13:22 +02:00
Francesco Mangiacrapa 675f23d1ac updated css 2023-03-30 12:43:45 +02:00
Francesco Mangiacrapa 4a44835356 Just including new dependencies 2023-03-30 12:10:29 +02:00
Francesco Mangiacrapa 5ec86d1a8d removed -SNAPSHOT to be released 2023-02-20 15:39:04 +01:00
Francesco Mangiacrapa 9581d3ce73 fixing issues #24632 2023-02-20 15:22:51 +01:00
Francesco Mangiacrapa 2b6272dd60 Fixed fit to Extent on features loaded end 2023-02-07 15:25:53 +01:00
Francesco Mangiacrapa 003590f46e removed -SNAPSHOT to be released 2023-02-03 15:25:28 +01:00
Francesco Mangiacrapa f1fde26359 Merge pull request 'task_24532' (!13) from task_24532 into master
Reviewed-on: #13
2023-02-03 15:24:09 +01:00
Francesco Mangiacrapa 872caa7137 updated CHANGELOG 2023-02-03 15:23:33 +01:00
Francesco Mangiacrapa ff3a7461df Added warning message on broken link 2023-02-03 14:19:33 +01:00
Francesco Mangiacrapa 1a6c9b074d Set Highlight to Light yellow4 2023-02-03 12:28:26 +01:00
Francesco Mangiacrapa 88c986a478 Updated 2023-02-03 11:54:40 +01:00
Francesco Mangiacrapa 06d88b4033 #24432 Done 2023-02-03 11:53:37 +01:00
Francesco Mangiacrapa b5e6afb6ce Moved to red highlight 2023-01-31 15:59:32 +01:00
Francesco Mangiacrapa 657da72da6 Done #24506. Removed -SNAPSHOT to be released 2023-01-31 15:35:37 +01:00
Francesco Mangiacrapa 14bb068b2e Added images 2023-01-31 15:34:04 +01:00
Francesco Mangiacrapa d81ca374dc Merged with branch `locate_layer_geometry` 2023-01-31 15:24:45 +01:00
Francesco Mangiacrapa 5221d2a6b5 Displaying an Alert if an error occurs on adding a layer to Map (#24471) 2023-01-25 10:46:17 +01:00
75 changed files with 4539 additions and 2365 deletions

View File

@ -1,16 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/geoportal-data-viewer-app-3.1.0/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/geoportal-data-viewer-app-3.6.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/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,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/geoportal-data-viewer-app-3.1.0/WEB-INF/classes"/>
<classpathentry kind="output" path="target/geoportal-data-viewer-app-3.6.0/WEB-INF/classes"/>
</classpath>

View File

@ -1,4 +1,4 @@
eclipse.preferences.version=1
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-3.1.0
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-3.6.0
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
@ -44,8 +44,120 @@
<wb-module deploy-name="geoportal-data-viewer-app-3.1.0">
<wb-module deploy-name="geoportal-data-viewer-app-3.6.0">
@ -91,7 +203,63 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
@ -137,7 +305,63 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
@ -183,7 +407,63 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
@ -229,56 +509,69 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="geoportal-data-common-2.0.1.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
<dependent-module archiveName="geoportal-data-mapper-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-mapper/geoportal-data-mapper">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="uri-resolver-manager-1.8.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/uri-resolver-manager/uri-resolver-manager">
<dependency-type>uses</dependency-type>
</dependent-module>
@ -324,7 +617,63 @@
<property name="java-output-path" value="/geoportal-data-viewer-app/target/geoportal-data-viewer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/>
@ -370,7 +719,63 @@
<property name="context-root" value="geoportal-data-viewer-app"/>
@ -416,7 +821,63 @@
</wb-module>

View File

@ -4,6 +4,48 @@
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.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

View File

@ -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
@ -13,12 +13,40 @@ The GeoPortal Data Viewer App is an application to access, discovery and navigat
* 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)
* 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 lArcheologia (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

42
pom.xml
View File

@ -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</version>
<version>3.6.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.4.1</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,7 +56,7 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>3.6.4</version>
<version>3.7.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -102,7 +103,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>
@ -135,13 +136,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>
@ -150,30 +144,12 @@
<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-SNAPSHOT, 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>

View File

@ -2,14 +2,21 @@ 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;
@ -18,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;
@ -26,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;
@ -39,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;
@ -48,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.gis.OpenLayerMap.CQL_FACILITY_ORIGIN;
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPanel;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.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;
@ -59,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;
@ -80,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>.
@ -91,6 +111,8 @@ import ol.Coordinate;
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";
@ -140,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.
*/
@ -185,6 +212,9 @@ public class GeoportalDataViewer implements EntryPoint {
}
/**
* Inits the application.
*/
private void initApplication() {
initApplication = true;
@ -211,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());
@ -265,6 +296,8 @@ public class GeoportalDataViewer implements EntryPoint {
mainPanel.openCollectionMenu();
loadConfigureduGroupedLayersForUCD();
GWT.log("DONE INIT LOAD");
}
@ -285,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;
}
@ -302,9 +416,15 @@ public class GeoportalDataViewer implements EntryPoint {
int height = rootHeight;
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();
@ -330,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);
@ -417,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(GNAImages.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
@ -542,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);
@ -569,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;
@ -577,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
@ -608,8 +809,8 @@ public class GeoportalDataViewer implements EntryPoint {
// 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());
@ -630,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();
@ -655,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
@ -703,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) {
@ -727,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();
@ -748,6 +1066,11 @@ public class GeoportalDataViewer implements EntryPoint {
timer.schedule(3000);
}
/**
* Gets the general error panel.
*
* @return the general error panel
*/
private FlowPanel getGeneralErrorPanel() {
Image geoportalError = new Image(GNAImages.ICONS.geoportaServiceError());
FlowPanel errorPanelMsg = new FlowPanel();
@ -760,4 +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);
}
}

View File

@ -14,6 +14,8 @@ import com.google.gwt.i18n.client.DateTimeFormat;
* Nov 24, 2020
*/
public class GeoportalDataViewerConstants {
public static final int TABLET_WIDTH = 1601;
public static final String MAP_DIV = "map";
@ -25,7 +27,10 @@ public class GeoportalDataViewerConstants {
public static final String GET_MAX_ZOOM_LEVEL = OpenLayersMapParameters.OL_MAP_PARAM.maxzoomlevel.name();
public static final String GET_ZOOM = OpenLayersMapParameters.OL_MAP_PARAM.zoom.name();
public static final String GET_CENTER_MAP_TO_LONG_LAT = OpenLayersMapParameters.OL_MAP_PARAM.centermap.name();
public static final 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 +39,32 @@ 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.
*
@ -152,7 +183,8 @@ public class GeoportalDataViewerConstants {
var tabCell = tr.insertCell(-1);
var theValue = jsonObj[j][col[i]];
//console.log("the value: "+theValue);
if (theValue !== null && Object.prototype.toString.call(theValue) === '[object Array]') {
if (theValue !== null
&& Object.prototype.toString.call(theValue) === '[object Array]') {
var formattedValueArray = "";
for (var k = 0; k < theValue.length; k++) {
var theValueArray = theValue[k];

View File

@ -2,12 +2,16 @@ 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;
@ -15,6 +19,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
@ -158,7 +163,7 @@ public interface GeoportalDataViewerService extends RemoteService {
* @param limit the limit
* @return the entry sets document for project ID
*/
LinkedHashMap<String, String> getEntrySetsDocumentForProjectID(String profileID, String projectID, int limit);
LinkedHashMap<String, Object> getEntrySetsDocumentForProjectID(String profileID, String projectID, int limit);
/**
* Gets the relationships for timeline.
@ -179,4 +184,49 @@ 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);
}

View File

@ -2,12 +2,16 @@ 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;
@ -15,6 +19,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
@ -69,10 +74,23 @@ public interface GeoportalDataViewerServiceAsync {
void getInitialConfiguration(AsyncCallback<ViewerConfiguration> callback);
void getEntrySetsDocumentForProjectID(String profileID, String projectID, int limit,
AsyncCallback<LinkedHashMap<String, String>> callback);
AsyncCallback<LinkedHashMap<String, Object>> callback);
void getRelationshipsForTimeline(String profileID, String projectID, AsyncCallback<List<String>> callback);
void 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);
}

View File

@ -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;
@ -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);
}
}
@ -805,7 +807,8 @@ public class LayerManager {
TemporalReferenceDV tempRef = projectDV.getTemporalReference();
if (tempRef != null) {
flowPanel.add(new HTML(ProjectUtil.toHTMLCode(tempRef)));
if(tempRef.getStart()!=null || tempRef.getEnd()!=null)
flowPanel.add(new HTML(ProjectUtil.toHTMLCode(tempRef)));
}
Button buttOpenProject = new Button("Open Project");
@ -929,7 +932,7 @@ public class LayerManager {
intFlex.setCellPadding(1);
intFlex.setCellSpacing(1);
if (projectDV.getTheDocument() != null) {
LinkedHashMap<String, String> map = projectDV.getTheDocument().getDocumentAsMap();
LinkedHashMap<String, Object> map = projectDV.getTheDocument().getDocumentAsMap();
// my-html-table
// intFlex.getElement().addClassName("my-html-table");
int i = 0;
@ -955,8 +958,9 @@ public class LayerManager {
TemporalReferenceDV tempRef = projectDV.getTemporalReference();
GWT.log("Temporal reference is: "+tempRef);
if (tempRef != null) {
flex.setHTML(flex.getRowCount() + 1, 0, ProjectUtil.toHTMLCode(tempRef));
if(tempRef.getStart()!=null || tempRef.getEnd()!=null)
flex.setHTML(flex.getRowCount() + 1, 0, ProjectUtil.toHTMLCode(tempRef));
}
List<SectionView> selections = projectView.getListSections();
@ -972,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;
@ -1007,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) {
@ -1138,8 +1142,9 @@ public class LayerManager {
FlexTable intFlex = new FlexTable();
intFlex.setCellPadding(1);
intFlex.setCellSpacing(1);
intFlex.getElement().addClassName("thePopDataTable");
if (projectDV.getTheDocument() != null) {
LinkedHashMap<String, String> map = projectDV.getTheDocument().getDocumentAsMap();
LinkedHashMap<String, Object> map = projectDV.getTheDocument().getDocumentAsMap();
// my-html-table
// intFlex.getElement().addClassName("my-html-table");
// int i = 0;
@ -1161,8 +1166,8 @@ public class LayerManager {
TemporalReferenceDV tempRef = projectDV.getTemporalReference();
if (tempRef != null) {
flex.setHTML(flex.getRowCount() + 1, 0, ProjectUtil.toHTMLCode(tempRef));
if(tempRef.getStart()!=null || tempRef.getEnd()!=null)
flex.setHTML(flex.getRowCount() + 1, 0, ProjectUtil.toHTMLCode(tempRef));
}
}
@ -1173,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());
@ -1199,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) {

View File

@ -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();
}
}

View File

@ -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);
}

View File

@ -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,29 +33,31 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
private boolean visibility;
private SwapLayer sourceLayerSwap;
private SwapLayer targetLayerSwap;
private LayerObject layerObject;
private DragDropLayer sourceEventUI;
/**
* The Class SwapLayer.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 15, 2021
* Oct 15, 2021
*/
public static class SwapLayer{
public static class SwapLayer {
private LayerItem layerItem;
private int position;
/**
* Instantiates a new swap layer.
*
* @param layerItem the layer item
* @param position the position
* @param position the position
*/
public SwapLayer(LayerItem layerItem, int position){
public SwapLayer(LayerItem layerItem, int position) {
this.layerItem = layerItem;
this.position = position;
}
/**
* Gets the layer item.
*
@ -62,7 +66,7 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
public LayerItem getLayerItem() {
return layerItem;
}
/**
* Gets the position.
*
@ -76,11 +80,14 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
/**
* Instantiates a new do action on detail layers event.
*
* @param action the action
* @param layerItem the layer item
* @param action the action
* @param layerItem the layer item
* @param layerObject the layer object
* @param layerObject the layer object
*/
public DoActionOnDetailLayersEvent(DO_LAYER_ACTION action, LayerItem layerItem) {
public DoActionOnDetailLayersEvent(DO_LAYER_ACTION action, LayerItem layerItem, LayerObject layerObject) {
this.layerItem = layerItem;
this.layerObject = layerObject;
this.doAction = action;
}
@ -135,6 +142,24 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
}
/**
* Gets the layer object.
*
* @return the layer object
*/
public LayerObject getLayerObject() {
return layerObject;
}
/**
* Sets the layer object.
*
* @param layerObject the new layer object
*/
public void setLayerObject(LayerObject layerObject) {
this.layerObject = layerObject;
}
/**
* Gets the do action.
*
@ -189,6 +214,25 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
return visibility;
}
/**
* Sets the UI event source.
*
* @param sourceEventUI the new UI event source
*/
public void setUIEventSource(DragDropLayer sourceEventUI) {
this.sourceEventUI = sourceEventUI;
}
/**
* Gets the source event UI.
*
* @return the source event UI
*/
public DragDropLayer getSourceEventUI() {
return sourceEventUI;
}
/**
* To string.
*

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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.
}
/**

View File

@ -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) {

View File

@ -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,7 +81,9 @@ import ol.source.XyzOptions;
*/
public abstract class OpenLayerMap {
private static final int MAX_LENGHT_CQL_FOR_GET_REQUEST = 1600; //1600 characters
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;
@ -80,6 +91,19 @@ public abstract class OpenLayerMap {
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.
*
@ -143,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();
@ -304,13 +332,13 @@ public abstract class OpenLayerMap {
* @param centerCoordinate the new center
*/
public void setCenter(Coordinate centerCoordinate) {
AnimationOptions animations = new AnimationOptions();
animations.setCenter(centerCoordinate);
animations.setDuration(SET_CENTER_ANIMATED_DURATION);
view.animate(animations);
//view.setCenter(centerCoordinate);
// view.setCenter(centerCoordinate);
}
/**
@ -323,7 +351,7 @@ public abstract class OpenLayerMap {
animations.setDuration(ZOOM_ANIMATED_DURATION);
animations.setZoom(zoom);
view.animate(animations);
//view.setZoom(zoom);
// view.setZoom(zoom);
}
/**
@ -339,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);
@ -357,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() {
@ -409,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);
@ -447,41 +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 || cqlFilterExpression.length()>MAX_LENGHT_CQL_FOR_GET_REQUEST) {
imageWMSParams.delete("CQL_FILTER");
} else {
imageWMSParams.set("CQL_FILTER", cqlFilterExpression);
// 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 {
setCQLFilter += " AND " + originCQLFilter;
}
}
}
if (setCQLFilter.isEmpty())
imageWMSParams.delete(CQL_FILTER_PARAMETER);
else
imageWMSParams.set(CQL_FILTER_PARAMETER, setCQLFilter);
imageWMSSource.updateParams(imageWMSParams);
wmsLayer.setSource(imageWMSSource);
wmsLayer.changed();
//map.addLayer(wmsLayer);
GWT.log("returning " + CQL_FILTER_PARAMETER + ": " + setCQLFilter);
return setCQLFilter;
}
/**
* Adds the WMS detail layer.
*
* @param layerItem the layer item
* @param layerItem the layer item
* @param initialOpacity the initial opacity
*/
public void addWMSDetailLayer(LayerItem layerItem) {
public void addWMSDetailLayer(LayerItem layerItem, double initialOpacity) {
if (wmsDetailsLayerMap == null)
wmsDetailsLayerMap = new LinkedHashMap<String, Image>();
@ -496,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);
@ -515,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);
@ -526,12 +575,65 @@ 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);
// NOT NEEDED ANYMORE.. I'M USING MIN/MAX LAYER RESOLUTION
if (wmsLayerMap == null)
@ -552,8 +654,6 @@ public abstract class OpenLayerMap {
*/
public void removeAllDetailLayers() {
// NOT NEEDED ANYMORE.. I'M USING MIN/MAX LAYER RESOLUTION
if (wmsDetailsLayerMap == null)
return;
@ -568,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.
*
@ -578,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);
@ -595,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.
*
@ -922,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.
*
@ -931,7 +1156,21 @@ public abstract class OpenLayerMap {
public void setWMSDetailLayerOpacity(LayerItem layerItem, double opacity) {
String key = layerItem.getName();
Image layer = wmsDetailsLayerMap.get(key);
layer.setOpacity(opacity);
if (layer != null)
layer.setOpacity(opacity);
}
/**
* Sets the WMS detail layer visible.
*
* @param layerItem the layer item
* @param visible the visible
*/
public void setWMSGroupedCustomLayerVisible(LayerItem layerItem, boolean visible) {
String key = layerItem.getName();
Image layer = wmsGroupedCustomLayerMap.get(key);
if (layer != null)
layer.setVisible(visible);
}
/**
@ -971,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);
}
}

View File

@ -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();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -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>

View File

@ -8,10 +8,15 @@ 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;
@ -20,12 +25,16 @@ import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAIcons;
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
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,6 +186,7 @@ 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);
@ -173,7 +203,7 @@ public class GeonaDataViewMainPanel extends Composite {
extentToEarth.getElement().appendChild(worldImg.getElement());
extentToEarth.setWidth("140px");
linkMap.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
// linkMap.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get());
linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
@ -185,16 +215,8 @@ public class GeonaDataViewMainPanel extends Composite {
initialSortFilter.setOrder(ORDER.ASC);
navListSearch.addItem(PLACEHOLDER_SELECT_SEARCH_IN, PLACEHOLDER_SELECT_SEARCH_IN);
navListSearch.getElement().getFirstChildElement().setAttribute("disabled", "disabled");
// List<UseCaseDescriptorDV> listUCDs = new ArrayList<UseCaseDescriptorDV>();
//
// for (ItemFieldsResponse itemFieldsResponse : itemFieldsReponse) {
// listUCDs.add(itemFieldsResponse.getUseCaseDescriptorDV());
// }
//
// Collections.sort(listUCDs);
for (final ItemFieldsResponse itemFieldResp : itemFieldsReponse) {
@ -216,9 +238,9 @@ public class GeonaDataViewMainPanel extends Composite {
String ucdProfileID = navListSearch.getValue(navListSearch.getSelectedIndex());
GWT.log("UCD ProfileID selected: " + ucdProfileID);
if (ucdProfileID.compareTo(PLACEHOLDER_SELECT_SEARCH_IN) != 0) {
searchFacilityPanel.clear();
ItemFieldsResponse itemFieldResp = mapItemFieldsForUCD.get(ucdProfileID);
@ -260,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();
}
/**
@ -310,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());
}
/**
@ -325,6 +376,27 @@ public class GeonaDataViewMainPanel extends Composite {
setOverlayPanelMaxHeight();
}
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.
@ -608,4 +680,107 @@ public class GeonaDataViewMainPanel extends Composite {
}
public void addOverlayLayers(GCubeCollection collection,
List<GroupedLayersDV<? extends LayerIDV>> listGroupedLayers) {
if (listGroupedLayers == null)
return;
com.github.gwtbootstrap.client.ui.Label collectionGroup = new com.github.gwtbootstrap.client.ui.Label(
collection.getUcd().getName());
collectionGroup.setType(LabelType.WARNING);
LayoutPanel lc = new LayoutPanel();
lc.add(collectionGroup);
panelCustomOverlayLayers.add(lc);
for (GroupedLayersDV gCustomLayerDV : listGroupedLayers) {
if (gCustomLayerDV.getListCustomLayers() != null) {
FlowPanel lcInner = new FlowPanel();
lcInner.getElement().getStyle().setMarginLeft(5.0, Unit.PX);
com.github.gwtbootstrap.client.ui.Label labelGroup = new com.github.gwtbootstrap.client.ui.Label(
gCustomLayerDV.getName());
labelGroup.setType(LabelType.INFO);
String descr = gCustomLayerDV.getDescription() != null && !gCustomLayerDV.getDescription().isEmpty()
? gCustomLayerDV.getDescription()
: gCustomLayerDV.getName();
labelGroup.setTitle(descr);
lcInner.add(labelGroup);
if (descr.compareTo(gCustomLayerDV.getName()) != 0) {
HTML overlayGroupDescr = new HTML();
overlayGroupDescr.getElement().setClassName("overlay-panel-style-description");
overlayGroupDescr.setHTML(descr);
lcInner.add(overlayGroupDescr);
}
List<ConfiguredLayerDV> list = gCustomLayerDV.getListCustomLayers();
for (ConfiguredLayerDV customLayer : list) {
if (customLayer.isDisplay()) {
LayerItem layerItem = new LayerItem();
if (customLayer.getWMS_URL() != null) {
final String mapServerHost = URLUtil.getPathURL(customLayer.getWMS_URL());
GWT.log("mapServerHost: " + mapServerHost);
layerItem.setMapServerHost(mapServerHost);
layerItem.setBaseLayer(false);
layerItem.setName(customLayer.getName());
layerItem.setTitle(customLayer.getTitle());
layerItem.setWmsLink(customLayer.getWMS_URL());
// panelCustomOverlayLayers.add(new CrossFilteringLayerPanel(layerItem,
// applicationBus));
lcInner.add(new OverlayCustomLayerPanel(layerItem, applicationBus));
map.addGroupedCustomWMSLayer(layerItem);
}
}
}
panelCustomOverlayLayers.add(lcInner);
}
}
linkCustomOverlayLayers.setVisible(listGroupedLayers.size() > 0);
}
public void addCrossFilteringLayers(GCubeCollection collection,
List<GroupedLayersDV<? extends LayerIDV>> listGroupedLayers) {
if (listGroupedLayers == null)
return;
com.github.gwtbootstrap.client.ui.Label collectionGroup = new com.github.gwtbootstrap.client.ui.Label(
collection.getUcd().getName());
collectionGroup.setType(LabelType.WARNING);
LayoutPanel lc = new LayoutPanel();
lc.add(collectionGroup);
panelCrossFilteringLayers.add(lc);
for (GroupedLayersDV<? extends LayerIDV> groupedLayerDV : listGroupedLayers) {
FlowPanel lcInner = new FlowPanel();
lcInner.getElement().getStyle().setMarginLeft(5.0, Unit.PX);
com.github.gwtbootstrap.client.ui.Label labelGroup = new com.github.gwtbootstrap.client.ui.Label(
groupedLayerDV.getName());
labelGroup.setType(LabelType.INFO);
String descr = groupedLayerDV.getDescription() != null && !groupedLayerDV.getDescription().isEmpty()
? groupedLayerDV.getDescription()
: groupedLayerDV.getName();
labelGroup.setTitle(descr);
lcInner.add(labelGroup);
// panelCustomOverlayLayers.add(labelGroup);
if (descr.compareTo(groupedLayerDV.getName()) != 0) {
HTML overlayGroupDescr = new HTML();
overlayGroupDescr.getElement().setClassName("filter-panel-style-description");
overlayGroupDescr.setHTML(descr);
lcInner.add(overlayGroupDescr);
// panelCustomOverlayLayers.add(overlayGroupDescr);
}
CrossFilteringLayerPanel cfp = new CrossFilteringLayerPanel(collection, groupedLayerDV, applicationBus);
cfp.setFilterButton(linkCrossFilteringLayers);
lcInner.add(cfp);
panelCrossFilteringLayers.add(lcInner);
}
linkCrossFilteringLayers.setVisible(listGroupedLayers.size() > 0);
}
}

View File

@ -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="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"

View File

@ -100,26 +100,37 @@ public class LayersSectionViewer extends Composite {
GWT.log("mapServerHost: " + mapServerHost);
BBOXDV bbox = layer.getBbox();
try {
if(bbox!=null) {
if(!GWT.isProdMode()) {
GWT.log("bbox: " + bbox);
if (bbox != null) {
if (!GWT.isProdMode()) {
GWT.log("bbox: " + bbox);
// GWT.log("bbox keys: " + bbox.keySet());
// GWT.log("bbox values: " + bbox.values());
GWT.log("minX: " + bbox.getMinX());
GWT.log("minY: " + bbox.getMinY());
GWT.log("maxX: " + bbox.getMaxX());
GWT.log("maxY: " + bbox.getMaxY());
GWT.log("minX: " + bbox.getMinX());
GWT.log("minY: " + bbox.getMinY());
GWT.log("maxX: " + bbox.getMaxX());
GWT.log("maxY: " + bbox.getMaxY());
}
BoundsMap bounds = new BoundsMap(bbox.getMinX(), bbox.getMinY(), bbox.getMaxX(), bbox.getMaxY(), "");
GWT.log("bounds: " + bounds);
mapView.addWMSLayer(mapServerHost, layerName, bounds);
} else {
Alert alert = new Alert();
alert.setType(AlertType.ERROR);
alert.setText("No BBOX found for this layer");
alert.setClose(false);
layerPanel.add(alert);
}
BoundsMap bounds = new BoundsMap(bbox.getMinX(), bbox.getMinY(), bbox.getMaxX(), bbox.getMaxY(), "");
GWT.log("bounds: " + bounds);
mapView.addWMSLayer(mapServerHost, layerName, bounds);
}else {
} catch (Exception e) {
Alert alert = new Alert();
alert.setType(AlertType.ERROR);
alert.setText("No BBOX found for this layer");
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);
}
@ -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());
}
});

View File

@ -14,7 +14,7 @@ public class ProjectUtil {
if (document == null)
return htmlCode;
Entry<String, String> firstEntrySet = document.getFirstEntryOfMap();
Entry<String, Object> firstEntrySet = document.getFirstEntryOfMap();
if (firstEntrySet != null) {
htmlCode += firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b>";
}
@ -32,7 +32,7 @@ public class ProjectUtil {
if (document == null)
return htmlCode;
Entry<String, String> firstEntrySet = document.getFirstEntryOfMap();
Entry<String, Object> firstEntrySet = document.getFirstEntryOfMap();
if (firstEntrySet != null) {
htmlCode += showkey ? firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b>"
: firstEntrySet.getValue();
@ -51,7 +51,7 @@ public class ProjectUtil {
if (document == null)
return htmlCode;
Entry<String, String> firstEntrySet = document.getFirstEntryOfMap();
Entry<String, Object> firstEntrySet = document.getFirstEntryOfMap();
if (firstEntrySet != null) {
htmlCode += firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b>";
}

View File

@ -304,7 +304,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) {

View File

@ -23,6 +23,7 @@
color: white;
padding: 10px 10px;
font-size: 14px;
padding-left: 40px;
}
.width-100 {

View File

@ -124,7 +124,7 @@ 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());
}
}
}

View File

@ -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);

View File

@ -121,7 +121,7 @@ public class ViewRelationshipPanel extends Composite {
firstProjectPanelContainer.clear();
secondProjectPanelContainer.clear();
Entry<String, String> firstEntrySet = project.getTheDocument().getFirstEntryOfMap();
Entry<String, Object> firstEntrySet = project.getTheDocument().getFirstEntryOfMap();
String htmlMsg = firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b> (id: " + project.getId()
+ ")";

View File

@ -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,13 +313,14 @@ 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) {
// message += "On the map you can see all the projects with a centroid matching the query";
// }
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";
}
HTML resultMessage = new HTML(message);
resultMessage.getElement().addClassName("search_result_msg");
@ -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()));

View File

@ -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();
}
}
}

View File

@ -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>

View File

@ -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);
}
}

View File

@ -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>

View File

@ -2,6 +2,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd;
import java.util.LinkedHashMap;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent;
@ -9,6 +10,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetai
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
@ -19,6 +21,7 @@ import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.github.gwtbootstrap.client.ui.constants.LabelType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style.FontWeight;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
@ -32,21 +35,33 @@ import com.google.gwt.event.dom.client.DropEvent;
import com.google.gwt.event.dom.client.DropHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
public class DragDropLayer extends FlowPanel {
private static final String _22PX = "22px";
private static DragDropLayer dragging = null;
private static DragDropLayer draggingTarget = null;
final boolean droppable;
private Label labelLayerName;
private Image imgLayerVisible = new Image(GNAImages.ICONS.layerVisible());
private Image imgLayerInvisible = new Image(GNAImages.ICONS.layerInvisible());
private Image imgLocate = new Image(GNAImages.ICONS.locate());
private Image imgLocateNone = new Image(GNAImages.ICONS.locateNone());
private boolean locateEnabled = false;
private HTML buttonLocate = new HTML();
private DragDropLayer INSTANCE = this;
private LoaderIcon loaderIcon = new LoaderIcon("Loading features", null);
private Button draggableButton = new Button();
private HandlerManager applicationBus;
private LayerObject layerObject;
@ -61,15 +76,35 @@ 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);
GeoportalDataViewerServiceAsync.Util.getInstance().getEntrySetsDocumentForProjectID(
layerObject.getProjectDV().getProfileID(), layerObject.getProjectDV().getId(), 1,
new AsyncCallback<LinkedHashMap<String, String>>() {
new AsyncCallback<LinkedHashMap<String, Object>>() {
@Override
public void onSuccess(LinkedHashMap<String, String> result) {
public void onSuccess(LinkedHashMap<String, Object> result) {
String realProjectName = "";
if (result != null) {
for (String key : result.keySet()) {
@ -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);
}
}

View File

@ -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);
}

View File

@ -5,6 +5,9 @@ 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;
@ -18,6 +21,8 @@ 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;
@ -47,7 +52,7 @@ import com.google.gwt.user.client.ui.Widget;
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jan 16, 2023
* May 15, 2023
*/
public class LayerCollectionPanel extends Composite {
@ -61,6 +66,9 @@ public class LayerCollectionPanel extends Composite {
@UiField
HTMLPanel styleListPanel;
@UiField
HTMLPanel statisticPanel;
@UiField
Button buttonLegend;
@ -76,6 +84,12 @@ public class LayerCollectionPanel extends Composite {
private ListBox listBoxStyles = new ListBox();
private String layerName;
private GCubeCollection gcubeCollection;
private HandlerManager applicationBus;
/**
* The Interface LayerCollectionPanelUiBinder.
*
@ -92,11 +106,13 @@ public class LayerCollectionPanel extends Composite {
* @param coll the coll
* @param applicationBus the application bus
*/
public LayerCollectionPanel(GCubeCollection coll, HandlerManager applicationBus) {
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();
@ -111,27 +127,50 @@ public class LayerCollectionPanel extends Composite {
@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));
enableLayerStyle(true);
} else {
// CLOSE COLLECTION
legendPanel.clear();
legendPanel.setVisible(false);
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();
GCubeCollection toOpen = theConfig.getAvailableCollections().get(collectionID);
final GCubeCollection toOpen = theConfig.getAvailableCollections().get(collectionID);
// Check if indexes is empty
if (toOpen.getIndexes() == null || toOpen.getIndexes().isEmpty()) {
@ -139,6 +178,7 @@ public class LayerCollectionPanel extends Composite {
Window.alert("Cannot open collection index layer for " + toOpen.getUcd().getName() + ".");
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);
@ -146,7 +186,7 @@ public class LayerCollectionPanel extends Composite {
HashMap<String, String> ogcLinks = layer.getLayer().getOgcLinks();
final String wmsLink = ogcLinks.get("wms");
final String layerName = URLUtil.getValueOfParameter("layers", wmsLink);
this.layerName = URLUtil.getValueOfParameter("layers", wmsLink);
GeoportalDataViewerServiceAsync.Util.getInstance().parseWmsRequest(wmsLink, layerName,
new AsyncCallback<GeoInformationForWMSRequest>() {
@ -181,9 +221,7 @@ public class LayerCollectionPanel extends Composite {
GWT.log("is isToggle: " + buttonLegend.isToggle());
GWT.log("is isToggled: " + buttonLegend.isToggled());
if (legendPanel.isVisible()) {
legendPanel.clear();
legendPanel.setVisible(false);
hideStyleLegend();
} else {
legendPanel.setVisible(true);
loadLegend(wmsLink);
@ -192,11 +230,45 @@ public class LayerCollectionPanel extends Composite {
}
});
listBoxStyles.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
setLayerStyle();
}
});
}
});
}
private void setLayerStyle() {
UpdateLayerToMapEvent updateLayer = new UpdateLayerToMapEvent(this.gcubeCollection, this.layerName,
LAYER_TYPE.INDEX);
updateLayer.setOperation(REQUEST_PARAMETER.STYLE, listBoxStyles.getSelectedValue());
applicationBus.fireEvent(updateLayer);
if (legendPanel.isVisible()) {
legendPanel.clear();
legendPanel.setVisible(false);
}
}
private void resetLayerStyle() {
listBoxStyles.setSelectedIndex(0);
listBoxStyles.setSelectedValue(listBoxStyles.getSelectedValue());
}
private void enableLayerStyle(boolean enabled) {
listBoxStyles.setEnabled(enabled);
}
private void hideStyleLegend() {
legendPanel.clear();
legendPanel.setVisible(false);
}
/**
* Gets the checkbox.
*
@ -228,7 +300,7 @@ public class LayerCollectionPanel extends Composite {
flow.add(new HTMLPanel("Legend for: " + theLayerName));
final HorizontalPanel hpLegend = new HorizontalPanel();
String url = geoInformation.getBaseWmsServiceHost() + "?service=WMS&" + "version="
String url = geoInformation.getServiceEndPoint() + "?service=WMS&" + "version="
+ URLUtil.getValueOfParameter("version", wmsLink) + "&" + "request=GetLegendGraphic&" + "layer="
+ theLayerName;

View File

@ -10,6 +10,8 @@
<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>

View File

@ -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);
}
}

View File

@ -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.
*

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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;
}
}

View File

@ -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,26 +44,39 @@ 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.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;
@ -72,6 +86,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedData
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
import org.gcube.portlets.user.geoportaldataviewer.shared.faults.ControlledError;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObjectType;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
@ -112,6 +127,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 +263,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 +290,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 +381,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,7 +408,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
* @param layerObjects the layer objects
* @param mapSrsName the map srs name
* @param selectBBOX the select BBOX
* @param maxWFSFeature the max WFS feature
* @param maxWFSFeature the max WFS feature. If 0 means all feature
* @param zoomLevel the zoom level
* @return the WFS features
*/
@ -436,50 +497,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);
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);
}
for (Index index : ucdConfig.getIndexes()) {
try {
IndexLayerDV toAdd = ConvertToDataValueObjectModel.convert(index);
if (toAdd.getFlag().equals(indexFlag)) {
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 +563,201 @@ 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;
}
// public Map<String, List<GroupedLayersDV>> getAvaiableCrossFilteringLayers() {
//
// Map<String, List<GroupedLayersDV>> mapProfileIDOvelayLayers = new LinkedHashMap<>();
//
// // Reading UCDs Collections from the session
// Map<String, UseCaseDescriptor> ucdCollections = SessionUtil.getAvailableCollections(getThreadLocalRequest());
//
// for (String profileId : ucdCollections.keySet()) {
//
// UseCaseDescriptor u = ucdCollections.get(profileId);
//
// // Loading geoportal_grouped_overlay_layers if exists
// GEOPORTAL_DATA_HANDLER theHandler = GEOPORTAL_DATA_HANDLER.geoportal_grouped_cross_filtering;
// List<HandlerDeclaration> handlers = u.getHandlersByType(theHandler.getType());
//
// if (handlers != null && handlers.size() > 0) {
// // Loading Handler gcube_profiles
// HandlerDeclaration handler = handlers.get(0);
// List<GroupedLayersDV> listGroupedCustomLayers = null;
// try {
//
// HandlerDeclarationDV handlerDV = ConvertToDataValueObjectModel.toHandlerDeclarationDV(handler, u,
// GEOPORTAL_CONFIGURATION_TYPE.grouped_overlay_layers);
//
// if (handler != null) {
// ConfigurationDV<?> config = handlerDV.getConfiguration();
// switch (config.getConfigurationType()) {
// case grouped_overlay_layers:
// listGroupedCustomLayers = (List<GroupedLayersDV>) config.getConfiguration();
// break;
// default:
// break;
// }
// }
// } catch (Exception e) {
// LOG.error("Error on loading {} config for ucd Id {}. Returning null",
// GEOPORTAL_CONFIGURATION_TYPE.grouped_overlay_layers, u.getId());
// }
//
// mapProfileIDOvelayLayers.put(profileId, listGroupedCustomLayers);
// } else {
// LOG.warn("No handler " + theHandler + "found into UCD " + u.getId() + ", continue...");
// mapProfileIDOvelayLayers.put(profileId, null);
// }
// }
//
// return mapProfileIDOvelayLayers;
//
// }
/**
* Gets the layer index.
*
* @param ucdConfig the ucd config
* @param flag the flag
* @return the layer index
*/
private IndexLayerDV getLayerIndex(Configuration ucdConfig, CENTROID_LAYER_INDEX_FLAG flag) {
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 +864,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
*/
@Override
protected void onBeforeRequestDeserialized(String serializedRequest) {
LOG.info("onBeforeRequestDeserialized called");
LOG.debug("onBeforeRequestDeserialized called");
String scope = "";
try {
@ -769,10 +1028,11 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
LOG.info("Access policy for discovering the layers is: " + accessPolicy);
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,10 +1154,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);
@ -1104,7 +1364,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
if (layerObject.getProjectDV().getTheDocument() == null) {
try {
LinkedHashMap<String, String> documentAsMap = getEntrySetsDocumentForProjectID(
LinkedHashMap<String, Object> documentAsMap = getEntrySetsDocumentForProjectID(
layerObject.getProfileID(), layerObject.getProjectID(), 1);
DocumentDV documentDV = new DocumentDV();
documentDV.setDocumentAsMap(documentAsMap);
@ -1200,7 +1460,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
});
if (loadDocument) {
LinkedHashMap<String, String> theDocument = getEntrySetsDocumentForProjectID(profileID, projectID,
LinkedHashMap<String, Object> theDocument = getEntrySetsDocumentForProjectID(profileID, projectID,
limitDocumentEntries);
DocumentDV docDV = new DocumentDV();
docDV.setDocumentAsMap(theDocument);
@ -1249,11 +1509,11 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
* @return the entry sets document for project ID
*/
@Override
public LinkedHashMap<String, String> getEntrySetsDocumentForProjectID(String profileID, String projectID,
public LinkedHashMap<String, Object> getEntrySetsDocumentForProjectID(String profileID, String projectID,
int limit) {
LOG.debug("called getEntrySetsDocumentForProjectID for profileID: " + profileID + ", projectID: " + projectID);
LinkedHashMap<String, String> documentAsMap = new LinkedHashMap<String, String>(limit);
LinkedHashMap<String, Object> documentAsMap = new LinkedHashMap<String, Object>(limit);
try {
@ -1269,7 +1529,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
break;
Entry<String, Object> entry = entrySetsIt.next();
documentAsMap.put(entry.getKey(), entry.getValue()!=null?entry.getValue().toString():null);
documentAsMap.put(entry.getKey(), entry.getValue() != null ? entry.getValue().toString() : null);
i++;
}
@ -1539,4 +1799,83 @@ 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;
}
}

View File

@ -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;

View File

@ -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,100 +33,95 @@ public class WMSUrlValidator {
private static final Logger LOG = LoggerFactory.getLogger(WMSUrlValidator.class);
/**
* Instantiates a new WMS url validator.
*
* @param wmsRequest the wms request
* @param wmsRequest the wms request
* @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.
*
* @param url the url
* @param url the url
* @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"
* "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,42 +255,40 @@ 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.
*
* @param wmsParam the wms param
* @param wmsParam the wms param
* @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.
*
* @param wmsParam the wms param
* @param wmsParam the wms param
* @param wmsUrlParameters the wms url parameters
* @param newValue the new value
* @param addIfNotExists the add if not exists
* @param newValue the new value
* @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();
}
}
}

View File

@ -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); }
// */
//
//}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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,8 @@ 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";
/**
* Checks if is into portal.
*
@ -136,7 +140,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 +277,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 +329,20 @@ public class SessionUtil {
}
public static void addCollectionToSession(HttpServletRequest httpServletRequest, UseCaseDescriptor u) {
HttpSession session = httpServletRequest.getSession();
Map<String, UseCaseDescriptor> ucds = (Map<String, UseCaseDescriptor>) session
.getAttribute(UCD_COLLECTIONS_SESSION);
if (ucds == null) {
ucds = new HashMap<String, UseCaseDescriptor>();
}
ucds.put(u.getId(), u);
session.setAttribute(UCD_COLLECTIONS_SESSION, ucds);
}
public static Map<String, UseCaseDescriptor> getAvailableCollections(HttpServletRequest httpServletRequest) {
HttpSession session = httpServletRequest.getSession();
return (Map<String, UseCaseDescriptor>) session.getAttribute(UCD_COLLECTIONS_SESSION);
}
}

View File

@ -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)
*

View File

@ -26,7 +26,6 @@ public class GeoNaSpatialQueryResult implements Serializable {
// Map with couple (mongoId concessione, list of uploaded GNAImages for the
// concessione)
private Map<String, List<PayloadDV>> mapImages = null;
// private ProjectDV projectDV;
/**
* Instantiates a new geo na data object.
@ -35,15 +34,6 @@ public class GeoNaSpatialQueryResult implements Serializable {
}
// public void setProjectDV(ProjectDV projectDV) {
// this.projectDV = projectDV;
//
// }
//
// public ProjectDV getProjectDV() {
// return projectDV;
// }
/**
* Gets the features.
*

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -0,0 +1,16 @@
package org.gcube.portlets.user.geoportaldataviewer.shared.gis;
import java.io.Serializable;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@Data
public class DisplayCategory implements Serializable {
String title;
String description;
}

View File

@ -23,7 +23,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 +36,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 +101,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;
@ -722,7 +718,7 @@ public class LayerItem implements Serializable, Cloneable {
public String getCqlFilter() {
return cqlFilter;
}
/**
* Sets the cql filter.
*
@ -756,16 +752,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 +774,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 +895,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 +939,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,7 +953,6 @@ public class LayerItem implements Serializable, Cloneable {
return builder.toString();
}
/**
* To layer item.
*
@ -991,9 +975,8 @@ public class LayerItem implements Serializable, Cloneable {
* @param maxResolution the max resolution
* @return the layer item
*/
// TODO Constructor from IndexLayerDV, GCUBESDILAeryDV or direct info
// TODO Constructor from IndexLayerDV, GCUBESDILAeryDV or direct info
private LayerItem toLayerItem(LayerType layerType, String layerTitle, String layerName, String layerURL,
String mapServerHost, boolean isExternal, boolean isBase, boolean displayInLayerSwitcher,
ArrayList<String> styles, String wmsLink, boolean onTop, HashMap<String, String> wmsNotStandardParams,

View File

@ -0,0 +1,13 @@
package org.gcube.portlets.user.geoportaldataviewer.shared.gis;
import java.util.Map;
public class OverlayWMSLayer {
private String title;
private String name;
private String wmsServiceBaseURL;
private boolean display;
private Map<String, String> mapProperties;
}

View File

@ -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","");

View File

@ -8,15 +8,14 @@ import java.util.HashMap;
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 27, 2020
* Oct 27, 2020
*/
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,20 +52,19 @@ public class GeoInformationForWMSRequest implements Serializable {
/**
* Instantiates a new geo information for wms request.
*
* @param baseWmsServiceHost the base wms service host
* @param wmsRequest the wms request
* @param layerName the layer name
* @param versionWms the version wms
* @param crs the crs
* @param mapWmsNoStandard the map wms not standard
* @param styles the layer styles
* @param isNcWMS the is nc WMS
* @param zAxis the z axis
* @param serviceEndPoint the base wms service host
* @param wmsRequest the wms request
* @param layerName the layer name
* @param versionWms the version wms
* @param crs the crs
* @param mapWmsNoStandard the map wms not standard
* @param styles the layer styles
* @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=");

View File

@ -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;
}
@ -717,11 +735,11 @@ Table Of Contents (TOC)
text-align: center;
font-size: 20px;
margin: 0;
position: absolute;
top: 50%;
position: absolute;
top: 50%;
width: 100%;
-ms-transform: translateY(-50%);
transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
.general_error div {
@ -729,45 +747,13 @@ Table Of Contents (TOC)
}
/******************************
RESPONSIVE
*******************************/
@media all and (max-width: 2350px) {
#timeline-data {
width: 700px;
left: 550px;
}
.general_warning {
text-align: center;
font-size: 20px;
}
@media all and (max-width: 2048px) {
#timeline-data {
width: 600px;
left: 310px;
bottom: 50px
}
.details-panel {
width: 600px;
}
}
@media all and (max-width: 1024px) {
#timeline-data {
width: 260px;
left: 140px;
bottom: 50px
}
.details-panel {
width: 400px;
}
.search-facility {
width: 250px;
max-width: 300px;
}
.inner-toolbar {
width: 100px;
}
.general_warning div {
padding: 20px;
}
/* OPEN COLLECTION UI */
@ -790,6 +776,166 @@ RESPONSIVE
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
*******************************/
@media all and (max-width: 2350px) {
#timeline-data {
width: 700px;
left: 550px;
}
}
@media all and (max-width: 2048px) {
#timeline-data {
width: 600px;
left: 310px;
bottom: 50px
}
.details-panel {
width: 530px;
}
}
@media all and (max-width: 1601px) {
.layers-panel {
width: 350px;
}
.dand-layer {
width: 336px;
}
.thePopDataTable {
}
.search-facility {
max-width: 680px;
}
.search-field {
width: 97%;
}
.ol-popup {
min-width: 220px;
width: 220px;
}
.thePopDataTable tr:last-of-type {
display: none;
}
.layer-panel {
width: 355px;
}
}
@media all and (max-width: 1024px) {
#timeline-data {
width: 260px;
left: 140px;
bottom: 50px
}
.details-panel {
width: 400px;
}
.search-facility {
/*width: 250px;
max-width: 300px;*/
}
.inner-toolbar {
/*width: 100px;*/
}
}
@media all and (max-height: 900px) {
.ol-popup{
min-width: 150px;
max-width: 150px;
max-height: 150px;
overflow-y: scroll;
}
.ol-popup img {
width: 100%;
max-width: 150px;
}
}
/******************************
END RESPONSIVE
*******************************/

View File

@ -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
@ -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>

View File

@ -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>

View File

@ -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");
@ -116,22 +114,23 @@ public class GeoportalViewer_Tests {
Project project = clientProjects.getProjectByID(PROFILE_ID, PROJECT_ID);
String jsonDocument = project.getTheDocument().toJson();
System.out.println("JSON Project is: " + jsonDocument);
ACCESS_POLICY accessPolicy = GeportalCheckAccessPolicy.accessPolicyFromSessionLogin(null);
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);
@ -270,8 +269,9 @@ public class GeoportalViewer_Tests {
Document temporalJsonTemplate = GeoportalClientCaller.useCaseDescriptors()
.readTemporalDimensionTemplate(theProject.getProfileID());
// String template = "{\"content\": \"$.nome\"," + "\"title\": \"$.nome\","
// + "\"start\" : \"$.dataInizioProgetto\"," + "\"end\" : \"$.dataFineProgetto\"}";
// String template = "{\"content\": \"$.nome\"," + "\"title\": \"$.nome\","
// + "\"start\" : \"$.dataInizioProgetto\"," + "\"end\" :
// \"$.dataFineProgetto\"}";
if (temporalJsonTemplate != null) {
@ -291,14 +291,13 @@ public class GeoportalViewer_Tests {
e.printStackTrace();
}
}
//@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
//SETTING PROJECTION ONLY FOR PROEJCT ID
// NEED TO GET projections
// 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));
//RESETTIG FILTER AND PROJECT TO CLIENT QUERY
System.out.println("IDS returned in ms: " + (end - start));
// 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,21 +352,21 @@ 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));
}
}

View File

@ -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();
}
}
}