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
This commit is contained in:
Francesco Mangiacrapa 2016-02-05 14:49:12 +00:00
parent d31df77b66
commit 054244b719
10 changed files with 61 additions and 93 deletions

View File

@ -1,10 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes> <attributes>
<attribute name="owner.project.facets" value="java"/> <attribute name="owner.project.facets" value="java"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src/main/java"> <classpathentry including="**/*.java" kind="src" output="target/classes" path="src/main/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
@ -17,11 +23,5 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>
</classpath> </classpath>

View File

@ -1,8 +1,8 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.compiler.source=1.6

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<faceted-project> <faceted-project>
<installed facet="jst.utility" version="1.0"/> <installed facet="jst.utility" version="1.0"/>
<installed facet="java" version="1.7"/> <installed facet="java" version="1.6"/>
</faceted-project> </faceted-project>

View File

@ -14,7 +14,7 @@ public class Constants {
public static String VERSION = "3.10.0"; public static String VERSION = "3.10.0";
public static String defaultGroup= "group45be7606f-4add-4636-ad14-f353163d0bd3"; public static String defaultGroup= "group45be7606f-4add-4636-ad14-f353163d0bd3";
public static String defaultGroup2 = "groupTemplate"; 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 // LOG AND INFO PRINTING
public static boolean printLog=false; public static boolean printLog=false;

View File

@ -599,8 +599,9 @@ implements ToolbarHandler, DataPanelHandler, LayersPanelHandler, CqlFilterHandle
int maxWFSFeature = lastClickDataInfo.getLimit()==Integer.MAX_VALUE?Constants.MAX_WFS_FEATURES:lastClickDataInfo.getLimit(); int maxWFSFeature = lastClickDataInfo.getLimit()==Integer.MAX_VALUE?Constants.MAX_WFS_FEATURES:lastClickDataInfo.getLimit();
GWT.log("Max WFS Feature is "+maxWFSFeature); GWT.log("Max WFS Feature is "+maxWFSFeature);
GWT.log("Zoom level"+openLayersMap.getMap().getZoom());
gisViewerServiceAsync.getDataResult(layersPanel.getVisibleLayers(), bbox, maxWFSFeature, new AsyncCallback<List<WebFeatureTable>>() { gisViewerServiceAsync.getDataResult(layersPanel.getVisibleLayers(), bbox, maxWFSFeature, openLayersMap.getMap().getZoom(), new AsyncCallback<List<WebFeatureTable>>() {
@Override @Override
public void onSuccess(List<WebFeatureTable> result) { public void onSuccess(List<WebFeatureTable> result) {
DataResultPanel dpanel = new DataResultPanel(); DataResultPanel dpanel = new DataResultPanel();

View File

@ -64,15 +64,6 @@ public interface GisViewerService extends RemoteService {
*/ */
LayerItemsResult getLayersInfoByLayerItems(List<LayerItem> layerItems); LayerItemsResult getLayersInfoByLayerItems(List<LayerItem> layerItems);
/**
* Gets the data result.
*
* @param layerItems the layer items
* @param bbox the bbox
* @return the data result
*/
List<WebFeatureTable> getDataResult(List<LayerItem> layerItems, String bbox);
/** /**
* Added by Francesco M. 10/09/2013 * Added by Francesco M. 10/09/2013
* *
@ -88,9 +79,12 @@ public interface GisViewerService extends RemoteService {
* @param layerItems the layer items * @param layerItems the layer items
* @param bbox the bbox * @param bbox the bbox
* @param maxWFSFeature the max wfs feature * @param maxWFSFeature the max wfs feature
* @param zoomLevel the zoom level
* @return the data result * @return the data result
*/ */
List<WebFeatureTable> getDataResult(List<LayerItem> layerItems, String bbox, int maxWFSFeature); List<WebFeatureTable> getDataResult(
List<LayerItem> layerItems, String bbox, int maxWFSFeature,
int zoomLevel);
/** /**
* Gets the base layers to gis viewer. * Gets the base layers to gis viewer.

View File

@ -68,16 +68,6 @@ public interface GisViewerServiceAsync {
*/ */
void getTransectParameters(AsyncCallback<TransectParameters> callback); void getTransectParameters(AsyncCallback<TransectParameters> 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<LayerItem> layerItems, String bbox, AsyncCallback<List<WebFeatureTable>> asyncCallback);
/** /**
* Gets the list property. * Gets the list property.
* *
@ -96,10 +86,11 @@ public interface GisViewerServiceAsync {
* @param bbox the bbox * @param bbox the bbox
* @param maxWFSFeature the max wfs feature * @param maxWFSFeature the max wfs feature
* @param callback the callback * @param callback the callback
* @param zoomLevel
* @return the data result * @return the data result
*/ */
void getDataResult(List<LayerItem> layerItems, String bbox, void getDataResult(List<LayerItem> layerItems, String bbox,
int maxWFSFeature, AsyncCallback<List<WebFeatureTable>> callback); int maxWFSFeature, int zoomLevel, AsyncCallback<List<WebFeatureTable>> callback);
/** /**
* Gets the base layers to gis viewer. * Gets the base layers to gis viewer.
@ -136,8 +127,4 @@ public interface GisViewerServiceAsync {
*/ */
void getGcubeSecurityToken(AsyncCallback<String> callback); void getGcubeSecurityToken(AsyncCallback<String> callback);
} }

