changeset 5130:b11f3563a117

Part of fix for flys/issue1128: Use rivers unit in cross section diagrams.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 28 Feb 2013 12:18:21 +0100
parents a020100ee6a1
children 42bae65c116b
files flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java
diffstat 1 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java	Thu Feb 28 11:48:17 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java	Thu Feb 28 12:18:21 2013 +0100
@@ -17,6 +17,7 @@
 
 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
 import de.intevation.artifacts.DataProvider;
+import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.geom.Lines;
 import de.intevation.flys.artifacts.model.CrossSectionFacet;
 import de.intevation.flys.artifacts.model.FacetTypes;
@@ -28,6 +29,7 @@
 import de.intevation.flys.themes.LineStyle;
 import de.intevation.flys.themes.TextStyle;
 import de.intevation.flys.themes.ThemeAccess;
+import de.intevation.flys.utils.FLYSUtils;
 import de.intevation.flys.utils.Formatter;
 import de.intevation.flys.utils.ThemeUtil;
 
@@ -232,7 +234,13 @@
 
     @Override
     protected String getDefaultYAxisLabel(int pos) {
-        return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT);
+        FLYSArtifact flys = (FLYSArtifact) master;
+
+        String unit = FLYSUtils.getRiver(flys).getWstUnit().getName();
+
+        return msg(I18N_YAXIS_LABEL,
+                   I18N_YAXIS_LABEL_DEFAULT,
+                   new Object[] { unit });
     }
 
 
@@ -341,7 +349,11 @@
         if (ThemeUtil.parseShowLevel(theme) && lines.points.length > 1
                 && lines.points[1].length > 0) {
             NumberFormat nf = Formatter.getMeterFormat(this.context);
-            String labelAdd = "W=" + nf.format(lines.points[1][0]) + "NN+m";
+            FLYSArtifact flys = (FLYSArtifact) master;
+
+            String unit = FLYSUtils.getRiver(flys).getWstUnit().getName();
+
+            String labelAdd = "W=" + nf.format(lines.points[1][0]) + unit;
             if (series.getLabel().length() == 0) {
                 series.setLabel(labelAdd);
             }

http://dive4elements.wald.intevation.org