annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/MiddleBedHeightData.java @ 6152:0587819960c3

Waterlevel differences & bed height differences: Add new model LinearInterpolated intented to unify the two very similiar calculations. The focus of the current implementation is correctness and not speed! The fact that the data sets more mostly sorted by station is not exploited. Doing so would improve performance significantly.
author Sascha L. Teichmann <teichmann@intevation.de>
date Sun, 02 Jun 2013 17:52:53 +0200
parents af13ceeba52a
children 4508501cdde7
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3924
diff changeset
9 package org.dive4elements.river.artifacts.model;
2713
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import java.io.Serializable;
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12
3924
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
13 import java.util.ArrayList;
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
14
2713
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import gnu.trove.TDoubleArrayList;
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3924
diff changeset
17 import org.dive4elements.artifacts.CallContext;
2714
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
18
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3924
diff changeset
19 import org.dive4elements.river.artifacts.resources.Resources;
2714
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
20
3924
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
21 import org.apache.log4j.Logger;
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
22
2713
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 public class MiddleBedHeightData implements Serializable {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25
3924
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
26 /** Very private logger. */
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
27 private static final Logger logger = Logger.getLogger(MiddleBedHeightData.class);
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
28
2714
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
29 public static final String I18N_SINGLE_NAME = "facet.bedheight_middle.single";
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
30 public static final String I18N_EPOCH_NAME = "facet.bedheight_middle.epoch";
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
31
2713
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 private int startYear;
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 private int endYear;
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 private String evaluatedBy;
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 private String description;
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 private TDoubleArrayList km;
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 private TDoubleArrayList middleHeight;
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 private TDoubleArrayList uncertainty;
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 private TDoubleArrayList soundingWidth;
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 private TDoubleArrayList dataGap;
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 private TDoubleArrayList width;
3924
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
43 private ArrayList empty;
2713
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 protected MiddleBedHeightData(int start, int end, String eval, String desc) {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 this.startYear = start;
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 this.endYear = end;
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 this.evaluatedBy = eval;
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 this.description = desc;
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 this.km = new TDoubleArrayList();
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 this.middleHeight = new TDoubleArrayList();
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 this.uncertainty = new TDoubleArrayList();
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 this.soundingWidth = new TDoubleArrayList();
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 this.dataGap = new TDoubleArrayList();
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 this.width = new TDoubleArrayList();
3924
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
58 this.empty = new ArrayList();
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
59 }
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
60
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
61 public void addAll(double station, double height, double uncertainty,
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
62 double soundingWidth, double dataGap, double width, boolean isEmpty) {
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
63 addKM(station);
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
64 addMiddleHeight(height);
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
65 addUncertainty(uncertainty);
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
66 addSoundingWidth(soundingWidth);
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
67 addDataGap(dataGap);
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
68 addWidth(width);
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
69 addIsEmpty(isEmpty);
2713
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 public int getStartYear() {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 return startYear;
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 public int getEndYear() {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 return endYear;
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 public String getEvaluatedBy() {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 return evaluatedBy;
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 public String getDescription() {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 return description;
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89
3924
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
90 protected void addKM(double km) {
2713
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 this.km.add(km);
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 public double getKM(int idx) {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 return km.get(idx);
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97
3924
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
98 protected void addMiddleHeight(double middleHeight) {
2713
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 this.middleHeight.add(middleHeight);
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 public double getMiddleHeight(int idx) {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103 return middleHeight.get(idx);
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105
3924
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
106 protected void addUncertainty(double uncertainty) {
2713
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107 this.uncertainty.add(uncertainty);
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 public double getUncertainty(int idx) {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 return uncertainty.get(idx);
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113
3924
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
114 protected void addSoundingWidth(double soundingWidth) {
2713
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 this.soundingWidth.add(soundingWidth);
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 public double getSoundingWidth(int idx) {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 return soundingWidth.get(idx);
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121
3924
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
122 protected void addDataGap(double gap) {
2713
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 this.dataGap.add(gap);
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126 public double getDataGap(int idx) {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 return dataGap.get(idx);
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129
3924
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
130 protected void addIsEmpty(boolean empty) {
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
131 this.empty.add(empty);
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
132 }
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
133
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
134 public boolean isEmpty(int idx) {
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
135 return (Boolean) empty.get(idx);
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
136 }
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
137
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
138
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
139 protected void addWidth(double width) {
2713
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 this.width.add(width);
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 public double getWidth(int idx) {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 return width.get(idx);
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147 public int size() {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148 return km.size();
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151
3924
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
152 /**
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
153 * Get the points, ready to be drawn
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
154 * @return [[km1, km2,...],[height1,height2,...]]
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
155 */
2713
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 public double[][] getMiddleHeightsPoints() {
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157 double[][] points = new double[2][size()];
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 for (int i = 0, n = size(); i < n; i++) {
3924
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
160 if (isEmpty(i)) {
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
161 points[0][i] = getKM(i);
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
162 points[1][i] = Double.NaN;
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
163 }
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
164 else {
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
165 points[0][i] = getKM(i);
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
166 points[1][i] = getMiddleHeight(i);
5fced192b95c Towards fix of issue863 (gaps in middle heigh bed data).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3083
diff changeset
167 }
2713
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
168 }
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
169
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
170 return points;
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
171 }
2714
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
172
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
173
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
174 public String getSoundingName(CallContext context) {
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
175 if (getStartYear() == getEndYear()) {
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
176 return Resources.getMsg(
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
177 context.getMeta(),
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
178 I18N_SINGLE_NAME,
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
179 I18N_SINGLE_NAME,
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
180 new Object[] { getStartYear() }
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
181 );
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
182 }
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
183 else {
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
184 return Resources.getMsg(
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
185 context.getMeta(),
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
186 I18N_EPOCH_NAME,
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
187 I18N_EPOCH_NAME,
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
188 new Object[] { getStartYear(), getEndYear() }
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
189 );
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
190 }
2952f6dee5cf Added an exporter for middle bed height values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2713
diff changeset
191 }
2713
b60751cfdd6c Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
192 }
3083
4bd3d8bbb60c Added missing vim lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2714
diff changeset
193 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org