annotate flys-artifacts/src/main/java/de/intevation/flys/exports/StickyAxisAnnotation.java @ 1038:4dcc635d6ca6

Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed needless imports. flys-artifacts/trunk@2499 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 17 Aug 2011 12:53:55 +0000
parents
children
rev   line source
1038
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.exports;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
2
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
3 import org.apache.log4j.Logger;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
4
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
5 import java.util.Iterator;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
6
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7 import java.awt.Shape;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
8 import java.awt.geom.Rectangle2D;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
9 import java.awt.geom.Line2D;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11 import org.jfree.chart.annotations.XYTextAnnotation;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12 import org.jfree.chart.axis.ValueAxis;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13 import org.jfree.chart.util.LineUtilities;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14 import org.jfree.text.TextUtilities;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15 import org.jfree.chart.plot.PlotOrientation;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16 import org.jfree.chart.plot.XYPlot;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17 import org.jfree.chart.entity.XYAnnotationEntity;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18 import org.jfree.chart.plot.PlotRenderingInfo;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19 import org.jfree.chart.ChartRenderingInfo;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20 import org.jfree.chart.plot.Plot;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22 import org.jfree.ui.RectangleEdge;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25 /**
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26 * Custom Annotations class that is drawn only if no collisions with other
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27 * already drawn CustomAnnotations in current plot are found.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28 * Draws a given text and a line to it from either axis.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29 */
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30 class StickyAxisAnnotation extends XYTextAnnotation {
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32 /** Logger for this class. */
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33 private static Logger logger =
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34 Logger.getLogger(StickyAxisAnnotation.class);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
35
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 /** Simplified view on axes. */
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
37 public static enum SimpleAxis {
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38 X_AXIS, /** Usually "horizontal". */
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39 Y_AXIS /** Usually "vertical". */
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40 }
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42 /** Which axis to stick to. */
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 protected SimpleAxis stickyAxis = SimpleAxis.X_AXIS;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46 /**
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 * Trivial constructor.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48 *
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
49 * @param text Text to display.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50 * @param x X-position in dataspace (typical horizontal, in km).
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51 * @param y Y-position in dataspace (typical vertical, in m).
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52 */
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
53 public StickyAxisAnnotation(String text, float x, float y) {
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54 super(text, x, y);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55 }
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58 /**
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
59 * Sets the "sticky axis" (whether to draw annotations at the
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60 * X- or the Y-Axis.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61 *
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62 * @param stickyAxis axis to stick to.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
63 */
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
64 public void setStickyAxis(SimpleAxis stickyAxis) {
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
65 this.stickyAxis = stickyAxis;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
66 }
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
67
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
68
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
69 /**
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70 * Draws a small line at axis where this annotation resides.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71 *
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 * @param g2 the graphics device.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 * @param dataArea the data area.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 * @param domainAxis the domain axis.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75 * @param rangeAxis the range axis.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76 * @param domainEdge the domain edge.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77 * @param rangeEdge the range edge.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
78 * @param orientation the plot orientation.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
79 */
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
80 protected void drawAxisMark(
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81 java.awt.Graphics2D g2,
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
82 java.awt.geom.Rectangle2D dataArea,
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
83 ValueAxis domainAxis,
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
84 ValueAxis rangeAxis,
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
85 RectangleEdge domainEdge,
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
86 RectangleEdge rangeEdge,
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
87 PlotOrientation orientation) {
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
88 float j2DX1 = 0.0f;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
89 float j2DX2 = 0.0f;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90 float j2DY1 = 0.0f;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
91 float j2DY2 = 0.0f;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
92 float x = (float) getX();
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
93 float y = (float) getY();
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
94 /* When dependent on X/Y-Axis and orientation, following
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
95 can be used as a base:
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
96 if (orientation == PlotOrientation.VERTICAL) {
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
97 j2DX1 = (float) domainAxis.valueToJava2D(x, dataArea,
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
98 domainEdge);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
99 j2DY1 = (float) rangeAxis.valueToJava2D(y, dataArea,
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
100 rangeEdge);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
101 j2DX2 = (float) domainAxis.valueToJava2D(x, dataArea,
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
102 domainEdge);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
103 j2DY2 = (float) rangeAxis.valueToJava2D(y, dataArea,
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
104 rangeEdge);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
105 }
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
106 else if (orientation == PlotOrientation.HORIZONTAL) {
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
107 j2DY1 = (float) domainAxis.valueToJava2D(x, dataArea,
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
108 domainEdge);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
109 j2DX1 = (float) rangeAxis.valueToJava2D(y, dataArea,
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
110 rangeEdge);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
111 j2DY2 = (float) domainAxis.valueToJava2D(x, dataArea,
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
112 domainEdge);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
113 j2DX2 = (float) rangeAxis.valueToJava2D(y, dataArea,
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
114 rangeEdge);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
115 }
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
116
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
117 g2.setPaint(this.paint);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
118 g2.setStroke(this.stroke);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
119 */
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
120 j2DY1 = (float) RectangleEdge.coordinate(dataArea, domainEdge);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
121 j2DY2 = j2DY1 - 0.10f * (float)
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
122 (rangeAxis.getRange().getUpperBound()
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
123 - rangeAxis.getRange().getLowerBound());
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
124 j2DX1 = (float) domainAxis.valueToJava2D(x, dataArea, domainEdge);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
125 j2DX2 = j2DX1;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
126
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
127 Line2D line = new Line2D.Float(j2DX1, j2DY1, j2DX2, j2DY2);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
128
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
129 // line is clipped to avoid JRE bug 6574155, for more info
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
130 // see JFreeChart bug 2221495
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
131 boolean visible = LineUtilities.clipLine(line, dataArea);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
132 if (visible) {
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
133 g2.draw(line);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
134 }
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
135 }
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
136
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
137
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
138 /**
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
139 * Draw the Annotiation if it does not collide with other already drawn
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
140 * Annotations.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
141 *
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
142 * @param g2 the graphics device.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
143 * @param plot the plot.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
144 * @param dataArea the data area.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
145 * @param domainAxis the domain axis.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
146 * @param rangeAxis the range axis.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
147 * @param rendererIndex the render index.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
148 * @param info state information, escpecially collects info about
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
149 * already drawn shapes (and thus annotations), used
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
150 * for collision detection.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
151 */
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
152 @Override
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
153 public void draw(
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
154 java.awt.Graphics2D g2,
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
155 XYPlot plot,
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
156 java.awt.geom.Rectangle2D dataArea,
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
157 ValueAxis domainAxis,
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
158 ValueAxis rangeAxis,
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
159 int rendererIndex,
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
160 PlotRenderingInfo info) {
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
161
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
162 if (info == null)
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
163 return;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
164
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
165 // Calculate the bounding box.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
166 ChartRenderingInfo chartInfo = info.getOwner();
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
167
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
168 PlotOrientation orientation = plot.getOrientation();
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
169 RectangleEdge domainEdge = Plot.resolveDomainAxisLocation(
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
170 plot.getDomainAxisLocation(), orientation);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
171 RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation(
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
172 plot.getRangeAxisLocation(), orientation);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
173 float anchorX = (float) domainAxis.valueToJava2D(
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
174 getX(), dataArea, domainEdge);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
175 float anchorY = (float) rangeAxis.valueToJava2D(
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
176 getY(), dataArea, rangeEdge);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
177 if (orientation == PlotOrientation.HORIZONTAL) {
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
178 float tempAnchor = anchorX;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
179 anchorX = anchorY;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
180 anchorY = tempAnchor;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
181 }
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
182
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
183 // Always draw the small line at axis.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
184 drawAxisMark(g2, dataArea, domainAxis, rangeAxis, domainEdge,
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
185 rangeEdge, orientation);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
186
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
187 g2.setFont(getFont());
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
188 Shape hotspot = TextUtilities.calculateRotatedStringBounds(
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
189 getText(), g2, anchorX, anchorY, getTextAnchor(),
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
190 getRotationAngle(), getRotationAnchor());
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
191 Rectangle2D hotspotBox = hotspot.getBounds2D();
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
192 // Check for collisions with other XYAnnotations.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
193 for (Iterator i = chartInfo.getEntityCollection().iterator();
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
194 i.hasNext(); ) {
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
195 Object next = i.next();
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
196 // Collision with other stuff than XYAnnotations are okay.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
197 if (next instanceof XYAnnotationEntity) {
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
198 XYAnnotationEntity drawnShape = (XYAnnotationEntity) next;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
199 if (drawnShape.getArea().intersects(hotspotBox)) {
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
200 // Found collision, early stop.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
201 return;
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
202 }
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
203 }
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
204 }
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
205
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
206 // Actuall drawing.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
207 if (getBackgroundPaint() != null) {
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
208 g2.setPaint(getBackgroundPaint());
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
209 g2.fill(hotspot);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
210 }
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
211 g2.setPaint(getPaint());
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
212 TextUtilities.drawRotatedString(getText(), g2, anchorX, anchorY,
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
213 getTextAnchor(), getRotationAngle(), getRotationAnchor());
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
214 // Draw outline.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
215 if (false) {
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
216 g2.setStroke(getOutlineStroke());
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
217 g2.setPaint(getOutlinePaint());
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
218 g2.draw(hotspot);
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
219 }
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
220
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
221 // Add info that we have drawn this Annotation.
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
222 addEntity(info, hotspot, rendererIndex, getToolTipText(), getURL());
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
223 }
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
224 }
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
225
4dcc635d6ca6 Extracted and renamed CustomAnnotation to StickyAxisAnnotation. Also removed
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
226

http://dive4elements.wald.intevation.org