From 054244b7194e7c9ad0d9b37459b78c278206da3f Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Fri, 5 Feb 2016 14:49:12 +0000 Subject: [PATCH] Added zoom parameter to wps request git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/gis-viewer@122864 82a268e6-3cf1-43bd-a215-b396298e98cf --- .classpath | 14 ++-- .settings/org.eclipse.jdt.core.prefs | 6 +- ....eclipse.wst.common.project.facet.core.xml | 2 +- .../user/gisviewer/client/Constants.java | 2 +- .../user/gisviewer/client/GisViewerPanel.java | 3 +- .../gisviewer/client/GisViewerService.java | 14 ++-- .../client/GisViewerServiceAsync.java | 17 +---- .../server/GisViewerServiceImpl.java | 22 +----- .../server/datafeature/FeatureParser.java | 5 +- .../server/datafeature/FeatureWPSRequest.java | 69 ++++++++++--------- 10 files changed, 61 insertions(+), 93 deletions(-) diff --git a/.classpath b/.classpath index 6c953eb..103d72a 100644 --- a/.classpath +++ b/.classpath @@ -1,10 +1,16 @@ - + + + + + + + @@ -17,11 +23,5 @@ - - - - - - diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 443e085..69c31cd 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,8 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml index 4f92af5..5c9bd75 100644 --- a/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -1,5 +1,5 @@ - + diff --git a/src/main/java/org/gcube/portlets/user/gisviewer/client/Constants.java b/src/main/java/org/gcube/portlets/user/gisviewer/client/Constants.java index 401762b..79b1435 100644 --- a/src/main/java/org/gcube/portlets/user/gisviewer/client/Constants.java +++ b/src/main/java/org/gcube/portlets/user/gisviewer/client/Constants.java @@ -14,7 +14,7 @@ public class Constants { public static String VERSION = "3.10.0"; public static String defaultGroup= "group45be7606f-4add-4636-ad14-f353163d0bd3"; public static String defaultGroup2 = "groupTemplate"; - public static String GCUBE_TOKEN = "d7a4076c-e8c1-42fe-81e0-bdecb1e8074a"; + public static String GCUBE_TOKEN = "d7a4076c-e8c1-42fe-81e0-bdecb1e8074a"; //A STATIC GCUBE TOKEN FOR TEST // LOG AND INFO PRINTING public static boolean printLog=false; diff --git a/src/main/java/org/gcube/portlets/user/gisviewer/client/GisViewerPanel.java b/src/main/java/org/gcube/portlets/user/gisviewer/client/GisViewerPanel.java index c44b8d0..9fd423d 100644 --- a/src/main/java/org/gcube/portlets/user/gisviewer/client/GisViewerPanel.java +++ b/src/main/java/org/gcube/portlets/user/gisviewer/client/GisViewerPanel.java @@ -599,8 +599,9 @@ implements ToolbarHandler, DataPanelHandler, LayersPanelHandler, CqlFilterHandle int maxWFSFeature = lastClickDataInfo.getLimit()==Integer.MAX_VALUE?Constants.MAX_WFS_FEATURES:lastClickDataInfo.getLimit(); GWT.log("Max WFS Feature is "+maxWFSFeature); + GWT.log("Zoom level"+openLayersMap.getMap().getZoom()); - gisViewerServiceAsync.getDataResult(layersPanel.getVisibleLayers(), bbox, maxWFSFeature, new AsyncCallback>() { + gisViewerServiceAsync.getDataResult(layersPanel.getVisibleLayers(), bbox, maxWFSFeature, openLayersMap.getMap().getZoom(), new AsyncCallback>() { @Override public void onSuccess(List result) { DataResultPanel dpanel = new DataResultPanel(); diff --git a/src/main/java/org/gcube/portlets/user/gisviewer/client/GisViewerService.java b/src/main/java/org/gcube/portlets/user/gisviewer/client/GisViewerService.java index 5ca0da6..bd3c2be 100644 --- a/src/main/java/org/gcube/portlets/user/gisviewer/client/GisViewerService.java +++ b/src/main/java/org/gcube/portlets/user/gisviewer/client/GisViewerService.java @@ -64,15 +64,6 @@ public interface GisViewerService extends RemoteService { */ LayerItemsResult getLayersInfoByLayerItems(List layerItems); - /** - * Gets the data result. - * - * @param layerItems the layer items - * @param bbox the bbox - * @return the data result - */ - List getDataResult(List layerItems, String bbox); - /** * Added by Francesco M. 10/09/2013 * @@ -88,9 +79,12 @@ public interface GisViewerService extends RemoteService { * @param layerItems the layer items * @param bbox the bbox * @param maxWFSFeature the max wfs feature + * @param zoomLevel the zoom level * @return the data result */ - List getDataResult(List layerItems, String bbox, int maxWFSFeature); + List getDataResult( + List layerItems, String bbox, int maxWFSFeature, + int zoomLevel); /** * Gets the base layers to gis viewer. diff --git a/src/main/java/org/gcube/portlets/user/gisviewer/client/GisViewerServiceAsync.java b/src/main/java/org/gcube/portlets/user/gisviewer/client/GisViewerServiceAsync.java index 4a73508..772632b 100644 --- a/src/main/java/org/gcube/portlets/user/gisviewer/client/GisViewerServiceAsync.java +++ b/src/main/java/org/gcube/portlets/user/gisviewer/client/GisViewerServiceAsync.java @@ -68,16 +68,6 @@ public interface GisViewerServiceAsync { */ void getTransectParameters(AsyncCallback callback); - /** - * Gets the data result. - * - * @param layerItems the layer items - * @param bbox the bbox - * @param asyncCallback the async callback - * @return the data result - */ - public void getDataResult(List layerItems, String bbox, AsyncCallback> asyncCallback); - /** * Gets the list property. * @@ -96,10 +86,11 @@ public interface GisViewerServiceAsync { * @param bbox the bbox * @param maxWFSFeature the max wfs feature * @param callback the callback + * @param zoomLevel * @return the data result */ void getDataResult(List layerItems, String bbox, - int maxWFSFeature, AsyncCallback> callback); + int maxWFSFeature, int zoomLevel, AsyncCallback> callback); /** * Gets the base layers to gis viewer. @@ -136,8 +127,4 @@ public interface GisViewerServiceAsync { */ void getGcubeSecurityToken(AsyncCallback callback); - - - - } diff --git a/src/main/java/org/gcube/portlets/user/gisviewer/server/GisViewerServiceImpl.java b/src/main/java/org/gcube/portlets/user/gisviewer/server/GisViewerServiceImpl.java index d9d2a34..eb21de5 100644 --- a/src/main/java/org/gcube/portlets/user/gisviewer/server/GisViewerServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/gisviewer/server/GisViewerServiceImpl.java @@ -535,29 +535,11 @@ public abstract class GisViewerServiceImpl extends RemoteServiceServlet implemen } } - /* (non-Javadoc) - * @see org.gcube.portlets.user.gisviewer.client.GisViewerService#getDataResult(java.util.List, java.lang.String) - */ - @Override - public List getDataResult(List layerItems, String bbox) { - String dataMinerURL = ""; - try { - GisViewerServiceParameters parameters = getParameters(); - dataMinerURL = parameters.getDataMinerUrl(); - } - catch (Exception e) { - logger.error("Error on retrieving DataMiner URL from parameters, returning empty list of features"); - return new ArrayList(); - } - List result = FeatureParser.getDataResults(layerItems, bbox, Constants.MAX_WFS_FEATURES, getGcubeSecurityToken(), dataMinerURL); - return result; - } - /* (non-Javadoc) * @see org.gcube.portlets.user.gisviewer.client.GisViewerService#getDataResult(java.util.List, java.lang.String, int) */ @Override - public List getDataResult(List layerItems, String bbox, int maxWFSFeature) { + public List getDataResult(List layerItems, String bbox, int maxWFSFeature, int zoomLevel) { String dataMinerURL = ""; try { GisViewerServiceParameters parameters = getParameters(); @@ -567,7 +549,7 @@ public abstract class GisViewerServiceImpl extends RemoteServiceServlet implemen logger.error("Error on retrieving DataMiner URL from parameters, returning empty list of features"); return new ArrayList(); } - List result = FeatureParser.getDataResults(layerItems, bbox, maxWFSFeature, getGcubeSecurityToken(), dataMinerURL); + List result = FeatureParser.getDataResults(layerItems, bbox, maxWFSFeature, getGcubeSecurityToken(), dataMinerURL, zoomLevel); return result; } diff --git a/src/main/java/org/gcube/portlets/user/gisviewer/server/datafeature/FeatureParser.java b/src/main/java/org/gcube/portlets/user/gisviewer/server/datafeature/FeatureParser.java index a7802b5..f9137f5 100644 --- a/src/main/java/org/gcube/portlets/user/gisviewer/server/datafeature/FeatureParser.java +++ b/src/main/java/org/gcube/portlets/user/gisviewer/server/datafeature/FeatureParser.java @@ -66,9 +66,10 @@ public class FeatureParser { * @param maxWFSFeature the max wfs feature * @param gCubeSecurityToken the g cube security token * @param dataMinerURL + * @param zoomLevel * @return the data results */ - public static List getDataResults(List layerItems, String bbox, int maxWFSFeature, String gCubeSecurityToken, String dataMinerURL) { + public static List getDataResults(List layerItems, String bbox, int maxWFSFeature, String gCubeSecurityToken, String dataMinerURL, int zoomLevel) { List results = new ArrayList(); if(maxWFSFeature<0) { @@ -81,7 +82,7 @@ public class FeatureParser { if(table.isError()){ if(layerItem.getUUID()!=null) { - results.add(FeatureWPSRequest.getTableFromWPSService(layerItem, bbox, maxWFSFeature, gCubeSecurityToken, dataMinerURL)); + results.add(FeatureWPSRequest.getTableFromWPSService(layerItem, bbox, maxWFSFeature, gCubeSecurityToken, dataMinerURL, zoomLevel)); }else{ results.add(table); } diff --git a/src/main/java/org/gcube/portlets/user/gisviewer/server/datafeature/FeatureWPSRequest.java b/src/main/java/org/gcube/portlets/user/gisviewer/server/datafeature/FeatureWPSRequest.java index 7237160..365a3c0 100644 --- a/src/main/java/org/gcube/portlets/user/gisviewer/server/datafeature/FeatureWPSRequest.java +++ b/src/main/java/org/gcube/portlets/user/gisviewer/server/datafeature/FeatureWPSRequest.java @@ -36,47 +36,48 @@ import com.extjs.gxt.ui.client.data.BaseModel; * The Class FeatureWPSRequest. * * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it - * Feb 2, 2016 + * Feb 3, 2016 */ public class FeatureWPSRequest { private static Logger log = Logger.getLogger(FeatureWPSRequest.class); - /** - * Gets the data results. - * - * @param layerItems the layer items - * @param bbox the bbox - * @param maxWFSFeature the max wfs feature - * @param gCubeSecurityToken the g cube security token - * @param dataMinerURL the data miner url - * @return the data results - */ - public static List getDataResults( - List layerItems, String bbox, int maxWFSFeature, String gCubeSecurityToken, String dataMinerURL) { - - List results = new ArrayList(); - if (maxWFSFeature < 0) { - maxWFSFeature = Constants.MAX_WFS_FEATURES; - } - for (LayerItem layerItem : layerItems) { - results.add(getTableFromWPSService(layerItem, bbox, maxWFSFeature, gCubeSecurityToken, dataMinerURL)); - } - return results; - } +// /** +// * Gets the data results. +// * +// * @param layerItems the layer items +// * @param bbox the bbox +// * @param maxWFSFeature the max wfs feature +// * @param gCubeSecurityToken the g cube security token +// * @param dataMinerURL the data miner url +// * @return the data results +// */ +// public static List getDataResults( +// List layerItems, String bbox, int maxWFSFeature, String gCubeSecurityToken, String dataMinerURL) { +// +// List results = new ArrayList(); +// if (maxWFSFeature < 0) { +// maxWFSFeature = Constants.MAX_WFS_FEATURES; +// } +// for (LayerItem layerItem : layerItems) { +// results.add(getTableFromWPSService(layerItem, bbox, maxWFSFeature, gCubeSecurityToken, dataMinerURL)); +// } +// return results; +// } /** - * Gets the table from wps service. - * - * @param layerItem the layer item - * @param bbox the bbox - * @param maxWFSFeature the max wfs feature - * @param gCubeSecurityToken the g cube security token - * @param dataMinerURL the data miner url - * @return the table from wps service - */ - public static WebFeatureTable getTableFromWPSService(LayerItem layerItem, String bbox, int maxWFSFeature, String gCubeSecurityToken, String dataMinerURL) { + * Gets the table from wps service. + * + * @param layerItem the layer item + * @param bbox the bbox + * @param maxWFSFeature the max wfs feature + * @param gCubeSecurityToken the g cube security token + * @param dataMinerURL the data miner url + * @param zoomLevel the zoom level + * @return the table from wps service + */ + public static WebFeatureTable getTableFromWPSService(LayerItem layerItem, String bbox, int maxWFSFeature, String gCubeSecurityToken, String dataMinerURL, int zoomLevel) { final WebFeatureTable table = new WebFeatureTable(); table.setTitle(layerItem.getName()); log.info("WPSGetData -> Creating WebFeatureTable for layerItem: "+layerItem.getLayer()); @@ -87,6 +88,8 @@ public class FeatureWPSRequest { gCubeSecurityToken = Constants.GCUBE_TOKEN; } + //TODO CALCULATE RESOLUTION AS FUNCTION OF + try { String[] splitted = bbox.split(",");