annotate flys-artifacts/src/main/java/de/intevation/flys/jfree/StickyAxisAnnotation.java @ 3166:591be3486087

FixA: Prevent that the plot becomes to small if only one point is drawn. flys-artifacts/trunk@4779 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 25 Jun 2012 15:03:57 +0000
parents 5642a83420f2
children b2ea89a665bc
rev   line source
1039
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.jfree;
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
2
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
3 import org.apache.log4j.Logger;
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
4
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
5
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
6 /**
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7 * Custom Annotations class that is drawn only if no collisions with other
1759
c51089a84d13 Restored correct drawing behavior for Annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
8 * already drawn CustomAnnotations in current plot are found. A mark on
c51089a84d13 Restored correct drawing behavior for Annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
9 * the axis is shown in all cases, though.
1039
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10 * Draws a given text and a line to it from either axis.
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11 */
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1962
diff changeset
12 public class StickyAxisAnnotation {
1039
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2999
diff changeset
14 /** Logger for this class. */
1039
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15 private static Logger logger =
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16 Logger.getLogger(StickyAxisAnnotation.class);
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18 /** Simplified view on axes. */
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19 public static enum SimpleAxis {
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20 X_AXIS, /** Usually "horizontal". */
2999
703be13ffa74 Cosmetics and ommitted fix.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2775
diff changeset
21 Y_AXIS, /** Usually "vertical". */
703be13ffa74 Cosmetics and ommitted fix.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2775
diff changeset
22 Y_AXIS2
1039
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23 }
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
25 /** The "symbolic" integer representing which axis to stick to. */
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
26 protected int axisSymbol;
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
27
1039
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28 /** Which axis to stick to. */
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29 protected SimpleAxis stickyAxis = SimpleAxis.X_AXIS;
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30
1085
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1082
diff changeset
31 /** The 1-dimensional position of this annotation. */
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1082
diff changeset
32 protected float pos;
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1082
diff changeset
33
2775
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
34 /**
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
35 * Optional field used when from axis a line should be drawn that
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
36 * hits a curve or something similar (current scenario: duration curves).
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
37 * This value is in the "other" dimension than the pos - field.
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
38 */
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
39 protected float hitPoint;
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
40
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
41 /** The text to display at axis. */
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1962
diff changeset
42 String text;
1085
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1082
diff changeset
43
2775
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
44
1085
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1082
diff changeset
45 /**
1089
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
46 * Constructor with implicit sticky x-axis.
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
47 * @param text the text to display.
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
48 * @param pos the position at which to draw the text and mark.
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
49 */
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
50 public StickyAxisAnnotation(String text, float pos) {
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1962
diff changeset
51 this(text, pos, SimpleAxis.X_AXIS);
1089
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
52 }
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
53
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
54
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
55 /**
1085
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1082
diff changeset
56 * Constructor with given explicit axis.
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1082
diff changeset
57 * @param text the text to display.
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1082
diff changeset
58 * @param pos the position at which to draw the text and mark.
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1082
diff changeset
59 * @param stickyAxis the axis at which to stick (and to which 'pos' is
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1082
diff changeset
60 * relative).
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1962
diff changeset
61 * @param lineTo upto where to draw a line (NaN for none).
1085
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1082
diff changeset
62 */
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1962
diff changeset
63 public StickyAxisAnnotation(String text, float pos, SimpleAxis stickAxis
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1962
diff changeset
64 ) {
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
65 this(text, pos, stickAxis, 0);
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
66 }
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
67
2775
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
68
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
69 public StickyAxisAnnotation(String text, float pos, SimpleAxis stickAxis,
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
70 int axisSymbol
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
71 ) {
1085
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1082
diff changeset
72 setStickyAxis(stickAxis);
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1962
diff changeset
73 this.text = text;
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1962
diff changeset
74 this.pos = pos;
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
75 this.axisSymbol = axisSymbol;
2775
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
76 this.hitPoint = Float.NaN;
1082
f16b66839e59 Prepare StickyAxisAnnotation implementation to handle annotations at 'y' (vertical) axis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1042
diff changeset
77 }
f16b66839e59 Prepare StickyAxisAnnotation implementation to handle annotations at 'y' (vertical) axis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1042
diff changeset
78
f16b66839e59 Prepare StickyAxisAnnotation implementation to handle annotations at 'y' (vertical) axis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1042
diff changeset
79
1039
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
80 /**
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81 * Sets the "sticky axis" (whether to draw annotations at the
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
82 * X- or the Y-Axis.
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
83 *
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
84 * @param stickyAxis axis to stick to.
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
85 */
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
86 public void setStickyAxis(SimpleAxis stickyAxis) {
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
87 this.stickyAxis = stickyAxis;
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
88 }
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
89
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1962
diff changeset
91 public float getPos() {
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1962
diff changeset
92 return this.pos;
1039
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
93 }
1738
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
94
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1962
diff changeset
95 public SimpleAxis getStickyAxis() {
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1962
diff changeset
96 return this.stickyAxis;
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1962
diff changeset
97 }
1738
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
98
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1962
diff changeset
99 public boolean atX() {
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1962
diff changeset
100 return this.getStickyAxis() == SimpleAxis.X_AXIS;
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1962
diff changeset
101 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1962
diff changeset
102
2775
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
103 /** Get text to be displayed at axis. */
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1962
diff changeset
104 public String getText() {
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1962
diff changeset
105 return this.text;
1738
6cdc7a77d3d4 Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1711
diff changeset
106 }
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
107
2775
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
108
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
109 public int getAxisSymbol() {
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
110 return this.axisSymbol;
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
111 }
2766
7dc4681a2bed Allow easy change of sticky axis for annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
112
2775
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
113
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
114 /** Set where to hit a curve (if any). */
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
115 public void setHitPoint(float pos) {
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
116 this.hitPoint = pos;
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
117 }
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
118
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
119 /** Get where to hit a curve (if any). */
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
120 public float getHitPoint() {
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
121 return this.hitPoint;
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
122 }
5016609663e2 Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2766
diff changeset
123
2766
7dc4681a2bed Allow easy change of sticky axis for annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
124 /** Set sticky axis to the X axis if it is currently Y, and vice versa. */
7dc4681a2bed Allow easy change of sticky axis for annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
125 public void flipStickyAxis() {
7dc4681a2bed Allow easy change of sticky axis for annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
126 if (this.getStickyAxis() == SimpleAxis.X_AXIS) {
7dc4681a2bed Allow easy change of sticky axis for annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
127 this.setStickyAxis(SimpleAxis.Y_AXIS);
7dc4681a2bed Allow easy change of sticky axis for annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
128 }
7dc4681a2bed Allow easy change of sticky axis for annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
129 else {
7dc4681a2bed Allow easy change of sticky axis for annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
130 this.setStickyAxis(SimpleAxis.X_AXIS);
7dc4681a2bed Allow easy change of sticky axis for annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
131 }
7dc4681a2bed Allow easy change of sticky axis for annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
132 }
1039
cf39205df113 Part of refactoring (see next commit).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
133 }
1711
f708120cb7bc Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1167
diff changeset
134 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org