changeset 422:3b83341e0cf4

ISSUE-52 The longitudinal section charts will now always have the head of the river at the left side. flys-artifacts/trunk@1904 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 11 May 2011 16:31:38 +0000
parents 24b53f9aa9dc
children bab867fb37e8
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java
diffstat 2 files changed, 35 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Wed May 11 09:51:54 2011 +0000
+++ b/flys-artifacts/ChangeLog	Wed May 11 16:31:38 2011 +0000
@@ -1,3 +1,12 @@
+2011-05-11  Ingo Weinzierl <ingo@intevation.de>
+
+	  ISSUE-52
+
+	* src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java:
+	  The X-Axis of such a chart is inverted, if the head of the river is not
+	  at kilometer 0. This type of charts always have the head of the river at
+	  the left side.
+
 2011-05-10	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/services/MetaDataService.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Wed May 11 09:51:54 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Wed May 11 16:31:38 2011 +0000
@@ -6,6 +6,7 @@
 
 import org.jfree.chart.JFreeChart;
 import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.axis.ValueAxis;
 import org.jfree.chart.plot.XYPlot;
 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
 import org.jfree.chart.title.TextTitle;
@@ -16,6 +17,9 @@
 
 import de.intevation.artifacts.Artifact;
 
+import de.intevation.flys.model.River;
+
+import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.WINFOArtifact;
 import de.intevation.flys.artifacts.model.WQKms;
 
@@ -150,6 +154,28 @@
 
         plot.setRangeAxis(2, qAxis);
         plot.mapDatasetToRangeAxis(1, 2);
+
+        invertXAxis(plot.getDomainAxis());
+    }
+
+
+    /**
+     * This method inverts the x-axis based on the kilometer information of the
+     * selected river. If the head of the river is at kilometer 0, the axis is
+     * not inverted, otherwise it is.
+     *
+     * @param xaxis The domain axis.
+     */
+    protected void invertXAxis(ValueAxis xaxis) {
+        FLYSArtifact artifact = (FLYSArtifact) master;
+        River        river    = artifact.getRiver();
+
+        boolean up = river.getKmUp();
+
+        if (up) {
+            logger.info("Invert X-Axis.");
+            xaxis.setInverted(true);
+        }
     }
 
 

http://dive4elements.wald.intevation.org