diff flys-artifacts/src/main/java/de/intevation/flys/jfree/StickyAxisAnnotation.java @ 2775:5016609663e2

Draw line from w-annotation to duration curve, rough version. flys-artifacts/trunk@4514 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 25 May 2012 09:13:43 +0000
parents 7dc4681a2bed
children 703be13ffa74
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/StickyAxisAnnotation.java	Fri May 25 09:05:07 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/StickyAxisAnnotation.java	Fri May 25 09:13:43 2012 +0000
@@ -30,8 +30,17 @@
     /** The 1-dimensional position of this annotation. */
     protected float pos;
 
+    /**
+     * Optional field used when from axis a line should be drawn that
+     * hits a curve or something similar (current scenario: duration curves).
+     * This value is in the "other" dimension than the pos - field.
+     */
+    protected float hitPoint;
+
+    /** The text to display at axis. */
     String text;
 
+
     /**
      * Constructor with implicit sticky x-axis.
      * @param text       the text to display.
@@ -55,6 +64,7 @@
         this(text, pos, stickAxis, 0);
     }
 
+
     public StickyAxisAnnotation(String text, float pos, SimpleAxis stickAxis,
             int axisSymbol
     ) {
@@ -62,6 +72,7 @@
         this.text   = text;
         this.pos    = pos;
         this.axisSymbol = axisSymbol;
+        this.hitPoint = Float.NaN;
     }
 
 
@@ -88,14 +99,27 @@
         return this.getStickyAxis() == SimpleAxis.X_AXIS;
     }
 
+    /** Get text to be displayed at axis. */
     public String getText() {
         return this.text;
     }
 
+
     public int getAxisSymbol() {
         return this.axisSymbol;
     }
 
+
+    /** Set where to hit a curve (if any). */
+    public void setHitPoint(float pos) {
+        this.hitPoint = pos;
+    }
+
+    /** Get where to hit a curve (if any). */
+    public float getHitPoint() {
+        return this.hitPoint;
+    }
+
     /** Set sticky axis to the X axis if it is currently Y, and vice versa. */
     public void flipStickyAxis() {
         if (this.getStickyAxis() == SimpleAxis.X_AXIS) {

http://dive4elements.wald.intevation.org