The Elements controller allows you to get information about the elements on the map, and make changes to their visibility.
getElement(
id
:string
):Promise
<null
|Element
>
Get a single element from the map by its id.
Parameters
Parameter | Type | Description |
---|---|---|
Returns
Promise
<null
| Element
>
The requested element.
Example
getElementGeometry(
id
:string
):Promise
<null
|Geometry
>
Get the geometry of an element.
Parameters
Returns
Promise
<null
| Geometry
>
Example
getElements(
constraint
?:GetElementsConstraint
):Promise
<(null
|Element
)[]>
Gets elements from the map, according to the constraints supplied. If no constraints are supplied, all elements will be returned.
Parameters
Returns
Promise
<(null
| Element
)[]>
All elements on the map.
Remarks
The elements in the map, ordered by the order specified in Felt. This is not necessarily the order that they are drawn in, as Felt draws points above lines and lines above polygons, for instance.
Example
getElementGroup(
id
:string
):Promise
<null
|ElementGroup
>
Get an element group from the map by its id.
Parameters
Returns
Promise
<null
| ElementGroup
>
The requested element group.
Example
getElementGroups(
constraint
?:GetElementGroupsConstraint
):Promise
<(null
|ElementGroup
)[]>
Gets element groups from the map, according to the filters supplied. If no constraints are supplied, all element groups will be returned in rendering order.
Parameters
Returns
Promise
<(null
| ElementGroup
)[]>
The requested element groups.
Example
setElementGroupVisibility(
visibility
:SetVisibilityRequest
):Promise
<void
>
Hide or show element groups with the given ids.
Parameters
Returns
Promise
<void
>
Example
onElementChange(
args
: {options
: {id
:string
; };handler
: (change
:ElementChangeCallbackParams
) =>void
; }):VoidFunction
Adds a listener for when an element changes.
Parameters
Returns
VoidFunction
A function to unsubscribe from the listener
Example
onElementGroupChange(
args
: {options
: {id
:string
; };handler
: (change
:ElementGroupChangeCallbackParams
) =>void
; }):VoidFunction
Adds a listener for when an element group changes.
Parameters
Returns
VoidFunction
A function to unsubscribe from the listener
Example
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type |
---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type |
---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type |
---|---|
id
string
The id of the element you want to get.
id
string
The id of the element you want to get the geometry of.
constraint
?
The constraints to apply to the elements returned from the map.
id
string
constraint
?
The constraints to apply to the element groups returned from the map.
visibility
args
object
-
args.options
object
-
args.options.id
string
The id of the element to listen for changes to.
args.handler
(change
: ElementChangeCallbackParams
) => void
The handler that is called when the element changes.
args
object
args.options
object
args.options.id
string
args.handler
(change
: ElementGroupChangeCallbackParams
) => void