Class TLspMagnifierController

java.lang.Object
com.luciad.view.lightspeed.controller.ALspController
com.luciad.view.lightspeed.controller.visualinspection.TLspMagnifierController
All Implemented Interfaces:
ILcdAWTEventListener, ILspController

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.

Since:
2020.0
See Also:
  • 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 coordinates
      aZoomFactor - 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

      protected void startInteractionImpl(ILspView aView)
      Description copied from class: ALspController
      The specific implementation of startInteraction for this controller.
      Overrides:
      startInteractionImpl in class ALspController
      Parameters:
      aView - the view to start interaction with.
    • terminateInteractionImpl

      protected void terminateInteractionImpl(ILspView aView)
      Description copied from class: ALspController
      The specific implementation of terminateInteraction for this controller.
      Overrides:
      terminateInteractionImpl in class ALspController
      Parameters:
      aView - the view to terminate interaction with.
    • handleAWTEventImpl

      public AWTEvent handleAWTEventImpl(AWTEvent aAWTEvent)
      Description copied from class: ALspController
      Called by 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 TLcdTouchEvents). When the controller did not use the given event, it is returned unaltered.
      Specified by:
      handleAWTEventImpl in class ALspController
      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

      public Event handleFXEventImpl(Event aEvent)
      Description copied from class: ALspController
      Called by handleFXEvent. Returns null when the controller consumed the event. When the controller did not use the given event, it is returned unaltered.
      Overrides:
      handleFXEventImpl in class ALspController
      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-coordinate
      aY - the y-coordinate
    • getPosition

      public ILcdPoint 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