Class: MapWaypointRenderer
Defined in: src/garminsdk/components/map/MapWaypointRenderer.ts:35
A renderer which draws waypoints to a Garmin-style map.
Extends
MapWaypointRenderer
<Waypoint
>
Constructors
Constructor
new MapWaypointRenderer(
textManager
):MapWaypointRenderer
Defined in: src/garminsdk/components/map/MapWaypointRenderer.ts:40
Constructor.
Parameters
Parameter | Type | Description |
---|---|---|
textManager | MapCullableTextLabelManager | The text manager to use for waypoint labels. |
Returns
MapWaypointRenderer
Overrides
BaseMapWaypointRenderer<Waypoint>.constructor
Properties
onWaypointAdded
readonly
onWaypointAdded:SubEvent
<any
,Waypoint
>
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:128
An event to subscribe to, fired when waypoints are added to the renderer.
Inherited from
BaseMapWaypointRenderer.onWaypointAdded
onWaypointRemoved
readonly
onWaypointRemoved:SubEvent
<any
,Waypoint
>
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:133
An event to subscribe to, fired when waypoints are removed from the render.
Inherited from
BaseMapWaypointRenderer.onWaypointRemoved
registered
protected
readonly
registered:Map
<string
,MapWaypointRendererEntry
<Waypoint
>>
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:116
Inherited from
BaseMapWaypointRenderer.registered
roleDefinitions
protected
readonly
roleDefinitions:Map
<number
,MapWaypointRenderRoleDef
<Waypoint
>>
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:123
This renderer's render role definitions. Waypoints assigned to be rendered under a role or combination of roles with no definition will not be rendered.
Inherited from
BaseMapWaypointRenderer.roleDefinitions
selectRoleToRender
protected
readonly
selectRoleToRender:MapWaypointRenderRoleSelector
<Waypoint
> =MapWaypointRenderer.DEFAULT_RENDER_ROLE_SELECTOR
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:143
A function which selects roles under which to render waypoints. Defaults to MapWaypointRenderer.DEFAULT_RENDER_ROLE_SELECTOR.
Inherited from
BaseMapWaypointRenderer.selectRoleToRender
textManager
protected
readonly
textManager:MapCullableTextLabelManager
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:142
The text manager to use for waypoint labels.
Inherited from
BaseMapWaypointRenderer.textManager
toCleanUp
protected
readonly
toCleanUp:Set
<MapWaypointRendererEntry
<Waypoint
>>
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:117
Inherited from
BaseMapWaypointRenderer.toCleanUp
NULL_ROLE_DEF
protected
readonly
static
NULL_ROLE_DEF:object
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:73
A null render role definition. Icons rendered under this role are never visible.
canvasContext
canvasContext:
null
=null
iconFactory
iconFactory:
null
=null
labelFactory
labelFactory:
null
=null
visibilityHandler()
visibilityHandler: () =>
boolean
Returns
boolean
Inherited from
BaseMapWaypointRenderer.NULL_ROLE_DEF
Methods
addRenderRole()
addRenderRole(
role
,def?
):boolean
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:164
Adds a render role to this renderer. If the role has already been added to this renderer, this method does nothing.
Parameters
Parameter | Type | Description |
---|---|---|
role | number | The render role to add. |
def? | MapWaypointRenderRoleDef <Waypoint > | The render role's definition. If undefined, the new role will be assigned a default definition with no defined rendering context, icon, or label factories, and a visibility handler which always returns true. |
Returns
boolean
Whether the render role was successfully added.
Inherited from
BaseMapWaypointRenderer.addRenderRole
clearRenderRoles()
clearRenderRoles():
void
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:205
Removes all render roles from this renderer.
Returns
void
Inherited from
BaseMapWaypointRenderer.clearRenderRoles
deregister()
deregister(
waypoint
,role
,sourceId
):void
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:334
Removes a registration for a waypoint for a specific role or roles. Once all of a waypoint's registrations for a role are removed, it will no longer be rendered in that role the next this renderer's update() method is called.
Parameters
Parameter | Type | Description |
---|---|---|
waypoint | Waypoint | The waypoint to deregister. |
role | number | The role(s) from which the waypoint should be deregistered. |
sourceId | string | The unique string ID for the source of the registration to remove. |
Returns
void
Inherited from
BaseMapWaypointRenderer.deregister
getNearestWaypoint()
getNearestWaypoint<
T
>(pos
,first?
):undefined
|T
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:405
Gets the nearest waypoint currently registered in the renderer.
Type Parameters
Type Parameter | Default type |
---|---|
T extends Waypoint | Waypoint |
Parameters
Parameter | Type | Description |
---|---|---|
pos | LatLonInterface | The position to get the closest waypoint to. |
first? | (waypoint ) => boolean | A predicate that will search the list of closest waypoints for a match, and return the first one found. |
Returns
undefined
| T
The nearest waypoint, or undefined if none found.
Inherited from
BaseMapWaypointRenderer.getNearestWaypoint
getRenderRoleDefinition()
getRenderRoleDefinition(
role
):undefined
|Readonly
<MapWaypointRenderRoleDef
<Waypoint
>>
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:189
Gets the definition for a render role.
Parameters
Parameter | Type | Description |
---|---|---|
role | number | A render role. |
Returns
undefined
| Readonly
<MapWaypointRenderRoleDef
<Waypoint
>>
The definition for the specified render role, or undefined if no such role has been added to this renderer.
Inherited from
BaseMapWaypointRenderer.getRenderRoleDefinition
hasRenderRole()
hasRenderRole(
role
):boolean
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:152
Checks whether a render role has been added to this renderer.
Parameters
Parameter | Type | Description |
---|---|---|
role | number | The render role to check. |
Returns
boolean
Whether the render role has been added to this renderer.
Inherited from
BaseMapWaypointRenderer.hasRenderRole
isRegistered()
isRegistered(
waypoint
,role?
):boolean
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:288
Checks if a waypoint is registered with this renderer. A role or roles can be optionally specified such that the method will only return true if the waypoint is registered under those specific roles.
Parameters
Parameter | Type | Description |
---|---|---|
waypoint | Waypoint | A waypoint. |
role? | number | The specific role(s) to check. |
Returns
boolean
whether the waypoint is registered with this renderer.
Inherited from
BaseMapWaypointRenderer.isRegistered
register()
register(
waypoint
,role
,sourceId
):void
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:312
Registers a waypoint with this renderer under a specific role or roles. Registered waypoints will be drawn as appropriate the next time this renderer's update() method is called. Registering a waypoint under a role under which it is already registered has no effect unless the source of the registration is different.
Parameters
Parameter | Type | Description |
---|---|---|
waypoint | Waypoint | The waypoint to register. |
role | number | The role(s) under which the waypoint should be registered. |
sourceId | string | A unique string ID for the source of the registration. |
Returns
void
Inherited from
BaseMapWaypointRenderer.register
removeRenderRole()
removeRenderRole(
role
):boolean
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:179
Removes a render role from this renderer.
Parameters
Parameter | Type | Description |
---|---|---|
role | number | The render role to remove. |
Returns
boolean
Whether the render role was successfully removed.
Inherited from
BaseMapWaypointRenderer.removeRenderRole
renderRoles()
renderRoles():
IterableIterator
<number
>
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:198
Gets an iterable of render roles added to this renderer. The iterable will return the roles in the order in which they were added.
Returns
IterableIterator
<number
>
An iterable of render roles added to this renderer.
Inherited from
BaseMapWaypointRenderer.renderRoles
setCanvasContext()
setCanvasContext(
role
,context
):boolean
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:252
Sets the canvas rendering context for a render role. If the render role has not been added to this renderer, this method does nothing.
Parameters
Parameter | Type | Description |
---|---|---|
role | number | A render role. |
context | CanvasRenderingContext2D | A canvas 2D rendering context. |
Returns
boolean
Whether the context was set.
Inherited from
BaseMapWaypointRenderer.setCanvasContext
setIconFactory()
setIconFactory(
role
,factory
):boolean
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:216
Sets the factory to use to create waypoint icons for a render role. If the render role has not been added to this renderer, this method does nothing.
Parameters
Parameter | Type | Description |
---|---|---|
role | number | A render role. |
factory | MapWaypointRendererIconFactory <Waypoint > | A waypoint icon factory. |
Returns
boolean
Whether the factory was set.
Inherited from
BaseMapWaypointRenderer.setIconFactory
setLabelFactory()
setLabelFactory(
role
,factory
):boolean
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:234
Sets the factory to use to create waypoint labels for a render role. If the render role has not been added to this renderer, this method does nothing.
Parameters
Parameter | Type | Description |
---|---|---|
role | number | A render role. |
factory | MapWaypointRendererLabelFactory <Waypoint > | A waypoint label factory. |
Returns
boolean
Whether the factory was set.
Inherited from
BaseMapWaypointRenderer.setLabelFactory
setVisibilityHandler()
setVisibilityHandler(
role
,handler
):boolean
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:270
Sets the handler that determines if a waypoint should visible for a render role. If the render role has not been added to this renderer, this method does nothing.
Parameters
Parameter | Type | Description |
---|---|---|
role | number | A render role. |
handler | (waypoint ) => boolean | A function that determines if a waypoint should be visible. |
Returns
boolean
Whether the handler was set.
Inherited from
BaseMapWaypointRenderer.setVisibilityHandler
update()
update(
mapProjection
):void
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:364
Redraws waypoints registered with this renderer.
Parameters
Parameter | Type | Description |
---|---|---|
mapProjection | MapProjection | The map projection to use. |
Returns
void
Inherited from
BaseMapWaypointRenderer.update
DEFAULT_RENDER_ROLE_SELECTOR()
readonly
static
DEFAULT_RENDER_ROLE_SELECTOR<T
>(entry
,roleDefinitions
):number
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:102
The default render role selector. For each waypoint entry, iterates through all possible render roles in the order they were originally added to the renderer and selects the first role under which the entry is registered and is visible.
Type Parameters
Type Parameter |
---|
T extends MapWaypoint |
Parameters
Parameter | Type | Description |
---|---|---|
entry | MapWaypointRendererEntry <T > | A waypoint entry. |
roleDefinitions | ReadonlyMap <number , Readonly <MapWaypointRenderRoleDef <T >>> | A map from all possible render roles to their definitions. |
Returns
number
The role under which the waypoint entry should be rendered, or 0 if the entry should not be rendered under any role.
Inherited from
BaseMapWaypointRenderer.DEFAULT_RENDER_ROLE_SELECTOR
ENTRY_SORT_FUNC()
protected
readonly
static
ENTRY_SORT_FUNC(a
,b
):number
Defined in: src/sdk/components/map/MapWaypointRenderer.ts:88
Sorts waypoint entries such that those with icons of higher priority are sorted after those with icons of lower priority.
Parameters
Parameter | Type | Description |
---|---|---|
a | MapWaypointRendererEntry <any > | The first waypoint entry to sort. |
b | MapWaypointRendererEntry <any > | The second waypoint entry to sort. |
Returns
number
A negative number if the first entry is to be sorted before the second, a positive number if the second entry is to be sorted before the first, and zero if the entries' relative sorting order does not matter.
Inherited from
BaseMapWaypointRenderer.ENTRY_SORT_FUNC