ref 11708: Setting initial map location and zoom level for the spatial data inputs in SAI

https://support.d4science.org/issues/11708

Added location and zoom

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/data-miner-manager-cl@178769 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2019-03-28 17:10:56 +00:00
parent c22a27a19e
commit d9b1f67cd4
7 changed files with 180 additions and 29 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/data-miner-manager-cl-1.6.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/data-miner-manager-cl-1.7.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/data-miner-manager-cl-1.6.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<classpathentry excluding="**" kind="src" output="target/data-miner-manager-cl-1.7.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
@ -28,10 +28,10 @@
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<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.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/data-miner-manager-cl-1.6.0-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/data-miner-manager-cl-1.7.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -1,6 +1,6 @@
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.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error

View File

@ -1,4 +1,9 @@
<ReleaseNotes>
<Changeset component="${groupId}.${artifactId}.1-7-0"
date="2019-03-14">
<Change>Added location and zoom support [ticket #11708]</Change>
<Change>Added coordinates EPSG:4326 and EPSG:3857 support [ticket #11710]</Change>
</Changeset>
<Changeset component="${groupId}.${artifactId}.1-6-0"
date="2019-01-31">
<Change>Updated to support get operator by id with refresh</Change>

23
pom.xml
View File

@ -11,7 +11,7 @@
<groupId>org.gcube.data.analysis</groupId>
<artifactId>data-miner-manager-cl</artifactId>
<version>1.6.0-SNAPSHOT</version>
<version>1.7.0-SNAPSHOT</version>
<name>data-miner-manager-cl</name>
<description>DataMiner Manager Client Library</description>
@ -39,17 +39,16 @@
<distroDirectory>distro</distroDirectory>
<configDirectory>config</configDirectory>
<!-- Java -->
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- Java Version -->
<javaVersion>1.7</javaVersion>
<!-- GWT configuration -->
<gwtVersion>2.6.1</gwtVersion>
<gwtLogVersion>3.3.2</gwtLogVersion>
<!-- <gxtVersion>3.1.1</gxtVersion> -->
<!-- <gxt2Version>2.6.1</gxt2Version> -->
<KEYS>${env.KEYS}</KEYS>
@ -177,7 +176,7 @@
<version>1.7.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@ -245,7 +244,7 @@
<plugins>
<!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version> </plugin> -->
@ -269,16 +268,16 @@
</compileSourcesArtifacts> -->
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${javaVersion}</source>
<target>${javaVersion}</target>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>

View File

@ -20,6 +20,7 @@ import net.opengis.wps.x100.SupportedComplexDataType;
import org.gcube.data.analysis.dataminermanagercl.shared.exception.ServiceException;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.ColumnListParameter;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.ColumnParameter;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.Coordinates;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.DateParameter;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.EnumParameter;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.FileParameter;
@ -200,43 +201,45 @@ public class WPS2DM {
private static Parameter retrieveWKTParameter(String id, String title, String defaultValue) {
WKTGeometryType wktGeometryType = WKTGeometryType.Polygon;
if (title.contains("[WKT_POINT]")) {
title = title.replace("[WKT_POINT]", "");
return new WKTParameter(id, title, WKTGeometryType.Point, defaultValue);
wktGeometryType = WKTGeometryType.Point;
} else {
if (title.contains("[WKT_LINESTRING]")) {
title = title.replace("[WKT_LINESTRING]", "");
return new WKTParameter(id, title, WKTGeometryType.LineString, defaultValue);
wktGeometryType = WKTGeometryType.LineString;
} else {
if (title.contains("[WKT_POLYGON]")) {
title = title.replace("[WKT_POLYGON]", "");
return new WKTParameter(id, title, WKTGeometryType.Polygon, defaultValue);
wktGeometryType = WKTGeometryType.Polygon;
} else {
if (title.contains("[WKT_CIRCLE]")) {
title = title.replace("[WKT_CIRCLE]", "");
return new WKTParameter(id, title, WKTGeometryType.Circle, defaultValue);
wktGeometryType = WKTGeometryType.Circle;
} else {
if (title.contains("[WKT_TRIANGLE]")) {
title = title.replace("[WKT_TRIANGLE]", "");
return new WKTParameter(id, title, WKTGeometryType.Triangle, defaultValue);
wktGeometryType = WKTGeometryType.Triangle;
} else {
if (title.contains("[WKT_SQUARE]")) {
title = title.replace("[WKT_SQUARE]", "");
return new WKTParameter(id, title, WKTGeometryType.Square, defaultValue);
wktGeometryType = WKTGeometryType.Square;
} else {
if (title.contains("[WKT_PENTAGON]")) {
title = title.replace("[WKT_PENTAGON]", "");
return new WKTParameter(id, title, WKTGeometryType.Pentagon, defaultValue);
wktGeometryType = WKTGeometryType.Pentagon;
} else {
if (title.contains("[WKT_HEXAGON]")) {
title = title.replace("[WKT_HEXAGON]", "");
return new WKTParameter(id, title, WKTGeometryType.Hexagon, defaultValue);
wktGeometryType = WKTGeometryType.Hexagon;
} else {
if (title.contains("[WKT_BOX]")) {
title = title.replace("[WKT_BOX]", "");
return new WKTParameter(id, title, WKTGeometryType.Box, defaultValue);
wktGeometryType = WKTGeometryType.Box;
} else {
return new WKTParameter(id, title, WKTGeometryType.Polygon, defaultValue);
wktGeometryType = WKTGeometryType.Polygon;
}
}
}
@ -246,8 +249,53 @@ public class WPS2DM {
}
}
}
Coordinates coordinates = retrieveCoordinates(title);
String wktDescription= cleanWKTDescription(title);
WKTParameter wktParameter = new WKTParameter(id, wktDescription, wktGeometryType, coordinates, defaultValue);
logger.debug("Retrieved WKTParameter: " + wktParameter);
return wktParameter;
}
private static Coordinates retrieveCoordinates(String title) {
logger.debug("Retrieve Coordinates");
Coordinates coordinates = null;
if (title != null && !title.isEmpty() && title.contains("[COORDS_")) {
Pattern pattern = Pattern.compile("\\[COORDS_(.*?)_(.*?)_(.*?)_(.*?)\\]");
Matcher matcher = pattern.matcher(title);
if (matcher.find()) {
logger.debug("Coords Match found");
coordinates = new Coordinates(matcher.group(1), matcher.group(2), matcher.group(3), matcher.group(4));
}
}
logger.debug("Retrieved Coordinates: " + coordinates);
return coordinates;
}
private static String cleanWKTDescription(String title) {
if (title != null && !title.isEmpty()) {
int indexStart = title.indexOf("[COORDS_");
if (indexStart > -1 && indexStart < title.length()) {
String subTitle = title.substring(indexStart);
logger.debug("Title without the initial part: " + subTitle);
int indexEnd = subTitle.indexOf("]");
if (indexEnd > -1 && indexEnd < subTitle.length()) {
StringBuilder titleCleaned = new StringBuilder();
titleCleaned.append(title.substring(0, indexStart));
if (indexEnd + 1 < subTitle.length()) {
titleCleaned.append(subTitle.substring(indexEnd + 1));
}
title = new String(titleCleaned.toString());
}
}
}
logger.debug("Cleaned Description: " + title);
return title;
}
/**
*
* @param maxMegaBytes

View File

@ -0,0 +1,67 @@
package org.gcube.data.analysis.dataminermanagercl.shared.parameters;
import java.io.Serializable;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class Coordinates implements Serializable {
private static final long serialVersionUID = -1387634056697911513L;
private String projection;
private String x;
private String y;
private String zoom;
public Coordinates() {
super();
}
public Coordinates(String projection, String x, String y, String zoom) {
super();
this.projection = projection;
this.x = x;
this.y = y;
this.zoom = zoom;
}
public String getProjection() {
return projection;
}
public void setProjection(String projection) {
this.projection = projection;
}
public String getX() {
return x;
}
public void setX(String x) {
this.x = x;
}
public String getY() {
return y;
}
public void setY(String y) {
this.y = y;
}
public String getZoom() {
return zoom;
}
public void setZoom(String zoom) {
this.zoom = zoom;
}
@Override
public String toString() {
return "Coordinates [projection=" + projection + ", x=" + x + ", y=" + y + ", zoom=" + zoom + "]";
}
}

View File

@ -13,6 +13,7 @@ public class WKTParameter extends Parameter {
private static final long serialVersionUID = 1673874854501249519L;
private WKTGeometryType wktGeometryType;
private Coordinates coordinates;
private String defaultValue;
/**
@ -38,6 +39,28 @@ public class WKTParameter extends Parameter {
super(name, ParameterType.WKT, description);
this.wktGeometryType = wktGeometryType;
this.defaultValue = defaultValue;
this.coordinates = null;
}
/**
*
* @param name
* Name
* @param description
* Description
* @param wktGeometryType
* WKT geometry type
* @param coordinates
* Coordinates
* @param defaultValue
* Default Value
*/
public WKTParameter(String name, String description, WKTGeometryType wktGeometryType, Coordinates coordinates,
String defaultValue) {
super(name, ParameterType.WKT, description);
this.wktGeometryType = wktGeometryType;
this.defaultValue = defaultValue;
this.coordinates = coordinates;
}
/**
@ -72,10 +95,19 @@ public class WKTParameter extends Parameter {
this.wktGeometryType = wktGeometryType;
}
public Coordinates getCoordinates() {
return coordinates;
}
public void setCoordinates(Coordinates coordinates) {
this.coordinates = coordinates;
}
@Override
public String toString() {
return "WKTParameter [wktGeometryType=" + wktGeometryType + ", defaultValue=" + defaultValue + ", value="
+ value + ", name=" + name + ", description=" + description + ", typology=" + typology + "]";
return "WKTParameter [wktGeometryType=" + wktGeometryType + ", coordinates=" + coordinates + ", defaultValue="
+ defaultValue + ", name=" + name + ", description=" + description + ", typology=" + typology
+ ", value=" + value + "]";
}
}