public interface ILspController extends ILcdAWTEventListener
ILspView
. When a controller is
assigned to a view (using setController
),
startInteraction
is called. From then on, the controller is responsible for interpreting the user
interaction on the view, until terminateInteraction
is called for
that view.
Interpreting the user interaction may consist of changing the internal state
of the view or any of its constituents. For example, a zoom controller may
change the view's scale, while a select controller may change the selection
state of an object in a layer which is part of the view. Note that
consumption of user interaction is not part of this interface, but is
performed by the view, which will forward input events to the controller's
handleAWTEvent
method.
The controller may indicate how user interaction is interpreted by rendering
visual feedback on the view using the paint
method. Note that the
controller is responsible for repainting the view as needed. To distinguish
between controllers, each controller has a name, a short description and an
ILcdIcon
.
Controllers are designed to be an element in a controller chain, passing along events and method calls.
A controller keeps a reference to the next controller in the chain. The controller is free to decide what methods and/or events should be delegated to the rest of the chain.
Note that input events received by a controller may contain a position expressed
in "toolkit coordinates". On systems that use DPI scaling, these do not correspond to
Lightspeed view coordinates. Users who wish to transform the cursor position to a
geographic location, for instance, must therefore be aware of this difference. For
more information on DPI scaling and toolkit/view coordinates, see
ALspViewXYZWorldTransformation
.
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener aListener)
Adds a
PropertyChangeListener to this ILspController . |
void |
appendController(ILspController aEnd)
This method will append the passed controller to the end of the chain.
|
ILcdIcon |
getIcon()
Gets the icon that is used for example on buttons
in the graphical user interface to identify this controller.
|
ILcdLayered |
getLayered()
Returns an
ILcdLayered for this controller. |
String |
getName()
Gets the name of this controller.
|
ILspController |
getNextController()
Returns a reference to the controller that is located after this one in a chain, or null
if this controller is the last element of the chain.
|
String |
getShortDescription()
Gets a short description for this controller.
|
default void |
handleFXEvent(javafx.event.Event aEvent)
Called when the controller is set on a
TLspFXView and
the view receives an input event. |
TLspPaintProgress |
paint(ILcdGLDrawable aGLDrawable,
ILspView aView,
TLspPaintPhase aPaintPhase)
Paints the visual feedback of this controller.
|
void |
removePropertyChangeListener(PropertyChangeListener aListener)
Removes the given
PropertyChangeListener from this ILspController . |
void |
startInteraction(ILspView aView)
Called to start interacting with the controller.
|
void |
terminateInteraction(ILspView aView)
Terminates interaction with this controller.
|
handleAWTEvent
default void handleFXEvent(javafx.event.Event aEvent)
TLspFXView
and
the view receives an input event.aEvent
- the event received by the viewvoid addPropertyChangeListener(PropertyChangeListener aListener)
PropertyChangeListener
to this ILspController
.aListener
- the listenervoid removePropertyChangeListener(PropertyChangeListener aListener)
PropertyChangeListener
from this ILspController
.aListener
- the listener.String getName()
String getShortDescription()
ILcdIcon getIcon()
void startInteraction(ILspView aView)
ILspView.setController(com.luciad.view.lightspeed.controller.ILspController)
.aView
- the view the controller operates onvoid terminateInteraction(ILspView aView)
ILspView.setController(com.luciad.view.lightspeed.controller.ILspController)
.aView
- the view the controller was operating onTLspPaintProgress paint(ILcdGLDrawable aGLDrawable, ILspView aView, TLspPaintPhase aPaintPhase)
aGLDrawable
- the drawable that should be painted onaView
- the view that is painted onaPaintPhase
- the current paint phaseTLspPaintProgress
object describing the completeness
of the paint operation.ILspController getNextController()
appendController(com.luciad.view.lightspeed.controller.ILspController)
void appendController(ILspController aEnd)
aEnd
- the controller to be appended to the end of the chain.ILcdLayered getLayered()
Returns an ILcdLayered
for this controller. Custom
implementations of this method should take care to return the same ILcdLayered
instance every time this method is called to guarantee correct working of the ILcdLayered
interface.
The returned layered object should contain layers that are relevant to this controller. Any view using this controller should take into account the layers of its active controller.
Note that the ILcdLayered is only allowed to contain ILspLayer
instances.