diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 550319e..352672b 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -4,7 +4,7 @@ - + uses diff --git a/changelog.xml b/changelog.xml index 8ce5797..83ca68c 100644 --- a/changelog.xml +++ b/changelog.xml @@ -1,11 +1,18 @@ + + [Task #19207]: init parameter to set max zoom level + + [Feature #19109] integrated with new Gis-Viewer capabilities [Feature #19111] GisViewer 'zoom' and 'center' to Map readable - as HTTP GET parameters + as HTTP GET parameters + [Feature #19172] Gis-Viewer-App: update the look and feel of Gis-Viewer diff --git a/pom.xml b/pom.xml index f2ce792..3564016 100644 --- a/pom.xml +++ b/pom.xml @@ -13,10 +13,10 @@ org.gcube.portlets.user gis-viewer-app war - 1.7.0 + 1.8.0-SNAPSHOT Gis Viewer App - The Gis Viewer App is a web application to interact with Gis Viwewer Widget + The Gis Viewer App is a web application to interact with Gis Viewer 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 d6b329a..c155753 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 @@ -10,8 +10,8 @@ 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.gisviewer.client.OpenLayersMapParameters; 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; @@ -60,8 +60,12 @@ 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; + private String paramLongLat; + private String paramZoom; + private String paramMaxZoomLevel; + private String paramWmsRequest; + private String paramUUID; + private String paramLayerTitle; /** * Instantiates a new application controller. @@ -86,7 +90,28 @@ public class ApplicationController { gisViewerParameters = new GisViewerParameters(); gisViewerParameters.setProjection(""); gisViewerParameters.setOpenDataPanelAtStart(false); - + + //READING QUERY STRING PARAMETER TO INIT OL MAP + paramMaxZoomLevel = Window.Location.getParameter(ConstantGisViewerApp.GET_MAX_ZOOM_LEVEL); + paramZoom = Window.Location.getParameter(ConstantGisViewerApp.GET_ZOOM); + paramLongLat = Window.Location.getParameter(ConstantGisViewerApp.GET_CENTER_MAP_TO_LONG_LAT); + GWT.log(ConstantGisViewerApp.GET_ZOOM+ " = "+paramZoom); + GWT.log(ConstantGisViewerApp.GET_CENTER_MAP_TO_LONG_LAT+ " = "+paramLongLat); + GWT.log(ConstantGisViewerApp.GET_MAX_ZOOM_LEVEL+ " = "+paramMaxZoomLevel); + + OpenLayersMapParameters oLMP = new OpenLayersMapParameters(); + + if(paramZoom!=null) + oLMP.addParameter(ConstantGisViewerApp.GET_ZOOM, paramZoom); + + if(paramMaxZoomLevel!=null) + oLMP.addParameter(ConstantGisViewerApp.GET_MAX_ZOOM_LEVEL, paramMaxZoomLevel); + + if(paramLongLat!=null) + oLMP.addParameter(ConstantGisViewerApp.GET_CENTER_MAP_TO_LONG_LAT, paramLongLat); + + gisViewerParameters.setOpenLayersMapParameters(oLMP); + gisViewerParameters.setDataPanelOpenListener(new DataPanelOpenListener() { @Override public void dataPanelOpen(boolean isOpen, int panelHeight) { @@ -143,26 +168,22 @@ public class ApplicationController { public void go(final RootPanel rootPanel) { this.gwtRootPanel = rootPanel; rootPanel.add(mainPanel); - - 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); - GWT.log(ConstantGisViewerApp.GET_ZOOM+ " = "+zoomGetParameter); - GWT.log(ConstantGisViewerApp.GET_CENTER_MAP_TO_LONG_LAT+ " = "+longLatGetParameter); + paramWmsRequest = Window.Location.getParameter(ConstantGisViewerApp.GET_WMS_PARAMETER); + paramUUID = Window.Location.getParameter(ConstantGisViewerApp.GET_UUID_PARAMETER); + paramLayerTitle = Window.Location.getParameter(ConstantGisViewerApp.GET_LAYER_TITLE); + GWT.log(ConstantGisViewerApp.GET_WMS_PARAMETER+ " = "+paramWmsRequest); + GWT.log(ConstantGisViewerApp.GET_UUID_PARAMETER+ " = "+paramUUID); + GWT.log(ConstantGisViewerApp.GET_LAYER_TITLE+ " = "+paramLayerTitle); + addGisViewerHandlers(); - if(wmsRequest!=null && !wmsRequest.isEmpty()){ + if(paramWmsRequest!=null && !paramWmsRequest.isEmpty()){ try { - wmsRequestConverter.addRequestToGisViewer(wmsRequest,layerTitle, uuid); + wmsRequestConverter.addRequestToGisViewer(paramWmsRequest,paramLayerTitle, paramUUID); } catch (Exception e) { - GWT.log("An error occurred on adding wmsrequest :"+wmsRequest); + GWT.log("An error occurred on adding wmsrequest :"+paramWmsRequest); e.printStackTrace(); } } @@ -241,7 +262,7 @@ public class ApplicationController { } displayWarning = readCookieWPSQueryAuthorization(GCUBE_COOKIE_SHOW_WARNING_FOR_WPS_BOX_QUERY); - GWT.log("Display " + GCUBE_COOKIE_SHOW_WARNING_FOR_WPS_BOX_QUERY + "? " + displayWarning); + GWT.log("DisplsetCenterMapToay " + GCUBE_COOKIE_SHOW_WARNING_FOR_WPS_BOX_QUERY + "? " + displayWarning); if (displayWarning) { gisViewerPanel.getToolBarPanel().getBoxDataToggle() @@ -263,25 +284,6 @@ public class ApplicationController { } }); } - - 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 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 4a7a99e..2a3c98b 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 @@ -3,7 +3,7 @@ */ package org.gcube.portlets.user.gisviewerapp.client; - +import org.gcube.portlets.user.gisviewer.client.OpenLayersMapParameters; /** * The Class ConstantGisViewerApp. @@ -18,7 +18,10 @@ 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"; + + + 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(); }