Class ALspObjectTranslationHandle
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.ALspObjectTranslationHandle
- Direct Known Subclasses:
TLspObjectHeightTranslationHandle
,TLspObjectTranslationHandle
Implementation of a handle that is activated when an object is touched. This handle is similar
to a
point drag handle
, except that it works on objects instead
of points.
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 can be used for all kinds of purposes, like moving a whole object, or adjusting the
height of an object.- 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
ModifierConstructorDescriptionprotected
ALspObjectTranslationHandle
(Object aDomainObject) Creates a new touch handle for the given editor. -
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 boolean
isObjectTouched
(int aX, int aY, TLspEditContext aEditContext) Returns whether the edited object is touched.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)
.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, process, process
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, getStyleTargetProviders, setCursor, setCursorFX, setPriority
-
Constructor Details
-
ALspObjectTranslationHandle
Creates a new touch handle for the given editor.- Parameters:
aDomainObject
- the object this handle was created for
-
-
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 using aMOUSE_PRESSED
event, translated using aMOUSE_DRAGGED
event, and deactivated using aMOUSE_RELEASED
event. Iffalse
, this handle is activate using aMOUSE_RELEASED
event, translated using aMOUSE_MOVED
event, and deactivated using aMOUSE_RELEASED
event. 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.
-
isObjectTouched
Returns whether the edited object is touched. The default implementation queries the layer of the edited object using a touch query, using the paint representation specified at construction time.- Parameters:
aX
- the x coordinate in the viewaY
- the y coordinate in the viewaEditContext
- the edit context- Returns:
true
if the object is touched
-
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
when this handle is active, or if the edited object is touched.- 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
-
canActivate
Checks whether the handle can be activated. If this method returnstrue
,isActive
will returntrue
andonActivate
is called next. By default, this method returnstrue
when the input event is a mouse pressed/click event (depending on the translation mode, and when the object is touched as indicated byisObjectTouched
.- 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
when the input event is a mouse release/click event (depending on the translation mode).- 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/move happened (depending on the translation mode).- 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
-
onActivate
Called when this handle is activated (aftercanActivate
has returnedtrue
. By default, this method returns a edit handle result without operations and interaction statusIN_PROGRESS
. Override this method to provide custom behavior. In that case, also make sure to call the super method.- 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 returns a edit handle result without operations and interaction statusFINISHED
. Override this method to provide custom behavior. In that case, also make sure to call the super method.- 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
-