[Dive4elements-commits] [PATCH] Part of fix for flys/issue1128: Use rivers unit in cross section diagrams

Wald Commits scm-commit at wald.intevation.org
Thu Feb 28 12:11:42 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1362050301 -3600
# Node ID b11f3563a11749395be7a8cf9812c39bd40db110
# Parent  a020100ee6a158ca3fefd0dea4505c5d52519154
Part of fix for flys/issue1128: Use rivers unit in cross section diagrams.

diff -r a020100ee6a1 -r b11f3563a117 flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java
--- 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);
             }


More information about the Dive4elements-commits mailing list