annotate artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstHeightProcessor.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 d2f5375ede26
rev   line source
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
2 * Software engineering by
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
3 * Björnsen Beratende Ingenieure GmbH
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
5 *
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
6 * This file is Free Software under the GNU AGPL (>=v3)
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
8 * documentation coming with Dive4Elements River for details.
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
9 */
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
10
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
11 package org.dive4elements.river.artifacts.bundu.bezugswst;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
12
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
13 import java.util.HashSet;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
14 import java.util.Set;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
15
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
16 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
17 import org.dive4elements.artifactdatabase.state.Facet;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
18 import org.dive4elements.artifacts.CallContext;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
19 import org.dive4elements.river.artifacts.bundu.BunduResultType;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
20 import org.dive4elements.river.artifacts.common.AbstractProcessor;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
21 import org.dive4elements.river.artifacts.common.AbstractResultType;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
22 import org.dive4elements.river.artifacts.common.GeneralResultType;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
23 import org.dive4elements.river.artifacts.resources.Resources;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
24 import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
25 import org.dive4elements.river.exports.DiagramGenerator;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
26 import org.dive4elements.river.exports.LongitudinalSectionGenerator;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
27 import org.dive4elements.river.themes.ThemeDocument;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
28
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
29 /**
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
30 * Processor to generate the facets and data series of a bundu bezugswst depth longitudinal section
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
31 *
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
32 * @author Matthias Schäfer
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
33 *
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
34 */
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
35 public final class BezugswstHeightProcessor extends AbstractProcessor {
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
36
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
37 private static final String FACET_W = "bundu_facet_w";
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
38
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
39 private static final String FACET_W_DESCRIPTION = "bundu_facet_w.description";
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
40
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
41 private static final String FACET_CHANNELMIN = "bundu_facet_channelmin";
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
42
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
43 private static final String FACET_CHANNELMIN_DESCRIPTION = "bundu_facet_channelmin.description";
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
44
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
45 private static final String FACET_BEDHEIGHT = "bundu_facet_bedheight";
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
46
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
47 private static final String FACET_BEDHEIGHT_DESCRIPTION = "bundu_facet_bedheight.description";
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
48
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
49 public static final String FACET_Q = "bundu_facet_q";
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
50
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
51 private static final String FACET_Q_DESCRIPTION = "bundu_facet_q.description";
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
52
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
53 private static final String AXIS_LABEL = LongitudinalSectionGenerator.I18N_YAXIS_LABEL;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
54
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
55 private static final String Q_AXIS_LABEL = LongitudinalSectionGenerator.I18N_2YAXIS_LABEL;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
56
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
57 private static final Set<String> HANDLED_FACET_TYPES = new HashSet<>();
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
58
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
59 static {
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
60 HANDLED_FACET_TYPES.add(FACET_W);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
61 HANDLED_FACET_TYPES.add(FACET_CHANNELMIN);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
62 HANDLED_FACET_TYPES.add(FACET_BEDHEIGHT);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
63 HANDLED_FACET_TYPES.add(FACET_Q);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
64 }
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
65
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
66 public BezugswstHeightProcessor() {
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
67 super(AXIS_LABEL, HANDLED_FACET_TYPES);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
68 }
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
69
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
70 public static Facet createWFacet(final CallContext context, final String hash, final String id, final int facetIndex,
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
71 final int resultIndex, final String seriesName) {
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
72
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
73 final String description = Resources.getMsg(context.getMeta(), FACET_W_DESCRIPTION, FACET_W_DESCRIPTION, seriesName);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
74 return new BezugswstResultFacet(facetIndex, resultIndex, FACET_W, description, AXIS_LABEL, id, hash);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
75 }
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
76
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
77 public static Facet createChannelminFacet(final CallContext context, final String hash, final String id, final int facetIndex,
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
78 final int resultIndex) {
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
79
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
80 final String description = Resources.getMsg(context.getMeta(), FACET_CHANNELMIN_DESCRIPTION, FACET_CHANNELMIN_DESCRIPTION);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
81 return new BezugswstResultFacet(facetIndex, resultIndex, FACET_CHANNELMIN, description, AXIS_LABEL, id, hash);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
82 }
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
83
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
84 public static Facet createBedheightFacet(final CallContext context, final String hash, final String id, final int facetIndex,
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
85 final int resultIndex, final String seriesName) {
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
86
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
87 final String description = Resources.getMsg(context.getMeta(), FACET_BEDHEIGHT_DESCRIPTION, FACET_BEDHEIGHT_DESCRIPTION, seriesName);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
88 return new BezugswstResultFacet(facetIndex, resultIndex, FACET_BEDHEIGHT, description, AXIS_LABEL, id, hash);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
89 }
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
90
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
91 @Override
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
92 protected String generateSeries(final DiagramGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, final boolean visible) {
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
93
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
94 return buildSeriesForType(generator, bundle, theme, visible, doGetType(bundle.getFacetName()), GAP_DISTANCE);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
95 }
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
96
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
97 protected AbstractResultType doGetType(final String facetName) {
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
98
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
99 if (FACET_W.contentEquals(facetName))
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
100 return BunduResultType.bezugswst;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
101 if (FACET_CHANNELMIN.contentEquals(facetName))
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
102 return BunduResultType.channelLowerEdge;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
103 if (FACET_BEDHEIGHT.contentEquals(facetName))
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
104 return SInfoResultType.meanBedHeight;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
105 if (FACET_Q.contentEquals(facetName))
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
106 return GeneralResultType.dischargeQwithUnit;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
107
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
108 final String error = String.format("Unknown facet name: %s", facetName);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
109 throw new UnsupportedOperationException(error);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
110 }
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
diff changeset
111 }

http://dive4elements.wald.intevation.org