Last updated

API / geotoolkit / widgets / tools / FloatingAnnotationTool / FloatingAnnotationTool

Class: FloatingAnnotationTool

tools.FloatingAnnotationTool.FloatingAnnotationTool

Define tool to move any node which supports ILayoutable interface inside of AnnotatedWidget and its subclasses

Hierarchy

Table of contents

Constructors
Methods
Css Properties
Name Type Description
centercontainerCompositeNodeCenter container to keep floating annotations
centercontainer-clippingbooleanEnable clipping, this does not consider the clipstyle, it is related to bounds-clipping
centercontainer-clipstyleClipStyleClipping style
centercontainer-clipstyle-evenoddbooleanTrue if evenodd mode is on ('nonzero' mode otherwise)
centercontainer-clipstyle-geometryGraphicsPathClipping geometry
centercontainer-clipstyle-geometry-boundsRectBounds
centercontainer-clipstyle-geometry-bounds-heightnumberHeight
centercontainer-clipstyle-geometry-bounds-readonlybooleanReadonly
centercontainer-clipstyle-geometry-bounds-widthnumberWidth
centercontainer-clipstyle-geometry-bounds-xnumberLeft
centercontainer-clipstyle-geometry-bounds-ynumberTop
centercontainer-clipstyleGraphicsPathClipping style
centercontainer-cssclassstringThe css class name of this node
centercontainer-csscursorstringCSS cursor associated with node
centercontainer-cssstylestringCSS style to be applied to inserted elements
centercontainer-idstring | numberId of the node, its a unique identifier
centercontainer-infinitybooleanMode to render outside the model limits
centercontainer-localtransformTransformationLocal transformation
centercontainer-localtransform-dxnumberX axis translation
centercontainer-localtransform-dynumberY axis translation
centercontainer-localtransform-xxnumberX scale
centercontainer-localtransform-xynumberXy skew
centercontainer-localtransform-yxnumberYx skew
centercontainer-localtransform-yynumberY scale
centercontainer-marginsnumber | stringIt has properties for specifying the margins for each side
centercontainer-namestringName of the node. It is often used for debugging purposes or to simplify queries
centercontainer-opacitynumberNode opacity (from 0 to 1). If it is undefined or null it inherits property from the parent. It changes globalAlpha on the rendering context
centercontainer-opacityblendmodeBlendModeNode opacity mode to blend it
centercontainer-scalescrollstrategyScaleScrollStrategyScale scroll strategy
centercontainer-scalescrollstrategy-enabledbooleanEnable flag
centercontainer-selectablebooleanSelectable node, a boolean to determine if selection should consider this node
centercontainer-taganyCustom 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
centercontainer-transformstringAdditional CSS transformation applied to node or 'none'
centercontainer-transformTransformationAdditional CSS transformation applied to node or 'none'
centercontainer-visiblebooleanVisibility of the node, a boolean to determine if the node should be rendered or not
centercontainer-z-indexnumberDefine node z-index
enabledbooleanEnabled state
layerCompositeNodeManipulator layer
mouseradiusnumberDevice radius for mouse events
namestringName of the tool used like cross-hair etc
paddingnumberPadding around the item
touchradiusnumberDevice radius for touch events

Contents

Constructors

new FloatingAnnotationTool(options)

new FloatingAnnotationTool(options?)

Create tool to move or resize floating annotations

Parameters

Name Type Description
Optional optionsOptionsoptions

Overrides

AbstractTool.constructor

Methods

addListener

addListener(eventName, listener): FloatingAnnotationTool

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)

Parameters

Name Type Description
eventNamestringevent name or unique event identifier
listenerFunctionthe event listener

Returns

FloatingAnnotationTool

Inherited from

AbstractTool.addListener


captureMouseUp

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.

Returns

void

Inherited from

AbstractTool.captureMouseUp


dispose

dispose(): void

Dispose tool.

Returns

void

Inherited from

AbstractTool.dispose


fireEvent

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()

Parameters

Name Type Description
eventNamestringevent name
Optional eventArgsanycontains info of the event

Returns

void

Inherited from

