Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCrossSectionIndexData.java @ 9429:bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
Colors and i10n for all themes.
author | gernotbelger |
---|---|
date | Fri, 17 Aug 2018 17:48:01 +0200 |
parents | b6e595f1696f |
children | e8b1255fc89e |
comparison
equal
deleted
inserted
replaced
9428:15f274e6d83b | 9429:bd5f5d2220fa |
---|---|
17 * The 'index' that tells the cross section facet which of my result are to be fetched as a cross section line. | 17 * The 'index' that tells the cross section facet which of my result are to be fetched as a cross section line. |
18 * | 18 * |
19 * @author Gernot Belger | 19 * @author Gernot Belger |
20 */ | 20 */ |
21 public final class SalixLineCrossSectionIndexData implements Serializable { | 21 public final class SalixLineCrossSectionIndexData implements Serializable { |
22 | |
23 /** | |
24 * Known waterlevels of the salix computation | |
25 */ | |
26 public enum SalixWaterlevel { | |
27 mnw, mw, mhw, mh5 | |
28 } | |
29 | |
22 private static final long serialVersionUID = 1L; | 30 private static final long serialVersionUID = 1L; |
23 | 31 |
24 private static final SalixLineCrossSectionIndexData SALIX_LINE = new SalixLineCrossSectionIndexData(null, null); | 32 private static final SalixLineCrossSectionIndexData SALIX_LINE = new SalixLineCrossSectionIndexData(null, null); |
25 | 33 |
26 // REMARK: we know at the moment there is exactly one result | 34 // REMARK: we know at the moment there is exactly one result |
27 private final int resultIndex = 0; | 35 private final int resultIndex = 0; |
28 | 36 |
29 private final Integer scenarioIndex; | 37 private final Integer scenarioIndex; |
30 | 38 |
31 private final String waterlevelName; | 39 private final SalixWaterlevel waterlevel; |
32 | 40 |
33 /** | 41 /** |
34 * Creates an instance of this class that represants the salix line. | 42 * Creates an instance of this class that represants the salix line. |
35 */ | 43 */ |
36 public static final SalixLineCrossSectionIndexData salixLine() { | 44 public static final SalixLineCrossSectionIndexData salixLine() { |
48 * Creates an instance of this class that represants the salix line. | 56 * Creates an instance of this class that represants the salix line. |
49 */ | 57 */ |
50 // FIXME: gemeint sind die einzublendenden 'MNW, MW, MHW, HW5' mir nicht klar wo diese Daten herkommen, ggf. aus der | 58 // FIXME: gemeint sind die einzublendenden 'MNW, MW, MHW, HW5' mir nicht klar wo diese Daten herkommen, ggf. aus der |
51 // Rechnung? | 59 // Rechnung? |
52 // FIXME: statt 'name' vielleicht eine enum oder irgend etwas anderes was diese dinger eindeutig referenzieet? | 60 // FIXME: statt 'name' vielleicht eine enum oder irgend etwas anderes was diese dinger eindeutig referenzieet? |
53 public static final SalixLineCrossSectionIndexData waterlevel(final String name) { | 61 public static final SalixLineCrossSectionIndexData waterlevel(final SalixWaterlevel name) { |
54 assert name != null; | 62 assert name != null; |
55 return new SalixLineCrossSectionIndexData(null, name); | 63 return new SalixLineCrossSectionIndexData(null, name); |
56 } | 64 } |
57 | 65 |
58 private SalixLineCrossSectionIndexData(final Integer scenarioIndex, final String waterlevelName) { | 66 private SalixLineCrossSectionIndexData(final Integer scenarioIndex, final SalixWaterlevel waterlevel) { |
59 this.scenarioIndex = scenarioIndex; | 67 this.scenarioIndex = scenarioIndex; |
60 this.waterlevelName = waterlevelName; | 68 this.waterlevel = waterlevel; |
61 } | 69 } |
62 | 70 |
63 public double getCrossSectionLine(final SalixLineCalculationResults results, final double currentKm, final double nextKm, | 71 public double getCrossSectionLine(final SalixLineCalculationResults results, final double currentKm, final double nextKm, final double prevKm, |
64 final double prevKm, final CallContext context) { | 72 final CallContext context) { |
65 | 73 |
66 final SalixLineCalculationResult result = results.getResults().get(this.resultIndex); | 74 final SalixLineCalculationResult result = results.getResults().get(this.resultIndex); |
67 | 75 |
68 if (this.scenarioIndex != null) { | 76 if (this.scenarioIndex != null) { |
69 // fetch scenario result data = salix line value at km | 77 // fetch scenario result data = salix line value at km |
70 return result.getSalixScenarioValue(currentKm, nextKm, prevKm, this.scenarioIndex); | 78 return result.getSalixScenarioValue(currentKm, nextKm, prevKm, this.scenarioIndex); |
71 } | 79 } |
72 | 80 |
73 if (this.waterlevelName != null) { | 81 if (this.waterlevel != null) { |
74 // fetch waterlevel result data = salix line value at km | 82 // fetch waterlevel result data = salix line value at km |
75 return result.getWaterlevelValue(currentKm, nextKm, prevKm, this.waterlevelName); | 83 return result.getWaterlevelValue(currentKm, nextKm, prevKm, this.waterlevel); |
76 } | 84 } |
77 | 85 |
78 // fetch normal result data = salix line value at km | 86 // fetch normal result data = salix line value at km |
79 return result.getSalixValue(currentKm, nextKm, prevKm); | 87 return result.getSalixValue(currentKm, nextKm, prevKm); |
80 } | 88 } |