Compare commits

..

29 Commits

Author SHA1 Message Date
Francesco Mangiacrapa 4ae3c2a30a removed setUserInSession 2020-11-19 15:55:43 +01:00
Francesco Mangiacrapa 26eeb3bf67 added modal on Open interaction 2020-11-19 15:14:05 +01:00
Francesco Mangiacrapa 87514c4f43 managed the init 2020-11-18 17:28:44 +01:00
Francesco Mangiacrapa 9920698d75 improved the css 2020-11-18 15:35:24 +01:00
Francesco Mangiacrapa 294bc2aa66 Details for selected product are shown in the right panel 2020-11-18 12:19:29 +01:00
Francesco Mangiacrapa eb8ea01bfb integrating the url shortener 2020-11-17 17:32:13 +01:00
Francesco Mangiacrapa e6f232298e in progress on Share With facility 2020-11-17 12:07:11 +01:00
Francesco Mangiacrapa cb132e93d5 fixed show/hide feature on zoom level. stylized the coordinates on Map 2020-11-17 10:27:44 +01:00
Francesco Mangiacrapa 2fb8f459b4 added logic to display Popup on Zoom level interaction 2020-11-16 18:03:05 +01:00
Francesco Mangiacrapa db668a37a8 added the first uploaded image into popup 2020-11-16 12:09:11 +01:00
Francesco Mangiacrapa 2536912982 Added init stage with git and gid parameters 2020-11-13 17:14:08 +01:00
Francesco Mangiacrapa 9d87dc8299 revisited the init logic 2020-11-13 16:37:34 +01:00
Francesco Mangiacrapa 38f6a2da03 updated the "GeoNa-Viewer-Profile" definition 2020-11-13 13:06:39 +01:00
Francesco Mangiacrapa 5b959299bd just changed a comment 2020-11-12 18:27:52 +01:00
Francesco Mangiacrapa 538f87f1d1 added Application Profile to read available layers 2020-11-12 18:25:24 +01:00
Francesco Mangiacrapa 05f6d5f5b8 fixed coordinate 2020-11-12 12:59:07 +01:00
Francesco Mangiacrapa 4064189cd3 fixed balloon visibility 2020-11-12 12:27:00 +01:00
Francesco Mangiacrapa 8dc710686f optimized map init 2020-11-12 12:03:22 +01:00
Francesco Mangiacrapa 7a36ef5ed5 Integrated Pianta Fine Scavo 2020-11-12 11:39:52 +01:00
Francesco Mangiacrapa 2ba6472e10 trying to center map on WMS Layer 2020-11-11 17:58:36 +01:00
Francesco Mangiacrapa fe9afe0bc2 working on layer view 2020-11-11 17:48:55 +01:00
Francesco Mangiacrapa 654ca73dcf enhancement on view details 2020-11-11 15:53:04 +01:00
Francesco Mangiacrapa 3b1caa2d7f optimized the view 2020-11-11 12:05:21 +01:00
Francesco Mangiacrapa c98bc7815b building view 2020-11-10 18:17:53 +01:00
Francesco Mangiacrapa 7d2a685508 added serializable 2020-11-10 17:53:35 +01:00
Francesco Mangiacrapa 6c495119b9 added set scope 2020-11-10 16:46:28 +01:00
Francesco Mangiacrapa ab8119be2e in progress view details 2020-11-10 16:22:28 +01:00
Francesco Mangiacrapa cee9c97c28 In progress on view details 2020-11-10 14:11:10 +01:00
francesco ebc7c60ccc added recordview 2020-11-05 17:17:07 +01:00
205 changed files with 6542 additions and 18677 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/geoportal-data-viewer-app-3.6.0/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/geoportal-data-viewer-app-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
@ -8,9 +8,14 @@
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
@ -19,16 +24,17 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/geoportal-data-viewer-app-3.6.0/WEB-INF/classes"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="target/geoportal-data-viewer-app-1.0.0-SNAPSHOT/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.6.0
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-1.0.0-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -1,2 +0,0 @@
eclipse.preferences.version=1
gwtSyncCodeServer=true

View File

@ -6,6 +6,6 @@ org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -1,924 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="geoportal-data-viewer-app-3.6.0">
<wb-module deploy-name="geoportal-data-viewer-app-1.0.0-SNAPSHOT">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<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>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/>
<property name="java-output-path" value="/geoportal-data-viewer-app/target/geoportal-data-viewer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/>
<property name="context-root" value="geoportal-data-viewer-app"/>
</wb-module>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="java" version="1.8"/>
<installed facet="jst.web" version="2.3"/>
<installed facet="com.gwtplugins.gwt.facet" version="1.0"/>
<installed facet="jst.jaxrs" version="2.0"/>
<installed facet="java" version="1.8"/>
<installed facet="jst.web" version="3.0"/>
</faceted-project>

View File

