comparison artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstDepthProcessor.java @ 9432:d194c5b24bf8

Added bundu bzws w calculation and longitudinal sections of wspl and depth
author mschaefer
date Mon, 20 Aug 2018 09:46:02 +0200
parents
children ecadc9ed0ba0
comparison
equal deleted inserted replaced
9431:eeea16ea0980 9432:d194c5b24bf8
1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
2 * Software engineering by
3 * Björnsen Beratende Ingenieure GmbH
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
5 *
6 * This file is Free Software under the GNU AGPL (>=v3)
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the
8 * documentation coming with Dive4Elements River for details.
9 */
10
11 package org.dive4elements.river.artifacts.bundu.bezugswst;
12
13 import java.util.HashSet;
14 import java.util.Set;
15
16 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
17 import org.dive4elements.artifactdatabase.state.Facet;
18 import org.dive4elements.artifacts.CallContext;
19 import org.dive4elements.river.artifacts.bundu.BunduResultType;
20 import org.dive4elements.river.artifacts.common.AbstractProcessor;
21 import org.dive4elements.river.artifacts.common.AbstractResultType;
22 import org.dive4elements.river.artifacts.resources.Resources;
23 import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
24 import org.dive4elements.river.exports.DiagramGenerator;
25 import org.dive4elements.river.themes.ThemeDocument;
26
27 /**
28 * Processor to generate the facets and data series of a bundu bezugswst depth longitudinal section
29 *
30 * @author Matthias Schäfer
31 *
32 */
33 public final class BezugswstDepthProcessor extends AbstractProcessor {
34
35 private static final String FACET_FLOWDEPTH_FILTERED = "bundu_facet_flowdepth.filtered";
36
37 private static final String FACET_FLOWDEPTH_FILTERED_DESCRIPTION = "bundu_facet_flowdepth.filtered.description";
38
39 public static final String FACET_CHANNELDEPTH = "bundu_facet_channeldepth";
40
41 private static final String FACET_CHANNELDEPTH_DESCRIPTION = "bundu_facet_channeldepth.description";
42
43 private static final String AXIS_LABEL = "sinfo.chart.flow_depth.section.yaxis.label";
44
45 private static final Set<String> HANDLED_FACET_TYPES = new HashSet<>();
46
47 static {
48 HANDLED_FACET_TYPES.add(FACET_FLOWDEPTH_FILTERED);
49 HANDLED_FACET_TYPES.add(FACET_CHANNELDEPTH);
50 }
51
52 public BezugswstDepthProcessor() {
53 super(AXIS_LABEL, HANDLED_FACET_TYPES);
54 }
55
56 public static Facet createFlowdepthFilteredFacet(final CallContext context, final String hash, final String id, final int facetIndex,
57 final int resultIndex, final String seriesName) {
58
59 final String description = Resources.getMsg(context.getMeta(), FACET_FLOWDEPTH_FILTERED_DESCRIPTION, FACET_FLOWDEPTH_FILTERED_DESCRIPTION, seriesName);
60 return new BezugswstResultFacet(facetIndex, resultIndex, FACET_FLOWDEPTH_FILTERED, description, AXIS_LABEL, id, hash);
61 }
62
63 public static Facet createChanneldepthFacet(final CallContext context, final String hash, final String id, final int facetIndex,
64 final int resultIndex) {
65
66 final String description = Resources.getMsg(context.getMeta(), FACET_CHANNELDEPTH_DESCRIPTION, FACET_CHANNELDEPTH_DESCRIPTION);
67 return new BezugswstResultFacet(facetIndex, resultIndex, FACET_CHANNELDEPTH, description, AXIS_LABEL, id, hash);
68 }
69
70 @Override
71 protected String generateSeries(final DiagramGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, final boolean visible) {
72
73 return buildSeriesForType(generator, bundle, theme, visible, doGetType(bundle.getFacetName()), GAP_DISTANCE);
74 }
75
76 protected AbstractResultType doGetType(final String facetName) {
77
78 if (FACET_FLOWDEPTH_FILTERED.contentEquals(facetName))
79 return SInfoResultType.flowdepth;
80 if (FACET_CHANNELDEPTH.contentEquals(facetName))
81 return BunduResultType.channelDepth;
82
83 final String error = String.format("Unknown facet name: %s", facetName);
84 throw new UnsupportedOperationException(error);
85 }
86 }

http://dive4elements.wald.intevation.org