From 5947f9cae011e23a8ae67c817e84eb9fccf02c52 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Fri, 6 Mar 2015 16:23:56 +0000 Subject: [PATCH] Added downscale C-Square git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widget-common-event@113499 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../CSquareDownscaleResolution.java | 64 +++++++++++++++++++ .../geospatial/GeospatialCoordinatesType.java | 12 ++-- .../shared/operations/OperationsId.java | 4 ++ .../shared/operations/UIOperationsId.java | 1 + 4 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/geospatial/CSquareDownscaleResolution.java diff --git a/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/geospatial/CSquareDownscaleResolution.java b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/geospatial/CSquareDownscaleResolution.java new file mode 100644 index 0000000..b93fd49 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/geospatial/CSquareDownscaleResolution.java @@ -0,0 +1,64 @@ +package org.gcube.portlets.user.td.widgetcommonevent.shared.geospatial; + +import java.util.Arrays; +import java.util.List; + +/** + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +public enum CSquareDownscaleResolution { + TEN("10"), + FIVE("5"), + ONE("1"), + HALF_DEGREE("0.5"), + TENTH_DEGREE("0.1"), + HALF_TENTH("0.05"), + CENTH_DEGREE("0.01"), + HALF_CENTH("0.005"), + MILLI_DEGREE("0.001"), + HALF_MILLI("0.0005"); + + /** + * @param text + */ + private CSquareDownscaleResolution(final String id) { + this.id = id; + } + + private final String id; + + @Override + public String toString() { + return id; + } + + public String getId() { + return id; + } + + + public static List getList(){ + return Arrays.asList(values()); + + } + + + public static CSquareDownscaleResolution getGeospatialCoordinatesTypeFromId( + String id) { + for(CSquareDownscaleResolution v:values()){ + if (id.compareTo(v.id) == 0) { + return v; + } + } + return null; + } + + public String getLabel(){ + return id; + } + + +} diff --git a/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/geospatial/GeospatialCoordinatesType.java b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/geospatial/GeospatialCoordinatesType.java index bff3127..0998bd3 100644 --- a/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/geospatial/GeospatialCoordinatesType.java +++ b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/geospatial/GeospatialCoordinatesType.java @@ -39,16 +39,12 @@ public enum GeospatialCoordinatesType { public static GeospatialCoordinatesType getGeospatialCoordinatesTypeFromId( String id) { - if (id.compareTo(C_SQUARE.id) == 0) { - return C_SQUARE; - } else { - if (id.compareTo(OCEAN_AREA.id) == 0) { - return OCEAN_AREA; - } else { - return null; - + for(GeospatialCoordinatesType coordType:values()){ + if (id.compareTo(coordType.id) == 0) { + return coordType; } } + return null; } public String getLabel(){ diff --git a/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/operations/OperationsId.java b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/operations/OperationsId.java index 99eee06..5537f9f 100644 --- a/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/operations/OperationsId.java +++ b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/operations/OperationsId.java @@ -39,6 +39,9 @@ package org.gcube.portlets.user.td.widgetcommonevent.shared.operations; * Denormalize3005 * GroupBy3006 * RemoveDuplicateTuples3007 + * Normalize3008 + * TimeAggregation3009 + * DownscaleCSquare/td>3010 * ReplaceColumnByExpression3101 * ReplaceById3102 * FilterByExpression3201 @@ -103,6 +106,7 @@ public enum OperationsId { RemoveDuplicateTuples("3007"), Normalize("3008"), TimeAggregation("3009"), + DownscaleCSquare("3010"), ReplaceColumnByExpression("3101"), ReplaceById("3102"), FilterByExpression("3201"), diff --git a/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/operations/UIOperationsId.java b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/operations/UIOperationsId.java index a5c1838..1f52847 100644 --- a/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/operations/UIOperationsId.java +++ b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/operations/UIOperationsId.java @@ -52,6 +52,7 @@ public enum UIOperationsId { ChartTopRating("Top Rating Chart"), GeometryCreatePoint("Geometry Create Point"), GeospatialCreateCoordinates("Geospatial Create Coordinates"), + DownscaleCSquare("Downscale C-Square"), Pending("Pending"); /**