Class AWTCameraMouseController
java.lang.Object
org.jzy3d.chart.controllers.AbstractController
org.jzy3d.chart.controllers.camera.AbstractCameraController
org.jzy3d.chart.controllers.mouse.camera.AWTCameraMouseController
- All Implemented Interfaces:
MouseListener
,MouseMotionListener
,MouseWheelListener
,EventListener
,ICameraMouseController
- Direct Known Subclasses:
AdaptiveMouseController
public class AWTCameraMouseController
extends AbstractCameraController
implements MouseListener, MouseWheelListener, MouseMotionListener
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Rendering setting of mouse selection -
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected Coord2d
protected RateLimiter
protected boolean
Fields inherited from class org.jzy3d.chart.controllers.camera.AbstractCameraController
perf, threadController, updateViewDefault
Fields inherited from class org.jzy3d.chart.controllers.AbstractController
controllerListeners, target
-
Constructor Summary
ConstructorDescriptionAWTCameraMouseController
(Chart chart) AWTCameraMouseController
(Chart chart, RateLimiter limiter) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
applyMouse2DSelection
(View view) Perform the actual 2D ZOOM or UNZOOM according to the recorded mouse gesture.protected void
configureScaler
(Chart chart) This deal with HiDPI, EMulGL and Windows+AWTprotected 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)void
dispose()
protected void
drawCoord
(Graphics2D g2d, Coord2d screenPosition, int interline, String d1, String d2, boolean leftAlign) protected void
drawCoord
(Graphics2D g2d, Coord2d screenPosition, Coord3d modelPosition, int interline, boolean leftAlign) Drawing primitive for mouse tooltips.protected String
Get the rate limiter to only consider mouse events at a given rate.Get the rendering settings of the mouse annotations (2D)protected int[]
protected boolean
Handles toggle between mouse rotation/auto rotation: double-click starts the animated rotation, while simple click stops it.protected void
maintainInAxis
(Coord2d mouse) Modify the input coord2D to ensure the mouse value never stand outside of the axis bounds.protected Coord3d
modelToScreen
(Coord3d model) Perform model to screen projection smartly, considering the effect of a colorbar on the actual viewport.void
When mouse is clicked, i.e. when button is pressed and released fastvoid
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 rectanglevoid
When mouse enters the canvasvoid
When mouse goes out of the canvasvoid
When mouse moves on the canvas In 3D, drop mouse position as it should not be displayed In 2D, store mouse position to overlay coordinatesvoid
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 rectanglevoid
When mouse button is released In 3D, does nothing In 2D, perform the zoom according to the selectionvoid
When mouse wheel rotates In 3D, Update Z scale In 2D, does nothingvoid
protected Coord3d
screenToModel
(float x, float y) protected Coord3d
protected Coord3d
screenToModel
(Coord3d mouse) Perform screen to model projection smartly, considering the effect of a colorbar on the actual viewport.void
setRateLimiter
(RateLimiter rateLimiter) Provide a rate limiter to only consider mouse events at a given rate.void
setSelectionSettings
(AWTCameraMouseController.MouseSelectionSettings selectionSettings) Set all rendering settings of the mouse annotations (2D) at oncevoid
unregister
(Chart chart) protected int
x
(MouseEvent e) protected Coord2d
xy
(MouseEvent e) protected int
y
(MouseEvent e) Methods inherited from class org.jzy3d.chart.controllers.camera.AbstractCameraController
addSlaveThreadController, addThread, getLODPerf, getSlaveThreadController, getThread, isUpdateViewDefault, removeSlaveThreadController, rotate, rotate, rotate, setLODPerf, setUpdateViewDefault, shift, shift, startThreadController, stopThreadController, zoomX, zoomX, zoomY, zoomY, zoomZ, zoomZ
Methods inherited from class org.jzy3d.chart.controllers.AbstractController
addControllerEventListener, fireControllerEvent, getChart, getCharts, removeControllerEventListener
-
Field Details
-
rateLimiter
-
prevMouse
-
maintainInAxis
protected boolean maintainInAxis -
scaled
protected boolean scaled
-
-
Constructor Details
-
AWTCameraMouseController
public AWTCameraMouseController() -
AWTCameraMouseController
-
AWTCameraMouseController
-
-
Method Details
-
register
- Overrides:
register
in classAbstractController
-
configureScaler
This deal with HiDPI, EMulGL and Windows+AWT -
unregister
- Overrides:
unregister
in classAbstractController
-
dispose
public void dispose()- Overrides:
dispose
in classAbstractCameraController
-
getRateLimiter
Get the rate limiter to only consider mouse events at a given rate. Mainly useful for EmulGL to deal with liveness effect. -
setRateLimiter
Provide a rate limiter to only consider mouse events at a given rate. Mainly useful for EmulGL to deal with liveness effect. -
getSelectionSettings
Get the rendering settings of the mouse annotations (2D) -
setSelectionSettings
Set all rendering settings of the mouse annotations (2D) at once -
mousePressed
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 interfaceMouseListener
-
mouseDragged
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 interfaceMouseMotionListener
-
mouseReleased
When mouse button is released- In 3D, does nothing
- In 2D, perform the zoom according to the selection
- Specified by:
mouseReleased
in interfaceMouseListener
-
mouseWheelMoved
When mouse wheel rotates- In 3D, Update Z scale
- In 2D, does nothing
- Specified by:
mouseWheelMoved
in interfaceMouseWheelListener
-
mouseMoved
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 interfaceMouseMotionListener
-
mouseExited
When mouse goes out of the canvas- Specified by:
mouseExited
in interfaceMouseListener
-
mouseClicked
When mouse is clicked, i.e. when button is pressed and released fast- Specified by:
mouseClicked
in interfaceMouseListener
-
mouseEntered
When mouse enters the canvas- Specified by:
mouseEntered
in interfaceMouseListener
-
applyMouse2DSelection
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
Modify the input coord2D to ensure the mouse value never stand outside of the axis bounds. -
handleSlaveThread
Handles toggle between mouse rotation/auto rotation: double-click starts the animated rotation, while simple click stops it. -
xy
-
y
-
x
-
modelToScreen
Perform model to screen projection smartly, considering the effect of a colorbar on the actual viewport. -
screenToModel
-
screenToModel
-
screenToModel
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
-