diff flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceEpochGenerator.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/BedDifferenceEpochGenerator.java	Tue Dec 04 15:38:21 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceEpochGenerator.java	Tue Dec 04 15:39:50 2012 +0100
@@ -6,12 +6,16 @@
 
 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
 import de.intevation.artifactdatabase.state.Facet;
+import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.access.FlowVelocityAccess;
 import de.intevation.flys.artifacts.model.FacetTypes;
 import de.intevation.flys.artifacts.model.minfo.BedDiffEpochResult;
 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;
 
@@ -82,6 +86,31 @@
             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) {
+            FLYSArtifact artifact = (FLYSArtifact)bundle.getArtifact();
+            FlowVelocityAccess access = new FlowVelocityAccess(artifact);
+            context.putContextValue("startkm", access.getLowerKM());
+            context.putContextValue("endkm", access.getUpperKM());
+        }
+        else if (getXBounds(0) == null && getDomainAxisRange() != null){
+            FLYSArtifact artifact = (FLYSArtifact)bundle.getArtifact();
+            FlowVelocityAccess access = new FlowVelocityAccess(artifact);
+            Bounds b = new DoubleBounds(access.getLowerKM(), access.getUpperKM());
+            Bounds bounds =
+                calculateZoom(b, getDomainAxisRange());
+            context.putContextValue("startkm", bounds.getLower());
+            context.putContextValue("endkm", bounds.getUpper());
+        }
         Processor processor = new KMIndexProcessor();
         if (name.equals(BED_DIFFERENCE_EPOCH)) {
             doBedDifferenceEpochOut(

http://dive4elements.wald.intevation.org