removed PointsPath and passed to Geometry JSON string

This commit is contained in:
Francesco Mangiacrapa 2021-09-06 16:39:12 +02:00
parent ad71d45158
commit 0e082c0c37
6 changed files with 188 additions and 165 deletions

View File

@ -48,14 +48,20 @@ public class GeoportalDataViewerConstants {
public static enum MAP_PROJECTION { public static enum MAP_PROJECTION {
EPSG_4326("EPSG:4326"), EPSG_3857("EPSG:3857"); EPSG_4326("4326", "EPSG:4326"), EPSG_3857("3857", "EPSG:3857");
String id;
String name; String name;
MAP_PROJECTION(String name) { MAP_PROJECTION(String id, String name) {
this.id = id;
this.name = name; this.name = name;
} }
public String getId() {
return id;
}
public String getName() { public String getName() {
return name; return name;
} }
@ -78,17 +84,16 @@ public class GeoportalDataViewerConstants {
public static native void printJs(String msg)/*-{ public static native void printJs(String msg)/*-{
console.log("js console: " + msg); console.log("js console: " + msg);
}-*/; }-*/;
/** /**
* Prints the. * Prints the.
* *
* @param msg the msg * @param msg the msg
*/ */
public static native void printJsObj(Object object)/*-{ public static native void printJsObj(Object object)/*-{
console.log("js obj: "+JSON.stringify(object, null, 4)); console.log("js obj: " + JSON.stringify(object, null, 4));
}-*/; }-*/;
/** /**
* Prints the. * Prints the.
* *

View File

@ -21,6 +21,8 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEventH
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEventHandler; import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM; import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil; import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil; import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
@ -29,7 +31,6 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.PointsPath;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
@ -41,6 +42,8 @@ import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element; import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event; import com.google.gwt.user.client.Event;
@ -52,6 +55,10 @@ import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.VerticalPanel;
import ol.Coordinate; import ol.Coordinate;
import ol.Extent;
import ol.OLFactory;
import ol.format.GeoJson;
import ol.geom.Geometry;
/** /**
* The Class LayerManager. * The Class LayerManager.
@ -350,17 +357,69 @@ public class LayerManager {
} }
Coordinate centerTo = null; Coordinate centerTo = null;
GWT.log("geometry is: " + feature.getGeometry());
if (feature.getGeometry() != null) { if (feature.getGeometry() != null) {
GWT.log("trasforming geometry: " + feature.getGeometry().getToJSONObject());
Geometry geom = new GeoJson()
.readGeometry(feature.getGeometry().getToJSONObject(), null);
//POINT
if (geom.getType().equalsIgnoreCase("Point")) {
GWT.log("geometry: is a point");
String coordinateJSON = feature.getGeometry().getCoordinatesJSON();
JSONArray centerJSON = (JSONArray) JSONParser
.parseStrict(coordinateJSON);
// Coordinate center = OLFactory.createCoordinate(
// new Double(centerJSON.get(0).toString()),
// new Double(centerJSON.get(1).toString()));
Coordinate center = new Coordinate(new Double(centerJSON.get(0).toString()),
new Double(centerJSON.get(1).toString()));
if (feature.getCrsName() != null && feature.getCrsName().endsWith(MAP_PROJECTION.EPSG_4326.getId())) {
center = MapUtils.transformCoordiante(center,
MAP_PROJECTION.EPSG_4326.getName(),
MAP_PROJECTION.EPSG_3857.getName());
}
centerTo = center;
} else {
Extent geomExtent = geom.getExtent();
Coordinate lower = OLFactory.createCoordinate(
geomExtent.getLowerLeftX(), geomExtent.getLowerLeftY());
Coordinate upper = OLFactory.createCoordinate(
geomExtent.getUpperRightX(), geomExtent.getUpperRightY());
Coordinate lowerCoord = lower;
Coordinate upperCoord = upper;
if (feature.getCrsName() != null && feature.getCrsName()
.endsWith(MAP_PROJECTION.EPSG_4326.getId())) {
lowerCoord = MapUtils.transformCoordiante(lower,
MAP_PROJECTION.EPSG_4326.getName(),
MAP_PROJECTION.EPSG_3857.getName());
upperCoord = MapUtils.transformCoordiante(upper,
MAP_PROJECTION.EPSG_4326.getName(),
MAP_PROJECTION.EPSG_3857.getName());
}
ExtentWrapped ew = new ExtentWrapped(lowerCoord.getX(),
lowerCoord.getY(), upperCoord.getX(), upperCoord.getY());
centerTo = new Coordinate(ew.getCenter().getX(), ew.getCenter().getY());
PointsPath path = feature.getGeometry().getPath();
GWT.log("Points Path: " + path);
if (path != null && path.getCoordinates() != null
&& path.getCoordinates().length > 0) {
org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.Coordinate center = path
.getCoordinates()[0];
centerTo = new Coordinate(center.getX(), center.getY());
} }
GWT.log("center is: "+centerTo);
// PointsPath path = feature.getGeometry().getPath();
// GWT.log("Points Path: " + path);
// if (path != null && path.getCoordinates() != null
// && path.getCoordinates().length > 0) {
// org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.Coordinate center = path
// .getCoordinates()[0];
// centerTo = new Coordinate(center.getX(), center.getY());
// }
} }
// fallback // fallback
@ -538,8 +597,8 @@ public class LayerManager {
* @param isNcWms the is nc wms * @param isNcWms the is nc wms
* @param UUID the uuid * @param UUID the uuid
* @param zAxis the z axis * @param zAxis the z axis
* @param minResolution the min resolution * @param minResolution the min resolution
* @param maxResolution the max resolution * @param maxResolution the max resolution
* @return the layer item * @return the layer item
*/ */
private LayerItem toLayerItem(LayerType layerType, String layerTitle, String layerName, String layerURL, private LayerItem toLayerItem(LayerType layerType, String layerTitle, String layerName, String layerURL,

View File

@ -19,23 +19,20 @@ import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.application.geoportalcommon.util.URLParserUtil; import org.gcube.application.geoportalcommon.util.URLParserUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.Coordinate;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureGeometry; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureGeometry;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.PointsPath;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* The Class FeatureParser. * The Class FeatureParser.
* *
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
* *
* Nov 13, 2020 * Nov 13, 2020
*/ */
public class FeatureParser { public class FeatureParser {
@ -44,125 +41,132 @@ public class FeatureParser {
/** /**
* Gets the WFS features. * Gets the WFS features.
* *
* @param layerItem the layer item * @param layerItem the layer item
* @param mapSrsName the map srs name * @param mapSrsName the map srs name
* @param selectBBOX the select BBOX * @param selectBBOX the select BBOX
* @param maxWFSFeature the max WFS feature * @param maxWFSFeature the max WFS feature
* @return the WFS features * @return the WFS features
*/ */
public static List<FeatureRow> getWFSFeatures(LayerItem layerItem, String mapSrsName, BoundsMap selectBBOX, int maxWFSFeature) { public static List<FeatureRow> getWFSFeatures(LayerItem layerItem, String mapSrsName, BoundsMap selectBBOX,
int maxWFSFeature) {
if(maxWFSFeature<0) { if (maxWFSFeature < 0) {
maxWFSFeature = GeoportalDataViewerConstants.MAX_WFS_FEATURES; maxWFSFeature = GeoportalDataViewerConstants.MAX_WFS_FEATURES;
} }
return getWFSFeatureProperties(layerItem, mapSrsName, selectBBOX, maxWFSFeature); return getWFSFeatureProperties(layerItem, mapSrsName, selectBBOX, maxWFSFeature);
} }
/** /**
* Gets the WFS feature properties. * Gets the WFS feature properties.
* *
* @param layerItem the layer item * @param layerItem the layer item
* @param mapSrsName the map srs name * @param mapSrsName the map srs name
* @param selectBBOX the select BBOX * @param selectBBOX the select BBOX
* @param maxWFSFeature the max WFS feature * @param maxWFSFeature the max WFS feature
* @return the WFS feature properties * @return the WFS feature properties
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private static List<FeatureRow> getWFSFeatureProperties(LayerItem layerItem, String mapSrsName, BoundsMap selectBBOX, int maxWFSFeature) { private static List<FeatureRow> getWFSFeatureProperties(LayerItem layerItem, String mapSrsName,
BoundsMap selectBBOX, int maxWFSFeature) {
LOG.info("getWFSFeatureProperties for layerItem: "+layerItem.getName() +" in the "+selectBBOX +" and maxWFSFeature: "+maxWFSFeature); LOG.info("getWFSFeatureProperties for layerItem: " + layerItem.getName() + " in the " + selectBBOX
+ " and maxWFSFeature: " + maxWFSFeature);
InputStream is = null; InputStream is = null;
List<FeatureRow> listFeaturesRow = new ArrayList<FeatureRow>(); List<FeatureRow> listFeaturesRow = new ArrayList<FeatureRow>();
try { try {
String url = GisMakers.buildWFSFeatureQuery(layerItem, mapSrsName, selectBBOX, maxWFSFeature, GisMakers.JSON); String url = GisMakers.buildWFSFeatureQuery(layerItem, mapSrsName, selectBBOX, maxWFSFeature,
GisMakers.JSON);
String cqlFilterValue = URLParserUtil.extractValueOfParameterFromURL(GisMakers.CQL_FILTER_PARAMETER, url); String cqlFilterValue = URLParserUtil.extractValueOfParameterFromURL(GisMakers.CQL_FILTER_PARAMETER, url);
LOG.info("Found CQL filter value into query string: "+cqlFilterValue); LOG.info("Found CQL filter value into query string: " + cqlFilterValue);
if(cqlFilterValue!=null) { if (cqlFilterValue != null) {
String notEncodedCQLFilter = String.format("%s=%s",GisMakers.CQL_FILTER_PARAMETER,cqlFilterValue); String notEncodedCQLFilter = String.format("%s=%s", GisMakers.CQL_FILTER_PARAMETER, cqlFilterValue);
//log.info("Found CQL filter: "+notEncodedCQLFilter); // log.info("Found CQL filter: "+notEncodedCQLFilter);
String toEncodeCQLFilter = String.format("%s=%s",GisMakers.CQL_FILTER_PARAMETER,URLEncoder.encode(cqlFilterValue,"UTF-8")); String toEncodeCQLFilter = String.format("%s=%s", GisMakers.CQL_FILTER_PARAMETER,
LOG.debug("Encoded CQL filter: "+toEncodeCQLFilter); URLEncoder.encode(cqlFilterValue, "UTF-8"));
LOG.debug("Encoded CQL filter: " + toEncodeCQLFilter);
url = url.replace(notEncodedCQLFilter, toEncodeCQLFilter); url = url.replace(notEncodedCQLFilter, toEncodeCQLFilter);
} }
LOG.info("Built WFS URL: "+url); LOG.info("Built WFS URL: " + url);
is = new URL(url).openStream(); is = new URL(url).openStream();
String jsonTxt = IOUtils.toString(is); String jsonTxt = IOUtils.toString(is);
if(jsonTxt==null || jsonTxt.isEmpty()){ if (jsonTxt == null || jsonTxt.isEmpty()) {
jsonTxt = "{\"type\":\"FeatureCollection\",\"features\":[]}"; jsonTxt = "{\"type\":\"FeatureCollection\",\"features\":[]}";
} }
// get json object // get json object
JSONObject json = new JSONObject(jsonTxt); JSONObject json = new JSONObject(jsonTxt);
// iterate features // iterate features
JSONArray features = json.getJSONArray("features"); JSONArray features = json.getJSONArray("features");
if(features.length()==0) { if (features.length() == 0) {
LOG.info("No features detected in the response, returning empty list"); LOG.info("No features detected in the response, returning empty list");
return listFeaturesRow; return listFeaturesRow;
} }
String featureCRSName = ""; String featureCRSName = "";
try { try {
JSONObject crs = json.getJSONObject("crs"); JSONObject crs = json.getJSONObject("crs");
JSONObject crsProp = crs.getJSONObject("properties"); JSONObject crsProp = crs.getJSONObject("properties");
featureCRSName = crsProp.getString("name"); featureCRSName = crsProp.getString("name");
LOG.info("Crs name found: "+featureCRSName); LOG.info("Crs name found: " + featureCRSName);
}catch (Exception e) { } catch (Exception e) {
LOG.warn("Unable to read the field 'crs'"); LOG.warn("Unable to read the field 'crs'");
} }
LOG.info("Features are: "+features.length()); LOG.info("Features are: " + features.length());
for (int i=0; i<features.length(); i++) { for (int i = 0; i < features.length(); i++) {
final FeatureRow row = new FeatureRow(); final FeatureRow row = new FeatureRow();
row.setCrsName(featureCRSName); row.setCrsName(featureCRSName);
JSONObject theFeature = ((JSONObject)features.get(i)); JSONObject theFeature = ((JSONObject) features.get(i));
LOG.debug("Building at index: "+i); LOG.debug("Building at index: " + i);
try { try {
JSONObject geometry = theFeature.getJSONObject("geometry"); JSONObject geometry = theFeature.getJSONObject("geometry");
String typeValue = geometry.getString("type"); String typeValue = geometry.getString("type");
JSONArray coordinates = geometry.getJSONArray("coordinates"); // JSONArray coordinates = geometry.getJSONArray("coordinates");
//String toCoordinates = coordinates.toString(); // String toCoordinates = coordinates.toString();
String x1 = coordinates.get(0).toString(); // String x1 = coordinates.get(0).toString();
String y1 = coordinates.get(1).toString(); // String y1 = coordinates.get(1).toString();
LOG.debug("Coordinate x1: "+x1); // LOG.debug("Coordinate x1: "+x1);
LOG.debug("Coordinate y1: "+y1); // LOG.debug("Coordinate y1: "+y1);
Double coordX = null; // Double coordX = null;
Double coordY = null; // Double coordY = null;
FeatureGeometry fg = new FeatureGeometry(); FeatureGeometry fg = new FeatureGeometry();
fg.setType(typeValue); fg.setType(typeValue);
//TODO ONLY POINT GEOMETRY // TODO ONLY POINT GEOMETRY
try { try {
coordX = Double.parseDouble(x1); JSONArray coordinates = geometry.getJSONArray("coordinates");
coordY = Double.parseDouble(y1); String coordinateJSONString = coordinates.toString();
Coordinate coord = new Coordinate(coordX, coordY); LOG.debug("coordinates are: " + coordinateJSONString);
fg.setPath(new PointsPath(new Coordinate[] {coord})); fg.setCoordinatesJSON(coordinates.toString());
}catch (Exception e) { // coordX = Double.parseDouble(x1);
LOG.warn("Not able to parse the 'coordinates' field: ",e); // coordY = Double.parseDouble(y1);
// Coordinate coord = new Coordinate(coordX, coordY);
// fg.setPath(new PointsPath(new Coordinate[] {coord}));
} catch (Exception e) {
LOG.warn("Not able to parse the 'coordinates' field: ", e);
} }
row.setGeometry(fg); row.setGeometry(fg);
}catch (Exception e) { } catch (Exception e) {
LOG.debug("Unable to pase geometry at index: "+i); LOG.debug("Unable to parse geometry at index: " + i);
} }
// // iterate properties // // iterate properties
JSONObject properties = theFeature.getJSONObject("properties"); JSONObject properties = theFeature.getJSONObject("properties");
Map<String,List<String>> mapProperties = new HashMap<String,List<String>>(); Map<String, List<String>> mapProperties = new HashMap<String, List<String>>();
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Iterator<String> ii = properties.keys(); Iterator<String> ii = properties.keys();
while (ii.hasNext()) { while (ii.hasNext()) {
String key = ii.next(); String key = ii.next();
String value = properties.optString(key,""); String value = properties.optString(key, "");
List<String> theValues = mapProperties.get(key); List<String> theValues = mapProperties.get(key);
if(theValues==null) if (theValues == null)
mapProperties.put(key, Arrays.asList(value)); mapProperties.put(key, Arrays.asList(value));
else { else {
theValues.add(value); theValues.add(value);
@ -171,18 +175,18 @@ public class FeatureParser {
} }
row.setMapProperties(mapProperties); row.setMapProperties(mapProperties);
listFeaturesRow.add(row); listFeaturesRow.add(row);
LOG.info("Added row "+row+" to exported properties"); LOG.info("Added row " + row + " to exported properties");
} }
} catch (IOException e) { } catch (IOException e) {
LOG.error("Error for layerItem name: "+layerItem.getName(), e); LOG.error("Error for layerItem name: " + layerItem.getName(), e);
} catch (JSONException e) { } catch (JSONException e) {
LOG.error("Error for layerItem name: "+layerItem.getName(), e); LOG.error("Error for layerItem name: " + layerItem.getName(), e);
}finally{ } finally {
IOUtils.closeQuietly(is); IOUtils.closeQuietly(is);
} }
LOG.info("Returning "+listFeaturesRow.size()+" features"); LOG.info("Returning " + listFeaturesRow.size() + " features");
return listFeaturesRow; return listFeaturesRow;
} }
} }

View File

@ -3,44 +3,60 @@ package org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs;
import java.io.Serializable; import java.io.Serializable;
/** /**
* The Class FeatureGeoemtry. * The Class FeatureGeometry.
* *
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
* *
* Oct 29, 2020 * Sep 6, 2021
*/ */
public class FeatureGeometry implements WFSGeometry, Serializable { public class FeatureGeometry implements WFSGeometry, Serializable {
/** /**
* *
*/ */
private static final long serialVersionUID = 6251162740446739453L; private static final long serialVersionUID = 8134176011135233810L;
private String type; private String type;
private PointsPath path; private String coordinatesJSON;
private String toJSON;
/**
* Instantiates a new feature geometry.
*/
public FeatureGeometry() { public FeatureGeometry() {
} }
public FeatureGeometry(String type, PointsPath path) { /**
* Instantiates a new feature geometry.
*
* @param type the type
* @param coordinatesJSON the coordinates JSON
*/
public FeatureGeometry(String type, String coordinatesJSON) {
super(); super();
this.type = type; this.type = type;
this.path = path; this.coordinatesJSON = coordinatesJSON;
} }
public String getType() { public String getType() {
return type; return type;
} }
public String getCoordinatesJSON() {
return coordinatesJSON;
}
public void setType(String type) { public void setType(String type) {
this.type = type; this.type = type;
} }
public PointsPath getPath() { public void setCoordinatesJSON(String coordinatesJSON) {
return path; this.coordinatesJSON = coordinatesJSON;
} }
public void setPath(PointsPath path) { public String getToJSONObject() {
this.path = path; if(toJSON==null)
toJSON = "{\"type\":\""+type+"\",\"coordinates\":"+coordinatesJSON+"}";
return toJSON;
} }
@Override @Override
@ -48,10 +64,10 @@ public class FeatureGeometry implements WFSGeometry, Serializable {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append("FeatureGeometry [type="); builder.append("FeatureGeometry [type=");
builder.append(type); builder.append(type);
builder.append(", path="); builder.append(", coordinatesJSON=");
builder.append(path); builder.append(coordinatesJSON);
builder.append("]"); builder.append("]");
return builder.toString(); return builder.toString();
} }
} }

View File

@ -1,60 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs;
import java.io.Serializable;
import java.util.Arrays;
/**
* The Class PointsPath.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 16, 2020
*/
public class PointsPath implements Serializable{
/**
*
*/
private static final long serialVersionUID = -3295493507974317970L;
private Coordinate[] coordinates;
/**
* Instantiates a new points path.
*/
public PointsPath() {
}
/**
* Instantiates a new points path.
*
* @param coordinates the coordinates
*/
public PointsPath(Coordinate[] coordinates) {
super();
this.coordinates = coordinates;
}
public Coordinate[] getCoordinates() {
return coordinates;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("PointsPath [coordinates=");
builder.append(Arrays.toString(coordinates));
builder.append("]");
return builder.toString();
}
}

View File

@ -4,9 +4,9 @@ package org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs;
/** /**
* The Interface WFSGeometry. * The Interface WFSGeometry.
* *
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
* *
* Nov 16, 2020 * Sep 6, 2021
*/ */
public interface WFSGeometry { public interface WFSGeometry {
@ -16,13 +16,12 @@ public interface WFSGeometry {
* @return the type * @return the type
*/ */
String getType(); String getType();
/** /**
* Gets the path. * Gets the coordinates JSON.
* *
* @return the path * @return the coordinates JSON
*/ */
PointsPath getPath(); String getCoordinatesJSON();
} }