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 aMouseWheelListener
that realize zooming functionality for the coordinate view of theContourPlot.CoordSysRenderer
. When registering this with anContourPlot.JPlotterCanvas
and correspondingContourPlot.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
Fields Modifier and Type Field Description protected int
axes
protected java.awt.Component
canvas
protected ContourPlot.CoordSysRenderer
coordsys
protected double
zoomFactor
-
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.CoordSysScrollZoom
deRegister()
Removes thisContourPlot.CoordSysScrollZoom
from the associated canvas' mouse wheel listeners.int
getZoomedAxes()
double
getZoomFactor()
void
mouseWheelMoved(java.awt.event.MouseWheelEvent e)
ContourPlot.CoordSysScrollZoom
register()
Adds thisContourPlot.CoordSysScrollZoom
asMouseWheelListener
to the associated canvas.ContourPlot.CoordSysScrollZoom
setZoomedAxes(int axes)
Sets the axes to which this scroll zoom is applied.ContourPlot.CoordSysScrollZoom
setZoomFactor(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:
mouseWheelMoved
in 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.CoordSysScrollZoom
asMouseWheelListener
to 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_AXIS
orX_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_AXIS
orX_AXIS|Y_AXIS
-
deRegister
public ContourPlot.CoordSysScrollZoom deRegister()
Removes thisContourPlot.CoordSysScrollZoom
from the associated canvas' mouse wheel listeners.- Returns:
- this for chaining
-
-