annotate flys-artifacts/src/main/java/de/intevation/flys/jfree/CollisionFreeXYTextAnnotation.java @ 4798:39885bdfc6fc

Added calculation of the "Umhuellende" to calculation of "W fuer ungleichwertige Abfluesse". This is done by figuring out the WST columns that imfold the data and then do simple "gleichwertige" calculations from the start of the interval. This is too much because only the Qs are needed for the "Umhuellende".
author Sascha L. Teichmann <teichmann@intevation.de>
date Sun, 13 Jan 2013 16:18:28 +0100
parents 6ed8ebd48d6e
children
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 java.awt.Shape;
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
4 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
5
2318
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
6 import org.jfree.chart.entity.EntityCollection;
2157
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7 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
8 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
9 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
10 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
11 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
12 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
13 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
14
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15 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
16
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17 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
18
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 * 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
21 * 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
22 */
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23 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
24
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2157
diff changeset
25 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
26 super(text, x, y);
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27 }
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
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30 /**
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31 * 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
32 * already drawn Annotations- texts.
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33 *
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34 * @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
35 * @param plot the plot.
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 * @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
37 * @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
38 * @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
39 * @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
40 * @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
41 * 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
42 * for collision detection.
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 */
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44 @Override
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45 public void draw(
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46 java.awt.Graphics2D g2,
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 XYPlot plot,
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48 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
49 ValueAxis domainAxis,
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50 ValueAxis rangeAxis,
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51 int rendererIndex,
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52 PlotRenderingInfo info
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
53 ) {
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54 // 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
55 PlotOrientation orientation = plot.getOrientation();
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56 RectangleEdge domainEdge = Plot.resolveDomainAxisLocation(
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57 plot.getDomainAxisLocation(), orientation);
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58 RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation(
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
59 plot.getRangeAxisLocation(), orientation);
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61 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
62 this.getX(), dataArea, domainEdge);
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
63 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
64 this.getY(), dataArea, rangeEdge);
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
65
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
66 if (orientation == PlotOrientation.HORIZONTAL) {
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
67 float tempAnchor = anchorX;
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
68 anchorX = anchorY;
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
69 anchorY = tempAnchor;
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70 }
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 g2.setFont(getFont());
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 Shape hotspot = TextUtilities.calculateRotatedStringBounds(
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 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
75 getRotationAngle(), getRotationAnchor());
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77 // Deviation from superclass: prevent collision.
3023
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2318
diff changeset
78 if (JFreeUtil.collides(hotspot, info.getOwner().getEntityCollection(),
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2318
diff changeset
79 XYAnnotationEntity.class)) {
e19ff9086035 Avoid collisions between line labels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2318
diff changeset
80 return;
2157
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81 }
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
82
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
83 if (this.getBackgroundPaint() != null) {
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
84 g2.setPaint(this.getBackgroundPaint());
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
85 g2.fill(hotspot);
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
86 }
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
87 g2.setPaint(getPaint());
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
88 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
89 getTextAnchor(), getRotationAngle(), getRotationAnchor());
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90 if (this.isOutlineVisible()) {
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
91 g2.setStroke(this.getOutlineStroke());
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
92 g2.setPaint(this.getOutlinePaint());
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
93 g2.draw(hotspot);
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
94 }
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
95
2318
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
96 //String toolTip = getToolTipText();
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
97 //String url = getURL();
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
98 String toolTip = "CollisionFreeXYTextAnnotation";
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
99 String url = toolTip;
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
100
2157
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
101 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
102 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
103 }
4048
6ed8ebd48d6e Removed dead code.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3317
diff changeset
104 // XXX: DEAD CODE (as long as a hard value is assigned to toolTip
6ed8ebd48d6e Removed dead code.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3317
diff changeset
105 /*
2157
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
106 else {
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
107 addEntity(info, hotspot, rendererIndex,
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
108 "CollisionFreeXYTextAnnotation",
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
109 "CollisionFreeXYTextAnnotation");
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
110 }
4048
6ed8ebd48d6e Removed dead code.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3317
diff changeset
111 */
2157
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
112 }
2318
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
113
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
114 /**
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
115 * A utility method for adding an {@link CollisionFreeXYAnnotationEntity} to
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
116 * a {@link PlotRenderingInfo} instance.
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
117 *
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
118 * @param info the plot rendering info (<code>null</code> permitted).
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
119 * @param hotspot the hotspot area.
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
120 * @param rendererIndex the renderer index.
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
121 * @param toolTipText the tool tip text.
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
122 * @param urlText the URL text.
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
123 */
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
124 protected void addEntity(PlotRenderingInfo info,
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
125 Shape hotspot, int rendererIndex,
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
126 String toolTipText, String urlText) {
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
127 if (info == null) {
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
128 return;
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
129 }
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
130 EntityCollection entities = info.getOwner().getEntityCollection();
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
131 if (entities == null) {
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
132 return;
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
133 }
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
134 CollisionFreeXYTextAnnotationEntity entity =
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
135 new CollisionFreeXYTextAnnotationEntity(hotspot,
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
136 rendererIndex, toolTipText, urlText);
0b8c04c7f762 Avoid that annotations like the ones used for hyks prevent manual point text annotation rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
137 entities.add(entity);
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3026
diff changeset
138 }
2157
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
139 }
c4ceade9d50e Added new Annotation class that prevents collisions (to replace StickyAxisAnnotation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
140 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org