[PATCH] issue1235: Fix determination of SedimentLoadLSGenerators Y-Axis (m3/a or t/a)

Wald Commits scm-commit at wald.intevation.org
Wed Jul 10 10:24:23 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1373445236 -7200
# Node ID 95aecf6cc5ad4801610ca558d2b3570f1d4d598a
# Parent  8c226c5089e0d52d2dc01a47c60420a5a9d82a7d
issue1235: Fix determination of SedimentLoadLSGenerators Y-Axis (m3/a or t/a).

diff -r 8c226c5089e0 -r 95aecf6cc5ad artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadLSGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadLSGenerator.java	Wed Jul 10 10:05:52 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadLSGenerator.java	Wed Jul 10 10:33:56 2013 +0200
@@ -73,8 +73,6 @@
     public static final String I18N_YAXIS_D_LABEL_DEFAULT = "delta S [m]";
     public static final String I18N_YAXIS_V_LABEL_DEFAULT = "Geschwindigkeit v [m/s]";
 
-    private String yLabel = "";
-
     @Override
     protected YAxisWalker getYAxisWalker() {
         return new YAxisWalker() {
@@ -106,14 +104,6 @@
         Facet facet = bundle.getFacet();
         D4EArtifact artifact = (D4EArtifact)bundle.getArtifact();
 
-        SedimentLoadAccess slaccess = new SedimentLoadAccess(artifact);
-        String unit = slaccess.getUnit();
-        if (unit != null && unit.equals("m3_per_a")) {
-            yLabel = msg(I18N_YAXIS_LABEL_2, I18N_YAXIS_LABEL_DEFAULT_2);
-        }
-        else {
-            yLabel = msg(I18N_YAXIS_LABEL_1, I18N_YAXIS_LABEL_DEFAULT_1);
-        }
         if (facet == null) {
             return;
         }
@@ -242,7 +232,15 @@
     protected String getDefaultYAxisLabel(int pos) {
         String label = "default";
         if (pos == YAXIS.L.idx) {
-            label = yLabel;
+            SedimentLoadAccess slaccess =
+                new SedimentLoadAccess((D4EArtifact) getMaster());
+            String unit = slaccess.getUnit();
+            if (unit != null && unit.equals("m3_per_a")) {
+                label = msg(I18N_YAXIS_LABEL_2, I18N_YAXIS_LABEL_DEFAULT_2);
+            }
+            else {
+                label = msg(I18N_YAXIS_LABEL_1, I18N_YAXIS_LABEL_DEFAULT_1);
+            }
         }
         else if (pos == YAXIS.V.idx) {
             label = msg(I18N_YAXIS_V_LABEL, I18N_YAXIS_V_LABEL_DEFAULT);


More information about the Dive4elements-commits mailing list