API / geotoolkit3d / tool / MeasuringTool / MeasuringTool
tool.MeasuringTool.MeasuringTool
A tool that implements selection mechanism.
This tool will perform a picking operation on click/tap using RendererPicking.
Then it will notify the attached listeners about what has been picked.
Note that if the picking found nothing, the listeners will be notified that nothing has been picked too.
The selection tool can be configured to pick an area instead of a single pixel.
In that case it may propagate a selection containing more than one object.
↳
MeasuringTool
Constructors
Methods
Constructors
• new MeasuringTool(options?)
| Name | Type |
|---|---|
Optional options | Options |
AbstractGestureTool.constructor
Methods
▸ dispose(): void
Dispose measuring tool
void
▸ getAnchorPosition(): Vector3
Get the Anchor position. Can return null if set/reset to null by the user.
Vector3
▸ getClassName(): string
string
AbstractGestureTool.getClassName
▸ getDefaultPosition(): Vector3
Get the default position for handles, by which the handles position are replaced when calling resetPosition().
Vector3
▸ getDistance(): number
Function to get the current distance of the two points from the tool.
number
distance between the two points, or null if one of the two point is null.
▸ getName(): string
Returns the tool name.
string
The tool's name
▸ getOptions(): Required<Omit<Options, "resetposition">>
Get abstract gesture tool options
Required<Omit<Options, "resetposition">>
options
AbstractGestureTool.getOptions
▸ getPlot(): Plot
Get the plot of this Tool.
▸ getPointerPosition(): Vector3
Get the Pointer position. Can return null if set/reset to null by the user.
Vector3
▸ 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
AbstractGestureTool.hasEventListener
▸ isArmed(): boolean
Return if this tool is 'armed'.
The tool actions are disabled when not armed.
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().
boolean
▸ isDisposed(): boolean
Returns whether this object has been disposed
boolean
AbstractGestureTool.isDisposed
▸ 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
AbstractGestureTool.isTouchEvent
▸ notify<E>(type, source, args?): MeasuringTool
Notify listeners
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | event types |
source | MeasuringTool | of the event |
Optional args | EventMap[E] | arguments of the event |
this
▸ off<E>(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.
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
Optional type | E | type of the event |
Optional callback | (eventType: E, sender: MeasuringTool, args: EventMap[E]) => void | function to be called |
this
▸ on<E>(type, callback): MeasuringTool
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: MeasuringTool, args: EventMap[E]) => void | to be called |
this
▸ onContext(event): void
Called when a 'context' event has occurred
| Name | Type | Description |
|---|---|---|
event | PointerEvent | the native event with plot coordinates added |
void
▸ onCursorMove(event): void
Called when a 'onCursorMove' event has occurred
| Name | Type | Description |
|---|---|---|
event | CustomPointerEvent | the native event with plot coordinates added |
void
AbstractGestureTool.onCursorMove
▸ onDoubleClick(event): void
Called when a 'doubleclick' event has occurred
| Name | Type | Description |
|---|---|---|
event | CustomPointerEvent | the native event with plot coordinates added |
void
AbstractGestureTool.onDoubleClick
▸ onDoubleTap(event): void
Called when a 'onDoubleTap' event has occurred
| Name | Type | Description |
|---|---|---|
event | CustomPointerEvent | the native event with plot coordinates added |
void
AbstractGestureTool.onDoubleTap
▸ onDrag(event): void
Called when a 'onDrag' event has occurred
| Name | Type | Description |
|---|---|---|
event | CustomPointerEvent | the native event with plot coordinates added |
void
▸ onDragEnd(event): void
Called when a 'onDragEnd' event has occurred
| Name | Type | Description |
|---|---|---|
event | CustomPointerEvent | the native event with plot coordinates added |
void
▸ onDragStart(event): void
Called when a 'onDragStart' event has occurred
| Name | Type | Description |
|---|---|---|
event | CustomPointerEvent | the native event with plot coordinates added |
void
AbstractGestureTool.onDragStart
▸ onKey(event): void
Called when a 'onKey' event has occurred
| Name | Type | Description |
|---|---|---|
event | KeyboardEvent | the native event with plot coordinates added |
void
▸ onKeyDown(event): void
Called when a 'keydown' event has occurred
| Name | Type | Description |
|---|---|---|
event | KeyboardEvent | the native event with plot coordinates added |
void
▸ onKeyEnd(event): void
Called when a 'onKeyEnd' event has occurred
| Name | Type | Description |
|---|---|---|
event | KeyboardEvent | the native event with plot coordinates added |
void
▸ onKeyStart(event): void
Called when a 'onKeyStart' event has occurred
| Name | Type | Description |
|---|---|---|
event | KeyboardEvent | the native event with plot coordinates added |
void
AbstractGestureTool.onKeyStart
▸ onKeyUp(event): void
Called when a 'keyup' event has occurred
| Name | Type | Description |
|---|---|---|
event | KeyboardEvent | the native event with plot coordinates added |
void
▸ onMouseDown(event): void
Called when a 'mousedown' event has occurred
| Name | Type | Description |
|---|---|---|
event | CustomPointerEvent | the native event with plot coordinates added |
void
AbstractGestureTool.onMouseDown
▸ onMouseMove(event): void
Called when a 'mousemove' event has occurred
| Name | Type | Description |
|---|---|---|
event | CustomPointerEvent | the native event with plot coordinates added |
void
AbstractGestureTool.onMouseMove
▸ onMouseOut(event): void
Called when a 'mouseout' event has occurred
| Name | Type | Description |
|---|---|---|
event | CustomPointerEvent | the native event with plot coordinates added |
void
AbstractGestureTool.onMouseOut
▸ onMouseUp(event): void
Called when a 'mouseup' event has occurred
| Name | Type | Description |
|---|---|---|
event | CustomPointerEvent | the native event with plot coordinates added |
void
▸ onMouseWheel(event): void
Called when a 'mousewheel' event has occurred
| Name | Type | Description |
|---|---|---|
event | WheelEvent | the native event with plot coordinates added |
void
AbstractGestureTool.onMouseWheel
▸ onPinch(event): void
Called when a 'onPinch' event has occurred
| Name | Type | Description |
|---|---|---|
event | MovePointerEvent | the native event with plot coordinates added |
void
▸ onPinchEnd(event): void
Called when a 'onPinchEnd' event has occurred
| Name | Type | Description |
|---|---|---|
event | CustomPointerEvent | the native event with plot coordinates added |
void
AbstractGestureTool.onPinchEnd
▸ onPinchStart(event): void
Called when a 'onPinchStart' event has occurred
| Name | Type | Description |
|---|---|---|
event | MovePointerEvent | the native event with plot coordinates added |
void
AbstractGestureTool.onPinchStart
▸ onSlide(event): void
Called when a 'onSlide' event has occurred
| Name | Type | Description |
|---|---|---|
event | CustomPointerEvent | the native event with plot coordinates added |
void
▸ onSlideEnd(event): void
Called when a 'onSlideEnd' event has occurred
| Name | Type | Description |
|---|---|---|
event | CustomPointerEvent | the native event with plot coordinates added |
void
AbstractGestureTool.onSlideEnd
▸ onSlideStart(event): void
Called when a 'onSlideStart' event has occurred
| Name | Type | Description |
|---|---|---|
event | CustomPointerEvent | the native event with plot coordinates added |
void
AbstractGestureTool.onSlideStart
▸ onTap(event): void
Called when a 'onTap' event has occurred
| Name | Type | Description |
|---|---|---|
event | CustomPointerEvent | the native event with plot coordinates added |
void
▸ onTouchEnd(event): void
Called when a 'touchend' event has occurred
| Name | Type | Description |
|---|---|---|
event | CustomPointerEvent | the native event with plot coordinates added |
void
AbstractGestureTool.onTouchEnd
▸ onTouchMove(event): void
Called when a 'touchmove' event has occurred
| Name | Type | Description |
|---|---|---|
event | CustomPointerEvent | the native event with plot coordinates added |
void
AbstractGestureTool.onTouchMove
▸ onTouchStart(event): void
Called when a 'touchstart' event has occurred
| Name | Type | Description |
|---|---|---|
event | CustomPointerEvent | the native event with plot coordinates added |
void
AbstractGestureTool.onTouchStart
▸ onVisibilityChanged(event): void
Called when a 'onVisibilityChanged' event has occurred
| Name | Type | Description |
|---|---|---|
event | CustomPointerEvent | the native event with plot coordinates added |
void
AbstractGestureTool.onVisibilityChanged
▸ onVisibilityGained(event): void
Called when a 'onVisibilityGained' event has occurred
| Name | Type | Description |
|---|---|---|
event | CustomPointerEvent | the native event with plot coordinates added |
void
AbstractGestureTool.onVisibilityGained
▸ onVisibilityLost(event): void
Called when a 'onVisibilityLost' event has occurred
| Name | Type | Description |
|---|---|---|
event | CustomPointerEvent | the native event with plot coordinates added |
void
AbstractGestureTool.onVisibilityLost
▸ resetPosition(): MeasuringTool
Reset the handles to the default position.
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.
▸ 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.
| Name | Type | Description |
|---|---|---|
position | Vector3 | the Anchor position. |
▸ setChildrenVisibility(visible): MeasuringTool
sets the visibility of this tool visuals (Handles and line, which are children of this object).
| Name | Type | Description |
|---|---|---|
visible | boolean | to set the visibility of the visuals. |
▸ setDefaultPosition(position, resetPosition?): MeasuringTool
Define the handles default position, and reset the position if desired.
If the position is set to null, the handles and line will not be visible until the MeasuringTool is operated to find new positions.
| Name | Type | Description |
|---|---|---|
position | Vector3 | new handles position, can be null if desired. |
Optional resetPosition | boolean | if true, pointer and anchor positions will be reset. |
▸ setOptions(options): MeasuringTool
Set options
| Name | Type |
|---|---|
options | Options |
AbstractGestureTool.setOptions
▸ 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.
| Name | Type | Description |
|---|---|---|
position | Vector3 | the Pointer position. |
▸ setSilent(bool): MeasuringTool
Set silent mode
| Name | Type | Description |
|---|---|---|
bool | boolean | flag to enable silent mode |
this
▸ setup(deviceSupport): MeasuringTool
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