API / geotoolkit / welllog / widgets / tools / CurveEditor / 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)
↳
CurveEditor
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 |
|---|---|---|
cachedlayer | Group | Layer to which handles will be added. Cache enabled |
cachedlayer-automodellimitsmode | boolean | Auto model limits mode |
cachedlayer-bounds | Rect | Define position of the group in the parent |
cachedlayer-bounds-height | number | Height |
cachedlayer-bounds-readonly | boolean | Readonly |
cachedlayer-bounds-width | number | Width |
cachedlayer-bounds-x | number | Left |
cachedlayer-bounds-y | number | Top |
cachedlayer-clipping | boolean | Enable clipping, this does not consider the clipstyle, it is related to bounds-clipping |
cachedlayer-clipstyle | ClipStyle | Clipping style |
cachedlayer-clipstyle-evenodd | boolean | True if evenodd mode is on ('nonzero' mode otherwise) |
cachedlayer-clipstyle-geometry | GraphicsPath | Clipping geometry |
cachedlayer-clipstyle-geometry-bounds | Rect | Bounds |
cachedlayer-clipstyle | GraphicsPath | Clipping style |
cachedlayer-contentorientation | Orientation | Content orientation |
cachedlayer-cssclass | string | The css class name of this node |
cachedlayer-csscursor | string | CSS cursor associated with node |
cachedlayer-cssstyle | string | CSS style to be applied to inserted elements |
cachedlayer-fillstyle | string | Fill style |
cachedlayer-fillstyle | FillStyle | Fill style |
cachedlayer-fillstyle-color | string | Color in CSS form |
cachedlayer-fillstyle-evenoddmode | boolean | Even-odd fill mode |
cachedlayer-fillstyle-fillpattern | Pattern | Pattern |
cachedlayer-fillstyle-fillpattern-containername | string | An 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-patternname | string | Name of this pattern for indexing |
cachedlayer-fillstyle-fillpattern-scalable | boolean | Flag that sets scalability of the pattern coordinates, or relative to the shape it is filling (It is not supported) |
cachedlayer-fillstyle-foreground | string | Foreground color |
cachedlayer-fillstyle-pattern | Pattern | Pattern |
cachedlayer-horizontalflip | boolean | Horizontal axis goes from right to left |
cachedlayer-id | string | number | Id of the node, its a unique identifier |
cachedlayer-infinity | boolean | Mode to render outside the model limits |
cachedlayer-layoutstyle | LayoutStyle | Layout style to be used for parent layout |
cachedlayer-layoutstyle-constraint | SizeConstraint | Layout constrains |
cachedlayer-layoutstyle-flexgrow | number | Number specifying how much the item will grow relative to the rest of the items inside the same container |
cachedlayer-layoutstyle-flexshrink | number | Number specifying how much the item will shrink relative to the rest of the items inside the same container |
cachedlayer-layoutstyle-float | string | Float position |
cachedlayer-layoutstyle-position | string | Layout position |
cachedlayer-layoutstyle-size | number | string | Layout size |
cachedlayer-linestyle | string | Line style |
cachedlayer-linestyle | LineStyle | Line style |
cachedlayer-linestyle-color | string | Color in CSS form |
cachedlayer-linestyle-fill | string | Optional fill style to be used to fill lines generated with this style |
cachedlayer-linestyle-fill | FillStyle | Optional fill style to be used to fill lines generated with this style |
cachedlayer-linestyle-linecap | CapStyle | The line cap style |
cachedlayer-linestyle-linedashoffset | number | Line dash offset of dashed line |
cachedlayer-linestyle-linejoin | JoinStyle | The line join style |
cachedlayer-linestyle-pixelsnapmode | boolean | Pixel Snap Mode, default( |
cachedlayer-linestyle-scalable | boolean | True if width should depend on transformation |
cachedlayer-linestyle-unit | string | Optional unit for the width |
cachedlayer-linestyle-width | number | string | The line thickness |
cachedlayer-localtransform | Transformation | Local transformation |
cachedlayer-localtransform-dx | number | X axis translation |
cachedlayer-localtransform-dy | number | Y axis translation |
cachedlayer-localtransform-xx | number | X scale |
cachedlayer-localtransform-xy | number | Xy skew |
cachedlayer-localtransform-yx | number | Yx skew |
cachedlayer-localtransform-yy | number | Y scale |
cachedlayer-margins | number | string | It has properties for specifying the margins for each side |
cachedlayer-modellimits | Rect | Define inner model coordinates of the group |
cachedlayer-name | string | Name of the node. It is often used for debugging purposes or to simplify queries |
cachedlayer-opacity | number | Node 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-opacityblendmode | BlendMode | Node opacity mode to blend it |
cachedlayer-padding | number | string | It has properties for specifying the padding for each side |
cachedlayer-pickingchildren | boolean | Enable picking children |
cachedlayer-scalescrollstrategy | ScaleScrollStrategy | Scale scroll strategy |
cachedlayer-scalescrollstrategy-enabled | boolean | Enable flag |
cachedlayer-selectable | boolean | Selectable node, a boolean to determine if selection should consider this node |
cachedlayer-tag | any | Custom 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-transform | string | Additional CSS transformation applied to node or 'none' |
cachedlayer-transform | Transformation | Additional CSS transformation applied to node or 'none' |
cachedlayer-verticalflip | boolean | Vertical axis goes from bottom to top |
cachedlayer-viewcache | boolean | View cache to cache child nodes |
cachedlayer-visible | boolean | Visibility of the node, a boolean to determine if the node should be rendered or not |
cachedlayer-z-index | number | Define node z-index |
cachedlayer | Layer | Layer to which handles will be added. Cache enabled |
cachedlayer-clipping | boolean | Enable clipping, this does not consider the clipstyle, it is related to bounds-clipping |
cachedlayer-clipstyle | ClipStyle | Clipping style |
cachedlayer-clipstyle | GraphicsPath | Clipping style |
cachedlayer-cssclass | string | The css class name of this node |
cachedlayer-csscursor | string | CSS cursor associated with node |
cachedlayer-cssstyle | string | CSS style to be applied to inserted elements |
cachedlayer-id | string | number | Id of the node, its a unique identifier |
cachedlayer-infinity | boolean | Mode to render outside the model limits |
cachedlayer-localtransform | Transformation | Local transformation |
cachedlayer-margins | number | string | It has properties for specifying the margins for each side |
cachedlayer-name | string | Name of the node. It is often used for debugging purposes or to simplify queries |
cachedlayer-opacity | number | Node 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-opacityblendmode | BlendMode | Node opacity mode to blend it |
cachedlayer-scalescrollstrategy | ScaleScrollStrategy | Scale scroll strategy |
cachedlayer-selectable | boolean | Selectable node, a boolean to determine if selection should consider this node |
cachedlayer-tag | any | Custom 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-transform | string | Additional CSS transformation applied to node or 'none' |
cachedlayer-transform | Transformation | Additional CSS transformation applied to node or 'none' |
cachedlayer-visible | boolean | Visibility of the node, a boolean to determine if the node should be rendered or not |
cachedlayer-z-index | number | Define node z-index |
enabled | boolean | Enabled state |
handlesize | number | Handle size |
handlestyles | HandleStyles | Object containing stylings for different types of handle states |
handlestyles-activefillstyle | string | Fill Style of the handle when it is selected and active |
handlestyles-activefillstyle | FillStyle | Fill Style of the handle when it is selected and active |
handlestyles-activelinestyle | string | Line Style of the handle when it is active |
handlestyles-activelinestyle | LineStyle | Line Style of the handle when it is active |
handlestyles-ghostfillstyle | string | Fill Style of the handle when it is in ghost state |
handlestyles-ghostfillstyle | FillStyle | Fill Style of the handle when it is in ghost state |
handlestyles-ghostlinestyle | string | Line Style of the handle when it is in ghost state |
handlestyles-ghostlinestyle | LineStyle | Line Style of the handle when it is in ghost state |
handlestyles-inactivefillstyle | string | Fill Style of the handle when it is selected and inactive |
handlestyles-inactivefillstyle | FillStyle | Fill Style of the handle when it is selected and inactive |
handlestyles-inactivelinestyle | string | Line Style of the handle when it is inactive |
handlestyles-inactivelinestyle | LineStyle | Line Style of the handle when it is inactive |
handlestype | HandlesType | Handles display type |
layer | CompositeNode | Manipulator layer |
layer-clipping | boolean | Enable clipping, this does not consider the clipstyle, it is related to bounds-clipping |
layer-clipstyle | ClipStyle | Clipping style |
layer-clipstyle | GraphicsPath | Clipping style |
layer-cssclass | string | The css class name of this node |
layer-csscursor | string | CSS cursor associated with node |
layer-cssstyle | string | CSS style to be applied to inserted elements |
layer-id | string | number | Id of the node, its a unique identifier |
layer-infinity | boolean | Mode to render outside the model limits |
layer-localtransform | Transformation | Local transformation |
layer-margins | number | string | It has properties for specifying the margins for each side |
layer-name | string | Name of the node. It is often used for debugging purposes or to simplify queries |
layer-opacity | number | Node 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-opacityblendmode | BlendMode | Node opacity mode to blend it |
layer-scalescrollstrategy | ScaleScrollStrategy | Scale scroll strategy |
layer-selectable | boolean | Selectable node, a boolean to determine if selection should consider this node |
layer-tag | any | Custom 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-transform | string | Additional CSS transformation applied to node or 'none' |
layer-transform | Transformation | Additional CSS transformation applied to node or 'none' |
layer-visible | boolean | Visibility of the node, a boolean to determine if the node should be rendered or not |
layer-z-index | number | Define node z-index |
mode | Modes | Mode in which this tool will work |
mouseradius | number | Device radius for mouse events |
name | string | Name of the tool used like cross-hair etc |
touchradius | number | Device radius for touch events |
Constructors
• new CurveEditor()
Creates a new instance of CurveEditor class
AbstractLogVisualEditingTool.constructor
• new CurveEditor(layer, cachedManipulatorLayer)
Creates a new instance of CurveEditor class
Deprecated
since 4.0. Use constructor with a single parameter instead
| Name | Type | Description |
|---|---|---|
layer | Group<Node> | CompositeNode<Node> | Layer<Node> | Options | layer to which handles will be added or tool options. Cache disabled |
cachedManipulatorLayer | Group<Node> | Layer<Node> | layer to which handles will be added. Cache enabled |
AbstractLogVisualEditingTool.constructor
• new CurveEditor(options)
Creates a new instance of CurveEditor class
| Name | Type | Description |
|---|---|---|
options | Group<Node> | CompositeNode<Node> | Layer<Node> | Options | layer to which handles will be added or tool options. Cache disabled |
AbstractLogVisualEditingTool.constructor
Methods
▸ Protected addHandle(handle): CurveEditor
Add editor handle
| Name | Type | Description |
|---|---|---|
handle | GhostBearingHandle | editor handle |
this
AbstractLogVisualEditingTool.addHandle
▸ 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)
| Name | Type | Description |
|---|---|---|
eventName | string | event name or unique event identifier |
listener | Function | the event listener |
AbstractLogVisualEditingTool.addListener
▸ 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.
void
AbstractLogVisualEditingTool.captureMouseUp
▸ checkHandleCollision(sample1, sample2?, activeHandle?): boolean
Checks if a sample or a value falls within the visible limits of the parent track.
| Name | Type | Description |
|---|---|---|
sample1 | number | LogDataSample | The sample or value to test. If a line segment is tested, this is the first point of the tested line |
Optional sample2 | number | LogDataSample | When a line segment is tested, this is the second point constructing the line |
Optional activeHandle | boolean | True if the test is done for the active handle. Used in cases of handle manipulation. |
boolean
True if the handle or the value falls within the visible limits of the track, false otherwise
▸ 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
▸ dispose(): void
Dispose tool.
void
AbstractLogVisualEditingTool.dispose
▸ findSampleIndex(depth, value): number
Searches the original sample index for the associated log curve
| Name | Type | Description |
|---|---|---|
depth | number | the search depth |
value | number | the search value |
number
the original sample index if exact sample is found, otherwise returns a bitwise complement of the closest sample index
▸ 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()
| Name | Type | Description |
|---|---|---|
eventName | string | event name |
Optional eventArgs | any | contains info of the event |
void
AbstractLogVisualEditingTool.fireEvent
▸ getActiveHandle(): GhostBearingHandle
Returns currently active handle,if exists, otherwise null
AbstractLogVisualEditingTool.getActiveHandle
▸ getCachedManipulatorLayer(): CompositeNode<Node>
Gets the manipulator layer with contains handles
Deprecated
since 4.0. Use AbstractLogVisualEditingTool#getManipulatorLayer instead
AbstractLogVisualEditingTool.getCachedManipulatorLayer
▸ getClassName(): string
string
AbstractLogVisualEditingTool.getClassName
▸ Protected getDeviceXY(args): Point
Returns a point in model coordinates, edits one of the util points
| Name | Type | Description |
|---|---|---|
args | EventArgs | Event arguments |
AbstractLogVisualEditingTool.getDeviceXY
▸ Protected getEventRadius(eventArgs): number
Returns device radius for the provided event
| Name | Type | Description |
|---|---|---|
eventArgs | EventArgs | contains info of the event |
number
AbstractLogVisualEditingTool.getEventRadius
▸ Protected getHandle(index): GhostBearingHandle
| Name | Type |
|---|---|
index | number |
AbstractLogVisualEditingTool.getHandle
▸ getHandleInsideTrack(): boolean
Gets the value of flag defining if the active handles can only move inside the track
boolean
▸ getHandlePainter(): Painter
Gets the shape painter with which is used to render handles. Format is the same as in SymbolShape Redraws all handles
painter
AbstractLogVisualEditingTool.getHandlePainter
▸ getHandleSize(): number
Get the size of the handles
number
AbstractLogVisualEditingTool.getHandleSize
▸ getHandleStyles(): HandleStylesOut
Returns registered styles for active, inactive, and ghost states of all handles
object containing stylings for different types of handle states
AbstractLogVisualEditingTool.getHandleStyles
▸ Protected getHandlesCount(): number
Return number of handles
number
number of handles
AbstractLogVisualEditingTool.getHandlesCount
▸ getHandlesType(): HandlesType
Gets handles display type
handles display type
▸ getHideGhostOnDrop(): boolean
Gets a flag defining if the ghost should be reset after it has been dropped
boolean
AbstractLogVisualEditingTool.getHideGhostOnDrop
▸ getHideInactiveHandles(): boolean
Returns a flag which defines if inactive handles have to be hidden when dragging.
boolean
hide True when inactive handles hidden on dragging
▸ getHideSpillingHandles(): boolean
Gets the value of the flag defining if the handles which overflow the track boundaries should be hidden
boolean
▸ getManipulatorLayer(): CompositeNode<Node>
return manipulator layer
layer
AbstractLogVisualEditingTool.getManipulatorLayer
▸ getMode(): Modes
Retrieves the type of editing that this adapter is doing
▸ getMouseRadius(): number
Returns current device radius for mouse events
number
AbstractLogVisualEditingTool.getMouseRadius
▸ getName(): string
return tool name if any
string
name of the tool
AbstractLogVisualEditingTool.getName
▸ getParentTool(): AbstractCompositeTool
Gets parent tool
parent tool
AbstractLogVisualEditingTool.getParentTool
▸ getPosition(): Point
Returns the last registered position of the mouse in device space
AbstractLogVisualEditingTool.getPosition
▸ getProperties(): OptionsOut
Returns all the properties pertaining to this object
An object containing the properties
AbstractLogVisualEditingTool.getProperties
▸ getProperty(name): any
Gets dynamic property by name. These properties can be used as a property bags
| Name | Type | Description |
|---|---|---|
name | string | property name |
any
AbstractLogVisualEditingTool.getProperty
▸ getPropertyKeys(): string[]
Returns known properties keys
string[]
AbstractLogVisualEditingTool.getPropertyKeys
▸ getRoot(): AbstractCompositeTool
Gets root tool
parent tool
AbstractLogVisualEditingTool.getRoot
▸ getShape(): LogCurve
Returns the shape which this tool is manipulating
AbstractLogVisualEditingTool.getShape
▸ getShowGhost(): boolean
Returns the flag defining if a ghost should be moved instead of the actual object
boolean
showGhost Show ghost flag
AbstractLogVisualEditingTool.getShowGhost
▸ getTouchRadius(): number
Returns current device radius for touch events
number
AbstractLogVisualEditingTool.getTouchRadius
▸ getVerticalEditAllowed(): boolean
Gets a flag defining if the data points can change their depths
boolean
True if depth change allowed
▸ hasEventListener(type, callback?): boolean
Check if a list of event listeners for this type contains this listener
| Name | Type | Description |
|---|---|---|
type | string | type of event or property |
Optional callback | Function | to be called, if null, check if any callback is registered |
boolean
AbstractLogVisualEditingTool.hasEventListener
▸ hideHandles(skipActive): CurveEditor
Hides all the handles. Has an option to hide everything except the active handle
| Name | Type | Description |
|---|---|---|
skipActive | boolean | If true, active handle will not be hidden |
▸ isActive(): boolean
return active state
boolean
AbstractLogVisualEditingTool.isActive
▸ isDisposed(): boolean
Returns whether this object has been disposed
boolean
AbstractLogVisualEditingTool.isDisposed
▸ Protected isDoubleClick(point, eventArgs?): boolean
returns true if double clicked
| Name | Type | Description |
|---|---|---|
point | Point | Click point |
Optional eventArgs | EventArgs | optional event args to verify double click |
boolean
AbstractLogVisualEditingTool.isDoubleClick
▸ isEnabled(): boolean
returns enable state
boolean
state
AbstractLogVisualEditingTool.isEnabled
▸ isSilent(): boolean
Return true if the event dispatcher doesn't notify any events
boolean
AbstractLogVisualEditingTool.isSilent
▸ isTouchEvent(eventArgs): boolean
return true if the event is a touch event and false otherwise.
| Name | Type | Description |
|---|---|---|
eventArgs | Event | EventArgs | contains info of the event |
boolean
AbstractLogVisualEditingTool.isTouchEvent
▸ Protected makeSelection(x, y): Node[]
Makes a selection according to current position of the pointer
| Name | Type | Description |
|---|---|---|
x | number | X coordinate of the pointer |
y | number | Y coordinate of the pointer |
Node[]
AbstractLogVisualEditingTool.makeSelection
▸ notify<E>(type, source, args?): CurveEditor
Notify listeners
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | event types |
source | CurveEditor | of the event |
Optional args | EventMap[E] | arguments of the event |
this
AbstractLogVisualEditingTool.notify
▸ 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.
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
Optional type | E | type of the event |
Optional callback | (eventType: E, sender: CurveEditor, args: EventMap[E]) => void | function to be called |
this
AbstractLogVisualEditingTool.off
▸ 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 & {
[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;
// ...
}| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | type of event or property |
callback | (eventType: E, sender: CurveEditor, args: EventMap[E]) => void | to be called |
AbstractLogVisualEditingTool.on
▸ Protected onActiveStateChanged(): void
Fires
void
AbstractLogVisualEditingTool.onActiveStateChanged
▸ Protected onEnabledStateChanged(): void
Called when the tool is enabled or disabled
void
AbstractLogVisualEditingTool.onEnabledStateChanged
▸ onMouseDown(eventArgs): CurveEditor
Handles the event caused by user pressing the mouse button
| Name | Type | Description |
|---|---|---|
eventArgs | EventArgs | Native event arguments received from EventDispatcher |
AbstractLogVisualEditingTool.onMouseDown
▸ onMouseMove(eventArgs): CurveEditor
Handles the event caused by user moving the mouse
| Name | Type | Description |
|---|---|---|
eventArgs | EventArgs | Native event arguments received from EventDispatcher |
AbstractLogVisualEditingTool.onMouseMove
▸ onMouseUp(eventArgs): CurveEditor
Handles the event caused by user releasing the mouse button
| Name | Type | Description |
|---|---|---|
eventArgs | EventArgs | Native event arguments received from EventDispatcher |
AbstractLogVisualEditingTool.onMouseUp
▸ pageToCanvas(eventArgs, externalPlot?): Object
return position relative to the canvas
| Name | Type | Description |
|---|---|---|
eventArgs | Event | EventArgs | parentElement the parent HTML element |
Optional externalPlot | Plot | plot |
Object
| Name | Type |
|---|---|
x | number |
y | number |
AbstractLogVisualEditingTool.pageToCanvas
▸ pointToModel(model, eventArgs): Point
converts device coordinates to inner coordinates of node
| Name | Type | Description |
|---|---|---|
model | Node | the model |
eventArgs | Point | EventArgs | arguments of the event OR point in device (plot) coordinates. |
AbstractLogVisualEditingTool.pointToModel
▸ Protected removeHandle(handle, disposeHandles?): CurveEditor
Remove handles
| Name | Type | Description |
|---|---|---|
handle | GhostBearingHandle | GhostBearingHandle[] | handle or array of handles to be removed |
Optional disposeHandles | boolean |
this
AbstractLogVisualEditingTool.removeHandle
▸ removeHandles(): CurveEditor
Clears all the handles from the adapter and manipulator layer
▸ removeListener(eventName, listener?): CurveEditor
remove event listener. The listener reveives the message when the system event happens.
Deprecated
since 4.0 use .off() instead.
| Name | Type | Description |
|---|---|---|
eventName | string | event name |
Optional listener | Function | Function[] | the event listener, if null, remove all listeners for the event |
AbstractLogVisualEditingTool.removeListener
▸ setActive(active): CurveEditor
set active state
Fires
| Name | Type | Description |
|---|---|---|
active | boolean | set active state |
AbstractLogVisualEditingTool.setActive
▸ setActiveHandle(handle): CurveEditor
Sets the handle currently active
| Name | Type | Description |
|---|---|---|
handle | GhostBearingHandle | The handle to be active |
AbstractLogVisualEditingTool.setActiveHandle
▸ setEnabled(enabled): CurveEditor
set enable state
Fires
Fires
| Name | Type | Description |
|---|---|---|
enabled | boolean | sets the enabled state |
this
AbstractLogVisualEditingTool.setEnabled
▸ setHandleInsideTrack(inside): CurveEditor
Sets a flag which defines if the active handle can only move within the track area
| Name | Type | Description |
|---|---|---|
inside | boolean | True to restrict the position of active handle in the track |
▸ 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
| Name | Type | Description |
|---|---|---|
painter | Painter | The painter which will be used to draw the handles for linearly interpolated curves |
AbstractLogVisualEditingTool.setHandlePainter
▸ setHandleSize(size): CurveEditor
Sets the pixel side of the handles to which a size is applicable (anchored handles)
| Name | Type | Description |
|---|---|---|
size | number | The size of the handles in device coordinates (pixels) |
AbstractLogVisualEditingTool.setHandleSize
▸ setHandleStyles(styles): CurveEditor
Sets styles for active, inactive, and ghost states of all handles, and redraws each handle (this will lose edited handles position)
| Name | Type | Description |
|---|---|---|
styles | HandleStyles | object containing stylings for different types of handle states |
AbstractLogVisualEditingTool.setHandleStyles
▸ setHandlesType(handlesType): CurveEditor
Sets handles display type
| Name | Type | Description |
|---|---|---|
handlesType | HandlesType | handles display type |
this
▸ Protected setHandlesVisible(visible): CurveEditor
Iterates through handles and sets the provided visibility. If the visibility is to hide, hides the ghosts as well
| Name | Type | Description |
|---|---|---|
visible | boolean | Visibility flag for handles |
AbstractLogVisualEditingTool.setHandlesVisible
▸ setHideGhostOnDrop(hide): CurveEditor
Gets a flag defining if the ghost should be reset after it has been dropped
| Name | Type | Description |
|---|---|---|
hide | boolean | True to hide ghosts when dropped |
AbstractLogVisualEditingTool.setHideGhostOnDrop
▸ 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.
| Name | Type | Description |
|---|---|---|
hide | boolean | True to hide inactive handles on dragging |
▸ setHideSpillingHandles(hide): CurveEditor
Sets the value of the flag defining if the handles which overflow the track boundaries should be hidden
| Name | Type | Description |
|---|---|---|
hide | boolean | If true, overflowing handles will not display |
▸ setMode(mode): CurveEditor
Sets what kind of edition this adapter has to do for the curve
| Name | Type | Description |
|---|---|---|
mode | Modes | The new mode in which this tool will work |
▸ setMouseRadius(radius): CurveEditor
Sets device radius for mouse events
| Name | Type | Description |
|---|---|---|
radius | number | radius for mouse events |
this
AbstractLogVisualEditingTool.setMouseRadius
▸ setName(name): CurveEditor
set tool name
| Name | Type | Description |
|---|---|---|
name | string | the tool name |
AbstractLogVisualEditingTool.setName
▸ setPosition(x, y): CurveEditor
Sets the last registered position of the mouse in device space
| Name | Type | Description |
|---|---|---|
x | number | The new X position |
y | number | The new Y position |
AbstractLogVisualEditingTool.setPosition
▸ setProperties(properties?): CurveEditor
Sets all the properties pertaining to this object
| Name | Type | Description |
|---|---|---|
Optional properties | Options | An object containing the properties to set |
this
AbstractLogVisualEditingTool.setProperties
▸ setProperty(name, value): CurveEditor
Sets dynamic property by name
| Name | Type | Description |
|---|---|---|
name | string | property name |
value | any | property value |
this
AbstractLogVisualEditingTool.setProperty
▸ setShape(shape): CurveEditor
Sets the shape which this tool has to manipulate and calculate its handles from.
| Name | Type | Description |
|---|---|---|
shape | Node | The new shape to set for manipulation |
AbstractLogVisualEditingTool.setShape
▸ setShowGhost(showGhost): CurveEditor
Sets the flag defining if a ghost should be moved instead of the actual handle
| Name | Type | Description |
|---|---|---|
showGhost | boolean | Show ghost flag |
AbstractLogVisualEditingTool.setShowGhost
▸ setSilent(bool): CurveEditor
Set silent mode
| Name | Type | Description |
|---|---|---|
bool | boolean | flag to enable silent mode |
this
AbstractLogVisualEditingTool.setSilent
▸ setSlotEnabled(eventName, value, target?): CurveEditor
Sets slot enabled
| Name | Type | Description |
|---|---|---|
eventName | string | eventName |
value | boolean | value |
Optional target | EventTarget | target |
AbstractLogVisualEditingTool.setSlotEnabled
▸ 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);| Name | Type | Description |
|---|---|---|
Optional slots | Record<string, Slot | Slot[] | (eventArgs: EventArgs) => void> | type of system events |
Optional merge | boolean | set to true if you want to merge with existing slots |
this
AbstractLogVisualEditingTool.setSlots
▸ setTouchRadius(radius): CurveEditor
Sets device radius for touch events
| Name | Type | Description |
|---|---|---|
radius | number | radius for touch events |
this
AbstractLogVisualEditingTool.setTouchRadius
▸ setVerticalEditAllowed(allow): CurveEditor
Sets a flag defining if the data points can change their depths
| Name | Type | Description |
|---|---|---|
allow | boolean | True to allow depth change |
▸ showHandles(): CurveEditor
Shows all existing handles on the screen.
▸ Protected start(eventArgs?): CurveEditor
start
| Name | Type | Description |
|---|---|---|
Optional eventArgs | EventArgs | event args |
AbstractLogVisualEditingTool.start
▸ Protected stop(): CurveEditor
stop
AbstractLogVisualEditingTool.stop
▸ toggle(): CurveEditor
switch enable state to opposite state
AbstractLogVisualEditingTool.toggle
▸ update(): void
Updates the state of the tool, recalculated and redraws the handles and curve limits (for spilling handles)
void
AbstractLogVisualEditingTool.update
▸ Static canvasToClient(plotPoint, plot): Point
Convert plot coordinates to global coordinates
AbstractLogVisualEditingTool.canvasToClient
▸ Static clientToCanvas(nativeEvent, plot): Point
Convert global coordinates to plot coordinates
| Name | Type | Description |
|---|---|---|
nativeEvent | Event | native browser event |
plot | Plot | plot with canvas |
AbstractLogVisualEditingTool.clientToCanvas
▸ Static getClassName(): string
string
AbstractLogVisualEditingTool.getClassName
▸ Static getExclusiveTool(plot): AbstractTool
return exclusive tool associated with plot
| Name | Type | Description |
|---|---|---|
plot | Plot | plot |
tool
AbstractLogVisualEditingTool.getExclusiveTool
▸ Static getNativeEventName(eventName): string[]
Returns native event name
| Name | Type | Description |
|---|---|---|
eventName | string | W3C Pointer Events Recommendation name |
string[]
AbstractLogVisualEditingTool.getNativeEventName
▸ Static isTouchEvent(eventArgs): eventArgs is TouchEvent
return true if the event is a touch event and false otherwise.
| Name | Type | Description |
|---|---|---|
eventArgs | Event | EventArgs | contains info of the event |
eventArgs is TouchEvent
AbstractLogVisualEditingTool.isTouchEvent
▸ Static lock(plot, tool): void
Set exclusive tool for plot
| Name | Type | Description |
|---|---|---|
plot | Plot | plot |
tool | AbstractTool | tool |
void
AbstractLogVisualEditingTool.lock
▸ Static setDefaultMouseRadius(radius): void
Sets default device radius for mouse events
| Name | Type | Description |
|---|---|---|
radius | number | radius for mouse events |
void
AbstractLogVisualEditingTool.setDefaultMouseRadius
▸ Static setDefaultTouchRadius(radius): void
Sets default device radius for touch events
| Name | Type | Description |
|---|---|---|
radius | number | radius for touch events |
void
AbstractLogVisualEditingTool.setDefaultTouchRadius
▸ Static unlock(value): void
Remove exclusive tool from plot
| Name | Type | Description |
|---|---|---|
value | AbstractTool | Plot | value |
void