Class ALspOutlineResizeHandle
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.ALspOutlineResizeHandle
Base implementation of a handle that allows resizing or scaling of domain objects
by dragging their outline.
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.
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 returnedPROPERTY_CHANGE
operation.
- 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
ALspOutlineResizeHandle
(Object aGeometry) Constructs an outline resize handle for the given editor. -
Method Summary
Modifier and TypeMethodDescriptionprotected 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
(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 abstract String
Returns the property name to be used by the generated property change descriptors created by this handle.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.handleAWTEvent
(AWTEvent aEvent, TLspEditContext aEditContext) Handle the given input event for the given edit context.handleFXEvent
(Event aEvent, TLspEditContext aEditContext) JavaFX equivalent ofALsp3StepEditHandle.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
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
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
-
ALspOutlineResizeHandle
Constructs an outline resize handle for the given editor.- Parameters:
aGeometry
- The geometry (shape) that will be edited by this handle. This argument is used to visualize the outline handle.
-
-
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.
-
getPropertyName
Returns the property name to be used by the generated property change descriptors created by this handle.- Returns:
- the property name the property change descriptor generated by this handle
-
isOutlineTouched
Checks if the outline of the given object is touched, based on the given view coordinates. The default implementation queries the layer of the handle using a touch query, using the paint representation of the handle.- Parameters:
aX
- mouse xaY
- mouse yaEditContext
- the edit context- Returns:
- true if touched, false otherwise
-
calculateClosestReferencePoint
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. 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. If no model point can be computed, this method should returnnull
. In that case, no operation will be created.- Parameters:
aModelPoint
- the model point for which the closest point on the reference axis should be calculated.aObject
- the domain objectaContext
- the context- Returns:
- the point on the reference axis of the given object that lies closest to the
given point, or
null
if no such point can be calculated.
-
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 when the outline 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
-
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 object itself (or its base shape for an extruded shape) for theVisualHandleComponentType
OUTLINE
. Returns an empty list for all other requests.- Specified by:
getStyleTargetProviders
in classALspHandle
- Parameters:
aType
- the handle component type for which the visual representations are to be retrieved- Returns:
- the provided object or its base object or
null
depending on the visual handle component type requested
-
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 with aPROPERTY_CHANGE
operation and interaction statusFINISHED
. The property chang descriptor describes a property change with the name provided bygetPropertyName
, 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.- 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 returns a edit handle result with aPROPERTY_CHANGE
operation and interaction statusIN_PROGRESS
. The property chang descriptor describes a property change with the name provided bygetPropertyName
, 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.- 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
when the input event is a mouse pressed/click event (depending on the translation mode), and when the outline is touched as indicated byisOutlineTouched
.- 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
-
handleAWTEvent
Description copied from class:ALsp3StepEditHandle
Handle the given input event for the given edit context. The edit handle can choose the operation to perform based on the type and state of the input event. When the edit handle has processed the input event, this method will return a edit handle result containing anull
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 aTLspEditHandleResult
without any edit operations, and an unconsumedAWTEvent
. An unconsumedAWTEvent
means that it should contain the original, unmodifiedaEvent
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.- Activation: First the handle checks if the handle can be activated.
If so,
onActivate
is called. - Processing: If a handle is active, the handle checks if it can process an event. If so,
process
is called. This step is typically performed for multiple events. - Deactivation: If a handle is active the handle checks if it can be deactivated. If so,
onDeactivate
is called, and the handle becomes inactive (isActive
returnsfalse
).
- Overrides:
handleAWTEvent
in classALsp3StepEditHandle
- Parameters:
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 handled- 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:
- Activation: First the handle checks if the handle can be activated.
If so,
-
handleFXEvent
Description copied from class:ALsp3StepEditHandle
JavaFX equivalent ofALsp3StepEditHandle.handleAWTEvent(AWTEvent, TLspEditContext)
.- Overrides:
handleFXEvent
in classALsp3StepEditHandle
- Parameters:
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 handled- 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
.
-