Skip to main content

GeovistoMapState

geovisto-map • Readme | API


geovisto-map / GeovistoMapState

Class: GeovistoMapState

This class manages state of the map. It wraps the state since the map can work with state objects which needs to be explicitly serialized.

Author​

Jiri Hynek

Extends​

Implements​

Constructors​

new GeovistoMapState()​

new GeovistoMapState(map): GeovistoMapState

It initializes a map state.

Parameters​

• map: IMap\<IMapProps, IMapDefaults, IMapState\<IMapProps, IMapDefaults, IMapConfig>, IMapConfig, IMapInitProps\<IMapConfig>>

Returns​

GeovistoMapState

Overrides​

MapObjectState.constructor

Source​

model/internal/map/GeovistoMapState.ts:45

Properties​

data​

private data: IMapData

Source​

model/internal/map/GeovistoMapState.ts:32


eventManager​

private eventManager: IMapEventManager

Source​

model/internal/map/GeovistoMapState.ts:27


geoDataManager​

private geoDataManager: IGeoDataManager

Source​

model/internal/map/GeovistoMapState.ts:34


leafletMap?​

private optional leafletMap: any

Source​

model/internal/map/GeovistoMapState.ts:28


mapCenter​

private mapCenter: object

lat​

lat: number

lng​

lng: number

Source​

model/internal/map/GeovistoMapState.ts:36


mapConfig​

private mapConfig: IMapConfigManager

Source​

model/internal/map/GeovistoMapState.ts:33


mapData​

private mapData: IMapDataManager

Source​

model/internal/map/GeovistoMapState.ts:31


mapStructure​

private mapStructure: object

maxBounds​

maxBounds: [[number, number], [number, number]]

maxZoom​

maxZoom: number

Source​

model/internal/map/GeovistoMapState.ts:37


toolTemplates​

private toolTemplates: IMapToolsManager

Source​

model/internal/map/GeovistoMapState.ts:30


tools​

private tools: IMapToolsManager

Source​

model/internal/map/GeovistoMapState.ts:29


toolsAPI​

private toolsAPI: Record\<string, () => IMapToolAPI>

Source​

model/internal/map/GeovistoMapState.ts:38


zoom​

private zoom: number

Source​

model/internal/map/GeovistoMapState.ts:35

Methods​

deserialize()​

deserialize(config): void

It takes config and deserializes the values.

Parameters​

• config: IMapConfig

Returns​

void

Implementation of​

IMapState.deserialize

Overrides​

MapObjectState.deserialize

Source​

model/internal/map/GeovistoMapState.ts:92


getCurrentData()​

getCurrentData(): IMapData

It returns current data (might be filtered).

Returns​

IMapData

Implementation of​

IMapState.getCurrentData

Source​

model/internal/map/GeovistoMapState.ts:224


getEventManager()​

getEventManager(): IMapEventManager

It returns the map event manager.

Returns​

IMapEventManager

Implementation of​

IMapState.getEventManager

Source​

model/internal/map/GeovistoMapState.ts:134


getGeoDataManager()​

getGeoDataManager(): IGeoDataManager

It returns the geo data manager.

Returns​

IGeoDataManager

Implementation of​

IMapState.getGeoDataManager

Source​

model/internal/map/GeovistoMapState.ts:256


getId()​

getId(): string

It returns the id property of the tool state.

Returns​

string

Implementation of​

IMapState.getId

Inherited from​

MapObjectState.getId

Source​

model/internal/object/MapObjectState.ts:87


getInitialMapCenter()​

getInitialMapCenter(): object

It returns the initial map center.

TODO: remove from state (use defaults only)

Returns​

object

lat​

lat: number

lng​

lng: number

Implementation of​

IMapState.getInitialMapCenter

Source​

model/internal/map/GeovistoMapState.ts:290


getInitialMapStructure()​

getInitialMapStructure(): object

It returns the initial structure.

TODO: remove from state (use defaults only)

Returns​

object

maxBounds​

maxBounds: [[number, number], [number, number]]

maxZoom​

maxZoom: number

Implementation of​

IMapState.getInitialMapStructure

Source​

model/internal/map/GeovistoMapState.ts:310


getInitialZoom()​

getInitialZoom(): number

It returns the initial zoom level.

Returns​

number

Implementation of​

IMapState.getInitialZoom

Source​

model/internal/map/GeovistoMapState.ts:272


getLeafletMap()​

getLeafletMap(): any

It returns the Leaflet map.

Returns​

any

Implementation of​

IMapState.getLeafletMap

Source​

model/internal/map/GeovistoMapState.ts:157


getMapConfig()​

getMapConfig(): IMapConfigManager

It returns the map config manager.

Returns​

IMapConfigManager

Implementation of​

IMapState.getMapConfig

Source​

model/internal/map/GeovistoMapState.ts:240


getMapData()​

getMapData(): IMapDataManager

It returns the map data manager.

Returns​

IMapDataManager

Implementation of​

IMapState.getMapData

Source​

model/internal/map/GeovistoMapState.ts:206


getMapObject()​

protected getMapObject(): IMapObject\<IMapObjectProps, IMapObjectDefaults\<IMapObjectProps, IMapObjectConfig>, IMapObjectState\<IMapObjectProps, IMapObjectDefaults\<IMapObjectProps, IMapObjectConfig>, IMapObjectConfig, IMapObjectInitProps\<IMapObjectConfig>>, IMapObjectConfig, IMapObjectInitProps\<IMapObjectConfig>>

It makes the map object visible to extended classes.

Returns​

