Last updated

API / geotoolkit / welllog / widgets / tools / CurveEditor / CurveEditor

Class: CurveEditor

tools.CurveEditor.CurveEditor

Implements a tool capable of editing log curve sample points.

When given a curve, this tool will create a set of manipulatable handles corresponding with each data sample point. If the curve is step interpolated, then the tool will build a set of lines covering the entire curve. Curve editing tool does not edit the actual curve which it is corresponded with, instead, each manipulation results in an event describing the action and changes. The tool can work in three modes: Edit, Insert, and Delete.

Edit Mode:

Provides a set of handles which become activated when clicked, and deactivated when released, and dragged with the mouse when the mouse pointer is moved.

  • When a mouse down occurs, "dragstart" event is fired with parameters:
    • depth: The depth (y) in curve model which belongs to the point where mouse down occurred
    • value: The value (x) in curve model which belongs to the point where mouse down occurred
  • When a mouse up occurs, "dragend" event is fired with parameters:
    • depth: The depth (y) in curve model which belongs to the point where mouse up occurred
    • value: The value (x) in curve model which belongs to the point where mouse up occurred
    • index: The index of manipulated data point in the original data set
  • If a mouse move occurs, "dragging" event is fired with parameters:
    • oldDepth: the depth (y) of the handle before the dragging occurred
    • oldValue: the value (x) of the handle before the dragging occurred
    • depth: the new depth (y) of the handle, resultant from the dragging action
    • value: the new value (x) of the handle, resultant from the dragging action
    • index: the index of the data sample (in the array of all data samples of the curve corresponding to this tool), which is being manipulated

Insert Mode:

Fires an "insert" event when a mouse down on the track occurs, also fires "move" event when the mouse pointer moves across the curve.

  • If a mouse move occurs, "move" event is fired with following arguments:
    • depth: The depth (y) of the mouse pointer in the curve model
    • value: The value (x) of the mouse pointer in the curve model
    • handleDepth: The depth of the handle which moves along the curve as the projection of the mouse pointer position
    • handleValue: The value of the handle which moves along the curve as the projection of the mouse pointer position
  • When a mouse down occurs, "insert" event is fired with following arguments:
    • depth: The depth (y) of the mouse pointer in the curve model
    • value: The value (x) of the mouse pointer in the curve model
    • handleDepth: The depth of the handle which moves along the curve as the projection of the mouse pointer position
    • handleValue: The value of the handle which moves along the curve as the projection of the mouse pointer position

Delete Mode:

Fires a "delete" event with handle info every time a mouse down occurs on a handle.

  • When a mouse down occurs on top of a handle, a "delete" event is fired with parameters:
    • depth: The depth of the data point corresponding to the handle
    • value: The value of the data point corresponding to the handle
    • index: The index of the data point in the original data set

NOTE: If the curve is interpolated with StartStep, MiddleStep, or EndStep, the tool will draw lines between each point,
and the events will be fired with the information about the point which the tool edits. However, in case of Middle Step, the point divides some lines in two, and some lines do not have any original data set points to manipulate:
p1----------p2 (p1 and p2 are not registered in curve data set)
|
|
p3 (this is the only point which actually existed in the data set)
|
|
p5----------p4 (p4 and p4 are not registered in curve data set)

Hierarchy

Table of contents

