Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java @ 2175:3f90f4d37c8d
Render manual points in longitudinal sections.
flys-artifacts/trunk@3770 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 26 Jan 2012 13:12:19 +0000 |
parents | ebfca80dae09 |
children | a79d5cd26083 |
comparison
equal
deleted
inserted
replaced
2174:98f7397d8f02 | 2175:3f90f4d37c8d |
---|---|
27 import de.intevation.flys.jfree.StyledXYSeries; | 27 import de.intevation.flys.jfree.StyledXYSeries; |
28 | 28 |
29 import de.intevation.flys.utils.FLYSUtils; | 29 import de.intevation.flys.utils.FLYSUtils; |
30 import de.intevation.flys.utils.DataUtil; | 30 import de.intevation.flys.utils.DataUtil; |
31 | 31 |
32 import org.json.JSONArray; | |
33 import org.json.JSONException; | |
32 | 34 |
33 /** | 35 /** |
34 * An OutGenerator that generates discharge curves. | 36 * An OutGenerator that generates discharge curves. |
35 * | 37 * |
36 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 38 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
367 artifactAndFacet.getFacetDescription(), | 369 artifactAndFacet.getFacetDescription(), |
368 attr, | 370 attr, |
369 visible); | 371 visible); |
370 | 372 |
371 } | 373 } |
374 else if (FacetTypes.MANUALPOINTS.equals(name)) { | |
375 doPoints(artifactAndFacet.getData(context), | |
376 artifactAndFacet.getFacetDescription(), | |
377 attr, visible); | |
378 } | |
372 else { | 379 else { |
373 logger.warn("Unknown facet name: " + name); | 380 logger.warn("Unknown facet name: " + name); |
374 return; | 381 return; |
375 } | 382 } |
376 } | 383 } |
530 logger.warn("Could not find axis for facet " + facetName); | 537 logger.warn("Could not find axis for facet " + facetName); |
531 return YAXIS.W.idx; | 538 return YAXIS.W.idx; |
532 } | 539 } |
533 } | 540 } |
534 | 541 |
542 | |
535 /** | 543 /** |
536 * Do Area out. | 544 * Do Area out. |
537 */ | 545 */ |
538 protected void doArea( | 546 protected void doArea( |
539 Object o, | 547 Object o, |
609 area.addSeries(down); | 617 area.addSeries(down); |
610 } | 618 } |
611 // Add area to the respective axis. | 619 // Add area to the respective axis. |
612 addAreaSeries(area, axisIdxForFacet(data.getRootFacetName()), visible); | 620 addAreaSeries(area, axisIdxForFacet(data.getRootFacetName()), visible); |
613 } | 621 } |
622 | |
623 | |
624 /** | |
625 * Do Points out. | |
626 */ | |
627 protected void doPoints( | |
628 Object o, | |
629 String seriesName, | |
630 Document theme, | |
631 boolean visible | |
632 ) { | |
633 XYSeries series = new StyledXYSeries(seriesName, theme); | |
634 | |
635 try { | |
636 JSONArray points = new JSONArray((String) o); | |
637 for (int i = 0; i < points.length(); i++) { | |
638 JSONArray array = points.getJSONArray(i); | |
639 double x = array.getDouble(0); | |
640 double y = array.getDouble(1); | |
641 //logger.debug(" x " + x + " y " + y ); | |
642 series.add(x, y, false); | |
643 } | |
644 } | |
645 catch(JSONException e){ | |
646 logger.error("Could not decode json."); | |
647 } | |
648 | |
649 addAxisSeries(series, YAXIS.W.idx, visible); | |
650 } | |
614 } | 651 } |
615 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 652 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |