Class TLspMagnifierController
- All Implemented Interfaces:
ILcdAWTEventListener
,ILspController
Mouse controller that allows to zoom in on a part of the view. The zoomed in part of the view is shown in a
square overlay that follows the mouse position.
The overlay window is moved by moving the mouse over the view. The zoom factor and size of the magnifier can be
changed by holding shift or ctrl respectively and scrolling the mouse wheel. These variables can also be set
programmatically with the corresponding setters.
World sized objects will be scaled in the magnifier overlay while view sized objects will have the same size
as in the main view.
By default, mouse events will overwrite values set programmatically with moveTo(int, int)
, setSize(int)
or
setZoomFactor(double)
. This can be adapted by overriding handleAWTEventImpl(java.awt.AWTEvent)
and ignoring the unwanted
mouse events.
This class can also be used to implement a programmatic magnifier action. In this case, please ensure to call
ALspController.startInteraction(com.luciad.view.lightspeed.ILspView)
and ALspController.terminateInteraction(com.luciad.view.lightspeed.ILspView)
respectively before and after interacting with the
view.
This controller does not work on stereo views.
- Since:
- 2020.0
- See Also:
-
Constructor Summary
ConstructorDescriptionTLspMagnifierController
(int aSize, double aZoomFactor) Constructs a new controller that allows to zoom in on a part of the view. -
Method Summary
Modifier and TypeMethodDescriptionReturns the position of the magnifier center.int
getSize()
Returns the size of the magnifier overlay.double
Returns the zoom factor of the magnifier.handleAWTEventImpl
(AWTEvent aAWTEvent) Called byhandleAWTEvent
.handleFXEventImpl
(Event aEvent) Called byhandleFXEvent
.void
moveTo
(int aX, int aY) Sets the magnifier center in view coordinates.void
setSize
(int aSize) Sets the size of the magnifier overlay.void
setZoomFactor
(double aZoomFactor) Sets the zoomFactor factor of the magnifier.protected void
startInteractionImpl
(ILspView aView) The specific implementation ofstartInteraction
for this controller.protected void
terminateInteractionImpl
(ILspView aView) The specific implementation ofterminateInteraction
for this controller.Methods inherited from class com.luciad.view.lightspeed.controller.ALspController
addPropertyChangeListener, addStatusListener, appendController, firePropertyChange, fireStatusEvent, getAWTFilter, getCursor, getFXCursor, getFXFilter, getIcon, getLayered, getName, getNextController, getShortDescription, getView, handleAWTEvent, handleFXEvent, paint, paintImpl, registerViewPropertyNameForReset, removePropertyChangeListener, removeStatusListener, setAWTFilter, setCursor, setFXCursor, setFXFilter, setIcon, setName, setShortDescription, startInteraction, terminateInteraction
-
Constructor Details
-
TLspMagnifierController
public TLspMagnifierController(int aSize, double aZoomFactor) Constructs a new controller that allows to zoom in on a part of the view. The zoomed in part of the view is shown in a square overlay that follows the mouse position.- Parameters:
aSize
- the width and height of the magnifier overlay defined in view coordinatesaZoomFactor
- the zoom factor of the magnifier. The zoom factor is equal to how much larger world sized objects will appear in the magnifier overlay than in the main view
-
-
Method Details
-
startInteractionImpl
Description copied from class:ALspController
The specific implementation ofstartInteraction
for this controller.- Overrides:
startInteractionImpl
in classALspController
- Parameters:
aView
- the view to start interaction with.
-
terminateInteractionImpl
Description copied from class:ALspController
The specific implementation ofterminateInteraction
for this controller.- Overrides:
terminateInteractionImpl
in classALspController
- Parameters:
aView
- the view to terminate interaction with.
-
handleAWTEventImpl
Description copied from class:ALspController
Called byhandleAWTEvent
. Returnsnull
when the controller consumed the event or a partially consumed event when the controller partially consumed the event (which could happen withTLcdTouchEvent
s). When the controller did not use the given event, it is returned unaltered.- Specified by:
handleAWTEventImpl
in classALspController
- Parameters:
aAWTEvent
- the event to be handled.- Returns:
null
when the input event was consumed, the (possibly modified) input event when it was (partially) consumed.
-
handleFXEventImpl
Description copied from class:ALspController
Called byhandleFXEvent
. Returnsnull
when the controller consumed the event. When the controller did not use the given event, it is returned unaltered.- Overrides:
handleFXEventImpl
in classALspController
- Parameters:
aEvent
- the event to be handled.- Returns:
null
when the input event was consumed, the (possibly modified) input event when it was (partially) consumed.
-
moveTo
public void moveTo(int aX, int aY) Sets the magnifier center in view coordinates.- Parameters:
aX
- the x-coordinateaY
- the y-coordinate
-
getPosition
Returns the position of the magnifier center.- Returns:
- the magnifier center in view coordinates
-
setSize
public void setSize(int aSize) Sets the size of the magnifier overlay. The magnifier overlay is always square and centered around its position.- Parameters:
aSize
- the length of the sides of the square magnifier overlay in view coordinates.
-
getSize
public int getSize()Returns the size of the magnifier overlay. The magnifier overlay is always square and centered around its position.- Returns:
- the length of the sides of the square magnifier overlay in view coordinates.
-
setZoomFactor
public void setZoomFactor(double aZoomFactor) Sets the zoomFactor factor of the magnifier.- Parameters:
aZoomFactor
- the zoom factor of the magnifier. When setting a zoom factor of 2, world sized objects will appear 2 times larger in the magnifier overlay than in the main view.
-
getZoomFactor
public double getZoomFactor()Returns the zoom factor of the magnifier.- Returns:
- the zoom factor of the magnifier. The zoom factor is equal to how much larger world sized objects will appear in the magnifier overlay than in the main view
-