@ -4,144 +4,6 @@
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]
## [v1.0.0-SNAPSHOT] - 2020-10-07
- GUI optimization [#25461]
- Using the latest libraries version: gwt-ol.v8.4.1 (with openlayers.v6.6.1) and gwt.v2.10
- Showing basic statistics (i.e. "X project published") via 'countByPhase' method [#25598]
## [v3.5.0]
- Supported the cross-filtering [#25074]
- Supported the grouped custom layers [#25110]
- Managed the (WMS) Layer Style facility [#25066]
## [v3.4.0] - 2023-05-11
- Integrated the geoportal-data-mapper component [#24978]
## [v3.3.1] - 2023-03-30
- Just including new dependencies
- Improved css
## [v3.3.0] - 2023-02-20
#### Fixes
- [#24632] Returning the public layer index if the private is missing
- [#24632] No temporal info shown if the temporal extent is missing
## [v3.2.1] - 2023-02-03
#### Fixes
- [#24432] Reverting serialization LinkedHashMap<String, String> to LinkedHashMap<String, Object>.
- Improved Alert UX in case of broken shared link
- Moved to gwt 2.9.0
## [v3.2.0] - 2023-01-31
#### Enhancements
- [#24506] Added facility: Locate/Highlight the Layer on the Map
## [v3.1.0] - 2023-01-12
#### Enhancements
- [#24300] Improved the GUI of the search functionality when multiple collections are available
- [#24404] Improved the handlers of events: Search, Locate
- Improved the user experience providing an animated map and zoom to layers facility
#### Fixes
- Reduced the BBOX when resolving a project by share link
- GNA Project binding with automatically adding of the layers to Map
- [#24390] Read the access policy from the fileset json section
- [#24432] Fixing serialization issue using LinkedHashMap<String, String> instead of LinkedHashMap<String, Object>
## [v3.0.0] - 2022-11-28
- [#23940] Passed to CMS-UCD
- [#23941] Implemented and integrated the DTO Project/Document per UCD config and gCube Metadata Profiles
- [#23953] Passed the 'Search facility' to CMS-UCD model
- [#23954] Passed the 'Details Panel facility' to CMS-UCD model
- [#23955] Implemented the Temporal facility to navigate temporal relations among (JSON) Projects
- [#24028] Passed the spatial dimension to CMS-Project model
- [#24136] Integrated the temporal dimension on the front-end side
- [#24195] Integrated the temporal query
## [v2.4.1-SNAPSHOT] - 2022-09-28
- [#23906] Tested building on jenkins with JDK_11
## [v2.4.0] - 2022-09-07
#### Enhancement
- [#23819] Adding layers to principal map belonging to more centroids with the same spatial position
## [v2.3.1] - 2022-08-29
#### Bug fixed
- [#23770] OpenLayers CDN URLs updated (github relative URL changed from "master/en/vX.Y.Z/" to "main/dist/en/vX.Y.Z/")
## [v2.3.0] - 2022-07-26
#### Bug fixed
- [#23689] Fixed the search facility is buggy when used from public access
- [#23704] Used new maven range for geoportal-client
- Moved to 3.6.4
## [v2.2.0] - 2021-12-07
#### Enhancements
- [#22518] Added the search for fields facility
## [v2.1.0-SNAPSHOT] - 2021-11-10
#### Enhancements
- [#22518] Added the search for name facility
- [#22027] Integrated with MapBox Satellite
- Added link "Open Project" in the pop-up of WFS details
- Moved to gwt-ol3 v8.1.0-gwt2_9
## [v2.0.1] - 2021-11-10
#### Fixes
- [#22370] Use a max-height for preview image shown in the pop-up
## [v2.0.0] - 2021-07-30
#### Enhancements
- [#21890] Porting to ConcessioniManagerI and pass to mongoID
- [#20595] Porting and using the model view provided by geoportal-common
- [#21946] Show layers of a concessione automatically on map according to zoom level
- [#21976] Access policies checked on server-side
- [#22042] Implemented the public access
- [#22040] Revisited the "Abstract and Relazione di Scavo"
- [#22041] Files have been ported to FileSet model
- [#21991] Implemented the Layer Switcher
## [v1.2.0] - 2021-07-19
#### Enhancements
- [#21847] Integrated with an Image and LighBox gallery for images
- Moved to maven-portal-bom 3.6.3
## [v1.1.0] - 2020-12-21
#### Enhancements
- [#20357] Improvements feedback-driven
## [v1.0.0] - 2020-12-09
- [#20004] First release
[#20004] First release

View File

@ -1,52 +1,15 @@
# GeoPortal Data Viewer App
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.
The GeoPortal Data Viewer App is an application to access, discovery and navigate the GeoNa products by a Gis GUI
## Built With
* [OpenJDK](https://openjdk.java.net/) - The JDK used
* [Maven](https://maven.apache.org/) - Dependency Management
**Uses**
* GWT v.2.9.0. [GWT](http://www.gwtproject.org) is licensed under [Apache License 2.0](http://www.gwtproject.org/terms.html)
* GWT-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
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)
N/A
## Change log

154
pom.xml
View File

@ -7,23 +7,20 @@
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.2.0</version>
<version>1.1.0</version>
<relativePath />
</parent>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>geoportal-data-viewer-app</artifactId>
<packaging>war</packaging>
<version>3.6.0</version>
<version>1.0.0-SNAPSHOT</version>
<name>GeoPortal Data Viewer App</name>
<description>The GeoPortal Data Viewer App is an application to access, discovery and navigate the Geoportal projects/documents by a Web-Map Interface</description>
<description>The GeoPortal Data Viewer App is an application to access, discovery and navigate the GeoNa products by a Gis GUI</description>
<properties>
<!-- Convenience property to set the 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>
<gwt.version>2.9.0</gwt.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>
@ -52,26 +49,32 @@
</developers>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>3.7.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
<!-- <dependencies> -->
<!-- <dependency> -->
<!-- <groupId>org.gcube.distribution</groupId> -->
<!-- <artifactId>maven-portal-bom</artifactId> -->
<!-- <version>3.6.0</version> -->
<!-- <type>pom</type> -->
<!-- <scope>import</scope> -->
<!-- <exclusions> -->
<!-- <exclusion> -->
<!-- <groupId>com.google.gwt</groupId> -->
<!-- <artifactId>gwt-user</artifactId> -->
<!-- </exclusion> -->
<!-- <exclusion> -->
<!-- <groupId>com.google.gwt</groupId> -->
<!-- <artifactId>gwt-servlet</artifactId> -->
<!-- </exclusion> -->
<!-- <exclusion> -->
<!-- <groupId>com.google.gwt</groupId> -->
<!-- <artifactId>gwt-dev</artifactId> -->
<!-- </exclusion> -->
<!-- </exclusions> -->
<!-- </dependency> -->
<!-- </dependencies> -->
</dependencyManagement>
<dependencies>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
@ -90,20 +93,10 @@
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>oidc-library-portal</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>oidc-library</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.tdesjardins</groupId>
<artifactId>gwt-ol3</artifactId>
<version>${gwt.ol.version}</version>
<version>8.0.0-gwt2_9</version>
</dependency>
<dependency>
<groupId>com.github.gwtbootstrap</groupId>
@ -116,102 +109,90 @@
<artifactId>geo-utility</artifactId>
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.resources.discovery</groupId>
<artifactId>ic-client</artifactId>
<scope>provided</scope>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.gcube.common</groupId> -->
<!-- <artifactId>authorization-client</artifactId> -->
<!-- <version>[2.0.0, 3.0.0-SNAPSHOT)</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>org.gcube.resources.discovery</groupId> -->
<!-- <artifactId>ic-client</artifactId> -->
<!-- <version>[1.0.0, 2.0.0-SNAPSHOT)</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId>
<version>[1.1.0, 2.0.0-SNAPSHOT)</version>
<scope>compile</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> -->
<dependency>
<groupId>org.gcube.common.portal</groupId>
<artifactId>portal-manager</artifactId>
<version>[2.4.1,3.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.dvos</groupId>
<artifactId>usermanagement-core</artifactId>
<version>[2.4.1,3.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<!-- REQUIRED FOR JDK_11 -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
<scope>provided</scope>
</dependency>
<!-- END -->
<dependency>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-data-mapper</artifactId>
<version>[1.0.1-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-data-common</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>2.7.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>keycloak-client</artifactId>
<artifactId>geoportal-logic</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>portal-service</artifactId>
<!-- <version>6.2.5</version> -->
<version>6.2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<!-- <version>2.0</version> -->
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<!-- <version>1.6.4</version> -->
<version>1.6.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<!-- <version>1.6.4</version> -->
<version>1.6.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- Output classes directly into the webapp, so that IDEs and "mvn process-classes"
update them in DevMode -->
<!-- <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory> -->
<!-- Output classes directly into the webapp, so that IDEs and "mvn process-classes"
update them in DevMode -->
@ -226,9 +207,6 @@
<version>${gwt.version}</version>
<executions>
<execution>
<!-- <configuration> -->
<!-- <style>${gwt.compiler.style}</style> -->
<!-- </configuration> -->
<goals>
<goal>compile</goal>
<!-- <goal>test</goal> -->
@ -266,10 +244,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<!-- SA Plugin -->
<plugin>

View File

@ -6,17 +6,12 @@
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.standard.Standard' />
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard' /> -->
<inherits name='ol.GwtOL' />
<inherits name="com.github.gwtbootstrap.Bootstrap" />
<inherits
name='org.gcube.application.geoportalcommon.GeoportalDataCommon' />
<inherits name="com.google.gwt.json.JSON" />
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->

View File

@ -1,24 +1,14 @@
package org.gcube.portlets.user.geoportaldataviewer.client;
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayersMapParameters;
import com.google.gwt.dom.client.Element;
import com.google.gwt.i18n.client.DateTimeFormat;
/**
* The Class GeoportalDataViewerConstants.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 24, 2020
*/
public class GeoportalDataViewerConstants {
public static final int TABLET_WIDTH = 1601;
public static final String EPSG_4326 = "EPSG:4326";
public static final String EPSG_3857 = "EPSG:3857";
public static final String MAP_DIV = "map";
public static final String GET_WMS_PARAMETER = "wmsrequest";
public static final String GET_GEONA_ITEM_TYPE = "git";
public static final String GET_GEONA_ITEM_ID = "gid";
@ -27,187 +17,18 @@ 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 {
MOUSE_CLICK, MAP_ZOOM_END, MOVE_END, ADDED_CENTROID_LAYER_TO_MAP
}
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.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 24, 2020
*/
public enum LayerType {
RASTER_BASELAYER, FEATURE_TYPE
};
public static DateTimeFormat DT_FORMAT = DateTimeFormat.getFormat(ConvertToDataViewModel.DATE_FORMAT);
public static final int MAX_WFS_FEATURES = 10; // zero for no limit
public enum LayerType {RASTER_BASELAYER, FEATURE_TYPE};
public static final int MAX_WFS_FEATURES = 3; // zero for no limit
public static final String NEW_LINE_BR = "<br/>";
public static enum MAP_PROJECTION {
EPSG_4326("4326", "EPSG:4326"), EPSG_3857("3857", "EPSG:3857");
String id;
String name;
MAP_PROJECTION(String id, String name) {
this.id = id;
this.name = name;
}
public String getId() {
return id;
}
public String getName() {
return name;
}
}
public static final double ITALY_CENTER_LONG = 12.45;
public static final double ITALY_CENTER_LAT = 42.98;
public static final int LIGHT_MAP_ITALY_FIT_ZOOM_ON = 5;
public static final int MAP_ITALY_FIT_ZOOM_ON = 5;
/**
* Prints the.
*
* @param msg the msg
*/
public static native void printJs(String msg)/*-{
//console.log("js console: " + msg);
}-*/;
/**
* Prints the.
*
* @param msg the msg
*/
public static native void printJsObj(Object object)/*-{
//console.log("js obj: " + JSON.stringify(object, null, 4));
}-*/;
/**
* Prints the.
*
* @param msg the msg
*/
public static native String toJsonObj(Object object)/*-{
return JSON.stringify(object);
}-*/;
/**
* Json to HTML.
*
* @param jsonTxt the json txt
* @return the string
*/
public static native String jsonToTableHTML(String jsonTxt)/*-{
try {
var jsonObj = JSON.parse(jsonTxt);
if (jsonObj.length == undefined)
jsonObj = [ jsonObj ]
//console.log(jsonObj.length)
// EXTRACT VALUE FOR HTML HEADER.
var col = [];
for (var i = 0; i < jsonObj.length; i++) {
for ( var key in jsonObj[i]) {
//console.log('key json' +key)
if (col.indexOf(key) === -1) {
col.push(key);
}
}
}
// CREATE DYNAMIC TABLE.
var table = document.createElement("table");
try {
table.classList.add("my-html-table");
} catch (e) {
console.log('invalid css add', e);
}
// ADD JSON DATA TO THE TABLE AS ROWS.
for (var i = 0; i < col.length; i++) {
tr = table.insertRow(-1);
var firstCell = tr.insertCell(-1);
//firstCell.style.cssText="font-weight: bold; text-align: center; vertical-align: middle;";
firstCell.innerHTML = col[i];
for (var j = 0; j < jsonObj.length; j++) {
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]') {
var formattedValueArray = "";
for (var k = 0; k < theValue.length; k++) {
var theValueArray = theValue[k];
//console.log(theValueArray);
formattedValueArray += theValueArray + "<br>";
}
tabCell.innerHTML = formattedValueArray;
} else {
tabCell.innerHTML = theValue;
}
}
}
return table.outerHTML;
} catch (e) {
console.log('invalid json', e);
return jsonTxt;
}
}-*/;
public static native void clickElement(Element elem) /*-{
elem.click();
}-*/;
public static final int ITALY_FIT_ZOOM_ON = 5;
}

View File

@ -1,27 +1,15 @@
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.GeoNaDataViewerProfile;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaItemRef;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
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.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@ -31,7 +19,7 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 17, 2020
* Nov 17, 2020
*/
@RemoteServiceRelativePath("geoportaldataviewerservice")
public interface GeoportalDataViewerService extends RemoteService {
@ -40,7 +28,7 @@ public interface GeoportalDataViewerService extends RemoteService {
* Parses the wms request.
*
* @param wmsRequest the wms request
* @param layerName the layer name
* @param layerName the layer name
* @return the geo information for WMS request
* @throws Exception the exception
*/
@ -49,16 +37,24 @@ public interface GeoportalDataViewerService extends RemoteService {
/**
* Gets the data result.
*
* @param layerObjects the layer objects
* @param mapSrsName the map srs name
* @param mapBBOX the map BBOX
* @param layerObjects the layer objects
* @param mapSrsName the map srs name
* @param mapBBOX the map BBOX
* @param maxWFSFeature the max WFS feature
* @param zoomLevel the zoom level
* @param zoomLevel the zoom level
* @return the data result
* @throws Exception the exception
*/
List<GeoNaSpatialQueryResult> getDataResult(List<LayerObject> layerObjects, String mapSrsName, BoundsMap mapBBOX,
int maxWFSFeature, double zoomLevel) throws Exception;
int maxWFSFeature, double zoomLevel);
/**
* Gets the concessione for id.
*
* @param id the id
* @return the concessione for id
* @throws Exception the exception
*/
ConcessioneDV getConcessioneForId(Long id) throws Exception;
/**
* Gets the my login.
@ -67,13 +63,33 @@ public interface GeoportalDataViewerService extends RemoteService {
*/
String getMyLogin();
/**
* Gets the layer for type.
*
* @param layerType the layer type
* @return the layer for type
* @throws Exception the exception
*/
GeoInformationForWMSRequest getLayerForType(String layerType) throws Exception;
/**
* Gets the geo na data view profile.
*
* @return the geo na data view profile
* @throws Exception the exception
*/
GNADataViewerConfigProfile getGeoNaDataViewProfile() throws Exception;
GeoNaDataViewerProfile getGeoNaDataViewProfile() throws Exception;
/**
* Gets the uploaded images for id.
*
* @param itemType the item type
* @param id the id
* @param maxImages the max images
* @return the uploaded images for id
* @throws Exception the exception
*/
List<UploadedImageDV> getUploadedImagesForId(String itemType, Long id, int maxImages) throws Exception;
/**
* Gets the public links for.
@ -82,151 +98,15 @@ public interface GeoportalDataViewerService extends RemoteService {
* @return the public links for
* @throws Exception the exception
*/
GeoportalItemReferences getPublicLinksFor(GeoportalItemReferences item) throws Exception;
GeoNaItemRef getPublicLinksFor(GeoNaItemRef item) throws Exception;
/**
* Gets the layers for id.
* Gets the short url.
*
* @param theProfileID the the profile ID
* @param theProductID the the product ID
* @return the layers for id
* @param longUrl the long url
* @return the short url
* @throws Exception the exception
*/
List<GCubeSDIViewerLayerDV> getLayersForId(String theProfileID, String theProductID) throws Exception;
/**
* Gets the WFS features.
*
* @param layerObjects the layer objects
* @param mapSrsName the map srs name
* @param selectBBOX the select BBOX
* @param maxWFSFeature the max WFS feature
* @param zoomLevel the zoom level
* @return the WFS features
*/
List<GeoNaSpatialQueryResult> getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName,
BoundsMap selectBBOX, int maxWFSFeature, double zoomLevel);
/**
* Gets the list base layers.
*
* @return the list base layers
*/
List<BaseMapLayer> getListBaseLayers();
/**
* List of fields for searching.
*
* @return the list
* @throws Exception the exception
*/
List<ItemFieldsResponse> getConfigListOfFieldsForSearching() throws Exception;
/**
* Gets the project view for id.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the project view for id
* @throws Exception the exception
*/
ProjectView getProjectViewForId(String profileID, String projectID) throws Exception;
/**
* Gets the list projects.
*
* @param theProfileID the the profile ID
* @param start the start
* @param limit the limit
* @param filter the filter
* @param reloadFromService the reload from service
* @return the list projects
* @throws Exception the exception
*/
ResultSetPaginatedDataIDs getListProjects(String theProfileID, Integer start, Integer limit, SearchingFilter filter,
boolean reloadFromService) throws Exception;
/**
* NEW CODE HERE.
*
* @return the initial configuration
* @throws Exception the exception
*/
ViewerConfiguration getInitialConfiguration() throws Exception;
/**
* Gets the entry sets document for project ID.
*
* @param profileID the profile ID
* @param projectID the project ID
* @param limit the limit
* @return the entry sets document for project ID
*/
LinkedHashMap<String, Object> getEntrySetsDocumentForProjectID(String profileID, String projectID, int limit);
/**
* Gets the relationships for timeline.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the relationships for timeline
* @throws Exception the exception
*/
List<String> getRelationshipsForTimeline(String profileID, String projectID) throws Exception;
/**
* Gets the spatial reference.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the spatial reference
*/
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);
String getShortUrl(String longUrl) throws Exception;
}

View File

@ -1,27 +1,15 @@
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.GeoNaDataViewerProfile;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaItemRef;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
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.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
@ -47,50 +35,20 @@ public interface GeoportalDataViewerServiceAsync {
void parseWmsRequest(String wmsRequest, String layerName, AsyncCallback<GeoInformationForWMSRequest> callback);
void getDataResult(List<LayerObject> layerObjects, String mapSrsName, BoundsMap mapBBOX, int maxWFSFeature,
double zoomLevel, AsyncCallback<List<GeoNaSpatialQueryResult>> callback);
void getDataResult(List<LayerObject> layerObjects, String mapSrsName, BoundsMap mapBBOX, int maxWFSFeature, double zoomLevel,
AsyncCallback<List<GeoNaSpatialQueryResult>> callback);
void getConcessioneForId(Long id, AsyncCallback<ConcessioneDV> callback);
void getMyLogin(AsyncCallback<String> callback);
void getGeoNaDataViewProfile(AsyncCallback<GNADataViewerConfigProfile> callback);
void getLayerForType(String layerType, AsyncCallback<GeoInformationForWMSRequest> callback);
void getPublicLinksFor(GeoportalItemReferences item, AsyncCallback<GeoportalItemReferences> asyncCallback);
void getGeoNaDataViewProfile(AsyncCallback<GeoNaDataViewerProfile> callback);
void getLayersForId(String theProfileID, String theProductID,
AsyncCallback<List<GCubeSDIViewerLayerDV>> asyncCallback);
void getUploadedImagesForId(String itemType, Long id, int maxImages, AsyncCallback<List<UploadedImageDV>> callback);
void getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName, BoundsMap selectBBOX, int maxWFSFeature,
double zoomLevel, AsyncCallback<List<GeoNaSpatialQueryResult>> callback);
void getListBaseLayers(AsyncCallback<List<BaseMapLayer>> callback);
void getConfigListOfFieldsForSearching(AsyncCallback<List<ItemFieldsResponse>> callback);
void getProjectViewForId(String profileID, String projectID, AsyncCallback<ProjectView> callback);
void getListProjects(String theProfileID, Integer start, Integer limit, SearchingFilter filter,
boolean reloadFromService, AsyncCallback<ResultSetPaginatedDataIDs> callback);
void getInitialConfiguration(AsyncCallback<ViewerConfiguration> callback);
void getEntrySetsDocumentForProjectID(String profileID, String projectID, int limit,
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);
void getPublicLinksFor(GeoNaItemRef item, AsyncCallback<GeoNaItemRef> asyncCallback);
void getShortUrl(String longUrl, AsyncCallback<String> callback);
}

View File

@ -1,16 +1,10 @@
package org.gcube.portlets.user.geoportaldataviewer.client;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent;
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.ui.map.ExtentMapUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.PLACE;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE;
@ -20,136 +14,130 @@ import com.google.gwt.event.shared.HandlerManager;
import ol.Coordinate;
import ol.MapBrowserEvent;
import ol.MapEvent;
import ol.OLFactory;
/**
* The Class OLMapManager.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 19, 2020
* Nov 19, 2020
*/
public class OLMapManager {
private String targetId;
private HandlerManager layerManagerBus;
private OpenLayerMap olMap;
private OpenLayerOSM olMap;
private ol.Extent dragStartExtent = null;
private Double zoomStart = null;
private Double zoomEnd = null;
private ol.Extent dragEndExtent = null;
public static final int QUERY_MIN_ZOOM_LEVEL = 13;
public static final Double LAYER_DETAIL_MIN_RESOLUTION = 0.01;
public static final Double LAYER_DETAIL_MAX_RESOLUTION = 18.5;
private static final int QUERY_MIN_ZOOM_LEVEL = 13;
/**
* Instantiates a new OL map manager.
*
* @param targetId the target id
* @param targetId the target id
* @param layerManagerBus the layer manager bus
* @param baseMapLayer the base map layer
*/
public OLMapManager(String targetId, HandlerManager layerManagerBus, BaseMapLayer baseMapLayer) {
public OLMapManager(String targetId, HandlerManager layerManagerBus) {
this.targetId = targetId;
this.layerManagerBus = layerManagerBus;
instanceOLMap(baseMapLayer);
instanceOLMap();
}
/**
* Instance OL map.
*
* @param baseMapLayer the base map layer
*/
public void instanceOLMap(BaseMapLayer baseMapLayer) {
public void instanceOLMap() {
olMap = new OpenLayerMap(targetId, layerManagerBus, baseMapLayer) {
olMap = new OpenLayerOSM(targetId, layerManagerBus) {
@Override
public void clickListener(MapBrowserEvent event) {
Coordinate coordinate = event.getCoordinate();
if (!olMap.mapInstancied())
if(!olMap.mapInstancied())
return;
if (olMap.isQueryPointActive()) {
GeoQuery select = toDataPointQuery(coordinate);
layerManagerBus.fireEvent(new QueryDataEvent(select, coordinate));
// if (olMap.isQueryPointActive()) {
// GeoQuery select = toDataPointQuery(coordinate);
// layerManagerBus.fireEvent(new QueryDataEvent(select, coordinate));
//
// }
ExtentWrapped toExt = new ExtentWrapped(coordinate.getX(), coordinate.getY(), coordinate.getX(),
coordinate.getY());
GeoQuery select = toDataPointQuery(coordinate, true);
layerManagerBus.fireEvent(new QueryDataEvent(select, toExt, null, true, MapEventType.MOUSE_CLICK));
}
}
@Override
public void moveEndListener(MapEvent event) {
// onInit
if (!olMap.mapInstancied())
//onInit
if(!olMap.mapInstancied())
return;
checkSelectQuery(MapEventType.MOVE_END);
checkSelectQuery();
}
@Override
public void moveStartListener(MapEvent event) {
// onInit
if (!olMap.mapInstancied())
//onInit
if(!olMap.mapInstancied())
return;
setDragStart();
}
@Override
public void mapZoomListener(MapEvent event) {
// onInit
if (!olMap.mapInstancied())
//onInit
if(!olMap.mapInstancied())
return;
setDragStart();
zoomStart = olMap.getCurrentZoomLevel();
GWT.log("zoomStart: " + zoomStart);
GWT.log("zoomStart: "+zoomStart);
}
@Override
public void mapZoomEndListener(MapEvent event) {
// onInit
if (!olMap.mapInstancied())
//onInit
//onInit
if(!olMap.mapInstancied())
return;
setDragStart();
zoomEnd = olMap.getCurrentZoomLevel();
GWT.log("zoomEnd: " + zoomEnd);
checkSelectQuery(MapEventType.MAP_ZOOM_END);
GWT.log("zoomEnd: "+zoomEnd);
checkSelectQuery();
}
};
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857);
// EPSG_4326_TO_ITALY
Coordinate centerCoordinate = OLFactory.createCoordinate(GeoportalDataViewerConstants.ITALY_CENTER_LONG,
GeoportalDataViewerConstants.ITALY_CENTER_LAT);
Coordinate transformedCenterCoordinate = MapUtils.transformCoordiante(centerCoordinate,
GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
olMap.setCenter(transformedCenterCoordinate);
olMap.setZoom(italyLocation.getZoomLevel());
olMap.setZoom(GeoportalDataViewerConstants.ITALY_FIT_ZOOM_ON);
}
/**
* To data point query.
*
* @param coordinate the coordinate
* @param manualClick the manual click
* @param coordinate the coordinate
* @return the geo query
*/
public GeoQuery toDataPointQuery(Coordinate coordinate, boolean manualClick) {
public GeoQuery toDataPointQuery(Coordinate coordinate) {
double lon = coordinate.getX();
double lat = coordinate.getY();
GWT.log("To quey DP: " + coordinate);
int w = (int) olMap.getSize().getWidth();
int h = (int) olMap.getSize().getHeight();
@ -158,47 +146,37 @@ public class OLMapManager {
// ratio - mapPixelWeight : bboxWeight = 20px : geoRectangleWidth
// where 10px is the pixel diameter dimension of the clicked point
double bboxWidth = Math.abs(olMap.getExtent().getLowerLeftX() - olMap.getExtent().getUpperRightX());
double geoWidth = 0;
// adding a tolerance in case of manual click
if (manualClick) {
// adding a tolerance for clicking
// geoWidth = (bboxWidth / w) * (14 / 2);
geoWidth = (bboxWidth / w) * (16 / 2);
} else {
// data point selection for coordinate loaded from the centroid
geoWidth = (bboxWidth / w) / 60;
GWT.log("geo width: "+geoWidth);
}
double geoWidth = (bboxWidth / w) * (20 / 2);
double x1 = Math.min(lon + geoWidth, lon - geoWidth);
double x2 = Math.max(lon + geoWidth, lon - geoWidth);
double y1 = Math.min(lat + geoWidth, lat - geoWidth);
double y2 = Math.max(lat + geoWidth, lat - geoWidth);
//GWT.log("("+x1+","+y1+")("+x2+","+y2+")");
// GWT.log("("+x1+","+y1+")("+x2+","+y2+")");
// Point pt = new Point(coordinate);
// ol.Extent extent = pt.getExtent();
// //new ClickDataInfo(x1, y1, x2, y2)
// SelectDataInfo selectDataInfo
// selectBox(new GeoQuery(x1, y1, x2, y2, GeoQuery.TYPE.POINT));
GeoQuery select = new GeoQuery(x1, y1, x2, y2, TYPE.POINT);
return select;
}
/**
* Gets the OL map.
* Gets the OLOSM map.
*
* @return the OL map
* @return the OLOSM map
*/
public OpenLayerMap getOLMap() {
public OpenLayerOSM getOLOSMMap() {
return olMap;
}
/**
* Check select query.
*
* @param mapEventType the map event type
*/
private void checkSelectQuery(MapEventType mapEventType) {
private void checkSelectQuery() {
GWT.log("Zoom is:" + olMap.getCurrentZoomLevel());
GWT.log("Resolution is:" + olMap.getCurrentResolution());
if (dragStartExtent != null && olMap.getCurrentZoomLevel() > QUERY_MIN_ZOOM_LEVEL) {
dragEndExtent = olMap.getExtent();
@ -213,12 +191,12 @@ public class OLMapManager {
GWT.log("the distance is: " + dist);
if (dist > 5000 || startExt.containsExtent(endExt)) {
GeoQuery select = toDataBoxQuery(dragEndExtent);
// TODO THE AUTOMATICALLY SHOWING POP-UP ACCORDING TO ZOOM IS BUGGY
layerManagerBus.fireEvent(new QueryDataEvent(select, endExt, null, false, mapEventType));
layerManagerBus.fireEvent(new QueryDataEvent(select, endExt.getCenter()));
}
} else if (zoomStart != null && zoomEnd != null) {
if (zoomEnd < QUERY_MIN_ZOOM_LEVEL) {
}
else if(zoomStart!=null && zoomEnd!=null) {
if(zoomEnd<QUERY_MIN_ZOOM_LEVEL) {
layerManagerBus.fireEvent(new ZoomOutOverMinimumEvent(zoomStart, zoomEnd, QUERY_MIN_ZOOM_LEVEL));
}
}
@ -234,7 +212,7 @@ public class OLMapManager {
GWT.log("Drag Start is: " + dragStartExtent);
}
}
/**
* To data point query.
*
@ -242,11 +220,11 @@ public class OLMapManager {
* @return the geo query
*/
private GeoQuery toDataBoxQuery(ol.Extent extent) {
return new GeoQuery(extent.getLowerLeftX(), extent.getLowerLeftY(), extent.getUpperRightX(),
extent.getUpperRightY(), TYPE.BOX);
return new GeoQuery(extent.getLowerLeftX(), extent.getLowerLeftY(), extent.getUpperRightX(), extent.getUpperRightY(), TYPE.BOX);
}
/**
* Checks if is query point active.
*
@ -262,5 +240,6 @@ public class OLMapManager {
public void hidePopInfo() {
olMap.hidePopup();
}
}

View File

@ -1,70 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client;
import java.util.ArrayList;
import java.util.HashMap;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd.DragDropLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
import com.github.gwtbootstrap.client.ui.Label;
import com.github.gwtbootstrap.client.ui.constants.LabelType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.ui.FlowPanel;
public class OverlayLayerManager {
// private ArrayList<LayerObject> layers = new ArrayList<LayerObject>();
// private FlowPanel fp = new FlowPanel();
private FlowPanel clusterCollectionsMainPanel = new FlowPanel();
private HashMap<String, ArrayList<DragDropLayer>> mapCollectionsPerProfileID = new HashMap<String, ArrayList<DragDropLayer>>();
private HashMap<String, FlowPanel> mapCollectionsContainersPerProfileID = new HashMap<String, FlowPanel>();
private HandlerManager applicationBus;
public OverlayLayerManager(HandlerManager applicationBus) {
this.applicationBus = applicationBus;
}
public void addLayerItem(LayerObject lo) {
GWT.log("Adding LayerObject having project: "+lo.getProjectDV());
GWT.log("Adding LayerObject having project id: "+lo.getProjectDV().getId());
ArrayList<DragDropLayer> listDDLayers = mapCollectionsPerProfileID.get(lo.getProfileID());
if (listDDLayers == null) {
String collectionName = lo.getProjectDV() != null && lo.getProjectDV().getProfileName() != null
? lo.getProjectDV().getProfileName()
: lo.getProfileID();
Label labelCollectionName = new Label(collectionName);
labelCollectionName.setType(LabelType.WARNING);
clusterCollectionsMainPanel.add(labelCollectionName);
listDDLayers = new ArrayList<DragDropLayer>();
}
FlowPanel fp = new FlowPanel();
fp.getElement().getStyle().setMarginLeft(10, Unit.PX);
DragDropLayer dandd = new DragDropLayer(applicationBus, lo, true, true);
listDDLayers.add(dandd);
fp.add(dandd);
mapCollectionsContainersPerProfileID.put(lo.getProfileID(), fp);
mapCollectionsPerProfileID.put(lo.getProfileID(), listDDLayers);
clusterCollectionsMainPanel.add(fp);
}
public void resetLayers() {
clusterCollectionsMainPanel.clear();
mapCollectionsContainersPerProfileID.clear();
mapCollectionsPerProfileID.clear();
}
public FlowPanel getPanel() {
return clusterCollectionsMainPanel;
}
}

View File

@ -1,18 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client;
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
public class ViewerStatus {
private ViewerConfiguration viewerConfig;
public void setConfig(ViewerConfiguration result) {
this.viewerConfig = result;
}
public ViewerConfiguration getViewerConfig() {
return viewerConfig;
}
}

View File

@ -1,69 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
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 AddLayerToMapEvent extends GwtEvent<AddLayerToMapEventHandler> {
public static Type<AddLayerToMapEventHandler> TYPE = new Type<AddLayerToMapEventHandler>();
private ProjectDV theProjectDV;
private boolean notifyClashing;
/**
* Instantiates a new adds the layer to map event.
*
* @param theProjectDV the the project DV
* @param notifyClashing the notify clashing
*/
public AddLayerToMapEvent(ProjectDV theProjectDV, boolean notifyClashing) {
this.theProjectDV = theProjectDV;
this.notifyClashing = notifyClashing;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<AddLayerToMapEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(AddLayerToMapEventHandler handler) {
handler.onAddingLayerForProject(this);
}
/**
* Gets the the project DV.
*
* @return the the project DV
*/
public ProjectDV getTheProjectDV() {
return theProjectDV;
}
/**
* Checks if is notify clashing.
*
* @return true, if is notify clashing
*/
public boolean isNotifyClashing() {
return notifyClashing;
}
}

View File

@ -1,21 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface AddLayerToMapEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 9, 2022
*/
public interface AddLayerToMapEventHandler extends EventHandler {
/**
* On adding layer for project.
*
* @param addLayerToMapEvent the add layer to map event
*/
void onAddingLayerForProject(AddLayerToMapEvent addLayerToMapEvent);
}

View File

@ -4,38 +4,26 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class AddedLayerToMapEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 18, 2020
* Nov 18, 2020
*/
public class AddedLayerToMapEvent extends GwtEvent<AddedLayerToMapEventHandler> {
public static Type<AddedLayerToMapEventHandler> TYPE = new Type<AddedLayerToMapEventHandler>();
private LayerItem layerItem;
private LAYER_TYPE layerType;
/**
* The Enum LAYER_TYPE.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 11, 2021
*/
public enum LAYER_TYPE {
BASE, OVERLAY
}
/**
* Instantiates a new added layer to map event.
*
* @param layerItem the layer item
* @param layerType the layer type
*/
public AddedLayerToMapEvent(LayerItem layerItem, LAYER_TYPE layerType) {
public AddedLayerToMapEvent(LayerItem layerItem) {
this.layerItem = layerItem;
this.layerType = layerType;
}
/**
@ -58,7 +46,7 @@ public class AddedLayerToMapEvent extends GwtEvent<AddedLayerToMapEventHandler>
handler.onLayerRendered(this);
}
/**
* Gets the layer item.
*
@ -67,14 +55,6 @@ public class AddedLayerToMapEvent extends GwtEvent<AddedLayerToMapEventHandler>
public LayerItem getLayerItem() {
return layerItem;
}
/**
* Gets the layer type.
*
* @return the layer type
*/
public LAYER_TYPE getLayerType() {
return layerType;
}
}

View File

@ -1,72 +0,0 @@
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

@ -1,20 +0,0 @@
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,57 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class ChangeMapLayerEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 12, 2021
*/
public class ChangeMapLayerEvent extends GwtEvent<ChangeMapLayerEventHandler> {
public static Type<ChangeMapLayerEventHandler> TYPE = new Type<ChangeMapLayerEventHandler>();
private BaseMapLayer baseMapLayer;
/**
* Instantiates a new change map layer event.
*
* @param baseMapLayer the base map layer
*/
public ChangeMapLayerEvent(BaseMapLayer baseMapLayer) {
this.baseMapLayer = baseMapLayer;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<ChangeMapLayerEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(ChangeMapLayerEventHandler handler) {
handler.onChangeBaseMapLayer(this);
}
/**
* Gets the base map layer.
*
* @return the base map layer
*/
public BaseMapLayer getBaseMapLayer() {
return baseMapLayer;
}
}

View File

@ -1,20 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface ChangeMapLayerEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 12, 2021
*/
public interface ChangeMapLayerEventHandler extends EventHandler {
/**
* On change base map layer.
*
* @param changeMapLayerEvent the change map layer event
*/
void onChangeBaseMapLayer(ChangeMapLayerEvent changeMapLayerEvent);
}

View File

@ -1,260 +0,0 @@
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;
/**
* The Class DoActionOnDetailLayersEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 12, 2021
*/
public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayersEventHandler> {
public static Type<DoActionOnDetailLayersEventHandler> TYPE = new Type<DoActionOnDetailLayersEventHandler>();
/**
* The Enum DO_LAYER_ACTION.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 12, 2021
*/
public static enum DO_LAYER_ACTION {
VISIBILITY, SWAP, OPACITY, LOCATE_LAYER
}
private DO_LAYER_ACTION doAction;
private LayerItem layerItem;
private double opacity;
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
*/
public static class SwapLayer {
private LayerItem layerItem;
private int position;
/**
* Instantiates a new swap layer.
*
* @param layerItem the layer item
* @param position the position
*/
public SwapLayer(LayerItem layerItem, int position) {
this.layerItem = layerItem;
this.position = position;
}
/**
* Gets the layer item.
*
* @return the layer item
*/
public LayerItem getLayerItem() {
return layerItem;
}
/**
* Gets the position.
*
* @return the position
*/
public int getPosition() {
return position;
}
}
/**
* Instantiates a new do action on detail layers event.
*
* @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, LayerObject layerObject) {
this.layerItem = layerItem;
this.layerObject = layerObject;
this.doAction = action;
}
/**
* Sets the swap layers.
*
* @param sourceLayerItem the source layer item
* @param targetLayerItem the target layer item
*/
public void setSwapLayers(SwapLayer sourceLayerItem, SwapLayer targetLayerItem) {
this.sourceLayerSwap = sourceLayerItem;
this.targetLayerSwap = targetLayerItem;
}
/**
* Sets the opacity.
*
* @param opacity the new opacity
*/
public void setOpacity(double opacity) {
this.opacity = opacity;
}
/**
* Sets the visibility.
*
* @param visibility the new visibility
*/
public void setVisibility(boolean visibility) {
this.visibility = visibility;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<DoActionOnDetailLayersEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(DoActionOnDetailLayersEventHandler handler) {
handler.onDoActionOnDetailLayers(this);
}
/**
* 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.
*
* @return the do action
*/
public DO_LAYER_ACTION getDoAction() {
return doAction;
}
/**
* Gets the layer item.
*
* @return the layer item
*/
public LayerItem getLayerItem() {
return layerItem;
}
/**
* Gets the source layer swap.
*
* @return the source layer swap
*/
public SwapLayer getSourceLayerSwap() {
return sourceLayerSwap;
}
/**
* Gets the target layer swap.
*
* @return the target layer swap
*/
public SwapLayer getTargetLayerSwap() {
return targetLayerSwap;
}
/**
* Gets the opacity.
*
* @return the opacity
*/
public double getOpacity() {
return opacity;
}
/**
* Gets the visibility.
*
* @return the visibility
*/
public boolean getVisibility() {
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.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("DoActionOnDetailLayersEvent [doAction=");
builder.append(doAction);
builder.append(", layerItem=");
builder.append(layerItem);
builder.append(", opacity=");
builder.append(opacity);
builder.append(", visibility=");
builder.append(visibility);
builder.append(", sourceLayerSwap=");
builder.append(sourceLayerSwap);
builder.append(", targetLayerSwap=");
builder.append(targetLayerSwap);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,21 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface DoActionOnDetailLayersEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 8, 2021
*/
public interface DoActionOnDetailLayersEventHandler extends EventHandler {
/**
* On do action on detail layers.
*
* @param doActionOnDetailLayersEvent the do action on detail layers event
*/
void onDoActionOnDetailLayers(DoActionOnDetailLayersEvent doActionOnDetailLayersEvent);
}

View File

@ -1,52 +0,0 @@
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

@ -1,20 +0,0 @@
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

@ -1,83 +0,0 @@
//package org.gcube.portlets.user.geoportaldataviewer.client.events;
//
//import org.gcube.application.geoportalcommon.shared.SearchingFilter;
//import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.RECORD_TYPE;
//
//import com.google.gwt.event.shared.GwtEvent;
//
///**
// * The Class GetListOfRecordsEvent.
// *
// * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
// *
// * Dec 7, 2021
// */
//public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler> {
//
// /** The type. */
// public static Type<GetListOfRecordsEventHandler> TYPE = new Type<GetListOfRecordsEventHandler>();
// private RECORD_TYPE recordType;
// private SearchingFilter sortFilter;
//
// /**
// * Instantiates a new cancel upload event.
// *
// * @param recordType the record type
// * @param sortFilter the sort filter
// */
// public GetListOfRecordsEvent(RECORD_TYPE recordType, SearchingFilter sortFilter) {
// this.recordType = recordType;
// this.sortFilter = sortFilter;
// }
//
// /**
// * Gets the associated type.
// *
// * @return the associated type
// */
// /*
// * (non-Javadoc)
// *
// * @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
// */
// @Override
// public Type<GetListOfRecordsEventHandler> getAssociatedType() {
// return TYPE;
// }
//
// /**
// * Dispatch.
// *
// * @param handler the handler
// */
// /*
// * (non-Javadoc)
// *
// * @see
// * com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
// * EventHandler)
// */
// @Override
// protected void dispatch(GetListOfRecordsEventHandler handler) {
// handler.onGetList(this);
// }
//
// /**
// * Gets the record type.
// *
// * @return the record type
// */
// public RECORD_TYPE getRecordType() {
// return recordType;
// }
//
// /**
// * Gets the sort filter.
// *
// * @return the sort filter
// */
// public SearchingFilter getSortFilter() {
// return sortFilter;
// }
//
//}

View File

@ -1,22 +0,0 @@
//package org.gcube.portlets.user.geoportaldataviewer.client.events;
//
//import com.google.gwt.event.shared.EventHandler;
//
//
///**
// * The Interface GetListOfRecordsEventHandler.
// *
// * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
// *
// * Aug 4, 2021
// */
//public interface GetListOfRecordsEventHandler extends EventHandler {
//
//
// /**
// * On get list.
// *
// * @param getListOfRecordsEvent the get list of records event
// */
// void onGetList(GetListOfRecordsEvent getListOfRecordsEvent);
//}

View File

@ -1,52 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class MapExtentToEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Sep 1, 2021
*/
public class MapExtentToEvent extends GwtEvent<MapExtentToEventHandler> {
public static Type<MapExtentToEventHandler> TYPE = new Type<MapExtentToEventHandler>();
private Location location;
/**
* Instantiates a new map extent to event.
*
* @param layerItem the layer item
*/
public MapExtentToEvent(Location location) {
this.location = location;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<MapExtentToEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(MapExtentToEventHandler handler) {
handler.onExtentEvent(this);
}
public Location getLocation() {
return location;
}
}

View File

@ -1,20 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface MapExtentToEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Sep 1, 2021
*/
public interface MapExtentToEventHandler extends EventHandler {
/**
* On extent event.
*
* @param mapExtentToEvent the map extent to event
*/
void onExtentEvent(MapExtentToEvent mapExtentToEvent);
}

View File

@ -1,92 +0,0 @@
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

@ -1,20 +0,0 @@
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

@ -1,42 +1,31 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
import com.google.gwt.event.shared.GwtEvent;
import ol.Coordinate;
/**
* The Class QueryDataEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Aug 31, 2021
* Oct 29, 2020
*/
public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
public static Type<QueryDataEventHandler> TYPE = new Type<QueryDataEventHandler>();
private GeoQuery select;
private ExtentWrapped queryClickExtent;
private String productID;
private boolean onInit;
private MapEventType sourceMapEventType;
private Coordinate oLCoordinate;
/**
* Instantiates a new query data event.
*
* @param select the select
* @param onFailureCenterTo the on failure center to
* @param productID the mongo item id
* @param onInit the on init
* @param mapEventType the map event type
* Instantiates a new table row selected event.
* @param coordinate
*/
public QueryDataEvent(GeoQuery select, ExtentWrapped queryClickExtent, String productID, boolean onInit,
MapEventType mapEventType) {
public QueryDataEvent(GeoQuery select, Coordinate coordinate) {
this.select = select;
this.queryClickExtent = queryClickExtent;
this.productID = productID;
this.onInit = onInit;
this.sourceMapEventType = mapEventType;
this.oLCoordinate = coordinate;
}
/**
@ -49,19 +38,6 @@ public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
return TYPE;
}
public String getProductID() {
return productID;
}
/**
* Checks if is on init.
*
* @return true, if is on init
*/
public boolean isOnInit() {
return onInit;
}
/**
* Dispatch.
*
@ -72,44 +48,12 @@ public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
handler.onQueryInteraction(this);
}
/**
* Gets the geo query.
*
* @return the geo query
*/
public GeoQuery getGeoQuery() {
return select;
}
public ExtentWrapped getQueryClickExtent() {
return queryClickExtent;
public Coordinate getoLCoordinate() {
return oLCoordinate;
}
/**
* Gets the source map event type.
*
* @return the source map event type
*/
public MapEventType getSourceMapEventType() {
return sourceMapEventType;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("QueryDataEvent [select=");
builder.append(select);
builder.append(", queryClickExtent=");
builder.append(queryClickExtent);
builder.append(", productID=");
builder.append(productID);
builder.append(", onInit=");
builder.append(onInit);
builder.append(", sourceMapEventType=");
builder.append(sourceMapEventType);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,81 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import java.util.List;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class SearchPerformedEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Dec 14, 2021
*/
public class SearchPerformedEvent extends GwtEvent<SearchPerformedEventHandler> {
public static Type<SearchPerformedEventHandler> TYPE = new Type<SearchPerformedEventHandler>();
private List<String> listProjectIDs;
private boolean searchReset;
private String profileID;
/**
* Instantiates a new search performed event.
*
* @param profileID the profile ID
* @param listProjectIds the list project ids
* @param searchReset the search reset
*/
public SearchPerformedEvent(String profileID, List<String> listProjectIds, boolean searchReset) {
this.profileID = profileID;
this.listProjectIDs = listProjectIds;
this.searchReset = searchReset;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<SearchPerformedEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(SearchPerformedEventHandler handler) {
handler.onSearchDone(this);
}
/**
* Gets the profile ID. It is equal to collectionID
*
* @return the profile ID
*/
public String getProfileID() {
return profileID;
}
/**
* Gets the list project Ids.
*
* @return the list project Ids
*/
public List<String> getListProjectIDs() {
return listProjectIDs;
}
/**
* Checks if is search reset.
*
* @return true, if is search reset
*/
public boolean isSearchReset() {
return searchReset;
}
}

View File

@ -1,20 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface SearchPerformedEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Dec 14, 2021
*/
public interface SearchPerformedEventHandler extends EventHandler {
/**
* On search done.
*
* @param searchPerformedEvent the search performed event
*/
void onSearchDone(SearchPerformedEvent searchPerformedEvent);
}

View File

@ -1,138 +1,55 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaItemRef;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class ShowDetailsEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 14, 2022
* Nov 13, 2020
*/
public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
public static Type<ShowDetailsEventHandler> TYPE = new Type<ShowDetailsEventHandler>();
private String layerObjectType;
private String geonaItemType;
private FeatureRow featureRow;
private Long geonaID;
private String itemName;
private String profileID;
private String projectID;
private boolean loadTimelineRelationships;
private boolean isEventFromTimeline;
private EVENT_SOURCE sourceEvent;
/**
* The Enum EVENT_SOURCE.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Dec 22, 2022
*/
public static enum EVENT_SOURCE {
LOCATE_ON_INIT, OPEN_DETAILS, OPEN_PROJECTS, LOCATE_SEARCHED, LOCATE_FROM_TIMELINE, GO_TO_LAYERS
}
/**
* Instantiates a new show details event.
*
* @param layerObjectType the layer object type
* @param profileID the profile ID
* @param projectID the project ID
* @param featureRow the feature row
* @param loadTimelineRelationships the load timeline relationships
* @param sourceEvent the source event
* @param geonaItemType the geona item type
* @param geonaID the geona ID
* @param itemName the item name
* @param featureRow the feature row
*/
public ShowDetailsEvent(String layerObjectType, String profileID, String projectID, FeatureRow featureRow,
boolean loadTimelineRelationships, EVENT_SOURCE sourceEvent) {
this.layerObjectType = layerObjectType;
this.profileID = profileID;
this.projectID = projectID;
public ShowDetailsEvent(String geonaItemType, Long geonaID, String itemName, FeatureRow featureRow) {
this.geonaItemType = geonaItemType;
this.geonaID = geonaID;
this.itemName = itemName;
this.featureRow = featureRow;
this.loadTimelineRelationships = loadTimelineRelationships;
this.sourceEvent = sourceEvent;
}
/**
* Instantiates a new show details event.
*
* @param gir the gir
* @param featureRow the feature row
* @param loadTimelineRelationships the load timeline relationships
* @param sourceEvent the source event
* @param gir the gir
* @param itemName the item name
* @param featureRow the feature row
*/
public ShowDetailsEvent(GeoportalItemReferences gir, FeatureRow featureRow, boolean loadTimelineRelationships,
boolean goToLayers, EVENT_SOURCE sourceEvent) {
this.layerObjectType = gir.getLayerObjectType();
this.profileID = gir.getProfileID();
this.projectID = gir.getProjectID();
public ShowDetailsEvent(GeoNaItemRef gir, String itemName, FeatureRow featureRow) {
this.geonaItemType = gir.getItemType();
this.geonaID = gir.getItemId();
this.itemName = itemName;
this.featureRow = featureRow;
this.loadTimelineRelationships = loadTimelineRelationships;
this.sourceEvent = sourceEvent;
}
/**
* Event from timeline.
*
* @param bool the bool
*/
public void setEventFromTimeline(boolean bool) {
this.isEventFromTimeline = bool;
}
/**
* Checks if is event from timeline.
*
* @return true, if is event from timeline
*/
public boolean isEventFromTimeline() {
return isEventFromTimeline;
}
/**
* Gets the source event.
*
* @return the source event
*/
public EVENT_SOURCE getSourceEvent() {
return sourceEvent;
}
/**
* Gets the type.
*
* @return the type
*/
public static Type<ShowDetailsEventHandler> getTYPE() {
return TYPE;
}
/**
* Gets the layer object type.
*
* @return the layer object type
*/
public String getLayerObjectType() {
return layerObjectType;
}
/**
* Gets the profile ID.
*
* @return the profile ID
*/
public String getProfileID() {
return profileID;
}
/**
* Gets the project ID.
*
* @return the project ID
*/
public String getProjectID() {
return projectID;
}
/**
@ -156,6 +73,15 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
}
/**
* Gets the geona item type.
*
* @return the geona item type
*/
public String getGeonaItemType() {
return geonaItemType;
}
/**
* Gets the feature row.
*
@ -166,44 +92,43 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
}
/**
* Checks if is load timeline relationships.
* Gets the geona ID.
*
* @return true, if is load timeline relationships
* @return the geona ID
*/
public boolean isLoadTimelineRelationships() {
return loadTimelineRelationships;
public Long getGeonaID() {
return geonaID;
}
/**
* Gets the item name.
*
* @return the item name
*/
public String getItemName() {
return itemName;
}
/**
* Sets the item name.
*
* @param itemName the new item name
*/
public void setItemName(String itemName) {
this.itemName = itemName;
}
/**
* Gets the geona item ref.
*
* @return the geona item ref
*/
public GeoportalItemReferences getGeonaItemRef() {
return new GeoportalItemReferences(projectID, profileID, layerObjectType);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ShowDetailsEvent [layerObjectType=");
builder.append(layerObjectType);
builder.append(", featureRow=");
builder.append(featureRow);
builder.append(", itemName=");
builder.append(itemName);
builder.append(", profileID=");
builder.append(profileID);
builder.append(", projectID=");
builder.append(projectID);
builder.append(", loadTimelineRelationships=");
builder.append(loadTimelineRelationships);
builder.append(", isEventFromTimeline=");
builder.append(isEventFromTimeline);
builder.append(", sourceEvent=");
builder.append(sourceEvent);
builder.append("]");
return builder.toString();
public GeoNaItemRef getGeonaItemRef() {
return new GeoNaItemRef(geonaID, geonaItemType);
}
}

View File

@ -1,122 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class ShowPopupOnCentroidEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jan 12, 2023
*/
public class ShowPopupOnCentroidEvent extends GwtEvent<ShowPopupOnCentroidEventHandler> {
public static Type<ShowPopupOnCentroidEventHandler> TYPE = new Type<ShowPopupOnCentroidEventHandler>();
private String profileID;
private String projectID;
private GeoJSON spatialReference;
private ProjectView projectView;
/**
* Instantiates a new show popup on centroid event.
*
* @param profileID the profile ID
* @param projectID the project ID
* @param spatialReference the spatial reference
*/
public ShowPopupOnCentroidEvent(String profileID, String projectID, GeoJSON spatialReference) {
this.profileID = profileID;
this.projectID = projectID;
this.spatialReference = spatialReference;
}
/**
* Instantiates a new show popup on centroid event.
*
* @param projectView the project view
*/
public ShowPopupOnCentroidEvent(ProjectView projectView) {
this.projectView = projectView;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<ShowPopupOnCentroidEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(ShowPopupOnCentroidEventHandler handler) {
handler.onShowPopup(this);
}
/**
* Gets the profile ID.
*
* @return the profile ID
*/
public String getProfileID() {
return profileID;
}
/**
* Gets the project ID.
*
* @return the project ID
*/
public String getProjectID() {
return projectID;
}
/**
* Gets the spatial reference.
*
* @return the spatial reference
*/
public GeoJSON getSpatialReference() {
return spatialReference;
}
/**
* Gets the project view.
*
* @return the project view
*/
public ProjectView getProjectView() {
return projectView;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ShowPopupOnCentroidEvent [profileID=");
builder.append(profileID);
builder.append(", projectID=");
builder.append(projectID);
builder.append(", spatialReference=");
builder.append(spatialReference);
builder.append(", projectView=");
builder.append(projectView);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,20 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface ShowPopupOnCentroidEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jan 12, 2023
*/
public interface ShowPopupOnCentroidEventHandler extends EventHandler {
/**
* On show popup.
*
* @param showPopupOnCentroiEvent the show popup on centroi event
*/
void onShowPopup(ShowPopupOnCentroidEvent showPopupOnCentroiEvent);
}

View File

@ -1,80 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class TimelineProjectRelationsEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 3, 2022
*/
public class TimelineProjectRelationsEvent extends GwtEvent<TimelineProjectRelationsEventHandler> {
public static Type<TimelineProjectRelationsEventHandler> TYPE = new Type<TimelineProjectRelationsEventHandler>();
private EVENT_TYPE eventType = EVENT_TYPE.HIDE; //default
private ProjectDV theProjectDV;
/**
* The Enum EVENT_TYPE.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 3, 2022
*/
public enum EVENT_TYPE {
SHOW, HIDE
}
/**
* Instantiates a new timeline project relations event.
*
* @param theProjectDV the the project DV
* @param eventType the event type
*/
public TimelineProjectRelationsEvent(ProjectDV theProjectDV, EVENT_TYPE eventType) {
this.theProjectDV = theProjectDV;
this.eventType = eventType;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<TimelineProjectRelationsEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(TimelineProjectRelationsEventHandler handler) {
handler.onTimelineRelationEvent(this);
}
/**
* Gets the event type.
*
* @return the event type
*/
public EVENT_TYPE getEventType() {
return eventType;
}
/**
* Gets the the project DV.
*
* @return the the project DV
*/
public ProjectDV getTheProjectDV() {
return theProjectDV;
}
}

View File

@ -1,20 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface TimelineProjectRelationsEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 3, 2022
*/
public interface TimelineProjectRelationsEventHandler extends EventHandler {
/**
* On timeline relation event.
*
* @param timelineProjectRelationsEvent the timeline project relations event
*/
void onTimelineRelationEvent(TimelineProjectRelationsEvent timelineProjectRelationsEvent);
}

View File

@ -1,134 +0,0 @@
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

@ -1,20 +0,0 @@
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

@ -1,30 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events.collections;
import com.google.gwt.event.shared.GwtEvent;
public class CloseCollectionEvent extends GwtEvent<CloseCollectionEventHandler> {
private String collectionId = null;
public static Type<CloseCollectionEventHandler> TYPE = new Type<CloseCollectionEventHandler>();
@Override
public Type<CloseCollectionEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(CloseCollectionEventHandler handler) {
handler.onCloseCollection(this);
}
public CloseCollectionEvent(String collectionId) {
this.collectionId=collectionId;
}
public String getCollectionId() {
return collectionId;
}
}

View File

@ -1,9 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events.collections;
import com.google.gwt.event.shared.EventHandler;
public interface CloseCollectionEventHandler extends EventHandler{
void onCloseCollection(CloseCollectionEvent closeCollectionEvent);
}

View File

@ -1,40 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events.collections;
import com.google.gwt.event.shared.GwtEvent;
public class OpenCollectionEvent extends GwtEvent<OpenCollectionEventHandler> {
private String collectionId = null;
public static Type<OpenCollectionEventHandler> TYPE = new Type<OpenCollectionEventHandler>();
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<OpenCollectionEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(OpenCollectionEventHandler handler) {
handler.onOpenCollection(this);
}
public OpenCollectionEvent(String collectionId) {
this.collectionId = collectionId;
}
public String getCollectionId() {
return collectionId;
}
}

View File

@ -1,10 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events.collections;
import com.google.gwt.event.shared.EventHandler;
public interface OpenCollectionEventHandler extends EventHandler {
void onOpenCollection(OpenCollectionEvent event);
}

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

@ -1,52 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
import java.util.HashMap;
/**
* The Class LayerOrder.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 12, 2021
*/
public class LayerOrder {
/**
* The Enum LAYER_TYPE.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 12, 2021
*/
public static enum LAYER_TYPE {
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); //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.
}
/**
* Instantiates a new layer order.
*/
public LayerOrder() {
}
/**
* Gets the offset.
*
* @param layerType the layer type
* @return the offset
*/
public Integer getOffset(LAYER_TYPE layerType) {
return LAYER_OFFSET.get(layerType);
}
}

View File

@ -1,496 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.NumberFormat;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.JSONValue;
import ol.Collection;
import ol.Coordinate;
import ol.Feature;
import ol.Map;
import ol.MapBrowserEvent;
import ol.MapOptions;
import ol.OLFactory;
import ol.View;
import ol.ViewOptions;
import ol.color.Color;
import ol.control.Attribution;
import ol.event.EventListener;
import ol.geom.Point;
import ol.interaction.KeyboardPan;
import ol.interaction.KeyboardZoom;
import ol.layer.Base;
import ol.layer.Image;
import ol.layer.Layer;
import ol.layer.LayerOptions;
import ol.layer.Tile;
import ol.layer.VectorLayerOptions;
import ol.proj.Projection;
import ol.proj.ProjectionOptions;
import ol.source.ImageWms;
import ol.source.ImageWmsOptions;
import ol.source.ImageWmsParams;
import ol.source.Osm;
import ol.source.Source;
import ol.source.Xyz;
import ol.source.XyzOptions;
import ol.style.Fill;
import ol.style.FillOptions;
import ol.style.Icon;
import ol.style.IconOptions;
import ol.style.Stroke;
import ol.style.StrokeOptions;
import ol.style.Style;
import ol.style.Text;
import ol.style.TextOptions;
/**
* The Class LightOpenLayerMap.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 12, 2021
*/
public class LightOpenLayerMap {
public static final int MAX_ZOOM = 20;
/** The map. */
private Map map;
/** The view. */
private View view;
/** The view options. */
private ViewOptions viewOptions = OLFactory.createOptions();
/** The projection options. */
private ProjectionOptions projectionOptions = OLFactory.createOptions();
private boolean isQueryPointActive;
private ol.layer.Vector geometryLayer;
private String markerURL = GNAImages.ICONS.mapMarkerIcon().getURL();
private LayerOrder layerOrder = new LayerOrder();
private Layer baseLayerTile;
/**
* Instantiates a new light open layer map.
*
* @param divTargetId the div target id
*/
public LightOpenLayerMap(String divTargetId) {
// create a projection
projectionOptions.setCode(MAP_PROJECTION.EPSG_3857.getName());
projectionOptions.setUnits("m");
Projection projection = new Projection(projectionOptions);
viewOptions.setProjection(projection);
viewOptions.setMaxZoom(20);
// create a view
view = new View(viewOptions);
// create the map
MapOptions mapOptions = OLFactory.createOptions();
mapOptions.setTarget(divTargetId);
mapOptions.setView(view);
map = new Map(mapOptions);
//map.addLayer(osmLayer);
// map.addLayer(tileDebugLayer);
Attribution attribution = new Attribution();
attribution.setCollapsed(true);
map.addClickListener(new EventListener<MapBrowserEvent>() {
@Override
public void onEvent(MapBrowserEvent event) {
// TODO Auto-generated method stub
Coordinate coordinate = event.getCoordinate();
if (isQueryPointActive) {
double lon = coordinate.getX();
double lat = coordinate.getY();
int w = (int) map.getSize().getWidth();
int h = (int) map.getSize().getHeight();
// handler.clickOnMap(x, y, w, h);
// ratio - mapPixelWeight : bboxWeight = 10px : geoRectangleWidth
// where 10px is the pixel diameter dimension of the clicked point
double bboxWidth = Math.abs(getExtent().getLowerLeftX() - getExtent().getUpperRightX());
double geoWidth = (bboxWidth / w) * (20 / 2);
double x1 = Math.min(lon + geoWidth, lon - geoWidth);
double x2 = Math.max(lon + geoWidth, lon - geoWidth);
double y1 = Math.min(lat + geoWidth, lat - geoWidth);
double y2 = Math.max(lat + geoWidth, lat - geoWidth);
// GWT.log("("+x1+","+y1+")("+x2+","+y2+")");
// Point pt = new Point(coordinate);
// ol.Extent extent = pt.getExtent();
// //new ClickDataInfo(x1, y1, x2, y2)
// SelectDataInfo selectDataInfo
// selectBox(new GeoQuery(x1, y1, x2, y2, GeoQuery.TYPE.POINT));
GeoQuery select = new GeoQuery(x1, y1, x2, y2, TYPE.POINT);
}
}
});
map.addControl(attribution);
// add some interactions
map.addInteraction(new KeyboardPan());
map.addInteraction(new KeyboardZoom());
List<BaseMapLayer> listBaseMapLayers = GeoportalDataViewer.getListBaseMapLayers();
BaseMapLayer bml = null;
if(listBaseMapLayers!=null)
bml = listBaseMapLayers.get(0);
changeBaseMap(bml);
}
/**
* Change base map.
*
* @param baseLayer the base layer
*/
public void changeBaseMap(BaseMapLayer baseLayer) {
BaseMapLayer.OL_BASE_MAP baseMap = baseLayer.getType() == null ? BaseMapLayer.OL_BASE_MAP.OSM
: baseLayer.getType();
try {
if (baseLayerTile != null)
map.removeLayer(baseLayerTile);
} catch (Exception e) {
}
switch (baseMap) {
case MAPBOX:
case OTHER:
XyzOptions xyzOptions2 = OLFactory.createOptions();
xyzOptions2.setCrossOrigin("Anonymous");
Xyz xyz = new Xyz(xyzOptions2);
//setAttributions is buggy
//xyz.setAttributions(baseLayer.getAttribution());
xyz.setUrl(baseLayer.getUrl());
LayerOptions layerOptions2 = OLFactory.createOptions();
layerOptions2.setSource(xyz);
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.BASE_MAP)+1;
layerOptions2.setZIndex(zIndex);
baseLayerTile = new Tile(layerOptions2);
break;
case OSM:
default:
XyzOptions osmSourceOptions = OLFactory.createOptions();
osmSourceOptions.setCrossOrigin("Anonymous");
Osm osmSource = new Osm(osmSourceOptions);
//osmSource.setUrl(baseLayer.getUrl());
//setAttributions is buggy
//osmSource.setAttributions(baseLayer.getAttribution());
LayerOptions layerOptions = OLFactory.createOptions();
layerOptions.setSource(osmSource);
zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.BASE_MAP)+1;
layerOptions.setZIndex(zIndex);
baseLayerTile = new Tile(layerOptions);
break;
}
// map == null at init time
if (map != null) {
map.addLayer(baseLayerTile);
}
}
/**
* Sets the center.
*
* @param centerCoordinate the new center
*/
public void setCenter(Coordinate centerCoordinate) {
view.setCenter(centerCoordinate);
}
/**
* Sets the center.
*
* @param zoom the new zoom
*/
public void setZoom(int zoom) {
view.setZoom(zoom);
}
/**
* Adds the WMS layer.
*
* @param mapServerHost the map server host
* @param layerName the layer name
* @param bbox the bbox
* @return the image
*/
public Image addWMSLayer(String mapServerHost, String layerName, BoundsMap bbox) {
GWT.log("Adding wmsLayer with mapServerHost: " + mapServerHost + ", layerName: " + layerName);
ImageWmsParams imageWMSParams = OLFactory.createOptions();
imageWMSParams.setLayers(layerName);
// imageWMSParams.setSize(new Size(400,400));
// imageWMSParams.setVersion("1.1.0");
// if(bbox!=null)
// imageWMSParams.set("BBOX", bbox.getLowerLeftX()+","+bbox.getLowerLeftY()+","+bbox.getUpperRightX()+","+bbox.getUpperRightY());
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
imageWMSOptions.setCrossOrigin("Anonymous");
imageWMSOptions.setUrl(mapServerHost);
imageWMSOptions.setParams(imageWMSParams);
// imageWMSOptions.setRatio(1.5f);
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
LayerOptions layerOptions = OLFactory.createOptions();
layerOptions.setSource(imageWMSSource);
ol.layer.Image wmsLayer = new ol.layer.Image(layerOptions);
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.WMS_DETAIL)+1;
wmsLayer.setZIndex(zIndex);
// visibleLayerItems
map.addLayer(wmsLayer);
return wmsLayer;
}
/**
* Gets the first layer.
*
* @return the first layer
*/
public Image getFirstLayer() {
if (map.getLayers() != null) {
return (Image) map.getLayers().getArray()[0];
}
return null;
}
/**
* Gets the layers.
*
* @return the layers
*/
public List<String> getLayers() {
Collection<Base> layers = map.getLayers();
List<String> layerNames = null;
if (layers != null) {
Base[] layersArr = layers.getArray();
layerNames = new ArrayList<String>(layersArr.length);
for (int i = 0; i < layersArr.length; i++) {
Base layer = layersArr[i];
if (layer instanceof Image) {
Image layerImage = (Image) layer;
Source source = layerImage.getSource();
// GWT.log("source: "+source.toString());
GeoportalDataViewerConstants.printJsObj(source);
String sorceRootObj = GeoportalDataViewerConstants.toJsonObj(source);
JSONValue jsonObj = JSONParser.parseStrict(sorceRootObj);
// GWT.log("jsonObj: " + jsonObj.toString());
JSONObject jsonSourceObj = (JSONObject) jsonObj;
JSONObject jsonParamsObj = (JSONObject) jsonSourceObj.get("params_");
// GWT.log("jsonParamsObj is: "+jsonParamsObj);
JSONValue jsonLayers = jsonParamsObj.get("LAYERS");
GWT.log("theLayerName name is: " + jsonLayers);
layerNames.add(jsonLayers.toString());
}
}
}
return layerNames;
}
/**
* Gets the layer UR ls property.
*
* @return the layer UR ls property
*/
public java.util.Map<String, String> getLayerURLsProperty() {
Collection<Base> layers = map.getLayerGroup().getLayers();
java.util.Map<String, String> mapLayerNameURL = new HashMap<String, String>();
if (layers != null) {
Base[] layersArr = layers.getArray();
for (int i = 0; i < layersArr.length; i++) {
Base layer = layersArr[i];
// GeoportalDataViewerConstants.printJs(layer.toString());
if (layer instanceof Image) {
Image layerImage = (Image) layer;
Source source = layerImage.getSource();
// GWT.log("source: "+source.toString());
// GeoportalDataViewerConstants.printJsObj(source);
String sorceRootObj = GeoportalDataViewerConstants.toJsonObj(source);
JSONValue jsonObj = JSONParser.parseStrict(sorceRootObj);
// GWT.log("jsonObj: " + jsonObj.toString());
JSONObject jsonSourceObj = (JSONObject) jsonObj;
JSONObject jsonParamsObj = (JSONObject) jsonSourceObj.get("params_");
// GWT.log("jsonParamsObj is: "+jsonParamsObj);
JSONString jsonLayers = (JSONString) jsonParamsObj.get("LAYERS");
String layerName = jsonLayers.stringValue();
GWT.log("jsonLayers is: " + layerName);
// GWT.log("theLayerName name is: " + jsonLayers);
JSONValue jsonImage = jsonSourceObj.get("image_");
// GWT.log("jsonImage: " + jsonImage.toString());
JSONObject jsonImageObj = (JSONObject) jsonImage;
JSONString jsonSrc = (JSONString) jsonImageObj.get("src_");
String layerURL = jsonSrc.stringValue();
GWT.log("jsonSrc: " + layerURL);
mapLayerNameURL.put(layerName, layerURL);
}
}
}
GWT.log("returning mapLayerNameURL: " + mapLayerNameURL);
return mapLayerNameURL;
}
/**
* Adds the point.
*
* @param coordinate the coordinate
* @param showCoordinateText the show coordinate text
* @param asMarker the as marker
*/
public void addPoint(Coordinate coordinate, boolean showCoordinateText, boolean asMarker) {
if (geometryLayer != null) {
map.removeLayer(geometryLayer);
} else {
}
Style style = new Style();
if (asMarker) {
IconOptions iconOptions = new IconOptions();
iconOptions.setSrc(markerURL);
Icon icon = new Icon(iconOptions);
style.setImage(icon);
}
if (showCoordinateText) {
TextOptions textOptions = new TextOptions();
textOptions.setOffsetY(-25);
StrokeOptions strokeOptions = new StrokeOptions();
strokeOptions.setColor(new Color(255, 255, 255, 1.0));
strokeOptions.setWidth(4);
Stroke stroke = new Stroke(strokeOptions);
stroke.setWidth(5);
textOptions.setStroke(stroke);
FillOptions fillOptions = new FillOptions();
fillOptions.setColor(new Color(0, 0, 255, 1.0));
textOptions.setFill(new Fill(fillOptions));
Coordinate transfCoord = MapUtils.transformCoordiante(coordinate, MAP_PROJECTION.EPSG_3857.getName(),
MAP_PROJECTION.EPSG_4326.getName());
// DecimalFormat df = new DecimalFormat("#.####");
NumberFormat fmt = NumberFormat.getFormat("#.####");
textOptions.setText("Long: " + fmt.format(transfCoord.getX()) + ", Lat: " + fmt.format(transfCoord.getY()));
Text text = new Text(textOptions);
// FillOptions fillOptions = new FillOptions();
// Color color = new Color(217, 217, 223, 0.0);
// fillOptions.setColor(color);
// Fill fill = new Fill(fillOptions);
// style.setFill(fill);
style.setText(text);
}
Point thePoint = new Point(coordinate);
Feature vf = new Feature(thePoint);
vf.setStyle(style);
ol.source.Vector vector = new ol.source.Vector();
vector.addFeature(vf);
VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
vectorLayerOptions.setSource(vector);
geometryLayer = new ol.layer.Vector(vectorLayerOptions);
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.VECTOR)+1;
geometryLayer.setZIndex(zIndex);
map.addLayer(geometryLayer);
}
/**
* Gets the map.
*
* @return the map
*/
public Map getMap() {
return map;
}
/**
* Gets the projection code.
*
* @return the projection code
*/
public String getProjectionCode() {
return map.getView().getProjection().getCode();
}
/**
* Gets the current zoom level.
*
* @return the current zoom level
*/
public double getCurrentZoomLevel() {
return map.getView().getZoom();
}
/**
* Gets the bbox.
*
* @return the bbox
*/
public ol.Extent getBBOX() {
return getExtent();
}
/**
* Gets the extent.
*
* @return the extent
*/
public ol.Extent getExtent() {
return this.map.getView().calculateExtent(map.getSize());
}
}

View File

@ -0,0 +1,338 @@
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.resources.Images;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE;
import com.google.gwt.core.client.GWT;
import ol.Coordinate;
import ol.Feature;
import ol.Map;
import ol.MapBrowserEvent;
import ol.MapOptions;
import ol.OLFactory;
import ol.View;
import ol.ViewOptions;
import ol.control.Attribution;
import ol.event.EventListener;
import ol.geom.Point;
import ol.interaction.KeyboardPan;
import ol.interaction.KeyboardZoom;
import ol.layer.Image;
import ol.layer.LayerOptions;
import ol.layer.Tile;
import ol.layer.VectorLayerOptions;
import ol.proj.Projection;
import ol.proj.ProjectionOptions;
import ol.source.ImageWms;
import ol.source.ImageWmsOptions;
import ol.source.ImageWmsParams;
import ol.source.Osm;
import ol.source.XyzOptions;
import ol.style.Icon;
import ol.style.IconOptions;
import ol.style.Style;
import ol.style.Text;
import ol.style.TextOptions;
/**
* The Class LightOpenLayerOSM.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 11, 2020
*/
public class LightOpenLayerOSM {
/** The map. */
private Map map;
/** The view. */
private View view;
/** The view options. */
private ViewOptions viewOptions = OLFactory.createOptions();
/** The projection options. */
private ProjectionOptions projectionOptions = OLFactory.createOptions();
private boolean isQueryPointActive;
private ol.layer.Vector geometryLayer;
private String markerURL = Images.ICONS.mapMarkerIcon().getURL();
/**
* Instantiates a new open layer OSM.
*
* @param divTargetId the div target id
*/
/* (non-Javadoc)
* @see de.desjardins.ol3.demo.client.example.Example#show()
*/
public LightOpenLayerOSM(String divTargetId) {
// create a OSM-layer
XyzOptions osmSourceOptions = OLFactory.createOptions();
Osm osmSource = new Osm(osmSourceOptions);
LayerOptions osmLayerOptions = OLFactory.createOptions();
osmLayerOptions.setSource(osmSource);
Tile osmLayer = new Tile(osmLayerOptions);
// create a projection
projectionOptions.setCode(GeoportalDataViewerConstants.EPSG_3857);
projectionOptions.setUnits("m");
Projection projection = new Projection(projectionOptions);
viewOptions.setProjection(projection);
viewOptions.setMaxZoom(19);
//viewOptions.setExtent(new Extent(-180, -90, 180, 90));
// create a view
view = new View(viewOptions);
// //EPSG_4326_TO_ITALY
// Coordinate centerCoordinate = OLFactory.createCoordinate(12.45, 42.98);
// Coordinate transformedCenterCoordinate = Projection.transform(centerCoordinate, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
//
// view.setCenter(transformedCenterCoordinate);
// view.setZoom(5);
// create the map
MapOptions mapOptions = OLFactory.createOptions();
mapOptions.setTarget(divTargetId);
mapOptions.setView(view);
map = new Map(mapOptions);
map.addLayer(osmLayer);
//map.addLayer(tileDebugLayer);
// add some controls
// map.addControl(OLFactory.createScaleLine());
// DemoUtils.addDefaultControls(map.getControls());
Attribution attribution = new Attribution();
attribution.setCollapsed(true);
map.addClickListener(new EventListener<MapBrowserEvent>() {
@Override
public void onEvent(MapBrowserEvent event) {
// TODO Auto-generated method stub
Coordinate coordinate = event.getCoordinate();
if(isQueryPointActive) {
double lon = coordinate.getX();
double lat = coordinate.getY();
int w = (int) map.getSize().getWidth();
int h = (int) map.getSize().getHeight();
// handler.clickOnMap(x, y, w, h);
// ratio - mapPixelWeight : bboxWeight = 10px : geoRectangleWidth
// where 10px is the pixel diameter dimension of the clicked point
double bboxWidth = Math.abs(getExtent().getLowerLeftX() - getExtent().getUpperRightX());
double geoWidth = (bboxWidth / w) * (20 / 2);
double x1 = Math.min(lon+geoWidth, lon-geoWidth);
double x2 = Math.max(lon+geoWidth, lon-geoWidth);
double y1 = Math.min(lat+geoWidth, lat-geoWidth);
double y2 = Math.max(lat+geoWidth, lat-geoWidth);
//GWT.log("("+x1+","+y1+")("+x2+","+y2+")");
// Point pt = new Point(coordinate);
// ol.Extent extent = pt.getExtent();
// //new ClickDataInfo(x1, y1, x2, y2)
// SelectDataInfo selectDataInfo
//selectBox(new GeoQuery(x1, y1, x2, y2, GeoQuery.TYPE.POINT));
GeoQuery select = new GeoQuery(x1, y1, x2, y2, TYPE.POINT);
}
}
});
map.addControl(attribution);
// add some interactions
map.addInteraction(new KeyboardPan());
map.addInteraction(new KeyboardZoom());
}
/**
* Sets the center.
*
* @param centerCoordinate the new center
*/
public void setCenter(Coordinate centerCoordinate) {
view.setCenter(centerCoordinate);
}
/**
* Sets the center.
*
* @param centerCoordinate the new center
*/
public void setZoom(int zoom) {
view.setZoom(zoom);
}
/**
* Adds the WMS layer.
*
* @param mapServerHost the map server host
* @param layerName the layer name
* @return the image
*/
public Image addWMSLayer(String mapServerHost, String layerName) {
GWT.log("Adding wmsLayer with mapServerHost: "+mapServerHost+", layerName: "+layerName);
ImageWmsParams imageWMSParams = OLFactory.createOptions();
imageWMSParams.setLayers(layerName);
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
imageWMSOptions.setUrl(mapServerHost);
imageWMSOptions.setParams(imageWMSParams);
//imageWMSOptions.setRatio(1.5f);
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
LayerOptions layerOptions = OLFactory.createOptions();
layerOptions.setSource(imageWMSSource);
ol.layer.Image wmsLayer = new ol.layer.Image(layerOptions);
//visibleLayerItems
map.addLayer(wmsLayer);
return wmsLayer;
}
/**
* Gets the first layer.
*
* @return the first layer
*/
public Image getFirstLayer() {
if(map.getLayers()!=null) {
return (Image) map.getLayers().getArray()[0];
}
return null;
}
/**
* Adds the point.
*
* @param coordinate the coordinate
* @param showCoordinateText the show coordinate text
* @param asMarker the as marker
*/
public void addPoint(Coordinate coordinate, boolean showCoordinateText, boolean asMarker) {
if(geometryLayer!=null) {
map.removeLayer(geometryLayer);
}else {
}
Style style = new Style();
if(asMarker) {
IconOptions iconOptions = new IconOptions();
iconOptions.setSrc(markerURL);
Icon icon = new Icon(iconOptions);
style.setImage(icon);
}
if(showCoordinateText) {
TextOptions textOptions = new TextOptions();
textOptions.setOffsetY(-25);
// StrokeOptions strokeOptions = new StrokeOptions();
// strokeOptions.setColor(new Color(0, 0, 255, 0.0));
// strokeOptions.setWidth(4);
// Stroke stroke = new Stroke(strokeOptions);
// textOptions.setStroke(stroke);
// FillOptions fillOptions = new FillOptions();
// fillOptions.setColor(new Color(0, 0, 0, 0.0));
// textOptions.setFill(new Fill(fillOptions));
Coordinate transfCoord = MapUtils.transformCoordiante(coordinate, GeoportalDataViewerConstants.EPSG_3857, GeoportalDataViewerConstants.EPSG_4326);
textOptions.setText("Long: "+transfCoord.getX() + ", Lat: "+transfCoord.getY());
Text text = new Text(textOptions);
// FillOptions fillOptions = new FillOptions();
// Color color = new Color(217, 217, 223, 0.0);
// fillOptions.setColor(color);
// Fill fill = new Fill(fillOptions);
// style.setFill(fill);
style.setText(text);
}
Point thePoint = new Point(coordinate);
Feature vf = new Feature(thePoint);
vf.setStyle(style);
ol.source.Vector vector = new ol.source.Vector();
vector.addFeature(vf);
VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
vectorLayerOptions.setSource(vector);
geometryLayer = new ol.layer.Vector(vectorLayerOptions);
map.addLayer(geometryLayer);
}
/**
* Gets the map.
*
* @return the map
*/
public Map getMap() {
return map;
}
/**
* Gets the projection code.
*
* @return the projection code
*/
public String getProjectionCode() {
return map.getView().getProjection().getCode();
}
/**
* Gets the current zoom level.
*
* @return the current zoom level
*/
public double getCurrentZoomLevel() {
return map.getView().getZoom();
}
/**
* Gets the bbox.
*
* @return the bbox
*/
public ol.Extent getBBOX() {
return getExtent();
}
/**
* Gets the extent.
*
* @return the extent
*/
public ol.Extent getExtent() {
return this.map.getView().calculateExtent(map.getSize());
}
}

View File

@ -1,13 +1,7 @@
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
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;
import ol.control.MousePosition;
@ -15,58 +9,46 @@ import ol.control.ZoomSlider;
import ol.geom.LineString;
import ol.proj.Projection;
/**
* The Class MapUtils.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 12, 2020
* Nov 12, 2020
*/
public final class MapUtils {
/**
* Creates some default controls and adds it to the collection.
*
* @param controls collection with controls
*/
public static void addDefaultControls(final Collection<Control> controls) {
controls.push(new FullScreen());
controls.push(new ZoomSlider());
MousePosition mousePosition = new MousePosition();
mousePosition.setCoordinateFormat(Coordinate.createStringXY(5));
controls.push(mousePosition);
/**
* Creates some default controls and adds it to the collection.
*
* @param controls collection with controls
*/
public static void addDefaultControls(final Collection<Control> controls) {
Attribution attribution = new Attribution();
attribution.setCollapsed(true);
controls.push(attribution);
// controls.push(new ZoomToExtent());
}
controls.push(new FullScreen());
controls.push(new ZoomSlider());
MousePosition mousePosition = new MousePosition();
mousePosition.setCoordinateFormat(Coordinate.createStringXY(5));
controls.push(mousePosition);
//controls.push(new ZoomToExtent());
}
/**
* Transform coordiante.
*
* @param centerCoordinate the center coordinate
* @param source the source
* @param target the target
* @param source the source
* @param target the target
* @return the coordinate
*/
public static Coordinate transformCoordiante(Coordinate centerCoordinate, String source, String target) {
return Projection.transform(centerCoordinate, source, target);
}
/**
* Transform extent.
*
* @param extent the extent
* @param source the source
* @param target the target
* @return the extent
*/
public static Extent transformExtent(Extent extent, String source, String target) {
return Projection.transformExtent(extent, source, target);
}
/**
* Distance between centroid.
@ -76,9 +58,10 @@ public final class MapUtils {
* @return the long
*/
public static long distanceBetweenCentroid(ExtentWrapped ex1, ExtentWrapped ex2) {
return distanceBetween(ex1.getCenter(), ex2.getCenter());
return distanceBetween(ex1.getCenter(),ex2.getCenter());
}
/**
* Distance between.
*
@ -96,43 +79,15 @@ public final class MapUtils {
// GWT.log("Line length is: "+ls);
return Math.round(ls.getLength() * 100) / 100;
}
/**
* Reverse coordinate.
*
* @param coord the coord
* @return the coordinate
*/
public static Coordinate reverseCoordinate(Coordinate coord) {
public static Coordinate reverseCoordinate(Coordinate coord){
return new Coordinate(coord.getY(), coord.getX());
}
/**
* 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 geoJSONToBBOXCenter(GeoJSON spatialReference, String transforFrom, String transformTo) {
try {
if (spatialReference != null) {
ExtentWrapped ew = new ExtentWrapped(spatialReference.getBbox().getMinX(),
spatialReference.getBbox().getMinY(), spatialReference.getBbox().getMaxX(),
spatialReference.getBbox().getMaxY());
Coordinate center = ew.getCenter();
if (transforFrom != null && transformTo != null)
center = transformCoordiante(center, transforFrom, transformTo);
return center;
}
} catch (Exception e) {
GWT.log("geoJSONTToBBoxCenter error: " + e.getMessage());
}
return null;
}
}

View File

@ -0,0 +1,514 @@
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Visibility;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
import ol.Collection;
import ol.Coordinate;
import ol.Map;
import ol.MapBrowserEvent;
import ol.MapEvent;
import ol.MapOptions;
import ol.OLFactory;
import ol.Overlay;
import ol.OverlayOptions;
import ol.Size;
import ol.View;
import ol.ViewOptions;
import ol.control.Attribution;
import ol.event.EventListener;
import ol.interaction.Draw;
import ol.interaction.DrawOptions;
import ol.interaction.Extent;
import ol.interaction.ExtentOptions;
import ol.interaction.Interaction;
import ol.interaction.KeyboardPan;
import ol.interaction.KeyboardZoom;
import ol.layer.Base;
import ol.layer.Image;
import ol.layer.LayerOptions;
import ol.layer.Tile;
import ol.proj.Projection;
import ol.proj.ProjectionOptions;
import ol.source.ImageWms;
import ol.source.ImageWmsOptions;
import ol.source.ImageWmsParams;
import ol.source.Osm;
import ol.source.Vector;
import ol.source.XyzOptions;
// TODO: Auto-generated Javadoc
/**
* The Class OpenLayerOSM.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 27, 2020
*/
public abstract class OpenLayerOSM {
public abstract void clickListener(MapBrowserEvent event);
public abstract void moveEndListener(MapEvent event);
public abstract void moveStartListener(MapEvent event);
public abstract void mapZoomListener(MapEvent event);
public abstract void mapZoomEndListener(MapEvent event);
/** The map. */
private Map map;
/** The view. */
private View view;
/** The view options. */
private ViewOptions viewOptions = OLFactory.createOptions();
/** The projection options. */
private ProjectionOptions projectionOptions = OLFactory.createOptions();
/** The point draw. */
private Draw queryPoint;
private Extent queryBox;
/** The popup overlay. */
private Overlay popupOverlay;
private HandlerManager eventBus;
private boolean isQueryBoxActive;
private boolean isQueryPointActive;
/**
* Instantiates a new open layer OSM.
*
* @param divTargetId the div target id
* @param eventBus the event bus
*/
/* (non-Javadoc)
* @see de.desjardins.ol3.demo.client.example.Example#show()
*/
public OpenLayerOSM(String divTargetId, HandlerManager eventBus) {
this.eventBus = eventBus;
// create a OSM-layer
XyzOptions osmSourceOptions = OLFactory.createOptions();
Osm osmSource = new Osm(osmSourceOptions);
LayerOptions osmLayerOptions = OLFactory.createOptions();
osmLayerOptions.setSource(osmSource);
Tile osmLayer = new Tile(osmLayerOptions);
// create a projection
projectionOptions.setCode(GeoportalDataViewerConstants.EPSG_3857);
projectionOptions.setUnits("m");
Projection projection = new Projection(projectionOptions);
viewOptions.setProjection(projection);
viewOptions.setMaxZoom(19);
//viewOptions.setExtent(new Extent(-180, -90, 180, 90));
// create a view
view = new View(viewOptions);
// create the map
MapOptions mapOptions = OLFactory.createOptions();
mapOptions.setTarget(divTargetId);
mapOptions.setView(view);
map = new Map(mapOptions);
map.addLayer(osmLayer);
//map.addLayer(tileDebugLayer);
// add some controls
map.addControl(OLFactory.createScaleLine());
MapUtils.addDefaultControls(map.getControls());
Attribution attribution = new Attribution();
attribution.setCollapsed(true);
map.addControl(attribution);
// add some interactions
map.addInteraction(new KeyboardPan());
map.addInteraction(new KeyboardZoom());
bindEvents();
}
private void bindEvents() {
map.addClickListener(new EventListener<MapBrowserEvent>() {
@Override
public void onEvent(MapBrowserEvent event) {
clickListener(event);
}
});
map.addMoveEndListener(new EventListener<MapEvent>() {
@Override
public void onEvent(MapEvent event) {
moveEndListener(event);
}
});
map.addMoveStartListener(new EventListener<MapEvent>() {
@Override
public void onEvent(MapEvent event) {
moveStartListener(event);
}
});
map.addMapZoomListener(new EventListener<MapEvent>() {
@Override
public void onEvent(MapEvent event) {
mapZoomListener(event);
}
});
map.addMapZoomEndListener(new EventListener<MapEvent>() {
@Override
public void onEvent(MapEvent event) {
mapZoomEndListener(event);
}
});
}
/**
* Sets the center.
*
* @param centerCoordinate the new center
*/
public void setCenter(Coordinate centerCoordinate) {
view.setCenter(centerCoordinate);
}
/**
* Sets the center.
*
* @param centerCoordinate the new center
*/
public void setZoom(int zoom) {
view.setZoom(zoom);
}
public void showPopup(String html, Coordinate coordinate) {
GWT.log("Showing popup on: "+coordinate);
Element elPopup = DOM.getElementById("popup");
elPopup.getStyle().setVisibility(Visibility.VISIBLE);
if(popupOverlay==null) {
popupOverlay = addOverlay(elPopup);
addPopupCloserHandelr(popupOverlay);
}
Element popContent = DOM.getElementById("popup-content");
popContent.setInnerHTML(html);
popupOverlay.setPosition(coordinate);
}
public void hidePopup() {
if(popupOverlay!=null) {
Element elPopup = DOM.getElementById("popup");
elPopup.getStyle().setVisibility(Visibility.HIDDEN);
}
}
/**
* Adds the popup closer handelr.
*
* @param popupOverlay the popup overlay
*/
private void addPopupCloserHandelr(Overlay popupOverlay) {
Element elPopupCloser = DOM.getElementById("popup-closer");
Event.sinkEvents(elPopupCloser, Event.ONCLICK);
Event.setEventListener(elPopupCloser, new com.google.gwt.user.client.EventListener() {
@Override
public void onBrowserEvent(Event event) {
if (Event.ONCLICK == event.getTypeInt()) {
popupOverlay.setPosition(null);
}
}
});
}
/**
* Handler popu closer.
*
* @param divId the div id
* @param overlayId the overlay id
*/
public static native void handlerPopuCloser(String divId, String overlayId) /*-{
var closer = $doc.getElementById(divId);
var overlay = $doc.getElementById(overlayId);
closer.onclick = function() {
overlay.setPosition(undefined);
closer.blur();
return false;
};
}-*/;
/**
* Adds the WMS layer.
*
* @param layerItem the layer item
*/
public void addWMSLayer(LayerItem layerItem) {
ImageWmsParams imageWMSParams = OLFactory.createOptions();
imageWMSParams.setLayers(layerItem.getName());
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
imageWMSOptions.setUrl(layerItem.getMapServerHost());
imageWMSOptions.setParams(imageWMSParams);
//imageWMSOptions.setRatio(1.5f);
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
LayerOptions layerOptions = OLFactory.createOptions();
layerOptions.setSource(imageWMSSource);
Image wmsLayer = new Image(layerOptions);
//visibleLayerItems
map.addLayer(wmsLayer);
GWT.log("Fired the event Added Layer");
eventBus.fireEvent(new AddedLayerToMapEvent(layerItem));
}
// /**
// * Adds the WMS layer.
// *
// * @param mapServerHost the map server host
// * @param layerName the layer name
// */
// public void addWMSLayer(String mapServerHost, String layerName) {
//
// ImageWmsParams imageWMSParams = OLFactory.createOptions();
// imageWMSParams.setLayers(layerName);
//
// ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
// imageWMSOptions.setUrl(mapServerHost);
// imageWMSOptions.setParams(imageWMSParams);
// //imageWMSOptions.setRatio(1.5f);
//
// ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
//
// LayerOptions layerOptions = OLFactory.createOptions();
// layerOptions.setSource(imageWMSSource);
//
// Image wmsLayer = new Image(layerOptions);
//
// //visibleLayerItems
//
// map.addLayer(wmsLayer);
// }
/**
* Adds the point vector source.
*
* @return the draw
*/
public Draw addPointVectorSource() {
if(queryPoint==null)
initPointInteraction();
map.addInteraction(queryPoint);
isQueryPointActive = true;
return queryPoint;
}
/**
* Inits the point interaction.
*/
private void initPointInteraction() {
Vector vectorSource = new Vector();
DrawOptions drawOptions = new DrawOptions();
drawOptions.setSource(vectorSource);
drawOptions.setType("Point");
drawOptions.setMaxPoints(1);
drawOptions.setMinPoints(1);
drawOptions.setWrapX(false);
queryPoint = new Draw(drawOptions);
queryPoint.addChangeListener(new EventListener<ol.events.Event>() {
@Override
public void onEvent(ol.events.Event event) {
GWT.log(event.getType());
}
});
}
/**
* Removes the interaction.
*
* @param interaction the interaction
*/
public void removeInteraction(Interaction interaction) {
map.removeInteraction(interaction);
}
/**
* Removes the interactions.
*/
public void removeQueryInteractions() {
Collection<Interaction> interactions = map.getInteractions();
if(interactions!=null) {
map.removeInteraction(queryBox);
map.removeInteraction(queryPoint);
isQueryBoxActive = false;
isQueryPointActive = false;
}
}
/**
* Adds the extent interaction.
*
* @return the extent
*/
public Extent addExtentInteraction() {
ExtentOptions extentOptions = new ExtentOptions();
extentOptions.setWrapX(false);
//StyleOptions styleOptions = new StyleOptions();
//styleOptions.setStroke(stroke);
//styleOptions.set
//extentOptions.setBoxStyle(new ol.style.Style(styleOptions));
queryBox = new Extent(extentOptions);
map.addInteraction(queryBox);
isQueryBoxActive = true;
return queryBox;
}
/**
* Adds the overlay.
*
* @param element the element
* @return the overlay
*/
private Overlay addOverlay(Element element) {
/**
* Create an overlay to anchor the popup to the map.
*/
OverlayOptions overlayOptions = new OverlayOptions();
overlayOptions.setAutoPan(true);
Overlay overlay = new Overlay(overlayOptions);
overlay.setElement(element);
map.addOverlay(overlay);
return overlay;
}
/**
* Checks if is layer visible.
*
* @param layerName the layer name
* @return true, if is layer visible
*/
public boolean isLayerVisible(String layerName) {
Collection<Base> layers = map.getLayers();
if(layers!=null) {
Base[] layersArr = layers.getArray();
for (int i = 0; i < layersArr.length; i++) {
Base layer = layersArr[i];
String theLayerName = (String) layer.get("name");
GWT.log("The Layer name is: "+layerName);
if(theLayerName!=null && theLayerName.equals(layerName))
return true;
}
}
return false;
}
/**
* Gets the projection code.
*
* @return the projection code
*/
public String getProjectionCode() {
return map.getView().getProjection().getCode();
}
/**
* Gets the current zoom level.
*
* @return the current zoom level
*/
public double getCurrentZoomLevel() {
return map.getView().getZoom();
}
/**
* Gets the bbox.
*
* @return the bbox
*/
public ol.Extent getBBOX() {
return getExtent();
}
/**
* Gets the extent.
*
* @return the extent
*/
public ol.Extent getExtent() {
return this.map.getView().calculateExtent(map.getSize());
}
public Coordinate transform (Coordinate centerCoordinate, String source, String target){
return Projection.transform(centerCoordinate, source, target);
}
public boolean isQueryBoxActive() {
return isQueryBoxActive;
}
public boolean isQueryPointActive() {
return isQueryPointActive;
}
public Size getSize() {
return map.getSize();
}
public boolean mapInstancied() {
return this.map!=null;
}
}

View File

@ -1,37 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.resources;
import com.github.gwtbootstrap.client.ui.constants.BaseIconType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
public interface GNAIcons extends ClientBundle {
/** My custom base icon collection */
public enum CustomIconType implements BaseIconType {
MAP("map"),
PRESET_LOCATION("preset_location"),
LAYERS("layers");
/** Inject the icon's css once at first usage */
static {
GNAImages icons = GWT.create(GNAImages.class);
icons.css().ensureInjected();
}
private static final String PREFIX = "myBaseIcon_";
private String className;
private CustomIconType(String className) {
this.className = className;
}
/**
* {@inheritDoc}
*/
@Override
public String get() {
return PREFIX + className;
}
}
}

View File

@ -1,68 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.resources;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.resources.client.ImageResource;
public interface GNAImages extends ClientBundle {
/** Get access to the css resource during gwt compilation */
@Source("baseIcons.css")
CssResource css();
public static final GNAImages ICONS = GWT.create(GNAImages.class);
/**
* Our sample image icon. Makes the image resource for the gwt-compiler's css
* composer accessible
*/
@Source("map1.png")
ImageResource map();
@Source("preset_location.png")
ImageResource preset_location();
@Source("layers.png")
ImageResource layers();
@Source("loading.gif")
ImageResource loading();
@Source("map-marker-icon.png")
ImageResource mapMarkerIcon();
@Source("icon_share.png")
ImageResource shareIcon();
@Source("italy.png")
ImageResource italyIcon();
@Source("world.png")
ImageResource worldIcon();
@Source("layer_visible.png")
ImageResource layerVisible();
@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("geoportal_error.png")
ImageResource geoportaServiceError();
@Source("warning_error.png")
ImageResource warningError();
}

View File

@ -0,0 +1,19 @@
package org.gcube.portlets.user.geoportaldataviewer.client.resources;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;
public interface Images extends ClientBundle {
public static final Images ICONS = GWT.create(Images.class);
@Source("loading.gif")
ImageResource loading();
@Source("map-marker-icon.png")
ImageResource mapMarkerIcon();
@Source("icon_share.png")
ImageResource shareIcon();
}

View File

@ -1,25 +0,0 @@
/* Prevent our icons from css obfuscation */
@external .myBaseIcon_*; /* Do some css stuff */
@sprite .myBaseIcon_map {
gwt-image: "map";
display: inline-block;
vertical-align: middle;
width: 17px !important;
height: 17px !important;
}
@sprite .myBaseIcon_preset_location {
gwt-image: "preset_location";
display: inline-block;
vertical-align: middle;
width: 17px !important;
height: 17px !important;
}
@sprite .myBaseIcon_layers {
gwt-image: "layers";
display: inline-block;
vertical-align: middle;
width: 17px !important;
height: 17px !important;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 810 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 705 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 581 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -1,13 +1,13 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectViewer;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni.ConcessioneView;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaItemRef;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RecordDV;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconSize;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
@ -32,7 +32,7 @@ public class DetailsPanel extends Composite {
@UiField
HTMLPanel detailsHTMLPanel;
private ProjectView displayedProject = null;
private RecordDV displayedRecord = null;
private HandlerManager applicationBus;
@ -44,8 +44,7 @@ public class DetailsPanel extends Composite {
initWidget(uiBinder.createAndBindUi(this));
closeButton.setType(ButtonType.LINK);
closeButton.setIcon(IconType.REMOVE);
closeButton.setIconSize(IconSize.LARGE);
closeButton.setIcon(IconType.REMOVE_SIGN);
closeButton.addClickHandler(new ClickHandler() {
@ -62,15 +61,13 @@ public class DetailsPanel extends Composite {
}
public void showDetailsFor(ProjectView result, GeoportalItemReferences geonaItemRef) {
this.displayedProject = result;
public void showDetailsFor(ConcessioneDV cdv, GeoNaItemRef geonaItemRef) {
this.displayedRecord = cdv;
datailsContainerPanel.clear();
if(detailsHTMLPanel.getParent()!=null) {
if(detailsHTMLPanel.getParent()!=null)
detailsHTMLPanel.getParent().getElement().setScrollTop(0);
}
datailsContainerPanel.add(new ProjectViewer(applicationBus, geonaItemRef, result));
datailsContainerPanel.add(new ConcessioneView(geonaItemRef, cdv));
showPanelDetails();
}
@ -79,13 +76,13 @@ public class DetailsPanel extends Composite {
}
public void hidePanelDetails() {
this.displayedProject = null;
this.displayedRecord = null;
datailsContainerPanel.clear();
detailsHTMLPanel.setVisible(false);
}
public ProjectView getDisplayedProject() {
return displayedProject;
public RecordDV getDisplayedRecord() {
return displayedRecord;
}
}

View File

@ -8,23 +8,12 @@
}
.to-align-right{
position: absolute;
top: 50px;
top: 10px;
right: 10px;
}
.to-align-left {
position: absolute;
top: 5px;
color: white !important;
text-decoration: none !important;
}
.to-align-left :hover {
color: #F5F5F5;
}
</ui:style>
<g:HTMLPanel ui:field="detailsHTMLPanel" visible="false">
<b:Button ui:field="closeButton" addStyleNames="{style.to-align-left}"></b:Button>
<b:Button ui:field="closeButton" addStyleNames="{style.to-align-right}"></b:Button>
<g:HTMLPanel ui:field="datailsContainerPanel"></g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,74 +1,21 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
import org.gcube.application.geoportalcommon.shared.geoportal.config.GroupedLayersDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.ConfiguredLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.LayerIDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.GisToolbarFacilities;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.OpenCollectionEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAIcons;
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
import org.gcube.portlets.user.geoportaldataviewer.client.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 org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaItemRef;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RecordDV;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.CheckBox;
import com.github.gwtbootstrap.client.ui.DropdownButton;
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;
import com.google.gwt.dom.client.Style.Unit;
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.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.event.shared.GwtEvent;
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.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;
/**
@ -76,14 +23,10 @@ import com.google.gwt.user.client.ui.Widget;
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 19, 2020
* Nov 19, 2020
*/
public class GeonaDataViewMainPanel extends Composite {
private static final String PLACEHOLDER_SELECT_SEARCH_IN = "Select Collection...";
private static GeonaDataViewMainPanelUiBinder uiBinder = GWT.create(GeonaDataViewMainPanelUiBinder.class);
/**
@ -91,276 +34,58 @@ public class GeonaDataViewMainPanel extends Composite {
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 19, 2020
* Nov 19, 2020
*/
interface GeonaDataViewMainPanelUiBinder extends UiBinder<Widget, GeonaDataViewMainPanel> {
}
// @UiField
// Tab mapTabPanel;
@UiField
HTMLPanel mainContainerPanel;
@UiField
HTMLPanel mainToolBar;
@UiField
NavLink dataPointSelection;
@UiField
NavLink dataBoxSelection;
@UiField
Button removeQuery;
@UiField
DetailsPanel detailsPanel;
@UiField
Button extentToItaly;
@UiField
Button extentToEarth;
@UiField
Button linkLayers;
@UiField
DropdownButton openCollectionDropDown;
@UiField
DropdownButton linkCustomOverlayLayers;
@UiField
DropdownButton linkCrossFilteringLayers;
@UiField
HTMLPanel panelCustomOverlayLayers;
@UiField
HTMLPanel panelCrossFilteringLayers;
@UiField
HTMLPanel openCollectionPanel;
@UiField
DropdownButton searchFacilityButton;
@UiField
ListBox navListSearch;
//@UiField
//ScrollPanel overlayLayersPanel;
RootPanel overlayLayersPanel = RootPanel.get(GeoportalDataViewer.DIV_LAYER_VIEW);
@UiField
ScrollPanel searchFacilityPanel;
@UiField
HTMLPanel panelAttribution;
@UiField
HTMLPanel panelBaseLayers;
@UiField
DropdownButton linkMap;
@UiField
DropdownButton linkPresetLocation;
private MapPanel mapPanel;
private OpenLayerMap map;
private OpenLayerOSM map;
private HandlerManager applicationBus;
private HashMap<String, List<CheckBox>> mapCollectionCheckBoxes;
private SearchFacilityUI currentSearchFacility;
private HashMap<String, ItemFieldsResponse> mapItemFieldsForUCD = new HashMap<String, ItemFieldsResponse>();
public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight,
List<ItemFieldsResponse> itemFieldsReponse) {
/**
* Instantiates a new geona data view main panel.
*
* @param applicationBus the application bus
* @param mapHeight the map height
*/
public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight) {
initWidget(uiBinder.createAndBindUi(this));
this.applicationBus = applicationBus;
mapPanel = new MapPanel(mapHeight + "px");
detailsPanel.setHeight(mapHeight + "px");
mapPanel = new MapPanel(mapHeight+"px");
detailsPanel.setHeight(mapHeight+"px");
detailsPanel.setApplicationBus(applicationBus);
overlayLayersPanel.setVisible(false);
mainContainerPanel.add(mapPanel);
bindHandlers();
dataPointSelection.setIcon(IconType.SCREENSHOT);
dataBoxSelection.setIcon(IconType.BOOKMARK);
removeQuery.setIcon(IconType.REMOVE);
Image italyImg = new Image(GNAImages.ICONS.italyIcon());
italyImg.getElement().getStyle().setPaddingLeft(20, Unit.PX);
extentToItaly.getElement().appendChild(italyImg.getElement());
extentToItaly.setWidth("140px");
Image worldImg = new Image(GNAImages.ICONS.worldIcon());
worldImg.getElement().getStyle().setPaddingLeft(20, Unit.PX);
extentToEarth.getElement().appendChild(worldImg.getElement());
extentToEarth.setWidth("140px");
// linkMap.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get());
linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
openCollectionDropDown.setIcon(IconType.COMPASS);
mapItemFieldsForUCD.clear();
SearchingFilter initialSortFilter = new SearchingFilter();
initialSortFilter.setOrder(ORDER.ASC);
navListSearch.addItem(PLACEHOLDER_SELECT_SEARCH_IN, PLACEHOLDER_SELECT_SEARCH_IN);
navListSearch.getElement().getFirstChildElement().setAttribute("disabled", "disabled");
for (final ItemFieldsResponse itemFieldResp : itemFieldsReponse) {
UseCaseDescriptorDV ucd = itemFieldResp.getUseCaseDescriptorDV();
mapItemFieldsForUCD.put(ucd.getId(), itemFieldResp);
GWT.log("Added navLink for: " + ucd.getName());
navListSearch.addItem(ucd.getName(), ucd.getProfileID());
}
navListSearch.addChangeHandler(new ChangeHandler() {
private SearchFacilityUI currentSearchFacility;
@Override
public void onChange(ChangeEvent event) {
if (this.currentSearchFacility != null)
this.currentSearchFacility.resetCurrentSearch();
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);
List<ItemFieldDV> result = itemFieldResp.getListItemFields();
List<ItemFieldDV> displayFields = new ArrayList<ItemFieldDV>();
List<ItemFieldDV> searchByFields = new ArrayList<ItemFieldDV>();
List<ItemFieldDV> sortByFields = new ArrayList<ItemFieldDV>();
for (ItemFieldDV itemField : result) {
if (itemField.isDisplayAsResult()) {
displayFields.add(itemField);
}
if (itemField.isSearchable()) {
searchByFields.add(itemField);
}
if (itemField.isSortable()) {
sortByFields.add(itemField);
}
}
this.currentSearchFacility = new SearchFacilityUI(ucdProfileID, applicationBus, displayFields,
sortByFields, searchByFields, initialSortFilter);
searchFacilityPanel.add(currentSearchFacility);
currentSearchFacility.setSearchButton(searchFacilityButton);
}
}
});
searchFacilityButton.setIcon(IconType.SEARCH);
if (itemFieldsReponse.size() == 0) {
searchFacilityPanel.setVisible(false);
searchFacilityButton.setVisible(false);
}
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
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();
}
/**
* Bind events.
*/
private void bindEvents() {
linkLayers.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
GWT.log("layersDDB clicked");
if (overlayLayersPanel.isVisible()) {
overlayLayersPanel.setVisible(false);
} else {
overlayLayersPanel.setVisible(true);
}
}
});
searchFacilityButton.addDomHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// event.preventDefault();
event.stopPropagation();
}
}, ClickEvent.getType());
openCollectionDropDown.addDomHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// event.preventDefault();
event.stopPropagation();
}
}, 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());
removeQuery.setIcon(IconType.REMOVE);
}
/**
@ -372,40 +97,6 @@ public class GeonaDataViewMainPanel extends Composite {
String toH = height + "px";
mapPanel.setMapHeight(height);
detailsPanel.setHeight(toH);
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.
*/
private void setOverlayPanelMaxHeight() {
String overlMH = mapPanel.getOffsetHeight() - 130 + "px";
GWT.log("overlayLayersPanel maxHeight: " + overlMH);
overlayLayersPanel.getElement().getStyle().setProperty("maxHeight", overlMH);
}
/**
@ -422,7 +113,7 @@ public class GeonaDataViewMainPanel extends Composite {
*
* @param map the new map
*/
public void setMap(OpenLayerMap map) {
public void setMap(OpenLayerOSM map) {
this.map = map;
}
@ -456,9 +147,9 @@ public class GeonaDataViewMainPanel extends Composite {
removeQuery.setVisible(true);
}
});
removeQuery.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
map.removeQueryInteractions();
@ -466,321 +157,34 @@ public class GeonaDataViewMainPanel extends Composite {
}
});
extentToItaly.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Location italyLocation = ExtentMapUtil.getLocation(ExtentMapUtil.PLACE.ITALY);
applicationBus.fireEvent(new MapExtentToEvent(italyLocation));
map.setCenter(italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857));
map.setZoom(italyLocation.getZoomLevel());
}
});
extentToEarth.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Location earthLocation = ExtentMapUtil.getLocation(ExtentMapUtil.PLACE.WORLD);
applicationBus.fireEvent(new MapExtentToEvent(earthLocation));
map.setCenter(earthLocation.getCoordinate(MAP_PROJECTION.EPSG_3857));
map.setZoom(earthLocation.getZoomLevel());
}
});
}
/**
* Show as details.
*
* @param result the result
* @param concessioneDV the concessione DV
* @param geonaItemRef the geona item ref
*/
public void showAsDetails(ProjectView result, GeoportalItemReferences geonaItemRef) {
detailsPanel.showDetailsFor(result, geonaItemRef);
public void showAsDetails(ConcessioneDV concessioneDV, GeoNaItemRef geonaItemRef) {
detailsPanel.showDetailsFor(concessioneDV, geonaItemRef);
}
/**
* Hide panel details.
*/
public void hidePanelDetails() {
detailsPanel.hidePanelDetails();
}
/**
* Gets the displayed record.
* Gets the displyed record.
*
* @return the displayed record
* @return the displyed record
*/
public ProjectView getDisplayedProject() {
return detailsPanel.getDisplayedProject();
public RecordDV getDisplyedRecord() {
return detailsPanel.getDisplayedRecord();
}
/**
* Gets the layers DDB.
*
* @return the layers DDB
*/
public Button getLayersDDB() {
return linkLayers;
}
/**
* Show overlay layers.
*
* @param panel the panel
*/
public void showOverlayLayers(FlowPanel panel) {
GWT.log("showOverlayLayers");
// layersDDB.setVisible(true);
overlayLayersPanel.setVisible(true);
overlayLayersPanel.clear();
setOverlayPanelMaxHeight();
overlayLayersPanel.add(panel);
// layersDDBClickEvent();
}
/**
* Layers DDB click event.
*/
private void layersDDBClickEvent() {
linkLayers.fireEvent(new GwtEvent<ClickHandler>() {
@Override
public com.google.gwt.event.shared.GwtEvent.Type<ClickHandler> getAssociatedType() {
return ClickEvent.getType();
}
@Override
protected void dispatch(ClickHandler handler) {
handler.onClick(null);
}
});
}
/**
* Hide overlay layers.
*/
public void hideOverlayLayers() {
GWT.log("hideOverlayLayers");
overlayLayersPanel.clear();
// layersDDB.setVisible(false);
overlayLayersPanel.setVisible(false);
// layersDDBClickEvent();
}
/**
* Sets the map attribution.
*
* @param attribution the new map attribution
*/
public void setMapAttribution(String attribution) {
panelAttribution.clear();
Label label = new Label("Base Map Credits");
Paragraph p = new Paragraph(attribution);
panelAttribution.add(label);
panelAttribution.add(p);
}
/**
* Sets the base layers.
*
* @param listBaseLayers the new base layers
*/
public void setAvailableCollections(Collection<GCubeCollection> collection, String openCollectionID) {
GWT.log("Init Available collections menu");
if (collection == null || collection.isEmpty())
GWT.log("!!! No Available collections");
mapCollectionCheckBoxes = new HashMap<String, List<CheckBox>>();
for (GCubeCollection coll : collection) {
GWT.log("Found available collection " + coll);
final String collectionID = coll.getUcd().getId(); // collectionID == UCD_Id
LayerCollectionPanel lcp = new LayerCollectionPanel(coll, applicationBus);
openCollectionPanel.add(lcp);
List<CheckBox> listCollections = mapCollectionCheckBoxes.get(collectionID);
if (listCollections == null)
listCollections = new ArrayList<CheckBox>();
listCollections.add(lcp.getCheckbox());
mapCollectionCheckBoxes.put(collectionID, listCollections);
// Opening All Collections if openCollectionID is null
if (openCollectionID == null) {
lcp.getCheckbox().setValue(true, true);
// String collectionID = checkbox.getId().replace("gcubeCollectionSelector_",
// "");
GWT.log("Opening the collection: " + collectionID);
applicationBus.fireEvent(new OpenCollectionEvent(collectionID));
}
}
// Opening All Collections if openCollectionID is null
if (openCollectionID != null) {
List<CheckBox> listCheckBoxes = mapCollectionCheckBoxes.get(openCollectionID);
if (listCheckBoxes != null) {
for (CheckBox checkBox : listCheckBoxes) {
checkBox.setValue(true, true);
String collectionID = checkBox.getId().replace("gcubeCollectionSelector_", "");
GWT.log("Opening the input collection: " + collectionID);
applicationBus.fireEvent(new OpenCollectionEvent(collectionID));
}
}
}
}
public void openCollectionMenu() {
GWT.log("openCollectionMenu");
GeoportalDataViewerConstants.clickElement(openCollectionDropDown.getElement().getFirstChildElement());
}
public void setBaseLayers(List<BaseMapLayer> listBaseLayers) {
if (listBaseLayers == null)
return;
int i = 0;
for (BaseMapLayer baseMapLayer : listBaseLayers) {
RadioButton radio = new RadioButton("base-layer");
radio.setText(baseMapLayer.getName());
if (i == 0) {
radio.setValue(true, false);
}
radio.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
@Override
public void onValueChange(ValueChangeEvent<Boolean> event) {
applicationBus.fireEvent(new ChangeMapLayerEvent(baseMapLayer));
}
});
SimplePanel sp = new SimplePanel(radio);
sp.getElement().addClassName("form-inline");
sp.getElement().addClassName("map-layers-radio");
panelBaseLayers.add(sp);
i++;
}
}
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

@ -7,92 +7,12 @@
.margin-right-10 {
margin-right: 10px;
}
.font-weight-bold {
font-weight: bold;
}
.open-collection-style {
padding-left: 15px;
padding-right: 15px;
}
.margin-left-top-5 {
margin-left: 5px;
margin-top: 5px;
}
.margin-left-5 {
margin-left: 5px;
}
</ui:style>
<g:HTMLPanel ui:field="mainHTMLPanel">
<g:HTMLPanel ui:field="mainContainerPanel">
<g:HTMLPanel ui:field="mainToolBar"
addStyleNames="inner-toolbar">
<b:DropdownButton type="LINK" text=" " icon="INFO">
<g:HTMLPanel ui:field="panelInfo"
addStyleNames="info-interaction">
<g:Label>Map Interactions</g:Label>
<b:Paragraph>
<b:Icon type="CHECK_EMPTY" />
Use
<code>Shift+Drag</code>
to draw an extent for zoom in the Map
</b:Paragraph>
<b:Paragraph>
<b:Icon type="HAND_UP" />
Click on the Points shown on the Map to view their features
</b:Paragraph>
<g:HTMLPanel ui:field="panelAttribution"
addStyleNames="info-interaction" visible="false">
</g:HTMLPanel>
</g:HTMLPanel>
</b:DropdownButton>
<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" 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">
<g:HorizontalPanel>
<b:Label type="INFO">Search in </b:Label>
<b:ListBox title="Search in the Collection..."
ui:field="navListSearch">
</b:ListBox>
</g:HorizontalPanel>
</g:FlowPanel>
<g:ScrollPanel ui:field="searchFacilityPanel"
addStyleNames="search-facility"></g:ScrollPanel>
</b:DropdownButton>
<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>
</b:Nav>
<b:Nav>
<b:Button type="LINK" ui:field="extentToEarth"
text="World" title="Center to World"></b:Button>
</b:Nav>
</b:DropdownButton>
<b:DropdownButton type="LINK" text="Query"
visible="false">
<b:DropdownButton type="LINK" text="Query">
<!-- <b:ButtonGroup toggle="checkbox" ui:field="buttonGroup"> -->
<b:NavLink ui:field="dataPointSelection"
addStyleNames="{style.margin-right-10}">Data Point
@ -103,10 +23,6 @@
</b:DropdownButton>
<b:Button type="LINK" ui:field="removeQuery"
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:HTMLPanel>
</g:HTMLPanel>
<c:DetailsPanel ui:field="detailsPanel"

View File

@ -1,70 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Modal;
import com.github.gwtbootstrap.client.ui.ModalFooter;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Widget;
/**
* The Class ModalWindow.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 20, 2020
*/
public class ModalWindow {
private Modal modal;
private Object caller;
/**
* Instantiates a new modal window.
*
* @param title the title
* @param width the width
* @param maxHeight the max height
*/
public ModalWindow(String title, int width, int maxHeight) {
modal = new Modal(false);
modal.hide(false);
modal.setTitle(title);
modal.setCloseVisible(true);
modal.setWidth(width);
modal.setMaxHeigth(maxHeight+"px");
ModalFooter modalFooter = new ModalFooter();
final Button buttClose = new Button("Close");
modalFooter.add(buttClose);
buttClose.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
modal.hide();
}
});
modal.add(modalFooter);
}
public void add(Widget toAdd) {
modal.add(toAdd);
}
public void setCaller(Object caller) {
this.caller = caller;
}
public void show() {
modal.show();
}
public void setWidth(int width) {
modal.setWidth(width);
}
}

View File

@ -1,213 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.gallery;
import java.util.Set;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.FilesetDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.SectionView;
import org.gcube.application.geoportalcommon.shared.geoportal.view.SubDocumentView;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.JSONValue;
import com.google.gwt.user.client.Random;
import com.google.gwt.user.client.ui.HTMLPanel;
/**
* The Class ImagesSectionGallery.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Jul 21, 2021
*/
public class ImagesSectionGallery {
private HTMLPanel galleryPanel;
private String galleryDivId;
private SectionView sectionView;
/**
* Instantiates a new images section gallery.
*
* @param sectionView the section view
*/
public ImagesSectionGallery(SectionView sectionView) {
this.galleryDivId = "nanogallery" + Random.nextInt() + Random.nextInt();
this.galleryPanel = new HTMLPanel("<div id='" + galleryDivId + "'></div>");
this.sectionView = sectionView;
}
/**
* Show gallery.
*
* @param json_array_images the json array images
* @param galleryDivId the gallery div id
*/
private native void showGallery(JavaScriptObject json_array_images, String galleryDivId) /*-{
//console.log("showing: " + json_array_images)
var waitForJQuery = setInterval(
function() {
if (typeof $wnd.$ != 'undefined') {
$wnd
.$("#" + galleryDivId)
.nanogallery2(
{
thumbnailHeight : '200 XS150 SM150', // RESPONSIVE THUMBNAIL HEIGHT: default=200px, XS resolution=150px, SM resolution=150px
thumbnailWidth : '218 XS150 SM150', // RESPONSIVE THUMBNAIL WIDTH: auto
thumbnailAlignment : 'left',
thumbnailBorderHorizontal : 0,
thumbnailBorderVertical : 0,
thumbnailGutterWidth : '10 XS10 SM10',
thumbnailGutterHeight : '10 XS10 SM10',
// THUMBNAIL TOOLS & LABEL
thumbnailLabel : {
display : true,
position : 'onBottom',
align : 'left'
},
thumbnailToolbarImage : {
bottomLeft : 'display'
},
// replace the default DISPLAY tool icon
icons : {
thumbnailDisplay : '<i class="fa fa-long-arrow-right" aria-hidden="true"></i> display'
},
// DISPLAY ANIMATION
galleryDisplayTransition : 'slideUp',
galleryDisplayTransitionDuration : 1000,
thumbnailDisplayTransition : 'scaleDown',
thumbnailDisplayTransitionDuration : 300,
thumbnailDisplayInterval : 50,
// THUMBNAIL'S HOVER ANIMATION
//thumbnailBuildInit2 : 'tools_font-size_1.5em|title_font-size_1.5em',
thumbnailHoverEffect2 : 'imageScaleIn80|tools_opacity_0_1|tools_translateX_-30px_0px|title_opacity_1_0|title_translateX_0px_-30px',
touchAnimation : true,
touchAutoOpenDelay : 800,
// GALLERY THEME
galleryTheme : {
thumbnail : {
borderRadius : '2px !important',
background : '#ffffff !important',
titleShadow : 'none !important',
titleColor : '#696969 !important',
labelBackground : '#f3f3f3 !important'
},
thumbnailIcon : {
color : '#000',
shadow : 'none'
},
},
viewerToolbar : {
display : true,
standard : 'minimizeButton, label',
minimized : 'minimizeButton, label, fullscreenButton, downloadButton'
},
viewerTools : {
topLeft : 'pageCounter',
topRight : 'playPauseButton, zoomButton, fullscreenButton, downloadButton, closeButton'
},
// DEEP LINKING
locationHash : false,
items : json_array_images
})
clearInterval(waitForJQuery);
}
}, 200);
}-*/;
/**
* Gets the gallery panel.
*
* @return the gallery panel
*/
public HTMLPanel getGalleryPanel() {
return galleryPanel;
}
/**
* Fill gallery.
*/
public void fillGallery() {
JSONArray jsonArray = new JSONArray();
int index = 0;
for (SubDocumentView subdoc : sectionView.getListSubDocuments()) {
JSONValue meta = JSONParser.parseStrict(subdoc.getMetadataAsJSON());
for (FilesetDV image : subdoc.getListImages()) {
try {
if (image.getListPayload() != null) {
for (PayloadDV payloadDV : image.getListPayload()) {
JSONObject json = new JSONObject();
json.put("src", new JSONString(payloadDV.getLink()));
json.put("srct", new JSONString(payloadDV.getLink()));
json.put("downloadURL", new JSONString(payloadDV.getLink()));
try {
json.put("title", new JSONString(getFirstValueOfJSON(meta)));
} catch (Exception e) {
GWT.log("Error on reading the title from: " + meta);
json.put("title", new JSONString(meta.toString()));
}
json.put("description", new JSONString(meta.toString()));
jsonArray.set(jsonArray.size(), json);
index++;
}
}
} catch (Exception e) {
GWT.log("Error on adding the image to gallery from: " + image);
}
}
}
if(jsonArray.size()>0) {
showGallery(jsonArray.getJavaScriptObject(), galleryDivId);
}
}
/**
* Gets the first value of JSON.
*
* @param metadata the metadata
* @return the first value of JSON
*/
public String getFirstValueOfJSON(JSONValue metadata) {
String value = "";
if (metadata == null)
return value;
if (metadata.isArray() != null) {
JSONArray array = (JSONArray) metadata;
for (int i = 0; i < array.size(); i++) {
JSONObject object = (JSONObject) array.get(i);
Set<String> set = object.keySet();
value = object.get(set.iterator().next()).toString();
}
} else if (metadata.isObject() != null) {
JSONObject object = (JSONObject) metadata;
Set<String> set = object.keySet();
value = object.get(set.iterator().next()).toString();
} else if (metadata.isString() != null) {
value = metadata.toString();
}
return value;
}
}

View File

@ -1,227 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.layers;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.BBOXDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.SubDocumentView;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.PLACE;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.DropdownButton;
import com.github.gwtbootstrap.client.ui.NavLink;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
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.ui.Composite;
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 ol.Coordinate;
public class LayersSectionViewer extends Composite {
private static LayersSectionViewerUiBinder uiBinder = GWT.create(LayersSectionViewerUiBinder.class);
interface LayersSectionViewerUiBinder extends UiBinder<Widget, LayersSectionViewer> {
}
@UiField
HTMLPanel layerPanel;
@UiField
HTMLPanel mapViewPanel;
private static enum IMAGE_EXPORT_AS {
PNG, JPEG
};
int downloadAttempt = 0;
private GCubeSDIViewerLayerDV layer;
private SubDocumentView subDocumentView;
public LayersSectionViewer(GCubeSDIViewerLayerDV layer, SubDocumentView subDocumentView) {
initWidget(uiBinder.createAndBindUi(this));
GWT.log("Showing: " + layer);
this.layer = layer;
this.subDocumentView = subDocumentView;
String wmsLink = null;
try {
wmsLink = layer.getWMSLink();
} catch (Exception e) {
return;
}
if (wmsLink == null) {
GeoportalDataViewerConstants.printJs("Wms link is null");
return;
}
String layerName = URLUtil.extractValueOfParameterFromURL("layers", wmsLink);
GWT.log("WMS LINK: " + wmsLink);
GWT.log("layerName: " + layerName);
DropdownButton exportMapButton = new DropdownButton("Export Map as...");
exportMapButton.setType(ButtonType.LINK);
exportMapButton.setIcon(IconType.DOWNLOAD_ALT);
exportMapButton.setTitle("Export the map view (OSM + layer) as an image...");
Style exportStyle = exportMapButton.getElement().getStyle();
// exportStyle.setWidth(100, Unit.PCT);
exportStyle.setMarginLeft(70, Unit.PCT);
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857);
MapView mapView = new MapView(transformedCenterCoordinate,
GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px");
mapViewPanel.add(mapView);
mapViewPanel.add(exportMapButton);
String mapServerHost = wmsLink.contains("?") ? wmsLink.substring(0, wmsLink.indexOf("?")) : wmsLink;
GWT.log("mapServerHost: " + mapServerHost);
BBOXDV bbox = layer.getBbox();
try {
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());
}
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);
}
} catch (Exception e) {
Alert alert = new Alert();
alert.setType(AlertType.ERROR);
alert.setHTML("Error on adding the layer to Map. Please check its WMS link: <br/>"+layer.getWMSLink());
alert.getElement().getStyle().setProperty("wordBreak", "break-all");
alert.setClose(false);
layerPanel.add(alert);
}
String htmlLinkId = mapView.getPanelMapElementId() + "-image-download";
for (IMAGE_EXPORT_AS exportType : IMAGE_EXPORT_AS.values()) {
NavLink navLink = new NavLink(exportType.name());
String exportExt = exportType.name().toLowerCase();
String filename = layerName + "." + exportExt;
String mimeType = "image/" + exportExt;
final HTML htmlLink = new HTML("<a id=\"" + htmlLinkId + "\" download=\"" + filename + "\"></a>");
navLink.getElement().appendChild(htmlLink.getElement());
navLink.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
downloadAttempt++;
if (downloadAttempt > 3) {
Window.alert("LOOP");
return;
}
// DOWNLOAD the OSM + layer by canvas
downloadMap(mapView.getLightOLM().getMap(), mapView.getPanelMapElementId(), htmlLinkId, filename,
mimeType);
}
});
exportMapButton.add(navLink);
}
if (subDocumentView.getMetadataAsJSON() != null) {
String table = GeoportalDataViewerConstants.jsonToTableHTML(subDocumentView.getMetadataAsJSON());
layerPanel.add(new HTML(table));
}
}
public static native void exportPDF(String layerURL) /*-{
var image = new Image(layerURL);
var doc = new $wnd.jspdf.jsPDF();
doc.addImage(layerURL, 'PNG', 0, 0, image.width, image.height);
doc.save("map.pdf")
}-*/;
/**
* Prints the.
*
* @param msg the msg
*/
public static native void downloadMap(ol.Map map, String mapPanelId, String linkId, String filename,
String mimeType)/*-{
//console.log("map: " + map);
map.once('rendercomplete', function() {
var mapCanvas = $doc.createElement('canvas');
var size = map.getSize();
mapCanvas.width = size[0];
mapCanvas.height = size[1];
var mapContext = mapCanvas.getContext('2d');
var mapContainer = $doc.querySelector('#' + mapPanelId);
//console.log("mapContainer:" +JSON.stringify(mapContainer, null, 4));
Array.prototype.forEach.call(mapContainer
.querySelectorAll('.ol-layer canvas'), function(canvas) {
if (canvas.width > 0) {
var opacity = canvas.parentNode.style.opacity;
mapContext.globalAlpha = opacity === '' ? 1
: Number(opacity);
var transform = canvas.style.transform;
// Get the transform parameters from the style's transform matrix
var matrix = transform.match(/^matrix\(([^\(]*)\)$/)[1]
.split(',').map(Number);
// Apply the transform to the export map context
CanvasRenderingContext2D.prototype.setTransform.apply(
mapContext, matrix);
mapContext.drawImage(canvas, 0, 0);
}
});
if (navigator.msSaveBlob) {
// link download attribute does not work on MS browsers
navigator.msSaveBlob(mapCanvas.msToBlob(), filename);
} else {
var link = $doc.getElementById(linkId);
link.href = mapCanvas.toDataURL(mimeType);
link.click();
}
});
map.renderSync();
}-*/;
}

View File

@ -1,85 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project;
import java.util.Map.Entry;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
public class ProjectUtil {
public static <T extends DocumentDV> String toHMLCode(T document, String projectID) {
String htmlCode = "";
if (document == null)
return htmlCode;
Entry<String, Object> firstEntrySet = document.getFirstEntryOfMap();
if (firstEntrySet != null) {
htmlCode += firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b>";
}
if (projectID != null) {
htmlCode += " (id: " + projectID + ")";
}
return htmlCode;
}
public static <T extends DocumentDV> String toHMLCode(boolean showkey, T document, String projectID) {
String htmlCode = "";
if (document == null)
return htmlCode;
Entry<String, Object> firstEntrySet = document.getFirstEntryOfMap();
if (firstEntrySet != null) {
htmlCode += showkey ? firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b>"
: firstEntrySet.getValue();
}
if (projectID != null) {
htmlCode += " (id: " + projectID + ")";
}
return htmlCode;
}
public static <T extends DocumentDV> String toHMLCode(T document) {
String htmlCode = "";
if (document == null)
return htmlCode;
Entry<String, Object> firstEntrySet = document.getFirstEntryOfMap();
if (firstEntrySet != null) {
htmlCode += firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b>";
}
return htmlCode;
}
public static String toHTMLCode(TemporalReferenceDV tempRef) {
String htmlCode = "<span class='display-date'>";
if (tempRef != null) {
String dateToString = "";
if (tempRef.getStart() != null) {
dateToString += GeoportalDataViewerConstants.DATE_TIME_FORMAT.format(tempRef.getStart());
}
dateToString += " / ";
if (tempRef.getStart() != null) {
dateToString += GeoportalDataViewerConstants.DATE_TIME_FORMAT.format(tempRef.getEnd());
}
htmlCode += dateToString;
}
htmlCode += "</span>";
return htmlCode;
}
}

View File

@ -1,359 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import org.gcube.application.geoportalcommon.shared.geoportal.view.SectionView;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddLayerToMapEvent;
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.gis.MapUtils;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.ModalWindow;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.dialogs.DialogShareableLink;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.PLACE;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.UListElement;
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.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Random;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
import ol.Coordinate;
/**
* The Class ProjectViewer.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 9, 2022
*/
public class ProjectViewer extends Composite {
private static ProjectViewerUiBinder uiBinder = GWT.create(ProjectViewerUiBinder.class);
/**
* The Interface ProjectViewerUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 9, 2022
*/
interface ProjectViewerUiBinder extends UiBinder<Widget, ProjectViewer> {
}
@UiField
HTMLPanel headerPanel;
@UiField
HTMLPanel pageViewDetails;
@UiField
HTMLPanel projectViewerMainPanel;
@UiField
HTMLPanel centroidPanel;
@UiField
HTMLPanel tableOfContentPanel;
@UiField
Button shareButton;
@UiField
Button expandButton;
@UiField
Button relationshipsButton;
@UiField
Button addLayersToMap;
@UiField
HTMLPanel toc_container;
@UiField
HTMLPanel toc_list_container;
@UiField
Button reduceToc;
@UiField
UListElement toc_list_anchors;
private ProjectView theProjectView;
private GeoportalItemReferences geoportalItemReferences;
private String myLogin;
private HandlerManager applicationBus;
private String projectViewerMainPanelID;
/**
* Instantiates a new project viewer.
*/
private ProjectViewer() {
initWidget(uiBinder.createAndBindUi(this));
pageViewDetails.getElement().addClassName("page-view-details");
projectViewerMainPanelID = "projectViewer-" + Random.nextInt();
projectViewerMainPanel.getElement().setId(projectViewerMainPanelID);
}
/**
* Instantiates a new project viewer.
*
* @param applicationBus the application bus
* @param geoportalItemRefs the geoportal item refs
* @param projectView the project view
*/
public ProjectViewer(HandlerManager applicationBus, GeoportalItemReferences geoportalItemRefs,
final ProjectView projectView) {
this();
GWT.log("Rendering " + projectView.getTheProjectDV().getId());
this.theProjectView = projectView;
this.geoportalItemReferences = geoportalItemRefs;
this.applicationBus = applicationBus;
final String theTitle = projectView.getTheProjectDV().getProfileName() != null
? projectView.getTheProjectDV().getProfileName()
: "Project ID: " + projectView.getTheProjectDV().getId();
headerPanel.add(new HTML(theTitle));
shareButton.setType(ButtonType.LINK);
shareButton.setIcon(IconType.SHARE);
shareButton.setTitle("Get a link to share with...");
shareButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
DialogShareableLink dg = new DialogShareableLink(geoportalItemReferences, null);
}
});
expandButton.setType(ButtonType.LINK);
expandButton.setIcon(IconType.EXPAND);
expandButton.setTitle("Show this view in new Window");
expandButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
ProjectViewer cv = new ProjectViewer(applicationBus, geoportalItemReferences, theProjectView);
cv.setExpandViewButtonVisible(false);
cv.setRelationshipsButtonVisible(false);
cv.setAddLayersToMapVisible(false);
cv.setTocContentVisible(true);
int width = Window.getClientWidth() * 75 / 100;
int height = Window.getClientHeight() * 70 / 100;
String modalTitle = ProjectUtil.toHMLCode(false, theProjectView.getTheProjectDV().getTheDocument(),
theProjectView.getTheProjectDV().getId());
ModalWindow mw = new ModalWindow(modalTitle, width, height);
mw.add(cv);
mw.setCaller(ProjectViewer.this);
// mw.setWidth(900);
mw.show();
}
});
relationshipsButton.setType(ButtonType.LINK);
relationshipsButton.setIcon(IconType.LINK);
relationshipsButton.setTitle("Show Relationships of this Project");
List<RelationshipDV> relationships = projectView.getTheProjectDV().getRelationships();
if (relationships != null && relationships.size() > 0) {
relationshipsButton.setVisible(true);
} else {
relationshipsButton.setVisible(false);
}
relationshipsButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
applicationBus.fireEvent(
new TimelineProjectRelationsEvent(theProjectView.getTheProjectDV(), EVENT_TYPE.SHOW));
}
});
addLayersToMap.setType(ButtonType.LINK);
addLayersToMap.setIcon(IconType.MAP_MARKER);
addLayersToMap.setTitle("Add the layer/s of the Project to principal Map");
addLayersToMap.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
applicationBus.fireEvent(new AddLayerToMapEvent(theProjectView.getTheProjectDV(), true));
}
});
setAddLayersToMapVisible(false);
GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() {
@Override
public void onSuccess(String result) {
myLogin = result;
addCentroidMap();
}
@Override
public void onFailure(Throwable caught) {
}
});
reduceToc.setType(ButtonType.LINK);
reduceToc.setIcon(IconType.PLUS_SIGN_ALT);
toc_list_container.setVisible(false);
reduceToc.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
boolean visible = toc_list_container.isVisible();
setTocContentVisible(!visible);
// if (visible) {
// toc_list_container.setVisible(false);
// reduceToc.setIcon(IconType.PLUS_SIGN_ALT);
// } else {
// toc_list_container.setVisible(true);
// reduceToc.setIcon(IconType.MINUS_SIGN_ALT);
// }
}
});
for (SectionView sectionView : projectView.getListSections()) {
if (!sectionView.isEmpty()) {
SectionViewer sectionViewer = new SectionViewer(sectionView, projectViewerMainPanelID);
String sectionId = sectionView.getSectionTitle().replaceAll("[^A-Za-z0-9]", "-") + "_"
+ Random.nextInt();
String divTarget = "<div class='anchor-target' id='" + sectionId + "'></div>";
sectionViewer.getElement().insertFirst(new HTML(divTarget).getElement());
addAnchorToSection(sectionId, sectionView.getSectionTitle());
pageViewDetails.add(sectionViewer);
}
if (sectionView.hasSpatialLayers()) {
setAddLayersToMapVisible(true);
}
}
if (toc_list_anchors.getChildCount() > 0) {
tableOfContentPanel.setVisible(true);
}
}
private void addAnchorToSection(String id, String text) {
String htmlAnchor = "<a href='#" + id + "'>" + text + "</a>";
toc_list_anchors.appendChild(new HTML("<li>" + htmlAnchor + "</li>").getElement());
}
protected void setTocContentVisible(boolean bool) {
toc_list_container.setVisible(bool);
if (bool) {
reduceToc.setIcon(IconType.MINUS_SIGN_ALT);
} else {
reduceToc.setIcon(IconType.PLUS_SIGN_ALT);
}
}
/**
* Adds the centroid map.
*/
private void addCentroidMap() {
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857);
MapView mapView = new MapView(transformedCenterCoordinate,
GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px");
if (theProjectView != null && theProjectView.getTheProjectDV() != null) {
GeoJSON spatialReference = theProjectView.getTheProjectDV().getSpatialReference();
Coordinate transfCoord = MapUtils.geoJSONToBBOXCenter(spatialReference, MAP_PROJECTION.EPSG_4326.getName(),
MAP_PROJECTION.EPSG_3857.getName());
if (transfCoord != null) {
boolean authenticatedUser = myLogin != null ? true : false;
mapView.addMarker(transfCoord, authenticatedUser);
centroidPanel.add(mapView);
}
} else if (theProjectView != null) {
GeoportalDataViewerConstants
.printJs("I cannot add centroid as maker one or both coordinates are null. Lat: " + theProjectView
+ ", Long:" + theProjectView);
}
}
/**
* Gets the project view.
*
* @return the project view
*/
public ProjectView getProjectView() {
return theProjectView;
}
/**
* Sets the expand view button visible.
*
* @param bool the new expand view button visible
*/
protected void setExpandViewButtonVisible(boolean bool) {
expandButton.setVisible(bool);
}
/**
* Sets the adds the layers to map visible.
*
* @param bool the new adds the layers to map visible
*/
protected void setAddLayersToMapVisible(boolean bool) {
addLayersToMap.setVisible(bool);
}
/**
* Sets the relationships button visible.
*
* @param bool the new relationships button visible
*/
protected void setRelationshipsButtonVisible(boolean bool) {
relationshipsButton.setVisible(bool);
}
}

View File

@ -1,66 +0,0 @@
<!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>
.margin-left-10 {
margin-left: 10px;
}
.font-size-h1-22 h1 {
font-size: 22px;
}
.align-to-right {
right: 20px;
position: absolute;
top: 20px !important;
}
.the-title {
background-color: rgba(0, 60, 136, .7);
color: white;
padding: 10px 10px;
font-size: 14px;
padding-left: 40px;
}
.width-100 {
width: 100%;
}
.display-item-list {
display: inline-table;
}
</ui:style>
<g:HTMLPanel ui:field="projectViewerMainPanel">
<!-- <g:HTMLPanel ui:field="sharePanel" -->
<!-- addStyleNames="{style.align-to-right}"> -->
<!-- </g:HTMLPanel> -->
<g:HTMLPanel ui:field="headerPanel"
addStyleNames="{style.the-title}"></g:HTMLPanel>
<g:HTMLPanel ui:field="pageViewDetails">
<g:HorizontalPanel
addStyleNames="functionalities-style">
<b:Button ui:field="shareButton">Share</b:Button>
<b:Button ui:field="expandButton">Expand</b:Button>
<b:Button ui:field="relationshipsButton">Relationships</b:Button>
<b:Button ui:field="addLayersToMap">Add Layers to Map</b:Button>
</g:HorizontalPanel>
<g:HTMLPanel ui:field="centroidPanel"></g:HTMLPanel>
<g:HTMLPanel ui:field="tableOfContentPanel"
visible="false" addStyleNames="{style.display-item-list}">
<g:HTMLPanel ui:field="toc_container"
addStyleNames="toc_container">
<b:Button ui:field="reduceToc"
addStyleNames="toc_container_reduce_button"></b:Button>
<div class="toc_title">Contents</div>
<g:HTMLPanel ui:field="toc_list_container" addStyleNames="toc_list_container">
<ul ui:field="toc_list_anchors"></ul>
</g:HTMLPanel>
</g:HTMLPanel>
</g:HTMLPanel>
</g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,163 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.FilesetDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.SectionView;
import org.gcube.application.geoportalcommon.shared.geoportal.view.SubDocumentView;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.gallery.ImagesSectionGallery;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.layers.LayersSectionViewer;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.PageHeader;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
public class SectionViewer extends Composite {
private static SectionViewerUiBinder uiBinder = GWT.create(SectionViewerUiBinder.class);
interface SectionViewerUiBinder extends UiBinder<Widget, SectionViewer> {
}
private SectionView sectionView;
@UiField
HTMLPanel sectionPanelContainer;
@UiField
PageHeader sectionTitle;
public SectionViewer(SectionView sectionView, String topTargetId) {
initWidget(uiBinder.createAndBindUi(this));
this.sectionView = sectionView;
List<SubDocumentView> subDocuments = sectionView.getListSubDocuments();
sectionTitle.setTitle(sectionView.getSectionTitle());
sectionTitle.setText(sectionView.getSectionTitle());
if (subDocuments == null)
return;
Button goToTop = new Button("");
goToTop.setType(ButtonType.LINK);
goToTop.setIcon(IconType.DOUBLE_ANGLE_UP);
goToTop.setHref("#" + topTargetId);
goToTop.setTitle("Go to top");
goToTop.getElement().setClassName("go-top-right");
sectionTitle.add(goToTop);
boolean displayAsGallery = false;
try {
for (SubDocumentView subDocumentView : subDocuments) {
if (subDocumentView.getListImages() != null && subDocumentView.getListImages().size() > 0) {
GWT.log("Section with images: " + subDocumentView.getListImages());
displayAsGallery = true;
break;
}
}
boolean displayAsMapOfLayers = false;
for (SubDocumentView subDocumentView : subDocuments) {
if (subDocumentView.getListLayers() != null && subDocumentView.getListLayers().size() > 0) {
GWT.log("Section with layers: " + subDocumentView.getListImages());
displayAsMapOfLayers = true;
break;
}
}
// Displaying the whole section as a Gallery
if (displayAsGallery) {
GWT.log("displayAsGallery the: " + sectionView);
ImagesSectionGallery sectionGallery = new ImagesSectionGallery(sectionView);
sectionPanelContainer.add(sectionGallery.getGalleryPanel());
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
sectionGallery.fillGallery();
}
});
// Displaying the whole section as a Map of Layers
} else if (displayAsMapOfLayers) {
GWT.log("displayAsMapOfLayers the: " + sectionView);
for (SubDocumentView subDocumentView : subDocuments) {
// String table = GeoportalDataViewerConstants.jsonToTableHTML(subDocumentView.getMetadataAsJSON());
// sectionPanelContainer.add(new HTML(table));
List<GCubeSDIViewerLayerDV> layers = subDocumentView.getListLayers();
if (layers != null) {
for (GCubeSDIViewerLayerDV gCubeLayer : layers) {
LayersSectionViewer layerSectionViewer = new LayersSectionViewer(gCubeLayer,
subDocumentView);
sectionPanelContainer.add(layerSectionViewer);
// showLinkToDownloadWsContent(fileset.getName(), fileset.getListPayload());
}
}
}
} else {
GWT.log("displaying default the: " + sectionView);
for (SubDocumentView subDocumentView : subDocuments) {
String table = GeoportalDataViewerConstants.jsonToTableHTML(subDocumentView.getMetadataAsJSON());
sectionPanelContainer.add(new HTML(table));
List<FilesetDV> files = subDocumentView.getListFiles();
if (files != null) {
for (FilesetDV fileset : files) {
showLinkToDownloadWsContent(fileset.getGcubeProfileFieldName(), fileset.getListPayload());
}
}
}
}
} catch (Exception e) {
GWT.log("Error on rendering the section: "+e.getMessage());
}
}
private void showLinkToDownloadWsContent(String title, List<PayloadDV> listPayloads) {
if (listPayloads != null) {
CustomFlexTable customTable = new CustomFlexTable();
int i = 0;
String fieldLabel = title;
for (PayloadDV payload : listPayloads) {
if (i > 0) {
fieldLabel = "";
}
String downloadLabel = "download";
if (payload.getName() != null) {
downloadLabel = payload.getName();
}
customTable.addNextKeyWidget(fieldLabel,
new HTML("<a href=\"" + payload.getLink() + "\">" + downloadLabel + "</a>"));
}
sectionPanelContainer.add(customTable);
}
}
}

View File

@ -1,39 +0,0 @@
<!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>
.margin-left-10 {
margin-left: 10px;
}
.font-size-h1-22 h1 {
font-size: 22px;
margin-top: 5px;
}
.align-to-right {
right: 20px;
position: absolute;
}
.the-title h1 {
font-size: 28px;
}
.margin-bottom-10 {
margin-bottom: 10px;
}
.width-100 {
width: 100%;
}
</ui:style>
<g:HTMLPanel ui:field="sectionPanelContainer">
<g:HTMLPanel
addStyleNames="{style.margin-left-10}">
<b:PageHeader addStyleNames="{style.font-size-h1-22}" ui:field="sectionTitle"></b:PageHeader>
</g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,50 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil;
import com.github.gwtbootstrap.client.ui.Column;
import com.google.gwt.core.client.GWT;
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.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
public class RelationshipPanel extends Composite {
private static ViewRelationshipPanelUiBinder uiBinder = GWT.create(ViewRelationshipPanelUiBinder.class);
interface ViewRelationshipPanelUiBinder extends UiBinder<Widget, RelationshipPanel> {
}
@UiField
HTMLPanel rootRow;
@UiField
Column leftChildColumn;
@UiField
Column rightChildColumn;
private HandlerManager appManagerBus;
public RelationshipPanel(HandlerManager appManagerBus, ProjectDV fromProject, List<ProjectDV> relationships) {
initWidget(uiBinder.createAndBindUi(this));
this.appManagerBus = appManagerBus;
String html = ProjectUtil.toHMLCode(false, fromProject.getTheDocument(), fromProject.getId());
rootRow.add(new HTML(html));
showRelationsOf(fromProject);
}
public void showRelationsOf(ProjectDV project) {
}
}

View File

@ -1,23 +0,0 @@
<!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>
</ui:style>
<g:HTMLPanel>
<b:Row ui:field="rootRow">
<b:FlowPanel ui:field="rootPanel"></b:FlowPanel>
</b:Row>
<b:Row>
<b:Column size="4">
<b:FlowPanel ui:field="leftChildPanel"></b:FlowPanel>
</b:Column>
<b:Column size="4">
<b:FlowPanel ui:field="rightChildPanel"></b:FlowPanel>
</b:Column>
</b:Row>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,100 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.ui.RootPanel;
public class TimelineManagerStatus {
private HandlerManager applicationBus;
private TimelineStatus status;
public TimelineManagerStatus(HandlerManager applicationBus) {
this.applicationBus = applicationBus;
}
protected TimelineStatus getTimelineOf(ProjectDV theProject) {
if (status == null) {
status = new TimelineStatus(true, new TimelineRelationPanel(applicationBus, theProject), theProject);
GWT.log("Displaying new Timeline of " + status);
return status;
} else {
boolean c1 = status.getTheProjectDV().getId().compareTo(theProject.getId()) == 0;
boolean c2 = status.getTheProjectDV().getProfileID().compareTo(theProject.getProfileID()) == 0;
if (!c1 || !c2) {
GWT.log("Displaying Timeline of " + status);
status = new TimelineStatus(true, new TimelineRelationPanel(applicationBus, theProject), theProject);
return status;
}
status.statusChanged(false);
GWT.log("Skipping already displayed Timeline of " + status);
return status;
}
}
public void showTimelineProjectRelations(ProjectDV theProject, boolean showNotify) {
GWT.log("Showing project relations for: " + theProject);
TimelineStatus timelineStatus = getTimelineOf(theProject);
if (timelineStatus.isStatusChanged()) {
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).clear();
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).add(timelineStatus.getTimelineRP());
} else if (showNotify) {
GeoportalDataViewer.showPopover(RootPanel.get(GeoportalDataViewer.APP_NOTIFIER),
"Timeline from the selected project is already displayed", "Timeline displayed");
}
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).setVisible(true);
timelineStatus.getTimelineRP().setTimelineContainerVisible(true);
}
public void hideTimelineProjectRelations() {
GWT.log("hideTimelineProjectRelations");
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).setVisible(false);
// RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).clear();
}
public class TimelineStatus {
public boolean statusChanged = false;
private TimelineRelationPanel timelineRP;
private ProjectDV theProjectDV;
public TimelineStatus(boolean statusChanged, TimelineRelationPanel timelineRP, ProjectDV theProjectDV) {
this.statusChanged = statusChanged;
this.timelineRP = timelineRP;
this.theProjectDV = theProjectDV;
}
public void statusChanged(boolean bool) {
this.statusChanged = bool;
}
public boolean isStatusChanged() {
return statusChanged;
}
public TimelineRelationPanel getTimelineRP() {
return timelineRP;
}
public ProjectDV getTheProjectDV() {
return theProjectDV;
}
}
}

View File

@ -1,196 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent.EVENT_SOURCE;
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.Style.TextAlign;
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.json.client.JSONArray;
import com.google.gwt.json.client.JSONParser;
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.Anchor;
import com.google.gwt.user.client.ui.Composite;
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.ScrollPanel;
import com.google.gwt.user.client.ui.Widget;
public class TimelineRelationPanel extends Composite {
@UiField
ScrollPanel timelineContainer;
@UiField
HTMLPanel timelineHeader;
@UiField
Anchor timelinePopupCloser;
private LoaderIcon loaderData = new LoaderIcon("Loading data... please wait",
new Image(GNAImages.ICONS.spinnerClock()));
private TimelineRelationPanel instance = this;
private String selectedTimelineProjectID;
private ProjectDV theProjectDV;
private HandlerManager applicationBus;
private static TimelineRelationPanelUiBinder uiBinder = GWT.create(TimelineRelationPanelUiBinder.class);
interface TimelineRelationPanelUiBinder extends UiBinder<Widget, TimelineRelationPanel> {
}
public TimelineRelationPanel(HandlerManager applicationBus, ProjectDV theProjectDV) {
initWidget(uiBinder.createAndBindUi(this));
this.theProjectDV = theProjectDV;
this.applicationBus = applicationBus;
String html = ProjectUtil.toHMLCode(theProjectDV.getTheDocument());
HTML title = new HTML("Relationships of the Project" + " <br>" + html);
timelineHeader.add(title);
timelineContainer.getElement().setId("timeline-content");
timelineHeader.getElement().setId("timeline-header");
loaderData.getElement().getStyle().setTextAlign(TextAlign.CENTER);
timelineContainer.getElement().setId("visualization");
timelineContainer.add(loaderData);
timelinePopupCloser.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if (timelineContainer.isVisible())
setTimelineContainerVisible(false);
else
setTimelineContainerVisible(true);
}
});
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
GeoportalDataViewerServiceAsync.Util.getInstance().getRelationshipsForTimeline(
theProjectDV.getProfileID(), theProjectDV.getId(), new AsyncCallback<List<String>>() {
@Override
public void onSuccess(List<String> result) {
timelineContainer.remove(loaderData);
JSONArray toJsonArr = new JSONArray();
for (int i = 0; i < result.size(); i++) {
toJsonArr.set(i, JSONParser.parseStrict(result.get(i)));
}
instanceTimeline(timelineContainer.getElement().getId(), toJsonArr, instance);
}
@Override
public void onFailure(Throwable caught) {
timelineContainer.remove(loaderData);
Alert alert = new Alert(caught.getMessage());
alert.setType(AlertType.ERROR);
alert.setClose(false);
timelineHeader.add(alert);
}
});
};
});
}
public void setTimelineContainerVisible(boolean bool) {
timelineContainer.setVisible(bool);
}
/*
* Called when a project (box) is clicked into Timeline
*/
private void setSelectedProject(String theComposedProjectID) {
this.selectedTimelineProjectID = theComposedProjectID;
//selectedTimelineProjectID is the couple ProfileID,ProjectID
GWT.log("selectedTimelineProjectID: " + selectedTimelineProjectID);
if (selectedTimelineProjectID == null || selectedTimelineProjectID.isEmpty())
return;
String[] references = this.selectedTimelineProjectID.split(",");
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.setEventFromTimeline(true);
GWT.log("fireEvent: " + showDetailsEvent);
applicationBus.fireEvent(showDetailsEvent);
}
public String getSelectedProjectID() {
return selectedTimelineProjectID;
}
public static native String instanceTimeline(String idDivContainer, JSONArray jsonItems,
TimelineRelationPanel instance) /*-{
console.log('showing timeline');
//console.log('showTimeline_instanceTimeline for json items: '+jsonItems);
//console.log("showTimeline_template: " + $wnd.templateHandlebars);
// DOM element where the Timeline will be attached
var container = $doc.getElementById(idDivContainer);
//console.log("showTimeline_container: " + container);
var myArray = $wnd.JSON.parse(jsonItems);
//console.log("showTimeline_jsonItems: " + myArray);
var container = $doc.getElementById(idDivContainer);
// Create a DataSet (allows two way data-binding)
var items = new $wnd.vis.DataSet(myArray);
// Create a Timeline
var timeline = new $wnd.vis.Timeline(container, items,
$wnd.optionsTimeline);
timeline
.on(
'select',
function(properties, items) {
//console.log('selected: ' + $wnd.JSON.stringify(properties));
console.log('selected items: ' + properties.items);
instance.@org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation.TimelineRelationPanel::setSelectedProject(Ljava/lang/String;)(properties.items+'')
});
//timeline.redraw();
}-*/;
}

View File

@ -1,17 +0,0 @@
<!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">
<ui:style>
.important {
font-weight: bold;
}
</ui:style>
<g:HTMLPanel addStyleNames="timeline-popup">
<g:HTMLPanel ui:field="timelineHeader"
addStyleNames="timeline-popup-header">
<g:Anchor href="#" ui:field="timelinePopupCloser" addStyleNames="timeline-popup-closer"></g:Anchor>
</g:HTMLPanel>
<g:ScrollPanel ui:field="timelineContainer"
addStyleNames="timeline-popup-content"></g:ScrollPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,198 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Label;
import com.github.gwtbootstrap.client.ui.Modal;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconSize;
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.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
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.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.Widget;
public class ViewRelationshipPanel extends Composite {
private static ViewRelationshipPanelUiBinder uiBinder = GWT.create(ViewRelationshipPanelUiBinder.class);
interface ViewRelationshipPanelUiBinder extends UiBinder<Widget, ViewRelationshipPanel> {
}
private String profileID;
@UiField
HTMLPanel firstPanelContainer;
@UiField
HTMLPanel panelTitle;
@UiField
HTMLPanel secondPanelContainer;
@UiField
FlowPanel firstProjectPanelContainer;
@UiField
FlowPanel secondProjectPanelContainer;
@UiField
Button closeButton;
@UiField
Button buttonExpand;
private HashMap<Integer, ResultDocumentDV> selectedProjects = new HashMap<Integer, ResultDocumentDV>(2);
private HandlerManager appManagerBus;
private Map<String, ResultDocumentDV> mapOfTargetProjectForId = new HashMap<String, ResultDocumentDV>();
public ViewRelationshipPanel(HandlerManager appManagerBus, ProjectDV fromProject, boolean showExpand) {
initWidget(uiBinder.createAndBindUi(this));
this.appManagerBus = appManagerBus;
closeButton.setType(ButtonType.LINK);
closeButton.setIcon(IconType.REMOVE);
closeButton.setIconSize(IconSize.LARGE);
closeButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
}
});
buttonExpand.setType(ButtonType.LINK);
buttonExpand.setIcon(IconType.EXPAND);
buttonExpand.setTitle("Show this view in new Window");
buttonExpand.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Modal mw = new Modal(true, true);
mw.setTitle("Relationships");
int width = 0;
try {
width = Window.getClientWidth() * 75 / 100;
} catch (Exception e) {
// TODO: handle exception
}
if (width > 500)
mw.setWidth(width);
mw.add(new ViewRelationshipPanel(appManagerBus, fromProject, false));
mw.show();
}
});
if (!showExpand) {
buttonExpand.setVisible(false);
panelTitle.setVisible(false);
closeButton.setVisible(false);
}
showRelationsOf(fromProject);
}
public void showRelationsOf(ProjectDV project) {
firstProjectPanelContainer.clear();
secondProjectPanelContainer.clear();
Entry<String, Object> firstEntrySet = project.getTheDocument().getFirstEntryOfMap();
String htmlMsg = firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b> (id: " + project.getId()
+ ")";
firstProjectPanelContainer.add(new HTML(htmlMsg));
HTML labelNoRelations = new HTML("No relationship/s found");
secondProjectPanelContainer.add(labelNoRelations);
if (project.getRelationships() != null && project.getRelationships().size() > 0) {
secondProjectPanelContainer.clear();
for (RelationshipDV relationDV : project.getRelationships()) {
final FlexTable flexTable = new FlexTable();
flexTable.getElement().addClassName("box-table-diplay-project");
Label label = new Label();
label.setType(LabelType.INFO);
label.setText(relationDV.getRelationshipName());
FlowPanel panelContainer = new FlowPanel();
Button deleteRelation = new Button("", IconType.SAVE);
deleteRelation.setTitle("Open this project");
deleteRelation.setType(ButtonType.LINK);
deleteRelation.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
ResultDocumentDV toProject = mapOfTargetProjectForId.get(relationDV.getTargetUCD());
// appManagerBus.fireEvent(
// new RelationActionHandlerEvent(project, relationDV.getRelationshipName(), toProject));
}
});
panelContainer.add(label);
panelContainer.add(deleteRelation);
flexTable.setWidget(0, 0, panelContainer);
// flexTable.setWidget(1, 0, new LoaderIcon("loading project.."));
// GeoportalDataEntryServiceAsync.Util.getInstance().getResultDocumentFoProjectByID(
// relationDV.getTargetUCD(), relationDV.getTargetID(), new AsyncCallback<ResultDocumentDV>() {
//
// @Override
// public void onFailure(Throwable caught) {
// flexTable.setWidget(1, 0, new HTML(caught.getMessage()));
//
// }
//
// @Override
// public void onSuccess(ResultDocumentDV result) {
// mapOfTargetProjectForId.put(relationDV.getTargetUCD(), result);
// Entry<String, Object> firstEntrySet = result.getFirstEntryOfMap();
// String htmlMsg = firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue()
// + "</b> (id: " + result.getId() + ")";
//
// flexTable.setWidget(1, 0, new HTML(htmlMsg));
//
// ReportTemplateToHTML rtth2 = new ReportTemplateToHTML("", result.getDocumentAsJSON(),
// false, false);
// rtth2.showAsJSON(false);
//
// flexTable.setWidget(2, 0, rtth2);
// }
// });
secondProjectPanelContainer.add(flexTable);
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More