IMapObject\<IMapObjectProps, IMapObjectDefaults\<IMapObjectProps, IMapObjectConfig>, IMapObjectState\<IMapObjectProps, IMapObjectDefaults\<IMapObjectProps, IMapObjectConfig>, IMapObjectConfig, IMapObjectInitProps\<IMapObjectConfig>>, IMapObjectConfig, IMapObjectInitProps\<IMapObjectConfig>>

Inherited from​

MapObjectState.getMapObject

Source​

model/internal/object/MapObjectState.ts:39


getToolTemplates()​

getToolTemplates(): IMapToolsManager

It returns the tool manager providing tool templates.

Returns​

IMapToolsManager

Implementation of​

IMapState.getToolTemplates

Source​

model/internal/map/GeovistoMapState.ts:173


getTools()​

getTools(): IMapToolsManager

It returns tools manager providing tools.

Returns​

IMapToolsManager

Implementation of​

IMapState.getTools

Source​

model/internal/map/GeovistoMapState.ts:189


getToolsAPI()​

getToolsAPI(): Record\<string, () => IMapToolAPI>

It returns the map tools API.

Returns​

Record\<string, () => IMapToolAPI>

Implementation of​

IMapState.getToolsAPI

Source​

model/internal/map/GeovistoMapState.ts:150


getType()​

getType(): string

It returns the type property of the tool state.

Returns​

string

Implementation of​

IMapState.getType

Inherited from​

MapObjectState.getType

Source​

model/internal/object/MapObjectState.ts:80


initialize()​

initialize(defaults, props, initProps): void

It resets the state to the initial props.

Parameters​

• defaults: IMapDefaults

• props: IMapProps

• initProps: IMapInitProps

Returns​

void

Implementation of​

IMapState.initialize

Overrides​

MapObjectState.initialize

Source​

model/internal/map/GeovistoMapState.ts:59


serialize()​

serialize(defaults): IMapConfig

It serializes the map state. Optionally, a serialized value can be let undefined if it equals the default value.

Parameters​

• defaults: undefined | IMapDefaults

Returns​

IMapConfig

Implementation of​

IMapState.serialize

Overrides​

MapObjectState.serialize

Source​

model/internal/map/GeovistoMapState.ts:105


setCurrentData()​

setCurrentData(data): void

It sets current data.

Parameters​

• data: IMapData

Returns​

void

Implementation of​

IMapState.setCurrentData

Source​

model/internal/map/GeovistoMapState.ts:233


setEventManager()​

setEventManager(eventManager): void

It returns the map event manager.

Parameters​

• eventManager: IMapEventManager

Returns​

void

Implementation of​

IMapState.setEventManager

Source​

model/internal/map/GeovistoMapState.ts:143


setGeoDataManager()​

setGeoDataManager(geoDataManager): void

It sets a geo data manager.

Parameters​

• geoDataManager: IGeoDataManager

Returns​

void

Implementation of​

IMapState.setGeoDataManager

Source​

model/internal/map/GeovistoMapState.ts:265


setId()​

setId(id): void

It sets the id property of the tool state.

Parameters​

• id: string

Returns​

void

Implementation of​

IMapState.setId

Inherited from​

MapObjectState.setId

Source​

model/internal/object/MapObjectState.ts:96


setInitialMapCenter()​

setInitialMapCenter(mapCenter): void

It sets initial map center.

TODO: remove from state (use defaults only)

Parameters​

• mapCenter

• mapCenter.lat: number

• mapCenter.lng: number

Returns​

void

Implementation of​

IMapState.setInitialMapCenter

Source​

model/internal/map/GeovistoMapState.ts:301


setInitialMapStructure()​

setInitialMapStructure(mapStructure): void

It sets initial map structure.

TODO: remove from state (use defaults only)

Parameters​

• mapStructure

• mapStructure.maxBounds: [[number, number], [number, number]]

• mapStructure.maxZoom: number

Returns​

void

Implementation of​

IMapState.setInitialMapStructure

Source​

model/internal/map/GeovistoMapState.ts:321


setInitialZoom()​

setInitialZoom(zoom): void

It sets initial zoom level.

Parameters​

• zoom: number

Returns​

void

Implementation of​

IMapState.setInitialZoom

Source​

model/internal/map/GeovistoMapState.ts:281


setLeafletMap()​

setLeafletMap(map): void

It returns the Leaflet map.

Parameters​

• map: Map

Returns​

void

Implementation of​

IMapState.setLeafletMap

Source​

model/internal/map/GeovistoMapState.ts:166


setMapConfig()​

setMapConfig(mapConfig): void

It sets the map config manager.

Parameters​

• mapConfig: IMapConfigManager

Returns​

void

Implementation of​

IMapState.setMapConfig

Source​

model/internal/map/GeovistoMapState.ts:249


setMapData()​

setMapData(mapData): void

It sets the map data manager. note: It also updates the current data.

Parameters​

• mapData: IMapDataManager

Returns​

void

Implementation of​

IMapState.setMapData

Source​

model/internal/map/GeovistoMapState.ts:216


setToolTemplates()​

setToolTemplates(toolTemplates): void

It sets tool templates providing tool templates.

Parameters​

• toolTemplates: IMapToolsManager

Returns​

void

Implementation of​

IMapState.setToolTemplates

Source​

model/internal/map/GeovistoMapState.ts:182


setTools()​

setTools(tools): void

It sets tools manager providing tools.

Parameters​

• tools: IMapToolsManager

Returns​

void

Implementation of​

IMapState.setTools

Source​

model/internal/map/GeovistoMapState.ts:198