comparison artifacts/src/main/java/org/dive4elements/river/jfree/RiverAnnotation.java @ 5864:f2e46a668fe6

River artifacts: Renamed FLYSAnnotation to RiverAnnotation.
author Sascha L. Teichmann <teichmann@intevation.de>
date Sun, 28 Apr 2013 15:04:44 +0200
parents artifacts/src/main/java/org/dive4elements/river/jfree/FLYSAnnotation.java@4897a58c8746
children af13ceeba52a
comparison
equal deleted inserted replaced
5863:4897a58c8746 5864:f2e46a668fe6
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
2 * Software engineering by Intevation GmbH
3 *
4 * This file is Free Software under the GNU AGPL (>=v3)
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
6 * documentation coming with Dive4Elements River for details.
7 */
8
9 package org.dive4elements.river.jfree;
10
11 import org.dive4elements.river.artifacts.model.HYKFactory;
12
13 import java.util.Collections;
14 import java.util.List;
15
16 import org.jfree.chart.annotations.XYTextAnnotation;
17 import org.w3c.dom.Document;
18
19 /**
20 * List of Text- Annotations (Sticky to one axis or in space)
21 * and 'HYK'-Annotations (rectangles/areas) with name and theme.
22 */
23 public class RiverAnnotation {
24
25 /** 'Other' Text Annotations. */
26 protected List<XYTextAnnotation> textAnnotations;
27
28 /** Annotations at axis. */
29 protected List<StickyAxisAnnotation> axisTextAnnotations;
30
31 /** Areas at axis. */
32 protected List<HYKFactory.Zone> boxes;
33
34 /** Styling information. */
35 protected Document theme;
36
37 /** Chart-legend information. */
38 protected String label;
39
40
41 public RiverAnnotation(String label, List<StickyAxisAnnotation> annotations) {
42 this(label, annotations, null, null);
43 }
44
45
46 /** Create annotations, parameter might be null. */
47 public RiverAnnotation(String label, List<StickyAxisAnnotation> annotations,
48 List<HYKFactory.Zone> bAnnotations
49 ) {
50 this(label, annotations, bAnnotations, null);
51 }
52
53
54 /** Create annotations, parameter might be null. */
55 public RiverAnnotation(String label, List<StickyAxisAnnotation> annotations,
56 List<HYKFactory.Zone> bAnnotations, Document theme
57 ) {
58 this.label = label;
59 this.axisTextAnnotations = (annotations != null)
60 ? annotations
61 : Collections.<StickyAxisAnnotation>emptyList();
62 this.boxes = (bAnnotations != null)
63 ? bAnnotations
64 : Collections.<HYKFactory.Zone>emptyList();
65 this.textAnnotations = Collections.<XYTextAnnotation>emptyList();
66 this.setTheme(theme);
67 }
68
69
70 public void setLabel(String label) {
71 this.label = label;
72 }
73
74 public String getLabel() {
75 return label;
76 }
77
78 public List<StickyAxisAnnotation> getAxisTextAnnotations() {
79 return axisTextAnnotations;
80 }
81
82 public void setTextAnnotations(List<XYTextAnnotation> annotations) {
83 this.textAnnotations = annotations;
84 }
85
86 /** Set the "other" Text Annotations. */
87 public List<XYTextAnnotation> getTextAnnotations() {
88 return textAnnotations;
89 }
90
91 public List<HYKFactory.Zone> getBoxes() {
92 return boxes;
93 }
94
95 public void setTheme(Document theme) {
96 this.theme = theme;
97 }
98
99 public Document getTheme() {
100 return theme;
101 }
102
103 /**
104 * Set sticky axis of all axisTextAnnotations
105 * to the X axis if it is currently Y, and vice versa.
106 * @return this
107 */
108 public RiverAnnotation flipStickyAxis() {
109 for (StickyAxisAnnotation saa: axisTextAnnotations) {
110 saa.flipStickyAxis();
111 }
112 return this;
113 }
114 }
115 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org