Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/model/W.java @ 6301:20a32dbdbb59
Remove discharge table scaling but add reference system to W
- Discharge_Tables are now always W[cm] Q[m³] no need for
special case handling depending on historical / master tables
- W now has a referenceSystem value that can be CENTIMETER_AT_GAUGE or
METER_OVER_REFPOINT. The default is METER_OVER_REFPOINT as this is
the case for everything except the objects created from discharge tables
Known issue: WINFO input validation is currently broken as it still scales
the user input.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 12 Jun 2013 10:54:27 +0200 |
parents | af13ceeba52a |
children | 3c4efd4b2c19 |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/W.java Wed Jun 12 16:36:34 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/W.java Wed Jun 12 10:54:27 2013 +0200 @@ -22,6 +22,12 @@ protected TDoubleArrayList ws; + public static final int METER_OVER_REFPOINT = 0; + + public static final int CENTIMETER_AT_GAUGE = 1; + + protected int referenceSystem; + public W() { ws = new TDoubleArrayList(); } @@ -36,10 +42,35 @@ } public W(int capacity, String name) { + this(capacity, "", METER_OVER_REFPOINT); + } + + public W(int capacity, String name, int referenceSystem) { super(name); + this.referenceSystem = referenceSystem; ws = new TDoubleArrayList(capacity); } + public void setReferenceSystem(int val) { + referenceSystem = val; + } + + /** Return the used reference system for W. + * If the W's refer to values in meters over a reference + * point (e.g. NN+m) they are in meter. If they are + * relative to the PNP of a gauge they are in centimeter*/ + public int getReferenceSystem() { + return referenceSystem; + } + + /** Convenience function to get the correct unit for W values. */ + public String getWUnit() { + if (getReferenceSystem() == CENTIMETER_AT_GAUGE) { + return "cm"; + } + return "m"; + } + public void add(double value) { ws.add(value); }