comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthProcessor.java @ 8948:a4f1ac81f26d

Work on SINFO-FlowDepthMinMax. Also rework of result row stuff, in order to reduce abstraction, using result type concept
author gernotbelger
date Wed, 14 Mar 2018 14:10:32 +0100
parents 5d5d482da3e9
children b0aeed4c97c1
comparison
equal deleted inserted replaced
8947:86650594f051 8948:a4f1ac81f26d
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<AbstractTkhCalculationResult> {
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
45 public FlowDepthProcessor() { 45 public FlowDepthProcessor() {
46 super(I18N_AXIS_LABEL, HANDLED_FACET_TYPES); 46 super(I18N_AXIS_LABEL, HANDLED_FACET_TYPES);
47 } 47 }
48 48
49 @Override 49 @Override
50 protected double[][] doGetPoints(final AbstractTkhCalculationResult<?> data, final String facetName) { 50 protected double[][] doGetPoints(final AbstractTkhCalculationResult data, final String facetName) {
51 51
52 if (FACET_FLOW_DEPTH_FILTERED.contentEquals(facetName)) 52 if (FACET_FLOW_DEPTH_FILTERED.contentEquals(facetName))
53 return data.getFlowDepthPoints(); 53 return data.getStationPoints(SInfoResultType.flowdepth);
54 54
55 if (FACET_FLOW_DEPTH_TKH_FILTERED.contentEquals(facetName)) 55 if (FACET_FLOW_DEPTH_TKH_FILTERED.contentEquals(facetName))
56 return data.getFlowDepthTkhPoints(); 56 return data.getStationPoints(SInfoResultType.flowdepthtkh);
57 57
58 final String error = String.format("Unknown facet name: %s", facetName); 58 final String error = String.format("Unknown facet name: %s", facetName);
59 throw new UnsupportedOperationException(error); 59 throw new UnsupportedOperationException(error);
60 } 60 }
61 61
62 public static Facet createFlowDepthFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult<?> result, 62 public static Facet createFlowDepthFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result,
63 final int index) { 63 final int index) {
64 final String facetFlowDepthFilteredDescription = Resources.getMsg(context.getMeta(), I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION, 64 final String facetFlowDepthFilteredDescription = Resources.getMsg(context.getMeta(), I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION,
65 I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION, result.getLabel()); 65 I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION, result.getLabel());
66 return new SInfoResultFacet(index, FlowDepthProcessor.FACET_FLOW_DEPTH_FILTERED, facetFlowDepthFilteredDescription, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, 66 return new SInfoResultFacet(index, FlowDepthProcessor.FACET_FLOW_DEPTH_FILTERED, facetFlowDepthFilteredDescription, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL,
67 ComputeType.ADVANCE, id, hash); 67 ComputeType.ADVANCE, id, hash);
68 } 68 }
69 69
70 public static Facet createFlowDepthTkhFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult<?> result, 70 public static Facet createFlowDepthTkhFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result,
71 final int index) { 71 final int index) {
72 final String facetFlowDepthTkhFilteredDescription = Resources.getMsg(context.getMeta(), I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION, 72 final String facetFlowDepthTkhFilteredDescription = Resources.getMsg(context.getMeta(), I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION,
73 I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION, result.getLabel()); 73 I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION, result.getLabel());
74 return new SInfoResultFacet(index, FlowDepthProcessor.FACET_FLOW_DEPTH_TKH_FILTERED, facetFlowDepthTkhFilteredDescription, 74 return new SInfoResultFacet(index, FlowDepthProcessor.FACET_FLOW_DEPTH_TKH_FILTERED, facetFlowDepthTkhFilteredDescription,
75 SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, ComputeType.ADVANCE, id, hash); 75 SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, ComputeType.ADVANCE, id, hash);

http://dive4elements.wald.intevation.org