diff flys-artifacts/src/main/java/de/intevation/flys/jfree/StickyAxisAnnotation.java @ 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 8e6615ad60b8
children 59622ba800c8
line wrap: on
line diff
--- 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