teichmann@5863: /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde teichmann@5863: * Software engineering by Intevation GmbH teichmann@5863: * teichmann@5994: * This file is Free Software under the GNU AGPL (>=v3) teichmann@5863: * and comes with ABSOLUTELY NO WARRANTY! Check out the teichmann@5994: * documentation coming with Dive4Elements River for details. teichmann@5863: */ teichmann@5863: teichmann@5831: package org.dive4elements.river.jfree; ingo@1677: teichmann@5831: import org.dive4elements.river.artifacts.model.HYKFactory; teichmann@6905: import org.dive4elements.river.themes.ThemeDocument; christian@4044: felix@2138: import java.util.Collections; ingo@1677: import java.util.List; ingo@1677: christian@4044: import org.jfree.chart.annotations.XYTextAnnotation; ingo@1679: felix@1721: /** felix@4277: * List of Text- Annotations (Sticky to one axis or in space) felix@4277: * and 'HYK'-Annotations (rectangles/areas) with name and theme. felix@1721: */ teichmann@5864: public class RiverAnnotation { ingo@1677: christian@4044: /** 'Other' Text Annotations. */ felix@2138: protected List textAnnotations; felix@2138: felix@2183: /** Annotations at axis. */ felix@2161: protected List axisTextAnnotations; felix@2161: felix@2183: /** Areas at axis. */ felix@2138: protected List boxes; ingo@1679: felix@2183: /** Styling information. */ teichmann@6905: protected ThemeDocument theme; ingo@1677: felix@2183: /** Chart-legend information. */ ingo@1677: protected String label; ingo@1677: ingo@1677: teichmann@5864: public RiverAnnotation(String label, List annotations) { felix@2152: this(label, annotations, null, null); felix@2152: } felix@2152: felix@2152: felix@2138: /** Create annotations, parameter might be null. */ teichmann@5864: public RiverAnnotation(String label, List annotations, felix@2138: List bAnnotations felix@2138: ) { felix@2152: this(label, annotations, bAnnotations, null); felix@2152: } felix@2152: felix@2152: felix@2152: /** Create annotations, parameter might be null. */ teichmann@5864: public RiverAnnotation(String label, List annotations, teichmann@6905: List bAnnotations, ThemeDocument theme felix@2152: ) { felix@4277: this.label = label; felix@2161: this.axisTextAnnotations = (annotations != null) felix@4277: ? annotations felix@4277: : Collections.emptyList(); felix@4277: this.boxes = (bAnnotations != null) felix@4277: ? bAnnotations felix@4277: : Collections.emptyList(); felix@2161: this.textAnnotations = Collections.emptyList(); felix@2152: this.setTheme(theme); felix@2138: } felix@2138: ingo@1677: ingo@1712: public void setLabel(String label) { ingo@1712: this.label = label; ingo@1712: } ingo@1712: ingo@1677: public String getLabel() { ingo@1677: return label; ingo@1677: } ingo@1677: felix@2161: public List getAxisTextAnnotations() { felix@2161: return axisTextAnnotations; felix@2161: } felix@2161: felix@2183: public void setTextAnnotations(List annotations) { felix@2183: this.textAnnotations = annotations; felix@2183: } felix@2183: felix@2183: /** Set the "other" Text Annotations. */ felix@2138: public List getTextAnnotations() { felix@2138: return textAnnotations; felix@2138: } felix@2138: felix@2138: public List getBoxes() { felix@2138: return boxes; ingo@1677: } ingo@1679: teichmann@6905: public void setTheme(ThemeDocument theme) { ingo@1679: this.theme = theme; ingo@1679: } ingo@1679: teichmann@6905: public ThemeDocument getTheme() { ingo@1679: return theme; ingo@1679: } felix@2768: felix@2768: /** felix@2768: * Set sticky axis of all axisTextAnnotations felix@2768: * to the X axis if it is currently Y, and vice versa. felix@2768: * @return this felix@2768: */ teichmann@5864: public RiverAnnotation flipStickyAxis() { felix@2768: for (StickyAxisAnnotation saa: axisTextAnnotations) { felix@2768: saa.flipStickyAxis(); felix@2768: } felix@2768: return this; felix@2768: } ingo@1677: } ingo@1677: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :