Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthDevelopmentProcessor.java @ 9600:bf79a865f6df
Dont interpolate results in chart of flow depth developement.
author | gernotbelger |
---|---|
date | Tue, 12 Feb 2019 12:03:49 +0100 |
parents | 08f46ccd37ba |
children | 1d4262a68f1f |
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 | |
9203 | 16 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; |
8956 | 17 import org.dive4elements.artifactdatabase.state.Facet; |
18 import org.dive4elements.artifacts.CallContext; | |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9123
diff
changeset
|
19 import org.dive4elements.river.artifacts.common.AbstractCalculationResult; |
9347 | 20 import org.dive4elements.river.artifacts.common.AbstractProcessor; |
21 import org.dive4elements.river.artifacts.common.ResultFacet; | |
8956 | 22 import org.dive4elements.river.artifacts.resources.Resources; |
23 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; | |
9203 | 24 import org.dive4elements.river.exports.DiagramGenerator; |
25 import org.dive4elements.river.themes.ThemeDocument; | |
8956 | 26 |
9347 | 27 public final class FlowDepthDevelopmentProcessor extends AbstractProcessor { |
8956 | 28 |
29 private static final String I18N_AXIS_LABEL = "sinfo.chart.flow_depth_development.section.yaxis.label"; | |
30 | |
9123
1cc7653ca84f
Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
gernotbelger
parents:
8980
diff
changeset
|
31 private static final String SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_YAXIS_LABEL = "sinfo.chart.flow_depth_development.yaxis.label"; |
8956 | 32 |
33 /* 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
|
34 // 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
|
35 // data changes depending on zoom state |
8956 | 36 public static final String FACET_FLOW_DEPTH_DEVELOPMENT_FILTERED = "sinfo_facet_flow_depth_development.filtered"; |
37 | |
8980
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
38 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
|
39 |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
40 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
|
41 |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
42 private static final String FACET_FLOW_DEPTH_DEVELOPMENT_RAW_DESCRIPTION = "sinfo.facet.flow_depth_development.raw.description"; |
8956 | 43 |
44 public static final String FACET_WATERLEVEL_DIFFERENCE_FILTERED = "sinfo_facet_waterlevel_difference.filtered"; | |
45 | |
8980
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
46 private static final String FACET_WATERLEVEL_DIFFERENCE_FILTERED_DESCRIPTION = "sinfo.facet.waterlevel_difference.filtered.description"; |
8956 | 47 |
48 public static final String FACET_BEDHEIGHT_DIFFERENCE_FILTERED = "sinfo_facet_bedheight_difference.filtered"; | |
49 | |
8980
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
50 private static final String FACET_BEDHEIGHT_DIFFERENCE_FILTERED_DESCRIPTION = "sinfo.facet.bedheight_difference.filtered.description"; |
8956 | 51 |
52 private static final Set<String> HANDLED_FACET_TYPES = new HashSet<>(); | |
53 | |
54 static { | |
55 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
|
56 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_DEVELOPMENT_RAW); |
8956 | 57 HANDLED_FACET_TYPES.add(FACET_WATERLEVEL_DIFFERENCE_FILTERED); |
58 HANDLED_FACET_TYPES.add(FACET_BEDHEIGHT_DIFFERENCE_FILTERED); | |
59 } | |
60 | |
61 public FlowDepthDevelopmentProcessor() { | |
62 super(I18N_AXIS_LABEL, HANDLED_FACET_TYPES); | |
63 } | |
64 | |
9600
bf79a865f6df
Dont interpolate results in chart of flow depth developement.
gernotbelger
parents:
9347
diff
changeset
|
65 private SInfoResultType doGetType(final String facetName) { |
8956 | 66 |
67 if (FACET_FLOW_DEPTH_DEVELOPMENT_FILTERED.contentEquals(facetName)) | |
9203 | 68 return SInfoResultType.flowdepthDevelopment; |
8980
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
69 if (FACET_FLOW_DEPTH_DEVELOPMENT_RAW.contentEquals(facetName)) |
9203 | 70 return SInfoResultType.flowdepthDevelopment; |
8956 | 71 |
72 if (FACET_WATERLEVEL_DIFFERENCE_FILTERED.contentEquals(facetName)) | |
9203 | 73 return SInfoResultType.waterlevelDifference; |
8956 | 74 |
75 if (FACET_BEDHEIGHT_DIFFERENCE_FILTERED.contentEquals(facetName)) | |
9203 | 76 return SInfoResultType.bedHeightDifference; |
8956 | 77 |
78 final String error = String.format("Unknown facet name: %s", facetName); | |
79 throw new UnsupportedOperationException(error); | |
80 } | |
81 | |
8980
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
82 public static Facet createFlowDepthDevelopmentFilteredFacet(final CallContext context, final String hash, final String id, |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9123
diff
changeset
|
83 final AbstractCalculationResult result, final int index) { |
9347 | 84 return AbstractProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_YAXIS_LABEL, |
8980
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
85 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
|
86 } |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
87 |
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
88 public static Facet createFlowDepthDevelopmentRawFacet(final CallContext context, final String hash, final String id, |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9123
diff
changeset
|
89 final AbstractCalculationResult result, final int index) { |
9347 | 90 return AbstractProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_YAXIS_LABEL, |
8980
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
91 FACET_FLOW_DEPTH_DEVELOPMENT_RAW, FACET_FLOW_DEPTH_DEVELOPMENT_RAW_DESCRIPTION); |
8956 | 92 } |
93 | |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9123
diff
changeset
|
94 public static Facet createWaterlevelDifferenceFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, |
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9123
diff
changeset
|
95 final int index) { |
8980
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
96 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
|
97 FACET_WATERLEVEL_DIFFERENCE_FILTERED_DESCRIPTION, result.getLabel()); |
9347 | 98 return new ResultFacet(index, FACET_WATERLEVEL_DIFFERENCE_FILTERED, facetFlowDepthTkhFilteredDescription, |
8956 | 99 SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_YAXIS_LABEL, ComputeType.ADVANCE, id, hash); |
100 } | |
101 | |
9150
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9123
diff
changeset
|
102 public static Facet createBedHeightDifferenceFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, |
23945061daec
gigantic refactoring: exporter, result, results
gernotbelger
parents:
9123
diff
changeset
|
103 final int index) { |
8956 | 104 |
8980
b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
gernotbelger
parents:
8956
diff
changeset
|
105 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
|
106 FACET_BEDHEIGHT_DIFFERENCE_FILTERED_DESCRIPTION, result.getLabel()); |
9347 | 107 return new ResultFacet(index, FACET_BEDHEIGHT_DIFFERENCE_FILTERED, facetFlowDepthFilteredDescription, |
8956 | 108 SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_YAXIS_LABEL, ComputeType.ADVANCE, id, hash); |
109 } | |
9203 | 110 |
111 @Override | |
112 protected String generateSeries(final DiagramGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, final boolean visible) { | |
113 | |
9600
bf79a865f6df
Dont interpolate results in chart of flow depth developement.
gernotbelger
parents:
9347
diff
changeset
|
114 return buildSeriesForType(generator, bundle, theme, visible, doGetType(bundle.getFacetName()), GAP_DISTANCE); |
9203 | 115 } |
8956 | 116 } |