Skip to main content

MapTool

geovisto-mapReadme | API


geovisto-map / MapTool

Class: MapTool

This class provides basic tools API.

Author

Jiri Hynek

Extends

Implements

Constructors

new MapTool()

new MapTool(props?): MapTool

It initializes the tool.

Parameters

props?: IMapToolProps

Returns

MapTool

Overrides

MapObject.constructor

Source

model/internal/tool/MapTool.ts:25

Methods

copy()

copy(): IMapTool\<IMapToolProps, IMapToolDefaults, IMapToolState\<IMapToolProps, IMapToolDefaults, IMapToolConfig, IMapToolInitProps\<IMapToolConfig>>, IMapToolConfig, IMapToolInitProps\<IMapToolConfig>, IMapToolAPI>

It creates copy of the uninitialized tool.

Returns

IMapTool\<IMapToolProps, IMapToolDefaults, IMapToolState\<IMapToolProps, IMapToolDefaults, IMapToolConfig, IMapToolInitProps\<IMapToolConfig>>, IMapToolConfig, IMapToolInitProps\<IMapToolConfig>, IMapToolAPI>

Implementation of

IMapTool.copy

Source

model/internal/tool/MapTool.ts:32


create()

create(): this

It creates a tool.

Override this function.

Returns

this

Implementation of

IMapTool.create

Source

model/internal/tool/MapTool.ts:121


createDefaults()

protected createDefaults(): IMapToolDefaults

It creates new defaults of the tool.

Returns

IMapToolDefaults

Overrides

MapObject.createDefaults

Source

model/internal/tool/MapTool.ts:53


createState()

protected createState(): IMapToolState\<IMapToolProps, IMapToolDefaults, IMapToolConfig, IMapToolInitProps\<IMapToolConfig>>

It creates new defaults of the tool.

Returns

IMapToolState\<IMapToolProps, IMapToolDefaults, IMapToolConfig, IMapToolInitProps\<IMapToolConfig>>

Overrides

MapObject.createState

Source

model/internal/tool/MapTool.ts:67


getAPIGetter()

getAPIGetter(): undefined | IMapToolAPIGetter

It returns the tool API

Returns

undefined | IMapToolAPIGetter

Implementation of

IMapTool.getAPIGetter

Source

model/internal/tool/MapTool.ts:74


getDefaults()

getDefaults(): IMapToolDefaults

It returns default values of the state properties.

Returns

IMapToolDefaults

Implementation of

IMapTool.getDefaults

Overrides

MapObject.getDefaults

Source

model/internal/tool/MapTool.ts:46


getId()

getId(): string

Help function which returns the id of the object.

Returns

string

Implementation of

IMapTool.getId

Inherited from

MapObject.getId

Source

model/internal/object/MapObject.ts:93


getMap()

getMap(): undefined | IMap\<IMapProps, IMapDefaults, IMapState\<IMapProps, IMapDefaults, IMapConfig>, IMapConfig, IMapInitProps\<IMapConfig>>

Help function returns map which uses this tool.

Do not override this function. Use the state class instead.

Returns

undefined | IMap\<IMapProps, IMapDefaults, IMapState\<IMapProps, IMapDefaults, IMapConfig>, IMapConfig, IMapInitProps\<IMapConfig>>

Implementation of

IMapTool.getMap

Source

model/internal/tool/MapTool.ts:112


getProps()

getProps(): IMapToolProps

Help function which returns the props given by the programmer.

Returns

IMapToolProps

Implementation of

IMapTool.getProps

Overrides

MapObject.getProps

Source

model/internal/tool/MapTool.ts:39


getState()

getState(): IMapToolState\<IMapToolProps, IMapToolDefaults, IMapToolConfig, IMapToolInitProps\<IMapToolConfig>>

It returns the map tool state.

Returns

IMapToolState\<IMapToolProps, IMapToolDefaults, IMapToolConfig, IMapToolInitProps\<IMapToolConfig>>

Implementation of

IMapTool.getState

Overrides

MapObject.getState

Source

model/internal/tool/MapTool.ts:60


getType()

getType(): string

Help function which returns the type of the object.

Returns

string

Implementation of

IMapTool.getType

Inherited from

MapObject.getType

Source

model/internal/object/MapObject.ts:86


handleEvent()

handleEvent(event): void

This function is called when a custom event is invoked.

Override this function, if needed.

Parameters

event: IMapEvent\<IMapObject\<IMapObjectProps, IMapObjectDefaults\<IMapObjectProps, IMapObjectConfig>, IMapObjectState\<IMapObjectProps, IMapObjectDefaults\<IMapObjectProps, IMapObjectConfig>, IMapObjectConfig, IMapObjectInitProps\<IMapObjectConfig>>, IMapObjectConfig, IMapObjectInitProps\<IMapObjectConfig>>>

Returns

void

Implementation of

IMapEventListener.handleEvent

Source

model/internal/tool/MapTool.ts:171


initialize()

initialize(initProps): this

It initializes the tool before it is created. It processes the serialized config and sets the Geovisto map which manages the tools.

This cannot be done in the tool constructor since the tool can be created before the Geovisto map is created.

This cannot be done in the tool create function since there can be possible dependencies between the tools (the tool might depend on other tools which needs to be initialized).

Parameters

initProps: IMapToolInitProps\<IMapToolConfig>

Returns

this

Implementation of

IMapTool.initialize

Overrides

MapObject.initialize

Source

model/internal/tool/MapTool.ts:98


isEnabled()

isEnabled(): boolean

Help getter which returns enabled property of state.

Do not override this function. Use the state class instead.

Returns

boolean

Implementation of

IMapTool.isEnabled

Source

model/internal/tool/MapTool.ts:130


isSingleton()

isSingleton(): boolean

Help getter which returns a logtical value whether the tool type is singleton.

Returns

boolean

Implementation of

IMapTool.isSingleton

Source

model/internal/tool/MapTool.ts:81


setEnabled()

setEnabled(enabled): void

Some tools might be dynamicaly enabled/disabled. This function is called externally when the tool is enabled/disabled.

Override this function, if needed.

Parameters

enabled: boolean

Returns

void

Implementation of

IMapTool.setEnabled

Source

model/internal/tool/MapTool.ts:142


setProps()

protected setProps(props): void

It updates the props.

Parameters

props: IMapObjectProps

Returns

void

Inherited from

MapObject.setProps

Source

model/internal/object/MapObject.ts:38


switchEnabled()

switchEnabled(): void

Help function which switches enabled state (enabled/disabled).

Do not override this function. Use setEnabled instead.

Returns

void

Implementation of

IMapTool.switchEnabled

Source

model/internal/tool/MapTool.ts:158