# HG changeset patch # User Ingo Weinzierl # Date 1317294724 0 # Node ID 66192d170c7906917a514c43b7599b77ab6da8f5 # Parent af6ad75223512ff5a33ba4b4a739d58fc9f78848 Bugfix: #179 and #198 Zoom-out will no longer work with a factor but with stacked chart extents. flys-client/trunk@2862 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r af6ad7522351 -r 66192d170c79 flys-client/ChangeLog --- a/flys-client/ChangeLog Thu Sep 29 09:14:41 2011 +0000 +++ b/flys-client/ChangeLog Thu Sep 29 11:12:04 2011 +0000 @@ -1,3 +1,21 @@ +2011-09-29 Ingo Weinzierl + + flys/issue179 (Zoom Out funktioniert nichtzuverlässig) + flys/issue198 (Diagramm: Zu vorheriger Zoomstufe per Klick zurückkehren) + + * src/main/java/de/intevation/flys/client/shared/model/ZoomObj.java: New. + This object is used to save the zoom extent of charts. + + * src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java: + The zoom-out button calls ChartOutputTab.zoomOut() without a integer + value. + + * src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java: + The Zoom-Out action no longer zooms out for a specific factor, but to the + last extent. The current extent of a chart is pushed onto a stack before + a Zoom-In action takes place. Zoom-out then zooms to the last extent + retrieved from the stack. + 2011-09-29 Ingo Weinzierl flys/issue336 (W-INFO / Berechnung Wasserstand an Orten, Zurodnung Bezugspegel) diff -r af6ad7522351 -r 66192d170c79 flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java Thu Sep 29 09:14:41 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java Thu Sep 29 11:12:04 2011 +0000 @@ -3,6 +3,7 @@ import java.util.Date; import java.util.HashMap; import java.util.Map; +import java.util.Stack; import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.rpc.AsyncCallback; @@ -23,6 +24,7 @@ import de.intevation.flys.client.shared.model.ChartInfo; import de.intevation.flys.client.shared.model.Collection; import de.intevation.flys.client.shared.model.OutputMode; +import de.intevation.flys.client.shared.model.ZoomObj; import de.intevation.flys.client.client.Config; import de.intevation.flys.client.client.event.OutputParameterChangeEvent; import de.intevation.flys.client.client.event.OutputParameterChangeHandler; @@ -89,7 +91,8 @@ protected int[] xrange; protected int[] yrange; - protected double[] zoom; + protected Stack zoomStack; + protected double[] zoom; /** @@ -114,6 +117,7 @@ xrange = new int[2]; yrange = new int[2]; zoom = new double[4]; + zoomStack = new Stack(); left.setBorder("1px solid black"); left.setWidth(THEMEPANEL_MIN_WIDTH); @@ -200,6 +204,8 @@ * @param evt The ZoomEvent that stores the coordinates for zooming. */ public void onZoom(ZoomEvent evt) { + zoomStack.push(new ZoomObj(zoom[0], zoom[1], zoom[2], zoom[3])); + xrange[0] = evt.getStartX(); xrange[1] = evt.getEndX(); yrange[0] = evt.getStartY(); @@ -325,31 +331,19 @@ /** - * This method is used to zoom out. + * 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 + * zoom-out will now lead you to the last extent that is poped from stack. * - * @param factor The factor should be between 0-100. */ - public void zoomOut(int factor) { - if (factor < 0 || factor > 100 || chartInfo == null) { - return; - } - - Axis xAxis = chartInfo.getXAxis(0); - Axis yAxis = chartInfo.getYAxis(0); + public void zoomOut() { + if (!zoomStack.empty()) { + zoom = zoomStack.pop().getZoom(); - GWT.log("ZOOM X"); - double[] x = zoomAxis(xAxis, factor); - - GWT.log("ZOOM Y"); - double[] y = zoomAxis(yAxis, factor); - - zoom[0] = x[0]; - zoom[1] = x[1]; - zoom[2] = x[0]; - zoom[3] = y[1]; - - updateChartInfo(); - updateChartPanel(); + updateChartInfo(); + updateChartPanel(); + } } diff -r af6ad7522351 -r 66192d170c79 flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java Thu Sep 29 09:14:41 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java Thu Sep 29 11:12:04 2011 +0000 @@ -96,7 +96,7 @@ zoomOut.setShowFocusedIcon(false); zoomOut.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { - getChartOutputTab().zoomOut(10); + getChartOutputTab().zoomOut(); } }); diff -r af6ad7522351 -r 66192d170c79 flys-client/src/main/java/de/intevation/flys/client/shared/model/ZoomObj.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/ZoomObj.java Thu Sep 29 11:12:04 2011 +0000 @@ -0,0 +1,30 @@ +package de.intevation.flys.client.shared.model; + +import java.io.Serializable; + + +public class ZoomObj implements Serializable { + + protected double a; + protected double b; + protected double c; + protected double d; + + + public ZoomObj() { + } + + + public ZoomObj(double a, double b, double c, double d) { + this.a = a; + this.b = b; + this.c = c; + this.d = d; + } + + + public double[] getZoom() { + return new double[] { a, b, c, d }; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :