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
Nested ClassesModifier and TypeClassDescriptionstatic classRendering setting of mouse selection -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected Coord2dprotected RateLimiterprotected booleanFields inherited from class org.jzy3d.chart.controllers.camera.AbstractCameraController
perf, threadController, updateViewDefaultFields inherited from class org.jzy3d.chart.controllers.AbstractController
controllerListeners, target -
Constructor Summary
ConstructorsConstructorDescriptionAWTCameraMouseController(Chart chart) AWTCameraMouseController(Chart chart, RateLimiter limiter) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapplyMouse2DSelection(View view) Perform the actual 2D ZOOM or UNZOOM according to the recorded mouse gesture.protected voidconfigureScaler(Chart chart) This deal with HiDPI, EMulGL and Windows+AWTprotected voidconfigureZoomAccordingTo2DView(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)voiddispose()protected voiddrawCoord(Graphics2D g2d, Coord2d screenPosition, int interline, String d1, String d2, boolean leftAlign) protected voiddrawCoord(Graphics2D g2d, Coord2d screenPosition, Coord3d modelPosition, int interline, boolean leftAlign) Drawing primitive for mouse tooltips.protected StringGet the rate limiter to only consider mouse events at a given rate.Get the rendering settings of the mouse annotations (2D)protected int[]protected booleanHandles toggle between mouse rotation/auto rotation: double-click starts the animated rotation, while simple click stops it.protected voidmaintainInAxis(Coord2d mouse) Modify the input coord2D to ensure the mouse value never stand outside of the axis bounds.protected Coord3dmodelToScreen(Coord3d model) Perform model to screen projection smartly, considering the effect of a colorbar on the actual viewport.voidWhen mouse is clicked, i.e. when button is pressed and released fastvoidWhen 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 rectanglevoidWhen mouse enters the canvasvoidWhen mouse goes out of the canvasvoidWhen mouse moves on the canvas In 3D, drop mouse position as it should not be displayed In 2D, store mouse position to overlay coordinatesvoidWhen 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 rectanglevoidWhen mouse button is released In 3D, does nothing In 2D, perform the zoom according to the selectionvoidWhen mouse wheel rotates In 3D, Update Z scale In 2D, does nothingvoidprotected Coord3dscreenToModel(float x, float y) protected Coord3dprotected Coord3dscreenToModel(Coord3d mouse) Perform screen to model projection smartly, considering the effect of a colorbar on the actual viewport.voidsetRateLimiter(RateLimiter rateLimiter) Provide a rate limiter to only consider mouse events at a given rate.voidsetSelectionSettings(AWTCameraMouseController.MouseSelectionSettings selectionSettings) Set all rendering settings of the mouse annotations (2D) at oncevoidunregister(Chart chart) protected intx(MouseEvent e) protected Coord2dxy(MouseEvent e) protected inty(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, zoomZMethods 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:
registerin classAbstractController
-
configureScaler
This deal with HiDPI, EMulGL and Windows+AWT -
unregister
- Overrides:
unregisterin classAbstractController
-
dispose
public void dispose()- Overrides:
disposein 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:
mousePressedin 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:
mouseDraggedin interfaceMouseMotionListener
-
mouseReleased
When mouse button is released- In 3D, does nothing
- In 2D, perform the zoom according to the selection
- Specified by:
mouseReleasedin interfaceMouseListener
-
mouseWheelMoved
When mouse wheel rotates- In 3D, Update Z scale
- In 2D, does nothing
- Specified by:
mouseWheelMovedin 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:
mouseMovedin interfaceMouseMotionListener
-
mouseExited
When mouse goes out of the canvas- Specified by:
mouseExitedin interfaceMouseListener
-
mouseClicked
When mouse is clicked, i.e. when button is pressed and released fast- Specified by:
mouseClickedin interfaceMouseListener
-
mouseEntered
When mouse enters the canvas- Specified by:
mouseEnteredin 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
-