Last updated

API / geotoolkit3d / tool / AbstractTool / AbstractTool

Class: AbstractTool

tool.AbstractTool.AbstractTool

The base class for tools in the 3D Plot.

This implementation uses DeviceSupportRegistry mechanism to retrieve a bridge-object that will deal with hardware/browser specific input devices.
The retrieved DeviceSupport object will listen to native events and call the corresponding generic functions on this tool.

Inheriting classes are responsible to implement those generic function.

One may consider inheriting from AbstractGestureTool for an even more generic/crossplatform approach.

Hierarchy

Table of contents

Constructors
Methods

Contents

Constructors

new AbstractTool(options)

Protected new AbstractTool(options)

Parameters

Name Type Description
optionsOptionsThe options

Overrides

EventDispatcher.constructor

Methods

dispose

dispose(): void

Disposes the tool

Returns

void

Overrides

EventDispatcher.dispose


getClassName

getClassName(): string

Returns

string

Inherited from

EventDispatcher.getClassName


getName

getName(): string

Returns the tool name.

Returns

string

The tool's name


getOptions

getOptions(): Required<Options>

Get abstract tool options

Returns

Required<Options>

options


getPlot

getPlot(): Plot

Get the plot of this Tool.

Returns

Plot


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

EventDispatcher.hasEventListener


isDisposed

isDisposed(): boolean

Returns whether this object has been disposed

Returns

boolean

Inherited from

EventDispatcher.isDisposed


isSilent

isSilent(): boolean

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

Returns

boolean

Inherited from

EventDispatcher.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


notify

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

Notify listeners

Type parameters

NameType
Eextends string

Parameters

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

Returns

AbstractTool

this

Overrides

EventDispatcher.notify


off

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

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: AbstractTool, args: EventMap[E]) => voidfunction to be called

Returns

AbstractTool

this

Overrides

EventDispatcher.off


on

on<E>(type, callback): AbstractTool

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.

Type parameters

NameType
Eextends string

Parameters

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

Returns

AbstractTool

this

Overrides

EventDispatcher.on


onContext

Abstract onContext(event): void

Called when a 'context' event has occurred

Parameters

Name Type Description
eventPointerEventthe native event with plot coordinates added

Returns

void


onDoubleClick

Abstract onDoubleClick(event): void

Called when a 'doubleclick' event has occurred

Parameters

Name Type Description
eventPointerEventthe native event with plot coordinates added

Returns

void


onKeyDown

Abstract onKeyDown(event): void

Called when a 'keydown' event has occurred

Parameters

Name Type Description
eventKeyboardEventthe native event with plot coordinates added

Returns

void


onKeyUp

Abstract onKeyUp(event): void

Called when a 'keyup' event has occurred

Parameters

Name Type Description
eventKeyboardEventthe native event with plot coordinates added

Returns

void


onMouseDown

Abstract onMouseDown(event): void

Called when a 'mousedown' event has occurred

Parameters

Name Type Description
eventPointerEventthe native event with plot coordinates added

Returns

void


onMouseMove

Abstract onMouseMove(event): void

Called when a 'mousemove' event has occurred

Parameters

Name Type Description
eventPointerEventthe native event with plot coordinates added

Returns

void


onMouseOut

Abstract onMouseOut(event): void

Called when a 'mouseout' event has occurred

Parameters

Name Type Description
eventPointerEventthe native event with plot coordinates added

Returns

void


onMouseUp

Abstract onMouseUp(event): void

Called when a 'mouseup' event has occurred

Parameters

Name Type Description
eventPointerEventthe native event with plot coordinates added

Returns

void


onMouseWheel

Abstract onMouseWheel(event): void

Called when a 'mousewheel' event has occurred

Parameters

Name Type Description
eventWheelEventthe native event with plot coordinates added

Returns

void


onTouchEnd

Abstract onTouchEnd(event): void

Called when a 'touchend' event has occurred

Parameters

Name Type Description
eventPointerEventthe native event with plot coordinates added

Returns

void


onTouchMove

Abstract onTouchMove(event): void

Called when a 'touchmove' event has occurred

Parameters

Name Type Description
eventPointerEventthe native event with plot coordinates added

Returns

void


onTouchStart

Abstract onTouchStart(event): void

Called when a 'touchstart' event has occurred

Parameters

Name Type Description
eventPointerEventthe native event with plot coordinates added

Returns

void


onVisibilityChanged

Abstract onVisibilityChanged(event): void

Called when a 'onVisibilityChanged' event has occurred

Parameters

Name Type Description
eventPointerEventthe native event with plot coordinates added

Returns

void


setOptions

setOptions(options): AbstractTool

Set options, the given json will be merged with the object's state so that only the given options will be changed.

Parameters

Name Type Description
optionsOptionsThe options

Returns

AbstractTool

this


setSilent

setSilent(bool): AbstractTool

Set silent mode

Parameters

Name Type Description
boolbooleanflag to enable silent mode

Returns

AbstractTool

this

Inherited from

EventDispatcher.setSilent


setup

setup(deviceSupport): AbstractTool

This function allows tools to bind their events to the device support

Parameters

Name Type Description
deviceSupportAbstractDeviceSupportthe type of device we are attaching to

Returns

AbstractTool


getClassName

Static getClassName(): string

Returns

string

Inherited from

EventDispatcher.getClassName