diff flys-artifacts/src/main/java/de/intevation/flys/jfree/DoubleBounds.java @ 2330:594885703687

Picked changes r4015:4026 from trunk. flys-artifacts/tags/2.6@4028 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 10 Feb 2012 11:18:27 +0000
parents 07c39470e2cb
children 2f6d4f92d628
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/DoubleBounds.java	Fri Feb 10 08:28:17 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/DoubleBounds.java	Fri Feb 10 11:18:27 2012 +0000
@@ -15,9 +15,13 @@
     protected double upper;
 
 
+    /**
+     * Default constructor. <b>A DoubleBounds has always set lower &lt;
+     * upper!</b>
+     */
     public DoubleBounds(double lower, double upper) {
-        this.lower = lower;
-        this.upper = upper;
+        this.lower = Math.min(lower, upper);
+        this.upper = Math.max(lower, upper);
     }
 
 
@@ -40,6 +44,13 @@
 
 
     @Override
+    public void applyBounds(ValueAxis axis, int percent) {
+        double space = (upper - lower) / 100 * percent;
+        axis.setRange(new Range(lower-space, upper+space));
+    }
+
+
+    @Override
     public Bounds combine(Bounds bounds) {
         if (bounds == null) {
             return this;

http://dive4elements.wald.intevation.org