comparison 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
comparison
equal deleted inserted replaced
8955:798d9dcbccdd 8956:ee5ce13016ed
13 import java.util.HashSet; 13 import java.util.HashSet;
14 import java.util.Set; 14 import java.util.Set;
15 15
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;
19 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
20 18
21 public final class FlowDepthProcessor extends AbstractSInfoLineProcessor<AbstractSInfoCalculationResult> { 19 public final class FlowDepthProcessor extends AbstractSInfoLineProcessor<AbstractSInfoCalculationResult> {
22 20
23 private static final String I18N_AXIS_LABEL = "sinfo.chart.flow_depth.section.yaxis.label"; 21 private static final String I18N_AXIS_LABEL = "sinfo.chart.flow_depth.section.yaxis.label";
24 22
41 39
42 public static final String FACET_FLOW_DEPTH_MAX_FILTERED = "sinfo_facet_flow_depth_max.filtered"; 40 public static final String FACET_FLOW_DEPTH_MAX_FILTERED = "sinfo_facet_flow_depth_max.filtered";
43 41
44 private static final String I18N_FACET_FLOW_DEPTH_MAX_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth_max.filtered.description"; 42 private static final String I18N_FACET_FLOW_DEPTH_MAX_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth_max.filtered.description";
45 43
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
46 private static final Set<String> HANDLED_FACET_TYPES = new HashSet<>(); 52 private static final Set<String> HANDLED_FACET_TYPES = new HashSet<>();
47 53
48 static { 54 static {
49 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_FILTERED); 55 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_FILTERED);
50 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_TKH_FILTERED); 56 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_TKH_FILTERED);
51 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_MIN_FILTERED); 57 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_MIN_FILTERED);
52 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_MAX_FILTERED); 58 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_MAX_FILTERED);
59 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_CURRENT_FILTERED);
60 HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_HISTORICAL_FILTERED);
53 } 61 }
54 62
55 public FlowDepthProcessor() { 63 public FlowDepthProcessor() {
56 super(I18N_AXIS_LABEL, HANDLED_FACET_TYPES); 64 super(I18N_AXIS_LABEL, HANDLED_FACET_TYPES);
57 } 65 }
69 return data.getStationPoints(SInfoResultType.flowdepthmin); 77 return data.getStationPoints(SInfoResultType.flowdepthmin);
70 78
71 if (FACET_FLOW_DEPTH_MAX_FILTERED.contentEquals(facetName)) 79 if (FACET_FLOW_DEPTH_MAX_FILTERED.contentEquals(facetName))
72 return data.getStationPoints(SInfoResultType.flowdepthmax); 80 return data.getStationPoints(SInfoResultType.flowdepthmax);
73 81
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
74 final String error = String.format("Unknown facet name: %s", facetName); 88 final String error = String.format("Unknown facet name: %s", facetName);
75 throw new UnsupportedOperationException(error); 89 throw new UnsupportedOperationException(error);
76 } 90 }
77 91
78 public static Facet createFlowDepthFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result, 92 public static Facet createFlowDepthFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result,
79 final int index) { 93 final int index) {
80 final String facetFlowDepthFilteredDescription = Resources.getMsg(context.getMeta(), I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION, 94 return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, FACET_FLOW_DEPTH_FILTERED,
81 I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION, result.getLabel()); 95 I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION);
82 return new SInfoResultFacet(index, FlowDepthProcessor.FACET_FLOW_DEPTH_FILTERED, facetFlowDepthFilteredDescription, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL,
83 ComputeType.ADVANCE, id, hash);
84 } 96 }
85 97
86 public static Facet createFlowDepthTkhFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result, 98 public static Facet createFlowDepthTkhFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result,
87 final int index) { 99 final int index) {
88 final String facetFlowDepthTkhFilteredDescription = Resources.getMsg(context.getMeta(), I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION, 100 return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, FACET_FLOW_DEPTH_TKH_FILTERED,
89 I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION, result.getLabel()); 101 I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION);
90 return new SInfoResultFacet(index, FlowDepthProcessor.FACET_FLOW_DEPTH_TKH_FILTERED, facetFlowDepthTkhFilteredDescription,
91 SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, ComputeType.ADVANCE, id, hash);
92 } 102 }
93 103
94 public static Facet createFlowDepthMinFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result, 104 public static Facet createFlowDepthMinFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result,
95 final int index) { 105 final int index) {
96 106 return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, FACET_FLOW_DEPTH_MIN_FILTERED,
97 final String facetFlowDepthFilteredDescription = Resources.getMsg(context.getMeta(), I18N_FACET_FLOW_DEPTH_MIN_FILTERED_DESCRIPTION, 107 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 } 108 }
102 109
103 public static Facet createFlowDepthMaxFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result, 110 public static Facet createFlowDepthMaxFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result,
104 final int index) { 111 final int index) {
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 }
105 115
106 final String facetFlowDepthFilteredDescription = Resources.getMsg(context.getMeta(), I18N_FACET_FLOW_DEPTH_MAX_FILTERED_DESCRIPTION, 116 public static Facet createFlowDepthCurrentFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result,
107 I18N_FACET_FLOW_DEPTH_MAX_FILTERED_DESCRIPTION, result.getLabel()); 117 final int index) {
108 return new SInfoResultFacet(index, FlowDepthProcessor.FACET_FLOW_DEPTH_MAX_FILTERED, facetFlowDepthFilteredDescription, 118 return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, FACET_FLOW_DEPTH_CURRENT_FILTERED,
109 SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, ComputeType.ADVANCE, id, hash); 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);
110 } 126 }
111 } 127 }

http://dive4elements.wald.intevation.org