Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceYearGenerator.java @ 6551:8c226c5089e0
BedDiff*Generator: Refactored to avoid code dupes. The problematic setting
will not crash anymore, but diagram will be empty.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 10 Jul 2013 10:05:52 +0200 |
parents | 7cf3b3bcd439 |
children | ae00ab7025ec |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceYearGenerator.java Wed Jul 10 09:31:43 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceYearGenerator.java Wed Jul 10 10:05:52 2013 +0200 @@ -34,7 +34,7 @@ public class BedDifferenceYearGenerator -extends FixChartGenerator +extends BedDiffBaseGenerator implements FacetTypes { public enum YAXIS { @@ -86,36 +86,6 @@ }; } - public void setContextBounds(ArtifactAndFacet bundle) { - if (getXBounds(0) != null && getDomainAxisRange() != null) { - Bounds bounds = - calculateZoom(getXBounds(0), getDomainAxisRange()); - context.putContextValue("startkm", bounds.getLower()); - context.putContextValue("endkm", bounds.getUpper()); - } - else if (getXBounds(0) != null && getDomainAxisRange() == null) { - context.putContextValue("startkm", getXBounds(0).getLower()); - context.putContextValue("endkm", getXBounds(0).getUpper()); - } - else if (getXBounds(0) == null && getDomainAxisRange() == null) { - BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context); - if (data.getKms().size() > 0) { - context.putContextValue("startkm", data.getKms().min()); - context.putContextValue("endkm", data.getKms().max()); - } - else { - logger.warn("No data to define start and end km"); - } - } - else if (getXBounds(0) == null && getDomainAxisRange() != null){ - BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context); - Bounds b = new DoubleBounds(data.getKms().min(), data.getKms().max()); - Bounds bounds = - calculateZoom(b, getDomainAxisRange()); - context.putContextValue("startkm", bounds.getLower()); - context.putContextValue("endkm", bounds.getUpper()); - } - } @Override public void doOut(ArtifactAndFacet bundle, Document attr, boolean visible) { @@ -134,7 +104,9 @@ return; } - setContextBounds(bundle); + if (bundle.getData(context) instanceof BedDifferencesResult) { + setContextBounds(bundle); + } Processor processor = new KMIndexProcessor(); Processor woutp = new WOutProcessor();