changeset 4520:0b330ed218f6

Added new y axis label for m3/a unit and fixed sand fraction output.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 14 Nov 2012 17:15:38 +0100
parents 3e1810e72199
children 71e6fe870c1d
files flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSGenerator.java
diffstat 1 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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;
     }

http://dive4elements.wald.intevation.org