annotate flys-artifacts/src/main/java/de/intevation/flys/jfree/FLYSAnnotation.java @ 5523:35dba807966a

Applied contrib/inline-dc-attribute.xsl und fix idention. Need testing
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 29 Mar 2013 14:25:36 +0100
parents 18c66e586e44
children
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 /**
4277
18c66e586e44 Doc and whitespace cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4044
diff changeset
12 * List of Text- Annotations (Sticky to one axis or in space)
18c66e586e44 Doc and whitespace cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4044
diff changeset
13 * and 'HYK'-Annotations (rectangles/areas) with name and theme.
1721
eb35570df0e8 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1712
diff changeset
14 */
1677
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 public class FLYSAnnotation {
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16
4044
7eebd9e58641 Add chart legend entries for interpolated series (#838).
Christian Lins <christian.lins@intevation.de>
parents: 3317
diff changeset
17 /** 'Other' Text Annotations. */
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
18 protected List<XYTextAnnotation> textAnnotations;
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
19
2183
a79d5cd26083 Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
20 /** 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
21 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
22
2183
a79d5cd26083 Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
23 /** Areas at axis. */
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
24 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
25
2183
a79d5cd26083 Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
26 /** Styling information. */
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1677
diff changeset
27 protected Document theme;
1677
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28
2183
a79d5cd26083 Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
29 /** Chart-legend information. */
1677
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 protected String label;
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@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: 2152
diff changeset
33 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
34 this(label, annotations, null, null);
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
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2138
diff changeset
37
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
38 /** 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
39 public FLYSAnnotation(String label, List<StickyAxisAnnotation> annotations,
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
40 List<HYKFactory.Zone> bAnnotations
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
41 ) {
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2138
diff changeset
42 this(label, annotations, bAnnotations, null);
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
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2138
diff changeset
46 /** 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
47 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
48 List<HYKFactory.Zone> bAnnotations, Document theme
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2138
diff changeset
49 ) {
4277
18c66e586e44 Doc and whitespace cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4044
diff changeset
50 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
51 this.axisTextAnnotations = (annotations != null)
4277
18c66e586e44 Doc and whitespace cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4044
diff changeset
52 ? annotations
18c66e586e44 Doc and whitespace cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4044
diff changeset
53 : Collections.<StickyAxisAnnotation>emptyList();
18c66e586e44 Doc and whitespace cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4044
diff changeset
54 this.boxes = (bAnnotations != null)
18c66e586e44 Doc and whitespace cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4044
diff changeset
55 ? bAnnotations
18c66e586e44 Doc and whitespace cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4044
diff changeset
56 : 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
57 this.textAnnotations = Collections.<XYTextAnnotation>emptyList();
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2138
diff changeset
58 this.setTheme(theme);
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
59 }
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
60
1677
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61
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
62 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
63 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
64 }
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
65
1677
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 public String getLabel() {
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 return label;
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 }
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
70 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
71 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
72 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
73
2183
a79d5cd26083 Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
74 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
75 this.textAnnotations = annotations;
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
a79d5cd26083 Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
78 /** Set the "other" Text Annotations. */
2138
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
79 public List<XYTextAnnotation> getTextAnnotations() {
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
80 return textAnnotations;
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
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
83 public List<HYKFactory.Zone> getBoxes() {
59bb5c895be3 Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1721
diff changeset
84 return boxes;
1677
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 }
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1677
diff changeset
86
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1677
diff changeset
87 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
88 this.theme = theme;
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
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1677
diff changeset
91 public Document getTheme() {
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1677
diff changeset
92 return theme;
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1677
diff changeset
93 }
2768
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 /**
1ddfb54e5db6 Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
96 * Set sticky axis of all axisTextAnnotations
1ddfb54e5db6 Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
97 * 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
98 * @return this
1ddfb54e5db6 Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
99 */
1ddfb54e5db6 Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
100 public FLYSAnnotation flipStickyAxis() {
1ddfb54e5db6 Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
101 for (StickyAxisAnnotation saa: axisTextAnnotations) {
1ddfb54e5db6 Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
102 saa.flipStickyAxis();
1ddfb54e5db6 Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
103 }
1ddfb54e5db6 Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
104 return this;
1ddfb54e5db6 Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2183
diff changeset
105 }
1677
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 }
dd9dfe1e48fa Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org