annotate flys-artifacts/src/main/java/de/intevation/flys/jfree/FLYSAnnotation.java @ 4123:30168be950a6

Improvements on issue934/4 (double annotations/DC).
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 12 Oct 2012 20:21:44 +0200
parents 7eebd9e58641
children 18c66e586e44
rev   line source
1677
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.jfree;
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
4044
7eebd9e58641 Add chart legend entries for interpolated series (#838).
Christian Lins <christian.lins@intevation.de>
parents: 3317
diff changeset
3 import de.intevation.flys.artifacts.model.HYKFactory;
7eebd9e58641 Add chart legend entries for interpolated series (#838).
Christian Lins <christian.lins@intevation.de>
parents: 3317
diff changeset
4
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
5 import java.util.Collections;
1677
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import java.util.List;
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7
4044
7eebd9e58641 Add chart legend entries for interpolated series (#838).
Christian Lins <christian.lins@intevation.de>
parents: 3317
diff changeset
8 import org.jfree.chart.annotations.XYTextAnnotation;
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1677
diff changeset
9 import org.w3c.dom.Document;
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1677
diff changeset
10
1721
eb35570df0e8 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1712
diff changeset
11 /**
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
12 * List of Text- Annotations with name and theme.
1721
eb35570df0e8 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1712
diff changeset
13 */
1677
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 public class FLYSAnnotation {
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15
4044
7eebd9e58641 Add chart legend entries for interpolated series (#838).
Christian Lins <christian.lins@intevation.de>
parents: 3317
diff changeset
16 /** 'Other' Text Annotations. */
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
17 protected List<XYTextAnnotation> textAnnotations;
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
18
2183
a79d5cd26083 Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
19 /** Annotations at axis. */
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
20 protected List<StickyAxisAnnotation> axisTextAnnotations;
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
21
2183
a79d5cd26083 Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
22 /** Areas at axis. */
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
23 protected List<HYKFactory.Zone> boxes;
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1677
diff changeset
24
2183
a79d5cd26083 Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
25 /** Styling information. */
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1677
diff changeset
26 protected Document theme;
1677
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27
2183
a79d5cd26083 Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
28 /** Chart-legend information. */
1677
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 protected String label;
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
32 public FLYSAnnotation(String label, List<StickyAxisAnnotation> annotations) {
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2138
diff changeset
33 this(label, annotations, null, null);
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2138
diff changeset
34 }
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2138
diff changeset
35
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2138
diff changeset
36
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
37 /** Create annotations, parameter might be null. */
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
38 public FLYSAnnotation(String label, List<StickyAxisAnnotation> annotations,
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
39 List<HYKFactory.Zone> bAnnotations
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
40 ) {
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2138
diff changeset
41 this(label, annotations, bAnnotations, null);
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2138
diff changeset
42 }
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2138
diff changeset
43
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2138
diff changeset
44
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2138
diff changeset
45 /** Create annotations, parameter might be null. */
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
46 public FLYSAnnotation(String label, List<StickyAxisAnnotation> annotations,
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2138
diff changeset
47 List<HYKFactory.Zone> bAnnotations, Document theme
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2138
diff changeset
48 ) {
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
49 this.label = label;
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
50 this.axisTextAnnotations = (annotations != null)
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
51 ? annotations
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
52 : Collections.<StickyAxisAnnotation>emptyList();
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
53 this.boxes = (bAnnotations != null)
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
54 ? bAnnotations
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
55 : Collections.<HYKFactory.Zone>emptyList();
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
56 this.textAnnotations = Collections.<XYTextAnnotation>emptyList();
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2138
diff changeset
57 this.setTheme(theme);
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
58 }
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
59
1677
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60
1712
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1679
diff changeset
61 public void setLabel(String label) {
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1679
diff changeset
62 this.label = label;
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1679
diff changeset
63 }
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1679
diff changeset
64
1677
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 public String getLabel() {
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 return label;
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 }
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
69 public List<StickyAxisAnnotation> getAxisTextAnnotations() {
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
70 return axisTextAnnotations;
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
71 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
72
2183
a79d5cd26083 Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
73 public void setTextAnnotations(List<XYTextAnnotation> annotations) {
a79d5cd26083 Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
74 this.textAnnotations = annotations;
a79d5cd26083 Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
75 }
a79d5cd26083 Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
76
a79d5cd26083 Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
77 /** Set the "other" Text Annotations. */
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
78 public List<XYTextAnnotation> getTextAnnotations() {
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
79 return textAnnotations;
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
80 }
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
81
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
82 public List<HYKFactory.Zone> getBoxes() {
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
83 return boxes;
1677
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 }
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1677
diff changeset
85
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1677
diff changeset
86 public void setTheme(Document theme) {
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1677
diff changeset
87 this.theme = theme;
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1677
diff changeset
88 }
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1677
diff changeset
89
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1677
diff changeset
90 public Document getTheme() {
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1677
diff changeset
91 return theme;
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1677
diff changeset
92 }
2768
1ddfb54e5db6 Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
93
1ddfb54e5db6 Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
94 /**
1ddfb54e5db6 Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
95 * Set sticky axis of all axisTextAnnotations
1ddfb54e5db6 Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
96 * to the X axis if it is currently Y, and vice versa.
1ddfb54e5db6 Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
97 * @return this
1ddfb54e5db6 Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
98 */
1ddfb54e5db6 Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
99 public FLYSAnnotation flipStickyAxis() {
1ddfb54e5db6 Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
100 for (StickyAxisAnnotation saa: axisTextAnnotations) {
1ddfb54e5db6 Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
101 saa.flipStickyAxis();
1ddfb54e5db6 Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
102 }
1ddfb54e5db6 Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
103 return this;
1ddfb54e5db6 Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
104 }
1677
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 }
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org