comparison flys-artifacts/src/main/java/de/intevation/flys/exports/HistoricalDischargeCurveGenerator.java @ 2215:ebbb18ed78c4

Added new classes and stubs used to calculate data for historical discharge curve charts. flys-artifacts/trunk@3854 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 01 Feb 2012 11:14:24 +0000
parents
children 958a10e2e246
comparison
equal deleted inserted replaced
2214:4cd0eb2ebb3b 2215:ebbb18ed78c4
1 package de.intevation.flys.exports;
2
3 import java.awt.Font;
4
5 import org.w3c.dom.Document;
6
7 import org.apache.log4j.Logger;
8
9 import org.jfree.chart.JFreeChart;
10 import org.jfree.chart.axis.NumberAxis;
11
12 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
13
14 import de.intevation.flys.artifacts.FLYSArtifact;
15 import de.intevation.flys.artifacts.model.FacetTypes;
16
17
18 /**
19 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
20 */
21 public class HistoricalDischargeCurveGenerator
22 extends XYChartGenerator
23 implements FacetTypes
24 {
25 private static Logger logger =
26 Logger.getLogger(HistoricalDischargeCurveGenerator.class);
27
28
29 public static enum YAXIS {
30 Q(0);
31 protected int idx;
32 private YAXIS(int c) {
33 idx = c;
34 }
35 }
36
37
38 @Override
39 protected YAxisWalker getYAxisWalker() {
40 return new YAxisWalker() {
41 @Override
42 public int length() {
43 return YAXIS.values().length;
44 }
45
46 @Override
47 public String getId(int idx) {
48 YAXIS[] yaxes = YAXIS.values();
49 return yaxes[idx].toString();
50 }
51 };
52 }
53
54
55 @Override
56 protected String getDefaultChartTitle() {
57 return "TODO: CHART TITLE";
58 }
59
60
61 /**
62 * Empty (suppress subtitle).
63 */
64 @Override
65 protected void addSubtitles(JFreeChart chart) {
66 // this chart has no subtitle
67 }
68
69
70 @Override
71 protected String getDefaultXAxisLabel() {
72 return "TODO: DEFAULT X AXIS LABEL";
73 }
74
75 @Override
76 protected String getDefaultYAxisLabel(int pos) {
77 return "TODO: DEFAULT Y AXIS LABEL FOR: " + pos;
78 }
79
80
81 /**
82 * Creates a new Y-Axis.
83 *
84 * @param index the index of the Y axis.
85 *
86 * @return an new NumberAxis with label from <i>getYAxisLabel()</i>.
87 */
88 @Override
89 protected NumberAxis createYAxis(int index) {
90 Font labelFont = new Font("Tahoma", Font.BOLD, 14);
91 String label = "default";
92
93 if (index == YAXIS.Q.idx) {
94 label = getYAxisLabel(0);
95 }
96
97 NumberAxis axis = createNumberAxis(index, label);
98 axis.setLabelFont(labelFont);
99 axis.setAutoRangeIncludesZero(false);
100
101 return axis;
102 }
103
104
105 public void doOut(
106 ArtifactAndFacet artifactFacet,
107 Document theme,
108 boolean visible
109 ) {
110 String name = artifactFacet.getFacetName();
111 logger.debug("HistoricalDischargeCurveGenerator.doOut: " + name);
112
113
114 if (name.equals(HISTORICAL_DISCHARGE_Q)) {
115 doHistoricalDischargeOut(
116 (FLYSArtifact) artifactFacet.getArtifact(),
117 artifactFacet.getData(context),
118 artifactFacet.getFacetDescription(),
119 theme,
120 visible);
121 }
122 else {
123 logger.warn("doOut(): unknown facet name: " + name);
124 return;
125 }
126 }
127
128
129 protected void doHistoricalDischargeOut(
130 FLYSArtifact artifact,
131 Object data,
132 String desc,
133 Document theme,
134 boolean visible)
135 {
136 logger.debug("doHistoricalDischargeOut(): description = " + desc);
137 logger.warn("TODO IMPLEMENT ME");
138 }
139 }
140 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org