From bc12fbb4eefd8e5e0093692b14f530445ebfb1ba Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Tue, 28 Apr 2020 10:16:49 +0200 Subject: [PATCH] merged with feature/19111 --- .classpath | 9 +- .project | 10 +- .../com.gwtplugins.gdt.eclipse.core.prefs | 2 +- .settings/org.eclipse.core.resources.prefs | 1 - .settings/org.eclipse.wst.common.component | 5 +- changelog.xml | 30 +++- pom.xml | 2 +- .../client/ApplicationController.java | 137 +++++++++++++----- .../client/ConstantGisViewerApp.java | 2 + src/main/webapp/WEB-INF/web.xml | 12 ++ src/test/resources/.gitignore | 1 + 11 files changed, 150 insertions(+), 61 deletions(-) create mode 100644 src/test/resources/.gitignore diff --git a/.classpath b/.classpath index 020e715..4f30a41 100644 --- a/.classpath +++ b/.classpath @@ -1,16 +1,17 @@ - + - + + @@ -29,10 +30,10 @@ + - - + diff --git a/.project b/.project index 1df4eea..448d808 100644 --- a/.project +++ b/.project @@ -40,11 +40,6 @@ - - org.eclipse.m2e.core.maven2Builder - - - com.gwtplugins.gdt.eclipse.core.webAppProjectValidator @@ -55,6 +50,11 @@ + + org.eclipse.m2e.core.maven2Builder + + + org.eclipse.m2e.core.maven2Nature diff --git a/.settings/com.gwtplugins.gdt.eclipse.core.prefs b/.settings/com.gwtplugins.gdt.eclipse.core.prefs index b7d938d..0494bfb 100644 --- a/.settings/com.gwtplugins.gdt.eclipse.core.prefs +++ b/.settings/com.gwtplugins.gdt.eclipse.core.prefs @@ -1,5 +1,5 @@ eclipse.preferences.version=1 jarsExcludedFromWebInfLib= -lastWarOutDir=/home/francesco/git/gis-viewer-app/target/gis-viewer-app-1.6.0-SNAPSHOT +lastWarOutDir=/home/francesco/git/gis-viewer-app/target/gis-viewer-app-1.6.0 warSrcDir=src/main/webapp warSrcDirIsOutput=false diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs index a148efb..aedbd31 100644 --- a/.settings/org.eclipse.core.resources.prefs +++ b/.settings/org.eclipse.core.resources.prefs @@ -2,6 +2,5 @@ eclipse.preferences.version=1 encoding//src/main/java=UTF-8 encoding//src/main/resources=UTF-8 encoding//src/test/java=UTF-8 -encoding//src/test/resources=UTF-8 encoding/=UTF-8 encoding/lib=UTF-8 diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 306fbfd..c4e3bb3 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,10 +1,11 @@ - + - + + uses diff --git a/changelog.xml b/changelog.xml index 6967ba2..740c75d 100644 --- a/changelog.xml +++ b/changelog.xml @@ -1,40 +1,54 @@ - + [Feature #19109] integrated with new Gis-Viewer capabilities + [Feature #19111] GisViewer 'zoom' and 'center' to Map readable as HTTP GET parameters + + [Task #9104] removed log4j.properies - Porting to Java8 Added layer title as parameter in query string Added meta tag in .html to avoid browser caching - Upgraded to GWT 2.7 - Porting to GisViewer 4.0.0 - [Feature #2034] Integrated with geo-utility library [Feature #2250] Updated to support new GisViewer functionalities - fixed z-index on wms balloon changed css Updated according to #1283 - added wms dialog - first release diff --git a/pom.xml b/pom.xml index 2a5f777..5188a21 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ org.gcube.portlets.user gis-viewer-app war - 1.6.0 + 1.7.0-SNAPSHOT Gis Viewer App The Gis Viewer App is a web application to interact with Gis Viwewer Widget diff --git a/src/main/java/org/gcube/portlets/user/gisviewerapp/client/ApplicationController.java b/src/main/java/org/gcube/portlets/user/gisviewerapp/client/ApplicationController.java index abf3290..d6b329a 100644 --- a/src/main/java/org/gcube/portlets/user/gisviewerapp/client/ApplicationController.java +++ b/src/main/java/org/gcube/portlets/user/gisviewerapp/client/ApplicationController.java @@ -7,9 +7,11 @@ import java.util.Date; import org.gcube.portlets.user.gisviewer.client.Constants; import org.gcube.portlets.user.gisviewer.client.DataPanelOpenListener; +import org.gcube.portlets.user.gisviewer.client.GisViewerMapLoadedNotification.GisViewerMapLoadedtListener; import org.gcube.portlets.user.gisviewer.client.GisViewerPanel; import org.gcube.portlets.user.gisviewer.client.GisViewerParameters; import org.gcube.portlets.user.gisviewerapp.client.resources.Images; +import org.gwtopenmaps.openlayers.client.LonLat; import com.extjs.gxt.ui.client.event.ButtonEvent; import com.extjs.gxt.ui.client.event.ComponentEvent; @@ -58,6 +60,8 @@ public class ApplicationController { private static final String GCUBE_COOKIE_SHOW_WARNING_FOR_WPS_DATA_POINT_QUERY= "GCUBE-Cookie_GeoWPSQuery_DataPoint_Authorization"; private static final String GCUBE_COOKIE_SHOW_WARNING_FOR_WPS_BOX_QUERY = "GCUBE-Cookie_GeoWPSQuery_Box_Authorization"; public static final long MILLISECS_PER_DAY = 1000L * 60L * 60L * 24L; + private String longLatGetParameter; + private String zoomGetParameter; /** * Instantiates a new application controller. @@ -143,48 +147,15 @@ public class ApplicationController { String wmsRequest = Window.Location.getParameter(ConstantGisViewerApp.GET_WMS_PARAMETER); String uuid = Window.Location.getParameter(ConstantGisViewerApp.GET_UUID_PARAMETER); String layerTitle = Window.Location.getParameter(ConstantGisViewerApp.GET_LAYER_TITLE); + longLatGetParameter = Window.Location.getParameter(ConstantGisViewerApp.GET_CENTER_MAP_TO_LONG_LAT); + zoomGetParameter = Window.Location.getParameter(ConstantGisViewerApp.GET_ZOOM); GWT.log(ConstantGisViewerApp.GET_WMS_PARAMETER+ " = "+wmsRequest); GWT.log(ConstantGisViewerApp.GET_UUID_PARAMETER+ " = "+uuid); GWT.log(ConstantGisViewerApp.GET_LAYER_TITLE+ " = "+layerTitle); - - boolean displayWarning = readCookieWPSQueryAuthorization(GCUBE_COOKIE_SHOW_WARNING_FOR_WPS_DATA_POINT_QUERY); - GWT.log("Display "+GCUBE_COOKIE_SHOW_WARNING_FOR_WPS_DATA_POINT_QUERY+"? "+displayWarning); - - if(displayWarning){ - gisViewerPanel.getToolBarPanel().getClickDataToggle().addSelectionListener(new SelectionListener() { - - @Override - public void componentSelected(ButtonEvent ce) { - - if(!gisViewerPanel.getToolBarPanel().getClickDataToggle().isPressed()) - return; - - boolean warning = readCookieWPSQueryAuthorization(GCUBE_COOKIE_SHOW_WARNING_FOR_WPS_DATA_POINT_QUERY); - if(warning) - showWarningForWPSService("Warning: gCube authorization required", "You must be authorized to perform the 'Data point query'. Some data could be not available because you are not authorized to contact gCube WPS service", GCUBE_COOKIE_SHOW_WARNING_FOR_WPS_DATA_POINT_QUERY); - } - }); - } - - displayWarning = readCookieWPSQueryAuthorization(GCUBE_COOKIE_SHOW_WARNING_FOR_WPS_BOX_QUERY); - GWT.log("Display "+GCUBE_COOKIE_SHOW_WARNING_FOR_WPS_BOX_QUERY+"? "+displayWarning); - - if(displayWarning){ - gisViewerPanel.getToolBarPanel().getBoxDataToggle().addSelectionListener(new SelectionListener() { - - @Override - public void componentSelected(ButtonEvent ce) { - - if(!gisViewerPanel.getToolBarPanel().getBoxDataToggle().isPressed()) - return; - - boolean warning = readCookieWPSQueryAuthorization(GCUBE_COOKIE_SHOW_WARNING_FOR_WPS_BOX_QUERY); - if(warning) - showWarningForWPSService("Warning: gCube authorization required", "You must be authorized to perform the 'Data box query'. Some data could be not available because you are not authorized to contact gCube WPS service", GCUBE_COOKIE_SHOW_WARNING_FOR_WPS_BOX_QUERY); - - } - }); - } + GWT.log(ConstantGisViewerApp.GET_ZOOM+ " = "+zoomGetParameter); + GWT.log(ConstantGisViewerApp.GET_CENTER_MAP_TO_LONG_LAT+ " = "+longLatGetParameter); + + addGisViewerHandlers(); if(wmsRequest!=null && !wmsRequest.isEmpty()){ @@ -233,6 +204,94 @@ public class ApplicationController { SetZIndex setZIndex = new SetZIndex(); safeFunctionCallOn(lcWMS,setZIndex); } + + + private void addGisViewerHandlers() { + + GisViewerMapLoadedtListener listeners = new GisViewerMapLoadedtListener() { + + @Override + public void onMapLoaded() { + + GWT.log("on Map Loaded fired"); + + boolean displayWarning = readCookieWPSQueryAuthorization(GCUBE_COOKIE_SHOW_WARNING_FOR_WPS_DATA_POINT_QUERY); + GWT.log("Display "+GCUBE_COOKIE_SHOW_WARNING_FOR_WPS_DATA_POINT_QUERY+"? "+displayWarning); + + if (displayWarning) { + + gisViewerPanel.getToolBarPanel().getClickDataToggle() + .addSelectionListener(new SelectionListener() { + + @Override + public void componentSelected(ButtonEvent ce) { + + if (!gisViewerPanel.getToolBarPanel().getClickDataToggle().isPressed()) + return; + + boolean warning = readCookieWPSQueryAuthorization( + GCUBE_COOKIE_SHOW_WARNING_FOR_WPS_DATA_POINT_QUERY); + if (warning) + showWarningForWPSService("Warning: gCube authorization required", + "You must be authorized to perform the 'Data point query'. Some data could be not available because you are not authorized to contact gCube WPS service", + GCUBE_COOKIE_SHOW_WARNING_FOR_WPS_DATA_POINT_QUERY); + } + }); + + } + + displayWarning = readCookieWPSQueryAuthorization(GCUBE_COOKIE_SHOW_WARNING_FOR_WPS_BOX_QUERY); + GWT.log("Display " + GCUBE_COOKIE_SHOW_WARNING_FOR_WPS_BOX_QUERY + "? " + displayWarning); + + if (displayWarning) { + gisViewerPanel.getToolBarPanel().getBoxDataToggle() + .addSelectionListener(new SelectionListener() { + + @Override + public void componentSelected(ButtonEvent ce) { + + if (!gisViewerPanel.getToolBarPanel().getBoxDataToggle().isPressed()) + return; + + boolean warning = readCookieWPSQueryAuthorization( + GCUBE_COOKIE_SHOW_WARNING_FOR_WPS_BOX_QUERY); + if (warning) + showWarningForWPSService("Warning: gCube authorization required", + "You must be authorized to perform the 'Data box query'. Some data could be not available because you are not authorized to contact gCube WPS service", + GCUBE_COOKIE_SHOW_WARNING_FOR_WPS_BOX_QUERY); + + } + }); + } + + try { + if(zoomGetParameter!=null) { + int zoomLevel = Integer.parseInt(zoomGetParameter); + gisViewerPanel.getOpenLayersMap().setZoomLevel(zoomLevel); + } + }catch (Exception e) { + GWT.log("BAD value: "+zoomGetParameter+" for parameter: "+ConstantGisViewerApp.GET_ZOOM); + } + + try { + if(longLatGetParameter!=null) { + String[] theLongLat = longLatGetParameter.split(","); + LonLat lonlat = new LonLat(Double.parseDouble(theLongLat[0]), Double.parseDouble(theLongLat[1])); + gisViewerPanel.getOpenLayersMap().setCenterAt(lonlat); + } + }catch (Exception e) { + GWT.log("BAD value: "+longLatGetParameter+" for parameter: "+ConstantGisViewerApp.GET_CENTER_MAP_TO_LONG_LAT); + } + } + + @Override + public void onFailed(Throwable throwable) { + } + + }; + + gisViewerPanel.addMapLoadedListener(listeners); + } /** diff --git a/src/main/java/org/gcube/portlets/user/gisviewerapp/client/ConstantGisViewerApp.java b/src/main/java/org/gcube/portlets/user/gisviewerapp/client/ConstantGisViewerApp.java index 685b0b9..4a7a99e 100644 --- a/src/main/java/org/gcube/portlets/user/gisviewerapp/client/ConstantGisViewerApp.java +++ b/src/main/java/org/gcube/portlets/user/gisviewerapp/client/ConstantGisViewerApp.java @@ -18,5 +18,7 @@ public class ConstantGisViewerApp { public static final String GET_UUID_PARAMETER = "uuid"; public static final String WMS_PARAM_SEPARATOR_REPLACEMENT_KEY = "separtor"; public static final String GET_LAYER_TITLE = "layertitle"; + public static final String GET_ZOOM = "zoom"; + public static final String GET_CENTER_MAP_TO_LONG_LAT = "centermap"; } diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index 2682d28..b89a3b5 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -30,6 +30,13 @@ org.gcube.portlets.user.gisviewer.server.DefaultGisViewerServiceImpl + + + DownloadWFSFeatures + org.gcube.portlets.user.gisviewer.server.DownloadWFSFeaturesServlet + + + MapGenerator @@ -56,6 +63,11 @@ /GisViewerApp/GisViewerService + + DownloadWFSFeatures + /GisViewerApp/DownloadWFSFeatures + + GisViewerApp.html diff --git a/src/test/resources/.gitignore b/src/test/resources/.gitignore new file mode 100644 index 0000000..e53ef90 --- /dev/null +++ b/src/test/resources/.gitignore @@ -0,0 +1 @@ +/log4j.properties