public class TLspPointTranslationHandle extends ALsp3StepEditHandle
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.PRIORITY_2D_CONTOUR, PRIORITY_2D_POINT, PRIORITY_2D_SHAPE, PRIORITY_3D_CONTOUR, PRIORITY_3D_POINT, PRIORITY_3D_SHAPE, PRIORITY_MULTIPLE_SHAPES
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
canActivate(AWTEvent aEvent,
TLspEditContext aEditContext)
Checks whether the handle can be activated.
|
protected boolean |
canActivate(javafx.event.Event aEvent,
TLspEditContext aEditContext)
JavaFX equivalent of
canActivate(AWTEvent, TLspEditContext) . |
protected boolean |
canDeactivate(AWTEvent aEvent,
TLspEditContext aEditContext)
Checks whether the handle can be deactivated.
|
protected boolean |
canDeactivate(javafx.event.Event aEvent,
TLspEditContext aEditContext)
JavaFX equivalent of
canDeactivate(AWTEvent, TLspEditContext) . |
protected boolean |
canProcess(AWTEvent aEvent,
TLspEditContext aEditContext)
Checks whether the given event should be processed.
|
protected boolean |
canProcess(javafx.event.Event aEvent,
TLspEditContext aEditContext)
JavaFX equivalent of
canProcess(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,
javafx.event.Event aProcessedEvent,
ELspInteractionStatus aInteractionStatus,
TLspEditContext aEditContext)
JavaFX equivalent of
createEditHandleResult(ILcdPoint, AWTEvent, ELspInteractionStatus, TLspEditContext) . |
ILcdPoint |
getPoint()
Returns the point that is set using this handle.
|
ILcdModelReference |
getPointReference()
Returns the reference in which the handle point is defined.
|
List<ALspStyleTargetProvider> |
getStyleTargetProviders(TLspHandleGeometryType aType)
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 |
isMoveOnTerrain()
Specifies if the terrain height is included when transforming the handle's model point to world
coordinates.
|
boolean |
isTranslateOnDrag()
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 (after
canActivate has returned
true . |
protected TLspEditHandleResultFX |
onActivate(javafx.event.Event aEvent,
TLspEditContext aEditContext)
JavaFX equivalent of
onActivate(AWTEvent, TLspEditContext) . |
protected TLspEditHandleResult |
onDeactivate(AWTEvent aEvent,
TLspEditContext aEditContext)
Performs some action with the event after the handle is deactivated.
|
protected TLspEditHandleResultFX |
onDeactivate(javafx.event.Event aEvent,
TLspEditContext aEditContext)
JavaFX equivalent of
onDeactivate(AWTEvent, TLspEditContext) . |
protected TLspEditHandleResult |
process(AWTEvent aEvent,
TLspEditContext aEditContext)
Process the given event.
|
protected TLspEditHandleResultFX |
process(javafx.event.Event aEvent,
TLspEditContext aEditContext)
JavaFX equivalent of
process(AWTEvent, TLspEditContext) . |
boolean |
requestsFocus(AWTEvent aEvent,
TLspEditContext aEditContext)
Indicates whether this handle requests focus for the given event.
|
boolean |
requestsFocus(javafx.event.Event aEvent,
TLspEditContext aEditContext)
JavaFX equivalent of
requestsFocus(AWTEvent, TLspEditContext) . |
void |
setTranslateOnDrag(boolean aIsTranslateOnDrag)
Sets if this handle is translated when dragging the mouse, or when moving it.
|
handleAWTEvent, handleFXEvent, isActive
getGeometry
getCursor, getCursorFX, getPriority, getProperties, setCursor, setCursorFX, setPriority
public TLspPointTranslationHandle(Object aDomainObject, ILcdPoint aPoint, ILcdModelReference aPointReference)
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, or null
if this point
is interpreted in view coordinates.public boolean isTranslateOnDrag()
setTranslateOnDrag(boolean)
public void setTranslateOnDrag(boolean aIsTranslateOnDrag)
true
,
the handle is activated on the first MOUSE_PRESSED
event, translated on subsequent
MOUSE_DRAGGED
events, and deactivated after receiving a MOUSE_RELEASED
event.
If false
, this handle is is activated after an initial chain of MOUSE_PRESSED
and MOUSE_RELEASED
events (i.e. a first mouse click), translated on all subsequent
MOUSE_MOVED
events, and deactivated on a second chain of
MOUSE_PRESSED
and MOUSE_RELEASED
events. (i.e. a second click).
When using touch events, the only difference is that when this setting is set to false
,
this handle doesn't need a DOWN
event to be activated.
This setting is typically set to true
during editing, and to false
during creation.
By default, isTranslateOnDrag
returns true
aIsTranslateOnDrag
- if this handle is translated when dragging the mouse, or when moving it.public ILcdPoint getPoint()
public ILcdModelReference getPointReference()
protected boolean isMoveOnTerrain()
true
.true
if this handle uses the view's height provider to add terrain height to
the transformed model point, false
otherwiseprotected TLspEditHandleResult createEditHandleResult(ILcdPoint aViewPoint, AWTEvent aProcessedEvent, ELspInteractionStatus aInteractionStatus, TLspEditContext aEditContext)
null
, if the given coordinates could not be transformed.
By default, this method uses an XY Constraint
.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.protected TLspEditHandleResultFX createEditHandleResultFX(ILcdPoint aViewPoint, javafx.event.Event aProcessedEvent, ELspInteractionStatus aInteractionStatus, TLspEditContext aEditContext)
createEditHandleResult(ILcdPoint, AWTEvent, ELspInteractionStatus, TLspEditContext)
.public List<ALspStyleTargetProvider> getStyleTargetProviders(TLspHandleGeometryType aType)
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 a POINT
type. Otherwise and empty list is returned.getStyleTargetProviders
in class ALspHandle
aType
- a visual editing component type
visual editing component type
public boolean requestsFocus(AWTEvent aEvent, TLspEditContext aEditContext)
handleAWTEvent
. However, this is not ensured, because another handle may have precedence
over this handle and also request focus. Precedence is primarily determined by the
handle priority
.
The default implementation returns true
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.requestsFocus
in class ALspEditHandle
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 handledtrue
if this handle requests focus for the given event, false
otherwise.ALspHandle.isActive()
,
ALspEditHandle.handleAWTEvent(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
public boolean requestsFocus(javafx.event.Event aEvent, TLspEditContext aEditContext)
requestsFocus(AWTEvent, TLspEditContext)
.requestsFocus
in class ALspEditHandle
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 handledtrue
if this handle requests focus for the given event, false
otherwise.protected TLspEditHandleResult onActivate(AWTEvent aEvent, TLspEditContext aEditContext)
canActivate
has returned
true
.
By default this method generates a edit handle result containing no operations, with the
interaction status IN_PROGRESS
.onActivate
in class ALsp3StepEditHandle
aEvent
- the event that caused the handle to be activatedaEditContext
- the edit contextnull
.ALspEditHandle.handleAWTEvent(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
,
ALsp3StepEditHandle.canActivate(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
protected TLspEditHandleResultFX onActivate(javafx.event.Event aEvent, TLspEditContext aEditContext)
onActivate(AWTEvent, TLspEditContext)
.onActivate
in class ALsp3StepEditHandle
aEvent
- the event that caused the handle to be activatedaEditContext
- the edit contextnull
.protected TLspEditHandleResult onDeactivate(AWTEvent aEvent, TLspEditContext aEditContext)
MOVE
operation, or no operations, depending on location the given AWT event points to. The
interaction status is set to FINISHED
.onDeactivate
in class ALsp3StepEditHandle
aEvent
- the event that caused the handle to be deactivatedaEditContext
- the edit contextnull
.ALspEditHandle.handleAWTEvent(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
,
ALsp3StepEditHandle.canDeactivate(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
protected TLspEditHandleResultFX onDeactivate(javafx.event.Event aEvent, TLspEditContext aEditContext)
onDeactivate(AWTEvent, TLspEditContext)
.onDeactivate
in class ALsp3StepEditHandle
aEvent
- the event that caused the handle to be deactivatedaEditContext
- the edit contextnull
.protected TLspEditHandleResult process(AWTEvent aEvent, TLspEditContext aEditContext)
MOVE
operation. The interaction status is set to IN_PROGRESS
.process
in class ALsp3StepEditHandle
aEvent
- the event that was processedaEditContext
- the edit contextnull
.ALspEditHandle.handleAWTEvent(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
protected TLspEditHandleResultFX process(javafx.event.Event aEvent, TLspEditContext aEditContext)
process(AWTEvent, TLspEditContext)
.process
in class ALsp3StepEditHandle
aEvent
- the event that was processedaEditContext
- the edit contextnull
.protected boolean canActivate(AWTEvent aEvent, TLspEditContext aEditContext)
true
, isActive
will return true
and onActivate
is called next.
By default, this method returns true
on a mouse press or mouse click
(depending on the translation mode) that happened within the
view distance threshold set.canActivate
in class ALsp3StepEditHandle
aEvent
- the event that should be handledaEditContext
- the edit contexttrue
if the handle should be activated as a result of the given event,
false
otherwiseALspEditHandle.handleAWTEvent(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
,
ALsp3StepEditHandle.onActivate(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
protected boolean canActivate(javafx.event.Event aEvent, TLspEditContext aEditContext)
canActivate(AWTEvent, TLspEditContext)
.canActivate
in class ALsp3StepEditHandle
aEvent
- the event that should be handledaEditContext
- the edit contexttrue
if the handle should be activated as a result of the given event,
false
otherwiseprotected boolean canDeactivate(AWTEvent aEvent, TLspEditContext aEditContext)
true
,
isActive
will return false
and onDeactivate
is called next.
By default, this method returns true
if a mouse release or click happened
(depending on the translation mode set).canDeactivate
in class ALsp3StepEditHandle
aEvent
- the event that should be handledaEditContext
- the edit contexttrue
if the handle should be deactivated as a result of the given event,
false
otherwiseALspEditHandle.handleAWTEvent(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
,
ALsp3StepEditHandle.onDeactivate(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
protected boolean canDeactivate(javafx.event.Event aEvent, TLspEditContext aEditContext)
canDeactivate(AWTEvent, TLspEditContext)
.canDeactivate
in class ALsp3StepEditHandle
aEvent
- the event that should be handledaEditContext
- the edit contexttrue
if the handle should be deactivated as a result of the given event,
false
otherwiseprotected boolean canProcess(AWTEvent aEvent, TLspEditContext aEditContext)
true
,
process
is called next.
By default, this method returns true
if a mouse drag or move happened
(depending on the translation mode set).canProcess
in class ALsp3StepEditHandle
aEvent
- the event that should be handledaEditContext
- the edit contexttrue
if the handle should process this event, false
otherwise.ALspEditHandle.handleAWTEvent(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
,
ALsp3StepEditHandle.process(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
protected boolean canProcess(javafx.event.Event aEvent, TLspEditContext aEditContext)
canProcess(AWTEvent, TLspEditContext)
.canProcess
in class ALsp3StepEditHandle
aEvent
- the event that should be handledaEditContext
- the edit contexttrue
if the handle should process this event, false
otherwise.