[PATCH] zu 2.1 y-Achsenbeschriftung Sohlhöhen

Wald Commits scm-commit at wald.intevation.org
Fri Jan 22 15:48:03 CET 2021


# HG changeset patch
# User dnt_bjoernsen <d.tironi at bjoernsen.de>
# Date 1611326875 -3600
#      Fri Jan 22 15:47:55 2021 +0100
# Node ID 23702537fb4f70c04bc9f39ed96cb1632ae1193e
# Parent  299c1c61d8ef302f61eed651bc27c4417437dbac
zu 2.1 y-Achsenbeschriftung Sohlhöhen

diff -r 299c1c61d8ef -r 23702537fb4f artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthWaterlevelProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthWaterlevelProcessor.java	Fri Jan 22 12:28:58 2021 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthWaterlevelProcessor.java	Fri Jan 22 15:47:55 2021 +0100
@@ -25,82 +25,89 @@
 
 public final class FlowDepthWaterlevelProcessor extends AbstractProcessor {
 
-    /* waterlevel */
-    public static final String FACET_FLOW_DEPTH_BEDHEIGHT_MIN = "sinfo_facet_flow_depth_bedheight_min";
-    public static final String FACET_FLOW_DEPTH_BEDHEIGHT_MAX = "sinfo_facet_flow_depth_bedheight_max";
-    public static final String FACET_FLOW_DEPTH_BEDHEIGHT = "sinfo_facet_flow_depth_bedheight";
-    public static final String FACET_FLOW_DEPTH_WATER_LEVEL = "sinfo_facet_flow_depth_waterlevel";
-    public static final String FACET_FLOW_DEPTH_WATER_LEVEL_Y_AXIS_LABEL = "chart.longitudinal.section.yaxis.label";
-    public static final String FACET_FLOW_DEPTH_WATER_LEVEL_DESCRIPTION = "facet.flow_depth.waterlevel";
-    public static final String FACET_FLOW_DEPTH_BEDHEIGHT_DESCRIPTION = "facet.flow_depth.bedheight";
-    public static final String FACET_FLOW_DEPTH_BEDHEIGHT_DESCRIPTION_MIN = "facet.flow_depth.bedheight.min";
-    public static final String FACET_FLOW_DEPTH_BEDHEIGHT_DESCRIPTION_MAX = "facet.flow_depth.bedheight.max";
-
-    private static final Set<String> HANDLED_FACET_TYPES = new HashSet<>();
-
-    static {
-        HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_WATER_LEVEL);
-        HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_BEDHEIGHT);
-        HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_BEDHEIGHT_MIN);
-        HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_BEDHEIGHT_MAX);
-    }
-
-    public FlowDepthWaterlevelProcessor() {
-        super(FACET_FLOW_DEPTH_WATER_LEVEL_Y_AXIS_LABEL, HANDLED_FACET_TYPES);
-    }
-
-    protected SInfoResultType doGetType(final String facetName) {
-
-        if (FACET_FLOW_DEPTH_WATER_LEVEL.contentEquals(facetName))
-            return SInfoResultType.waterlevel;
-        if (FACET_FLOW_DEPTH_BEDHEIGHT.contentEquals(facetName))
-            return SInfoResultType.meanBedHeight;
-        if (FACET_FLOW_DEPTH_BEDHEIGHT_MIN.contentEquals(facetName))
-            return SInfoResultType.minBedHeight;
-        if (FACET_FLOW_DEPTH_BEDHEIGHT_MAX.contentEquals(facetName))
-            return SInfoResultType.maxBedHeight;
-
-        final String error = String.format("Unknown facet name: %s", facetName);
-        throw new UnsupportedOperationException(error);
-    }
+	/* waterlevel */
+	public static final String FACET_FLOW_DEPTH_BEDHEIGHT_MIN = "sinfo_facet_flow_depth_bedheight_min";
+	public static final String FACET_FLOW_DEPTH_BEDHEIGHT_MAX = "sinfo_facet_flow_depth_bedheight_max";
+	public static final String FACET_FLOW_DEPTH_BEDHEIGHT = "sinfo_facet_flow_depth_bedheight";
+	public static final String FACET_FLOW_DEPTH_WATER_LEVEL = "sinfo_facet_flow_depth_waterlevel";
+	private static final String FACET_FLOW_DEPTH_WATER_LEVEL_Y_AXIS_LABEL = "chart.longitudinal.section.yaxis.label";
+	private static final String FACET_BEDHEIGHT_Y_AXIS_LABEL = "chart.bedheight_middle.section.yaxis.label"; 
 
