de.erichseifert.gral.plots
Class PlotNavigator
- java.lang.Object
-
- de.erichseifert.gral.navigation.AbstractNavigator
-
- de.erichseifert.gral.plots.PlotNavigator
-
- All Implemented Interfaces:
- NavigationListener, Navigator
- Direct Known Subclasses:
- XYPlot.XYPlotNavigator
public abstract class PlotNavigator extends AbstractNavigator
Abstract base class that can be used to control the zoom and panning of a plot. The navigator translates the interaction to operations on a defined set of axes: Zooming is translated as scaling, panning is done by uniformly changing the minimum and maximum values of the axes.
Additionally, the actions can also be bound to a certain direction by defining a more restricted set of axes. The methods
AbstractNavigator.getDirection()andAbstractNavigator.setDirection(de.erichseifert.gral.navigation.NavigationDirection)provide a convenient way for setting predefined sets of axes.
-
-
Field Summary
-
Fields inherited from class de.erichseifert.gral.navigation.AbstractNavigator
DEFAULT_ZOOM_FACTOR, DEFAULT_ZOOM_MAX, DEFAULT_ZOOM_MIN
-
-
Constructor Summary
Constructors Constructor and Description PlotNavigator(Plot plot, java.util.List<java.lang.String> axesNames)Initializes a new instance that is responsible for zooming and panning the axes with the specified names of the specified plot.PlotNavigator(Plot plot, java.lang.String... axesNames)Initializes a new instance that is responsible for zooming and panning the axes with the specified names of the specified plot.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description PointND<? extends java.lang.Number>getCenter()Returns the current center point.doublegetZoom()Returns the current zoom level of the associated object.voidpan(PointND<? extends java.lang.Number> deltas)Moves the center by the relative values of the specified point.voidreset()Sets the object's position and zoom level to the default state.voidsetCenter(PointND<? extends java.lang.Number> center)Sets a new center point.voidsetDefaultState()Sets the current state as the default state of the object.voidsetZoom(double zoomNew)Sets the zoom level of the associated object to the specified value.-
Methods inherited from class de.erichseifert.gral.navigation.AbstractNavigator
addNavigationListener, centerChanged, connect, disconnect, getDirection, getZoomFactor, getZoomMax, getZoomMin, isPannable, isZoomable, removeNavigationListener, setDirection, setPannable, setZoomable, setZoomFactor, setZoomMax, setZoomMin, zoomAt, zoomChanged, zoomIn, zoomInAt, zoomOut, zoomOutAt
-
-
-
-
Constructor Detail
-
PlotNavigator
public PlotNavigator(Plot plot, java.util.List<java.lang.String> axesNames)
Initializes a new instance that is responsible for zooming and panning the axes with the specified names of the specified plot.- Parameters:
plot- AbstractPlot to be zoomed and panned.axesNames- Names of the axes that should be controlled by this navigator.
-
PlotNavigator
public PlotNavigator(Plot plot, java.lang.String... axesNames)
Initializes a new instance that is responsible for zooming and panning the axes with the specified names of the specified plot.- Parameters:
plot- AbstractPlot to be zoomed and panned.axesNames- Names of the axes that should be controlled by this navigator.
-
-
Method Detail
-
getZoom
public double getZoom()
Returns the current zoom level of the associated object.- Returns:
- Current zoom level.
-
setZoom
public void setZoom(double zoomNew)
Sets the zoom level of the associated object to the specified value.- Parameters:
zoomNew- New zoom level.
-
getCenter
public PointND<? extends java.lang.Number> getCenter()
Returns the current center point. The returned point contains value in world units.- Returns:
- Center point in world units.
-
setCenter
public void setCenter(PointND<? extends java.lang.Number> center)
Sets a new center point. The values of the point are in world units.- Parameters:
center- New center point in world units.- See Also:
Navigator.isPannable(),Navigator.setPannable(boolean)
-
pan
public void pan(PointND<? extends java.lang.Number> deltas)
Moves the center by the relative values of the specified point. The values of the point are in screen units.- Parameters:
deltas- Relative values to use for panning.- See Also:
Navigator.isPannable(),Navigator.setPannable(boolean)
-
setDefaultState
public void setDefaultState()
Sets the current state as the default state of the object. Resetting the navigator will then return to the default state.
-
reset
public void reset()
Sets the object's position and zoom level to the default state.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG