diff --git a/.classpath b/.classpath index 1b3eb3f..3f84059 100644 --- a/.classpath +++ b/.classpath @@ -1,12 +1,12 @@ - + - + @@ -35,5 +35,5 @@ - + diff --git a/.settings/com.gwtplugins.gdt.eclipse.core.prefs b/.settings/com.gwtplugins.gdt.eclipse.core.prefs index aaa6c87..4c65c64 100644 --- a/.settings/com.gwtplugins.gdt.eclipse.core.prefs +++ b/.settings/com.gwtplugins.gdt.eclipse.core.prefs @@ -1,4 +1,4 @@ eclipse.preferences.version=1 -lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-2.0.0 +lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-2.1.0-SNAPSHOT warSrcDir=src/main/webapp warSrcDirIsOutput=false diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 66ff2c7..af45588 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,21 +1,41 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CHANGELOG.md b/CHANGELOG.md index 841bfca..95a8e22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ 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). + +## [v2.1.0-SNAPSHOT] - 2021-11-10 + +#### Enhancements + +- [#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 diff --git a/README.md b/README.md index 86ee60d..7ae475e 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ The GeoPortal Data Viewer App is an application to access, discovery and navigat * 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.0.0-gwt2_9. [GWT-OL3](https://github.com/TDesjardins/gwt-ol) +* 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) ## Documentation diff --git a/pom.xml b/pom.xml index 4b017dc..eccb30a 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ org.gcube.portlets.user geoportal-data-viewer-app war - 2.0.1 + 2.1.0-SNAPSHOT GeoPortal Data Viewer App The GeoPortal Data Viewer App is an application to access, discovery and navigate the GeoNa products by a Web-Map Interface @@ -122,7 +122,7 @@ com.github.tdesjardins gwt-ol3 - 8.0.0-gwt2_9 + 8.1.0-gwt2_9 com.github.gwtbootstrap diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java index d0ddc0b..9dd16d9 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java @@ -1,6 +1,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client; import java.util.Iterator; +import java.util.List; import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile; import org.gcube.application.geoportalcommon.shared.GeoNaItemRef; @@ -12,6 +13,8 @@ import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerCon import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent.LAYER_TYPE; import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler; +import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEvent; +import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEventHandler; import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEventHandler; import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent; @@ -27,9 +30,11 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMini import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEventHandler; 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.OpenLayerOSM; +import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap; import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPanel; +import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon; import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil; +import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery; import com.google.gwt.core.client.EntryPoint; @@ -43,6 +48,7 @@ import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.RootPanel; import ol.Coordinate; @@ -60,7 +66,7 @@ public class GeoportalDataViewer implements EntryPoint { public final static String APP_DIV = "geoportal-data-viewer"; /** The ol map. */ - // private OpenLayerOSM olMap = null; + // private OpenLayerMap olMap = null; /** The main panel. */ private GeonaDataViewMainPanel mainPanel; @@ -88,11 +94,32 @@ public class GeoportalDataViewer implements EntryPoint { private OLMapManager olMapMng = null; int attempt = 0; + + private LoaderIcon loaderApp = new LoaderIcon("Loading application... please wait"); + + private HTML attributionDiv = new HTML(); + + private static List listBaseMapLayers = null; /** * This is the entry point method. */ public void onModuleLoad() { + + loaderApp.getElement().addClassName("loader-gna-app"); + RootPanel.get(APP_DIV).add(loaderApp); + + paramWmsRequest = Window.Location.getParameter(GeoportalDataViewerConstants.GET_WMS_PARAMETER); + paramGeonaItemType = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE); + paramGeonaItemID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID); + paramLayerTitle = Window.Location.getParameter(GeoportalDataViewerConstants.GET_LAYER_TITLE); + GWT.log(GeoportalDataViewerConstants.GET_WMS_PARAMETER + " = " + paramWmsRequest); + GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE + " = " + paramGeonaItemType); + GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID + " = " + paramGeonaItemID); + GWT.log(GeoportalDataViewerConstants.GET_LAYER_TITLE + " = " + paramLayerTitle); + + RootPanel.get(APP_DIV).add(loaderApp); + mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight()); RootPanel.get(APP_DIV).add(mainPanel); @@ -101,13 +128,44 @@ public class GeoportalDataViewer implements EntryPoint { @Override public void execute() { - olMapMng = new OLMapManager(mainPanel.getMapPanel().getElement().getId(), - layerManager.getLayerManagerBus()); - layerManager.setOlMap(olMapMng.getOLOSMMap()); - mainPanel.setMap(olMapMng.getOLOSMMap()); - updateSize(); - ScriptInjector.fromUrl("//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js") - .setWindow(ScriptInjector.TOP_WINDOW).inject(); + //LOADING THE BASE MAP LAYERS + GeoportalDataViewerServiceAsync.Util.getInstance().getListBaseLayers(new AsyncCallback>() { + + @Override + public void onFailure(Throwable caught) { + RootPanel.get(APP_DIV).remove(loaderApp); + Window.alert("Sorry, an error occurred on instancing the GeoPortale Viewer. Please, contact the support"); + } + + @Override + public void onSuccess(List listBaseMapLayers) { + try { + RootPanel.get(APP_DIV).remove(loaderApp); + }catch (Exception e) { + loaderApp.setVisible(false); + } + GeoportalDataViewer.listBaseMapLayers = listBaseMapLayers; + //now the map is loaded and I'm sure that I can load the GeonaDataViewer Profile + loadGeonaDataViewerProfile(); + mainPanel.setBaseLayers(listBaseMapLayers); + + BaseMapLayer firstBaseLayer = listBaseMapLayers.get(0); + //Passing the first base map layer that will be applied as first base layer + olMapMng = new OLMapManager(mainPanel.getMapPanel().getElement().getId(), + layerManager.getLayerManagerBus(), firstBaseLayer); + OpenLayerMap olMap = olMapMng.getOLMap(); + layerManager.setOLMap(olMap); + mainPanel.setMap(olMap); + + updateSize(); + ScriptInjector.fromUrl("//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js") + .setWindow(ScriptInjector.TOP_WINDOW).inject(); + + } + + + }); + } }); @@ -118,28 +176,19 @@ public class GeoportalDataViewer implements EntryPoint { } }); - paramWmsRequest = Window.Location.getParameter(GeoportalDataViewerConstants.GET_WMS_PARAMETER); - paramGeonaItemType = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE); - // paramUUID = - // Window.Location.getParameter(GeoportalDataViewerConstants.GET_UUID_PARAMETER); - paramGeonaItemID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID); - paramLayerTitle = Window.Location.getParameter(GeoportalDataViewerConstants.GET_LAYER_TITLE); - GWT.log(GeoportalDataViewerConstants.GET_WMS_PARAMETER + " = " + paramWmsRequest); - GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE + " = " + paramGeonaItemType); - GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID + " = " + paramGeonaItemID); - // GWT.log(GeoportalDataViewerConstants.GET_UUID_PARAMETER + " = " + paramUUID); - GWT.log(GeoportalDataViewerConstants.GET_LAYER_TITLE + " = " + paramLayerTitle); - - // VALIDATING THE LONG FORMAT FOR GID -// try { -// if (paramGeonaItemID != null) -// Long.parseLong(paramGeonaItemID); -// } catch (Exception e) { -// Window.alert("Bad format for parameter " + GeoportalDataViewerConstants.GET_GEONA_ITEM_ID -// + ". It must be a Long"); -// paramGeonaItemID = null; -// } + + bindEvents(); + + RootPanel.get(APP_DIV).add(attributionDiv); + } + + public static List getListBaseMapLayers() { + return listBaseMapLayers; + } + + private void loadGeonaDataViewerProfile() { + Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override @@ -195,8 +244,7 @@ public class GeoportalDataViewer implements EntryPoint { }); } }); - - bindEvents(); + } /** @@ -271,9 +319,7 @@ public class GeoportalDataViewer implements EntryPoint { @Override public void onLayerRendered(AddedLayerToMapEvent addedLayerToMapEvent) { GWT.log("Fired AddedLayerToMapEvent " + addedLayerToMapEvent.getLayerItem() + "layer type: "+addedLayerToMapEvent.getLayerType()); - // GeoportalDataViewerConstants.print("Fired AddedLayerToMapEvent - // "+addedLayerToMapEvent.getLayerItem()); - + try { attempt = 0; @@ -370,7 +416,7 @@ public class GeoportalDataViewer implements EntryPoint { DO_LAYER_ACTION doAction = doLayerActionEvent.getDoAction(); GWT.log("event: "+doAction); GWT.log("layer source: "+doLayerActionEvent.getLayerItem().getName()); - OpenLayerOSM olMap = olMapMng.getOLOSMMap(); + OpenLayerMap olMap = olMapMng.getOLMap(); switch (doAction) { case OPACITY: @@ -399,6 +445,30 @@ public class GeoportalDataViewer implements EntryPoint { } }); + + + applicationBus.addHandler(ChangeMapLayerEvent.TYPE, new ChangeMapLayerEventHandler() { + + @Override + public void onChangeBaseMapLayer(ChangeMapLayerEvent changeMapLayerEvent) { + + BaseMapLayer baseLayer = changeMapLayerEvent.getBaseMapLayer(); + + if (baseLayer == null) + return; + + String attributionHTML = "
" + + baseLayer.getAttribution() + "
"; + olMapMng.getOLMap().changeBaseMap(baseLayer); + + // THE OSM Contributors are automatically added by gwt-ol, others ones not. + if (!baseLayer.getType().equals(BaseMapLayer.OL_BASE_MAP.OSM)) { + attributionDiv.setHTML(attributionHTML); + } else + attributionDiv.setHTML(""); + + } + }); } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerService.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerService.java index b4f9611..b48828a 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerService.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerService.java @@ -9,6 +9,7 @@ import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV; import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV; import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV; import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult; +import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest; @@ -124,5 +125,7 @@ public interface GeoportalDataViewerService extends RemoteService { List getWFSFeatures(List layerObjects, String mapSrsName, BoundsMap selectBBOX, int maxWFSFeature, double zoomLevel); + List getListBaseLayers(); + } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerServiceAsync.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerServiceAsync.java index fd50869..462a52e 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerServiceAsync.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerServiceAsync.java @@ -9,6 +9,7 @@ import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV; import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV; import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV; import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult; +import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest; @@ -58,4 +59,6 @@ public interface GeoportalDataViewerServiceAsync { void getWFSFeatures(List layerObjects, String mapSrsName, BoundsMap selectBBOX, int maxWFSFeature, double zoomLevel, AsyncCallback> callback); + void getListBaseLayers(AsyncCallback> callback); + } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/LayerManager.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/LayerManager.java index 7998f93..2719312 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/LayerManager.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/LayerManager.java @@ -26,7 +26,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMini import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEventHandler; 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.OpenLayerOSM; +import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap; import org.gcube.portlets.user.geoportaldataviewer.client.ui.ModalWindow; import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil; import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil; @@ -57,6 +57,7 @@ import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Element; import com.google.gwt.user.client.Event; import com.google.gwt.user.client.EventListener; +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.FlexTable; @@ -81,7 +82,7 @@ import ol.geom.Geometry; public class LayerManager { /** The ol map. */ - private OpenLayerOSM olMap; + private OpenLayerMap olMap; private Map mapDetailLayerObjects = new HashMap(); private Map mapBaseLayerObjects = new HashMap(); @@ -558,6 +559,8 @@ public class LayerManager { flowPanel.getElement().getStyle().setProperty("maxHeight", "600px"); scrollPanel.add(flowPanel); + List