AbstractTool.fireEvent


getClassName

getClassName(): string

Returns

string

Inherited from

AbstractTool.getClassName


getEventRadius

Protected getEventRadius(eventArgs): number

Returns device radius for the provided event

Parameters

Name Type Description
eventArgsEventArgscontains info of the event

Returns

number

Inherited from

AbstractTool.getEventRadius


getManipulatorLayer

getManipulatorLayer(): CompositeNode<Node>

return manipulator layer

Returns

CompositeNode<Node>

layer

Inherited from

AbstractTool.getManipulatorLayer


getMouseRadius

getMouseRadius(): number

Returns current device radius for mouse events

Returns

number

Inherited from

AbstractTool.getMouseRadius


getName

getName(): string

return tool name if any

Returns

string

name of the tool

Inherited from

AbstractTool.getName


getNodeFilter

getNodeFilter(): (nodes: Node[]) => FloatingAnnotation

Gets floating annotation filter

Returns

fn

function to filter selected node

▸ (nodes): FloatingAnnotation

Gets floating annotation filter

Parameters
Name Type
nodesNode[]
Returns

FloatingAnnotation

function to filter selected node


getPadding

getPadding(): number

Returns

number

padding


getParentTool

getParentTool(): AbstractCompositeTool

Gets parent tool

Returns

AbstractCompositeTool

parent tool

Inherited from

AbstractTool.getParentTool


getPlaceHolderFilter

getPlaceHolderFilter(): (location: AnnotationLocation) => boolean

Returns placeHolver filter

Returns

fn

placeholver filter

▸ (location): boolean

Returns placeHolver filter

Parameters
Name Type
locationAnnotationLocation
Returns

boolean

placeholver filter


getPlaceholder

getPlaceholder(): Group<Node>

Get placeholder group

Returns

Group<Node>

Placeholder group


getProperties

getProperties(context?): OptionsOut

Returns all the properties pertaining to this object

Parameters

Name Type Description
Optional contextISerializationContextserialization context

Returns

OptionsOut

An object containing the properties

Overrides

AbstractTool.getProperties


getProperty

getProperty(name): any

Gets dynamic property by name. These properties can be used as a property bags

Parameters

Name Type Description
namestringproperty name

Returns

any

Inherited from

AbstractTool.getProperty


getPropertyKeys

getPropertyKeys(): string[]

Returns known properties keys

Returns

string[]

Inherited from

AbstractTool.getPropertyKeys


getRoot

getRoot(): AbstractCompositeTool

Gets root tool

Returns

AbstractCompositeTool

parent tool

Inherited from

AbstractTool.getRoot


getSelectedItem

getSelectedItem(): FloatingAnnotation

Return selected item at the current moment

Returns

FloatingAnnotation

selected item


getTouchRadius

getTouchRadius(): number

Returns current device radius for touch events

Returns

number

Inherited from

AbstractTool.getTouchRadius


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

AbstractTool.hasEventListener


isActive

isActive(): boolean

return active state

Returns

boolean

Inherited from

AbstractTool.isActive


isDisposed

isDisposed(): boolean

Returns whether this object has been disposed

Returns

boolean

Inherited from

AbstractTool.isDisposed


isDoubleClick

Protected isDoubleClick(point, eventArgs?): boolean

returns true if double clicked

Parameters

Name Type Description
pointPointClick point
Optional eventArgsEventArgsoptional event args to verify double click

Returns

boolean

Inherited from

AbstractTool.isDoubleClick


isEnabled

isEnabled(): boolean

returns enable state

Returns

boolean

state

Inherited from

AbstractTool.isEnabled


isSilent

isSilent(): boolean

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

Returns

boolean

Inherited from

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

AbstractTool.isTouchEvent


notify

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

Notify listeners

Type parameters

NameType
Eextends string

Parameters

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

Returns

FloatingAnnotationTool

this

Inherited from

AbstractTool.notify


off

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

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

Returns

FloatingAnnotationTool

this

Inherited from

AbstractTool.off


on

