comparison flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java @ 2325:1fcaeced48f2

#485 Fixed broken renaming of chart themes. flys-artifacts/trunk@4009 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 09 Feb 2012 15:59:49 +0000
parents 4cd0eb2ebb3b
children 65ff8ff20be4
comparison
equal deleted inserted replaced
2324:867ebe191799 2325:1fcaeced48f2
9 import org.jfree.chart.axis.ValueAxis; 9 import org.jfree.chart.axis.ValueAxis;
10 import org.jfree.chart.plot.XYPlot; 10 import org.jfree.chart.plot.XYPlot;
11 import org.jfree.data.xy.XYSeries; 11 import org.jfree.data.xy.XYSeries;
12 12
13 import org.w3c.dom.Document; 13 import org.w3c.dom.Document;
14
15 14
16 import de.intevation.artifactdatabase.state.ArtifactAndFacet; 15 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
17 import de.intevation.artifactdatabase.state.Facet; 16 import de.intevation.artifactdatabase.state.Facet;
18 17
19 import de.intevation.flys.artifacts.FLYSArtifact; 18 import de.intevation.flys.artifacts.FLYSArtifact;
334 if (facet == null) { 333 if (facet == null) {
335 return; 334 return;
336 } 335 }
337 336
338 if (name.equals(LONGITUDINAL_W)) { 337 if (name.equals(LONGITUDINAL_W)) {
339 doWOut((WQKms) artifactAndFacet.getData(context), facet, attr, visible); 338 doWOut(
339 (WQKms) artifactAndFacet.getData(context),
340 artifactAndFacet,
341 attr,
342 visible);
340 } 343 }
341 else if (name.equals(LONGITUDINAL_Q)) { 344 else if (name.equals(LONGITUDINAL_Q)) {
342 doQOut((WQKms) artifactAndFacet.getData(context), facet, attr, visible); 345 doQOut(
346 (WQKms) artifactAndFacet.getData(context),
347 artifactAndFacet,
348 attr,
349 visible);
343 } 350 }
344 else if (name.equals(LONGITUDINAL_ANNOTATION)) { 351 else if (name.equals(LONGITUDINAL_ANNOTATION)) {
345 doAnnotations((FLYSAnnotation) artifactAndFacet.getData(context), 352 doAnnotations(
346 facet, attr, visible); 353 (FLYSAnnotation) artifactAndFacet.getData(context),
354 artifactAndFacet,
355 attr,
356 visible);
347 } 357 }
348 else if (name.equals(STATIC_WKMS) 358 else if (name.equals(STATIC_WKMS)
349 || name.equals(HEIGHTMARKS_POINTS) 359 || name.equals(HEIGHTMARKS_POINTS)
350 || name.equals(STATIC_WQKMS)) { 360 || name.equals(STATIC_WQKMS)) {
351 doWOut((WKms) artifactAndFacet.getData(context), facet, attr, visible); 361 doWOut(
362 (WKms) artifactAndFacet.getData(context),
363 artifactAndFacet,
364 attr,
365 visible);
352 } 366 }
353 else if (name.equals(STATIC_WQKMS_W)) { 367 else if (name.equals(STATIC_WQKMS_W)) {
354 doWOut((WQKms) artifactAndFacet.getData(context), facet, attr, visible); 368 doWOut(
369 (WQKms) artifactAndFacet.getData(context),
370 artifactAndFacet,
371 attr,
372 visible);
355 } 373 }
356 else if (name.equals(STATIC_WQKMS_Q)) { 374 else if (name.equals(STATIC_WQKMS_Q)) {
357 doQOut((WQKms) artifactAndFacet.getData(context), facet, attr, visible); 375 doQOut(
376 (WQKms) artifactAndFacet.getData(context),
377 artifactAndFacet,
378 attr,
379 visible);
358 } 380 }
359 else if (name.equals(W_DIFFERENCES)) { 381 else if (name.equals(W_DIFFERENCES)) {
360 doWDifferencesOut( 382 doWDifferencesOut(
361 (WKms) artifactAndFacet.getData(context), 383 (WKms) artifactAndFacet.getData(context),
362 facet, 384 artifactAndFacet,
363 attr, 385 attr,
364 visible); 386 visible);
365 } 387 }
366 else if (FacetTypes.IS.AREA(name)) { 388 else if (FacetTypes.IS.AREA(name)) {
367 doArea(artifactAndFacet.getData(context), 389 doArea(
368 artifactAndFacet.getFacetDescription(), 390 artifactAndFacet.getData(context),
391 artifactAndFacet,
369 attr, 392 attr,
370 visible); 393 visible);
371
372 } 394 }
373 else if (FacetTypes.IS.MANUALPOINTS(name)) { 395 else if (FacetTypes.IS.MANUALPOINTS(name)) {
374 doPoints(artifactAndFacet.getData(context), 396 doPoints(
375 artifactAndFacet.getFacetDescription(), 397 artifactAndFacet.getData(context),
376 attr, visible, YAXIS.W.idx); 398 artifactAndFacet,
399 attr,
400 visible,
401 YAXIS.W.idx);
377 } 402 }
378 else { 403 else {
379 logger.warn("Unknown facet name: " + name); 404 logger.warn("Unknown facet name: " + name);
380 return; 405 return;
381 } 406 }
391 * data. 416 * data.
392 * @param theme The theme that contains styling information. 417 * @param theme The theme that contains styling information.
393 * @param visible The visibility of the curve. 418 * @param visible The visibility of the curve.
394 */ 419 */
395 protected void doWOut( 420 protected void doWOut(
396 WKms wkms, 421 WKms wkms,
397 Facet facet, 422 ArtifactAndFacet aandf,
398 Document theme, 423 Document theme,
399 boolean visible 424 boolean visible
400 ) { 425 ) {
401 logger.debug("LongitudinalSectionGenerator.doWOut"); 426 logger.debug("LongitudinalSectionGenerator.doWOut");
402 427
403 XYSeries series = new StyledXYSeries(facet.getDescription(), theme); 428 XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
404 429
405 StyledSeriesBuilder.addPoints(series, wkms); 430 StyledSeriesBuilder.addPoints(series, wkms);
406 431
407 addAxisSeries(series, YAXIS.W.idx, visible); 432 addAxisSeries(series, YAXIS.W.idx, visible);
408 433
417 /** 442 /**
418 * Add items to dataseries which describes the differences. 443 * Add items to dataseries which describes the differences.
419 */ 444 */
420 protected void doWDifferencesOut( 445 protected void doWDifferencesOut(
421 WKms wkms, 446 WKms wkms,
422 Facet facet, 447 ArtifactAndFacet aandf,
423 Document theme, 448 Document theme,
424 boolean visible 449 boolean visible
425 ) { 450 ) {
426 logger.debug("WDifferencesCurveGenerator.doWDifferencesOut"); 451 logger.debug("WDifferencesCurveGenerator.doWDifferencesOut");
427 if (wkms == null) { 452 if (wkms == null) {
428 logger.warn("No data to add to WDifferencesChart."); 453 logger.warn("No data to add to WDifferencesChart.");
429 return; 454 return;
430 } 455 }
431 456
432 XYSeries series = new StyledXYSeries(facet.getDescription(), theme); 457 XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
433 458
434 if (logger.isDebugEnabled()) { 459 if (logger.isDebugEnabled()) {
435 if (wkms.size() > 0) { 460 if (wkms.size() > 0) {
436 logger.debug("Generate series: " + series.getKey()); 461 logger.debug("Generate series: " + series.getKey());
437 logger.debug("Start km: " + wkms.getKm(0)); 462 logger.debug("Start km: " + wkms.getKm(0));
460 * @param theme The theme that contains styling information. 485 * @param theme The theme that contains styling information.
461 * @param visible The visibility of the curve. 486 * @param visible The visibility of the curve.
462 */ 487 */
463 protected void doQOut( 488 protected void doQOut(
464 WQKms wqkms, 489 WQKms wqkms,
465 Facet facet, 490 ArtifactAndFacet aandf,
466 Document theme, 491 Document theme,
467 boolean visible 492 boolean visible
468 ) { 493 ) {
469 logger.debug("LongitudinalSectionGenerator.doQOut"); 494 logger.debug("LongitudinalSectionGenerator.doQOut");
470 495
471 XYSeries series = new StyledXYSeries(facet.getDescription(), theme); 496 XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
472 497
473 StyledSeriesBuilder.addPointsKmQ(series, wqkms); 498 StyledSeriesBuilder.addPointsKmQ(series, wqkms);
474 499
475 addAxisSeries(series, YAXIS.Q.idx, visible); 500 addAxisSeries(series, YAXIS.Q.idx, visible);
476 501
542 /** 567 /**
543 * Do Area out. 568 * Do Area out.
544 */ 569 */
545 protected void doArea( 570 protected void doArea(
546 Object o, 571 Object o,
547 String seriesName, 572 ArtifactAndFacet aandf,
548 Document theme, 573 Document theme,
549 boolean visible 574 boolean visible
550 ) { 575 ) {
551 logger.debug("LongitudinalSectionGenerator.doArea"); 576 logger.debug("LongitudinalSectionGenerator.doArea");
552 StyledAreaSeriesCollection area = new StyledAreaSeriesCollection(theme); 577 StyledAreaSeriesCollection area = new StyledAreaSeriesCollection(theme);
578
579 String seriesName = aandf.getFacetDescription();
553 580
554 AreaFacet.Data data = (AreaFacet.Data) o; 581 AreaFacet.Data data = (AreaFacet.Data) o;
555 582
556 XYSeries up = null; 583 XYSeries up = null;
557 XYSeries down = null; 584 XYSeries down = null;

http://dive4elements.wald.intevation.org