diff flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDiffHeightYearGenerator.java @ 4638:6122ee2ab67f

Put start and end km into the context for average calculation.
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 04 Dec 2012 15:39:50 +0100
parents 05a54b4d579d
children 32f90baf4afa
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDiffHeightYearGenerator.java	Tue Dec 04 15:38:21 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDiffHeightYearGenerator.java	Tue Dec 04 15:39:50 2012 +0100
@@ -8,10 +8,13 @@
 import de.intevation.artifactdatabase.state.Facet;
 import de.intevation.flys.artifacts.model.FacetTypes;
 import de.intevation.flys.artifacts.model.minfo.BedDiffYearResult;
+import de.intevation.flys.artifacts.model.minfo.BedDifferencesResult;
 import de.intevation.flys.exports.StyledSeriesBuilder;
 import de.intevation.flys.exports.fixings.FixChartGenerator;
 import de.intevation.flys.exports.process.KMIndexProcessor;
 import de.intevation.flys.exports.process.Processor;
+import de.intevation.flys.jfree.Bounds;
+import de.intevation.flys.jfree.DoubleBounds;
 import de.intevation.flys.jfree.FLYSAnnotation;
 import de.intevation.flys.jfree.StyledXYSeries;
 
@@ -79,6 +82,29 @@
             return;
         }
 
+        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);
+            context.putContextValue("startkm", data.getKms().min());
+            context.putContextValue("endkm", data.getKms().max());
+        }
+        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());
+        }
         Processor processor = new KMIndexProcessor();
         if (name.equals(BED_DIFFERENCE_HEIGHT_YEAR)) {
             doBedDifferenceYearOut(

http://dive4elements.wald.intevation.org