View File

@ -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<WebFeatureTable> getDataResult(List<LayerItem> 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<WebFeatureTable>();
}
List<WebFeatureTable> result = FeatureParser.getDataResults(layerItems, bbox, Constants.MAX_WFS_FEATURES, getGcubeSecurityToken(), dataMinerURL);
return result;
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.gcube.portlets.user.gisviewer.client.GisViewerService#getDataResult(java.util.List, java.lang.String, int) * @see org.gcube.portlets.user.gisviewer.client.GisViewerService#getDataResult(java.util.List, java.lang.String, int)
*/ */
@Override @Override
public List<WebFeatureTable> getDataResult(List<LayerItem> layerItems, String bbox, int maxWFSFeature) { public List<WebFeatureTable> getDataResult(List<LayerItem> layerItems, String bbox, int maxWFSFeature, int zoomLevel) {
String dataMinerURL = ""; String dataMinerURL = "";
try { try {
GisViewerServiceParameters parameters = getParameters(); 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"); logger.error("Error on retrieving DataMiner URL from parameters, returning empty list of features");
return new ArrayList<WebFeatureTable>(); return new ArrayList<WebFeatureTable>();
} }
List<WebFeatureTable> result = FeatureParser.getDataResults(layerItems, bbox, maxWFSFeature, getGcubeSecurityToken(), dataMinerURL); List<WebFeatureTable> result = FeatureParser.getDataResults(layerItems, bbox, maxWFSFeature, getGcubeSecurityToken(), dataMinerURL, zoomLevel);
return result; return result;
} }

View File

