Mercurial > dive4elements > river
view artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthDevelopmentPerYearProcessor.java @ 9005:460fcc128794
jasper multiple
author | gernotbelger |
---|---|
date | Tue, 17 Apr 2018 13:19:56 +0200 |
parents | b194fa64506a |
children | 23945061daec |
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 FlowDepthDevelopmentPerYearProcessor extends AbstractSInfoLineProcessor<AbstractSInfoCalculationResult> { private static final String I18N_AXIS_LABEL = "sinfo.chart.flow_depth_development_per_year.section.yaxis.label"; private static final String SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_PER_YEAR_YAXIS_LABEL = "sinfo.chart.flow_depth_development_per_year.yaxis.label"; /* Theme name, usually defined in 'FacetTypes', but that is soooo bad dependencies... */ // REMARK: these must end 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_DEVELOPMENT_PER_YEAR_FILTERED = "sinfo_facet_flow_depth_development_per_year.filtered"; private static final String FACET_FLOW_DEPTH_DEVELOPMENT_PER_YEAR_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth_development_per_year.filtered.description"; public static final String FACET_FLOW_DEPTH_DEVELOPMENT_PER_YEAR_RAW = "sinfo_facet_flow_depth_development_per_year"; private static final String FACET_FLOW_DEPTH_DEVELOPMENT_PER_YEAR_RAW_DESCRIPTION = "sinfo.facet.flow_depth_development_per_year.raw.description"; private static final Set<String> HANDLED_FACET_TYPES = new HashSet<>(); static { HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_DEVELOPMENT_PER_YEAR_FILTERED); HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_DEVELOPMENT_PER_YEAR_RAW); } public FlowDepthDevelopmentPerYearProcessor() { super(I18N_AXIS_LABEL, HANDLED_FACET_TYPES); } @Override protected double[][] doGetPoints(final AbstractSInfoCalculationResult data, final String facetName) { if (FACET_FLOW_DEPTH_DEVELOPMENT_PER_YEAR_FILTERED.contentEquals(facetName)) return data.getStationPoints(SInfoResultType.flowdepthDevelopmentPerYear); if (FACET_FLOW_DEPTH_DEVELOPMENT_PER_YEAR_RAW.contentEquals(facetName)) return data.getStationPoints(SInfoResultType.flowdepthDevelopmentPerYear); final String error = String.format("Unknown facet name: %s", facetName); throw new UnsupportedOperationException(error); } public static Facet createFlowDepthDevelopmentFilteredFacet(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_DEVELOPMENT_PER_YEAR_YAXIS_LABEL, FACET_FLOW_DEPTH_DEVELOPMENT_PER_YEAR_FILTERED, FACET_FLOW_DEPTH_DEVELOPMENT_PER_YEAR_FILTERED_DESCRIPTION); } public static Facet createFlowDepthDevelopmentRawFacet(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_DEVELOPMENT_PER_YEAR_YAXIS_LABEL, FACET_FLOW_DEPTH_DEVELOPMENT_PER_YEAR_RAW, FACET_FLOW_DEPTH_DEVELOPMENT_PER_YEAR_RAW_DESCRIPTION); } }