Constructors
[new CurveEditor()](/solutions/geotoolkit/apis/classes/geotoolkit.welllog.widgets-4.tools-5.curveeditor.curveeditor.md#new curveeditor())[new CurveEditor(layer, cachedManipulatorLayer)](/solutions/geotoolkit/apis/classes/geotoolkit.welllog.widgets-4.tools-5.curveeditor.curveeditor.md#new curveeditor(layer, cachedmanipulatorlayer))[new CurveEditor(options)](/solutions/geotoolkit/apis/classes/geotoolkit.welllog.widgets-4.tools-5.curveeditor.curveeditor.md#new curveeditor(options))
Methods
Css Properties
Name Type Description
cachedlayerGroupLayer to which handles will be added. Cache enabled
cachedlayer-automodellimitsmodebooleanAuto model limits mode
cachedlayer-boundsRectDefine position of the group in the parent
cachedlayer-bounds-heightnumberHeight
cachedlayer-bounds-readonlybooleanReadonly
cachedlayer-bounds-widthnumberWidth
cachedlayer-bounds-xnumberLeft
cachedlayer-bounds-ynumberTop
cachedlayer-clippingbooleanEnable clipping, this does not consider the clipstyle, it is related to bounds-clipping
cachedlayer-clipstyleClipStyleClipping style
cachedlayer-clipstyle-evenoddbooleanTrue if evenodd mode is on ('nonzero' mode otherwise)
cachedlayer-clipstyle-geometryGraphicsPathClipping geometry
cachedlayer-clipstyle-geometry-boundsRectBounds
cachedlayer-clipstyleGraphicsPathClipping style
cachedlayer-contentorientationOrientationContent orientation
cachedlayer-cssclassstringThe css class name of this node
cachedlayer-csscursorstringCSS cursor associated with node
cachedlayer-cssstylestringCSS style to be applied to inserted elements
cachedlayer-fillstylestringFill style
cachedlayer-fillstyleFillStyleFill style
cachedlayer-fillstyle-colorstringColor in CSS form
cachedlayer-fillstyle-evenoddmodebooleanEven-odd fill mode
cachedlayer-fillstyle-fillpatternPatternPattern
cachedlayer-fillstyle-fillpattern-containernamestringAn optional container name, which creates an image pattern. This parameter is used for serialization if you want to save are reference to pattern instead of the pattern itself
cachedlayer-fillstyle-fillpattern-patternnamestringName of this pattern for indexing
cachedlayer-fillstyle-fillpattern-scalablebooleanFlag that sets scalability of the pattern coordinates, or relative to the shape it is filling (It is not supported)
cachedlayer-fillstyle-foregroundstringForeground color
cachedlayer-fillstyle-patternPatternPattern
cachedlayer-horizontalflipbooleanHorizontal axis goes from right to left
cachedlayer-idstring | numberId of the node, its a unique identifier
cachedlayer-infinitybooleanMode to render outside the model limits
cachedlayer-layoutstyleLayoutStyleLayout style to be used for parent layout
cachedlayer-layoutstyle-constraintSizeConstraintLayout constrains
cachedlayer-layoutstyle-flexgrownumberNumber specifying how much the item will grow relative to the rest of the items inside the same container
cachedlayer-layoutstyle-flexshrinknumberNumber specifying how much the item will shrink relative to the rest of the items inside the same container
cachedlayer-layoutstyle-floatstringFloat position
cachedlayer-layoutstyle-positionstringLayout position
cachedlayer-layoutstyle-sizenumber | stringLayout size
cachedlayer-linestylestringLine style
cachedlayer-linestyleLineStyleLine style
cachedlayer-linestyle-colorstringColor in CSS form
cachedlayer-linestyle-fillstringOptional fill style to be used to fill lines generated with this style
cachedlayer-linestyle-fillFillStyleOptional fill style to be used to fill lines generated with this style
cachedlayer-linestyle-linecapCapStyleThe line cap style
cachedlayer-linestyle-linedashoffsetnumberLine dash offset of dashed line
cachedlayer-linestyle-linejoinJoinStyleThe line join style
cachedlayer-linestyle-pixelsnapmodebooleanPixel Snap Mode, default(
cachedlayer-linestyle-scalablebooleanTrue if width should depend on transformation
cachedlayer-linestyle-unitstringOptional unit for the width
cachedlayer-linestyle-widthnumber | stringThe line thickness
cachedlayer-localtransformTransformationLocal transformation
cachedlayer-localtransform-dxnumberX axis translation
cachedlayer-localtransform-dynumberY axis translation
cachedlayer-localtransform-xxnumberX scale
cachedlayer-localtransform-xynumberXy skew
cachedlayer-localtransform-yxnumberYx skew
cachedlayer-localtransform-yynumberY scale
cachedlayer-marginsnumber | stringIt has properties for specifying the margins for each side
cachedlayer-modellimitsRectDefine inner model coordinates of the group
cachedlayer-namestringName of the node. It is often used for debugging purposes or to simplify queries
cachedlayer-opacitynumberNode opacity (from 0 to 1). If it is undefined or null it inherits property from the parent. It changes globalAlpha on the rendering context
cachedlayer-opacityblendmodeBlendModeNode opacity mode to blend it
cachedlayer-paddingnumber | stringIt has properties for specifying the padding for each side
cachedlayer-pickingchildrenbooleanEnable picking children
cachedlayer-scalescrollstrategyScaleScrollStrategyScale scroll strategy
cachedlayer-scalescrollstrategy-enabledbooleanEnable flag
cachedlayer-selectablebooleanSelectable node, a boolean to determine if selection should consider this node
cachedlayer-taganyCustom information associated with node. It is a user object which can be used by client code to store information or attach an application object to the shape
cachedlayer-transformstringAdditional CSS transformation applied to node or 'none'
cachedlayer-transformTransformationAdditional CSS transformation applied to node or 'none'
cachedlayer-verticalflipbooleanVertical axis goes from bottom to top
cachedlayer-viewcachebooleanView cache to cache child nodes
cachedlayer-visiblebooleanVisibility of the node, a boolean to determine if the node should be rendered or not
cachedlayer-z-indexnumberDefine node z-index
cachedlayerLayerLayer to which handles will be added. Cache enabled
cachedlayer-clippingbooleanEnable clipping, this does not consider the clipstyle, it is related to bounds-clipping
cachedlayer-clipstyleClipStyleClipping style
cachedlayer-clipstyleGraphicsPathClipping style
cachedlayer-cssclassstringThe css class name of this node
cachedlayer-csscursorstringCSS cursor associated with node
cachedlayer-cssstylestringCSS style to be applied to inserted elements
cachedlayer-idstring | numberId of the node, its a unique identifier
cachedlayer-infinitybooleanMode to render outside the model limits
cachedlayer-localtransformTransformationLocal transformation
cachedlayer-marginsnumber | stringIt has properties for specifying the margins for each side
cachedlayer-namestringName of the node. It is often used for debugging purposes or to simplify queries
cachedlayer-opacitynumberNode opacity (from 0 to 1). If it is undefined or null it inherits property from the parent. It changes globalAlpha on the rendering context
cachedlayer-opacityblendmodeBlendModeNode opacity mode to blend it
cachedlayer-scalescrollstrategyScaleScrollStrategyScale scroll strategy
cachedlayer-selectablebooleanSelectable node, a boolean to determine if selection should consider this node
cachedlayer-taganyCustom information associated with node. It is a user object which can be used by client code to store information or attach an application object to the shape
cachedlayer-transformstringAdditional CSS transformation applied to node or 'none'
cachedlayer-transformTransformationAdditional CSS transformation applied to node or 'none'
cachedlayer-visiblebooleanVisibility of the node, a boolean to determine if the node should be rendered or not
cachedlayer-z-indexnumberDefine node z-index
enabledbooleanEnabled state
handlesizenumberHandle size
handlestylesHandleStylesObject containing stylings for different types of handle states
handlestyles-activefillstylestringFill Style of the handle when it is selected and active
handlestyles-activefillstyleFillStyleFill Style of the handle when it is selected and active
handlestyles-activelinestylestringLine Style of the handle when it is active
handlestyles-activelinestyleLineStyleLine Style of the handle when it is active
handlestyles-ghostfillstylestringFill Style of the handle when it is in ghost state
handlestyles-ghostfillstyleFillStyleFill Style of the handle when it is in ghost state
handlestyles-ghostlinestylestringLine Style of the handle when it is in ghost state
handlestyles-ghostlinestyleLineStyleLine Style of the handle when it is in ghost state
handlestyles-inactivefillstylestringFill Style of the handle when it is selected and inactive
handlestyles-inactivefillstyleFillStyleFill Style of the handle when it is selected and inactive
handlestyles-inactivelinestylestringLine Style of the handle when it is inactive
handlestyles-inactivelinestyleLineStyleLine Style of the handle when it is inactive
handlestypeHandlesTypeHandles display type
layerCompositeNodeManipulator layer
layer-clippingbooleanEnable clipping, this does not consider the clipstyle, it is related to bounds-clipping
layer-clipstyleClipStyleClipping style
layer-clipstyleGraphicsPathClipping style
layer-cssclassstringThe css class name of this node
layer-csscursorstringCSS cursor associated with node
layer-cssstylestringCSS style to be applied to inserted elements
layer-idstring | numberId of the node, its a unique identifier
layer-infinitybooleanMode to render outside the model limits
layer-localtransformTransformationLocal transformation
layer-marginsnumber | stringIt has properties for specifying the margins for each side
layer-namestringName of the node. It is often used for debugging purposes or to simplify queries
layer-opacitynumberNode opacity (from 0 to 1). If it is undefined or null it inherits property from the parent. It changes globalAlpha on the rendering context
layer-opacityblendmodeBlendModeNode opacity mode to blend it
layer-scalescrollstrategyScaleScrollStrategyScale scroll strategy
layer-selectablebooleanSelectable node, a boolean to determine if selection should consider this node
layer-taganyCustom information associated with node. It is a user object which can be used by client code to store information or attach an application object to the shape
layer-transformstringAdditional CSS transformation applied to node or 'none'
layer-transformTransformationAdditional CSS transformation applied to node or 'none'
layer-visiblebooleanVisibility of the node, a boolean to determine if the node should be rendered or not
layer-z-indexnumberDefine node z-index
modeModesMode in which this tool will work
mouseradiusnumberDevice radius for mouse events
namestringName of the tool used like cross-hair etc
touchradiusnumberDevice radius for touch events

Contents

Constructors

new CurveEditor()

new CurveEditor()

Creates a new instance of CurveEditor class

Overrides

AbstractLogVisualEditingTool.constructor


new CurveEditor(layer, cachedManipulatorLayer)

new CurveEditor(layer, cachedManipulatorLayer)

Creates a new instance of CurveEditor class

Deprecated

since 4.0. Use constructor with a single parameter instead

Parameters

Name Type Description
layerGroup<Node> | CompositeNode<Node> | Layer<Node> | Optionslayer to which handles will be added or tool options. Cache disabled
cachedManipulatorLayerGroup<Node> | Layer<Node>layer to which handles will be added. Cache enabled

Overrides

AbstractLogVisualEditingTool.constructor


new CurveEditor(options)

new CurveEditor(options)

Creates a new instance of CurveEditor class

Parameters

Name Type Description
optionsGroup<Node> | CompositeNode<Node> | Layer<Node> | Optionslayer to which handles will be added or tool options. Cache disabled

Overrides

AbstractLogVisualEditingTool.constructor

Methods

addHandle

Protected addHandle(handle): CurveEditor

Add editor handle

Parameters

Name Type Description
handleGhostBearingHandleeditor handle

Returns

CurveEditor

this

Inherited from

AbstractLogVisualEditingTool.addHandle


addListener

addListener(eventName, listener): CurveEditor

add event listener. The listener receives the message when the system event happens.

Deprecated

since 4.0 use .on() instead. Note that 3 args callback should be used in subscription via .on(): (eventType, source, args)

Parameters

Name Type Description
eventNamestringevent name or unique event identifier
listenerFunctionthe event listener

Returns

CurveEditor

Inherited from

AbstractLogVisualEditingTool.addListener


captureMouseUp

captureMouseUp(): void

listen to window mouse events in order to catch a mouse up action outside of the tool container DOM element. useful for example when you pan and release click outside of DOM element.

Returns

void

Inherited from

AbstractLogVisualEditingTool.captureMouseUp


checkHandleCollision

checkHandleCollision(sample1, sample2?, activeHandle?): boolean

Checks if a sample or a value falls within the visible limits of the parent track.

Parameters

Name Type Description
sample1number | LogDataSampleThe sample or value to test. If a line segment is tested, this is the first point of the tested line
Optional sample2number | LogDataSampleWhen a line segment is tested, this is the second point constructing the line
Optional activeHandlebooleanTrue if the test is done for the active handle. Used in cases of handle manipulation.

Returns

boolean

True if the handle or the value falls within the visible limits of the track, false otherwise


createHandles

Protected createHandles(): CurveEditor

Creates the handles for every point that curve has visible on the screen if in linear interpolation mode. In step interpolation creates a line handle between each visible point

Returns

CurveEditor


dispose

dispose(): void

Dispose tool.

Returns

void

Inherited from

AbstractLogVisualEditingTool.dispose


findSampleIndex

findSampleIndex(depth, value): number

Searches the original sample index for the associated log curve

Parameters

Name Type Description
depthnumberthe search depth
valuenumberthe search value

Returns

number

the original sample index if exact sample is found, otherwise returns a bitwise complement of the closest sample index


fireEvent

fireEvent(eventName, eventArgs?): void

This method is Protected. Fire an Event.

Deprecated

since 4.0 use .notify() instead. Note that 3 args callback should be used in subscription via .on()

Parameters

Name Type Description
eventNamestringevent name
Optional eventArgsanycontains info of the event

Returns

void

Inherited from

AbstractLogVisualEditingTool.fireEvent


getActiveHandle

getActiveHandle(): GhostBearingHandle

Returns currently active handle,if exists, otherwise null

Returns

GhostBearingHandle

Inherited from

AbstractLogVisualEditingTool.getActiveHandle


getCachedManipulatorLayer

getCachedManipulatorLayer(): CompositeNode<Node>

Gets the manipulator layer with contains handles

Deprecated

since 4.0. Use AbstractLogVisualEditingTool#getManipulatorLayer instead

Returns

CompositeNode<Node>

Inherited from

AbstractLogVisualEditingTool.getCachedManipulatorLayer


getClassName

getClassName(): string

Returns

string

Inherited from

AbstractLogVisualEditingTool.getClassName


getDeviceXY

Protected getDeviceXY(args): Point

Returns a point in model coordinates, edits one of the util points

Parameters

Name Type Description
argsEventArgsEvent arguments

Returns

Point

Inherited from

AbstractLogVisualEditingTool.getDeviceXY


getEventRadius

Protected getEventRadius(eventArgs): number

Returns device radius for the provided event

Parameters

Name Type Description
eventArgsEventArgscontains info of the event

Returns

number

Inherited from

AbstractLogVisualEditingTool.getEventRadius


getHandle

Protected getHandle(index): GhostBearingHandle

Parameters

Name Type
indexnumber

Returns

GhostBearingHandle

Inherited from

AbstractLogVisualEditingTool.getHandle


getHandleInsideTrack

getHandleInsideTrack(): boolean

Gets the value of flag defining if the active handles can only move inside the track

Returns

boolean


getHandlePainter

getHandlePainter(): Painter

Gets the shape painter with which is used to render handles. Format is the same as in SymbolShape Redraws all handles

Returns

Painter

painter

Inherited from

AbstractLogVisualEditingTool.getHandlePainter


getHandleSize

getHandleSize(): number

Get the size of the handles

Returns

number

Inherited from

AbstractLogVisualEditingTool.getHandleSize


getHandleStyles

getHandleStyles(): HandleStylesOut

Returns registered styles for active, inactive, and ghost states of all handles

Returns

HandleStylesOut

object containing stylings for different types of handle states

Inherited from

AbstractLogVisualEditingTool.getHandleStyles


getHandlesCount

Protected getHandlesCount(): number

Return number of handles

Returns

number

number of handles

Inherited from

AbstractLogVisualEditingTool.getHandlesCount


getHandlesType

getHandlesType(): HandlesType

Gets handles display type

Returns

HandlesType

handles display type


getHideGhostOnDrop

getHideGhostOnDrop(): boolean

Gets a flag defining if the ghost should be reset after it has been dropped

Returns

boolean

Inherited from

AbstractLogVisualEditingTool.getHideGhostOnDrop


getHideInactiveHandles

getHideInactiveHandles(): boolean

Returns a flag which defines if inactive handles have to be hidden when dragging.

Returns

boolean

hide True when inactive handles hidden on dragging


getHideSpillingHandles

getHideSpillingHandles(): boolean

Gets the value of the flag defining if the handles which overflow the track boundaries should be hidden

Returns

boolean


getManipulatorLayer

getManipulatorLayer(): CompositeNode<Node>

return manipulator layer

Returns

CompositeNode<Node>

layer

Inherited from

AbstractLogVisualEditingTool.getManipulatorLayer


getMode

getMode(): Modes

Retrieves the type of editing that this adapter is doing

Returns

Modes


getMouseRadius

getMouseRadius(): number

Returns current device radius for mouse events

Returns

number

Inherited from

AbstractLogVisualEditingTool.getMouseRadius


getName

getName(): string

return tool name if any

Returns

string

name of the tool

Inherited from

AbstractLogVisualEditingTool.getName


getParentTool

getParentTool(): AbstractCompositeTool

Gets parent tool

Returns

AbstractCompositeTool

parent tool

Inherited from

AbstractLogVisualEditingTool.getParentTool


getPosition

getPosition(): Point

Returns the last registered position of the mouse in device space

Returns

Point

Inherited from

AbstractLogVisualEditingTool.getPosition


getProperties

getProperties(): OptionsOut

Returns all the properties pertaining to this object

Returns

OptionsOut

An object containing the properties

Overrides

AbstractLogVisualEditingTool.getProperties


getProperty

getProperty(name): any

Gets dynamic property by name. These properties can be used as a property bags

Parameters

Name Type Description
namestringproperty name

Returns

any

Inherited from

AbstractLogVisualEditingTool.getProperty


getPropertyKeys

getPropertyKeys(): string[]

Returns known properties keys

Returns

string[]

Inherited from

AbstractLogVisualEditingTool.getPropertyKeys


getRoot

getRoot(): AbstractCompositeTool

Gets root tool

Returns

AbstractCompositeTool

parent tool

Inherited from

AbstractLogVisualEditingTool.getRoot


getShape

getShape(): LogCurve

Returns the shape which this tool is manipulating

Returns

LogCurve

Overrides

AbstractLogVisualEditingTool.getShape


getShowGhost

getShowGhost(): boolean

Returns the flag defining if a ghost should be moved instead of the actual object

Returns

boolean

showGhost Show ghost flag

Inherited from

AbstractLogVisualEditingTool.getShowGhost


getTouchRadius

getTouchRadius(): number

Returns current device radius for touch events

Returns

number

Inherited from

AbstractLogVisualEditingTool.getTouchRadius


getVerticalEditAllowed

getVerticalEditAllowed(): boolean

Gets a flag defining if the data points can change their depths

Returns

boolean

True if depth change allowed


hasEventListener

hasEventListener(type, callback?): boolean

Check if a list of event listeners for this type contains this listener

Parameters

Name Type Description
typestringtype of event or property
Optional callbackFunctionto be called, if null, check if any callback is registered

Returns

boolean

Inherited from

AbstractLogVisualEditingTool.hasEventListener


hideHandles

hideHandles(skipActive): CurveEditor

Hides all the handles. Has an option to hide everything except the active handle

Parameters

Name Type Description
skipActivebooleanIf true, active handle will not be hidden

Returns

CurveEditor


isActive

isActive(): boolean

return active state

Returns

boolean

Inherited from

AbstractLogVisualEditingTool.isActive


isDisposed

isDisposed(): boolean

Returns whether this object has been disposed

Returns

boolean

Inherited from

AbstractLogVisualEditingTool.isDisposed


isDoubleClick

Protected isDoubleClick(point, eventArgs?): boolean

returns true if double clicked

Parameters

Name Type Description
pointPointClick point
Optional eventArgsEventArgsoptional event args to verify double click

Returns

boolean

Inherited from

AbstractLogVisualEditingTool.isDoubleClick


isEnabled

isEnabled(): boolean

returns enable state

Returns

boolean

state

Inherited from

AbstractLogVisualEditingTool.isEnabled


isSilent

isSilent(): boolean

Return true if the event dispatcher doesn't notify any events

Returns

boolean

Inherited from

AbstractLogVisualEditingTool.isSilent


isTouchEvent

isTouchEvent(eventArgs): boolean

return true if the event is a touch event and false otherwise.

Parameters

Name Type Description
eventArgsEvent | EventArgscontains info of the event

Returns

boolean

Inherited from

AbstractLogVisualEditingTool.isTouchEvent


makeSelection

Protected makeSelection(x, y): Node[]

Makes a selection according to current position of the pointer

Parameters

Name Type Description
xnumberX coordinate of the pointer
ynumberY coordinate of the pointer

Returns

Node[]

Inherited from

AbstractLogVisualEditingTool.makeSelection


notify

notify<E>(type, source, args?): CurveEditor

Notify listeners

Type parameters

NameType
Eextends string

Parameters

Name Type Description
typeEevent types
sourceCurveEditorof the event
Optional argsEventMap[E]arguments of the event

Returns

CurveEditor

this

Overrides

AbstractLogVisualEditingTool.notify


off

off<E>(type?, callback?): CurveEditor

Detach listener on event. Calling .off() with no arguments removes all attached listeners. Calling .off(type) with no callback removes all attached listeners for specific type.

Type parameters

NameType
Eextends string

Parameters

Name Type Description
Optional typeEtype of the event
Optional callback(eventType: E, sender: CurveEditor, args: EventMap[E]) => voidfunction to be called

Returns

CurveEditor

this

Overrides

AbstractLogVisualEditingTool.off


on

on<E>(type, callback): CurveEditor

Attach listener on event that will be called whenever the specified event is delivered to the target

If the callback function is already in the list of event listeners for this target, the function is not added a second time.

If a particular anonymous function is in the list of event listeners registered for a certain target, and then later in the code, an identical anonymous function is given in an "on" call, the second function will also be added to the list of event listeners for that target.

TypeScript hint: in case of creating derived tool with own events, EventMap should be extended and .on() and .notify() methods redeclared, see sample.

Example

// Using in derived tool
import type {EventMap as EventMapBase} from '@int/geotoolkit/controls/tools/AbstractTool';
export type EventMap = EventMapBase &amp; {
[MyToolEvents.onValueChanged]: MyToolEventArgs
}
export enum MyToolEvents {
onValueChanged = 'onValueChanged'
}
export class MyTool extends AbstractTool {
public declare on: <E extends keyof EventMap>(type: E, callback: (eventType: E, sender: this, args: EventMap[E]) => void) => this;
protected declare notify: <E extends keyof EventMap>(type: E, source: AbstractTool, args?: EventMap[E]) => this;
public declare off: <E extends keyof EventMap>(type: E, callback?: (eventType: E, sender: this, args: EventMap[E]) => void) => this;
// ...
}

Type parameters

NameType
Eextends string

Parameters

Name Type Description
typeEtype of event or property
callback(eventType: E, sender: CurveEditor, args: EventMap[E]) => voidto be called

Returns

CurveEditor

Overrides

AbstractLogVisualEditingTool.on


onActiveStateChanged

Protected onActiveStateChanged(): void

Fires

Events.onStateChanged

Returns

void

Inherited from

AbstractLogVisualEditingTool.onActiveStateChanged


onEnabledStateChanged

Protected onEnabledStateChanged(): void

Called when the tool is enabled or disabled

Returns

void

Inherited from

AbstractLogVisualEditingTool.onEnabledStateChanged


onMouseDown

onMouseDown(eventArgs): CurveEditor

Handles the event caused by user pressing the mouse button

Parameters

Name Type Description
eventArgsEventArgsNative event arguments received from EventDispatcher

Returns

CurveEditor

Overrides

AbstractLogVisualEditingTool.onMouseDown


onMouseMove

onMouseMove(eventArgs): CurveEditor

Handles the event caused by user moving the mouse

Parameters

Name Type Description
eventArgsEventArgsNative event arguments received from EventDispatcher

Returns

CurveEditor

Overrides

AbstractLogVisualEditingTool.onMouseMove


onMouseUp

onMouseUp(eventArgs): CurveEditor

Handles the event caused by user releasing the mouse button

Parameters

Name Type Description
eventArgsEventArgsNative event arguments received from EventDispatcher

Returns

CurveEditor

Overrides

AbstractLogVisualEditingTool.onMouseUp


pageToCanvas

pageToCanvas(eventArgs, externalPlot?): Object

return position relative to the canvas

Parameters

Name Type Description
eventArgsEvent | EventArgsparentElement the parent HTML element
Optional externalPlotPlotplot

Returns

Object

NameType
xnumber
ynumber

Inherited from

AbstractLogVisualEditingTool.pageToCanvas


pointToModel

pointToModel(model, eventArgs): Point

converts device coordinates to inner coordinates of node

Parameters

Name Type Description
modelNodethe model
eventArgsPoint | EventArgsarguments of the event OR point in device (plot) coordinates.

Returns

Point

Inherited from

AbstractLogVisualEditingTool.pointToModel


removeHandle

Protected removeHandle(handle, disposeHandles?): CurveEditor

Remove handles

Parameters

Name Type Description
handleGhostBearingHandle | GhostBearingHandle[]handle or array of handles to be removed
Optional disposeHandlesboolean

Returns

CurveEditor

this

Inherited from

AbstractLogVisualEditingTool.removeHandle


removeHandles

removeHandles(): CurveEditor

Clears all the handles from the adapter and manipulator layer

Returns

CurveEditor


removeListener

removeListener(eventName, listener?): CurveEditor

remove event listener. The listener reveives the message when the system event happens.

Deprecated

since 4.0 use .off() instead.

Parameters

Name Type Description
eventNamestringevent name
Optional listenerFunction | Function[]the event listener, if null, remove all listeners for the event

Returns

CurveEditor

Inherited from

AbstractLogVisualEditingTool.removeListener


setActive

setActive(active): CurveEditor

set active state

Fires

Events.onStateChanged

Parameters

Name Type Description
activebooleanset active state

Returns

CurveEditor

Inherited from

AbstractLogVisualEditingTool.setActive


setActiveHandle

setActiveHandle(handle): CurveEditor

Sets the handle currently active

Parameters

Name Type Description
handleGhostBearingHandleThe handle to be active

Returns

CurveEditor

Inherited from

AbstractLogVisualEditingTool.setActiveHandle


setEnabled

setEnabled(enabled): CurveEditor

set enable state

Fires

Events.onEnabledStateChanged

Fires

Events.onStateChanged

Parameters

Name Type Description
enabledbooleansets the enabled state

Returns

CurveEditor

this

Inherited from

AbstractLogVisualEditingTool.setEnabled


setHandleInsideTrack

setHandleInsideTrack(inside): CurveEditor

Sets a flag which defines if the active handle can only move within the track area

Parameters

Name Type Description
insidebooleanTrue to restrict the position of active handle in the track

Returns

CurveEditor


setHandlePainter

setHandlePainter(painter): CurveEditor

Sets the shape painter with which the handles will be drawn. Format is the same as in geotoolkit.scene.shapes.SymbolShape Redraws all handles

Parameters

Name Type Description
painterPainterThe painter which will be used to draw the handles for linearly interpolated curves

Returns

CurveEditor

Inherited from

AbstractLogVisualEditingTool.setHandlePainter


setHandleSize

setHandleSize(size): CurveEditor

Sets the pixel side of the handles to which a size is applicable (anchored handles)

Parameters

Name Type Description
sizenumberThe size of the handles in device coordinates (pixels)

Returns

CurveEditor

Inherited from

AbstractLogVisualEditingTool.setHandleSize


setHandleStyles

setHandleStyles(styles): CurveEditor

Sets styles for active, inactive, and ghost states of all handles, and redraws each handle (this will lose edited handles position)

Parameters

Name Type Description
stylesHandleStylesobject containing stylings for different types of handle states

Returns

CurveEditor

Inherited from

AbstractLogVisualEditingTool.setHandleStyles


setHandlesType

setHandlesType(handlesType): CurveEditor

Sets handles display type

Parameters

Name Type Description
handlesTypeHandlesTypehandles display type

Returns

CurveEditor

this


setHandlesVisible

Protected setHandlesVisible(visible): CurveEditor

Iterates through handles and sets the provided visibility. If the visibility is to hide, hides the ghosts as well

Parameters

Name Type Description
visiblebooleanVisibility flag for handles

Returns

CurveEditor

Inherited from

AbstractLogVisualEditingTool.setHandlesVisible


setHideGhostOnDrop

setHideGhostOnDrop(hide): CurveEditor

Gets a flag defining if the ghost should be reset after it has been dropped

Parameters

Name Type Description
hidebooleanTrue to hide ghosts when dropped

Returns

CurveEditor

Inherited from

AbstractLogVisualEditingTool.setHideGhostOnDrop


setHideInactiveHandles

setHideInactiveHandles(hide): CurveEditor

Sets a flag which defines if inactive handles have to be hidden when a move with an existing active handle occurs. Once you grab a handle and start dragging it around, every other handle will be hidden to aid a better view of the curve you are editing.

Parameters

Name Type Description
hidebooleanTrue to hide inactive handles on dragging

Returns

CurveEditor


setHideSpillingHandles

setHideSpillingHandles(hide): CurveEditor

Sets the value of the flag defining if the handles which overflow the track boundaries should be hidden

Parameters

Name Type Description
hidebooleanIf true, overflowing handles will not display

Returns

CurveEditor


setMode

setMode(mode): CurveEditor

Sets what kind of edition this adapter has to do for the curve

Parameters

Name Type Description
modeModesThe new mode in which this tool will work

Returns

CurveEditor


setMouseRadius

setMouseRadius(radius): CurveEditor

Sets device radius for mouse events

Parameters

Name Type Description
radiusnumberradius for mouse events

Returns

CurveEditor

this

Inherited from

AbstractLogVisualEditingTool.setMouseRadius


setName

setName(name): CurveEditor

set tool name

Parameters

Name Type Description
namestringthe tool name

Returns

CurveEditor

Inherited from

AbstractLogVisualEditingTool.setName


setPosition

setPosition(x, y): CurveEditor

Sets the last registered position of the mouse in device space

Parameters

Name Type Description
xnumberThe new X position
ynumberThe new Y position

Returns

CurveEditor

Inherited from

AbstractLogVisualEditingTool.setPosition


setProperties

setProperties(properties?): CurveEditor

Sets all the properties pertaining to this object

Parameters

Name Type Description
Optional propertiesOptionsAn object containing the properties to set

Returns

CurveEditor

this

Overrides

AbstractLogVisualEditingTool.setProperties


setProperty

setProperty(name, value): CurveEditor

Sets dynamic property by name

Parameters

Name Type Description
namestringproperty name
valueanyproperty value

Returns

CurveEditor

this

Inherited from

AbstractLogVisualEditingTool.setProperty


setShape

setShape(shape): CurveEditor

Sets the shape which this tool has to manipulate and calculate its handles from.

Parameters

Name Type Description
shapeNodeThe new shape to set for manipulation

Returns

CurveEditor

Inherited from

AbstractLogVisualEditingTool.setShape


setShowGhost

setShowGhost(showGhost): CurveEditor

Sets the flag defining if a ghost should be moved instead of the actual handle

Parameters

Name Type Description
showGhostbooleanShow ghost flag

Returns

CurveEditor

Inherited from

AbstractLogVisualEditingTool.setShowGhost


setSilent

setSilent(bool): CurveEditor

Set silent mode

Parameters

Name Type Description
boolbooleanflag to enable silent mode

Returns

CurveEditor

this

Inherited from

AbstractLogVisualEditingTool.setSilent


setSlotEnabled

setSlotEnabled(eventName, value, target?): CurveEditor

Sets slot enabled

Parameters

Name Type Description
eventNamestringeventName
valuebooleanvalue
Optional targetEventTargettarget

Returns

CurveEditor

Inherited from

AbstractLogVisualEditingTool.setSlotEnabled


setSlots

setSlots(slots?, merge?): CurveEditor

Sets new slots.

Example

const slots = {
'pointerdown': (event: EventArgs) => {
// event is an instance of @int/geotoolkit/controls/tools/EventArgs
...
}
};
tool.setSlots(slots);

Parameters

Name Type Description
Optional slotsRecord<string, Slot | Slot[] | (eventArgs: EventArgs) => void>type of system events
Optional mergebooleanset to true if you want to merge with existing slots

Returns

CurveEditor

this

Inherited from

AbstractLogVisualEditingTool.setSlots


setTouchRadius

setTouchRadius(radius): CurveEditor

Sets device radius for touch events

Parameters

Name Type Description
radiusnumberradius for touch events

Returns

CurveEditor

this

Inherited from

AbstractLogVisualEditingTool.setTouchRadius


setVerticalEditAllowed

setVerticalEditAllowed(allow): CurveEditor

Sets a flag defining if the data points can change their depths

Parameters

Name Type Description
allowbooleanTrue to allow depth change

Returns

CurveEditor


showHandles

showHandles(): CurveEditor

Shows all existing handles on the screen.

Returns

CurveEditor


start

Protected start(eventArgs?): CurveEditor

start

Parameters

Name Type Description
Optional eventArgsEventArgsevent args

Returns

CurveEditor

Inherited from

AbstractLogVisualEditingTool.start


stop

Protected stop(): CurveEditor

stop

Returns

CurveEditor

Inherited from

AbstractLogVisualEditingTool.stop


toggle

toggle(): CurveEditor

switch enable state to opposite state

Returns

CurveEditor

Inherited from

AbstractLogVisualEditingTool.toggle


update

update(): void

Updates the state of the tool, recalculated and redraws the handles and curve limits (for spilling handles)

Returns

void

Overrides

AbstractLogVisualEditingTool.update


canvasToClient

Static canvasToClient(plotPoint, plot): Point

Convert plot coordinates to global coordinates

Parameters

Name Type Description
plotPointPointpoint in plot coordinates
plotPlotplot with canvas

Returns

Point

Inherited from

AbstractLogVisualEditingTool.canvasToClient


clientToCanvas

Static clientToCanvas(nativeEvent, plot): Point

Convert global coordinates to plot coordinates

Parameters

Name Type Description
nativeEventEventnative browser event
plotPlotplot with canvas

Returns

Point

Inherited from

AbstractLogVisualEditingTool.clientToCanvas


getClassName

Static getClassName(): string

Returns

string

Inherited from

AbstractLogVisualEditingTool.getClassName


getExclusiveTool

Static getExclusiveTool(plot): AbstractTool

return exclusive tool associated with plot

Parameters

Name Type Description
plotPlotplot

Returns

AbstractTool

tool

Inherited from

AbstractLogVisualEditingTool.getExclusiveTool


getNativeEventName

Static getNativeEventName(eventName): string[]

Returns native event name

Parameters

Name Type Description
eventNamestringW3C Pointer Events Recommendation name

Returns

string[]

Inherited from

AbstractLogVisualEditingTool.getNativeEventName


isTouchEvent

Static isTouchEvent(eventArgs): eventArgs is TouchEvent

return true if the event is a touch event and false otherwise.

Parameters

Name Type Description
eventArgsEvent | EventArgscontains info of the event

Returns

eventArgs is TouchEvent

Inherited from

AbstractLogVisualEditingTool.isTouchEvent


lock

Static lock(plot, tool): void

Set exclusive tool for plot

Parameters

Name Type Description
plotPlotplot
toolAbstractTooltool

Returns

void

Inherited from

AbstractLogVisualEditingTool.lock


setDefaultMouseRadius

Static setDefaultMouseRadius(radius): void

Sets default device radius for mouse events

Parameters

Name Type Description
radiusnumberradius for mouse events

Returns

void

Inherited from

AbstractLogVisualEditingTool.setDefaultMouseRadius


setDefaultTouchRadius

Static setDefaultTouchRadius(radius): void

Sets default device radius for touch events

Parameters

Name Type Description
radiusnumberradius for touch events

Returns

void

Inherited from

AbstractLogVisualEditingTool.setDefaultTouchRadius


unlock

Static unlock(value): void

Remove exclusive tool from plot

Parameters

Name Type Description
valueAbstractTool | Plotvalue

Returns

void

Inherited from

AbstractLogVisualEditingTool.unlock