public class TLspMagnifierController extends ALspController
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.
com.luciad.view.lightspeed.controller.visualinspection
Constructor and Description |
---|
TLspMagnifierController(int aSize,
double aZoomFactor)
Constructs a new controller that allows to zoom in on a part of the view.
|
Modifier and Type | Method and Description |
---|---|
ILcdPoint |
getPosition()
Returns the position of the magnifier center.
|
int |
getSize()
Returns the size of the magnifier overlay.
|
double |
getZoomFactor()
Returns the zoom factor of the magnifier.
|
AWTEvent |
handleAWTEventImpl(AWTEvent aAWTEvent)
Called by
handleAWTEvent . |
javafx.event.Event |
handleFXEventImpl(javafx.event.Event aEvent)
Called by
handleFXEvent . |
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 of
startInteraction for this controller. |
protected void |
terminateInteractionImpl(ILspView aView)
The specific implementation of
terminateInteraction for this controller. |
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
public TLspMagnifierController(int aSize, double aZoomFactor)
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 viewprotected void startInteractionImpl(ILspView aView)
ALspController
startInteraction
for this controller.startInteractionImpl
in class ALspController
aView
- the view to start interaction with.protected void terminateInteractionImpl(ILspView aView)
ALspController
terminateInteraction
for this controller.terminateInteractionImpl
in class ALspController
aView
- the view to terminate interaction with.public AWTEvent handleAWTEventImpl(AWTEvent aAWTEvent)
ALspController
handleAWTEvent
.
Returns null
when the controller consumed the event or a partially consumed event
when the controller partially consumed the event (which could happen with
TLcdTouchEvent
s). When the controller did not use the given event, it is returned
unaltered.handleAWTEventImpl
in class ALspController
aAWTEvent
- the event to be handled.null
when the input event was consumed, the (possibly modified) input
event when it was (partially) consumed.public javafx.event.Event handleFXEventImpl(javafx.event.Event aEvent)
ALspController
handleFXEvent
.
Returns null
when the controller consumed the event. When the controller did not use the
given event, it is returned unaltered.handleFXEventImpl
in class ALspController
aEvent
- the event to be handled.null
when the input event was consumed, the (possibly modified) input
event when it was (partially) consumed.public void moveTo(int aX, int aY)
aX
- the x-coordinateaY
- the y-coordinatepublic ILcdPoint getPosition()
public void setSize(int aSize)
aSize
- the length of the sides of the square magnifier overlay in view coordinates.public int getSize()
public void setZoomFactor(double aZoomFactor)
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.public double getZoomFactor()