Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java @ 4448:9425b7c51b73
Use new WOutProcessor for generating charts
Use WOutProcessor in DischargeLongitudinalSectionGenerator and
LongitudinalSectionGenerator.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Wed, 07 Nov 2012 15:56:28 +0100 |
parents | 0eca080fc162 |
children |
comparison
equal
deleted
inserted
replaced
4447:a5993b69439b | 4448:9425b7c51b73 |
---|---|
6 import de.intevation.flys.artifacts.geom.Lines; | 6 import de.intevation.flys.artifacts.geom.Lines; |
7 import de.intevation.flys.artifacts.model.AreaFacet; | 7 import de.intevation.flys.artifacts.model.AreaFacet; |
8 import de.intevation.flys.artifacts.model.FacetTypes; | 8 import de.intevation.flys.artifacts.model.FacetTypes; |
9 import de.intevation.flys.artifacts.model.WKms; | 9 import de.intevation.flys.artifacts.model.WKms; |
10 import de.intevation.flys.artifacts.model.WQKms; | 10 import de.intevation.flys.artifacts.model.WQKms; |
11 import de.intevation.flys.exports.process.WOutProcessor; | |
11 import de.intevation.flys.jfree.FLYSAnnotation; | 12 import de.intevation.flys.jfree.FLYSAnnotation; |
12 import de.intevation.flys.jfree.StyledAreaSeriesCollection; | 13 import de.intevation.flys.jfree.StyledAreaSeriesCollection; |
13 import de.intevation.flys.jfree.StyledXYSeries; | 14 import de.intevation.flys.jfree.StyledXYSeries; |
14 import de.intevation.flys.utils.DataUtil; | 15 import de.intevation.flys.utils.DataUtil; |
15 import de.intevation.flys.utils.FLYSUtils; | 16 import de.intevation.flys.utils.FLYSUtils; |
16 import de.intevation.flys.utils.ThemeUtil; | |
17 | |
18 import org.apache.log4j.Logger; | 17 import org.apache.log4j.Logger; |
19 import org.jfree.chart.axis.NumberAxis; | 18 import org.jfree.chart.axis.NumberAxis; |
20 import org.jfree.chart.axis.ValueAxis; | 19 import org.jfree.chart.axis.ValueAxis; |
21 import org.jfree.chart.plot.XYPlot; | 20 import org.jfree.chart.plot.XYPlot; |
22 import org.jfree.data.xy.XYSeries; | 21 import org.jfree.data.xy.XYSeries; |
324 | 323 |
325 if (facet == null) { | 324 if (facet == null) { |
326 return; | 325 return; |
327 } | 326 } |
328 | 327 |
329 if (name.equals(LONGITUDINAL_W)) { | 328 WOutProcessor processor = new WOutProcessor(); |
330 doWOut( | 329 if (processor.canHandle(name)) { |
331 (WQKms) artifactAndFacet.getData(context), | 330 processor.doOut(this, artifactAndFacet, attr, visible, YAXIS.W.idx); |
332 artifactAndFacet, | |
333 attr, | |
334 visible); | |
335 } | 331 } |
336 else if (name.equals(LONGITUDINAL_Q)) { | 332 else if (name.equals(LONGITUDINAL_Q)) { |
337 doQOut( | 333 doQOut( |
338 (WQKms) artifactAndFacet.getData(context), | 334 (WQKms) artifactAndFacet.getData(context), |
339 artifactAndFacet, | 335 artifactAndFacet, |
344 doAnnotations( | 340 doAnnotations( |
345 (FLYSAnnotation) artifactAndFacet.getData(context), | 341 (FLYSAnnotation) artifactAndFacet.getData(context), |
346 artifactAndFacet, | 342 artifactAndFacet, |
347 attr, | 343 attr, |
348 visible); | 344 visible); |
349 } | |
350 else if (name.equals(STATIC_WKMS) | |
351 || name.equals(HEIGHTMARKS_POINTS) | |
352 || name.equals(STATIC_WQKMS)) { | |
353 doWOut( | |
354 (WKms) artifactAndFacet.getData(context), | |
355 artifactAndFacet, | |
356 attr, | |
357 visible); | |
358 } | |
359 else if (name.equals(STATIC_WQKMS_W)) { | |
360 doWOut( | |
361 (WQKms) artifactAndFacet.getData(context), | |
362 artifactAndFacet, | |
363 attr, | |
364 visible); | |
365 } | 345 } |
366 else if (name.equals(STATIC_WQKMS_Q)) { | 346 else if (name.equals(STATIC_WQKMS_Q)) { |
367 doQOut( | 347 doQOut( |
368 (WQKms) artifactAndFacet.getData(context), | 348 (WQKms) artifactAndFacet.getData(context), |
369 artifactAndFacet, | 349 artifactAndFacet, |
395 else { | 375 else { |
396 logger.warn("Unknown facet name: " + name); | 376 logger.warn("Unknown facet name: " + name); |
397 return; | 377 return; |
398 } | 378 } |
399 } | 379 } |
400 | |
401 | |
402 /** | |
403 * Process the output for W facets in a longitudinal section curve. | |
404 * | |
405 * @param wkms WKms data. | |
406 * @param aandf The artifact and facet. This facet does NOT support any data objects. Use | |
407 * FLYSArtifact.getNativeFacet() instead to retrieve a Facet which supports | |
408 * data. | |
409 * @param theme The theme that contains styling information. | |
410 * @param visible The visibility of the curve. | |
411 */ | |
412 protected void doWOut( | |
413 WKms wkms, | |
414 ArtifactAndFacet aandf, | |
415 Document theme, | |
416 boolean visible | |
417 ) { | |
418 logger.debug("LongitudinalSectionGenerator.doWOut"); | |
419 | |
420 XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); | |
421 | |
422 StyledSeriesBuilder.addPoints(series, wkms); | |
423 addAxisSeries(series, YAXIS.W.idx, visible); | |
424 | |
425 // If a "band around the curve shall be drawn, add according area. | |
426 double bandWidth = ThemeUtil.parseBandWidth(theme); | |
427 if (bandWidth > 0 ) { | |
428 XYSeries seriesDown = new StyledXYSeries( | |
429 "band " + aandf.getFacetDescription(), false, theme); | |
430 XYSeries seriesUp = new StyledXYSeries( | |
431 aandf.getFacetDescription()+"+/-"+bandWidth, false, theme); | |
432 StyledSeriesBuilder.addUpperBand(seriesUp, wkms, bandWidth); | |
433 StyledSeriesBuilder.addLowerBand(seriesDown, wkms, bandWidth); | |
434 | |
435 StyledAreaSeriesCollection area = new StyledAreaSeriesCollection(theme); | |
436 area.addSeries(seriesUp); | |
437 area.addSeries(seriesDown); | |
438 area.setMode(StyledAreaSeriesCollection.FILL_MODE.BETWEEN); | |
439 addAreaSeries(area, YAXIS.W.idx, visible); | |
440 } | |
441 | |
442 if (needInvertAxis(wkms)) { | |
443 setInverted(true); | |
444 } | |
445 } | |
446 | |
447 | 380 |
448 /** | 381 /** |
449 * Add items to dataseries which describes the differences. | 382 * Add items to dataseries which describes the differences. |
450 */ | 383 */ |
451 protected void doWDifferencesOut( | 384 protected void doWDifferencesOut( |