comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculationResult.java @ 8877:9f7a285b0ee3

Some work on SINFO FlowDepth
author gernotbelger
date Thu, 08 Feb 2018 18:48:24 +0100
parents 7bbfb24e6eec
children 7a8c12706834
comparison
equal deleted inserted replaced
8876:23264d1a528f 8877:9f7a285b0ee3
1 /* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde 1 /* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
2 * Software engineering by 2 * Software engineering by
3 * Björnsen Beratende Ingenieure GmbH 3 * Björnsen Beratende Ingenieure GmbH
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt 4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
5 * 5 *
6 * This file is Free Software under the GNU AGPL (>=v3) 6 * This file is Free Software under the GNU AGPL (>=v3)
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the 7 * and comes with ABSOLUTELY NO WARRANTY! Check out the
8 * documentation coming with Dive4Elements River for details. 8 * documentation coming with Dive4Elements River for details.
21 * 21 *
22 * @author Gernot Belger 22 * @author Gernot Belger
23 */ 23 */
24 class FlowDepthCalculationResult 24 class FlowDepthCalculationResult
25 implements Serializable { 25 implements Serializable {
26
27 private static final long serialVersionUID = 1L;
28 26
29 private final Collection<FlowDepthRow> rows = new ArrayList<>(); 27 private static final long serialVersionUID = 1L;
30 28
31 private final String wstLabel; 29 private final Collection<FlowDepthRow> rows = new ArrayList<>();
32
33 private final String soundingLabel;
34 30
35 public FlowDepthCalculationResult(final String wstLabel, final String soundingLabel) { 31 private final String label;
36 this.wstLabel = wstLabel;
37 this.soundingLabel = soundingLabel;
38 }
39 32
40 public void addRow(double station, double flowDepth, double flowDepthWithTkh, double tkh, double waterlevel, double discharge, String waterlevelLabel, String gauge, double meanBedHeight, String sondageLabel, String location) { 33 private final BedHeightInfo sounding;
41 rows.add(new FlowDepthRow(station, flowDepth, flowDepthWithTkh, tkh, waterlevel, discharge, waterlevelLabel, gauge, meanBedHeight, sondageLabel, location));
42 }
43
44 public String getWstLabel() {
45 return this.wstLabel;
46 }
47 34
48 public String getSoundingLabel() { 35 private final WstInfo wst;
49 return this.soundingLabel;
50 }
51 36
52 public Collection<FlowDepthRow> getRows() { 37 public FlowDepthCalculationResult(final String label, final WstInfo wst, final BedHeightInfo sounding) {
53 return Collections.unmodifiableCollection( rows ); 38 this.label = label;
54 } 39 this.wst = wst;
55 40 this.sounding = sounding;
41 }
42
43 public void addRow(final double station, final double flowDepth, final double flowDepthWithTkh, final double tkh, final double waterlevel, final double discharge, final String waterlevelLabel, final String gauge, final double meanBedHeight, final String sondageLabel, final String location) {
44 this.rows.add(new FlowDepthRow(station, flowDepth, flowDepthWithTkh, tkh, waterlevel, discharge, waterlevelLabel, gauge, meanBedHeight, sondageLabel, location));
45 }
46
47 public String getLabel() {
48 return this.label;
49 }
50
51 public WstInfo getWst() {
52 return this.wst;
53 }
54
55 public BedHeightInfo getSounding() {
56 return this.sounding;
57 }
58
59 public Collection<FlowDepthRow> getRows() {
60 return Collections.unmodifiableCollection( this.rows );
61 }
62
56 public double[][] getFlowDepthPoints() { 63 public double[][] getFlowDepthPoints() {
57 64
58 TDoubleArrayList xPoints = new TDoubleArrayList(rows.size()); 65 final TDoubleArrayList xPoints = new TDoubleArrayList(this.rows.size());
59 TDoubleArrayList yPoints = new TDoubleArrayList(rows.size()); 66 final TDoubleArrayList yPoints = new TDoubleArrayList(this.rows.size());
60 67
61 for (FlowDepthRow row : rows) { 68 for (final FlowDepthRow row : this.rows) {
62 xPoints.add(row.getStation()); 69 xPoints.add(row.getStation());
63 yPoints.add(row.getFlowDepth()); 70 yPoints.add(row.getFlowDepth());
64 } 71 }
65 72
66 return new double[][] { xPoints.toNativeArray(), yPoints.toNativeArray() }; 73 return new double[][] { xPoints.toNativeArray(), yPoints.toNativeArray() };
67 } 74 }
68 } 75 }

http://dive4elements.wald.intevation.org