Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/jfree/StickyAxisAnnotation.java @ 9258:d950c6055102
Made serializable for use with FloodDurationCalculationResults
author | mschaefer |
---|---|
date | Mon, 16 Jul 2018 08:41:51 +0200 |
parents | 130160b8d245 |
children |
comparison
equal
deleted
inserted
replaced
9257:ef7b65576d4b | 9258:d950c6055102 |
---|---|
6 * documentation coming with Dive4Elements River for details. | 6 * documentation coming with Dive4Elements River for details. |
7 */ | 7 */ |
8 | 8 |
9 package org.dive4elements.river.jfree; | 9 package org.dive4elements.river.jfree; |
10 | 10 |
11 import java.io.Serializable; | |
12 | |
11 /** | 13 /** |
12 * Text, position on axis, and maybe a hit-point in a class. | 14 * Text, position on axis, and maybe a hit-point in a class. |
13 * | 15 * |
14 * Idea is to draw a given text and a line to it from either axis. | 16 * Idea is to draw a given text and a line to it from either axis. |
15 * This class just keeps the info. | 17 * This class just keeps the info. |
16 */ | 18 */ |
17 public class StickyAxisAnnotation { | 19 public class StickyAxisAnnotation implements Serializable { |
20 | |
21 private static final long serialVersionUID = 1L; | |
18 | 22 |
19 /** Simplified view on axes. */ | 23 /** Simplified view on axes. */ |
20 public static enum SimpleAxis { | 24 public static enum SimpleAxis { |
21 X_AXIS, /** Usually "horizontal". */ | 25 X_AXIS, /** Usually "horizontal". */ |
22 Y_AXIS, /** Usually "vertical". */ | 26 Y_AXIS, /** Usually "vertical". */ |
46 /** | 50 /** |
47 * Constructor with implicit sticky x-axis. | 51 * Constructor with implicit sticky x-axis. |
48 * @param text the text to display. | 52 * @param text the text to display. |
49 * @param pos the position at which to draw the text and mark. | 53 * @param pos the position at which to draw the text and mark. |
50 */ | 54 */ |
51 public StickyAxisAnnotation(String text, float pos) { | 55 public StickyAxisAnnotation(final String text, final float pos) { |
52 this(text, pos, SimpleAxis.X_AXIS); | 56 this(text, pos, SimpleAxis.X_AXIS); |
53 } | 57 } |
54 | 58 |
55 | 59 |
56 /** | 60 /** |
58 * @param text the text to display. | 62 * @param text the text to display. |
59 * @param pos the position at which to draw the text and mark. | 63 * @param pos the position at which to draw the text and mark. |
60 * @param stickAxis the axis at which to stick (and to which 'pos' is | 64 * @param stickAxis the axis at which to stick (and to which 'pos' is |
61 * relative). | 65 * relative). |
62 */ | 66 */ |
63 public StickyAxisAnnotation(String text, float pos, SimpleAxis stickAxis | 67 public StickyAxisAnnotation(final String text, final float pos, final SimpleAxis stickAxis |
64 ) { | 68 ) { |
65 this(text, pos, stickAxis, 0); | 69 this(text, pos, stickAxis, 0); |
66 } | 70 } |
67 | 71 |
68 | 72 |
69 /** | 73 /** |
71 * @param text the text to display. | 75 * @param text the text to display. |
72 * @param pos the position at which to draw the text and mark. | 76 * @param pos the position at which to draw the text and mark. |
73 * @param stickAxis the axis at which to stick (and to which 'pos' is | 77 * @param stickAxis the axis at which to stick (and to which 'pos' is |
74 * relative). | 78 * relative). |
75 */ | 79 */ |
76 public StickyAxisAnnotation(String text, float pos, SimpleAxis stickAxis, | 80 public StickyAxisAnnotation(final String text, final float pos, final SimpleAxis stickAxis, |
77 int axisSymbol | 81 final int axisSymbol |
78 ) { | 82 ) { |
79 setStickyAxis(stickAxis); | 83 setStickyAxis(stickAxis); |
80 this.text = text; | 84 this.text = text; |
81 this.pos = pos; | 85 this.pos = pos; |
82 this.axisSymbol = axisSymbol; | 86 this.axisSymbol = axisSymbol; |
83 this.hitPoint = Float.NaN; | 87 this.hitPoint = Float.NaN; |
88 * Sets the "sticky axis" (whether to draw annotations at the | 92 * Sets the "sticky axis" (whether to draw annotations at the |
89 * X- or the Y-Axis. | 93 * X- or the Y-Axis. |
90 * | 94 * |
91 * @param stickyAxis axis to stick to. | 95 * @param stickyAxis axis to stick to. |
92 */ | 96 */ |
93 public void setStickyAxis(SimpleAxis stickyAxis) { | 97 public void setStickyAxis(final SimpleAxis stickyAxis) { |
94 this.stickyAxis = stickyAxis; | 98 this.stickyAxis = stickyAxis; |
95 } | 99 } |
96 | 100 |
97 | 101 |
98 /** The position (relative to axis). */ | 102 /** The position (relative to axis). */ |
99 public float getPos() { | 103 public float getPos() { |
100 return this.pos; | 104 return this.pos; |
101 } | 105 } |
102 | 106 |
103 /** The position (relative to axis). */ | 107 /** The position (relative to axis). */ |
104 public void setPos(double pos) { | 108 public void setPos(final double pos) { |
105 this.pos = (float) pos; | 109 this.pos = (float) pos; |
106 } | 110 } |
107 | 111 |
108 public SimpleAxis getStickyAxis() { | 112 public SimpleAxis getStickyAxis() { |
109 return this.stickyAxis; | 113 return this.stickyAxis; |
122 | 126 |
123 public int getAxisSymbol() { | 127 public int getAxisSymbol() { |
124 return this.axisSymbol; | 128 return this.axisSymbol; |
125 } | 129 } |
126 | 130 |
127 public void setAxisSymbol(int axis) { | 131 public void setAxisSymbol(final int axis) { |
128 this.axisSymbol = axis; | 132 this.axisSymbol = axis; |
129 } | 133 } |
130 | 134 |
131 /** Set where to hit a curve (if any). */ | 135 /** Set where to hit a curve (if any). */ |
132 public void setHitPoint(float pos) { | 136 public void setHitPoint(final float pos) { |
133 this.hitPoint = pos; | 137 this.hitPoint = pos; |
134 } | 138 } |
135 | 139 |
136 /** Get where to hit a curve (if any). */ | 140 /** Get where to hit a curve (if any). */ |
137 public float getHitPoint() { | 141 public float getHitPoint() { |