Mercurial > dive4elements > river
view 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 source
/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde * Software engineering by * Björnsen Beratende Ingenieure GmbH * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt * * This file is Free Software under the GNU AGPL (>=v3) * and comes with ABSOLUTELY NO WARRANTY! Check out the * documentation coming with Dive4Elements River for details. */ package org.dive4elements.river.artifacts.sinfo.common; import java.util.HashSet; import java.util.Set; import org.dive4elements.artifactdatabase.state.Facet; import org.dive4elements.artifacts.CallContext; public final class FlowDepthProcessor extends AbstractSInfoLineProcessor<AbstractSInfoCalculationResult> { private static final String I18N_AXIS_LABEL = "sinfo.chart.flow_depth.section.yaxis.label"; private static final String SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL = "sinfo.chart.flow_depth.yaxis.label"; /* Theme name, usually defined in 'FacetTypes', but that is soooo bad dependencies... */ // REMARK: these mustend with 'filtered' so extra handling happens in chart: point are always recalculated, because data // changes depending on zoom state public static final String FACET_FLOW_DEPTH_FILTERED = "sinfo_facet_flow_depth.filtered"; private static final String I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth.filtered.description"; private static final String FACET_FLOW_DEPTH_TKH_FILTERED = "sinfo_facet_flow_depth_with_tkh.filtered"; private static final String I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth_with_tkh.filtered.description"; public static final String FACET_FLOW_DEPTH_MIN_FILTERED = "sinfo_facet_flow_depth_min.filtered"; private static final String I18N_FACET_FLOW_DEPTH_MIN_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth_min.filtered.description"; public static final String FACET_FLOW_DEPTH_MAX_FILTERED = "sinfo_facet_flow_depth_max.filtered"; 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 { HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_FILTERED); 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() { super(I18N_AXIS_LABEL, HANDLED_FACET_TYPES); } @Override protected double[][] doGetPoints(final AbstractSInfoCalculationResult data, final String facetName) { if (FACET_FLOW_DEPTH_FILTERED.contentEquals(facetName)) return data.getStationPoints(SInfoResultType.flowdepth); if (FACET_FLOW_DEPTH_TKH_FILTERED.contentEquals(facetName)) return data.getStationPoints(SInfoResultType.flowdepthtkh); if (FACET_FLOW_DEPTH_MIN_FILTERED.contentEquals(facetName)) return data.getStationPoints(SInfoResultType.flowdepthmin); 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) { 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) { 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) { 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); } 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); } }