Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/jfree/CollisionFreeXYTextAnnotation.java @ 2298:177921b9e8bb
Partial fix issue474, i18n.
flys-artifacts/trunk@3964 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 08 Feb 2012 11:16:39 +0000 |
parents | c68f4f227c09 |
children | 0b8c04c7f762 |
rev | line source |
---|---|
2157
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.jfree; |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 import org.apache.log4j.Logger; |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 import java.util.Iterator; |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 import java.awt.Shape; |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 import java.awt.geom.Rectangle2D; |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 import org.jfree.chart.annotations.XYTextAnnotation; |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 import org.jfree.chart.axis.ValueAxis; |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 import org.jfree.chart.plot.PlotOrientation; |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 import org.jfree.chart.plot.XYPlot; |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 import org.jfree.chart.entity.XYAnnotationEntity; |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 import org.jfree.chart.plot.PlotRenderingInfo; |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 import org.jfree.chart.plot.Plot; |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 import org.jfree.text.TextUtilities; |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 import org.jfree.ui.RectangleEdge; |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 /** |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 * Custom Annotations class that is drawn only if no collisions with other |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 * already drawn CustomAnnotations in current plot are found. |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 */ |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 public class CollisionFreeXYTextAnnotation extends XYTextAnnotation { |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 /** Logger for this class. */ |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 private static Logger logger = |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 Logger.getLogger(CollisionFreeXYTextAnnotation.class); |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2157
diff
changeset
|
33 |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2157
diff
changeset
|
34 public CollisionFreeXYTextAnnotation(String text, double x, double y) { |
2157
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 super(text, x, y); |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 } |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 /** |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 * Draw the Annotation only if it does not collide with other |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 * already drawn Annotations- texts. |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 * |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 * @param g2 the graphics device. |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 * @param plot the plot. |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 * @param dataArea the data area. |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 * @param domainAxis the domain axis. |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 * @param rangeAxis the range axis. |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 * @param rendererIndex the render index. |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 * @param info state information, escpecially collects info about |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 * already drawn shapes (and thus annotations), used |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 * for collision detection. |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 */ |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 @Override |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 public void draw( |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 java.awt.Graphics2D g2, |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
56 XYPlot plot, |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
57 java.awt.geom.Rectangle2D dataArea, |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 ValueAxis domainAxis, |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
59 ValueAxis rangeAxis, |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
60 int rendererIndex, |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 PlotRenderingInfo info |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 ) { |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 // From superclass, adjusted access only. |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
64 PlotOrientation orientation = plot.getOrientation(); |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
65 RectangleEdge domainEdge = Plot.resolveDomainAxisLocation( |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
66 plot.getDomainAxisLocation(), orientation); |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
67 RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation( |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
68 plot.getRangeAxisLocation(), orientation); |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
69 |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
70 float anchorX = (float) domainAxis.valueToJava2D( |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 this.getX(), dataArea, domainEdge); |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 float anchorY = (float) rangeAxis.valueToJava2D( |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
73 this.getY(), dataArea, rangeEdge); |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
74 |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
75 if (orientation == PlotOrientation.HORIZONTAL) { |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
76 float tempAnchor = anchorX; |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
77 anchorX = anchorY; |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
78 anchorY = tempAnchor; |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
79 } |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
80 |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
81 g2.setFont(getFont()); |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
82 Shape hotspot = TextUtilities.calculateRotatedStringBounds( |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
83 getText(), g2, anchorX, anchorY, getTextAnchor(), |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
84 getRotationAngle(), getRotationAnchor()); |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
85 |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
86 // Deviation from superclass: prevent collision. |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
87 Rectangle2D hotspotBox = hotspot.getBounds2D(); |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2157
diff
changeset
|
88 |
2157
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
89 for (Iterator i = info.getOwner().getEntityCollection().iterator(); |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
90 i.hasNext(); ) { |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
91 Object next = i.next(); |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
92 // Collision with other stuff than XYAnnotations are okay. |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
93 if (next instanceof XYAnnotationEntity) { |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
94 XYAnnotationEntity drawnShape = (XYAnnotationEntity) next; |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
95 if (drawnShape.getArea().intersects(hotspotBox)) { |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
96 // Found collision, early stop. |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
97 return; |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
98 } |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
99 } |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
100 } |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
101 |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
102 if (this.getBackgroundPaint() != null) { |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
103 g2.setPaint(this.getBackgroundPaint()); |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
104 g2.fill(hotspot); |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
105 } |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
106 g2.setPaint(getPaint()); |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
107 TextUtilities.drawRotatedString(getText(), g2, anchorX, anchorY, |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
108 getTextAnchor(), getRotationAngle(), getRotationAnchor()); |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
109 if (this.isOutlineVisible()) { |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
110 g2.setStroke(this.getOutlineStroke()); |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
111 g2.setPaint(this.getOutlinePaint()); |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
112 g2.draw(hotspot); |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
113 } |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
114 |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
115 String toolTip = getToolTipText(); |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
116 String url = getURL(); |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
117 if (toolTip != null || url != null) { |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
118 addEntity(info, hotspot, rendererIndex, toolTip, url); |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
119 } |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
120 else { |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
121 addEntity(info, hotspot, rendererIndex, |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
122 "CollisionFreeXYTextAnnotation", |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
123 "CollisionFreeXYTextAnnotation"); |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
124 } |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
125 } |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
126 } |
c4ceade9d50e
Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
127 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |