diff artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadLSGenerator.java @ 6791:dd5355775ce1 longitudinal-symmetry

merge changes from default into longitudinal-symmetrie branch and make it build
author Tom Gottfried <tom@intevation.de>
date Wed, 07 Aug 2013 18:53:15 +0200
parents ef3b02034f6a 252806ee7dd1
children
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadLSGenerator.java	Fri Jun 28 21:08:23 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadLSGenerator.java	Wed Aug 07 18:53:15 2013 +0200
@@ -36,10 +36,12 @@
 import org.dive4elements.river.utils.DataUtil;
 
 
+/** Generator for Longitudinal Sections of SedimentLoad-Calculations. */
 public class SedimentLoadLSGenerator
 extends LongitudinalSectionGenerator
 implements FacetTypes
 {
+    /** Y-Axis enum defining the four possible axes. */
     public enum YAXIS {
         L(0),
         D(1),
@@ -71,8 +73,7 @@
     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 = "";
-
+    /** Enumerator over y-axes. */
     @Override
     protected YAxisWalker getYAxisWalker() {
         return new YAxisWalker() {
@@ -104,14 +105,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;
         }
@@ -235,7 +228,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);

http://dive4elements.wald.intevation.org