Package gov.nih.mipav.model.algorithms
Class ContourPlot.CoordSysScrollZoom
- java.lang.Object
-
- gov.nih.mipav.model.algorithms.ContourPlot.CoordSysScrollZoom
-
- All Implemented Interfaces:
ContourPlot.InteractionConstants,java.awt.event.MouseWheelListener,java.util.EventListener
- Enclosing class:
- ContourPlot
public class ContourPlot.CoordSysScrollZoom extends java.lang.Object implements java.awt.event.MouseWheelListener, ContourPlot.InteractionConstants
The CoordSysScrollZoom class implements aMouseWheelListenerthat realize zooming functionality for the coordinate view of theContourPlot.CoordSysRenderer. When registering this with anContourPlot.JPlotterCanvasand correspondingContourPlot.CoordSysRendererturning 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
Fields Modifier and Type Field Description protected intaxesprotected java.awt.Componentcanvasprotected ContourPlot.CoordSysRenderercoordsysprotected doublezoomFactor-
Fields inherited from interface gov.nih.mipav.model.algorithms.ContourPlot.InteractionConstants
X_AXIS, Y_AXIS
-
-
Constructor Summary
Constructors Constructor Description CoordSysScrollZoom(ContourPlot.JPlotterCanvas canvas, ContourPlot.CoordSysRenderer coordsys)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContourPlot.CoordSysScrollZoomdeRegister()Removes thisContourPlot.CoordSysScrollZoomfrom the associated canvas' mouse wheel listeners.intgetZoomedAxes()doublegetZoomFactor()voidmouseWheelMoved(java.awt.event.MouseWheelEvent e)ContourPlot.CoordSysScrollZoomregister()Adds thisContourPlot.CoordSysScrollZoomasMouseWheelListenerto the associated canvas.ContourPlot.CoordSysScrollZoomsetZoomedAxes(int axes)Sets the axes to which this scroll zoom is applied.ContourPlot.CoordSysScrollZoomsetZoomFactor(double zoomFactor)Sets the zoom factor of thisContourPlot.CoordSysScrollZoom.
-
-
-
Field Detail
-
canvas
protected java.awt.Component canvas
-
coordsys
protected ContourPlot.CoordSysRenderer coordsys
-
zoomFactor
protected double zoomFactor
-
axes
protected int axes
-
-
Constructor Detail
-
CoordSysScrollZoom
public CoordSysScrollZoom(ContourPlot.JPlotterCanvas canvas, ContourPlot.CoordSysRenderer coordsys)
-
-
Method Detail
-
mouseWheelMoved
public void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
- Specified by:
mouseWheelMovedin interfacejava.awt.event.MouseWheelListener
-
setZoomFactor
public ContourPlot.CoordSysScrollZoom setZoomFactor(double zoomFactor)
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
public ContourPlot.CoordSysScrollZoom register()
Adds thisContourPlot.CoordSysScrollZoomasMouseWheelListenerto the associated canvas.- Returns:
- this for chaining
-
setZoomedAxes
public ContourPlot.CoordSysScrollZoom setZoomedAxes(int axes)
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
public ContourPlot.CoordSysScrollZoom deRegister()
Removes thisContourPlot.CoordSysScrollZoomfrom the associated canvas' mouse wheel listeners.- Returns:
- this for chaining
-
-