changeset 2649:6f5fc3de0d48

Most of issue454: Label waterlines. flys-artifacts/trunk@4308 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 26 Apr 2012 10:45:25 +0000 (2012-04-26)
parents 8aaa7f4ce06a
children a6fa128e4654
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java
diffstat 2 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Apr 26 09:51:13 2012 +0000
+++ b/flys-artifacts/ChangeLog	Thu Apr 26 10:45:25 2012 +0000
@@ -1,3 +1,10 @@
+2012-04-26	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Most of issue454: Label waterlevels.
+
+	* src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java
+	  (drawSecondaryPass): Use correct label for lines.
+
 2012-04-26	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java	Thu Apr 26 09:51:13 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java	Thu Apr 26 10:45:25 2012 +0000
@@ -17,6 +17,7 @@
 import org.jfree.chart.plot.XYPlot;
 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
 import org.jfree.data.xy.XYDataset;
+import org.jfree.data.xy.XYSeriesCollection;
 import org.jfree.ui.RectangleEdge;
 import org.jfree.util.BooleanList;
 import org.jfree.util.ShapeUtilities;
@@ -236,12 +237,13 @@
                     (y1 < 0.0));
         }
 
-        boolean doWaterlevelLabel = false;
+        // Draw label of line.
         if (isShowLineLabel(series) && isMinimumX (dataset, series, item)) {
-            // TODO find name of dataset/series
-            String waterlevelLabel = "label";
+            String waterlevelLabel =
+                ((XYSeriesCollection) dataset).getSeries(series)
+                    .getKey().toString();
             // TODO Force water of some German rivers to flow direction mountains.
-            g2.drawString("waterlevel label", (float)xx, (float)yy-3f);
+            g2.drawString(waterlevelLabel, (float)xx, (float)yy-3f);
         }
 
         int domainAxisIndex = plot.getDomainAxisIndex(domainAxis);

http://dive4elements.wald.intevation.org