Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java @ 2138:59bb5c895be3
Improved HYK/Zones- handling.
flys-artifacts/trunk@3716 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 19 Jan 2012 11:00:27 +0000 |
parents | d626ae185305 |
children | c5d24e0587ce |
comparison
equal
deleted
inserted
replaced
2137:04b6b6a4564d | 2138:59bb5c895be3 |
---|---|
6 | 6 |
7 import org.jfree.chart.JFreeChart; | 7 import org.jfree.chart.JFreeChart; |
8 import org.jfree.chart.title.TextTitle; | 8 import org.jfree.chart.title.TextTitle; |
9 import org.jfree.data.xy.XYSeries; | 9 import org.jfree.data.xy.XYSeries; |
10 | 10 |
11 import de.intevation.flys.jfree.FLYSAnnotation; | |
12 | |
11 import org.w3c.dom.Document; | 13 import org.w3c.dom.Document; |
12 | 14 |
13 import de.intevation.artifacts.DataProvider; | 15 import de.intevation.artifacts.DataProvider; |
14 | 16 |
15 import de.intevation.artifactdatabase.state.ArtifactAndFacet; | 17 import de.intevation.artifactdatabase.state.ArtifactAndFacet; |
17 import de.intevation.flys.artifacts.model.FacetTypes; | 19 import de.intevation.flys.artifacts.model.FacetTypes; |
18 import de.intevation.flys.artifacts.model.CrossSectionFacet; | 20 import de.intevation.flys.artifacts.model.CrossSectionFacet; |
19 import de.intevation.flys.jfree.StyledXYSeries; | 21 import de.intevation.flys.jfree.StyledXYSeries; |
20 | 22 |
21 import de.intevation.flys.model.FastCrossSectionLine; | 23 import de.intevation.flys.model.FastCrossSectionLine; |
24 import de.intevation.flys.artifacts.model.HYKFactory; | |
25 | |
22 | 26 |
23 /** | 27 /** |
24 * An OutGenerator that generates cross section graphs. | 28 * An OutGenerator that generates cross section graphs. |
25 */ | 29 */ |
26 public class CrossSectionGenerator | 30 public class CrossSectionGenerator |
27 extends LongitudinalSectionGenerator//XYChartGenerator | 31 extends LongitudinalSectionGenerator |
28 implements FacetTypes | 32 implements FacetTypes |
29 { | 33 { |
30 /** The logger that is used in this generator. */ | 34 /** The logger that is used in this generator. */ |
31 private static Logger logger = | 35 private static Logger logger = |
32 Logger.getLogger(CrossSectionGenerator.class); | 36 Logger.getLogger(CrossSectionGenerator.class); |
81 }; | 85 }; |
82 return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT, i18n_msg_args); | 86 return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT, i18n_msg_args); |
83 } | 87 } |
84 | 88 |
85 | 89 |
90 /** Always return default subtitle. */ | |
86 @Override | 91 @Override |
87 protected String getChartSubtitle() { | 92 protected String getChartSubtitle() { |
88 // XXX NOTE: overriding this method disables ChartSettings subtitle! | 93 // XXX NOTE: overriding this method disables ChartSettings subtitle! |
94 // TODO clarify XXX NOTE | |
89 return getDefaultChartSubtitle(); | 95 return getDefaultChartSubtitle(); |
90 } | 96 } |
91 | 97 |
92 | 98 |
99 /** Get Charts default subtitle. */ | |
93 @Override | 100 @Override |
94 protected String getDefaultChartSubtitle() { | 101 protected String getDefaultChartSubtitle() { |
95 List<DataProvider> providers = | 102 List<DataProvider> providers = |
96 context.getDataProvider(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA); | 103 context.getDataProvider(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA); |
97 double km = 0d; | 104 double km = 0d; |
165 doArea(artifactFacet.getData(context), | 172 doArea(artifactFacet.getData(context), |
166 artifactFacet.getFacetDescription(), | 173 artifactFacet.getFacetDescription(), |
167 attr, | 174 attr, |
168 visible); | 175 visible); |
169 } | 176 } |
177 else if (name.equals(HYK)) { | |
178 doHyk(artifactFacet.getData(context), | |
179 artifactFacet.getFacetDescription(), | |
180 attr, | |
181 visible); | |
182 } | |
170 else { | 183 else { |
171 logger.warn("CrossSection.doOut: Unknown facet name: " + name); | 184 logger.warn("CrossSection.doOut: Unknown facet name: " + name); |
172 return; | 185 return; |
173 } | 186 } |
174 } | 187 } |
202 | 215 |
203 addAxisSeries(series, 0, visible); | 216 addAxisSeries(series, 0, visible); |
204 } | 217 } |
205 | 218 |
206 | 219 |
220 /** Add HYK-Annotations (colorize and label some areas, draw lines. */ | |
221 protected void doHyk( | |
222 Object o, | |
223 String seriesName, | |
224 Document theme, | |
225 boolean visible | |
226 ) { | |
227 logger.debug("CrossSectionGenerator.doHyk"); | |
228 | |
229 // TODO there is some style information for the text at least. | |
230 | |
231 List<HYKFactory.Zone> zones = (List<HYKFactory.Zone>) o; | |
232 | |
233 if (zones.size() == 0) { | |
234 logger.debug("CrossSectionGenerator.doHYK: empty zone list received."); | |
235 } | |
236 | |
237 //TODO handle visible | |
238 | |
239 addAnnotations(new FLYSAnnotation("HYK Zones", null, zones), true); | |
240 } | |
241 | |
242 | |
207 /** | 243 /** |
208 * Do cross sections out. | 244 * Do cross sections out. |
209 * | 245 * |
210 * @param seriesName name of the data (line) to display in legend. | 246 * @param seriesName name of the data (line) to display in legend. |
211 * @param theme Theme for the data series. | 247 * @param theme Theme for the data series. |