[Dive4elements-commits] [PATCH 09 of 13] Added new y axis label for m3/a unit and fixed sand fraction output

Wald Commits scm-commit at wald.intevation.org
Wed Nov 14 17:26:35 CET 2012


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1352909738 -3600
# Node ID 0b330ed218f67eaef35b375295366b366e0d4265
# Parent  3e1810e7219912912ac4c6e7865631004cde3d16
Added new y axis label for m3/a unit and fixed sand fraction output.

diff -r 3e1810e72199 -r 0b330ed218f6 flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSGenerator.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSGenerator.java	Wed Nov 14 17:11:56 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSGenerator.java	Wed Nov 14 17:15:38 2012 +0100
@@ -6,6 +6,8 @@
 
 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
 import de.intevation.artifactdatabase.state.Facet;
+import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.access.SedimentLoadAccess;
 import de.intevation.flys.artifacts.model.FacetTypes;
 import de.intevation.flys.artifacts.model.minfo.SedimentLoadResult;
 import de.intevation.flys.exports.StyledSeriesBuilder;
@@ -32,11 +34,15 @@
 
     public static final String I18N_CHART_TITLE = "chart.sedimentload.ls.title";
     public static final String I18N_XAXIS_LABEL = "chart.sedimentload.ls.xaxis.label";
-    public static final String I18N_YAXIS_LABEL = "chart.sedimentload.ls.yaxis.label.diff";
+    public static final String I18N_YAXIS_LABEL_1 = "chart.sedimentload.ls.yaxis.label.tpera";
+    public static final String I18N_YAXIS_LABEL_2 = "chart.sedimentload.ls.yaxis.label.m3pera";
 
     public static final String I18N_CHART_TITLE_DEFAULT = "Sedimentfracht";
     public static final String I18N_XAXIS_LABEL_DEFAULT = "Fluss-Km";
-    public static final String I18N_YAXIS_LABEL_DEFAULT = "[t/a]";
+    public static final String I18N_YAXIS_LABEL_DEFAULT_1 = "[t/a]";
+    public static final String I18N_YAXIS_LABEL_DEFAULT_2 = "[m\u00b3/a]";
+
+    private FLYSArtifact artifact;
 
     @Override
     protected YAxisWalker getYAxisWalker() {
@@ -67,6 +73,7 @@
         }
 
         Facet facet = bundle.getFacet();
+        artifact = (FLYSArtifact)bundle.getArtifact();
 
         if (facet == null) {
             return;
@@ -94,7 +101,7 @@
                 visible);
         }
         else if (name.equals(SEDIMENT_LOAD_SUSP_SAND)) {
-            doSedimentLoadSandOut(
+            doSedimentLoadSuspSandOut(
                 (SedimentLoadResult) bundle.getData(context),
                 bundle,
                 attr,
@@ -144,7 +151,13 @@
     protected String getDefaultYAxisLabel(int pos) {
         String label = "default";
         if (pos == YAXIS.L.idx) {
-            label = msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT);
+            SedimentLoadAccess access = new SedimentLoadAccess(artifact);
+            if (access.getUnit().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);
+            }
         }
         return label;
     }


More information about the Dive4elements-commits mailing list