Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java @ 6905:1b35b2ddfc28
Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 22 Aug 2013 23:31:38 +0200 |
parents | d710bd3df387 |
children | 765cf5fe26c3 |
comparison
equal
deleted
inserted
replaced
6904:d710bd3df387 | 6905:1b35b2ddfc28 |
---|---|
21 import org.dive4elements.river.jfree.RiverAnnotation; | 21 import org.dive4elements.river.jfree.RiverAnnotation; |
22 import org.dive4elements.river.jfree.StickyAxisAnnotation; | 22 import org.dive4elements.river.jfree.StickyAxisAnnotation; |
23 import org.dive4elements.river.jfree.StyledXYSeries; | 23 import org.dive4elements.river.jfree.StyledXYSeries; |
24 import org.dive4elements.river.model.Gauge; | 24 import org.dive4elements.river.model.Gauge; |
25 import org.dive4elements.river.model.River; | 25 import org.dive4elements.river.model.River; |
26 import org.dive4elements.river.themes.ThemeDocument; | |
26 import org.dive4elements.river.utils.RiverUtils; | 27 import org.dive4elements.river.utils.RiverUtils; |
27 import org.dive4elements.river.utils.ThemeUtil; | |
28 | 28 |
29 import org.apache.log4j.Logger; | 29 import org.apache.log4j.Logger; |
30 import org.jfree.chart.annotations.XYTextAnnotation; | 30 import org.jfree.chart.annotations.XYTextAnnotation; |
31 import org.jfree.chart.axis.ValueAxis; | 31 import org.jfree.chart.axis.ValueAxis; |
32 import org.jfree.chart.plot.XYPlot; | 32 import org.jfree.chart.plot.XYPlot; |
33 import org.jfree.data.Range; | 33 import org.jfree.data.Range; |
34 import org.jfree.data.xy.XYSeries; | 34 import org.jfree.data.xy.XYSeries; |
35 import org.w3c.dom.Document; | |
36 | 35 |
37 | 36 |
38 /** | 37 /** |
39 * An OutGenerator that generates discharge curves. | 38 * An OutGenerator that generates discharge curves. |
40 * | 39 * |
184 | 183 |
185 | 184 |
186 @Override | 185 @Override |
187 public void doOut( | 186 public void doOut( |
188 ArtifactAndFacet artifactFacet, | 187 ArtifactAndFacet artifactFacet, |
189 Document theme, | 188 ThemeDocument theme, |
190 boolean visible | 189 boolean visible |
191 ) { | 190 ) { |
192 String name = artifactFacet.getFacetName(); | 191 String name = artifactFacet.getFacetName(); |
193 logger.debug("DischargeCurveGenerator.doOut: " + name); | 192 logger.debug("DischargeCurveGenerator.doOut: " + name); |
194 | 193 |
229 */ | 228 */ |
230 protected void doDischargeOut( | 229 protected void doDischargeOut( |
231 D4EArtifact artifact, | 230 D4EArtifact artifact, |
232 Object o, | 231 Object o, |
233 String description, | 232 String description, |
234 Document theme, | 233 ThemeDocument theme, |
235 boolean visible) | 234 boolean visible) |
236 { | 235 { |
237 logger.debug("DischargeCurveGenerator.doDischargeOut"); | 236 logger.debug("DischargeCurveGenerator.doDischargeOut"); |
238 WQKms wqkms = (WQKms) o; | 237 WQKms wqkms = (WQKms) o; |
239 | 238 |
266 * @param theme theme to use. | 265 * @param theme theme to use. |
267 */ | 266 */ |
268 protected void doQOut( | 267 protected void doQOut( |
269 Object wqkms, | 268 Object wqkms, |
270 ArtifactAndFacet aaf, | 269 ArtifactAndFacet aaf, |
271 Document theme, | 270 ThemeDocument theme, |
272 boolean visible | 271 boolean visible |
273 ) { | 272 ) { |
274 logger.debug("DischargeCurveGenerator: doQOut (add W/Q data)."); | 273 logger.debug("DischargeCurveGenerator: doQOut (add W/Q data)."); |
275 XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme); | 274 XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme); |
276 | 275 |
283 /** Add a point annotation at given x and y coordinates. */ | 282 /** Add a point annotation at given x and y coordinates. */ |
284 protected void addPointTextAnnotation( | 283 protected void addPointTextAnnotation( |
285 String title, | 284 String title, |
286 double x, | 285 double x, |
287 double y, | 286 double y, |
288 Document theme | 287 ThemeDocument theme |
289 ) { | 288 ) { |
290 List<XYTextAnnotation> textAnnos = | 289 List<XYTextAnnotation> textAnnos = |
291 new ArrayList<XYTextAnnotation>(); | 290 new ArrayList<XYTextAnnotation>(); |
292 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( | 291 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( |
293 title, | 292 title, |
328 * @param wq data as double[][] | 327 * @param wq data as double[][] |
329 */ | 328 */ |
330 protected void doWQOut( | 329 protected void doWQOut( |
331 Object wq, | 330 Object wq, |
332 ArtifactAndFacet aaf, | 331 ArtifactAndFacet aaf, |
333 Document theme, | 332 ThemeDocument theme, |
334 boolean visible | 333 boolean visible |
335 ) { | 334 ) { |
336 logger.debug("DischargeCurveGenerator: doWQOut"); | 335 logger.debug("DischargeCurveGenerator: doWQOut"); |
337 double [][] data = (double [][]) wq; | 336 double [][] data = (double [][]) wq; |
338 String title = aaf.getFacetDescription(); | 337 String title = aaf.getFacetDescription(); |
370 else { | 369 else { |
371 StyledSeriesBuilder.addPoints(series, data, true); | 370 StyledSeriesBuilder.addPoints(series, data, true); |
372 addAxisSeries(series, YAXIS.W.idx, visible); | 371 addAxisSeries(series, YAXIS.W.idx, visible); |
373 } | 372 } |
374 | 373 |
375 if (visible && ThemeUtil.parseShowPointLabel(theme) | 374 if (visible && theme.parseShowPointLabel() |
376 && data != null && data.length != 0) { | 375 && data != null && data.length != 0) { |
377 | 376 |
378 double[] xs = data[0]; | 377 double[] xs = data[0]; |
379 double[] ys = data[1]; | 378 double[] ys = data[1]; |
380 for (int i = 0; i < xs.length; i++) { | 379 for (int i = 0; i < xs.length; i++) { |