changeset 1281:4782c0ce9cec

Re-added the function to zoom-out charts by a given factor (10%). flys-client/trunk@2863 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 29 Sep 2011 12:55:17 +0000
parents 66192d170c79
children 3904519ec161
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java flys-client/src/main/webapp/images/zoom-back.png
diffstat 8 files changed, 72 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Thu Sep 29 11:12:04 2011 +0000
+++ b/flys-client/ChangeLog	Thu Sep 29 12:55:17 2011 +0000
@@ -1,6 +1,23 @@
 2011-09-29  Ingo Weinzierl <ingo@intevation.de>
 
-	flys/issue179 (Zoom Out funktioniert nichtzuverlässig)
+	* src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java:
+	  Re-added the button to zoom-out by a given factor. Added a new one to
+	  step back to the last extent.
+
+	* src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java:
+	  Re-added the function to zoom-out by a given factor.
+
+	* src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.java: Added
+	  the path to the zoom-back icon.
+
+	* src/main/webapp/images/zoom-back.png: New. Icon for the zoom-back
+	  button.
+
+2011-09-29  Ingo Weinzierl <ingo@intevation.de>
+
 	flys/issue198 (Diagramm: Zu vorheriger Zoomstufe per Klick zurückkehren)
 
 	* src/main/java/de/intevation/flys/client/shared/model/ZoomObj.java: New.
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Thu Sep 29 11:12:04 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Thu Sep 29 12:55:17 2011 +0000
@@ -100,6 +100,8 @@
 
     String zoom_out();
 
+    String zoom_back();
+
     String pan();
 
     String fix();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Thu Sep 29 11:12:04 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Thu Sep 29 12:55:17 2011 +0000
@@ -113,6 +113,7 @@
 zoom_all = images/zoom-1.png
 zoom_in = images/zoom-in.png
 zoom_out = images/zoom-out.png
+zoom_back = images/zoom-back.png
 pan = images/pan.png
 
 discharge_curve = Discharge Curves at Gauges
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Thu Sep 29 11:12:04 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Thu Sep 29 12:55:17 2011 +0000
@@ -114,6 +114,7 @@
 zoom_all = images/zoom-1.png
 zoom_in = images/zoom-in.png
 zoom_out = images/zoom-out.png
+zoom_back = images/zoom-back.png
 pan = images/pan.png
 
 discharge_curve = Abflusskurven an Pegeln
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Thu Sep 29 11:12:04 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Thu Sep 29 12:55:17 2011 +0000
@@ -108,6 +108,7 @@
 zoom_all = images/zoom-1.png
 zoom_in = images/zoom-in.png
 zoom_out = images/zoom-out.png
+zoom_back = images/zoom-back.png
 pan = images/pan.png
 
 discharge_curve = Discharge Curves at Gauges
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java	Thu Sep 29 11:12:04 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java	Thu Sep 29 12:55:17 2011 +0000
@@ -320,6 +320,8 @@
 
 
     public void resetRanges() {
+        zoomStack.push(new ZoomObj(zoom[0], zoom[1], zoom[2], zoom[3]));
+
         zoom[0] = 0d;
         zoom[1] = 1d;
         zoom[2] = 0d;
@@ -331,6 +333,34 @@
 
 
     /**
+     * This method zooms the current chart out by a given <i>factor</i>.
+     *
+     * @param factor The factor should be between 0-100.
+     */
+    public void zoomOut(int factor) {
+        if (factor < 0 || factor > 100 || chartInfo == null) {
+            return;
+        }
+
+        zoomStack.push(new ZoomObj(zoom[0], zoom[1], zoom[2], zoom[3]));
+
+        Axis xAxis = chartInfo.getXAxis(0);
+        Axis yAxis = chartInfo.getYAxis(0);
+
+        double[] x = zoomAxis(xAxis, factor);
+        double[] y = zoomAxis(yAxis, factor);
+
+        zoom[0] = x[0];
+        zoom[1] = x[1];
+        zoom[2] = x[0];
+        zoom[3] = y[1];
+
+        updateChartInfo();
+        updateChartPanel();
+    }
+
+
+    /**
      * This method is used to zoom out. Zooming out is realizied with a stacked
      * logic. Initially, you cannot zoom out. For each time you start a zoom-in
      * action, the extent of the chart is stored and pushed onto a stack. A
@@ -351,16 +381,12 @@
         double min  = axis.getFrom();
         double max  = axis.getTo();
 
-        GWT.log("ZOOM CURRENT: " + min + " - " + max);
-
         double add = (max - min) / 100 * factor;
         add = add < 0 ? (-1) * add : add;
 
         min -= add;
         max += add;
 
-        GWT.log("ZOOM TO: " + min + " - " + max);
-
         return computeZoom(axis, min, max);
     }
 
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java	Thu Sep 29 11:12:04 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java	Thu Sep 29 12:55:17 2011 +0000
@@ -43,6 +43,8 @@
 
     protected ImgButton zoomToMaxExtent;
 
+    protected ImgButton historyBack;
+
     protected ImgButton zoomOut;
 
     protected PanControl panControl;
@@ -60,6 +62,7 @@
         zoombox         = new ZoomboxControl(chartTab, MSG.zoom_in());
         zoomToMaxExtent = new ImgButton();
         zoomOut         = new ImgButton();
+        historyBack     = new ImgButton();
         panControl      = new PanControl(chartTab, MSG.pan());
 
         datacage.addClickHandler(new ClickHandler() {
@@ -96,6 +99,21 @@
         zoomOut.setShowFocusedIcon(false);
         zoomOut.addClickHandler(new ClickHandler() {
             public void onClick(ClickEvent event) {
+                getChartOutputTab().zoomOut(10);
+            }
+        });
+
+        historyBack.setSrc(baseUrl + MSG.zoom_back());
+        historyBack.setWidth(20);
+        historyBack.setHeight(20);
+        historyBack.setShowDown(false);
+        historyBack.setShowRollOver(false);
+        historyBack.setShowDisabled(false);
+        historyBack.setShowDisabledIcon(true);
+        historyBack.setShowDownIcon(false);
+        historyBack.setShowFocusedIcon(false);
+        historyBack.addClickHandler(new ClickHandler() {
+            public void onClick(ClickEvent event) {
                 getChartOutputTab().zoomOut();
             }
         });
@@ -146,6 +164,7 @@
 
         addMember(datacage);
         addMember(zoomToMaxExtent);
+        addMember(historyBack);
         addMember(zoomOut);
         addMember(zoombox);
         addMember(panControl);
Binary file flys-client/src/main/webapp/images/zoom-back.png has changed

http://dive4elements.wald.intevation.org