comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthProcessor.java @ 8950:b0aeed4c97c1

Implemented chart output for sinfo flow depth min/max calculation
author gernotbelger
date Thu, 15 Mar 2018 17:22:28 +0100
parents a4f1ac81f26d
children ee5ce13016ed
comparison
equal deleted inserted replaced
8949:09e4a4909814 8950:b0aeed4c97c1
16 import org.dive4elements.artifactdatabase.state.Facet; 16 import org.dive4elements.artifactdatabase.state.Facet;
17 import org.dive4elements.artifacts.CallContext; 17 import org.dive4elements.artifacts.CallContext;
18 import org.dive4elements.river.artifacts.resources.Resources; 18 import org.dive4elements.river.artifacts.resources.Resources;
19 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; 19 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
20 20
21 public final class FlowDepthProcessor extends AbstractSInfoLineProcessor<AbstractTkhCalculationResult> { 21 public final class FlowDepthProcessor extends AbstractSInfoLineProcessor<AbstractSInfoCalculationResult> {
22 22
23 private static final String I18N_AXIS_LABEL = "sinfo.chart.flow_depth.section.yaxis.label"; 23 private static final String I18N_AXIS_LABEL = "sinfo.chart.flow_depth.section.yaxis.label";
24 24
25 private static final String SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL = "sinfo.chart.flow_depth.yaxis.label"; 25 private static final String SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL = "sinfo.chart.flow_depth.yaxis.label";
26 26
33 33
34 private static final String FACET_FLOW_DEPTH_TKH_FILTERED = "sinfo_facet_flow_depth_with_tkh.filtered"; 34 private static final String FACET_FLOW_DEPTH_TKH_FILTERED = "sinfo_facet_flow_depth_with_tkh.filtered";
35 35
36 private static final String I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth_with_tkh.filtered.description"; 36 private static final String I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth_with_tkh.filtered.description";
37 37
38 public static final String FACET_FLOW_DEPTH_MIN_FILTERED = "sinfo_facet_flow_depth_min.filtered";
39
40 private static final String I18N_FACET_FLOW_DEPTH_MIN_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth_min.filtered.description";
41
42 public static final String FACET_FLOW_DEPTH_MAX_FILTERED = "sinfo_facet_flow_depth_max.filtered";
43
44 private static final String I18N_FACET_FLOW_DEPTH_MAX_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth_max.filtered.description";
45
38 private static final Set<String> HANDLED_FACET_TYPES = new HashSet<>(); 46 private static final Set<String> HANDLED_FACET_TYPES = new HashSet<>();
39 47
40 static { 48 static {
41 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_FILTERED); 49 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_FILTERED);
42 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_TKH_FILTERED); 50 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_TKH_FILTERED);
51 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_MIN_FILTERED);
52 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_MAX_FILTERED);
43 } 53 }
44 54
45 public FlowDepthProcessor() { 55 public FlowDepthProcessor() {
46 super(I18N_AXIS_LABEL, HANDLED_FACET_TYPES); 56 super(I18N_AXIS_LABEL, HANDLED_FACET_TYPES);
47 } 57 }
48 58
49 @Override 59 @Override
50 protected double[][] doGetPoints(final AbstractTkhCalculationResult data, final String facetName) { 60 protected double[][] doGetPoints(final AbstractSInfoCalculationResult data, final String facetName) {
51 61
52 if (FACET_FLOW_DEPTH_FILTERED.contentEquals(facetName)) 62 if (FACET_FLOW_DEPTH_FILTERED.contentEquals(facetName))
53 return data.getStationPoints(SInfoResultType.flowdepth); 63 return data.getStationPoints(SInfoResultType.flowdepth);
54 64
55 if (FACET_FLOW_DEPTH_TKH_FILTERED.contentEquals(facetName)) 65 if (FACET_FLOW_DEPTH_TKH_FILTERED.contentEquals(facetName))
56 return data.getStationPoints(SInfoResultType.flowdepthtkh); 66 return data.getStationPoints(SInfoResultType.flowdepthtkh);
67
68 if (FACET_FLOW_DEPTH_MIN_FILTERED.contentEquals(facetName))
69 return data.getStationPoints(SInfoResultType.flowdepthmin);
70
71 if (FACET_FLOW_DEPTH_MAX_FILTERED.contentEquals(facetName))
72 return data.getStationPoints(SInfoResultType.flowdepthmax);
57 73
58 final String error = String.format("Unknown facet name: %s", facetName); 74 final String error = String.format("Unknown facet name: %s", facetName);
59 throw new UnsupportedOperationException(error); 75 throw new UnsupportedOperationException(error);
60 } 76 }
61 77
72 final String facetFlowDepthTkhFilteredDescription = Resources.getMsg(context.getMeta(), I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION, 88 final String facetFlowDepthTkhFilteredDescription = Resources.getMsg(context.getMeta(), I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION,
73 I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION, result.getLabel()); 89 I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION, result.getLabel());
74 return new SInfoResultFacet(index, FlowDepthProcessor.FACET_FLOW_DEPTH_TKH_FILTERED, facetFlowDepthTkhFilteredDescription, 90 return new SInfoResultFacet(index, FlowDepthProcessor.FACET_FLOW_DEPTH_TKH_FILTERED, facetFlowDepthTkhFilteredDescription,
75 SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, ComputeType.ADVANCE, id, hash); 91 SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, ComputeType.ADVANCE, id, hash);
76 } 92 }
93
94 public static Facet createFlowDepthMinFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result,
95 final int index) {
96
97 final String facetFlowDepthFilteredDescription = Resources.getMsg(context.getMeta(), I18N_FACET_FLOW_DEPTH_MIN_FILTERED_DESCRIPTION,
98 I18N_FACET_FLOW_DEPTH_MIN_FILTERED_DESCRIPTION, result.getLabel());
99 return new SInfoResultFacet(index, FlowDepthProcessor.FACET_FLOW_DEPTH_MIN_FILTERED, facetFlowDepthFilteredDescription,
100 SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, ComputeType.ADVANCE, id, hash);
101 }
102
103 public static Facet createFlowDepthMaxFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result,
104 final int index) {
105
106 final String facetFlowDepthFilteredDescription = Resources.getMsg(context.getMeta(), I18N_FACET_FLOW_DEPTH_MAX_FILTERED_DESCRIPTION,
107 I18N_FACET_FLOW_DEPTH_MAX_FILTERED_DESCRIPTION, result.getLabel());
108 return new SInfoResultFacet(index, FlowDepthProcessor.FACET_FLOW_DEPTH_MAX_FILTERED, facetFlowDepthFilteredDescription,
109 SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, ComputeType.ADVANCE, id, hash);
110 }
77 } 111 }

http://dive4elements.wald.intevation.org