changeset 1759:c51089a84d13

Restored correct drawing behavior for Annotations. flys-artifacts/trunk@3072 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 25 Oct 2011 12:43:58 +0000
parents 1d78039a36e6
children 424e26041564
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/jfree/StickyAxisAnnotation.java
diffstat 2 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Oct 25 12:37:05 2011 +0000
+++ b/flys-artifacts/ChangeLog	Tue Oct 25 12:43:58 2011 +0000
@@ -1,3 +1,9 @@
+2011-10-25  Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* ./src/main/java/de/intevation/flys/jfree/StickyAxisAnnotation.java:
+	  Revert correct behaviour of Annotations (the small axis tick shall
+	  always be drawn). Minor refactoring.
+
 2011-10-25  Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* doc/conf/meta-data.xml: Added configuration to include differences
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/StickyAxisAnnotation.java	Tue Oct 25 12:37:05 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/StickyAxisAnnotation.java	Tue Oct 25 12:43:58 2011 +0000
@@ -32,7 +32,8 @@
 
 /**
  * Custom Annotations class that is drawn only if no collisions with other
- * already drawn CustomAnnotations in current plot are found.
+ * already drawn CustomAnnotations in current plot are found. A mark on
+ * the axis is shown in all cases, though.
  * Draws a given text and a line to it from either axis.
  */
 public class StickyAxisAnnotation extends XYTextAnnotation {
@@ -216,6 +217,9 @@
         // see JFreeChart bug 2221495
         boolean visible = LineUtilities.clipLine(line, dataArea);
         if (visible) {
+            setOutlineStroke(new BasicStroke((float) lineWidth));
+            g2.setStroke(getOutlineStroke());
+            g2.setPaint(lineColor);
             g2.draw(line);
         }
     }
@@ -296,6 +300,10 @@
         //Call to apply orientation.
         setStickyAxis(stickyAxis);
 
+        // Always draw the small line at axis.
+        drawAxisMark(g2, dataArea, domainAxis, rangeAxis, domainEdge,
+                rangeEdge, orientation);
+
         Shape hotspot = TextUtilities.calculateRotatedStringBounds(
            getText(), g2, anchorX, anchorY, getTextAnchor(),
            getRotationAngle(), getRotationAnchor());
@@ -326,13 +334,6 @@
             g2.draw(hotspot);
         }
 
-        // Always draw the small line at axis.
-        setOutlineStroke(new BasicStroke((float) lineWidth));
-        g2.setStroke(getOutlineStroke());
-        g2.setPaint(lineColor);
-        drawAxisMark(g2, dataArea, domainAxis, rangeAxis, domainEdge,
-                rangeEdge, orientation);
-
         // Draw the text.
         g2.setPaint(textColor);
         g2.setFont(font);

http://dive4elements.wald.intevation.org