[Dive4elements-commits] [PATCH 3 of 4] Put start and end km into the context for average calculation

Wald Commits scm-commit at wald.intevation.org
Tue Dec 4 15:41:39 CET 2012


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1354631990 -3600
# Node ID 6122ee2ab67f413c38bf671b113cf4751feb415c
# Parent  3ab9ec5ca02ffdf85a18fa9ff3318bbb126e9815
Put start and end km into the context for average calculation.

diff -r 3ab9ec5ca02f -r 6122ee2ab67f flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDiffHeightYearGenerator.java
--- 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(
diff -r 3ab9ec5ca02f -r 6122ee2ab67f flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceEpochGenerator.java
--- 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(
diff -r 3ab9ec5ca02f -r 6122ee2ab67f flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceYearGenerator.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceYearGenerator.java	Tue Dec 04 15:38:21 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceYearGenerator.java	Tue Dec 04 15:39:50 2012 +0100
@@ -6,12 +6,18 @@
 
 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
 import de.intevation.artifactdatabase.state.Facet;
+import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.access.BedDifferencesAccess;
+import de.intevation.flys.artifacts.access.FlowVelocityAccess;
 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;
 
@@ -83,6 +89,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_YEAR)) {
             doBedDifferenceYearOut(


More information about the Dive4elements-commits mailing list