on<E>(type, callback): FloatingAnnotationTool

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 &amp; {
[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;
// ...
}

Type parameters

NameType
Eextends string

Parameters

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

Returns

FloatingAnnotationTool

Inherited from

AbstractTool.on


onActiveStateChanged

Protected onActiveStateChanged(): void

Fires

Events.onStateChanged

Returns

void

Inherited from

AbstractTool.onActiveStateChanged


onEnabledStateChanged

Protected onEnabledStateChanged(): void

Fires

Events.onEnabledStateChanged

Returns

void

Inherited from

AbstractTool.onEnabledStateChanged


pageToCanvas

pageToCanvas(eventArgs, externalPlot?): Object

return position relative to the canvas

Parameters

Name Type Description
eventArgsEvent | EventArgsparentElement the parent HTML element
Optional externalPlotPlotplot

Returns

Object

NameType
xnumber
ynumber

Inherited from

AbstractTool.pageToCanvas


pointToModel

pointToModel(model, eventArgs): Point

converts device coordinates to inner coordinates of node

Parameters

Name Type Description
modelNodethe model
eventArgsPoint | EventArgsarguments of the event OR point in device (plot) coordinates.

Returns

Point

Inherited from

AbstractTool.pointToModel


removeListener

removeListener(eventName, listener?): FloatingAnnotationTool

remove event listener. The listener reveives the message when the system event happens.

Deprecated

since 4.0 use .off() instead.

Parameters

Name Type Description
eventNamestringevent name
Optional listenerFunction | Function[]the event listener, if null, remove all listeners for the event

Returns

FloatingAnnotationTool

Inherited from

AbstractTool.removeListener


setActive

setActive(active): FloatingAnnotationTool

set active state

Fires

Events.onStateChanged

Parameters

Name Type Description
activebooleanset active state

Returns

FloatingAnnotationTool

Inherited from

AbstractTool.setActive


setEnabled

setEnabled(enabled): FloatingAnnotationTool

set enable state

Fires

Events.onEnabledStateChanged

Fires

Events.onStateChanged

Parameters

Name Type Description
enabledbooleansets the enabled state

Returns

FloatingAnnotationTool

this

Inherited from

AbstractTool.setEnabled


setMouseRadius

setMouseRadius(radius): FloatingAnnotationTool

Sets device radius for mouse events

Parameters

Name Type Description
radiusnumberradius for mouse events

Returns

FloatingAnnotationTool

this

Inherited from

AbstractTool.setMouseRadius


setName

setName(name): FloatingAnnotationTool

set tool name

Parameters

Name Type Description
namestringthe tool name

Returns

FloatingAnnotationTool

Inherited from

AbstractTool.setName


setNodeFilter

setNodeFilter(filter): FloatingAnnotationTool

Sets filter of floating annotations

Parameters

Name Type Description
filterFloatingAnnotation | (nodes: Node[]) => FloatingAnnotationfloating annotation filter

Returns

FloatingAnnotationTool


setPadding

setPadding(padding): FloatingAnnotationTool

set padding

Parameters

Name Type Description
paddingnumberpadding

Returns

FloatingAnnotationTool

this


setPlaceHolderFilter

setPlaceHolderFilter(filter): FloatingAnnotationTool

Set placeHolder filter

Parameters

Name Type Description
filter(location: AnnotationLocation) => booleanplaceHolder filter

Returns

FloatingAnnotationTool

this


setProperties

setProperties(properties): FloatingAnnotationTool

Sets all the properties pertaining to this object

Parameters

Name Type Description
propertiesOptionsAn object containing the properties to set

Returns

FloatingAnnotationTool

this

Overrides

AbstractTool.setProperties


setProperty

setProperty(name, value): FloatingAnnotationTool

Sets dynamic property by name

Parameters

Name Type Description
namestringproperty name
valueanyproperty value

Returns

FloatingAnnotationTool

this

Inherited from

AbstractTool.setProperty


setSilent

setSilent(bool): FloatingAnnotationTool

Set silent mode

Parameters

Name Type Description
boolbooleanflag to enable silent mode

Returns

FloatingAnnotationTool

this

Inherited from

AbstractTool.setSilent


setSlotEnabled

setSlotEnabled(eventName, value, target?): FloatingAnnotationTool

Sets slot enabled

Parameters

Name Type Description
eventNamestringeventName
valuebooleanvalue
Optional targetEventTargettarget

Returns

FloatingAnnotationTool

Inherited from

AbstractTool.setSlotEnabled


setSlots

setSlots(slots?, merge?): FloatingAnnotationTool

Sets new slots.

Example

const slots = {
'pointerdown': (event: EventArgs) => {
// event is an instance of @int/geotoolkit/controls/tools/EventArgs
...
}
};
tool.setSlots(slots);

Parameters

Name Type Description
Optional slotsRecord<string, Slot | Slot[] | (eventArgs: EventArgs) => void>type of system events
Optional mergebooleanset to true if you want to merge with existing slots

Returns

FloatingAnnotationTool

this

Inherited from

AbstractTool.setSlots


setTouchRadius

setTouchRadius(radius): FloatingAnnotationTool

Sets device radius for touch events

Parameters

Name Type Description
radiusnumberradius for touch events

Returns

FloatingAnnotationTool

this

Inherited from

AbstractTool.setTouchRadius


start

Protected start(eventArgs?): FloatingAnnotationTool

start

Parameters

Name Type Description
Optional eventArgsEventArgsevent args

Returns

FloatingAnnotationTool

Inherited from

AbstractTool.start


stop

Protected stop(): FloatingAnnotationTool

stop

Returns

FloatingAnnotationTool

Inherited from

AbstractTool.stop


toggle

toggle(): FloatingAnnotationTool

switch enable state to opposite state

Returns

FloatingAnnotationTool

Inherited from

AbstractTool.toggle


canvasToClient

Static canvasToClient(plotPoint, plot): Point

Convert plot coordinates to global coordinates

Parameters

Name Type Description
plotPointPointpoint in plot coordinates
plotPlotplot with canvas

Returns

Point

Inherited from

AbstractTool.canvasToClient


clientToCanvas

Static clientToCanvas(nativeEvent, plot): Point

Convert global coordinates to plot coordinates

Parameters

Name Type Description
nativeEventEventnative browser event
plotPlotplot with canvas

Returns

Point

Inherited from

AbstractTool.clientToCanvas


getClassName

Static getClassName(): string

Returns

string

Inherited from

AbstractTool.getClassName


getExclusiveTool

Static getExclusiveTool(plot): AbstractTool

return exclusive tool associated with plot

Parameters

Name Type Description
plotPlotplot

Returns

AbstractTool

tool

Inherited from

AbstractTool.getExclusiveTool


getNativeEventName

Static getNativeEventName(eventName): string[]

Returns native event name

Parameters

Name Type Description
eventNamestringW3C Pointer Events Recommendation name

Returns

string[]

Inherited from

AbstractTool.getNativeEventName


isTouchEvent

Static isTouchEvent(eventArgs): eventArgs is TouchEvent

return true if the event is a touch event and false otherwise.

Parameters

Name Type Description
eventArgsEvent | EventArgscontains info of the event

Returns

eventArgs is TouchEvent

Inherited from

AbstractTool.isTouchEvent


lock

Static lock(plot, tool): void

Set exclusive tool for plot

Parameters

Name Type Description
plotPlotplot
toolAbstractTooltool

Returns

void

Inherited from

AbstractTool.lock


setDefaultMouseRadius

Static setDefaultMouseRadius(radius): void

Sets default device radius for mouse events

Parameters

Name Type Description
radiusnumberradius for mouse events

Returns

void

Inherited from

AbstractTool.setDefaultMouseRadius


setDefaultTouchRadius

Static setDefaultTouchRadius(radius): void

Sets default device radius for touch events

Parameters

Name Type Description
radiusnumberradius for touch events

Returns

void

Inherited from

AbstractTool.setDefaultTouchRadius


unlock

Static unlock(value): void

Remove exclusive tool from plot

Parameters

Name Type Description
valueAbstractTool | Plotvalue

Returns

void

Inherited from

AbstractTool.unlock