-    private static Facet createFlowDepthBedheightFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result,
-            final int index, final String unit, final String facetLabel, final String facetName, final String description) {
-        final CallMeta meta = context.getMeta();
-        final String yAxisLabel = Resources.getMsg(meta, FACET_FLOW_DEPTH_WATER_LEVEL_Y_AXIS_LABEL, FACET_FLOW_DEPTH_WATER_LEVEL_Y_AXIS_LABEL, unit);
-
-        return AbstractProcessor.createFacet(context, hash, id, result, index, yAxisLabel, facetName, description, facetLabel);
-    }
-
-    public static Facet createFlowDepthMeanBedheightFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result,
-            final int index, final String unit, final String facetLabel) {
-        return FlowDepthWaterlevelProcessor.createFlowDepthBedheightFacet(context, hash, id, result, index, unit, facetLabel, FACET_FLOW_DEPTH_BEDHEIGHT,
-                FACET_FLOW_DEPTH_BEDHEIGHT_DESCRIPTION);
-    }
-
-    public static Facet createFlowDepthMinBedheightFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result,
-            final int index, final String unit, final String facetLabel) {
-        return FlowDepthWaterlevelProcessor.createFlowDepthBedheightFacet(context, hash, id, result, index, unit, facetLabel, FACET_FLOW_DEPTH_BEDHEIGHT_MIN,
-                FACET_FLOW_DEPTH_BEDHEIGHT_DESCRIPTION_MIN);
-    }
+	public static final String FACET_FLOW_DEPTH_WATER_LEVEL_DESCRIPTION = "facet.flow_depth.waterlevel";
+	public static final String FACET_FLOW_DEPTH_BEDHEIGHT_DESCRIPTION = "facet.flow_depth.bedheight";
+	public static final String FACET_FLOW_DEPTH_BEDHEIGHT_DESCRIPTION_MIN = "facet.flow_depth.bedheight.min";
+	public static final String FACET_FLOW_DEPTH_BEDHEIGHT_DESCRIPTION_MAX = "facet.flow_depth.bedheight.max";
 
-    public static Facet createFlowDepthMaxBedheightFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result,
-            final int index, final String unit, final String facetLabel) {
-        return FlowDepthWaterlevelProcessor.createFlowDepthBedheightFacet(context, hash, id, result, index, unit, facetLabel, FACET_FLOW_DEPTH_BEDHEIGHT_MAX,
-                FACET_FLOW_DEPTH_BEDHEIGHT_DESCRIPTION_MAX);
-    }
+	private static final Set<String> HANDLED_FACET_TYPES = new HashSet<>();
 
-    public static Facet createFlowDepthWaterlevelFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result,
-            final int index, final String unit, final String wstLabel) {
-        final CallMeta meta = context.getMeta();
-        final String yAxisLabel = Resources.getMsg(meta, FACET_FLOW_DEPTH_WATER_LEVEL_Y_AXIS_LABEL, FACET_FLOW_DEPTH_WATER_LEVEL_Y_AXIS_LABEL, unit);
-        return AbstractProcessor.createFacet(context, hash, id, result, index, yAxisLabel, FACET_FLOW_DEPTH_WATER_LEVEL,
-                FACET_FLOW_DEPTH_WATER_LEVEL_DESCRIPTION, wstLabel);
-    }
+	static {
+		HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_WATER_LEVEL);
+		HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_BEDHEIGHT);
+		HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_BEDHEIGHT_MIN);
+		HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_BEDHEIGHT_MAX);
+	}
 
