diff flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.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 991e4a5df323
children 2f6d4f92d628
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java	Fri Feb 10 08:28:17 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java	Fri Feb 10 11:18:27 2012 +0000
@@ -49,6 +49,7 @@
 
 import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.resources.Resources;
+import de.intevation.flys.jfree.Bounds;
 import de.intevation.flys.jfree.EnhancedLineAndShapeRenderer;
 import de.intevation.flys.jfree.StableXYDifferenceRenderer;
 import de.intevation.flys.jfree.StyledAreaSeriesCollection;
@@ -248,6 +249,14 @@
      */
     public abstract Range[] getRangesForAxis(int index);
 
+    public abstract Bounds getXBounds(int axis);
+
+    protected abstract void setXBounds(int axis, Bounds bounds);
+
+    public abstract Bounds getYBounds(int axis);
+
+    protected abstract void setYBounds(int axis, Bounds bounds);
+
 
     /**
      * This method should be used by concrete subclasses to add subtitle to
@@ -1003,9 +1012,11 @@
 
 
     /**
-     * Get Range of Domain ("X"-) Axis from request.
+     * Returns the X-Axis range as String array from request document.
+     *
+     * @return a String array with [lower, upper].
      */
-    protected Range getDomainAxisRange() {
+    protected String[] getDomainAxisRangeFromRequest() {
         Element xrange = (Element)XMLUtils.xpath(
             request,
             XPATH_CHART_X_RANGE,
@@ -1021,34 +1032,11 @@
         String lower = xrange.getAttributeNS(uri, "from");
         String upper = xrange.getAttributeNS(uri, "to");
 
-        if (lower.length() > 0 && upper.length() > 0) {
-            try {
-                double from = Double.parseDouble(lower);
-                double to   = Double.parseDouble(upper);
-
-                if (from == 0 && to == 0) {
-                    logger.debug("No range specified. Lower and upper X == 0");
-                    return null;
-                }
-
-                if (from > to) {
-                    double tmp = to;
-                    to         = from;
-                    from       = tmp;
-                }
-
-                return new Range(from, to);
-            }
-            catch (NumberFormatException nfe) {
-                logger.warn("Wrong values for domain axis range.");
-            }
-        }
-
-        return null;
+        return new String[] { lower, upper };
     }
 
 
-    protected Range getValueAxisRange() {
+    protected String[] getValueAxisRangeFromRequest() {
         Element yrange = (Element)XMLUtils.xpath(
             request,
             XPATH_CHART_Y_RANGE,
@@ -1062,30 +1050,10 @@
 
         String uri = ArtifactNamespaceContext.NAMESPACE_URI;
 
-
         String lower = yrange.getAttributeNS(uri, "from");
         String upper = yrange.getAttributeNS(uri, "to");
 
-        if (lower.length() > 0 && upper.length() > 0) {
-            try {
-                double from = Double.parseDouble(lower);
-                double to   = Double.parseDouble(upper);
-
-                if (from == 0 && to == 0) {
-                    logger.debug("No range specified. Lower and upper Y == 0");
-                    return null;
-                }
-
-                return from > to
-                       ? new Range(to, from)
-                       : new Range(from, to);
-            }
-            catch (NumberFormatException nfe) {
-                logger.warn("Wrong values for value axis range.");
-            }
-        }
-
-        return null;
+        return new String[] { lower, upper };
     }
 
 

http://dive4elements.wald.intevation.org