comparison artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator.java @ 6927:0288db5e90d5

issue1455: Extract QOutProcessor, use it in MiddleBedHeightGenerator and LongitudinalSectionGenerator.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 27 Aug 2013 12:46:11 +0200
parents 1b35b2ddfc28
children e0311aa32efb
comparison
equal deleted inserted replaced
6926:bf191baa37e7 6927:0288db5e90d5
19 19
20 import org.dive4elements.river.exports.process.Processor; 20 import org.dive4elements.river.exports.process.Processor;
21 import org.dive4elements.river.exports.process.BedDiffHeightYearProcessor; 21 import org.dive4elements.river.exports.process.BedDiffHeightYearProcessor;
22 import org.dive4elements.river.exports.process.BedDiffYearProcessor; 22 import org.dive4elements.river.exports.process.BedDiffYearProcessor;
23 import org.dive4elements.river.exports.process.BedheightProcessor; 23 import org.dive4elements.river.exports.process.BedheightProcessor;
24 import org.dive4elements.river.exports.process.QOutProcessor;
24 import org.dive4elements.river.exports.process.WOutProcessor; 25 import org.dive4elements.river.exports.process.WOutProcessor;
25 26
26 import org.dive4elements.river.jfree.RiverAnnotation; 27 import org.dive4elements.river.jfree.RiverAnnotation;
27 import org.dive4elements.river.jfree.StyledAreaSeriesCollection; 28 import org.dive4elements.river.jfree.StyledAreaSeriesCollection;
28 import org.dive4elements.river.jfree.StyledXYSeries; 29 import org.dive4elements.river.jfree.StyledXYSeries;
338 if (facet == null) { 339 if (facet == null) {
339 return; 340 return;
340 } 341 }
341 342
342 WOutProcessor wProcessor = new WOutProcessor(); 343 WOutProcessor wProcessor = new WOutProcessor();
344 QOutProcessor qProcessor = new QOutProcessor();
343 Processor bedp = new BedheightProcessor(); 345 Processor bedp = new BedheightProcessor();
344 Processor bdyProcessor = new BedDiffYearProcessor(); 346 Processor bdyProcessor = new BedDiffYearProcessor();
345 Processor bdhyProcessor = new BedDiffHeightYearProcessor(); 347 Processor bdhyProcessor = new BedDiffHeightYearProcessor();
346 348
347 if (wProcessor.canHandle(name)) { 349 if (wProcessor.canHandle(name)) {
348 wProcessor.doOut(this, artifactAndFacet, attr, visible, YAXIS.W.idx); 350 wProcessor.doOut(this, artifactAndFacet, attr, visible, YAXIS.W.idx);
349 } 351 }
352 if (qProcessor.canHandle(name)) {
353 qProcessor.doOut(this, artifactAndFacet, attr, visible, YAXIS.Q.idx);
354 }
350 else if (bedp.canHandle(name)) { 355 else if (bedp.canHandle(name)) {
351 bedp.doOut(this, artifactAndFacet, attr, visible, YAXIS.W.idx); 356 bedp.doOut(this, artifactAndFacet, attr, visible, YAXIS.W.idx);
352 } 357 }
353 else if (bdyProcessor.canHandle(name)) { 358 else if (bdyProcessor.canHandle(name)) {
354 bdyProcessor.doOut(this, artifactAndFacet, attr, visible, YAXIS.W.idx); 359 bdyProcessor.doOut(this, artifactAndFacet, attr, visible, YAXIS.W.idx);
355 } 360 }
356 else if (bdhyProcessor.canHandle(name)) { 361 else if (bdhyProcessor.canHandle(name)) {
357 bdhyProcessor.doOut(this, artifactAndFacet, attr, visible, YAXIS.W.idx); 362 bdhyProcessor.doOut(this, artifactAndFacet, attr, visible, YAXIS.W.idx);
358 }
359 else if (name.equals(LONGITUDINAL_Q)) {
360 doQOut(
361 (WQKms) artifactAndFacet.getData(context),
362 artifactAndFacet,
363 attr,
364 visible);
365 } 363 }
366 else if (name.equals(LONGITUDINAL_ANNOTATION)) { 364 else if (name.equals(LONGITUDINAL_ANNOTATION)) {
367 doAnnotations( 365 doAnnotations(
368 (RiverAnnotation) artifactAndFacet.getData(context), 366 (RiverAnnotation) artifactAndFacet.getData(context),
369 artifactAndFacet, 367 artifactAndFacet,
370 attr, 368 attr,
371 visible); 369 visible);
372 }
373 else if (name.equals(STATIC_WQKMS_Q)) {
374 doQOut(
375 (WQKms) artifactAndFacet.getData(context),
376 artifactAndFacet,
377 attr,
378 visible);
379 } 370 }
380 else if (name.equals(W_DIFFERENCES)) { 371 else if (name.equals(W_DIFFERENCES)) {
381 doWDifferencesOut( 372 doWDifferencesOut(
382 (WKms) artifactAndFacet.getData(context), 373 (WKms) artifactAndFacet.getData(context),
383 artifactAndFacet, 374 artifactAndFacet,
439 } 430 }
440 } 431 }
441 432
442 433
443 /** 434 /**
444 * Process the output for Q facets in a longitudinal section curve.
445 *
446 * @param wqkms An array of WQKms values.
447 * @param aandf The facet and artifact. This facet does NOT support any data objects. Use
448 * D4EArtifact.getNativeFacet() instead to retrieve a Facet which supports
449 * data.
450 * @param theme The theme that contains styling information.
451 * @param visible The visibility of the curve.
452 */
453 protected void doQOut(
454 WQKms wqkms,
455 ArtifactAndFacet aandf,
456 ThemeDocument theme,
457 boolean visible
458 ) {
459 logger.debug("LongitudinalSectionGenerator.doQOut");
460
461 XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
462
463 StyledSeriesBuilder.addStepPointsKmQ(series, wqkms);
464
465 addAxisSeries(series, YAXIS.Q.idx, visible);
466
467 if (needInvertAxis(wqkms)) {
468 setInverted(true);
469 }
470 }
471
472 /**
473 * This method determines - taking JFreeCharts auto x value ordering into 435 * This method determines - taking JFreeCharts auto x value ordering into
474 * account - if the x axis need to be inverted. Waterlines in these charts 436 * account - if the x axis need to be inverted. Waterlines in these charts
475 * should decrease. 437 * should decrease.
476 * 438 *
477 * @param wkms The data object that stores the x and y values used for this 439 * @param wkms The data object that stores the x and y values used for this

http://dive4elements.wald.intevation.org