merged with Feauture/19220
This commit is contained in:
parent
cb0bf23241
commit
b755de5c2a
|
@ -3,6 +3,9 @@
|
|||
component="org.gcube.portlets-user.GISViewer.4-5-0" date="2020-05-07">
|
||||
<Change>[Task #19207]: init parameter to set max zoom level
|
||||
</Change>
|
||||
<Change>[Task #19220]: CQL filtering (if activated for WMS) should be
|
||||
applied also for GetFeature request
|
||||
</Change>
|
||||
</Changeset>
|
||||
<Changeset
|
||||
component="org.gcube.portlets-user.GISViewer.4-4-0" date="2020-04-21">
|
||||
|
|
|
@ -19,6 +19,10 @@ public class Constants {
|
|||
public static final String DOWNLOAD_WSF_FEATURES_SERVICE = GWT.getModuleBaseURL() + "DownloadWFSFeatures";
|
||||
public static final String PARAMETER_WFS_REQUEST = "wfs-request";
|
||||
|
||||
public static final int WFS_COLUMN_WIDTH = 140;
|
||||
|
||||
public static final int SOUTH_PANEL_HEIGHT = 400;
|
||||
|
||||
// LOG AND INFO PRINTING
|
||||
public static boolean printLog=false;
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ public class GisViewerLayout extends LayoutContainer {
|
|||
centerPanelData = new BorderLayoutData(LayoutRegion.CENTER);
|
||||
centerPanelData.setMargins(new Margins(0));
|
||||
|
||||
southPanelData = new BorderLayoutData(LayoutRegion.SOUTH, 200);
|
||||
southPanelData = new BorderLayoutData(LayoutRegion.SOUTH, Constants.SOUTH_PANEL_HEIGHT);
|
||||
southPanelData.setSplit(true);
|
||||
southPanelData.setCollapsible(true);
|
||||
southPanelData.setFloatable(true);
|
||||
|
|
|
@ -292,17 +292,22 @@ implements ToolbarHandler, DataPanelHandler, LayersPanelHandler, CqlFilterHandle
|
|||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
||||
if(westPanel.isMasked())
|
||||
westPanel.unmask();
|
||||
|
||||
if(layersPanel.isMasked())
|
||||
layersPanel.unmask();
|
||||
|
||||
Window.alert(caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(GeoInformationForWMSRequest result) {
|
||||
|
||||
if(westPanel.isMasked())
|
||||
westPanel.unmask();
|
||||
|
||||
if(layersPanel.isMasked())
|
||||
layersPanel.unmask();
|
||||
|
||||
|
@ -434,6 +439,8 @@ implements ToolbarHandler, DataPanelHandler, LayersPanelHandler, CqlFilterHandle
|
|||
}
|
||||
|
||||
if (lastClickDataInfo.isPoint()) {
|
||||
//THIS CASE IS ORPHAN. IT SHOULD NOT BE (NEVER) CALLED BY CODE
|
||||
GWT.log("Data point selection");
|
||||
List<String> urls = gerUrlsForClickData(lastClickDataInfo);
|
||||
mainPanel.setDataPanelWait(true);
|
||||
|
||||
|
@ -452,6 +459,7 @@ implements ToolbarHandler, DataPanelHandler, LayersPanelHandler, CqlFilterHandle
|
|||
}
|
||||
});
|
||||
} else if (lastClickDataInfo.isBox()) {
|
||||
GWT.log("Data box selection");
|
||||
String bbox = lastClickDataInfo.getBbox();
|
||||
mainPanel.setDataPanelWait(true);
|
||||
|
||||
|
@ -987,7 +995,12 @@ implements ToolbarHandler, DataPanelHandler, LayersPanelHandler, CqlFilterHandle
|
|||
else {
|
||||
openLayersMap.setCqlFilter(layerItem, filter);
|
||||
layersPanel.setCqlTip(layerItem, true);
|
||||
//tryng to sync CQL with WFS features
|
||||
showDataPanel();
|
||||
}
|
||||
|
||||
|
||||
//showDataPanel();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -999,6 +1012,8 @@ implements ToolbarHandler, DataPanelHandler, LayersPanelHandler, CqlFilterHandle
|
|||
openLayersMap.removeCqlFilter(layerItem);
|
||||
layersPanel.setCqlTip(layerItem, false);
|
||||
}
|
||||
//tryng to sync CQL with WFS features
|
||||
showDataPanel();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -1051,6 +1066,7 @@ implements ToolbarHandler, DataPanelHandler, LayersPanelHandler, CqlFilterHandle
|
|||
}
|
||||
|
||||
// create a list of url request for data (for each geoserver)
|
||||
GWT.log("Querying for: "+lastClickDataInfo);
|
||||
showDataPanel();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import com.google.gwt.core.shared.GWT;
|
|||
*/
|
||||
public class URLMakers {
|
||||
|
||||
public static String CQL_FILTER_PARAMETER = "CQL_FILTER";
|
||||
|
||||
/**
|
||||
* Encoding layer.
|
||||
|
@ -141,16 +142,9 @@ public class URLMakers {
|
|||
*/
|
||||
public static String getWfsFeatureUrl(LayerItem l, String bbox, int limit, String format) {
|
||||
|
||||
// COMMENTED 26/06/2014
|
||||
// String link = l.getGeoserverUrl() +
|
||||
// "/wfs?service=wfs&version=1.1.0&REQUEST=GetFeature" +
|
||||
// "&TYPENAME=" + l.getLayer() +
|
||||
// "&BBOX=" + bbox +
|
||||
// (limit==0 ? "" : "&MAXFEATURES="+limit) +
|
||||
// (format==null ? "" : "&OUTPUTFORMAT="+format);
|
||||
|
||||
String link = l.getGeoserverUrl();
|
||||
GWT.log("GeoserverUrl is: "+link);
|
||||
System.out.println("GeoserverUrl is: "+link);
|
||||
System.out.println("CQL filter is: "+l.getCqlFilter());
|
||||
|
||||
String outputformat = null;
|
||||
String srsName = null;
|
||||
|
@ -185,12 +179,27 @@ public class URLMakers {
|
|||
+ "&REQUEST=GetFeature"
|
||||
+ "&srsName="+srsName
|
||||
+ "&TYPENAME=" + l.getLayer()+
|
||||
(boundingBox==null ? "" : "&BBOX="+boundingBox)+
|
||||
// + "&BBOX=" + boundingBox +
|
||||
(limit==0 ? "" : "&MAXFEATURES="+limit) +
|
||||
(outputformat==null ? "" : "&OUTPUTFORMAT="+outputformat);
|
||||
|
||||
GWT.log("WFS: "+link);
|
||||
if(l.getCqlFilter()!=null && !l.getCqlFilter().isEmpty()) {
|
||||
if(l.getCqlFilter().contains("BBOX(the_geom")) {
|
||||
//THE BBOX IS ALREADY USED INTO CQL FILTERING, SO USING IT DIRECTLY
|
||||
link +="&"+CQL_FILTER_PARAMETER+"="+l.getCqlFilter();
|
||||
}else {
|
||||
//I NEED TO ENCODE THE BBOX INTO CQL FILTERING,
|
||||
String cqlFilterValue = "BBOX(the_geom,"+boundingBox+")"+
|
||||
" AND "+l.getCqlFilter();
|
||||
|
||||
link +="&"+CQL_FILTER_PARAMETER+"="+cqlFilterValue;
|
||||
}
|
||||
|
||||
}else {
|
||||
//NO CQL FILTERING APPLIED
|
||||
link += (boundingBox==null ? "" : "&BBOX="+boundingBox);
|
||||
}
|
||||
|
||||
System.out.println("WFS: "+link);
|
||||
return link;
|
||||
}
|
||||
|
||||
|
@ -274,6 +283,23 @@ public class URLMakers {
|
|||
return gsUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the last char.
|
||||
*
|
||||
* @param string the string
|
||||
* @return the string
|
||||
*/
|
||||
public static String removeLastChar(String string){
|
||||
|
||||
if(string == null)
|
||||
return null;
|
||||
|
||||
if(string.length()>0)
|
||||
return string.substring(0, string.length()-1);
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The main method.
|
||||
|
|
|
@ -4,6 +4,7 @@ package org.gcube.portlets.user.gisviewer.client.datafeature;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.gisviewer.client.Constants;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.DataResult;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.ResultColumn;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.ResultRow;
|
||||
|
@ -15,8 +16,10 @@ import com.extjs.gxt.ui.client.widget.Html;
|
|||
import com.extjs.gxt.ui.client.widget.TabItem;
|
||||
import com.extjs.gxt.ui.client.widget.TabPanel;
|
||||
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
||||
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
|
||||
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
||||
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
||||
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
|
||||
import com.extjs.gxt.ui.client.widget.layout.CenterLayout;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||
|
||||
|
@ -31,7 +34,8 @@ public class DataResultPanel extends TabPanel {
|
|||
public DataResultPanel() {
|
||||
super();
|
||||
|
||||
this.setMinTabWidth(115);
|
||||
//this.setMinTabWidth(115);
|
||||
this.setMinTabWidth(200);
|
||||
this.setAutoWidth(true);
|
||||
|
||||
this.setResizeTabs(true);
|
||||
|
@ -101,7 +105,8 @@ public class DataResultPanel extends TabPanel {
|
|||
|
||||
|
||||
TabItem item = new TabItem();
|
||||
item.setText(dr.getTitle());
|
||||
String title = "("+rows.size()+")" + dr.getTitle();
|
||||
item.setText(title);
|
||||
item.setClosable(true);
|
||||
|
||||
|
||||
|
@ -123,7 +128,12 @@ public class DataResultPanel extends TabPanel {
|
|||
public void setDataResultFromWfs(List<WebFeatureTable> result) {
|
||||
for (WebFeatureTable table: result) {
|
||||
TabItem item = new TabItem();
|
||||
item.setText(table.getTitle());
|
||||
|
||||
String title = table.getTitle();
|
||||
if(table.getRows()!=null)
|
||||
title = "("+table.getRows().size()+") " + title;
|
||||
|
||||
item.setText(title);
|
||||
item.setClosable(true);
|
||||
|
||||
item.addStyleName("pad-text");
|
||||
|
@ -137,11 +147,31 @@ public class DataResultPanel extends TabPanel {
|
|||
ListStore<BaseModel> listStore = new ListStore<BaseModel>();
|
||||
|
||||
List<String> columnNames = table.getColumnNames();
|
||||
for (String columnName : columnNames) {
|
||||
for (final String columnName : columnNames) {
|
||||
ColumnConfig column = new ColumnConfig();
|
||||
column.setId(columnName);
|
||||
column.setHeader(columnName);
|
||||
column.setWidth(65);
|
||||
//set the renderer for the grid cell. Adding the tool-tip 'title'
|
||||
column.setRenderer(new GridCellRenderer<BaseModel>() {
|
||||
@Override
|
||||
public Object render(BaseModel model, String property,
|
||||
ColumnData config, int rowIndex,
|
||||
int colIndex, ListStore<BaseModel> store,
|
||||
Grid<BaseModel> grid) {
|
||||
String value = model.get(property);
|
||||
if (value != null) {
|
||||
// return "<div qtitle='" + Format.htmlEncode(value) +
|
||||
// "' qtip='" + Format.htmlEncode(value) +
|
||||
// "'>" + value + "</div>";
|
||||
//String thevalue = Format.htmlEncode(value);
|
||||
String thevalue = value;
|
||||
//GWT.log("value is: "+thevalue);
|
||||
return "<span title='" + thevalue + "'>" + thevalue + "</span>";
|
||||
}
|
||||
return value;
|
||||
}
|
||||
});
|
||||
column.setWidth(Constants.WFS_COLUMN_WIDTH);
|
||||
configs.add(column);
|
||||
}
|
||||
|
||||
|
@ -157,6 +187,27 @@ public class DataResultPanel extends TabPanel {
|
|||
item.setLayout(new FitLayout());
|
||||
item.add(grid);
|
||||
|
||||
//adding the tool-tip to single cell value
|
||||
/*QuickTip quickTip = new QuickTip(grid);
|
||||
grid.addListener(Events.OnMouseOver, new Listener<GridEvent<BaseModel>>(){
|
||||
|
||||
@Override
|
||||
public void handleEvent(GridEvent<BaseModel> ge) {
|
||||
try {
|
||||
com.google.gwt.dom.client.Element el= grid.getView().getCell(ge.getRowIndex(),ge.getColIndex());
|
||||
if(el!=null && el.getFirstChildElement()!=null) {
|
||||
String value = Format.htmlEncode(el.getFirstChildElement().getInnerText());
|
||||
GWT.log("value is: "+value);
|
||||
String html = "<span qtip='" + value + "'>" + value + "</span>";
|
||||
el.getFirstChildElement().setInnerHTML(html);
|
||||
}
|
||||
}catch (Exception e) {
|
||||
GWT.log(e.getMessage());
|
||||
}
|
||||
}
|
||||
});*/
|
||||
|
||||
|
||||
} else {
|
||||
item.setLayout(new CenterLayout());
|
||||
item.add(new Html(MESSAGE_NO_DATA));
|
||||
|
|
|
@ -21,6 +21,7 @@ import com.extjs.gxt.ui.client.widget.Html;
|
|||
import com.extjs.gxt.ui.client.widget.Label;
|
||||
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||
import com.extjs.gxt.ui.client.widget.form.TextField;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.KeyCodes;
|
||||
|
||||
public class CqlFilterPanel {
|
||||
|
@ -124,4 +125,9 @@ public class CqlFilterPanel {
|
|||
cqlFilterHandler.setCQLFilter(layerItem, cqlQueryObject.getCqlQuery());
|
||||
dialog.hide();
|
||||
}
|
||||
|
||||
public String getCQLFilterApplied(){
|
||||
GWT.log("The CQL filter applied is: "+filterTextField.getValue());
|
||||
return filterTextField.getValue();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,11 +10,16 @@ import org.gcube.portlets.user.gisviewer.client.commons.beans.GisViewerBaseLayer
|
|||
import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItem;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.MapViewInfo;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.TransectParameters;
|
||||
import org.gcube.portlets.user.gisviewer.client.resources.Images;
|
||||
import org.gwtopenmaps.openlayers.client.Bounds;
|
||||
import org.gwtopenmaps.openlayers.client.Icon;
|
||||
import org.gwtopenmaps.openlayers.client.LonLat;
|
||||
import org.gwtopenmaps.openlayers.client.Map;
|
||||
import org.gwtopenmaps.openlayers.client.MapOptions;
|
||||
import org.gwtopenmaps.openlayers.client.MapWidget;
|
||||
import org.gwtopenmaps.openlayers.client.Marker;
|
||||
import org.gwtopenmaps.openlayers.client.Pixel;
|
||||
import org.gwtopenmaps.openlayers.client.Size;
|
||||
import org.gwtopenmaps.openlayers.client.ZIndexBase;
|
||||
import org.gwtopenmaps.openlayers.client.control.Control;
|
||||
import org.gwtopenmaps.openlayers.client.control.DrawFeature;
|
||||
|
@ -35,6 +40,7 @@ import org.gwtopenmaps.openlayers.client.geometry.Point;
|
|||
import org.gwtopenmaps.openlayers.client.handler.RegularPolygonHandler;
|
||||
import org.gwtopenmaps.openlayers.client.handler.RegularPolygonHandlerOptions;
|
||||
import org.gwtopenmaps.openlayers.client.layer.Layer;
|
||||
import org.gwtopenmaps.openlayers.client.layer.Markers;
|
||||
import org.gwtopenmaps.openlayers.client.layer.Vector;
|
||||
import org.gwtopenmaps.openlayers.client.layer.VectorOptions;
|
||||
import org.gwtopenmaps.openlayers.client.layer.WMS;
|
||||
|
@ -78,11 +84,7 @@ public class OpenLayersMap {
|
|||
private HashMap<Layer, LayerItem> mappingLayersToLayerItems = new HashMap<Layer, LayerItem>();
|
||||
private NavToolbar mouseToolBar;
|
||||
private MouseDefaults mouseDefaults;
|
||||
//private OverviewMap overViewMap;
|
||||
//private MouseClickOnMap mouseClickOnMap;
|
||||
// private ToolBarPanelOld toolBarPanel;
|
||||
private int numZoomLevels = 0;
|
||||
//private String projection = "";
|
||||
private Vector vectorLayer;
|
||||
private ZoomBox zoomBox;
|
||||
private boolean clickData = false;
|
||||
|
@ -359,8 +361,10 @@ public class OpenLayersMap {
|
|||
FeatureAddedListener listener = new FeatureAddedListener() {
|
||||
@Override
|
||||
public void onFeatureAdded(VectorFeature vf) {
|
||||
|
||||
if (prevVf!=null)
|
||||
vectorLayer.removeFeature(prevVf);
|
||||
|
||||
prevVf = vf;
|
||||
vectorLayer.setZIndex(MAX_ZINDEX);
|
||||
|
||||
|
@ -426,6 +430,7 @@ public class OpenLayersMap {
|
|||
}
|
||||
|
||||
};
|
||||
|
||||
MousePositionOptions mpOptions = new MousePositionOptions();
|
||||
mpOptions.setFormatOutput(mpOut);
|
||||
MousePosition mousePosition = new MousePosition(mpOptions);
|
||||
|
@ -483,17 +488,6 @@ public class OpenLayersMap {
|
|||
|
||||
map.addLayers(layers);
|
||||
//vectorLayer.setZIndex(MAX_ZINDEX);
|
||||
|
||||
// OverviewMapOptions overOptions = new OverviewMapOptions();
|
||||
// Layer[] ls = new Layer[1];
|
||||
// ls[0] = layers[0];
|
||||
//
|
||||
// overOptions.setLayers(ls);
|
||||
//
|
||||
// if (Constants.isOverViewMapVisible) {
|
||||
// overViewMap = new OverviewMap();
|
||||
// addControl(overViewMap);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -568,6 +562,17 @@ public class OpenLayersMap {
|
|||
return panel;
|
||||
}
|
||||
|
||||
public void addMarker(LonLat lonLat) {
|
||||
Markers markers = new Markers("Markers");
|
||||
map.addLayer(markers);
|
||||
|
||||
Size size = new Size(21,25);
|
||||
Pixel offset = new Pixel(-(size.getWidth()/2), -size.getHeight());
|
||||
Icon icon = new Icon(Images.mapMarked().createImage().getUrl(), size, offset);
|
||||
markers.addMarker(new Marker(lonLat,icon));
|
||||
//markers.addMarker(new Marker(lonLat,icon.clone()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the opacity.
|
||||
*
|
||||
|
|
|
@ -126,4 +126,8 @@ public class Images {
|
|||
public static AbstractImagePrototype loading() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.loadingImg());
|
||||
}
|
||||
|
||||
public static AbstractImagePrototype mapMarked() {
|
||||
return AbstractImagePrototype.create(GisViewer.resources.mapMarker());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,6 +145,13 @@ public interface Resources extends ClientBundle {
|
|||
ImageResource gisViewerIcon();
|
||||
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
@Source("new-icon/map-marker.png")
|
||||
ImageResource mapMarker();
|
||||
|
||||
|
||||
// @Source("baselayer.txt")
|
||||
// TextResource baseLayer();
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -24,6 +24,7 @@ import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItem;
|
|||
import org.gcube.portlets.user.gisviewer.server.datafeature.wfs.WFSExporter;
|
||||
import org.gcube.portlets.user.gisviewer.server.datafeature.wfs.WFSExporter.WFS_TO;
|
||||
import org.gcube.portlets.user.gisviewer.server.util.CSVWriter;
|
||||
import org.gcube.portlets.user.gisviewer.server.util.URLParserUtil;
|
||||
import org.gcube.portlets.user.gisviewer.shared.CSVFile;
|
||||
import org.gcube.portlets.user.gisviewer.shared.CSVRow;
|
||||
|
||||
|
@ -75,14 +76,16 @@ public class DownloadWFSFeaturesServlet extends HttpServlet{
|
|||
sendError(resp, HttpServletResponse.SC_BAD_REQUEST, "Bad Request: parameter "+Constants.PARAMETER_WFS_REQUEST+" is null");
|
||||
try{
|
||||
LOG.info("Read param: "+Constants.PARAMETER_WFS_REQUEST +" "+wfsRequestURL);
|
||||
String layerName = getValueOfParameter("TYPENAME", wfsRequestURL);
|
||||
String layerName = URLParserUtil.extractValueOfParameterFromURL("TYPENAME", wfsRequestURL);
|
||||
String geoserverURL = wfsRequestURL.substring(0,wfsRequestURL.indexOf("?"));
|
||||
String bbox = getValueOfParameter("BBOX", wfsRequestURL);
|
||||
String bbox = URLParserUtil.extractValueOfParameterFromURL("BBOX", wfsRequestURL);
|
||||
String cqlFilter = URLParserUtil.extractValueOfParameterFromURL("CQL_FILTER", wfsRequestURL);
|
||||
|
||||
LayerItem layerItem = new LayerItem();
|
||||
layerItem.setLayer(layerName);
|
||||
layerItem.setGeoserverUrl(geoserverURL);
|
||||
layerItem.setName(layerName);
|
||||
layerItem.setCqlFilter(cqlFilter);
|
||||
LOG.info("From WFS request got: "+layerItem);
|
||||
LOG.info("layerName: "+layerItem.getName());
|
||||
LOG.info("wfs service URL: "+layerItem.getGeoserverUrl());
|
||||
|
@ -181,34 +184,6 @@ public class DownloadWFSFeaturesServlet extends HttpServlet{
|
|||
return csvWriter;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value of parameter.
|
||||
*
|
||||
* @param paramName the param name
|
||||
* @param requestURL the request URL
|
||||
* @return the value of parameter
|
||||
*/
|
||||
public static String getValueOfParameter(String paramName, String requestURL) {
|
||||
// logger.trace("finding: "+paramName +" into "+requestURL);
|
||||
int index = requestURL.toLowerCase().indexOf(paramName.toLowerCase()+"="); //ADDING CHAR "=" IN TAIL TO BE SECURE IT IS A PARAMETER
|
||||
// logger.trace("start index of "+paramName+ " is: "+index);
|
||||
String value = "";
|
||||
if(index > -1){
|
||||
|
||||
int start = index + paramName.length()+1; //add +1 for char '='
|
||||
String sub = requestURL.substring(start, requestURL.length());
|
||||
int indexOfSeparator = sub.indexOf("&");
|
||||
int end = indexOfSeparator!=-1?indexOfSeparator:sub.length();
|
||||
value = sub.substring(0, end);
|
||||
}else
|
||||
return null;
|
||||
|
||||
// logger.trace("return value: "+value);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to manage HttpServletResponse content length also to big data.
|
||||
*
|
||||
|
|
|
@ -68,10 +68,13 @@ public abstract class GisViewerServiceImpl extends RemoteServiceServlet implemen
|
|||
* @see org.gcube.portlets.user.gisviewer.client.GisViewerService#getDataResult(java.util.List)
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public List<DataResult> getDataResult(List<String> urls) {
|
||||
//THIS METHOD IS ORPHAN. IT SHOULD NOT BE CALLED FROM THIS CODE
|
||||
List<DataResult> result = new ArrayList<DataResult>();
|
||||
|
||||
for (String url : urls) {
|
||||
logger.info("Data point selection: "+url);
|
||||
List<DataResult> oneGeoserverResult = ClickDataParser.getDataResult(url); // TODO adjust url adding wms
|
||||
result.addAll(oneGeoserverResult);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.io.FileNotFoundException;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
@ -17,6 +18,7 @@ import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItem;
|
|||
import org.gcube.portlets.user.gisviewer.client.commons.utils.URLMakers;
|
||||
import org.gcube.portlets.user.gisviewer.server.util.CSVReader;
|
||||
import org.gcube.portlets.user.gisviewer.server.util.JSONUtil;
|
||||
import org.gcube.portlets.user.gisviewer.server.util.URLParserUtil;
|
||||
import org.gcube.portlets.user.gisviewer.shared.CSVFile;
|
||||
import org.gcube.portlets.user.gisviewer.shared.CSVRow;
|
||||
import org.json.JSONArray;
|
||||
|
@ -140,6 +142,17 @@ public class WFSExporter {
|
|||
InputStream is = null;
|
||||
try {
|
||||
String url = URLMakers.getWfsFeatureUrl(layerItem, bbox, maxWFSFeature, Constants.JSON);
|
||||
String cqlFilterValue = URLParserUtil.extractValueOfParameterFromURL(URLMakers.CQL_FILTER_PARAMETER, url);
|
||||
log.info("Found CQL filter value into query string: "+cqlFilterValue);
|
||||
|
||||
if(cqlFilterValue!=null) {
|
||||
String notEncodedCQLFilter = String.format("%s=%s",URLMakers.CQL_FILTER_PARAMETER,cqlFilterValue);
|
||||
//log.info("Found CQL filter: "+notEncodedCQLFilter);
|
||||
String toEncodeCQLFilter = String.format("%s=%s",URLMakers.CQL_FILTER_PARAMETER,URLEncoder.encode(cqlFilterValue,"UTF-8"));
|
||||
log.debug("Encoded CQL filter: "+toEncodeCQLFilter);
|
||||
url = url.replace(notEncodedCQLFilter, toEncodeCQLFilter);
|
||||
}
|
||||
|
||||
log.info("getTableFromJson -> WFS URL: "+url);
|
||||
is = new URL(url).openStream();
|
||||
String jsonTxt = IOUtils.toString(is);
|
||||
|
@ -287,5 +300,14 @@ public class WFSExporter {
|
|||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Gets the WFS exporter config to.
|
||||
*
|
||||
* @param wfsTo the wfs to
|
||||
* @return the WFS exporter config to
|
||||
*/
|
||||
public FeatureExporterFileConfig getWFSExporterConfigTo(WFS_TO wfsTo){
|
||||
return mapWFSConfig.get(wfsTo);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public class GisConfigurationPropertyReader {
|
|||
this.geoNetworkUrl = prop.getProperty(GEONETWORK_URL);
|
||||
this.geoNetworkUser = prop.getProperty(GEONETWORK_USER);
|
||||
this.geoNetworkPwd = prop.getProperty(GEONETWORK_PWD);
|
||||
logger.info("geoNetworkPwd: "+geoNetworkPwd +" tentative to descypt...");
|
||||
logger.info("geoNetworkPwd: "+geoNetworkPwd +" tentative to decrypt...");
|
||||
String decryptedPassword;
|
||||
|
||||
this.scope = prop.getProperty(SCOPE);
|
||||
|
@ -96,7 +96,7 @@ public class GisConfigurationPropertyReader {
|
|||
this.geoServerUrl = prop.getProperty(GEOSERVER_URL);
|
||||
this.geoServerUser = prop.getProperty(GEOSERVER_USER);
|
||||
this.geoServerPwd = prop.getProperty(GEOSERVER_PWD);
|
||||
logger.info("geoServerPwd: "+geoServerPwd +" tentative to descypt...");
|
||||
logger.info("geoServerPwd: "+geoServerPwd +" tentative to decrypt...");
|
||||
|
||||
try {
|
||||
decryptedPassword = StringEncrypter.getEncrypter().decrypt(geoServerPwd);
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package org.gcube.portlets.user.gisviewer.server.util;
|
||||
|
||||
|
||||
/**
|
||||
* The Class URLParserUtil.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR Pisa (Italy)
|
||||
* May 8, 2020
|
||||
*/
|
||||
public class URLParserUtil {
|
||||
|
||||
|
||||
/**
|
||||
* Extract value of parameter from URL.
|
||||
*
|
||||
* @param paramName the param name
|
||||
* @param url the url
|
||||
* @return the string
|
||||
*/
|
||||
public static String extractValueOfParameterFromURL(String paramName, String url) {
|
||||
int index = url.toLowerCase().indexOf(paramName.toLowerCase() + "="); // ADDING CHAR "=" IN TAIL TO BE SURE THAT IT
|
||||
// IS A PARAMETER
|
||||
String value = "";
|
||||
if (index > -1) {
|
||||
|
||||
int start = index + paramName.length() + 1; // add +1 for char '='
|
||||
String sub = url.substring(start, url.length());
|
||||
int indexOfSeparator = sub.indexOf("&");
|
||||
int end = indexOfSeparator != -1 ? indexOfSeparator : sub.length();
|
||||
value = sub.substring(0, end);
|
||||
} else
|
||||
return null;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
|
@ -25,10 +25,10 @@ public class WfsTableExporter {
|
|||
public static void main(String[] args) {
|
||||
WFSExporter exporter = new WFSExporter();
|
||||
System.out.println("\n\nEXPORTER TO WFS VIEW: ");
|
||||
printMap(exporter.getToWFSViewFileConfig().getMap());
|
||||
printMap(exporter.getWFSExporterConfigTo(WFS_TO.VIEW).getMap());
|
||||
|
||||
System.out.println("\n\nEXPORTER TO WFS EXPORT: ");
|
||||
printMap(exporter.getToWFSExportFileConfig().getMap());
|
||||
printMap(exporter.getWFSExporterConfigTo(WFS_TO.EXPORT).getMap());
|
||||
|
||||
String bbox = "-90,-180,90,180";
|
||||
int maxFeatures = 200;
|
||||
|
@ -48,7 +48,7 @@ public class WfsTableExporter {
|
|||
l.setGeoserverUrl("https://geona-proto.d4science.org/geoserver/geona-proto/wms");
|
||||
l.setName("geona-proto:schede_sub");
|
||||
bbox = "40.9130859375,13.194580078125,41.46240234375,13.919677734375";
|
||||
|
||||
l.setCqlFilter("ANNO_DA<1942");
|
||||
|
||||
CSVFile table = exporter.getTableFromJsonToExport(l, bbox, maxFeatures, WFS_TO.VIEW);
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue