Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
The parameters for the onElementGroupChange
listener.
elementGroup:
null
|ElementGroup
The Felt SDK lets you get information about the elements in the map, and the groups that they belong to.
id:
string
The string identifying the element
type:
string
The type of element, such as a Place, Polygon, Line, Route, etc.
groupId:
null
|string
The ID of the element group that the element belongs to, or null if the element is not inside an element group.
name:
null
|string
The name of the element can be displayed in the Legend, depending on how the element's legend is configured in its style.
description:
null
|string
The element description forms part of the element's metadata. This is visible to users via the element info button in the legend.
attributes:
Record
<string
,unknown
>
The attributes of the element, which can be added via the Element Inspector under the Detail tab.
id:
string
A string identifying the element group.
name:
string
The name of the element group. This is shown in the legend.
caption:
null
|string
The caption of the element group. This is shown in the legend.
elementIds:
string
[]
The ids of the elements in the element group.
Remarks
You can use these ids to get the full element objects via the getElements
method.
visible:
boolean
Whether the element group is visible or not.
shownInLegend:
boolean
Whether the element group is shown in the legend or not.
The parameters for the onElementChange
listener.
element:
null
|Element
The new data for the element or null if the element was removed.
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
id
string
The id of the element you want to get.
Returns
Promise
<null
| Element
>
The requested element.
Example
getElementGeometry(
id
:string
):Promise
<null
|Geometry
>
Get the geometry of an element.
Parameters
id
string
The id of the element you want to get the geometry of.
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
constraint
?
The constraints to apply to the elements returned from the map.
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
id
string
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
constraint
?
The constraints to apply to the element groups returned from the map.
Returns
Promise
<(null
| ElementGroup
)[]>
The requested element groups.
Example
setElementGroupVisibility(
visibility
:SetVisibilityRequest
):Promise
<void
>
Hide or show element groups with the given ids.
Parameters
visibility
Returns
Promise
<void
>
Example
onElementChange(
args
: {options
: {id
:string
; };handler
: (change
:ElementChangeCallbackParams
) =>void
; }):VoidFunction
Adds a listener for when an element changes.
Parameters
args
object
-
args.options
object
-
args.options.id
string
The id of the element to listen for changes to.
args.handler
The handler that is called when the element changes.
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
args
object
args.options
object
args.options.id
string
args.handler
Returns
VoidFunction
A function to unsubscribe from the listener
Example
(change
: ) => void
(change
: ) => void