Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java @ 542:7c57149e8715
Append the x and y ranges determined after zooming with the ZoomboxControl to the attribute document used for the chart creation.
flys-client/trunk@2045 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 03 Jun 2011 06:34:32 +0000 |
parents | ed29599e06e5 |
children | 9c2cf4811a7d |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java Wed Jun 01 14:13:29 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java Fri Jun 03 06:34:32 2011 +0000 @@ -41,7 +41,6 @@ public static final int THEMEPANEL_MIN_WIDTH = 200; - /** The service that is used to fetch chart information.*/ protected ChartInfoServiceAsync info = GWT.create(ChartInfoService.class); @@ -62,6 +61,11 @@ protected Canvas right; + /** Chart zoom options.*/ + protected double[] xrange; + protected double[] yrange; + + /** * The default constructor to create a new ChartOutputTab. * @@ -81,6 +85,8 @@ left = new Canvas(); right = new Canvas(); tbarPanel = new ChartToolbar(collectionView, this); + xrange = new double[2]; + yrange = new double[2]; left.setBorder("1px solid black"); left.setWidth(THEMEPANEL_MIN_WIDTH); @@ -145,12 +151,12 @@ double[] lower = transformer.transform(evt.getStartX(), evt.getStartY()); double[] upper = transformer.transform(evt.getEndX(), evt.getEndY()); - double xmin = lower[0]; - double xmax = upper[0]; - double ymin = upper[1]; - double ymax = lower[1]; + xrange[0] = lower[0]; + xrange[1] = upper[0]; + yrange[0] = upper[1]; + yrange[1] = lower[1]; - // TODO Trigger the recreation of the chart + updateChartPanel(); } @@ -193,6 +199,11 @@ } + /** + * Returns the existing chart panel. + * + * @return the existing chart panel. + */ public Canvas getChartPanel() { Canvas[] children = right.getChildren(); @@ -227,18 +238,30 @@ } + /** + * Creates a new chart panel with default size. + * + * @return the created chart panel. + */ protected Canvas createChartPanel() { return createChartPanel(DEFAULT_CHART_WIDTH, DEFAULT_CHART_HEIGHT); } + /** + * Creates a new chart panel with specified width and height. + * + * @param width The width for the chart panel. + * @param height The height for the chart panel. + * + * @return the created chart panel. + */ protected Canvas createChartPanel(int width, int height) { Img chart = getChartImg(width, height); chart.setWidth100(); chart.setHeight100(); return chart; - } @@ -260,6 +283,8 @@ * * @param width The width of the requested chart. * @param height The height of the requested chart. + * @param xr Optional x range (used for zooming). + * @param yr Optional y range (used for zooming). * * @return the URL to the chart image. */ @@ -276,6 +301,18 @@ imgUrl += "&width=" + Integer.toString(width); imgUrl += "&height=" + Integer.toString(height); + if (xrange != null) { + GWT.log("Zoom to xrange."); + imgUrl += "&minx=" + Double.toString(xrange[0]); + imgUrl += "&maxx=" + Double.toString(xrange[1]); + } + + if (yrange != null) { + GWT.log("Zoom to xrange."); + imgUrl += "&miny=" + Double.toString(yrange[0]); + imgUrl += "&maxy=" + Double.toString(yrange[1]); + } + return imgUrl; } }