Mercurial > dive4elements > river
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 | 1 /* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
8884 | 2 * Software engineering by |
3 * Björnsen Beratende Ingenieure GmbH | |
8854 | 4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt |
5 * | |
6 * This file is Free Software under the GNU AGPL (>=v3) | |
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
8 * documentation coming with Dive4Elements River for details. | |
9 */ | |
10 | |
8940
82998242ba84
Preparing for additional outputs of SINFO-Tkh
gernotbelger
parents:
8916
diff
changeset
|
11 package org.dive4elements.river.artifacts.sinfo.common; |
8854 | 12 |
8884 | 13 import java.util.HashSet; |
14 import java.util.Set; | |
8854 | 15 |
8940
82998242ba84
Preparing for additional outputs of SINFO-Tkh
gernotbelger
parents:
8916
diff
changeset
|
16 import org.dive4elements.artifactdatabase.state.Facet; |
8886 | 17 import org.dive4elements.artifacts.CallContext; |
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 | 24 |
8884 | 25 /* Theme name, usually defined in 'FacetTypes', but that is soooo bad dependencies... */ |
26 // REMARK: these mustend with 'filtered' so extra handling happens in chart: point are always recalculated, because data | |
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 | 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 | 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 | 44 public static final String FACET_FLOW_DEPTH_CURRENT_FILTERED = "sinfo_facet_flow_depth_current.filtered"; |
45 | |
46 private static final String I18N_FACET_FLOW_DEPTH_CURRENT_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth_current.filtered.description"; | |
47 | |
48 public static final String FACET_FLOW_DEPTH_HISTORICAL_FILTERED = "sinfo_facet_flow_depth_historical.filtered"; | |
49 | |
50 private static final String I18N_FACET_FLOW_DEPTH_HISTORICAL_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth_historical.filtered.description"; | |
51 | |
8884 | 52 private static final Set<String> HANDLED_FACET_TYPES = new HashSet<>(); |
53 | |
54 static { | |
55 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_FILTERED); | |
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 | 59 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_CURRENT_FILTERED); |
60 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_HISTORICAL_FILTERED); | |
8884 | 61 } |
8854 | 62 |
8884 | 63 public FlowDepthProcessor() { |
64 super(I18N_AXIS_LABEL, HANDLED_FACET_TYPES); | |
8854 | 65 } |
66 | |
8886 | 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 | 69 |
8884 | 70 if (FACET_FLOW_DEPTH_FILTERED.contentEquals(facetName)) |
8948 | 71 return data.getStationPoints(SInfoResultType.flowdepth); |
8854 | 72 |
8884 | 73 if (FACET_FLOW_DEPTH_TKH_FILTERED.contentEquals(facetName)) |
8948 | 74 return data.getStationPoints(SInfoResultType.flowdepthtkh); |
8854 | 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 | 82 if (FACET_FLOW_DEPTH_CURRENT_FILTERED.contentEquals(facetName)) |
83 return data.getStationPoints(SInfoResultType.flowdepthCurrent); | |
84 | |
85 if (FACET_FLOW_DEPTH_HISTORICAL_FILTERED.contentEquals(facetName)) | |
86 return data.getStationPoints(SInfoResultType.flowdepthHistorical); | |
87 | |
8886 | 88 final String error = String.format("Unknown facet name: %s", facetName); |
89 throw new UnsupportedOperationException(error); | |
8854 | 90 } |
8890
90b7f45ff4ae
Calculating moving average of flow depth output
gernotbelger
parents:
8886
diff
changeset
|
91 |
8948 | 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 | 94 return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, FACET_FLOW_DEPTH_FILTERED, |
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 | 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 | 100 return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, FACET_FLOW_DEPTH_TKH_FILTERED, |
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 | 106 return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, FACET_FLOW_DEPTH_MIN_FILTERED, |
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 | 112 return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, FACET_FLOW_DEPTH_MAX_FILTERED, |
113 I18N_FACET_FLOW_DEPTH_MAX_FILTERED_DESCRIPTION); | |
114 } | |
8950
b0aeed4c97c1
Implemented chart output for sinfo flow depth min/max calculation
gernotbelger
parents:
8948
diff
changeset
|
115 |
8956 | 116 public static Facet createFlowDepthCurrentFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result, |
117 final int index) { | |
118 return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, FACET_FLOW_DEPTH_CURRENT_FILTERED, | |
119 I18N_FACET_FLOW_DEPTH_CURRENT_FILTERED_DESCRIPTION); | |
120 } | |
121 | |
122 public static Facet createFlowDepthHistoricalFacet(final CallContext context, final String hash, final String id, | |
123 final AbstractSInfoCalculationResult result, final int index) { | |
124 return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, | |
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 | 127 } |