Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java @ 439:8975de9d7483
Loop through configuration to chart generation.
gnv-artifacts/trunk@487 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 28 Dec 2009 16:24:05 +0000 |
parents | bed9735adf84 |
children | da21c256a0ba |
comparison
equal
deleted
inserted
replaced
438:7399bb8f83ea | 439:8975de9d7483 |
---|---|
264 exportFormat, | 264 exportFormat, |
265 locale, | 265 locale, |
266 chartWidth, | 266 chartWidth, |
267 chartHeight, | 267 chartHeight, |
268 linesVisible, | 268 linesVisible, |
269 shapesVisible | 269 shapesVisible, |
270 callContext | |
270 ); | 271 ); |
271 } | 272 } |
272 else if (outputMode.equalsIgnoreCase("pdf")) { | 273 else if (outputMode.equalsIgnoreCase("pdf")) { |
273 log.debug("Output mode == pdf"); | 274 log.debug("Output mode == pdf"); |
274 | 275 |
352 ); | 353 ); |
353 } | 354 } |
354 else if (outputMode.equalsIgnoreCase("csv")) { | 355 else if (outputMode.equalsIgnoreCase("csv")) { |
355 log.debug("CSV-File will be generated."); | 356 log.debug("CSV-File will be generated."); |
356 Collection<Result> chartResult = | 357 Collection<Result> chartResult = |
357 (Collection<Result>) getChartResult(uuid); | 358 (Collection<Result>) getChartResult(uuid, callContext); |
358 this.createCSV(outputStream, chartResult); | 359 this.createCSV(outputStream, chartResult); |
359 } else if (outputMode.equalsIgnoreCase("statistics")) { | 360 } else if (outputMode.equalsIgnoreCase("statistics")) { |
360 log.debug("Statistics will be generated."); | 361 log.debug("Statistics will be generated."); |
361 Statistics s = getStatisticsGenerator(); | 362 Statistics s = getStatisticsGenerator(); |
362 Collection<Result> chartResult = | 363 Collection<Result> chartResult = |
363 (Collection<Result>) getChartResult(uuid); | 364 (Collection<Result>) getChartResult(uuid, callContext); |
364 Collection<KeyValueDescibeData> parameters = | 365 Collection<KeyValueDescibeData> parameters = |
365 this.getParameters(uuid); | 366 this.getParameters(uuid); |
366 Collection<KeyValueDescibeData> measurements = | 367 Collection<KeyValueDescibeData> measurements = |
367 this.getMeasurements(uuid); | 368 this.getMeasurements(uuid); |
368 Collection<KeyValueDescibeData> dates = | 369 Collection<KeyValueDescibeData> dates = |
571 String exportFormat, | 572 String exportFormat, |
572 Locale locale, | 573 Locale locale, |
573 int width, | 574 int width, |
574 int height, | 575 int height, |
575 boolean linesVisible, | 576 boolean linesVisible, |
576 boolean shapesVisible | 577 boolean shapesVisible, |
578 CallContext callContext | |
577 ) | 579 ) |
578 throws IOException, TechnicalChartException | 580 throws IOException, TechnicalChartException |
579 { | 581 { |
580 log.debug("Create chart."); | 582 log.debug("Create chart."); |
581 Chart chart = getChart( | 583 Chart chart = getChart( |
582 chartLables, | 584 chartLables, |
583 createStyle(context), | 585 createStyle(context), |
584 parameters, | 586 parameters, |
585 measurements, | 587 measurements, |
586 dates, | 588 dates, |
587 getChartResult(uuid), | 589 getChartResult(uuid, callContext), |
588 locale, // Locale | 590 locale, // Locale |
589 uuid, | 591 uuid, |
590 linesVisible, | 592 linesVisible, |
591 shapesVisible | 593 shapesVisible, |
594 callContext | |
592 ); | 595 ); |
593 | 596 |
594 if (chart == null) { | 597 if (chart == null) { |
595 log.error("Could not initialize chart."); | 598 log.error("Could not initialize chart."); |
596 return; | 599 return; |
629 chartLables, | 632 chartLables, |
630 createStyle(context), | 633 createStyle(context), |
631 parameters, | 634 parameters, |
632 measurements, | 635 measurements, |
633 dates, | 636 dates, |
634 (Collection) getChartResult(uuid), | 637 (Collection) getChartResult(uuid, context), |
635 locale, | 638 locale, |
636 uuid, | 639 uuid, |
637 linesVisible, | 640 linesVisible, |
638 shapesVisible | 641 shapesVisible, |
642 context | |
639 ); | 643 ); |
640 | 644 |
641 if (chart == null) { | 645 if (chart == null) { |
642 log.error("Could not initialize chart."); | 646 log.error("Could not initialize chart."); |
643 return; | 647 return; |
649 "A4", | 653 "A4", |
650 PDF_FORMAT_LANDSCAPE, | 654 PDF_FORMAT_LANDSCAPE, |
651 50F, 50F, 50F, 50F | 655 50F, 50F, 50F, 50F |
652 ); | 656 ); |
653 | 657 |
658 /* XXX: @Ingo: What's this? Looks like dev test remains. | |
654 try { | 659 try { |
655 OutputStream toFile = new FileOutputStream("/vol1/home/iweinzierl/tmp/test.svg"); | 660 OutputStream toFile = new FileOutputStream("/vol1/home/iweinzierl/tmp/test.svg"); |
656 ChartExportHelper.exportSVG( | 661 ChartExportHelper.exportSVG( |
657 toFile, | 662 toFile, |
658 chart.generateChart(), | 663 chart.generateChart(), |
661 ); | 666 ); |
662 toFile.flush(); | 667 toFile.flush(); |
663 toFile.close(); | 668 toFile.close(); |
664 } | 669 } |
665 catch(Exception e) { log.debug("ERROR WHLILE TEST."); } | 670 catch(Exception e) { log.debug("ERROR WHLILE TEST."); } |
671 */ | |
666 } | 672 } |
667 | 673 |
668 | 674 |
669 protected void createSVG( | 675 protected void createSVG( |
670 OutputStream outputStream, | 676 OutputStream outputStream, |
684 chartLables, | 690 chartLables, |
685 createStyle(callContext), | 691 createStyle(callContext), |
686 parameters, | 692 parameters, |
687 measurements, | 693 measurements, |
688 dates, | 694 dates, |
689 (Collection) getChartResult(uuid), | 695 (Collection) getChartResult(uuid, callContext), |
690 locale, | 696 locale, |
691 uuid, | 697 uuid, |
692 linesVisible, | 698 linesVisible, |
693 shapesVisible | 699 shapesVisible, |
700 callContext | |
694 ); | 701 ); |
695 | 702 |
696 if (chart == null) { | 703 if (chart == null) { |
697 log.error("Could not initialize chart."); | 704 log.error("Could not initialize chart."); |
698 return; | 705 return; |
717 Collection dates, | 724 Collection dates, |
718 Object result, | 725 Object result, |
719 Locale locale, | 726 Locale locale, |
720 String uuid, | 727 String uuid, |
721 boolean linesVisible, | 728 boolean linesVisible, |
722 boolean shapesVisible | 729 boolean shapesVisible, |
730 CallContext callContext | |
723 ) { | 731 ) { |
724 Chart chart = null; | 732 Chart chart = null; |
725 | 733 |
726 if (CACHE_CHART) { | 734 if (CACHE_CHART) { |
727 log.info("Try to get timeseries chart from cache."); | 735 log.info("Try to get timeseries chart from cache."); |
728 chart = (Chart) getChartFromCache(uuid); | 736 chart = (Chart) getChartFromCache(uuid, callContext); |
729 } | 737 } |
730 | 738 |
731 if (chart != null) | 739 if (chart != null) |
732 return chart; | 740 return chart; |
733 | 741 |