Skip to main content

ChoroplethLayerTool

geovisto-map • Readme | API


geovisto-map / ChoroplethLayerTool

Class: ChoroplethLayerTool

This class represents Choropleth layer tool. It works with geojson polygons representing countries.

Author​

Jiri Hynek

Extends​

Implements​

Constructors​

new ChoroplethLayerTool()​

new ChoroplethLayerTool(props?): ChoroplethLayerTool

It creates a new tool with respect to the props.

Parameters​

• props?: IChoroplethLayerToolProps

Returns​

ChoroplethLayerTool

Overrides​

AbstractLayerTool.constructor

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:89

Properties​

mapForm​

private mapForm: IMapForm

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:81


mapLegend​

private mapLegend: IMapLegend

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:82


selectionToolAPI​

private selectionToolAPI: undefined | ISelectionToolAPI

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:79


themesToolAPI​

private themesToolAPI: undefined | IThemesToolAPI

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:80

Methods​

computeColorClass()​

protected computeColorClass(val, scale): string

It returns color class for the current scale and given value.

Parameters​

• val: number

• scale: number[]

Returns​

string

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:720


computeColorIntensity()​

computeColorIntensity(val, scale): number

It returns color intensity for the current scale and given value.

Parameters​

• val: number

• scale: number[]

Returns​

number

Implementation of​

IChoroplethLayerTool.computeColorIntensity

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:735


computeStyleClasses()​

protected computeStyleClasses(item, scale): string[]

It returns style classes for the current template and given feature.

Parameters​

• item: Polygon

• scale: number[]

Returns​

string[]

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:649


copy()​

copy(): IChoroplethLayerTool\<IChoroplethLayerToolProps, IChoroplethLayerToolDefaults, IChoroplethLayerToolState\<IChoroplethLayerToolProps, IChoroplethLayerToolDefaults, IChoroplethLayerToolConfig, object, object>, IChoroplethLayerToolConfig, IMapToolInitProps\<IChoroplethLayerToolConfig>>

It creates a copy of the uninitialized tool.

Returns​

IChoroplethLayerTool\<IChoroplethLayerToolProps, IChoroplethLayerToolDefaults, IChoroplethLayerToolState\<IChoroplethLayerToolProps, IChoroplethLayerToolDefaults, IChoroplethLayerToolConfig, object, object>, IChoroplethLayerToolConfig, IMapToolInitProps\<IChoroplethLayerToolConfig>>

Implementation of​

IChoroplethLayerTool.copy

Overrides​

AbstractLayerTool.copy

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:96


create()​

create(): this

It creates new layer with respect to configuration

Returns​

this

Implementation of​

IChoroplethLayerTool.create

Inherited from​

AbstractLayerTool.create

Source​

model/internal/layer/AbstractLayerTool.ts:89


createDefaults()​

protected createDefaults(): IChoroplethLayerToolDefaults

It creates new defaults of the tool.

Returns​

IChoroplethLayerToolDefaults

Overrides​

AbstractLayerTool.createDefaults

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:117


createGeoJSONLayer()​

protected createGeoJSONLayer(): GeoJSON

It creates an instance of the Leaflet GeoJSON layer.

Returns​

GeoJSON

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:239


createLayerItems()​

protected createLayerItems(): Layer[]

It creates layer items.

Returns​

Layer[]

Overrides​

AbstractLayerTool.createLayerItems

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:207


createMapForm()​

protected createMapForm(): IMapForm

It creates new tab control.

Returns​

IMapForm

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:173


createMapLegend()​

protected createMapLegend(): IMapLegend

It creates new legend control.

Returns​

IMapLegend

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:181


createState()​

protected createState(): IChoroplethLayerToolState\<IChoroplethLayerToolProps, IChoroplethLayerToolDefaults, IChoroplethLayerToolConfig, object, object>

It returns default tool state.

Returns​

IChoroplethLayerToolState\<IChoroplethLayerToolProps, IChoroplethLayerToolDefaults, IChoroplethLayerToolConfig, object, object>

Overrides​

AbstractLayerTool.createState

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:131


getAPIGetter()​

