Class: Draw

cercaliagl.control/Draw


Extends

Members

allowPolygonIntersection{Boolean}

Allow polygon intersections when drawing, true by default

onDelete{function} {null}

onDeselect{function} {null}

onDrawEnd{function} {null}

onModify{function} {null}

onSelect{function} {null}

Methods

deleteAllFeatures()

Delete all drawn features

deleteFeature(id)

Delete feature by id

Name Type Description
id string

Feature id

Disable control. Show UI buttons.

Enable control. Show UI buttons.

getAllowPolygonIntersections(){boolean}

Return if polygon intersections are allowed

Returns:
allow Allow

Returns cercalia Map object

Returns:
Cercalia map.

getClass(){string} inherited

Get class name.

Returns:
Class name.

getCurrentMode()

Get current mode

getElement(){Element} inherited

Get control HTML Element

Returns:
HTML Element

getFeatureById(id){GeoJSON}

Return feature in GeoJSON format by feature id.

Name Type Description
id string

Feature Id

Returns:
feature Feature

getGeoJSONFeatures(){Array.<GeoJSON>}

Return all drawing features in GeoJSON format.

Get control id.

Returns:
Id.

getMap(){module:maplibre-gl~Map} inherited

Returns mapboxgl Map object

getName(){string|null} inherited

Get control name. Null if control has not defined name.

Returns:
Class name.

Hide control.

loadFeatures(features)

Load Cercalia Features to draw control. Then you can modify them or delete.

Name Type Description
features Array.<Feature>

Features

loadGeoJSON(geojson)

Load features via GeoJSON or geometry

Name Type Description
geojson GeoJSON

GeoJSON

setAllowPolygonIntersections(allow)

Set if polygon intersections are allowed

Name Type Description
allow boolean

Allow

setDisableDragWhenEditing(disable)

Set disable drag when editing

Name Type Description
disable boolean

Disable

setDrawCircleMode()

Enable draw polygon interaction

setDrawFreehandPolygonMode()

Enable draw polygon interaction

setDrawLinestring()

Enable draw linestring interaction

setDrawMagneticPolygonMode()

Enable draw polygon interaction with magnetic closes

setDrawPolygonMode()

Enable draw polygon interaction

setFeatureProperty(featureId, property, value)

Sets a property on the given feature

Name Type Description
featureId string
property string

property

value string

value

setSelectMode()

Enable select mode to select features. After select it is possible to delete features. Hit and hold Shift key if you want to select more features.

setSnapping(enabled)

Enable or disable snapping

Name Type Description
enabled boolean

Enabled

setStaticMode()

Static mode shows drawn features but in this mode it is not possible to edit them.

Show control.