@ -66,9 +66,10 @@ public class FeatureParser {
* @param maxWFSFeature the max wfs feature * @param maxWFSFeature the max wfs feature
* @param gCubeSecurityToken the g cube security token * @param gCubeSecurityToken the g cube security token
* @param dataMinerURL * @param dataMinerURL
* @param zoomLevel
* @return the data results * @return the data results
*/ */
public static List<WebFeatureTable> getDataResults(List<LayerItem> layerItems, String bbox, int maxWFSFeature, String gCubeSecurityToken, String dataMinerURL) { public static List<WebFeatureTable> getDataResults(List<LayerItem> layerItems, String bbox, int maxWFSFeature, String gCubeSecurityToken, String dataMinerURL, int zoomLevel) {
List<WebFeatureTable> results = new ArrayList<WebFeatureTable>(); List<WebFeatureTable> results = new ArrayList<WebFeatureTable>();
if(maxWFSFeature<0) { if(maxWFSFeature<0) {
@ -81,7 +82,7 @@ public class FeatureParser {
if(table.isError()){ if(table.isError()){
if(layerItem.getUUID()!=null) { if(layerItem.getUUID()!=null) {
results.add(FeatureWPSRequest.getTableFromWPSService(layerItem, bbox, maxWFSFeature, gCubeSecurityToken, dataMinerURL)); results.add(FeatureWPSRequest.getTableFromWPSService(layerItem, bbox, maxWFSFeature, gCubeSecurityToken, dataMinerURL, zoomLevel));
}else{ }else{
results.add(table); results.add(table);
} }

View File

@ -36,47 +36,48 @@ import com.extjs.gxt.ui.client.data.BaseModel;
* The Class FeatureWPSRequest. * The Class FeatureWPSRequest.
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 2, 2016 * Feb 3, 2016
*/ */
public class FeatureWPSRequest { public class FeatureWPSRequest {
private static Logger log = Logger.getLogger(FeatureWPSRequest.class); private static Logger log = Logger.getLogger(FeatureWPSRequest.class);
/** // /**
* Gets the data results. // * Gets the data results.
* // *
* @param layerItems the layer items // * @param layerItems the layer items
* @param bbox the bbox // * @param bbox the bbox
* @param maxWFSFeature the max wfs feature // * @param maxWFSFeature the max wfs feature
* @param gCubeSecurityToken the g cube security token // * @param gCubeSecurityToken the g cube security token
* @param dataMinerURL the data miner url // * @param dataMinerURL the data miner url
* @return the data results // * @return the data results
*/ // */
public static List<WebFeatureTable> getDataResults( // public static List<WebFeatureTable> getDataResults(
List<LayerItem> layerItems, String bbox, int maxWFSFeature, String gCubeSecurityToken, String dataMinerURL) { // List<LayerItem> layerItems, String bbox, int maxWFSFeature, String gCubeSecurityToken, String dataMinerURL) {
//
List<WebFeatureTable> results = new ArrayList<WebFeatureTable>(); // List<WebFeatureTable> results = new ArrayList<WebFeatureTable>();
if (maxWFSFeature < 0) { // if (maxWFSFeature < 0) {
maxWFSFeature = Constants.MAX_WFS_FEATURES; // maxWFSFeature = Constants.MAX_WFS_FEATURES;
} // }
for (LayerItem layerItem : layerItems) { // for (LayerItem layerItem : layerItems) {
results.add(getTableFromWPSService(layerItem, bbox, maxWFSFeature, gCubeSecurityToken, dataMinerURL)); // results.add(getTableFromWPSService(layerItem, bbox, maxWFSFeature, gCubeSecurityToken, dataMinerURL));
} // }
return results; // return results;
} // }
/** /**
* Gets the table from wps service. * Gets the table from wps service.
* *
* @param layerItem the layer item * @param layerItem the layer item
* @param bbox the bbox * @param bbox the bbox
* @param maxWFSFeature the max wfs feature * @param maxWFSFeature the max wfs feature
* @param gCubeSecurityToken the g cube security token * @param gCubeSecurityToken the g cube security token
* @param dataMinerURL the data miner url * @param dataMinerURL the data miner url
* @return the table from wps service * @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) { */
public static WebFeatureTable getTableFromWPSService(LayerItem layerItem, String bbox, int maxWFSFeature, String gCubeSecurityToken, String dataMinerURL, int zoomLevel) {
final WebFeatureTable table = new WebFeatureTable(); final WebFeatureTable table = new WebFeatureTable();
table.setTitle(layerItem.getName()); table.setTitle(layerItem.getName());
log.info("WPSGetData -> Creating WebFeatureTable for layerItem: "+layerItem.getLayer()); log.info("WPSGetData -> Creating WebFeatureTable for layerItem: "+layerItem.getLayer());
@ -87,6 +88,8 @@ public class FeatureWPSRequest {
gCubeSecurityToken = Constants.GCUBE_TOKEN; gCubeSecurityToken = Constants.GCUBE_TOKEN;
} }
//TODO CALCULATE RESOLUTION AS FUNCTION OF
try { try {
String[] splitted = bbox.split(","); String[] splitted = bbox.split(",");