getAPIGetter(): undefined | IMapToolAPIGetter

It returns the tool API

Returns​

undefined | IMapToolAPIGetter

Implementation of​

IChoroplethLayerTool.getAPIGetter

Inherited from​

AbstractLayerTool.getAPIGetter

Source​

model/internal/tool/MapTool.ts:74


getClickFunction()​

protected getClickFunction(): (e) => void

It returns the click property for the GeoJSON layer.

Returns​

Function

Parameters​

• e: LeafletMouseEvent

Returns​

void

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:322


getDefaults()​

getDefaults(): IChoroplethLayerToolDefaults

It returns default values of the state properties.

Returns​

IChoroplethLayerToolDefaults

Implementation of​

IChoroplethLayerTool.getDefaults

Overrides​

AbstractLayerTool.getDefaults

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:110


getId()​

getId(): string

Help function which returns the id of the object.

Returns​

string

Implementation of​

IChoroplethLayerTool.getId

Inherited from​

AbstractLayerTool.getId

Source​

model/internal/object/MapObject.ts:93


getLayerItems()​

getLayerItems(): Layer[]

It returns layer items which should be rendered.

Returns​

Layer[]

Implementation of​

IChoroplethLayerTool.getLayerItems

Inherited from​

AbstractLayerTool.getLayerItems

Source​

model/internal/layer/AbstractLayerTool.ts:163


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​

IChoroplethLayerTool.getMap

Inherited from​

AbstractLayerTool.getMap

Source​

model/internal/tool/MapTool.ts:112


getMapForm()​

getMapForm(): IMapForm

It returns a sidebar tab with respect to the configuration.

Returns​

IMapForm

Implementation of​

IMapFormControl.getMapForm

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:164


getMapLegend()​

getMapLegend(): IMapLegend

It returns a legend.

Returns​

IMapLegend

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:188


getMouseOutFunction()​

protected getMouseOutFunction(): (e) => void

It returns the mouseout property for the GeoJSON layer.

Returns​

Function

Parameters​

• e: LeafletMouseEvent

Returns​

void

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:307


getMouseOverFunction()​

protected getMouseOverFunction(): (e) => void

It returns the mouseover property for the GeoJSON layer.

Returns​

Function

Parameters​

• e: LeafletMouseEvent

Returns​

void

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:264


getOnEachFeatureFunction()​

protected getOnEachFeatureFunction(): (feature, layer) => void

It returns the onEachFeature property for the GeoJSON layer.

Returns​

Function

Parameters​

• feature: Feature

• layer: Layer

Returns​

void

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:251


getProps()​

getProps(): IChoroplethLayerToolProps

It returns the props given by the programmer.

Returns​

IChoroplethLayerToolProps

Implementation of​

IChoroplethLayerTool.getProps

Overrides​

AbstractLayerTool.getProps

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:103


getScale()​

getScale(): undefined | number[]

Help function which returns a scale which can be used to distinguish value levels in choropleth.

Returns​

undefined | number[]

Implementation of​

IChoroplethLayerTool.getScale

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:588


getSelectionTool()​

private getSelectionTool(): undefined | ISelectionToolAPI

Help function which acquires and returns the selection tool if available.

Returns​

undefined | ISelectionToolAPI

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:138


getState()​

getState(): IChoroplethLayerToolState\<IChoroplethLayerToolProps, IChoroplethLayerToolDefaults, IChoroplethLayerToolConfig, object, object>

It returns the layer tool state.

Returns​

IChoroplethLayerToolState\<IChoroplethLayerToolProps, IChoroplethLayerToolDefaults, IChoroplethLayerToolConfig, object, object>

Implementation of​

IChoroplethLayerTool.getState

Overrides​

AbstractLayerTool.getState

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:124


getThemesTool()​

private getThemesTool(): undefined | IThemesToolAPI

Help function which acquires and returns the themes tool if available.

Returns​

undefined | IThemesToolAPI

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:151


getType()​

getType(): string

Help function which returns the type of the object.

Returns​

string

Implementation of​

IChoroplethLayerTool.getType

Inherited from​

