Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/jfree/RiverAnnotation.java @ 9802:a9641367812c 3.2.x tip
Improve locale support in artifacts container
Makes it easier to run scripts e.g. for importing data.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 29 May 2024 10:51:00 +0200 |
parents | 5e38e2924c07 |
children |
rev | line source |
---|---|
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5864
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5864
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4277
diff
changeset
|
9 package org.dive4elements.river.jfree; |
1677
dd9dfe1e48fa
Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4277
diff
changeset
|
11 import org.dive4elements.river.artifacts.model.HYKFactory; |
6905
1b35b2ddfc28
Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
12 import org.dive4elements.river.themes.ThemeDocument; |
4044
7eebd9e58641
Add chart legend entries for interpolated series (#838).
Christian Lins <christian.lins@intevation.de>
parents:
3317
diff
changeset
|
13 |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1721
diff
changeset
|
14 import java.util.Collections; |
1677
dd9dfe1e48fa
Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import java.util.List; |
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 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
|
18 |
1721
eb35570df0e8
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1712
diff
changeset
|
19 /** |
4277
18c66e586e44
Doc and whitespace cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4044
diff
changeset
|
20 * 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
|
21 * and 'HYK'-Annotations (rectangles/areas) with name and theme. |
1721
eb35570df0e8
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1712
diff
changeset
|
22 */ |
5864
f2e46a668fe6
River artifacts: Renamed FLYSAnnotation to RiverAnnotation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
23 public class RiverAnnotation { |
1677
dd9dfe1e48fa
Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 |
4044
7eebd9e58641
Add chart legend entries for interpolated series (#838).
Christian Lins <christian.lins@intevation.de>
parents:
3317
diff
changeset
|
25 /** 'Other' Text Annotations. */ |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1721
diff
changeset
|
26 protected List<XYTextAnnotation> textAnnotations; |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1721
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 /** 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
|
29 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
|
30 |
2183
a79d5cd26083
Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
31 /** Areas at axis. */ |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1721
diff
changeset
|
32 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
|
33 |
2183
a79d5cd26083
Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
34 /** Styling information. */ |
6905
1b35b2ddfc28
Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
35 protected ThemeDocument theme; |
1677
dd9dfe1e48fa
Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 |
2183
a79d5cd26083
Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
37 /** Chart-legend information. */ |
1677
dd9dfe1e48fa
Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 protected String label; |
dd9dfe1e48fa
Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 |
dd9dfe1e48fa
Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 |
8856 | 41 public RiverAnnotation( |
42 String label, | |
43 List<StickyAxisAnnotation> annotations | |
44 ) { | |
2152
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2138
diff
changeset
|
45 this(label, annotations, null, null); |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2138
diff
changeset
|
46 } |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2138
diff
changeset
|
47 |
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 /** Create annotations, parameter might be null. */ |
8856 | 50 public RiverAnnotation( |
51 String label, | |
52 List<StickyAxisAnnotation> annotations, | |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1721
diff
changeset
|
53 List<HYKFactory.Zone> bAnnotations |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1721
diff
changeset
|
54 ) { |
2152
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2138
diff
changeset
|
55 this(label, annotations, bAnnotations, null); |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2138
diff
changeset
|
56 } |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2138
diff
changeset
|
57 |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2138
diff
changeset
|
58 |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2138
diff
changeset
|
59 /** Create annotations, parameter might be null. */ |
8856 | 60 public RiverAnnotation( |
61 String label, | |
62 List<StickyAxisAnnotation> annotations, | |
63 List<HYKFactory.Zone> bAnnotations, | |
64 ThemeDocument theme | |
2152
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2138
diff
changeset
|
65 ) { |
4277
18c66e586e44
Doc and whitespace cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4044
diff
changeset
|
66 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
|
67 this.axisTextAnnotations = (annotations != null) |
8856 | 68 ? annotations |
69 : Collections.<StickyAxisAnnotation>emptyList(); | |
4277
18c66e586e44
Doc and whitespace cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4044
diff
changeset
|
70 this.boxes = (bAnnotations != null) |
8856 | 71 ? bAnnotations |
72 : 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
|
73 this.textAnnotations = Collections.<XYTextAnnotation>emptyList(); |
2152
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2138
diff
changeset
|
74 this.setTheme(theme); |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1721
diff
changeset
|
75 } |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1721
diff
changeset
|
76 |
1677
dd9dfe1e48fa
Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 |
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
|
78 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
|
79 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
|
80 } |
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
|
81 |
1677
dd9dfe1e48fa
Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 public String getLabel() { |
dd9dfe1e48fa
Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 return label; |
dd9dfe1e48fa
Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 } |
dd9dfe1e48fa
Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
86 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
|
87 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
|
88 } |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
89 |
2183
a79d5cd26083
Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
90 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
|
91 this.textAnnotations = annotations; |
a79d5cd26083
Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
92 } |
a79d5cd26083
Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
93 |
a79d5cd26083
Render labels of manual points in a very primitive manner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
94 /** Set the "other" Text Annotations. */ |
2138
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1721
diff
changeset
|
95 public List<XYTextAnnotation> getTextAnnotations() { |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1721
diff
changeset
|
96 return textAnnotations; |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1721
diff
changeset
|
97 } |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1721
diff
changeset
|
98 |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1721
diff
changeset
|
99 public List<HYKFactory.Zone> getBoxes() { |
59bb5c895be3
Improved HYK/Zones- handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1721
diff
changeset
|
100 return boxes; |
1677
dd9dfe1e48fa
Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 } |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1677
diff
changeset
|
102 |
6905
1b35b2ddfc28
Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
103 public void setTheme(ThemeDocument theme) { |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1677
diff
changeset
|
104 this.theme = theme; |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1677
diff
changeset
|
105 } |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1677
diff
changeset
|
106 |
6905
1b35b2ddfc28
Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
107 public ThemeDocument getTheme() { |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1677
diff
changeset
|
108 return theme; |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1677
diff
changeset
|
109 } |
2768
1ddfb54e5db6
Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2183
diff
changeset
|
110 |
1ddfb54e5db6
Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2183
diff
changeset
|
111 /** |
1ddfb54e5db6
Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2183
diff
changeset
|
112 * Set sticky axis of all axisTextAnnotations |
1ddfb54e5db6
Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2183
diff
changeset
|
113 * 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
|
114 * @return this |
1ddfb54e5db6
Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2183
diff
changeset
|
115 */ |
5864
f2e46a668fe6
River artifacts: Renamed FLYSAnnotation to RiverAnnotation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
116 public RiverAnnotation flipStickyAxis() { |
2768
1ddfb54e5db6
Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2183
diff
changeset
|
117 for (StickyAxisAnnotation saa: axisTextAnnotations) { |
1ddfb54e5db6
Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2183
diff
changeset
|
118 saa.flipStickyAxis(); |
1ddfb54e5db6
Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2183
diff
changeset
|
119 } |
1ddfb54e5db6
Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2183
diff
changeset
|
120 return this; |
1ddfb54e5db6
Added accidentally omitted file.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2183
diff
changeset
|
121 } |
1677
dd9dfe1e48fa
Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 } |
dd9dfe1e48fa
Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |