Class TranslateEditHandle
- All Implemented Interfaces:
- IEditHandle,- AutoCloseable
ITranslateEditAction.
 
 This handle can operate in 2 modes: 1) Feature mode: the handle is highlighted and can be interacted with when the feature is touched.
 
- the handle does not paint anything. It depends on the original Featurebeing painted.
- you can drag the feature
- the EditHandleState and cursor are changed accordingly
 2) Shadow geometry mode: this mode is enabled when a shadow geometry provider is configured that provides a non-null shadow geometry. A shadow geometry is a draped version of a geometry. In that case the handle is highlighted and can be interacted with when that shadow geometry is touched.
 
- the handle paints a shadow geometry
- you can drag the shadow instead of the feature
- the EditHandleState and cursor are changed accordingly
 If the shadow geometry provider returns null, Feature mode is enabled.
 
 This handle uses drag events to call ITranslateEditAction#translate.
- 
Constructor SummaryConstructorsConstructorDescriptionTranslateEditHandle(CoordinateReference reference, FeatureEditContext context) Creates a new translate handle that allows you to drag around a feature or geometry horizontally.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddEditStateObserver(IInvalidationCallback observer) Adds an observer that is called when theedit stateof this handle has changed.addOnDragAction(ITranslateEditAction action) Adds an action that will be triggered when dragging.voidclose()booleanprotected voidfinalize()Returns the current state of this handle.Returns the current mouse cursor that should be displayed for this handle.Returns the complex stroke line style that is used for shadow lines.Returns the fill style that is used when ashadow versionof a geometry is painted.Returns the current shadow geometry of this handle, ornull.Observable<@Nullable Geometry> Returns the shadow geometry provider of this handle.Returns the icon that is used when ashadow versionof a geometry is painted.Returns the line style that is used for shadow lines.intReturns the Z-order that is used for this handle's paint calls to theFeatureCanvas.inthashCode()onEvent(IInputEvent inputEvent, FeatureEditContext context) Handles the given event, and returns if the event was consumed or not.voidpaint(FeatureCanvas canvas, FeatureEditContext context) Paints this handle on the given canvas.voidremoveEditStateObserver(IInvalidationCallback observer) Removes the given observer.voidsetInvalidationCallback(IInvalidationCallback invalidationCallback) Sets the callback for the handle to call when its visual representation or cursor has changed.voidSets the complex stroke line style that is used for shadow lines.voidsetShadowFillStyle(FillStyle style) Sets the fill style that is used when ashadow versionof a geometry is painted.voidsetShadowGeometryProvider(Observable<@Nullable Geometry> shadowGeometryProvider) Sets the shadow geometry provider of this handle.voidsetShadowIcon(IIcon icon) Sets the icon that is used when ashadow versionof a geometry is painted.voidsetShadowLineStyle(LineStyle style) Sets the line style that is used for shadow lines.voidsetZOrder(int zOrder) Sets the Z-order that is used for this handle's paint calls to theFeatureCanvas.
- 
Constructor Details- 
TranslateEditHandlepublic TranslateEditHandle(@NotNull CoordinateReference reference, @NotNull FeatureEditContext context) Creates a new translate handle that allows you to drag around a feature or geometry horizontally.- Parameters:
- reference- the coordinate reference in which the translation will occur, cannot be- null
- context- the context, cannot be- null
 
 
- 
- 
Method Details- 
finalizeprotected void finalize()
- 
closepublic void close()- Specified by:
- closein interface- AutoCloseable
 
- 
onEvent@NotNull public EventResult onEvent(@NotNull IInputEvent inputEvent, @NotNull FeatureEditContext context) throws NullPointerException Handles the given event, and returns if the event was consumed or not.While handling events, IEditHandlescan mark themselves as highlighted or as Active. Related to event handling, the main effect of this is that highlighted or active handles get a higher priority compared to other handles: they get the chance to consume events first. See EditHandleState- Specified by:
- onEventin interface- IEditHandle
- Parameters:
- inputEvent- the event to handle, cannot be- null
- context- the context, cannot be- null
- Returns:
- if the event was consumed or not
- Throws:
- NullPointerException- when- nullis passed.
 
- 
paintPaints this handle on the given canvas.This method is called when - the handle's IEditHandlesfires anEditHandlesEventcontaining this handle, when the handle is newly added or removed for example.
- the handle triggers a new paint call itself by calling its invalidation callback.
 This method only gets called on the UI thread, so there is no need for additional synchronization. - Specified by:
- paintin interface- IEditHandle
- Parameters:
- canvas- the canvas on which this handle gets painted.
- context- the context, cannot be- null
 
- the handle's 
- 
getEditStateReturns the current state of this handle.- Specified by:
- getEditStatein interface- IEditHandle
- Returns:
- the current state of this handle.
 
- 
getMouseCursorReturns the current mouse cursor that should be displayed for this handle.This method typically returns a value when this handle is highlighted or active. If not, nullcan be returned.- Specified by:
- getMouseCursorin interface- IEditHandle
- Returns:
- the current mouse cursor that should be displayed for this handle.
 
- 
setInvalidationCallbackSets the callback for the handle to call when its visual representation or cursor has changed.Calling this callback triggers a new call to this handle's paintmethod.- Specified by:
- setInvalidationCallbackin interface- IEditHandle
- Parameters:
- invalidationCallback- the callback for the handle to call when its visual representation has changed
 
- 
addEditStateObserverpublic void addEditStateObserver(@NotNull IInvalidationCallback observer) throws IllegalArgumentException Adds an observer that is called when theedit stateof this handle has changed.Adding the same observer twice is forbidden, and will cause an exception to be thrown. - Specified by:
- addEditStateObserverin interface- IEditHandle
- Parameters:
- observer- an observer
- Throws:
- IllegalArgumentException- when the observer was already added.
- Since:
- 2023.1
 
- 
removeEditStateObserverpublic void removeEditStateObserver(@NotNull IInvalidationCallback observer) throws IllegalArgumentException Removes the given observer.If the given observer was never added, an exception is thrown. - Specified by:
- removeEditStateObserverin interface- IEditHandle
- Parameters:
- observer- an observer
- Throws:
- IllegalArgumentException- when the observer is not known.
- Since:
- 2023.1
 
- 
getShadowGeometryReturns the current shadow geometry of this handle, ornull.- Returns:
- the current shadow geometry of this handle, or null.
- See Also:
 
- 
getShadowGeometryProviderReturns the shadow geometry provider of this handle.Can be null.- Returns:
- the shadow geometry provider of this handle, or null.
 
- 
setShadowGeometryProviderpublic void setShadowGeometryProvider(@Nullable Observable<@Nullable Geometry> shadowGeometryProvider) Sets the shadow geometry provider of this handle.When this provider (or the geometry it returned) is null,Featuremode is enabled for this handle. SeeTranslateEditHandlefor more information.- Parameters:
- shadowGeometryProvider- the shadow geometry provider that is used by this handle. Can be- nullto disable the shadow geometry mode.
 
- 
getShadowIconReturns the icon that is used when ashadow versionof a geometry is painted.- Returns:
- the icon that is used when a shadow versionof a geometry is painted.
 
- 
setShadowIconSets the icon that is used when ashadow versionof a geometry is painted.- Parameters:
- icon- the icon that is used when a- shadow versionof a geometry is painted.
 
- 
getShadowLineStyleReturns the line style that is used for shadow lines.This method is linked to the getShadowComplexStrokeLineStylemethod:- if both of them return null, no shadow line is painted
- if one of them is not null, that shadow line style is used
- it's not possible for both methods to return a non nullvalue: they are mutually exclusive
 - Returns:
- the line style that is used for shadow lines.
 
- if both of them return 
- 
setShadowLineStyleSets the line style that is used for shadow lines.Only one shadow line style can be set, if this function is called with a non nullvalue when aComplexStrokeLineStylehas already been set, it will be overwritten.- Parameters:
- style- the line style that is used for shadow lines.
 
- 
getShadowComplexStrokeLineStyleReturns the complex stroke line style that is used for shadow lines.This method is linked to the getShadowLineStylemethod:- if both of them return null, no shadow line is painted
- if one of them is not null, that shadow line style is used
- it's not possible for both methods to return a non nullvalue: they are mutually exclusive
 - Returns:
- the complex stroke line style that is used for shadow lines.
- Since:
- 2023.1
 
- if both of them return 
- 
setShadowComplexStrokeLineStyleSets the complex stroke line style that is used for shadow lines.Only one shadow line style can be set, if this function is called with a non nullvalue when aComplexStrokeLineStylehas already been set, it will be overwritten.- Parameters:
- style- the complex stroke line style that is used for shadow lines.
- Since:
- 2023.1
 
- 
getShadowFillStyleReturns the fill style that is used when ashadow versionof a geometry is painted.- Returns:
- the fill style that is used when a shadow versionof a geometry is painted.
 
- 
setShadowFillStyleSets the fill style that is used when ashadow versionof a geometry is painted.Setting this to nullmeans the shadow version of the geometry won't have a fill style.- Parameters:
- style- fill style that is used when a shadow version of a geometry is painted.
 
- 
getZOrderpublic int getZOrder()Returns the Z-order that is used for this handle's paint calls to theFeatureCanvas.- Returns:
- the Z-order that is used for this handle's paint calls to the FeatureCanvas.
- See Also:
 
- 
setZOrderpublic void setZOrder(int zOrder) Sets the Z-order that is used for this handle's paint calls to theFeatureCanvas.This Z-order determines which handles are painted on top when multiple handles overlap. Edit handles with a higher Z-order are painted on top of handles with a lower Z-order. Note: Highlightededit handles are always painted above regular handles, andactivehandles are always painted above highlighted handles.Must be between [-1000,1000]. The default value is 0. - Parameters:
- zOrder- the Z-order that is used for this handle's paint calls to the- FeatureCanvas.
- See Also:
 
- 
addOnDragActionAdds an action that will be triggered when dragging.For every drag event, the following method call will be triggered: - ITranslateEditAction#translateat the end of the drag sequence, or on every drag update when- EditActionBinder#performOnIntermediateEventsis set to true
 - Parameters:
- action- the action to be performed on drag, cannot be- null.
- Returns:
- an object on which you can specify more options or requirements regarding the given on-drag action, such as the mouse buttons that need to be pressed for the action to be executed.
 
- 
hashCodepublic int hashCode()
- 
equals
 
-