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_CHANGEoperation.
- 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
ConstructorsModifierConstructorDescriptionprotectedALspOutlineResizeHandle(Object aGeometry) Constructs an outline resize handle for the given editor. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ILcdPointcalculateClosestReferencePoint(ILcdPoint aModelPoint, Object aObject, TLspContext aContext) Retrieves the reference point of the given object that lies closest to the given point.protected booleancanActivate(AWTEvent aEvent, TLspEditContext aEditContext) Checks whether the handle can be activated.protected booleancanActivate(Event aEvent, TLspEditContext aEditContext) JavaFX equivalent ofcanActivate(AWTEvent, TLspEditContext).protected booleancanDeactivate(AWTEvent aEvent, TLspEditContext aEditContext) Checks whether the handle can be deactivated.protected booleancanDeactivate(Event aEvent, TLspEditContext aEditContext) JavaFX equivalent ofcanDeactivate(AWTEvent, TLspEditContext).protected booleancanProcess(AWTEvent aEvent, TLspEditContext aEditContext) Checks whether the given event should be processed.protected booleancanProcess(Event aEvent, TLspEditContext aEditContext) JavaFX equivalent ofcanProcess(AWTEvent, TLspEditContext).protected abstract StringReturns 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 booleanisOutlineTouched(int aX, int aY, TLspEditContext aEditContext) Checks if the outline of the given object is touched, based on the given view coordinates.booleanReturns if this handle is translated when dragging the mouse, or when moving it.protected TLspEditHandleResultonActivate(AWTEvent aEvent, TLspEditContext aEditContext) Called when this handle is activated (aftercanActivatehas returnedtrue.protected TLspEditHandleResultFXonActivate(Event aEvent, TLspEditContext aEditContext) JavaFX equivalent ofonActivate(AWTEvent, TLspEditContext).protected TLspEditHandleResultonDeactivate(AWTEvent aEvent, TLspEditContext aEditContext) Performs some action with the event after the handle is deactivated.protected TLspEditHandleResultFXonDeactivate(Event aEvent, TLspEditContext aEditContext) JavaFX equivalent ofonDeactivate(AWTEvent, TLspEditContext).protected TLspEditHandleResultprocess(AWTEvent aEvent, TLspEditContext aEditContext) Process the given event.protected TLspEditHandleResultFXprocess(Event aEvent, TLspEditContext aEditContext) JavaFX equivalent ofprocess(AWTEvent, TLspEditContext).booleanrequestsFocus(AWTEvent aEvent, TLspEditContext aEditContext) Indicates whether this handle requests focus for the given event.booleanrequestsFocus(Event aEvent, TLspEditContext aEditContext) JavaFX equivalent ofrequestsFocus(AWTEvent, TLspEditContext).voidsetTranslateOnDrag(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
isActiveMethods inherited from class com.luciad.view.lightspeed.editor.handle.ALspEditHandle
getGeometryMethods 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_PRESSEDevent, translated using aMOUSE_DRAGGEDevent, and deactivated using aMOUSE_RELEASEDevent. Iffalse, this handle is activate using aMOUSE_RELEASEDevent, translated using aMOUSE_MOVEDevent, and deactivated using aMOUSE_RELEASEDevent. When using touch events, the only difference is that when this setting is set tofalse, this handle doesn't need aDOWNevent to be activated. This setting is typically set totrueduring editing, and tofalseduring creation. By default,isTranslateOnDragreturnstrue- 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
nullif 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 returnstrueif 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.truewhen this handle is active, or when the outline is touched.- Overrides:
requestsFocusin 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:
trueif this handle requests focus for the given event,falseotherwise.- See Also:
-
requestsFocus
JavaFX equivalent ofrequestsFocus(AWTEvent, TLspEditContext).- Overrides:
requestsFocusin 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:
trueif this handle requests focus for the given event,falseotherwise.- 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.TLspEditHandleStylerallows 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 theVisualHandleComponentTypeOUTLINE. Returns an empty list for all other requests.- Specified by:
getStyleTargetProvidersin 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
nulldepending on the visual handle component type requested
-
onActivate
Called when this handle is activated (aftercanActivatehas 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:
onActivatein 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:
onActivatein 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_CHANGEoperation 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:
onDeactivatein 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:
onDeactivatein 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_CHANGEoperation 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:
processin 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:
processin 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,isActivewill returntrueandonActivateis called next. By default, this method returnstruewhen 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:
canActivatein classALsp3StepEditHandle- Parameters:
aEvent- the event that should be handledaEditContext- the edit context- Returns:
trueif the handle should be activated as a result of the given event,falseotherwise- See Also:
-
canActivate
JavaFX equivalent ofcanActivate(AWTEvent, TLspEditContext).- Overrides:
canActivatein classALsp3StepEditHandle- Parameters:
aEvent- the event that should be handledaEditContext- the edit context- Returns:
trueif the handle should be activated as a result of the given event,falseotherwise- Since:
- 2020.0
-
canDeactivate
Checks whether the handle can be deactivated. If this method returnstrue,isActivewill returnfalseandonDeactivateis called next. By default, this method returnstruewhen the input event is a mouse release/click event (depending on the translation mode).- Specified by:
canDeactivatein classALsp3StepEditHandle- Parameters:
aEvent- the event that should be handledaEditContext- the edit context- Returns:
trueif the handle should be deactivated as a result of the given event,falseotherwise- See Also:
-
canDeactivate
JavaFX equivalent ofcanDeactivate(AWTEvent, TLspEditContext).- Overrides:
canDeactivatein classALsp3StepEditHandle- Parameters:
aEvent- the event that should be handledaEditContext- the edit context- Returns:
trueif the handle should be deactivated as a result of the given event,falseotherwise- Since:
- 2020.0
-
canProcess
Checks whether the given event should be processed. If this method returnstrue,processis called next. By default, this method returnstrueif a mouse drag/move happened (depending on the translation mode).- Specified by:
canProcessin classALsp3StepEditHandle- Parameters:
aEvent- the event that should be handledaEditContext- the edit context- Returns:
trueif the handle should process this event,falseotherwise.- See Also:
-
canProcess
JavaFX equivalent ofcanProcess(AWTEvent, TLspEditContext).- Overrides:
canProcessin classALsp3StepEditHandle- Parameters:
aEvent- the event that should be handledaEditContext- the edit context- Returns:
trueif the handle should process this event,falseotherwise.- Since:
- 2020.0
-
handleAWTEvent
Description copied from class:ALsp3StepEditHandleHandle 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 anullevent 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 aTLspEditHandleResultwithout any edit operations, and an unconsumedAWTEvent. An unconsumedAWTEventmeans that it should contain the original, unmodifiedaEventparameter 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,
onActivateis called. - Processing: If a handle is active, the handle checks if it can process an event. If so,
processis 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,
onDeactivateis called, and the handle becomes inactive (isActivereturnsfalse).
- Overrides:
handleAWTEventin 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:ALsp3StepEditHandleJavaFX equivalent ofALsp3StepEditHandle.handleAWTEvent(AWTEvent, TLspEditContext).- Overrides:
handleFXEventin 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.
-