changeset 3228:698d09930329

Fix issue695 (labels of waterlines). flys-artifacts/trunk@4856 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 03 Jul 2012 09:32:47 +0000
parents ed07dd55f487
children ad9640211db3
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java flys-artifacts/src/main/java/de/intevation/flys/jfree/XYStyle.java
diffstat 3 files changed, 39 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Jul 03 08:46:14 2012 +0000
+++ b/flys-artifacts/ChangeLog	Tue Jul 03 09:32:47 2012 +0000
@@ -1,3 +1,14 @@
+2012-07-03	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Fix issue695 (labeling of waterlines).
+	
+	* src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java
+	  (doCrossSectionWaterLineOut): Handle labels more individually.
+	
+	* src/main/java/de/intevation/flys/jfree/XYStyle.java
+	  (applyShowLineLabel): Tell renderer that there is something to do in case
+	  any label is switched on.
+
 2012-07-03  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java,
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java	Tue Jul 03 08:46:14 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java	Tue Jul 03 09:32:47 2012 +0000
@@ -225,22 +225,40 @@
         // DO NOT SORT DATA! This destroys the gaps indicated by NaNs.
         StyledXYSeries series = new StyledXYSeries(seriesName, false, theme);
 
+        if (!ThemeUtil.parseShowLineLabel(theme)) {
+            series.setLabel("");
+        }
         if (ThemeUtil.parseShowWidth(theme)) {
             NumberFormat nf = nf = Formatter.getMeterFormat(this.context);
-            series.setLabel(series.getLabel() + ", b=" +
-                nf.format(lines.width) + "m");
+            String labelAdd = "b=" + nf.format(lines.width) + "m";
+            if (series.getLabel().equals("")) {
+               series.setLabel(labelAdd);
+            }
+            else {
+                series.setLabel(series.getLabel() + ", " + labelAdd);
+            }
         }
         if (ThemeUtil.parseShowLevel(theme) && lines.points.length >0
             && lines.points[1].length > 0) {
             NumberFormat nf = nf = Formatter.getMeterFormat(this.context);
-            series.setLabel(series.getLabel() + ", W=" +
-                nf.format(lines.points[1][0]) + "NN+m");
+            String labelAdd = "W=" + nf.format(lines.points[1][0]) + "NN+m";
+            if (series.getLabel().equals("")) {
+               series.setLabel(labelAdd);
+            }
+            else {
+                series.setLabel(series.getLabel() + ", " + labelAdd);
+            }
         }
         if (ThemeUtil.parseShowMiddleHeight(theme) && lines.width != 0) {
             NumberFormat nf = nf = Formatter.getMeterFormat(this.context);
-            series.setLabel(series.getLabel() + ",H=" +
-                nf.format(lines.area / lines.width) + "m");
+            String labelAdd = "H=" + nf.format(lines.area / lines.width) + "m";
                 // : " + lines.area + "/" + lines.width);
+            if (series.getLabel().equals("")) {
+               series.setLabel(labelAdd);
+            }
+            else {
+                series.setLabel(series.getLabel() + ", " + labelAdd);
+            }
         }
 
         StyledSeriesBuilder.addPoints(series, lines.points, false);
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/XYStyle.java	Tue Jul 03 08:46:14 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/XYStyle.java	Tue Jul 03 09:32:47 2012 +0000
@@ -76,7 +76,10 @@
             return;
         }
         boolean showLabelLine = ThemeUtil.parseShowLineLabel(theme);
-        ((EnhancedLineAndShapeRenderer)r).setShowLineLabel(showLabelLine, idx);
+        boolean anyLabel = showLabelLine || ThemeUtil.parseShowWidth(theme) ||
+                           ThemeUtil.parseShowLevel(theme) ||
+                           ThemeUtil.parseShowMiddleHeight(theme);
+        ((EnhancedLineAndShapeRenderer)r).setShowLineLabel(anyLabel, idx);
     }
 
 

http://dive4elements.wald.intevation.org