public abstract class ALspOutlineResizeHandle 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.
When using touch events, this handle is activated on DOWN
events, processes
MOVED
events, and is deactivated on UP
events.
This class can be implemented by implementing the following methods:
calculateClosestReferencePoint
: Calculates the
reference point of the given object that lies closest to the given point. The reference point
can for example be the center of a circle, a point on the point list representing the axis of
a buffer, etc.getPropertyName
: Determines the property name used
in the returned PROPERTY_CHANGE
operation.PRIORITY_2D_CONTOUR, PRIORITY_2D_POINT, PRIORITY_2D_SHAPE, PRIORITY_3D_CONTOUR, PRIORITY_3D_POINT, PRIORITY_3D_SHAPE, PRIORITY_MULTIPLE_SHAPES
Modifier | Constructor and Description |
---|---|
protected |
ALspOutlineResizeHandle(Object aGeometry)
Constructs an outline resize handle for the given editor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract ILcdPoint |
calculateClosestReferencePoint(ILcdPoint aModelPoint,
Object aObject,
TLspContext aContext)
Retrieves the reference point of the given object that lies closest to the given point.
|
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 abstract String |
getPropertyName()
Returns the property name to be used by the generated property change descriptors created by this handle.
|
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.
|
TLspEditHandleResult |
handleAWTEvent(AWTEvent aEvent,
TLspEditContext aEditContext)
Handle the given input event for the given edit context.
|
TLspEditHandleResultFX |
handleFXEvent(javafx.event.Event aEvent,
TLspEditContext aEditContext)
JavaFX equivalent of
ALsp3StepEditHandle.handleAWTEvent(AWTEvent, TLspEditContext) . |
protected boolean |
isOutlineTouched(int aX,
int aY,
TLspEditContext aEditContext)
Checks if the outline of the given object is touched, based on the given view 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.
|
isActive
getGeometry
getCursor, getCursorFX, getPriority, getProperties, setCursor, setCursorFX, setPriority
protected ALspOutlineResizeHandle(Object aGeometry)
aGeometry
- The geometry (shape) that will be edited by this handle. This argument is used
to visualize the outline handle.public boolean isTranslateOnDrag()
setTranslateOnDrag(boolean)
public void setTranslateOnDrag(boolean aIsTranslateOnDrag)
true
,
the handle is activated using a MOUSE_PRESSED
event, translated using a
MOUSE_DRAGGED
event, and deactivated using a MOUSE_RELEASED
event.
If false
, this handle is activate using a MOUSE_RELEASED
event,
translated using a MOUSE_MOVED
event, and deactivated using a MOUSE_RELEASED
event.
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.protected abstract String getPropertyName()
protected boolean isOutlineTouched(int aX, int aY, TLspEditContext aEditContext)
aX
- mouse xaY
- mouse yaEditContext
- the edit contextprotected abstract ILcdPoint calculateClosestReferencePoint(ILcdPoint aModelPoint, Object aObject, TLspContext aContext)
null
. In that case,
no operation will be created.aModelPoint
- the model point for which the closest point on the reference axis
should be calculated.aObject
- the domain objectaContext
- the contextnull
if no such point can be calculated.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
when this handle is active, or when
the outline is touched.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.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 object itself
(or its base shape for an extruded shape) for the VisualHandleComponentType
OUTLINE
. Returns an empty list for all other requests.getStyleTargetProviders
in class ALspHandle
aType
- the handle component type for which the visual representations are to be
retrievednull
depending on the visual handle
component type requestedprotected TLspEditHandleResult onActivate(AWTEvent aEvent, TLspEditContext aEditContext)
canActivate
has returned
true
.
By default, this method returns a edit handle result without operations and interaction status
IN_PROGRESS
.
Override this method to provide custom behavior. In that case, also make sure to call the
super method.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)
PROPERTY_CHANGE
operation and interaction status FINISHED
. The property chang descriptor describes a
property change with the name provided by getPropertyName
, and the
closest point on the reference axis.
Override this method to provide custom behavior. In that case, also make sure to call the
super method.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)
PROPERTY_CHANGE
operation and interaction status IN_PROGRESS
. The property chang descriptor describes a
property change with the name provided by getPropertyName
, and the
closest point on the reference axis.
Override this method to provide custom behavior. In that case, also make sure to call the
super method.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
when the input event is a mouse pressed/click
event (depending on the translation mode), and when the outline is touched
as indicated by isOutlineTouched
.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
when the input event is a mouse release/click
event (depending on the translation mode).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/move happened
(depending on the translation mode).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.public TLspEditHandleResult handleAWTEvent(AWTEvent aEvent, TLspEditContext aEditContext)
ALsp3StepEditHandle
null
event to indicate that the event has been consumed. Note that sometimes an event might be
partially consumed (which is often the case with touch events), in which case this method
will return an edit handle result with an altered version of the given input event.
If incoming event should be ignored, this method should return a TLspEditHandleResult
without any edit operations, and an unconsumed AWTEvent
. An unconsumed AWTEvent
means that it should contain the original, unmodified aEvent
parameter passed to this
method. This result indicates that the event was not consumed, and that some other object needs to
consume the event instead.
As a side effect, a handle is allowed to activate or deactivate itself as a result
of processing an input event.
This method performs the handling of AWT events into 3 steps.
onActivate
is called.process
is called. This step is typically
performed for multiple events.onDeactivate
is called, and the handle becomes
inactive (isActive
returns false
).handleAWTEvent
in class ALsp3StepEditHandle
aEvent
- the input eventaEditContext
- 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 handlednull
.ALspHandle.isActive()
public TLspEditHandleResultFX handleFXEvent(javafx.event.Event aEvent, TLspEditContext aEditContext)
ALsp3StepEditHandle
ALsp3StepEditHandle.handleAWTEvent(AWTEvent, TLspEditContext)
.handleFXEvent
in class ALsp3StepEditHandle
aEvent
- the input eventaEditContext
- 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 handlednull
.