API / geotoolkit3d / tool / AbstractTool / 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.
↳
AbstractTool
Constructors
Methods
Constructors
• Protected new AbstractTool(options)
| Name | Type | Description |
|---|---|---|
options | Options | The options |
EventDispatcher.constructor
Methods
▸ dispose(): void
Disposes the tool
void
▸ getClassName(): string
string
▸ getName(): string
Returns the tool name.
string
The tool's name
▸ getOptions(): Required<Options>
Get abstract tool options
Required<Options>
options
▸ getPlot(): Plot
Get the plot of this Tool.
▸ 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
EventDispatcher.hasEventListener
▸ isDisposed(): boolean
Returns whether this object has been disposed
boolean
▸ isSilent(): boolean
Return true if the event dispatcher doesn't notify any events
boolean
▸ 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
▸ notify<E>(type, source, args?): AbstractTool
Notify listeners
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | event types |
source | AbstractTool | of the event |
Optional args | EventMap[E] | arguments of the event |
this
▸ 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.
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
Optional type | E | type of the event |
Optional callback | (eventType: E, sender: AbstractTool, args: EventMap[E]) => void | function to be called |
this
▸ 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.
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | type of event or property |
callback | (eventType: E, sender: AbstractTool, args: EventMap[E]) => void | to be called |
this
▸ Abstract onContext(event): void
Called when a 'context' event has occurred
| Name | Type | Description |
|---|---|---|
event | PointerEvent | the native event with plot coordinates added |
void
▸ Abstract onDoubleClick(event): void
Called when a 'doubleclick' event has occurred
| Name | Type | Description |
|---|---|---|
event | PointerEvent | the native event with plot coordinates added |
void
▸ Abstract onKeyDown(event): void
Called when a 'keydown' event has occurred
| Name | Type | Description |
|---|---|---|
event | KeyboardEvent | the native event with plot coordinates added |
void
▸ Abstract onKeyUp(event): void
Called when a 'keyup' event has occurred
| Name | Type | Description |
|---|---|---|
event | KeyboardEvent | the native event with plot coordinates added |
void
▸ Abstract onMouseDown(event): void
Called when a 'mousedown' event has occurred
| Name | Type | Description |
|---|---|---|
event | PointerEvent | the native event with plot coordinates added |
void
▸ Abstract onMouseMove(event): void
Called when a 'mousemove' event has occurred
| Name | Type | Description |
|---|---|---|
event | PointerEvent | the native event with plot coordinates added |
void
▸ Abstract onMouseOut(event): void
Called when a 'mouseout' event has occurred
| Name | Type | Description |
|---|---|---|
event | PointerEvent | the native event with plot coordinates added |
void
▸ Abstract onMouseUp(event): void
Called when a 'mouseup' event has occurred
| Name | Type | Description |
|---|---|---|
event | PointerEvent | the native event with plot coordinates added |
void
▸ Abstract onMouseWheel(event): void
Called when a 'mousewheel' event has occurred
| Name | Type | Description |
|---|---|---|
event | WheelEvent | the native event with plot coordinates added |
void
▸ Abstract onTouchEnd(event): void
Called when a 'touchend' event has occurred
| Name | Type | Description |
|---|---|---|
event | PointerEvent | the native event with plot coordinates added |
void
▸ Abstract onTouchMove(event): void
Called when a 'touchmove' event has occurred
| Name | Type | Description |
|---|---|---|
event | PointerEvent | the native event with plot coordinates added |
void
▸ Abstract onTouchStart(event): void
Called when a 'touchstart' event has occurred
| Name | Type | Description |
|---|---|---|
event | PointerEvent | the native event with plot coordinates added |
void
▸ Abstract onVisibilityChanged(event): void
Called when a 'onVisibilityChanged' event has occurred
| Name | Type | Description |
|---|---|---|
event | PointerEvent | the native event with plot coordinates added |
void
▸ 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.
| Name | Type | Description |
|---|---|---|
options | Options | The options |
this
▸ setSilent(bool): AbstractTool
Set silent mode
| Name | Type | Description |
|---|---|---|
bool | boolean | flag to enable silent mode |
this
▸ setup(deviceSupport): AbstractTool
This function allows tools to bind their events to the device support
| Name | Type | Description |
|---|---|---|
deviceSupport | AbstractDeviceSupport | the type of device we are attaching to |
▸ Static getClassName(): string
string