Class TLspPointTranslationHandle
java.lang.Object
com.luciad.view.lightspeed.editor.handle.ALspHandle
com.luciad.view.lightspeed.editor.handle.ALspEditHandle
com.luciad.view.lightspeed.editor.handle.ALsp3StepEditHandle
com.luciad.view.lightspeed.editor.handle.TLspPointTranslationHandle
Base implementation of a handle that allows a point to be moved/dragged around.
This handle has two translate modes: either by dragging the mouse, or by moving it in between
two clicks. See
setTranslateOnDrag
. When true
,
the handle is activated/deactivated using mouse press and release events and changed using mouse
dragged events. Otherwise, the handle is activated/deactivated using mouse clicks and changed
by moving the mouse when active.
When using touch events, this handle is activated on DOWN
events, processes
MOVED
events, and is deactivated on UP
events.
This handle produces move operations objects where the result
is set to the model coordinates of the position where the handle was dragged.
This handle can be used for all kinds of purposes, like moving the point of a
point list, moving
a control point of an arc, or
changing the height of an extruded shape.- Since:
- 2012.0
-
Field Summary
Fields inherited from class com.luciad.view.lightspeed.editor.handle.ALspHandle
PRIORITY_2D_CONTOUR, PRIORITY_2D_POINT, PRIORITY_2D_SHAPE, PRIORITY_3D_CONTOUR, PRIORITY_3D_POINT, PRIORITY_3D_SHAPE, PRIORITY_MULTIPLE_SHAPES
-
Constructor Summary
ConstructorDescriptionTLspPointTranslationHandle
(Object aDomainObject, ILcdPoint aPoint, ILcdModelReference aPointReference) Constructs a point handle for the given editor that can be dragged or moved around with the mouse. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
canActivate
(AWTEvent aEvent, TLspEditContext aEditContext) Checks whether the handle can be activated.protected boolean
canActivate
(Event aEvent, TLspEditContext aEditContext) JavaFX equivalent ofcanActivate(AWTEvent, TLspEditContext)
.protected boolean
canDeactivate
(AWTEvent aEvent, TLspEditContext aEditContext) Checks whether the handle can be deactivated.protected boolean
canDeactivate
(Event aEvent, TLspEditContext aEditContext) JavaFX equivalent ofcanDeactivate(AWTEvent, TLspEditContext)
.protected boolean
canProcess
(AWTEvent aEvent, TLspEditContext aEditContext) Checks whether the given event should be processed.protected boolean
canProcess
(Event aEvent, TLspEditContext aEditContext) JavaFX equivalent ofcanProcess(AWTEvent, TLspEditContext)
.protected TLspEditHandleResult
createEditHandleResult
(ILcdPoint aViewPoint, AWTEvent aProcessedEvent, ELspInteractionStatus aInteractionStatus, TLspEditContext aEditContext) Creates a new edit handle result for the given view point.protected TLspEditHandleResultFX
createEditHandleResultFX
(ILcdPoint aViewPoint, Event aProcessedEvent, ELspInteractionStatus aInteractionStatus, TLspEditContext aEditContext) JavaFX equivalent ofcreateEditHandleResult(ILcdPoint, AWTEvent, ELspInteractionStatus, TLspEditContext)
.getPoint()
Returns the point that is set using this handle.Returns the reference in which the handle point is defined.Returns a style target provider that can generate geometry for the given visual editing component type, or an empty list if no geometry can be generated for the given type.protected boolean
Specifies if the terrain height is included when transforming the handle's model point to world coordinates.boolean
Returns if this handle is translated when dragging the mouse, or when moving it.protected TLspEditHandleResult
onActivate
(AWTEvent aEvent, TLspEditContext aEditContext) Called when this handle is activated (aftercanActivate
has returnedtrue
.protected TLspEditHandleResultFX
onActivate
(Event aEvent, TLspEditContext aEditContext) JavaFX equivalent ofonActivate(AWTEvent, TLspEditContext)
.protected TLspEditHandleResult
onDeactivate
(AWTEvent aEvent, TLspEditContext aEditContext) Performs some action with the event after the handle is deactivated.protected TLspEditHandleResultFX
onDeactivate
(Event aEvent, TLspEditContext aEditContext) JavaFX equivalent ofonDeactivate(AWTEvent, TLspEditContext)
.protected TLspEditHandleResult
process
(AWTEvent aEvent, TLspEditContext aEditContext) Process the given event.protected TLspEditHandleResultFX
process
(Event aEvent, TLspEditContext aEditContext) JavaFX equivalent ofprocess(AWTEvent, TLspEditContext)
.boolean
requestsFocus
(AWTEvent aEvent, TLspEditContext aEditContext) Indicates whether this handle requests focus for the given event.boolean
requestsFocus
(Event aEvent, TLspEditContext aEditContext) JavaFX equivalent ofrequestsFocus(AWTEvent, TLspEditContext)
.void
setTranslateOnDrag
(boolean aIsTranslateOnDrag) Sets if this handle is translated when dragging the mouse, or when moving it.Methods inherited from class com.luciad.view.lightspeed.editor.handle.ALsp3StepEditHandle
handleAWTEvent, handleFXEvent, isActive
Methods inherited from class com.luciad.view.lightspeed.editor.handle.ALspEditHandle
getGeometry
Methods inherited from class com.luciad.view.lightspeed.editor.handle.ALspHandle
getCursor, getCursorFX, getPriority, getProperties, setCursor, setCursorFX, setPriority
-
Constructor Details
-
TLspPointTranslationHandle
public TLspPointTranslationHandle(Object aDomainObject, ILcdPoint aPoint, ILcdModelReference aPointReference) Constructs a point handle for the given editor that can be dragged or moved around with the mouse.- Parameters:
aDomainObject
- the domain object to be editedaPoint
- the point associated with this handle. This point is always re-evaluated, so changing this point internally also modifies this handle. This makes it easy to tie this handle to a point in a pointlist for example.aPointReference
- the reference of the given point, ornull
if this point is interpreted in view coordinates.
-
-
Method Details
-
isTranslateOnDrag
public boolean isTranslateOnDrag()Returns if this handle is translated when dragging the mouse, or when moving it.- Returns:
- if this handle is translated when dragging the mouse, or when moving it.
- See Also:
-
setTranslateOnDrag
public void setTranslateOnDrag(boolean aIsTranslateOnDrag) Sets if this handle is translated when dragging the mouse, or when moving it. Iftrue
, the handle is activated on the firstMOUSE_PRESSED
event, translated on subsequentMOUSE_DRAGGED
events, and deactivated after receiving aMOUSE_RELEASED
event. Iffalse
, this handle is is activated after an initial chain ofMOUSE_PRESSED
andMOUSE_RELEASED
events (i.e. a first mouse click), translated on all subsequentMOUSE_MOVED
events, and deactivated on a second chain ofMOUSE_PRESSED
andMOUSE_RELEASED
events. (i.e. a second click). When using touch events, the only difference is that when this setting is set tofalse
, this handle doesn't need aDOWN
event to be activated. This setting is typically set totrue
during editing, and tofalse
during creation. By default,isTranslateOnDrag
returnstrue
- Parameters:
aIsTranslateOnDrag
- if this handle is translated when dragging the mouse, or when moving it.
-
getPoint
Returns the point that is set using this handle. This point is always re-evaluated, so changing this point internally also modifies this handle. This makes it easy to tie this handle to a point in a pointlist for example.- Returns:
- the point that is set using this handle.
-
getPointReference
Returns the reference in which the handle point is defined.- Returns:
- the reference in which the handle point is defined
-
isMoveOnTerrain
protected boolean isMoveOnTerrain()Specifies if the terrain height is included when transforming the handle's model point to world coordinates. If so, the handle will follow the terrain. By default, this method returnstrue
.- Returns:
true
if this handle uses the view's height provider to add terrain height to the transformed model point,false
otherwise
-
createEditHandleResult
protected TLspEditHandleResult createEditHandleResult(ILcdPoint aViewPoint, AWTEvent aProcessedEvent, ELspInteractionStatus aInteractionStatus, TLspEditContext aEditContext) Creates a new edit handle result for the given view point. By default this method will create a move descriptor containing the given X and Y coordinates, transformed to the point reference of this handle. Ornull
, if the given coordinates could not be transformed. By default, this method uses anXY Constraint
.- Parameters:
aViewPoint
- the view point from the event which triggered the call to this method.aProcessedEvent
- the processed event.aInteractionStatus
- the interaction status.aEditContext
- the edit context.- Returns:
- an edit handle result.
-
createEditHandleResultFX
protected TLspEditHandleResultFX createEditHandleResultFX(ILcdPoint aViewPoint, Event aProcessedEvent, ELspInteractionStatus aInteractionStatus, TLspEditContext aEditContext) JavaFX equivalent ofcreateEditHandleResult(ILcdPoint, AWTEvent, ELspInteractionStatus, TLspEditContext)
.- Since:
- 2020.0
-
getStyleTargetProviders
Returns a style target provider that can generate geometry for the given visual editing component type, or an empty list if no geometry can be generated for the given type.TLspEditHandleStyler
allows you to register different styles for each visual component type. By default, this method returns a style target provider that returns the point associated with this handle if the given type is aPOINT
type. Otherwise and empty list is returned.- Specified by:
getStyleTargetProviders
in classALspHandle
- Parameters:
aType
- avisual editing component type
- Returns:
- a list of style target providers, or an empty list if no style targets can be created for the given
visual editing component type
-
requestsFocus
Indicates whether this handle requests focus for the given event. The edit controller can respond to this by forwarding event objects to this handle by callinghandleAWTEvent
. However, this is not ensured, because another handle may have precedence over this handle and also request focus. Precedence is primarily determined by thehandle priority
.The default implementation returns
By default, this method returnstrue
if the handle is active. Subclasses can override this method for custom behavior. An example would be to request focus when the mouse hovers over a visual handle component.true
is this handle is active or if the given event points to a location near this handle.- Overrides:
requestsFocus
in classALspEditHandle
- Parameters:
aEvent
- the AWTEvent that might result in a focus requestaEditContext
- the edit context, containing, amongst others, information about the layer for which this handle is operating, the view, the object for which this handle was created, the geometry that this handle was created for, the paint representation in which geometry exists, and the sensitivity with which the event should be handled- Returns:
true
if this handle requests focus for the given event,false
otherwise.- See Also:
-
requestsFocus
JavaFX equivalent ofrequestsFocus(AWTEvent, TLspEditContext)
.- Overrides:
requestsFocus
in classALspEditHandle
- Parameters:
aEvent
- the AWTEvent that might result in a focus requestaEditContext
- the edit context, containing, amongst others, information about the layer for which this handle is operating, the view, the object for which this handle was created, the geometry that this handle was created for, the paint representation in which geometry exists, and the sensitivity with which the event should be handled- Returns:
true
if this handle requests focus for the given event,false
otherwise.- Since:
- 2020.0
-
onActivate
Called when this handle is activated (aftercanActivate
has returnedtrue
. By default this method generates a edit handle result containing no operations, with the interaction statusIN_PROGRESS
.- Specified by:
onActivate
in classALsp3StepEditHandle
- Parameters:
aEvent
- the event that caused the handle to be activatedaEditContext
- the edit context- Returns:
- an edit handle result containing a collection of operations to perform, and the
(partially) consumed event object. The handle result itself should not be
null
. - See Also:
-
onActivate
JavaFX equivalent ofonActivate(AWTEvent, TLspEditContext)
.- Overrides:
onActivate
in classALsp3StepEditHandle
- Parameters:
aEvent
- the event that caused the handle to be activatedaEditContext
- the edit context- Returns:
- an edit handle result containing a collection of operations to perform, and the
(partially) consumed event object. The handle result itself should not be
null
. - Since:
- 2020.0
-
onDeactivate
Performs some action with the event after the handle is deactivated. By default this method generates a edit handle result containingMOVE
operation, or no operations, depending on location the given AWT event points to. The interaction status is set toFINISHED
.- Specified by:
onDeactivate
in classALsp3StepEditHandle
- Parameters:
aEvent
- the event that caused the handle to be deactivatedaEditContext
- the edit context- Returns:
- an edit handle result containing a collection of operations to perform, and the
(partially) consumed event object. The handle result itself should not be
null
. - See Also:
-
onDeactivate
JavaFX equivalent ofonDeactivate(AWTEvent, TLspEditContext)
.- Overrides:
onDeactivate
in classALsp3StepEditHandle
- Parameters:
aEvent
- the event that caused the handle to be deactivatedaEditContext
- the edit context- Returns:
- an edit handle result containing a collection of operations to perform, and the
(partially) consumed event object. The handle result itself should not be
null
. - Since:
- 2020.0
-
process
Process the given event. This method is only called when the handle is active and processing is requested. By default this method generates a edit handle result containingMOVE
operation. The interaction status is set toIN_PROGRESS
.- Specified by:
process
in classALsp3StepEditHandle
- Parameters:
aEvent
- the event that was processedaEditContext
- the edit context- Returns:
- an edit handle result containing a collection of operations to perform, and the
(partially) consumed event object. The handle result itself should not be
null
. - See Also:
-
process
JavaFX equivalent ofprocess(AWTEvent, TLspEditContext)
.- Overrides:
process
in classALsp3StepEditHandle
- Parameters:
aEvent
- the event that was processedaEditContext
- the edit context- Returns:
- an edit handle result containing a collection of operations to perform, and the
(partially) consumed event object. The handle result itself should not be
null
. - Since:
- 2020.0
-
canActivate
Checks whether the handle can be activated. If this method returnstrue
,isActive
will returntrue
andonActivate
is called next. By default, this method returnstrue
on a mouse press or mouse click (depending on the translation mode) that happened within the view distance threshold set.- Specified by:
canActivate
in classALsp3StepEditHandle
- Parameters:
aEvent
- the event that should be handledaEditContext
- the edit context- Returns:
true
if the handle should be activated as a result of the given event,false
otherwise- See Also:
-
canActivate
JavaFX equivalent ofcanActivate(AWTEvent, TLspEditContext)
.- Overrides:
canActivate
in classALsp3StepEditHandle
- Parameters:
aEvent
- the event that should be handledaEditContext
- the edit context- Returns:
true
if the handle should be activated as a result of the given event,false
otherwise- Since:
- 2020.0
-
canDeactivate
Checks whether the handle can be deactivated. If this method returnstrue
,isActive
will returnfalse
andonDeactivate
is called next. By default, this method returnstrue
if a mouse release or click happened (depending on the translation mode set).- Specified by:
canDeactivate
in classALsp3StepEditHandle
- Parameters:
aEvent
- the event that should be handledaEditContext
- the edit context- Returns:
true
if the handle should be deactivated as a result of the given event,false
otherwise- See Also:
-
canDeactivate
JavaFX equivalent ofcanDeactivate(AWTEvent, TLspEditContext)
.- Overrides:
canDeactivate
in classALsp3StepEditHandle
- Parameters:
aEvent
- the event that should be handledaEditContext
- the edit context- Returns:
true
if the handle should be deactivated as a result of the given event,false
otherwise- Since:
- 2020.0
-
canProcess
Checks whether the given event should be processed. If this method returnstrue
,process
is called next. By default, this method returnstrue
if a mouse drag or move happened (depending on the translation mode set).- Specified by:
canProcess
in classALsp3StepEditHandle
- Parameters:
aEvent
- the event that should be handledaEditContext
- the edit context- Returns:
true
if the handle should process this event,false
otherwise.- See Also:
-
canProcess
JavaFX equivalent ofcanProcess(AWTEvent, TLspEditContext)
.- Overrides:
canProcess
in classALsp3StepEditHandle
- Parameters:
aEvent
- the event that should be handledaEditContext
- the edit context- Returns:
true
if the handle should process this event,false
otherwise.- Since:
- 2020.0
-