-    @Override
-    protected String generateSeries(final DiagramGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, final boolean visible) {
+	public FlowDepthWaterlevelProcessor() {
+		super(FACET_FLOW_DEPTH_WATER_LEVEL_Y_AXIS_LABEL, HANDLED_FACET_TYPES);
+	}
 
-        return buildSeriesForType(generator, bundle, theme, visible, doGetType(bundle.getFacetName()), GAP_DISTANCE);
-    }
+	protected SInfoResultType doGetType(final String facetName) {
+
+		if (FACET_FLOW_DEPTH_WATER_LEVEL.contentEquals(facetName))
+			return SInfoResultType.waterlevel;
+		if (FACET_FLOW_DEPTH_BEDHEIGHT.contentEquals(facetName))
+			return SInfoResultType.meanBedHeight;
+		if (FACET_FLOW_DEPTH_BEDHEIGHT_MIN.contentEquals(facetName))
+			return SInfoResultType.minBedHeight;
+		if (FACET_FLOW_DEPTH_BEDHEIGHT_MAX.contentEquals(facetName))
+			return SInfoResultType.maxBedHeight;
+
+		final String error = String.format("Unknown facet name: %s", facetName);
+		throw new UnsupportedOperationException(error);
+	}
+
+	private static Facet createFlowDepthBedheightFacet(final CallContext context, final String hash, final String id,
+			final AbstractCalculationResult result, final int index, final String unit, final String facetLabel,
+			final String facetName, final String description) {
+		final CallMeta meta = context.getMeta();
+		final String yAxisLabel = Resources.getMsg(meta, FACET_BEDHEIGHT_Y_AXIS_LABEL,
+				FACET_BEDHEIGHT_Y_AXIS_LABEL, unit);
+
+		return AbstractProcessor.createFacet(context, hash, id, result, index, yAxisLabel, facetName, description,
+				facetLabel);
+	}
+
+	public static Facet createFlowDepthMeanBedheightFacet(final CallContext context, final String hash, final String id,
+			final AbstractCalculationResult result, final int index, final String unit, final String facetLabel) {
+		return FlowDepthWaterlevelProcessor.createFlowDepthBedheightFacet(context, hash, id, result, index, unit,
+				facetLabel, FACET_FLOW_DEPTH_BEDHEIGHT, FACET_FLOW_DEPTH_BEDHEIGHT_DESCRIPTION);
+	}
+
+	public static Facet createFlowDepthMinBedheightFacet(final CallContext context, final String hash, final String id,
+			final AbstractCalculationResult result, final int index, final String unit, final String facetLabel) {
+		return FlowDepthWaterlevelProcessor.createFlowDepthBedheightFacet(context, hash, id, result, index, unit,
+				facetLabel, FACET_FLOW_DEPTH_BEDHEIGHT_MIN, FACET_FLOW_DEPTH_BEDHEIGHT_DESCRIPTION_MIN);
+	}
+
+	public static Facet createFlowDepthMaxBedheightFacet(final CallContext context, final String hash, final String id,
+			final AbstractCalculationResult result, final int index, final String unit, final String facetLabel) {
+		return FlowDepthWaterlevelProcessor.createFlowDepthBedheightFacet(context, hash, id, result, index, unit,
+				facetLabel, FACET_FLOW_DEPTH_BEDHEIGHT_MAX, FACET_FLOW_DEPTH_BEDHEIGHT_DESCRIPTION_MAX);
+	}
+
+	public static Facet createFlowDepthWaterlevelFacet(final CallContext context, final String hash, final String id,
+			final AbstractCalculationResult result, final int index, final String unit, final String wstLabel) {
+		final CallMeta meta = context.getMeta();
+		final String yAxisLabel = Resources.getMsg(meta, FACET_FLOW_DEPTH_WATER_LEVEL_Y_AXIS_LABEL,
+				FACET_FLOW_DEPTH_WATER_LEVEL_Y_AXIS_LABEL, unit);
+		return AbstractProcessor.createFacet(context, hash, id, result, index, yAxisLabel, FACET_FLOW_DEPTH_WATER_LEVEL,
+				FACET_FLOW_DEPTH_WATER_LEVEL_DESCRIPTION, wstLabel);
+	}
+
+	@Override
+	protected String generateSeries(final DiagramGenerator generator, final ArtifactAndFacet bundle,
+			final ThemeDocument theme, final boolean visible) {
+
+		return buildSeriesForType(generator, bundle, theme, visible, doGetType(bundle.getFacetName()), GAP_DISTANCE);
+	}
 }
\ No newline at end of file


More information about the Dive4Elements-commits mailing list