annotate artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthProcessor.java @ 8956:ee5ce13016ed

Work on SINFO-Fließtiefenentwicklung
author gernotbelger
date Tue, 20 Mar 2018 13:30:07 +0100
parents b0aeed4c97c1
children b194fa64506a
rev   line source
8854
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents:
diff changeset
1 /* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
8884
7a8c12706834 Work on SINFO-FlowDepth
gernotbelger
parents: 8854
diff changeset
2 * Software engineering by
7a8c12706834 Work on SINFO-FlowDepth
gernotbelger
parents: 8854
diff changeset
3 * Björnsen Beratende Ingenieure GmbH
8854
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents:
diff changeset
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents:
diff changeset
5 *
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents:
diff changeset
6 * This file is Free Software under the GNU AGPL (>=v3)
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents:
diff changeset
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents:
diff changeset
8 * documentation coming with Dive4Elements River for details.
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents:
diff changeset
9 */
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents:
diff changeset
10
8940
82998242ba84 Preparing for additional outputs of SINFO-Tkh
gernotbelger
parents: 8916
diff changeset
11 package org.dive4elements.river.artifacts.sinfo.common;
8854
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents:
diff changeset
12
8884
7a8c12706834 Work on SINFO-FlowDepth
gernotbelger
parents: 8854
diff changeset
13 import java.util.HashSet;
7a8c12706834 Work on SINFO-FlowDepth
gernotbelger
parents: 8854
diff changeset
14 import java.util.Set;
8854
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents:
diff changeset
15
8940
82998242ba84 Preparing for additional outputs of SINFO-Tkh
gernotbelger
parents: 8916
diff changeset
16 import org.dive4elements.artifactdatabase.state.Facet;
8886
cc86b0f9b3c3 SINFO-FlowDepth - work on tkh themes
gernotbelger
parents: 8884
diff changeset
17 import org.dive4elements.artifacts.CallContext;
cc86b0f9b3c3 SINFO-FlowDepth - work on tkh themes
gernotbelger
parents: 8884
diff changeset
18
8950
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
19 public final class FlowDepthProcessor extends AbstractSInfoLineProcessor<AbstractSInfoCalculationResult> {
8940
82998242ba84 Preparing for additional outputs of SINFO-Tkh
gernotbelger
parents: 8916
diff changeset
20
82998242ba84 Preparing for additional outputs of SINFO-Tkh
gernotbelger
parents: 8916
diff changeset
21 private static final String I18N_AXIS_LABEL = "sinfo.chart.flow_depth.section.yaxis.label";
82998242ba84 Preparing for additional outputs of SINFO-Tkh
gernotbelger
parents: 8916
diff changeset
22
82998242ba84 Preparing for additional outputs of SINFO-Tkh
gernotbelger
parents: 8916
diff changeset
23 private static final String SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL = "sinfo.chart.flow_depth.yaxis.label";
8854
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents:
diff changeset
24
8884
7a8c12706834 Work on SINFO-FlowDepth
gernotbelger
parents: 8854
diff changeset
25 /* Theme name, usually defined in 'FacetTypes', but that is soooo bad dependencies... */
7a8c12706834 Work on SINFO-FlowDepth
gernotbelger
parents: 8854
diff changeset
26 // REMARK: these mustend with 'filtered' so extra handling happens in chart: point are always recalculated, because data
7a8c12706834 Work on SINFO-FlowDepth
gernotbelger
parents: 8854
diff changeset
27 // changes depending on zoom state
8941
a9950a3a71e5 SINFO - tkh, configured result facets and themes
gernotbelger
parents: 8940
diff changeset
28 public static final String FACET_FLOW_DEPTH_FILTERED = "sinfo_facet_flow_depth.filtered";
8854
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents:
diff changeset
29
8940
82998242ba84 Preparing for additional outputs of SINFO-Tkh
gernotbelger
parents: 8916
diff changeset
30 private static final String I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth.filtered.description";
82998242ba84 Preparing for additional outputs of SINFO-Tkh
gernotbelger
parents: 8916
diff changeset
31
8941
a9950a3a71e5 SINFO - tkh, configured result facets and themes
gernotbelger
parents: 8940
diff changeset
32 private static final String FACET_FLOW_DEPTH_TKH_FILTERED = "sinfo_facet_flow_depth_with_tkh.filtered";
8940
82998242ba84 Preparing for additional outputs of SINFO-Tkh
gernotbelger
parents: 8916
diff changeset
33
8941
a9950a3a71e5 SINFO - tkh, configured result facets and themes
gernotbelger
parents: 8940
diff changeset
34 private static final String I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth_with_tkh.filtered.description";
8884
7a8c12706834 Work on SINFO-FlowDepth
gernotbelger
parents: 8854
diff changeset
35
8950
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
36 public static final String FACET_FLOW_DEPTH_MIN_FILTERED = "sinfo_facet_flow_depth_min.filtered";
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
37
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
38 private static final String I18N_FACET_FLOW_DEPTH_MIN_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth_min.filtered.description";
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
39
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
40 public static final String FACET_FLOW_DEPTH_MAX_FILTERED = "sinfo_facet_flow_depth_max.filtered";
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
41
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
42 private static final String I18N_FACET_FLOW_DEPTH_MAX_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth_max.filtered.description";
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
43
8956
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
44 public static final String FACET_FLOW_DEPTH_CURRENT_FILTERED = "sinfo_facet_flow_depth_current.filtered";
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
45
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
46 private static final String I18N_FACET_FLOW_DEPTH_CURRENT_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth_current.filtered.description";
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
47
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
48 public static final String FACET_FLOW_DEPTH_HISTORICAL_FILTERED = "sinfo_facet_flow_depth_historical.filtered";
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
49
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
50 private static final String I18N_FACET_FLOW_DEPTH_HISTORICAL_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth_historical.filtered.description";
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
51
8884
7a8c12706834 Work on SINFO-FlowDepth
gernotbelger
parents: 8854
diff changeset
52 private static final Set<String> HANDLED_FACET_TYPES = new HashSet<>();
7a8c12706834 Work on SINFO-FlowDepth
gernotbelger
parents: 8854
diff changeset
53
7a8c12706834 Work on SINFO-FlowDepth
gernotbelger
parents: 8854
diff changeset
54 static {
7a8c12706834 Work on SINFO-FlowDepth
gernotbelger
parents: 8854
diff changeset
55 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_FILTERED);
7a8c12706834 Work on SINFO-FlowDepth
gernotbelger
parents: 8854
diff changeset
56 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_TKH_FILTERED);
8950
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
57 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_MIN_FILTERED);
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
58 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_MAX_FILTERED);
8956
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
59 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_CURRENT_FILTERED);
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
60 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_HISTORICAL_FILTERED);
8884
7a8c12706834 Work on SINFO-FlowDepth
gernotbelger
parents: 8854
diff changeset
61 }
8854
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents:
diff changeset
62
8884
7a8c12706834 Work on SINFO-FlowDepth
gernotbelger
parents: 8854
diff changeset
63 public FlowDepthProcessor() {
7a8c12706834 Work on SINFO-FlowDepth
gernotbelger
parents: 8854
diff changeset
64 super(I18N_AXIS_LABEL, HANDLED_FACET_TYPES);
8854
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents:
diff changeset
65 }
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents:
diff changeset
66
8886
cc86b0f9b3c3 SINFO-FlowDepth - work on tkh themes
gernotbelger
parents: 8884
diff changeset
67 @Override
8950
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
68 protected double[][] doGetPoints(final AbstractSInfoCalculationResult data, final String facetName) {
8854
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents:
diff changeset
69
8884
7a8c12706834 Work on SINFO-FlowDepth
gernotbelger
parents: 8854
diff changeset
70 if (FACET_FLOW_DEPTH_FILTERED.contentEquals(facetName))
8948
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
71 return data.getStationPoints(SInfoResultType.flowdepth);
8854
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents:
diff changeset
72
8884
7a8c12706834 Work on SINFO-FlowDepth
gernotbelger
parents: 8854
diff changeset
73 if (FACET_FLOW_DEPTH_TKH_FILTERED.contentEquals(facetName))
8948
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
74 return data.getStationPoints(SInfoResultType.flowdepthtkh);
8854
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents:
diff changeset
75
8950
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
76 if (FACET_FLOW_DEPTH_MIN_FILTERED.contentEquals(facetName))
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
77 return data.getStationPoints(SInfoResultType.flowdepthmin);
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
78
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
79 if (FACET_FLOW_DEPTH_MAX_FILTERED.contentEquals(facetName))
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
80 return data.getStationPoints(SInfoResultType.flowdepthmax);
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
81
8956
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
82 if (FACET_FLOW_DEPTH_CURRENT_FILTERED.contentEquals(facetName))
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
83 return data.getStationPoints(SInfoResultType.flowdepthCurrent);
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
84
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
85 if (FACET_FLOW_DEPTH_HISTORICAL_FILTERED.contentEquals(facetName))
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
86 return data.getStationPoints(SInfoResultType.flowdepthHistorical);
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
87
8886
cc86b0f9b3c3 SINFO-FlowDepth - work on tkh themes
gernotbelger
parents: 8884
diff changeset
88 final String error = String.format("Unknown facet name: %s", facetName);
cc86b0f9b3c3 SINFO-FlowDepth - work on tkh themes
gernotbelger
parents: 8884
diff changeset
89 throw new UnsupportedOperationException(error);
8854
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents:
diff changeset
90 }
8890
90b7f45ff4ae Calculating moving average of flow depth output
gernotbelger
parents: 8886
diff changeset
91
8948
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
92 public static Facet createFlowDepthFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result,
8940
82998242ba84 Preparing for additional outputs of SINFO-Tkh
gernotbelger
parents: 8916
diff changeset
93 final int index) {
8956
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
94 return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, FACET_FLOW_DEPTH_FILTERED,
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
95 I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION);
8940
82998242ba84 Preparing for additional outputs of SINFO-Tkh
gernotbelger
parents: 8916
diff changeset
96 }
8890
90b7f45ff4ae Calculating moving average of flow depth output
gernotbelger
parents: 8886
diff changeset
97
8948
a4f1ac81f26d Work on SINFO-FlowDepthMinMax.
gernotbelger
parents: 8946
diff changeset
98 public static Facet createFlowDepthTkhFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result,
8940
82998242ba84 Preparing for additional outputs of SINFO-Tkh
gernotbelger
parents: 8916
diff changeset
99 final int index) {
8956
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
100 return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, FACET_FLOW_DEPTH_TKH_FILTERED,
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
101 I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION);
8890
90b7f45ff4ae Calculating moving average of flow depth output
gernotbelger
parents: 8886
diff changeset
102 }
8950
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
103
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
104 public static Facet createFlowDepthMinFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result,
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
105 final int index) {
8956
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
106 return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, FACET_FLOW_DEPTH_MIN_FILTERED,
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
107 I18N_FACET_FLOW_DEPTH_MIN_FILTERED_DESCRIPTION);
8950
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
108 }
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
109
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
110 public static Facet createFlowDepthMaxFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result,
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
111 final int index) {
8956
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
112 return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, FACET_FLOW_DEPTH_MAX_FILTERED,
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
113 I18N_FACET_FLOW_DEPTH_MAX_FILTERED_DESCRIPTION);
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
114 }
8950
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
115
8956
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
116 public static Facet createFlowDepthCurrentFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result,
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
117 final int index) {
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
118 return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, FACET_FLOW_DEPTH_CURRENT_FILTERED,
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
119 I18N_FACET_FLOW_DEPTH_CURRENT_FILTERED_DESCRIPTION);
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
120 }
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
121
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
122 public static Facet createFlowDepthHistoricalFacet(final CallContext context, final String hash, final String id,
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
123 final AbstractSInfoCalculationResult result, final int index) {
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
124 return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL,
ee5ce13016ed Work on SINFO-Fließtiefenentwicklung
gernotbelger
parents: 8950
diff changeset
125 FACET_FLOW_DEPTH_HISTORICAL_FILTERED, I18N_FACET_FLOW_DEPTH_HISTORICAL_FILTERED_DESCRIPTION);
8950
b0aeed4c97c1 Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents: 8948
diff changeset
126 }
8854
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents:
diff changeset
127 }

http://dive4elements.wald.intevation.org