Skip to content
Last updated

API / geotoolkit3d / tool / MeasuringTool / MeasuringTool

Class: MeasuringTool

tool.MeasuringTool.MeasuringTool

A tool that implements selection mechanism.<br> <br> This tool will perform a picking operation on click/tap using RendererPicking.<br> Then it will notify the attached listeners about what has been picked.<br> <br> Note that if the picking found nothing, the listeners will be notified that nothing has been picked too.<br> <br> The selection tool can be configured to pick an area instead of a single pixel.<br> In that case it may propagate a selection containing more than one object.<br>

Hierarchy

Table of contents

Constructors
  • [new MeasuringTool(options)](/solutions/geotoolkit/GeoToolkit_JS/apis/classes/geotoolkit3d.tool.measuringtool.measuringtool.md#new measuringtool(options))
Methods

Contents

Constructors

new MeasuringTool(options)

• new MeasuringTool(options?)

Parameters

Name Type
Optional optionsOptions

Overrides

AbstractGestureTool.constructor

Methods

dispose

▸ dispose(): void

Dispose measuring tool

Returns

void

Overrides

AbstractGestureTool.dispose


getAnchorPosition

▸ getAnchorPosition(): Vector3

Get the Anchor position. Can return null if set/reset to null by the user.

Returns

Vector3


getClassName

▸ getClassName(): string

Returns

string

Inherited from

AbstractGestureTool.getClassName


getDefaultPosition

▸ getDefaultPosition(): Vector3

Get the default position for handles, by which the handles position are replaced when calling resetPosition().

Returns

Vector3


getDistance

▸ getDistance(): number

Function to get the current distance of the two points from the tool.

Returns

number

distance between the two points, or null if one of the two point is null.


getName

▸ getName(): string

Returns the tool name.

Returns

string

The tool's name

Inherited from

AbstractGestureTool.getName


getOptions

▸ getOptions(): Required<Omit<Options, "resetposition"&gt;&gt;

Get abstract gesture tool options

Returns

Required<Omit<Options, "resetposition"&gt;&gt;

options

Overrides

AbstractGestureTool.getOptions


getPlot

▸ getPlot(): Plot

Get the plot of this Tool.

Returns

Plot

Inherited from

AbstractGestureTool.getPlot


getPointerPosition

▸ getPointerPosition(): Vector3

Get the Pointer position. Can return null if set/reset to null by the user.

Returns

Vector3


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

AbstractGestureTool.hasEventListener


isArmed

▸ isArmed(): boolean

Return if this tool is 'armed'.<br> The tool actions are disabled when not armed.<br> A tool can either be armed at all time, or only when a specific key is pressed. To set/unset the arming key, please see this tool option 'armingkey', via .setOptions().

Returns

boolean

Inherited from

AbstractGestureTool.isArmed


isDisposed

▸ isDisposed(): boolean

Returns whether this object has been disposed

Returns

boolean

Inherited from

AbstractGestureTool.isDisposed


isSilent

▸ isSilent(): boolean

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

Returns

boolean

Inherited from

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

AbstractGestureTool.isTouchEvent


notify

▸ notify<E&gt;(type, source, args?): MeasuringTool

Notify listeners

Type parameters

NameType
Eextends string

Parameters

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

Returns

MeasuringTool

this

Overrides

AbstractGestureTool.notify


off

▸ off<E&gt;(type?, callback?): MeasuringTool

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

Returns

MeasuringTool

this

Overrides

AbstractGestureTool.off


on

▸ on<E&gt;(type, callback): MeasuringTool

Attach listener on event that will be called whenever the specified event is delivered to the target <p> If the callback function is already in the list of event listeners for this target, the function is not added a second time. </p> <p> 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. </p>

Type parameters

NameType
Eextends string

Parameters

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

Returns

MeasuringTool

this

Overrides

AbstractGestureTool.on


onContext

▸ onContext(event): void

Called when a 'context' event has occurred

Parameters

Name Type Description
eventPointerEventthe native event with plot coordinates added

Returns

void

Inherited from

AbstractGestureTool.onContext


onCursorMove

▸ onCursorMove(event): void

Called when a 'onCursorMove' event has occurred

Parameters

Name Type Description
eventCustomPointerEventthe native event with plot coordinates added

Returns

void

Overrides

AbstractGestureTool.onCursorMove


onDoubleClick

▸ onDoubleClick(event): void

Called when a 'doubleclick' event has occurred

Parameters

Name Type Description
eventCustomPointerEventthe native event with plot coordinates added

Returns

void

Inherited from

AbstractGestureTool.onDoubleClick


onDoubleTap

▸ onDoubleTap(event): void

Called when a 'onDoubleTap' event has occurred

Parameters

Name Type Description
eventCustomPointerEventthe native event with plot coordinates added

Returns

void

Overrides

AbstractGestureTool.onDoubleTap


onDrag

▸ onDrag(event): void

Called when a 'onDrag' event has occurred

Parameters

Name Type Description
eventCustomPointerEventthe native event with plot coordinates added

Returns

void

Overrides

AbstractGestureTool.onDrag


onDragEnd

▸ onDragEnd(event): void

Called when a 'onDragEnd' event has occurred

Parameters

Name Type Description
eventCustomPointerEventthe native event with plot coordinates added

Returns

void

Overrides

AbstractGestureTool.onDragEnd


onDragStart

▸ onDragStart(event): void

Called when a 'onDragStart' event has occurred

Parameters

Name Type Description
eventCustomPointerEventthe native event with plot coordinates added

Returns

void

Overrides

AbstractGestureTool.onDragStart


onKey

▸ onKey(event): void

Called when a 'onKey' event has occurred

Parameters

Name Type Description
eventKeyboardEventthe native event with plot coordinates added

Returns

void

Overrides

AbstractGestureTool.onKey


onKeyDown

▸ onKeyDown(event): void

Called when a 'keydown' event has occurred

Parameters

Name Type Description
eventKeyboardEventthe native event with plot coordinates added

Returns

void

Inherited from

AbstractGestureTool.onKeyDown


onKeyEnd

▸ onKeyEnd(event): void

Called when a 'onKeyEnd' event has occurred

Parameters

Name Type Description
eventKeyboardEventthe native event with plot coordinates added

Returns

void

Overrides

AbstractGestureTool.onKeyEnd


onKeyStart

▸ onKeyStart(event): void

Called when a 'onKeyStart' event has occurred

Parameters

Name Type Description
eventKeyboardEventthe native event with plot coordinates added

Returns

void

Overrides

AbstractGestureTool.onKeyStart


onKeyUp

▸ onKeyUp(event): void

Called when a 'keyup' event has occurred

Parameters

Name Type Description
eventKeyboardEventthe native event with plot coordinates added

Returns

void

Inherited from

AbstractGestureTool.onKeyUp


onMouseDown

▸ onMouseDown(event): void

Called when a 'mousedown' event has occurred

Parameters

Name Type Description
eventCustomPointerEventthe native event with plot coordinates added

Returns

void

Inherited from

AbstractGestureTool.onMouseDown


onMouseMove

▸ onMouseMove(event): void

Called when a 'mousemove' event has occurred

Parameters

Name Type Description
eventCustomPointerEventthe native event with plot coordinates added

Returns

void

Inherited from

AbstractGestureTool.onMouseMove


onMouseOut

▸ onMouseOut(event): void

Called when a 'mouseout' event has occurred

Parameters

Name Type Description
eventCustomPointerEventthe native event with plot coordinates added

Returns

void

Inherited from

AbstractGestureTool.onMouseOut


onMouseUp

▸ onMouseUp(event): void

Called when a 'mouseup' event has occurred

Parameters

Name Type Description
eventCustomPointerEventthe native event with plot coordinates added

Returns

void

Inherited from

AbstractGestureTool.onMouseUp


onMouseWheel

▸ onMouseWheel(event): void

Called when a 'mousewheel' event has occurred

Parameters

Name Type Description
eventWheelEventthe native event with plot coordinates added

Returns

void

Overrides

AbstractGestureTool.onMouseWheel


onPinch

▸ onPinch(event): void

Called when a 'onPinch' event has occurred

Parameters

Name Type Description
eventMovePointerEventthe native event with plot coordinates added

Returns

void

Overrides

AbstractGestureTool.onPinch


onPinchEnd

▸ onPinchEnd(event): void

Called when a 'onPinchEnd' event has occurred

Parameters

Name Type Description
eventCustomPointerEventthe native event with plot coordinates added

Returns

void

Overrides

AbstractGestureTool.onPinchEnd


onPinchStart

▸ onPinchStart(event): void

Called when a 'onPinchStart' event has occurred

Parameters

Name Type Description
eventMovePointerEventthe native event with plot coordinates added

Returns

void

Overrides

AbstractGestureTool.onPinchStart


onSlide

▸ onSlide(event): void

Called when a 'onSlide' event has occurred

Parameters

Name Type Description
eventCustomPointerEventthe native event with plot coordinates added

Returns

void

Overrides

AbstractGestureTool.onSlide


onSlideEnd

▸ onSlideEnd(event): void

Called when a 'onSlideEnd' event has occurred

Parameters

Name Type Description
eventCustomPointerEventthe native event with plot coordinates added

Returns

void

Overrides

AbstractGestureTool.onSlideEnd


onSlideStart

▸ onSlideStart(event): void

Called when a 'onSlideStart' event has occurred

Parameters

Name Type Description
eventCustomPointerEventthe native event with plot coordinates added

Returns

void

Overrides

AbstractGestureTool.onSlideStart


onTap

▸ onTap(event): void

Called when a 'onTap' event has occurred

Parameters

Name Type Description
eventCustomPointerEventthe native event with plot coordinates added

Returns

void

Overrides

AbstractGestureTool.onTap


onTouchEnd

▸ onTouchEnd(event): void

Called when a 'touchend' event has occurred

Parameters

Name Type Description
eventCustomPointerEventthe native event with plot coordinates added

Returns

void

Inherited from

AbstractGestureTool.onTouchEnd


onTouchMove

▸ onTouchMove(event): void

Called when a 'touchmove' event has occurred

Parameters

Name Type Description
eventCustomPointerEventthe native event with plot coordinates added

Returns

void

Inherited from

AbstractGestureTool.onTouchMove


onTouchStart

▸ onTouchStart(event): void

Called when a 'touchstart' event has occurred

Parameters

Name Type Description
eventCustomPointerEventthe native event with plot coordinates added

Returns

void

Inherited from

AbstractGestureTool.onTouchStart


onVisibilityChanged

▸ onVisibilityChanged(event): void

Called when a 'onVisibilityChanged' event has occurred

Parameters

Name Type Description
eventCustomPointerEventthe native event with plot coordinates added

Returns

void

Inherited from

AbstractGestureTool.onVisibilityChanged


onVisibilityGained

▸ onVisibilityGained(event): void

Called when a 'onVisibilityGained' event has occurred

Parameters

Name Type Description
eventCustomPointerEventthe native event with plot coordinates added

Returns

void

Overrides

AbstractGestureTool.onVisibilityGained


onVisibilityLost

▸ onVisibilityLost(event): void

Called when a 'onVisibilityLost' event has occurred

Parameters

Name Type Description
eventCustomPointerEventthe native event with plot coordinates added

Returns

void

Overrides

AbstractGestureTool.onVisibilityLost


resetPosition

▸ resetPosition(): MeasuringTool

Reset the handles to the default position.<br> If the default position was set to null, the handles will be hidden and getters for pointer, anchor and distance will return null until updated by the tool operation.

Returns

MeasuringTool


setAnchorPosition

▸ setAnchorPosition(position): MeasuringTool

Set the Anchor new position. Can be set to null if desired, which will make the measure line and the Anchor visuals disappears.

Parameters

Name Type Description
positionVector3the Anchor position.

Returns

MeasuringTool


setChildrenVisibility

▸ setChildrenVisibility(visible): MeasuringTool

sets the visibility of this tool visuals (Handles and line, which are children of this object).

Parameters

Name Type Description
visiblebooleanto set the visibility of the visuals.

Returns

MeasuringTool


setDefaultPosition

▸ setDefaultPosition(position, resetPosition?): MeasuringTool

Define the handles default position, and reset the position if desired.<br> If the position is set to null, the handles and line will not be visible until the MeasuringTool is operated to find new positions.

Parameters

Name Type Description
positionVector3new handles position, can be null if desired.
Optional resetPositionbooleanif true, pointer and anchor positions will be reset.

Returns

MeasuringTool


setOptions

▸ setOptions(options): MeasuringTool

Set options

Parameters

Name Type
optionsOptions

Returns

MeasuringTool

Overrides

AbstractGestureTool.setOptions


setPointerPosition

▸ setPointerPosition(position): MeasuringTool

Set the Pointer new position. Can be set to null if desired, which will make the measure line and the Pointer visuals disappears.

Parameters

Name Type Description
positionVector3the Pointer position.

Returns

MeasuringTool


setSilent

▸ setSilent(bool): MeasuringTool

Set silent mode

Parameters

Name Type Description
boolbooleanflag to enable silent mode

Returns

MeasuringTool

this

Inherited from

AbstractGestureTool.setSilent


setup

▸ setup(deviceSupport): MeasuringTool

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

MeasuringTool

Inherited from

AbstractGestureTool.setup


getClassName

▸ Static getClassName(): string

Returns

string

Inherited from

AbstractGestureTool.getClassName