Package gov.nih.mipav.model.algorithms
Class ContourPlot.CoordSysScrollZoom
java.lang.Object
gov.nih.mipav.model.algorithms.ContourPlot.CoordSysScrollZoom
- All Implemented Interfaces:
ContourPlot.InteractionConstants,MouseWheelListener,EventListener
- Enclosing class:
ContourPlot
public class ContourPlot.CoordSysScrollZoom
extends Object
implements MouseWheelListener, ContourPlot.InteractionConstants
The CoordSysScrollZoom class implements a
MouseWheelListener
that realize zooming functionality for the coordinate view of the ContourPlot.CoordSysRenderer.
When registering this with an ContourPlot.JPlotterCanvas and corresponding ContourPlot.CoordSysRenderer turning the scroll wheel zooms into or out of
the current coordinate system view.
The zoom factor can be set and is by default 2.0.
Intended use: CoordSysScrollZoom zoom = new CoordSysScrollZoom(canvas, coordsys).register();
- Author:
- hageldave
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected Componentprotected ContourPlot.CoordSysRendererprotected doubleFields inherited from interface gov.nih.mipav.model.algorithms.ContourPlot.InteractionConstants
X_AXIS, Y_AXIS -
Constructor Summary
ConstructorsConstructorDescriptionCoordSysScrollZoom(ContourPlot.JPlotterCanvas canvas, ContourPlot.CoordSysRenderer coordsys) -
Method Summary
Modifier and TypeMethodDescriptionRemoves thisContourPlot.CoordSysScrollZoomfrom the associated canvas' mouse wheel listeners.intdoublevoidregister()Adds thisContourPlot.CoordSysScrollZoomasMouseWheelListenerto the associated canvas.setZoomedAxes(int axes) Sets the axes to which this scroll zoom is applied.setZoomFactor(double zoomFactor) Sets the zoom factor of thisContourPlot.CoordSysScrollZoom.
-
Field Details
-
canvas
-
coordsys
-
zoomFactor
protected double zoomFactor -
axes
protected int axes
-
-
Constructor Details
-
CoordSysScrollZoom
-
-
Method Details
-
mouseWheelMoved
- Specified by:
mouseWheelMovedin interfaceMouseWheelListener
-
setZoomFactor
Sets the zoom factor of thisContourPlot.CoordSysScrollZoom. The default value is 2.0. Using a value in ]0,1[ will reverse the zoom direction.- Parameters:
zoomFactor- to be set- Returns:
- this for chaining
-
getZoomFactor
public double getZoomFactor() -
register
Adds thisContourPlot.CoordSysScrollZoomasMouseWheelListenerto the associated canvas.- Returns:
- this for chaining
-
setZoomedAxes
Sets the axes to which this scroll zoom is applied. Default are both x and y axis.- Parameters:
axes-ContourPlot.InteractionConstants.X_AXIS,ContourPlot.InteractionConstants.Y_AXISorX_AXIS|Y_AXIS- Returns:
- this for chaining
-
getZoomedAxes
public int getZoomedAxes()- Returns:
- the axes this scroll zoom applies to, i.e.
ContourPlot.InteractionConstants.X_AXIS,ContourPlot.InteractionConstants.Y_AXISorX_AXIS|Y_AXIS
-
deRegister
Removes thisContourPlot.CoordSysScrollZoomfrom the associated canvas' mouse wheel listeners.- Returns:
- this for chaining
-