Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/StyledAreaSeriesCollection.java @ 2020:4f7f781e4481
Improved area rendering workflow.
flys-artifacts/trunk@3475 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 20 Dec 2011 06:47:08 +0000 |
parents | |
children | 3c3693e9c538 |
comparison
equal
deleted
inserted
replaced
2019:aa3e7ed1fa46 | 2020:4f7f781e4481 |
---|---|
1 package de.intevation.flys.exports; | |
2 | |
3 import java.awt.BasicStroke; | |
4 import java.awt.Color; | |
5 import java.awt.Paint; | |
6 import java.awt.geom.Ellipse2D; | |
7 | |
8 import org.apache.log4j.Logger; | |
9 | |
10 import org.w3c.dom.Document; | |
11 | |
12 import org.jfree.data.xy.XYSeriesCollection; | |
13 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; | |
14 import org.jfree.data.Range; | |
15 import org.jfree.data.xy.XYSeries; | |
16 | |
17 import de.intevation.flys.utils.ThemeUtil; | |
18 import de.intevation.flys.jfree.StableXYDifferenceRenderer; | |
19 | |
20 | |
21 /** | |
22 * One or more dataseries to draw a polygon (either "open up/downwards", or | |
23 * the area between two curves), a theme-document and further display options. | |
24 * The theme-document will later "style" the graphical representation. | |
25 * The display options can be used to control the z-order and the axis of the | |
26 * dataset. | |
27 */ | |
28 public class StyledAreaSeriesCollection extends XYSeriesCollection { | |
29 /** Mode, how to draw/which areas to fill. */ | |
30 public enum FILL_MODE {UNDER, ABOVE, BETWEEN}; | |
31 | |
32 /** MODE in use. */ | |
33 protected FILL_MODE mode; | |
34 | |
35 /** The theme-document with attributes about actual visual representation. */ | |
36 protected Document theme; | |
37 | |
38 /** Own logger. */ | |
39 private static final Logger logger = | |
40 Logger.getLogger(StyledAreaSeriesCollection.class); | |
41 | |
42 | |
43 /** | |
44 * @param theme the theme-document. | |
45 */ | |
46 public StyledAreaSeriesCollection(Document theme) { | |
47 this.theme = theme; | |
48 this.mode = FILL_MODE.BETWEEN; | |
49 } | |
50 | |
51 | |
52 /** Gets the Fill mode. */ | |
53 public FILL_MODE getMode() { | |
54 return this.mode; | |
55 } | |
56 | |
57 | |
58 /** Sets the Fill mode. */ | |
59 public void setMode(FILL_MODE fMode) { | |
60 this.mode = fMode; | |
61 } | |
62 | |
63 | |
64 /** | |
65 * Applies line color, size and type attributes to renderer, also | |
66 * whether to draw lines and/or points. | |
67 */ | |
68 public StableXYDifferenceRenderer applyTheme( | |
69 StableXYDifferenceRenderer renderer | |
70 ) { | |
71 applyFillColor(renderer); | |
72 applyShowShape(renderer); | |
73 | |
74 return renderer; | |
75 } | |
76 | |
77 | |
78 /** | |
79 * Blindly (for now) apply the postiviepaint of renderer. | |
80 */ | |
81 protected void applyFillColor(StableXYDifferenceRenderer renderer) { | |
82 Paint paint = ThemeUtil.parseFillColorField(theme); | |
83 if (paint != null) | |
84 renderer.setPositivePaint(paint); | |
85 // TODO set negativepaint? Dependend on the over/under/between settings | |
86 } | |
87 | |
88 /** | |
89 * Blindly (for now) apply the postiviepaint of renderer. | |
90 */ | |
91 protected void applyShowShape(StableXYDifferenceRenderer renderer) { | |
92 boolean show = ThemeUtil.parseShowBorder(theme); | |
93 renderer.setShapesVisible(show); | |
94 } | |
95 } | |
96 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |