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 or circular 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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe shape of the overlay window used for the controller. -
Constructor Summary
ConstructorsConstructorDescriptionTLspMagnifierController(int aSize, double aZoomFactor) Constructs a new controller that allows to zoom in on a part of the view.TLspMagnifierController(int aSize, double aZoomFactor, TLspMagnifierController.OverlayShape aOverlayShape) Constructs a new controller that allows to zoom in on a part of the view. -
Method Summary
Modifier and TypeMethodDescriptionReturns the overlay shape of the magnifier.Returns the position of the magnifier center.intgetSize()Returns the size of the magnifier overlay.doubleReturns the zoom factor of the magnifier.handleAWTEventImpl(AWTEvent aAWTEvent) Called byhandleAWTEvent.handleFXEventImpl(Event aEvent) Called byhandleFXEvent.voidmoveTo(int aX, int aY) Sets the magnifier center in view coordinates.voidsetOverlayShape(TLspMagnifierController.OverlayShape aOverlayShape) Sets the overlay shape of the magnifier.voidsetSize(int aSize) Sets the size of the magnifier overlay.voidsetZoomFactor(double aZoomFactor) Sets the zoomFactor factor of the magnifier.protected voidstartInteractionImpl(ILspView aView) The specific implementation ofstartInteractionfor this controller.protected voidterminateInteractionImpl(ILspView aView) The specific implementation ofterminateInteractionfor 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
-
TLspMagnifierController
public TLspMagnifierController(int aSize, double aZoomFactor, TLspMagnifierController.OverlayShape aOverlayShape) 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 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 willaOverlayShape- The shape of the overlay used for the controller.- Since:
- 2025.0
-
-
Method Details
-
startInteractionImpl
Description copied from class:ALspControllerThe specific implementation ofstartInteractionfor this controller.- Overrides:
startInteractionImplin classALspController- Parameters:
aView- the view to start interaction with.
-
terminateInteractionImpl
Description copied from class:ALspControllerThe specific implementation ofterminateInteractionfor this controller.- Overrides:
terminateInteractionImplin classALspController- Parameters:
aView- the view to terminate interaction with.
-
handleAWTEventImpl
Description copied from class:ALspControllerCalled byhandleAWTEvent. Returnsnullwhen the controller consumed the event or a partially consumed event when the controller partially consumed the event (which could happen withTLcdTouchEvents). When the controller did not use the given event, it is returned unaltered.- Specified by:
handleAWTEventImplin classALspController- Parameters:
aAWTEvent- the event to be handled.- Returns:
nullwhen the input event was consumed, the (possibly modified) input event when it was (partially) consumed.
-
handleFXEventImpl
Description copied from class:ALspControllerCalled byhandleFXEvent. Returnsnullwhen the controller consumed the event. When the controller did not use the given event, it is returned unaltered.- Overrides:
handleFXEventImplin classALspController- Parameters:
aEvent- the event to be handled.- Returns:
nullwhen 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 square or circular and centered around its position.- Parameters:
aSize- the length of the sides of the square magnifier overlay in view coordinates in case of a square overlay or the diameter of the circular magnifier overlay in view coordinates in case of a circular overlay.
-
getSize
public int getSize()Returns the size of the magnifier overlay. The magnifier overlay is square or circular and centered around its position.- Returns:
- the length of the sides of the square magnifier overlay in view coordinates in case of a square overlay or the diameter of the circular magnifier overlay in view coordinates in case of a circular overlay.
-
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
-
setOverlayShape
Sets the overlay shape of the magnifier.- Parameters:
aOverlayShape- The shape of the overlay used for the controller.- Since:
- 2025.0
-
getOverlayShape
Returns the overlay shape of the magnifier.- Returns:
- The shape of the overlay used for the controller.
- Since:
- 2025.0
-