changeset 3567:572384206fe0

Fix issue795. flys-artifacts/trunk@5165 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 07 Aug 2012 12:36:32 +0000
parents 8d0f06b76e09
children 99c60d38a3a8
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java
diffstat 2 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Wed Aug 01 10:19:45 2012 +0000
+++ b/flys-artifacts/ChangeLog	Tue Aug 07 12:36:32 2012 +0000
@@ -1,3 +1,10 @@
+2012-08-07	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Fix issue795.
+
+	* src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java:
+	  Set Tick Units dependant on cm/m scale on X axis.
+
 2012-08-01	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	Fix for flys/issue748
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java	Wed Aug 01 10:19:45 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java	Tue Aug 07 12:36:32 2012 +0000
@@ -92,6 +92,7 @@
     }
 
 
+    /** True if axis is in cm (because at gauge). */
     protected boolean getInCm(int index) {
         Object obj = context.getContextValue("reference.curve.axis.scale");
         return obj instanceof WWAxisTypes && ((WWAxisTypes)obj).getInCm(index);
@@ -221,9 +222,11 @@
         addAxisSeries(series, YAXIS.W.idx, visible);
     }
 
-    protected void setAxisTickUnit(ValueAxis axis) {
+
+    /** Set the tick units for given axis. */
+    protected void setAxisTickUnit(double tick, ValueAxis axis) {
         TickUnits units = new TickUnits();
-        units.add(new NumberTickUnit(1d, Formatter.getWaterlevelW(context)));
+        units.add(new NumberTickUnit(tick, Formatter.getWaterlevelW(context)));
         axis.setStandardTickUnits(units);
         axis.setAutoTickUnitSelection(true);
     }
@@ -231,14 +234,19 @@
     @Override
     protected void localizeDomainAxis(ValueAxis domainAxis) {
         super.localizeDomainAxis(domainAxis);
-        setAxisTickUnit(domainAxis);
+        if (getInCm(0)) {
+            setAxisTickUnit(100d, domainAxis);
+        }
+        else {
+            setAxisTickUnit(1d, domainAxis);
+        }
     }
 
 
     @Override
     protected void localizeRangeAxis(ValueAxis rangeAxis) {
         super.localizeRangeAxis(rangeAxis);
-        setAxisTickUnit(rangeAxis);
+        setAxisTickUnit(1d, rangeAxis);
     }
 
     /** Get Walker to iterate over all axes. */

http://dive4elements.wald.intevation.org