AbstractLayerTool.getType

Source​

model/internal/object/MapObject.ts:86


handleEvent()​

handleEvent(event): void

This function is called when a custom event is invoked.

Parameters​

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

Returns​

void

Overrides​

AbstractLayerTool.handleEvent

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:532


hideLayerItems()​

protected hideLayerItems(): void

Help function which hides layer items

This function is meant to be private.

Returns​

void

Inherited from​

AbstractLayerTool.hideLayerItems

Source​

model/internal/layer/AbstractLayerTool.ts:147


hoverItem()​

protected hoverItem(item, hover): void

It updates style of the given feature using the current template.

Parameters​

• item: Layer

• hover: boolean

Returns​

void

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:748


initialize()​

initialize(initProps): this

Overrides the super method.

Parameters​

• initProps: IMapToolInitProps\<IChoroplethLayerToolConfig>

Returns​

this

Implementation of​

IChoroplethLayerTool.initialize

Overrides​

AbstractLayerTool.initialize

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:200


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​

IChoroplethLayerTool.isEnabled

Inherited from​

AbstractLayerTool.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​

IChoroplethLayerTool.isSingleton

Inherited from​

AbstractLayerTool.isSingleton

Source​

model/internal/tool/MapTool.ts:81


render()​

render(type, animateOptions?): void

It reloads data and redraw the layer.

Parameters​

• type: number

• animateOptions?: IDataChangeAnimateOptions

Returns​

void

Implementation of​

IChoroplethLayerTool.render

Overrides​

AbstractLayerTool.render

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:480


setEnabled()​

setEnabled(enabled): void

It changes layer state to enabled/disabled.

Parameters​

• enabled: boolean

Returns​

void

Implementation of​

IChoroplethLayerTool.setEnabled

Inherited from​

AbstractLayerTool.setEnabled

Source​

model/internal/layer/AbstractLayerTool.ts:102


setProps()​

protected setProps(props): void

It updates the props.

Parameters​

• props: IMapObjectProps

Returns​

void

Inherited from​

AbstractLayerTool.setProps

Source​

model/internal/object/MapObject.ts:38


showLayerItems()​

protected showLayerItems(): void

Help function which shows layer items.

This function is meant to be private.

Returns​

void

Inherited from​

AbstractLayerTool.showLayerItems

Source​

model/internal/layer/AbstractLayerTool.ts:126


switchEnabled()​

switchEnabled(): void

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

Do not override this function. Use setEnabled instead.

Returns​

void

Implementation of​

IChoroplethLayerTool.switchEnabled

Inherited from​

AbstractLayerTool.switchEnabled

Source​

model/internal/tool/MapTool.ts:158


updateData()​

protected updateData(): Map\<string, IMapAggregationBucket>

It updates the bucket data so it represents the current data.

Returns​

Map\<string, IMapAggregationBucket>

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:379


updateDimension()​

updateDimension(dimension, value, redraw): void

It updates the dimension.

Parameters​

• dimension: IMapDomainDimension\<IMapDomain>

• value: string

• redraw: undefined | number

Returns​

void

Implementation of​

IChoroplethLayerTool.updateDimension

Overrides​

AbstractLayerTool.updateDimension

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:507


updateGeoData()​

protected updateGeoData(): any

It updates the polygons of the layer so they represent current geo data.

Returns​

any

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:345


updateItemStyle()​

protected updateItemStyle(item, scale, animateOptions?): void

It updates style of the given feature using the current template.

Parameters​

• item: Layer

• scale: number[]

• animateOptions?: IDataChangeAnimateOptions

Returns​

void

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:629


updateStyle()​

protected updateStyle(animateOptions?): void

It updates style of all layer features using the current template.

Parameters​

• animateOptions?: IDataChangeAnimateOptions

Returns​

void

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:575


updateTheme()​

protected updateTheme(theme): void

Help function which updates theme with respect to the Themes Tool API.

TODO: move to adapter

Parameters​

• theme: IMapTheme

Returns​

void

Source​

tools/layers/choropleth/model/internal/tool/ChoroplethLayerTool.ts:566