Mercurial > dive4elements > river
comparison 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 |
comparison
equal
deleted
inserted
replaced
6300:0711ce5ca701 | 6301:20a32dbdbb59 |
---|---|
20 { | 20 { |
21 private static Logger log = Logger.getLogger(W.class); | 21 private static Logger log = Logger.getLogger(W.class); |
22 | 22 |
23 protected TDoubleArrayList ws; | 23 protected TDoubleArrayList ws; |
24 | 24 |
25 public static final int METER_OVER_REFPOINT = 0; | |
26 | |
27 public static final int CENTIMETER_AT_GAUGE = 1; | |
28 | |
29 protected int referenceSystem; | |
30 | |
25 public W() { | 31 public W() { |
26 ws = new TDoubleArrayList(); | 32 ws = new TDoubleArrayList(); |
27 } | 33 } |
28 | 34 |
29 public W(String name) { | 35 public W(String name) { |
34 public W(int capacity) { | 40 public W(int capacity) { |
35 this(capacity, ""); | 41 this(capacity, ""); |
36 } | 42 } |
37 | 43 |
38 public W(int capacity, String name) { | 44 public W(int capacity, String name) { |
45 this(capacity, "", METER_OVER_REFPOINT); | |
46 } | |
47 | |
48 public W(int capacity, String name, int referenceSystem) { | |
39 super(name); | 49 super(name); |
50 this.referenceSystem = referenceSystem; | |
40 ws = new TDoubleArrayList(capacity); | 51 ws = new TDoubleArrayList(capacity); |
52 } | |
53 | |
54 public void setReferenceSystem(int val) { | |
55 referenceSystem = val; | |
56 } | |
57 | |
58 /** Return the used reference system for W. | |
59 * If the W's refer to values in meters over a reference | |
60 * point (e.g. NN+m) they are in meter. If they are | |
61 * relative to the PNP of a gauge they are in centimeter*/ | |
62 public int getReferenceSystem() { | |
63 return referenceSystem; | |
64 } | |
65 | |
66 /** Convenience function to get the correct unit for W values. */ | |
67 public String getWUnit() { | |
68 if (getReferenceSystem() == CENTIMETER_AT_GAUGE) { | |
69 return "cm"; | |
70 } | |
71 return "m"; | |
41 } | 72 } |
42 | 73 |
43 public void add(double value) { | 74 public void add(double value) { |
44 ws.add(value); | 75 ws.add(value); |
45 } | 76 } |