/**
 * 
 */
package org.mwc.cmap.plotViewer.actions;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
import org.mwc.cmap.core.CorePlugin;
import org.mwc.cmap.core.operations.DebriefActionWrapper;
import org.mwc.cmap.plotViewer.editors.chart.*;
import org.mwc.cmap.plotViewer.editors.chart.SWTChart.PlotMouseDragger;

import MWC.GUI.*;
import MWC.GUI.Tools.Action;
import MWC.GenericData.*;

/**
 * @author ian.mayo
 */
public class ZoomIn extends CoreDragAction
{

	public static class ZoomInMode extends SWTChart.PlotMouseDragger
	{
		Point _startPoint;

		SWTCanvas _myCanvas;

		private PlainChart _myChart;

		public void doMouseDrag(final Point pt, final int JITTER, final Layers theLayers,
				SWTCanvas theCanvas)
		{
			// just do a check that we have our start point (it may have been cleared
			// at the end of the move operation)
			if (_startPoint != null)
			{
				int deltaX = _startPoint.x - pt.x;
				int deltaY = _startPoint.y - pt.y;

				Tracker _dragTracker = new Tracker((Composite) _myCanvas.getCanvas(), SWT.RESIZE);
				Rectangle rect = new Rectangle(_startPoint.x, _startPoint.y, deltaX, deltaY);
				_dragTracker.setRectangles(new Rectangle[] { rect });
				boolean dragResult = _dragTracker.open();
				if (dragResult)
				{
					Rectangle[] rects = _dragTracker.getRectangles();
					Rectangle res = rects[0];
					// get world area
					java.awt.Point tl = new java.awt.Point(res.x, res.y);
					java.awt.Point br = new java.awt.Point(res.x + res.width, res.y + res.height);

					if (res.width > JITTER || res.height > JITTER)
					{

						WorldLocation locA = new WorldLocation(_myCanvas.getProjection().toWorld(tl));
						WorldLocation locB = new WorldLocation(_myCanvas.getProjection().toWorld(br));
						WorldArea area = new WorldArea(locA, locB);

						WorldArea oldArea = _myCanvas.getProjection().getDataArea();
						Action theAction = new MWC.GUI.Tools.Chart.ZoomIn.ZoomInAction(_myChart,
								oldArea, area);

						// and wrap it
						DebriefActionWrapper daw = new DebriefActionWrapper(theAction, null);

						// and add it to the clipboard
						CorePlugin.run(daw);

					}

					_dragTracker = null;
					_startPoint = null;
					_myChart = null;
					_myCanvas = null;
				}
			}
		}

		public void doMouseUp(Point point, int keyState)
		{
			_startPoint = null;
		}

		public void mouseDown(Point point, SWTCanvas canvas, PlainChart theChart)
		{
			_startPoint = point;
			_myCanvas = canvas;
			_myChart = theChart;
		}

	}

	public PlotMouseDragger getDragMode()
	{
		// TODO Auto-generated method stub
		return new ZoomInMode();
	}
}
@@ -107,17 +107,106 @@
 raphics.
-*
+Point;%0Aimport org.eclipse.swt.graphics.Rectangle;%0Aimport org.eclipse.swt.widgets.Composite
 ;%0Aimport
@@ -230,17 +230,23 @@
 widgets.
-*
+Tracker
 ;%0Aimport
@@ -379,17 +379,80 @@
 s.chart.
-*
+SWTCanvas;%0Aimport org.mwc.cmap.plotViewer.editors.chart.SWTChart
 ;%0Aimport
@@ -533,17 +533,49 @@
 MWC.GUI.
-*
+Layers;%0Aimport MWC.GUI.PlainChart
 ;%0Aimport
@@ -620,17 +620,63 @@
 ricData.
-*
+WorldArea;%0Aimport MWC.GenericData.WorldLocation
 ;%0A%0A/**%0A 
@@ -891,16 +891,28 @@
 Chart;%0A%0A
+%09%09@Override%0A
 %09%09public
@@ -962,17 +962,21 @@
  JITTER,
- 
+%0A%09%09%09%09
 final La
@@ -990,21 +990,17 @@
 eLayers,
-%0A%09%09%09%09
+ 
 SWTCanva
@@ -1318,17 +1318,23 @@
 anvas(),
- 
+%0A%09%09%09%09%09%09
 SWT.RESI
@@ -1410,17 +1410,23 @@
  deltaX,
- 
+%0A%09%09%09%09%09%09
 deltaY);
@@ -1792,17 +1792,24 @@
 h, res.y
- 
+%0A%09%09%09%09%09%09%09
 + res.he
@@ -1938,32 +1938,41 @@
 .getProjection()
+%0A%09%09%09%09%09%09%09%09
 .toWorld(tl));%0A%09
@@ -2040,16 +2040,25 @@
 ection()
+%0A%09%09%09%09%09%09%09%09
 .toWorld
@@ -2255,17 +2255,8 @@
 ion(
-_myChart,
 %0A%09%09%09
@@ -2260,16 +2260,26 @@
 %09%09%09%09%09%09%09%09
+_myChart, 
 oldArea,
@@ -2376,21 +2376,34 @@
 eAction,
- null
+%0A%09%09%09%09%09%09%09%09theLayers
 );%0A%0A%09%09%09%09
@@ -2579,24 +2579,36 @@
 %7D%0A%09%09%09%7D%0A%09%09%7D%0A%0A
+%09%09@Override%0A
 %09%09public voi
@@ -2678,16 +2678,28 @@
 l;%0A%09%09%7D%0A%0A
+%09%09@Override%0A
 %09%09public
@@ -2850,16 +2850,27 @@
 %09%7D%0A%0A%09%7D%0A%0A
+%09@Override%0A
 %09public 

Include layers object so we can fire modified change