Mercurial > dive4elements > river
comparison 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 |
comparison
equal
deleted
inserted
replaced
2774:b2727413fae2 | 2775:5016609663e2 |
---|---|
28 protected SimpleAxis stickyAxis = SimpleAxis.X_AXIS; | 28 protected SimpleAxis stickyAxis = SimpleAxis.X_AXIS; |
29 | 29 |
30 /** The 1-dimensional position of this annotation. */ | 30 /** The 1-dimensional position of this annotation. */ |
31 protected float pos; | 31 protected float pos; |
32 | 32 |
33 /** | |
34 * Optional field used when from axis a line should be drawn that | |
35 * hits a curve or something similar (current scenario: duration curves). | |
36 * This value is in the "other" dimension than the pos - field. | |
37 */ | |
38 protected float hitPoint; | |
39 | |
40 /** The text to display at axis. */ | |
33 String text; | 41 String text; |
42 | |
34 | 43 |
35 /** | 44 /** |
36 * Constructor with implicit sticky x-axis. | 45 * Constructor with implicit sticky x-axis. |
37 * @param text the text to display. | 46 * @param text the text to display. |
38 * @param pos the position at which to draw the text and mark. | 47 * @param pos the position at which to draw the text and mark. |
53 public StickyAxisAnnotation(String text, float pos, SimpleAxis stickAxis | 62 public StickyAxisAnnotation(String text, float pos, SimpleAxis stickAxis |
54 ) { | 63 ) { |
55 this(text, pos, stickAxis, 0); | 64 this(text, pos, stickAxis, 0); |
56 } | 65 } |
57 | 66 |
67 | |
58 public StickyAxisAnnotation(String text, float pos, SimpleAxis stickAxis, | 68 public StickyAxisAnnotation(String text, float pos, SimpleAxis stickAxis, |
59 int axisSymbol | 69 int axisSymbol |
60 ) { | 70 ) { |
61 setStickyAxis(stickAxis); | 71 setStickyAxis(stickAxis); |
62 this.text = text; | 72 this.text = text; |
63 this.pos = pos; | 73 this.pos = pos; |
64 this.axisSymbol = axisSymbol; | 74 this.axisSymbol = axisSymbol; |
75 this.hitPoint = Float.NaN; | |
65 } | 76 } |
66 | 77 |
67 | 78 |
68 /** | 79 /** |
69 * Sets the "sticky axis" (whether to draw annotations at the | 80 * Sets the "sticky axis" (whether to draw annotations at the |
86 | 97 |
87 public boolean atX() { | 98 public boolean atX() { |
88 return this.getStickyAxis() == SimpleAxis.X_AXIS; | 99 return this.getStickyAxis() == SimpleAxis.X_AXIS; |
89 } | 100 } |
90 | 101 |
102 /** Get text to be displayed at axis. */ | |
91 public String getText() { | 103 public String getText() { |
92 return this.text; | 104 return this.text; |
93 } | 105 } |
94 | 106 |
107 | |
95 public int getAxisSymbol() { | 108 public int getAxisSymbol() { |
96 return this.axisSymbol; | 109 return this.axisSymbol; |
110 } | |
111 | |
112 | |
113 /** Set where to hit a curve (if any). */ | |
114 public void setHitPoint(float pos) { | |
115 this.hitPoint = pos; | |
116 } | |
117 | |
118 /** Get where to hit a curve (if any). */ | |
119 public float getHitPoint() { | |
120 return this.hitPoint; | |
97 } | 121 } |
98 | 122 |
99 /** Set sticky axis to the X axis if it is currently Y, and vice versa. */ | 123 /** Set sticky axis to the X axis if it is currently Y, and vice versa. */ |
100 public void flipStickyAxis() { | 124 public void flipStickyAxis() { |
101 if (this.getStickyAxis() == SimpleAxis.X_AXIS) { | 125 if (this.getStickyAxis() == SimpleAxis.X_AXIS) { |