Class AWTCameraMouseController

All Implemented Interfaces:
MouseListener, MouseMotionListener, MouseWheelListener, EventListener, ICameraMouseController
Direct Known Subclasses:
AdaptiveMouseController

public class AWTCameraMouseController extends AbstractCameraController implements MouseListener, MouseWheelListener, MouseMotionListener
  • Field Details

    • rateLimiter

      protected RateLimiter rateLimiter
    • prevMouse

      protected Coord2d prevMouse
    • maintainInAxis

      protected boolean maintainInAxis
    • scaled

      protected boolean scaled
  • Constructor Details

    • AWTCameraMouseController

      public AWTCameraMouseController()
    • AWTCameraMouseController

      public AWTCameraMouseController(Chart chart)
    • AWTCameraMouseController

      public AWTCameraMouseController(Chart chart, RateLimiter limiter)
  • Method Details

    • register

      public void register(Chart chart)
      Overrides:
      register in class AbstractController
    • configureScaler

      protected void configureScaler(Chart chart)
      This deal with HiDPI, EMulGL and Windows+AWT
    • unregister

      public void unregister(Chart chart)
      Overrides:
      unregister in class AbstractController
    • dispose

      public void dispose()
      Overrides:
      dispose in class AbstractCameraController
    • getRateLimiter

      public RateLimiter getRateLimiter()
      Get the rate limiter to only consider mouse events at a given rate. Mainly useful for EmulGL to deal with liveness effect.
    • setRateLimiter

      public void setRateLimiter(RateLimiter rateLimiter)
      Provide a rate limiter to only consider mouse events at a given rate. Mainly useful for EmulGL to deal with liveness effect.
    • getSelectionSettings

      public AWTCameraMouseController.MouseSelectionSettings getSelectionSettings()
      Get the rendering settings of the mouse annotations (2D)
    • setSelectionSettings

      public void setSelectionSettings(AWTCameraMouseController.MouseSelectionSettings selectionSettings)
      Set all rendering settings of the mouse annotations (2D) at once
    • mousePressed

      public void mousePressed(MouseEvent e)
      When a mouse button is pressed
      • In 3D, if double click, start or stop the camera rotation thread if there is any attached
      • In 2D, memorize the starting point (top left) of the selection rectangle
      Specified by:
      mousePressed in interface MouseListener
    • mouseDragged

      public void mouseDragged(MouseEvent e)
      When mouse is dragged
      • In 3D, if left button is hold, rotates the view around the center of the scene
      • In 3D, if right button is hold, shift the view along Z axis
      • In 2D, update the memory of the stop point (bottom right) of the selection rectangle
      Specified by:
      mouseDragged in interface MouseMotionListener
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      When mouse button is released
      • In 3D, does nothing
      • In 2D, perform the zoom according to the selection
      Specified by:
      mouseReleased in interface MouseListener
    • mouseWheelMoved

      public void mouseWheelMoved(MouseWheelEvent e)
      When mouse wheel rotates
      • In 3D, Update Z scale
      • In 2D, does nothing
      Specified by:
      mouseWheelMoved in interface MouseWheelListener
    • mouseMoved

      public void mouseMoved(MouseEvent e)
      When mouse moves on the canvas
      • In 3D, drop mouse position as it should not be displayed
      • In 2D, store mouse position to overlay coordinates
      Specified by:
      mouseMoved in interface MouseMotionListener
    • mouseExited

      public void mouseExited(MouseEvent e)
      When mouse goes out of the canvas
      Specified by:
      mouseExited in interface MouseListener
    • mouseClicked

      public void mouseClicked(MouseEvent e)
      When mouse is clicked, i.e. when button is pressed and released fast
      Specified by:
      mouseClicked in interface MouseListener
    • mouseEntered

      public void mouseEntered(MouseEvent e)
      When mouse enters the canvas
      Specified by:
      mouseEntered in interface MouseListener
    • applyMouse2DSelection

      protected void applyMouse2DSelection(View view)
      Perform the actual 2D ZOOM or UNZOOM according to the recorded mouse gesture.
    • configureZoomAccordingTo2DView

      protected void configureZoomAccordingTo2DView(View view, BoundingBox3d bounds, org.jzy3d.chart.controllers.mouse.camera.AWTCameraMouseController.MouseSelection mouseSelection)
      Configure zoom according mouse selection, bounds, and current 2D (XY, XZ, etc)
    • maintainInAxis

      protected void maintainInAxis(Coord2d mouse)
      Modify the input coord2D to ensure the mouse value never stand outside of the axis bounds.
    • handleSlaveThread

      protected boolean handleSlaveThread(MouseEvent e)
      Handles toggle between mouse rotation/auto rotation: double-click starts the animated rotation, while simple click stops it.
    • xy

      protected Coord2d xy(MouseEvent e)
    • y

      protected int y(MouseEvent e)
    • x

      protected int x(MouseEvent e)
    • modelToScreen

      protected Coord3d modelToScreen(Coord3d model)
      Perform model to screen projection smartly, considering the effect of a colorbar on the actual viewport.
    • screenToModel

      protected Coord3d screenToModel(MouseEvent e)
    • screenToModel

      protected Coord3d screenToModel(float x, float y)
    • screenToModel

      protected Coord3d screenToModel(Coord3d mouse)
      Perform screen to model projection smartly, considering the effect of a colorbar on the actual viewport.
    • getViewportExcludingColorbar

      protected int[] getViewportExcludingColorbar()
    • drawCoord

      protected void drawCoord(Graphics2D g2d, Coord2d screenPosition, Coord3d modelPosition, int interline, boolean leftAlign)
      Drawing primitive for mouse tooltips. Will format according to axis tick renderers and labels.
      Parameters:
      g2d -
      screenPosition -
      modelPosition -
      interline -
      leftAlign -
    • drawCoord

      protected void drawCoord(Graphics2D g2d, Coord2d screenPosition, int interline, String d1, String d2, boolean leftAlign)
    • format

      protected String format(Axis axis, float value)