comparison artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator.java @ 7081:3c4efd4b2c19 generator-refactoring

Simplyfy / unify "invert axis" logic - DataUtil now can check if two datasets are in the same direction - In the case of WKM data a no means that the Water flows Right to Left - If the water flows from right to left do inversion of diagrams
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 20 Sep 2013 17:36:11 +0200
parents 06a9a241faac
children 41567bf1e131
comparison
equal deleted inserted replaced
7080:02a704a37323 7081:3c4efd4b2c19
425 addAxisSeries(series, YAXIS.D.idx, visible); 425 addAxisSeries(series, YAXIS.D.idx, visible);
426 } 426 }
427 427
428 428
429 /** 429 /**
430 * This method determines - taking JFreeCharts auto x value ordering into
431 * account - if the x axis need to be inverted. Waterlines in these charts
432 * should decrease.
433 *
434 * @param wkms The data object that stores the x and y values used for this
435 * chart.
436 */
437 public boolean needInvertAxis(WKms wkms) {
438 boolean wsUp = wkms.guessWaterIncreasing();
439 boolean kmUp = DataUtil.guessWaterIncreasing(wkms.allKms());
440 boolean inv = (wsUp && kmUp) || (!wsUp && !kmUp);
441
442 int size = wkms.size();
443
444 if (logger.isDebugEnabled()) {
445 logger.debug("(Wkms)Values : " + size);
446 if (size > 0) {
447 logger.debug("Start km: " + wkms.getKm(0));
448 logger.debug("End km: " + wkms.getKm(size-1));
449 }
450 logger.debug("wsUp: " + wsUp);
451 logger.debug("kmUp: " + kmUp);
452 logger.debug("inv: " + inv);
453 }
454
455 return inv;
456 }
457
458
459 /**
460 * Get name of series (displayed in legend). 430 * Get name of series (displayed in legend).
461 * @return name of the series. 431 * @return name of the series.
462 */ 432 */
463 protected String getSeriesName(WQKms wqkms, String mode) { 433 protected String getSeriesName(WQKms wqkms, String mode) {
464 String name = wqkms.getName(); 434 String name = wqkms.getName();

http://dive4elements.wald.intevation.org