Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthDevelopmentProcessor.java @ 9016:6e5ff436febe
Added datacage select and chart display for TKH series loaded from database
author | mschaefer |
---|---|
date | Mon, 23 Apr 2018 15:18:48 +0200 |
parents | b194fa64506a |
children | 1cc7653ca84f |
rev | line source |
---|---|
8956 | 1 /* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
2 * Software engineering by | |
3 * Björnsen Beratende Ingenieure GmbH | |
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 | |
11 package org.dive4elements.river.artifacts.sinfo.common; | |
12 | |
13 import java.util.HashSet; | |
14 import java.util.Set; | |
15 | |
16 import org.dive4elements.artifactdatabase.state.Facet; | |
17 import org.dive4elements.artifacts.CallContext; | |
18 import org.dive4elements.river.artifacts.resources.Resources; | |
19 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; | |
20 | |
21 public final class FlowDepthDevelopmentProcessor extends AbstractSInfoLineProcessor<AbstractSInfoCalculationResult> { | |
22 | |
23 private static final String I18N_AXIS_LABEL = "sinfo.chart.flow_depth_development.section.yaxis.label"; | |
24 | |
25 private static final String SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_YAXIS_LABEL = "sinfo.chart.flow_depth.yaxis.label"; | |
26 | |
27 /* Theme name, usually defined in 'FacetTypes', but that is soooo bad dependencies... */ | |
8980
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
28 // REMARK: these must end with 'filtered' so extra handling happens in chart: point are always recalculated, because |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
29 // data changes depending on zoom state |
8956 | 30 public static final String FACET_FLOW_DEPTH_DEVELOPMENT_FILTERED = "sinfo_facet_flow_depth_development.filtered"; |
31 | |
8980
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
32 private static final String FACET_FLOW_DEPTH_DEVELOPMENT_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth_development.filtered.description"; |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
33 |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
34 public static final String FACET_FLOW_DEPTH_DEVELOPMENT_RAW = "sinfo_facet_flow_depth_development"; |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
35 |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
36 private static final String FACET_FLOW_DEPTH_DEVELOPMENT_RAW_DESCRIPTION = "sinfo.facet.flow_depth_development.raw.description"; |
8956 | 37 |
38 public static final String FACET_WATERLEVEL_DIFFERENCE_FILTERED = "sinfo_facet_waterlevel_difference.filtered"; | |
39 | |
8980
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
40 private static final String FACET_WATERLEVEL_DIFFERENCE_FILTERED_DESCRIPTION = "sinfo.facet.waterlevel_difference.filtered.description"; |
8956 | 41 |
42 public static final String FACET_BEDHEIGHT_DIFFERENCE_FILTERED = "sinfo_facet_bedheight_difference.filtered"; | |
43 | |
8980
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
44 private static final String FACET_BEDHEIGHT_DIFFERENCE_FILTERED_DESCRIPTION = "sinfo.facet.bedheight_difference.filtered.description"; |
8956 | 45 |
46 private static final Set<String> HANDLED_FACET_TYPES = new HashSet<>(); | |
47 | |
48 static { | |
49 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_DEVELOPMENT_FILTERED); | |
8980
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
50 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_DEVELOPMENT_RAW); |
8956 | 51 HANDLED_FACET_TYPES.add(FACET_WATERLEVEL_DIFFERENCE_FILTERED); |
52 HANDLED_FACET_TYPES.add(FACET_BEDHEIGHT_DIFFERENCE_FILTERED); | |
53 } | |
54 | |
55 public FlowDepthDevelopmentProcessor() { | |
56 super(I18N_AXIS_LABEL, HANDLED_FACET_TYPES); | |
57 } | |
58 | |
59 @Override | |
60 protected double[][] doGetPoints(final AbstractSInfoCalculationResult data, final String facetName) { | |
61 | |
62 if (FACET_FLOW_DEPTH_DEVELOPMENT_FILTERED.contentEquals(facetName)) | |
63 return data.getStationPoints(SInfoResultType.flowdepthDevelopment); | |
8980
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
64 if (FACET_FLOW_DEPTH_DEVELOPMENT_RAW.contentEquals(facetName)) |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
65 return data.getStationPoints(SInfoResultType.flowdepthDevelopment); |
8956 | 66 |
67 if (FACET_WATERLEVEL_DIFFERENCE_FILTERED.contentEquals(facetName)) | |
68 return data.getStationPoints(SInfoResultType.waterlevelDifference); | |
69 | |
70 if (FACET_BEDHEIGHT_DIFFERENCE_FILTERED.contentEquals(facetName)) | |
71 return data.getStationPoints(SInfoResultType.bedHeightDifference); | |
72 | |
73 final String error = String.format("Unknown facet name: %s", facetName); | |
74 throw new UnsupportedOperationException(error); | |
75 } | |
76 | |
8980
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
77 public static Facet createFlowDepthDevelopmentFilteredFacet(final CallContext context, final String hash, final String id, |
8956 | 78 final AbstractSInfoCalculationResult result, final int index) { |
8980
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
79 return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_YAXIS_LABEL, |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
80 FACET_FLOW_DEPTH_DEVELOPMENT_FILTERED, FACET_FLOW_DEPTH_DEVELOPMENT_FILTERED_DESCRIPTION); |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
81 } |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
82 |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
83 public static Facet createFlowDepthDevelopmentRawFacet(final CallContext context, final String hash, final String id, |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
84 final AbstractSInfoCalculationResult result, final int index) { |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
85 return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_YAXIS_LABEL, |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
86 FACET_FLOW_DEPTH_DEVELOPMENT_RAW, FACET_FLOW_DEPTH_DEVELOPMENT_RAW_DESCRIPTION); |
8956 | 87 } |
88 | |
89 public static Facet createWaterlevelDifferenceFacet(final CallContext context, final String hash, final String id, | |
90 final AbstractSInfoCalculationResult result, final int index) { | |
8980
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
91 final String facetFlowDepthTkhFilteredDescription = Resources.getMsg(context.getMeta(), FACET_WATERLEVEL_DIFFERENCE_FILTERED_DESCRIPTION, |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
92 FACET_WATERLEVEL_DIFFERENCE_FILTERED_DESCRIPTION, result.getLabel()); |
8956 | 93 return new SInfoResultFacet(index, FACET_WATERLEVEL_DIFFERENCE_FILTERED, facetFlowDepthTkhFilteredDescription, |
94 SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_YAXIS_LABEL, ComputeType.ADVANCE, id, hash); | |
95 } | |
96 | |
97 public static Facet createBedHeightDifferenceFacet(final CallContext context, final String hash, final String id, | |
98 final AbstractSInfoCalculationResult result, final int index) { | |
99 | |
8980
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
100 final String facetFlowDepthFilteredDescription = Resources.getMsg(context.getMeta(), FACET_BEDHEIGHT_DIFFERENCE_FILTERED_DESCRIPTION, |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
101 FACET_BEDHEIGHT_DIFFERENCE_FILTERED_DESCRIPTION, result.getLabel()); |
8956 | 102 return new SInfoResultFacet(index, FACET_BEDHEIGHT_DIFFERENCE_FILTERED, facetFlowDepthFilteredDescription, |
103 SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_YAXIS_LABEL, ComputeType.ADVANCE, id, hash); | |
104 } | |
105 } |