changeset 480:46bb2b9e0bdc

Introduced a 'scale' parameter in Gauge.determineMinMaxW(). flys-backend/trunk@1787 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 02 May 2011 11:33:32 +0000
parents f9653fc8ef7b
children 73052199f9f6
files flys-backend/ChangeLog flys-backend/src/main/java/de/intevation/flys/model/Gauge.java
diffstat 2 files changed, 20 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/ChangeLog	Sun May 01 11:14:18 2011 +0000
+++ b/flys-backend/ChangeLog	Mon May 02 11:33:32 2011 +0000
@@ -1,3 +1,8 @@
+2011-05-02  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/model/Gauge.java: Introduced a 'scale'
+	  that is used to adjust the range of min/max W values.
+
 2011-05-01	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/importer/WstParser.java:
--- a/flys-backend/src/main/java/de/intevation/flys/model/Gauge.java	Sun May 01 11:14:18 2011 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/model/Gauge.java	Mon May 02 11:33:32 2011 +0000
@@ -28,6 +28,8 @@
 public class Gauge
 implements   Serializable
 {
+    public static final int DEFAULT_SCALE = 100;
+
     private Integer    id;
     private String     name;
     private River      river;
@@ -142,11 +144,21 @@
 
 
     /**
+     * Returns min and max W values of this gauge based with a DEFAULT_SCALE.
+     *
+     * @return min and max W value of this gauge [min,max].
+     */
+    public double[] determineMinMaxW() {
+        return determineMinMaxW(DEFAULT_SCALE);
+    }
+
+
+    /**
      * Returns min and max W values of this gauge.
      *
      *  @return the min and max W value of this gauge [min,max].
      */
-    public double[] determineMinMaxW() {
+    public double[] determineMinMaxW(int scale) {
         Session session = SessionHolder.HOLDER.get();
 
         List<DischargeTable> tables   = getDischargeTables();
@@ -173,8 +185,8 @@
 
         return result != null
             ? new double[] {
-                ((BigDecimal) result[0]).doubleValue(),
-                ((BigDecimal) result[1]).doubleValue() }
+                ((BigDecimal) result[0]).doubleValue() * scale,
+                ((BigDecimal) result[1]).doubleValue() * scale}
             : null;
     }
 }

http://dive4elements.wald.intevation.org