Documentation of 'de.erichseifert.gral.navigation.AbstractNavigator' Java class
AbstractNavigator
de.erichseifert.gral.navigation

Class AbstractNavigator

  • All Implemented Interfaces:
    NavigationListener, Navigator
    Direct Known Subclasses:
    PiePlot.PiePlotNavigator, PlotNavigator


    public abstract class AbstractNavigator
    extends java.lang.Object
    implements Navigator
    Abstract base class that can be used to control the zoom and panning of an object. The navigator translates actions to operations on the object. The class provides implementations for zooming using a zoom factor, management of listeners, getting and setting a main direction for actions, and synchronizing actions with another navigator. Derived classes must use the methods fireCenterChanged(NavigationEvent) and fireZoomChanged(NavigationEvent) to notify listeners of changes to the center or zoom level. To avoid loop states these methods must only be called if a value has really been changed.
    • Constructor Summary

      Constructors 
      Constructor and Description
      AbstractNavigator()
      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
      void addNavigationListener(NavigationListener l)
      Adds the specified listener object that gets notified on changes to navigation information like panning or zooming.
      void centerChanged(NavigationEvent<PointND<? extends java.lang.Number>> event)
      A method that gets called after the center of an object in a connected PlotNavigator has changed.
      void connect(Navigator navigator)
      Couples the actions of the current and the specified navigator.
      void disconnect(Navigator navigator)
      Decouples the actions of the current and the connected specified navigator.
      NavigationDirection getDirection()
      Returns the current direction of the components that will be taken into account for zooming and panning.
      double getZoomFactor()
      Returns the factor which is used to change the zoom level on zoom in/out actions.
      double getZoomMax()
      Returns the minimal zoom factor.
      double getZoomMin()
      Returns the minimal zoom factor.
      boolean isPannable()
      Returns whether the associated object can be panned.
      boolean isZoomable()
      Returns whether the associated object can be zoomed.
      void removeNavigationListener(NavigationListener l)
      Removes the specified listener object, i.e.
      void setDirection(NavigationDirection direction)
      Sets the direction of the components that will be taken into account for zooming and panning.
      void setPannable(boolean pannable)
      Sets whether the associated object can be panned.
      void setZoomable(boolean zoomable)
      Sets whether the associated object can be zoomed.
      void setZoomFactor(double factor)
      Sets the factor which should be used to change the zoom level on zoom in/out actions.
      void setZoomMax(double max)
      Sets the maximal zoom factor.
      void setZoomMin(double min)
      Sets the minimal zoom factor.
      void zoomAt(double zoom, PointND<? extends java.lang.Number> zoomPoint)
      Scale the associated object at the specified point.
      void zoomChanged(NavigationEvent<java.lang.Double> event)
      A method that gets called after the zoom level of an object in a connected PlotNavigator has changed.
      void zoomIn()
      Increases the current zoom level by the specified zoom factor.
      void zoomInAt(PointND<? extends java.lang.Number> zoomPoint)
      Increases the current zoom level by the specified zoom factor and scales the associated object at the specified point.
      void zoomOut()
      Decreases the current zoom level by the specified zoom factor.
      void zoomOutAt(PointND<? extends java.lang.Number> zoomPoint)
      Decreases the current zoom level by the specified zoom factor and scales the associated object at the specified point.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_ZOOM_FACTOR

        public static final double DEFAULT_ZOOM_FACTOR
        Default zoom factor.
        See Also:
        Constant Field Values
      • DEFAULT_ZOOM_MIN

        public static final double DEFAULT_ZOOM_MIN
        Default minimum of zoom factor.
        See Also:
        Constant Field Values
      • DEFAULT_ZOOM_MAX

        public static final double DEFAULT_ZOOM_MAX
        Default maximum of zoom factor.
        See Also:
        Constant Field Values
    • Constructor Detail

      • AbstractNavigator

        public AbstractNavigator()
        Initializes a new instance that is responsible for zooming and panning the axes with the specified names of the specified plot.
    • Method Detail

      • isZoomable

        public boolean isZoomable()
        Returns whether the associated object can be zoomed.
        Specified by:
        isZoomable in interface Navigator
        Returns:
        true if the object can be zoomed, false otherwise.
      • setZoomable

        public void setZoomable(boolean zoomable)
        Sets whether the associated object can be zoomed.
        Specified by:
        setZoomable in interface Navigator
        Parameters:
        zoomable - A value that tells whether it should be possible to zoom the associated object.
      • zoomAt

        public void zoomAt(double zoom,
                           PointND<? extends java.lang.Number> zoomPoint)
        Description copied from interface: Navigator
        Scale the associated object at the specified point. If zooming is disabled nothing will be done. If panning is disabled zooming will be applied around the current center.
        Specified by:
        zoomAt in interface Navigator
        Parameters:
        zoom - New zoom level.
        zoomPoint - Center point for zooming in world units.
      • zoomInAt

        public void zoomInAt(PointND<? extends java.lang.Number> zoomPoint)
        Description copied from interface: Navigator
        Increases the current zoom level by the specified zoom factor and scales the associated object at the specified point.
        Specified by:
        zoomInAt in interface Navigator
        Parameters:
        zoomPoint - Center point for zooming in world units.
      • zoomOutAt

        public void zoomOutAt(PointND<? extends java.lang.Number> zoomPoint)
        Description copied from interface: Navigator
        Decreases the current zoom level by the specified zoom factor and scales the associated object at the specified point.
        Specified by:
        zoomOutAt in interface Navigator
        Parameters:
        zoomPoint - Center point for zooming in world units.
      • isPannable

        public boolean isPannable()
        Returns whether the associated object can be panned.
        Specified by:
        isPannable in interface Navigator
        Returns:
        true if the object can be panned, false otherwise.
      • setPannable

        public void setPannable(boolean pannable)
        Sets whether the associated object can be panned.
        Specified by:
        setPannable in interface Navigator
        Parameters:
        pannable - A value that tells whether it should be possible to pan the associated object.
      • getZoomFactor

        public double getZoomFactor()
        Returns the factor which is used to change the zoom level on zoom in/out actions.
        Specified by:
        getZoomFactor in interface Navigator
        Returns:
        The current zoom factor.
      • setZoomFactor

        public void setZoomFactor(double factor)
        Sets the factor which should be used to change the zoom level on zoom in/out actions.
        Specified by:
        setZoomFactor in interface Navigator
        Parameters:
        factor - The new zoom factor.
      • getZoomMin

        public double getZoomMin()
        Returns the minimal zoom factor.
        Specified by:
        getZoomMin in interface Navigator
        Returns:
        Minimal zoom factor.
      • setZoomMin

        public void setZoomMin(double min)
        Sets the minimal zoom factor.
        Specified by:
        setZoomMin in interface Navigator
        Parameters:
        min - New minimal zoom factor.
      • getZoomMax

        public double getZoomMax()
        Returns the minimal zoom factor.
        Specified by:
        getZoomMax in interface Navigator
        Returns:
        Maximal zoom factor.
      • setZoomMax

        public void setZoomMax(double max)
        Sets the maximal zoom factor.
        Specified by:
        setZoomMax in interface Navigator
        Parameters:
        max - New maximal zoom factor.
      • addNavigationListener

        public void addNavigationListener(NavigationListener l)
        Adds the specified listener object that gets notified on changes to navigation information like panning or zooming.
        Specified by:
        addNavigationListener in interface Navigator
        Parameters:
        l - Listener object
      • removeNavigationListener

        public void removeNavigationListener(NavigationListener l)
        Removes the specified listener object, i.e. it doesn't get notified on changes to navigation information like panning or zooming.
        Specified by:
        removeNavigationListener in interface Navigator
        Parameters:
        l - Listener object
      • getDirection

        public NavigationDirection getDirection()
        Returns the current direction of the components that will be taken into account for zooming and panning.
        Specified by:
        getDirection in interface Navigator
        Returns:
        Direction.
      • setDirection

        public void setDirection(NavigationDirection direction)
        Sets the direction of the components that will be taken into account for zooming and panning.
        Specified by:
        setDirection in interface Navigator
        Parameters:
        direction - Direction.
      • connect

        public void connect(Navigator navigator)
        Couples the actions of the current and the specified navigator. All actions applied to this navigator will be also applied to the specified navigator and vice versa.
        Specified by:
        connect in interface Navigator
        Parameters:
        navigator - Navigator which should be bound to this instance.
      • disconnect

        public void disconnect(Navigator navigator)
        Decouples the actions of the current and the connected specified navigator. All actions will be applied separately to each navigator.
        Specified by:
        disconnect in interface Navigator
        Parameters:
        navigator - Navigator to be bound to this instance.
      • centerChanged

        public void centerChanged(NavigationEvent<PointND<? extends java.lang.Number>> event)
        A method that gets called after the center of an object in a connected PlotNavigator has changed.
        Specified by:
        centerChanged in interface NavigationListener
        Parameters:
        event - An object describing the change event.
      • zoomChanged

        public void zoomChanged(NavigationEvent<java.lang.Double> event)
        A method that gets called after the zoom level of an object in a connected PlotNavigator has changed.
        Specified by:
        zoomChanged in interface NavigationListener
        Parameters:
        event - An object describing the change event.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.