Mercurial > dive4elements > river
diff 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 |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthProcessor.java Mon Mar 19 16:32:42 2018 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthProcessor.java Tue Mar 20 13:30:07 2018 +0100 @@ -15,8 +15,6 @@ import org.dive4elements.artifactdatabase.state.Facet; import org.dive4elements.artifacts.CallContext; -import org.dive4elements.river.artifacts.resources.Resources; -import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; public final class FlowDepthProcessor extends AbstractSInfoLineProcessor<AbstractSInfoCalculationResult> { @@ -43,6 +41,14 @@ private static final String I18N_FACET_FLOW_DEPTH_MAX_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth_max.filtered.description"; + public static final String FACET_FLOW_DEPTH_CURRENT_FILTERED = "sinfo_facet_flow_depth_current.filtered"; + + private static final String I18N_FACET_FLOW_DEPTH_CURRENT_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth_current.filtered.description"; + + public static final String FACET_FLOW_DEPTH_HISTORICAL_FILTERED = "sinfo_facet_flow_depth_historical.filtered"; + + private static final String I18N_FACET_FLOW_DEPTH_HISTORICAL_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth_historical.filtered.description"; + private static final Set<String> HANDLED_FACET_TYPES = new HashSet<>(); static { @@ -50,6 +56,8 @@ HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_TKH_FILTERED); HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_MIN_FILTERED); HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_MAX_FILTERED); + HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_CURRENT_FILTERED); + HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_HISTORICAL_FILTERED); } public FlowDepthProcessor() { @@ -71,41 +79,49 @@ if (FACET_FLOW_DEPTH_MAX_FILTERED.contentEquals(facetName)) return data.getStationPoints(SInfoResultType.flowdepthmax); + if (FACET_FLOW_DEPTH_CURRENT_FILTERED.contentEquals(facetName)) + return data.getStationPoints(SInfoResultType.flowdepthCurrent); + + if (FACET_FLOW_DEPTH_HISTORICAL_FILTERED.contentEquals(facetName)) + return data.getStationPoints(SInfoResultType.flowdepthHistorical); + final String error = String.format("Unknown facet name: %s", facetName); throw new UnsupportedOperationException(error); } public static Facet createFlowDepthFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result, final int index) { - final String facetFlowDepthFilteredDescription = Resources.getMsg(context.getMeta(), I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION, - I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION, result.getLabel()); - return new SInfoResultFacet(index, FlowDepthProcessor.FACET_FLOW_DEPTH_FILTERED, facetFlowDepthFilteredDescription, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, - ComputeType.ADVANCE, id, hash); + return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, FACET_FLOW_DEPTH_FILTERED, + I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION); } public static Facet createFlowDepthTkhFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result, final int index) { - final String facetFlowDepthTkhFilteredDescription = Resources.getMsg(context.getMeta(), I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION, - I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION, result.getLabel()); - return new SInfoResultFacet(index, FlowDepthProcessor.FACET_FLOW_DEPTH_TKH_FILTERED, facetFlowDepthTkhFilteredDescription, - SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, ComputeType.ADVANCE, id, hash); + return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, FACET_FLOW_DEPTH_TKH_FILTERED, + I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION); } public static Facet createFlowDepthMinFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result, final int index) { - - final String facetFlowDepthFilteredDescription = Resources.getMsg(context.getMeta(), I18N_FACET_FLOW_DEPTH_MIN_FILTERED_DESCRIPTION, - I18N_FACET_FLOW_DEPTH_MIN_FILTERED_DESCRIPTION, result.getLabel()); - return new SInfoResultFacet(index, FlowDepthProcessor.FACET_FLOW_DEPTH_MIN_FILTERED, facetFlowDepthFilteredDescription, - SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, ComputeType.ADVANCE, id, hash); + return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, FACET_FLOW_DEPTH_MIN_FILTERED, + I18N_FACET_FLOW_DEPTH_MIN_FILTERED_DESCRIPTION); } public static Facet createFlowDepthMaxFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result, final int index) { + return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, FACET_FLOW_DEPTH_MAX_FILTERED, + I18N_FACET_FLOW_DEPTH_MAX_FILTERED_DESCRIPTION); + } - final String facetFlowDepthFilteredDescription = Resources.getMsg(context.getMeta(), I18N_FACET_FLOW_DEPTH_MAX_FILTERED_DESCRIPTION, - I18N_FACET_FLOW_DEPTH_MAX_FILTERED_DESCRIPTION, result.getLabel()); - return new SInfoResultFacet(index, FlowDepthProcessor.FACET_FLOW_DEPTH_MAX_FILTERED, facetFlowDepthFilteredDescription, - SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, ComputeType.ADVANCE, id, hash); + public static Facet createFlowDepthCurrentFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result, + final int index) { + return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, FACET_FLOW_DEPTH_CURRENT_FILTERED, + I18N_FACET_FLOW_DEPTH_CURRENT_FILTERED_DESCRIPTION); + } + + public static Facet createFlowDepthHistoricalFacet(final CallContext context, final String hash, final String id, + final AbstractSInfoCalculationResult result, final int index) { + return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, + FACET_FLOW_DEPTH_HISTORICAL_FILTERED, I18N_FACET_FLOW_DEPTH_HISTORICAL_FILTERED_DESCRIPTION); } } \ No newline at end of file