Skip to main content

Class: MapSystemWaypointsRenderer

Defined in: src/sdk/components/mapsystem/MapSystemWaypointsRenderer.ts:15

A waypoint renderer for the MapSystem API. Supports addition of string-keyed render roles. Each render role is assigned a position in an ordered list that determines the priority of being chosen when roles are selected for rendering waypoints. For each waypoint, the renderer iterates through all render roles in the priority order list and selects the first role under which the waypoint is registered and is visible.

Extends

Constructors

Constructor

new MapSystemWaypointsRenderer(textManager): MapSystemWaypointsRenderer

Defined in: src/sdk/components/mapsystem/MapSystemWaypointsRenderer.ts:33

Constructor.

Parameters

ParameterTypeDescription
textManagerMapCullableTextLabelManagerThe text manager to use for waypoint labels.

Returns

MapSystemWaypointsRenderer

Overrides

MapWaypointRenderer.constructor

Properties

_onIconRenderEvent

protected readonly _onIconRenderEvent: SubEvent<MapWaypointRenderer<Waypoint>, MapWaypointIconRenderEvent<Waypoint>>

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:266

Inherited from

MapWaypointRenderer._onIconRenderEvent


_onLabelRenderEvent

protected readonly _onLabelRenderEvent: SubEvent<MapWaypointRenderer<Waypoint>, MapWaypointLabelRenderEvent<Waypoint>>

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:281

Inherited from

MapWaypointRenderer._onLabelRenderEvent


_renderedIcons

protected readonly _renderedIcons: Map<string, MapWaypointRenderedIcon<Waypoint>>

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:231

Inherited from

MapWaypointRenderer._renderedIcons


_renderedLabels

protected readonly _renderedLabels: Map<string, MapWaypointRenderedLabel<Waypoint>>

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:240

Inherited from

MapWaypointRenderer._renderedLabels


currentBit

protected currentBit: number = 1

Defined in: src/sdk/components/mapsystem/MapSystemWaypointsRenderer.ts:24


onIconRenderEvent

readonly onIconRenderEvent: ReadonlySubEvent<MapWaypointRenderer<Waypoint>, MapWaypointIconRenderEvent<Waypoint>>

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:279

An event that notifies when the rendering of an icon for a waypoint changes. Changes include when an icon is newly rendered for a waypoint, when the rendered icon changes for a waypoint, and when the icon for a waypoint is no longer rendered.

The definition of rendered used by this event is when an icon is drawn to its target canvas context. An icon that has been drawn but is not visible to the user due to downstream effects (for example, if the canvas is hidden or the drawn label is occluded by a clip path) is still considered to be rendered.

The data object passed to event handlers is only guaranteed to be valid at the moment the handler is called. If a handler needs to retain the data past this moment, then it is recommended that a copy of the data be made.

Inherited from

MapWaypointRenderer.onIconRenderEvent


onLabelRenderEvent

readonly onLabelRenderEvent: ReadonlySubEvent<MapWaypointRenderer<Waypoint>, MapWaypointLabelRenderEvent<Waypoint>>

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:295

An event that notifies when the rendering of a label for a waypoint changes. Changes include when a label is newly rendered for a waypoint, when the rendered label changes for a waypoint, and when the label for a waypoint is no longer rendered.

The definition of rendered used by this event is when a label is registered with the text label manager. A label that is registered with the text label manager but is not visible to the user due to downstream effects (for example, if the manager has culled the label or has not been updated to draw the label) is still considered to be rendered.

The data object passed to event handlers is only guaranteed to be valid at the moment the handler is called. If a handler needs to retain the data past this moment, then it is recommended that a copy of the data be made.

Inherited from

MapWaypointRenderer.onLabelRenderEvent


onRolesAdded

readonly onRolesAdded: SubEvent<MapSystemWaypointsRenderer, void>

Defined in: src/sdk/components/mapsystem/MapSystemWaypointsRenderer.ts:27

An event that fires when any roles are added.


onWaypointAdded

readonly onWaypointAdded: SubEvent<MapWaypointRenderer<Waypoint>, Waypoint>

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:261

An event that notifies when a waypoint has been registered with this renderer under at least one render role.

Inherited from

MapWaypointRenderer.onWaypointAdded


onWaypointRemoved

readonly onWaypointRemoved: SubEvent<MapWaypointRenderer<Waypoint>, Waypoint>

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:264

An event that notifies when a waypoint has been deregistered with this renderer under all render roles.

Inherited from

MapWaypointRenderer.onWaypointRemoved


registered

protected readonly registered: Map<string, MapWaypointRendererEntry<Waypoint>>

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:228

Inherited from

MapWaypointRenderer.registered


roleDefinitions

protected readonly roleDefinitions: Map<number, MapWaypointRenderRoleDef<Waypoint>>

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:253

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

MapWaypointRenderer.roleDefinitions


roleDefinitionsArray

protected readonly roleDefinitionsArray: MapWaypointRenderRoleDef<Waypoint>[] = []

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:258

An array of this renderer's role definitions. This array is kept in sync with the roleDefinitions map.

Inherited from

MapWaypointRenderer.roleDefinitionsArray


roleIdMap

protected readonly roleIdMap: Map<string, number>

Defined in: src/sdk/components/mapsystem/MapSystemWaypointsRenderer.ts:23


rolePriorityOrder

protected readonly rolePriorityOrder: number[] = []

Defined in: src/sdk/components/mapsystem/MapSystemWaypointsRenderer.ts:19


rolesByGroup

protected readonly rolesByGroup: Map<string, string[]>

Defined in: src/sdk/components/mapsystem/MapSystemWaypointsRenderer.ts:21


scratchIconRenderEvent

protected readonly scratchIconRenderEvent: object

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:233

icon

icon: MapWaypointIcon<Waypoint> | undefined

renderedRole

renderedRole: number = 0

type

type: MapWaypointRenderEventType | undefined

waypoint

waypoint: Waypoint | undefined

Inherited from

MapWaypointRenderer.scratchIconRenderEvent


scratchLabelRenderEvent

protected readonly scratchLabelRenderEvent: object

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:242

label

label: MapCullableTextLabel | undefined

renderedRole

renderedRole: number = 0

type

type: MapWaypointRenderEventType | undefined

waypoint

waypoint: Waypoint | undefined

Inherited from

MapWaypointRenderer.scratchLabelRenderEvent


selectRoleToRender

protected readonly selectRoleToRender: MapWaypointRenderRoleSelector<Waypoint> = MapWaypointRenderer.DEFAULT_RENDER_ROLE_SELECTOR

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:305

A function which selects roles under which to render waypoints. Defaults to MapWaypointRenderer.DEFAULT_RENDER_ROLE_SELECTOR.

Inherited from

MapWaypointRenderer.selectRoleToRender


textManager

protected readonly textManager: MapCullableTextLabelManager

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:304

The text label manager to use for waypoint labels.

Inherited from

MapWaypointRenderer.textManager


toCleanUp

protected readonly toCleanUp: Set<MapWaypointRendererEntry<Waypoint>>

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:229

Inherited from

MapWaypointRenderer.toCleanUp


DefaultGroup

readonly static DefaultGroup: "DEFAULT_GROUP" = 'DEFAULT_GROUP'

Defined in: src/sdk/components/mapsystem/MapSystemWaypointsRenderer.ts:17

The default render role group.


NULL_ROLE_DEF

protected readonly static NULL_ROLE_DEF: object

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:185

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

MapWaypointRenderer.NULL_ROLE_DEF

Methods

addRenderRole()

Call Signature

addRenderRole(role, def?): false

Defined in: src/sdk/components/mapsystem/MapSystemWaypointsRenderer.ts:55

This method is disabled. Please use the addRenderRole(name: string, def: MapWaypointRenderRoleDef<Waypoint>, group?: string) overload to add render roles to this renderer.

Parameters
ParameterTypeDescription
rolenumberThe render role to add.
def?MapWaypointRenderRoleDef<Waypoint>The render role's definition.
Returns

false

false.

Overrides

MapWaypointRenderer.addRenderRole

Call Signature

addRenderRole(name, def?, group?): boolean

Defined in: src/sdk/components/mapsystem/MapSystemWaypointsRenderer.ts:67

Adds a new named render role to this renderer. The new render role will be placed at the end of this renderer's render role selection priority order. Roles positioned earlier in the order have a higher priority for being chosen when roles are selected for rendering waypoints.

Parameters
ParameterTypeDescription
namestringThe name of 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.
group?stringThe group in which to include the new render role, if any. Defaults to MapSystemWaypointsRenderer.DefaultGroup.
Returns

boolean

Whether the role was successfully added.

Overrides

MapWaypointRenderer.addRenderRole


clearRenderRoles()

clearRenderRoles(): void

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:376

Removes all render roles from this renderer.

Returns

void

Inherited from

MapWaypointRenderer.clearRenderRoles


deregister()

deregister(waypoint, role, sourceId): void

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:506

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

ParameterTypeDescription
waypointWaypointThe waypoint to deregister.
rolenumberThe role(s) from which the waypoint should be deregistered.
sourceIdstringThe unique string ID for the source of the registration to remove.

Returns

void

Inherited from

MapWaypointRenderer.deregister


getNearestWaypoint()

getNearestWaypoint<T>(pos, first?): T | undefined

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:735

Gets the nearest waypoint currently registered in the renderer.

Type Parameters

Type ParameterDefault type
T extends WaypointWaypoint

Parameters

ParameterTypeDescription
posLatLonInterfaceThe position to get the closest waypoint to.
first?(waypoint) => booleanA predicate that will search the list of closest waypoints for a match, and return the first one found.

Returns

T | undefined

The nearest waypoint, or undefined if none found.

Inherited from

MapWaypointRenderer.getNearestWaypoint


getRenderRoleDefinition()

getRenderRoleDefinition(role): Readonly<MapWaypointRenderRoleDef<Waypoint>> | undefined

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:360

Gets the definition for a render role.

Parameters

ParameterTypeDescription
rolenumberA render role.

Returns

Readonly<MapWaypointRenderRoleDef<Waypoint>> | undefined

The definition for the specified render role, or undefined if no such role has been added to this renderer.

Inherited from

MapWaypointRenderer.getRenderRoleDefinition


getRoleFromName()

getRoleFromName(name): number | undefined

Defined in: src/sdk/components/mapsystem/MapSystemWaypointsRenderer.ts:126

Gets a render role associated with a name.

Parameters

ParameterTypeDescription
namestringThe name of the role.

Returns

number | undefined

The render role associated with the specified name, or undefined if there is no such role.


getRoleNamesByGroup()

getRoleNamesByGroup(group): readonly string[]

Defined in: src/sdk/components/mapsystem/MapSystemWaypointsRenderer.ts:135

Gets the names of roles in a specified group.

Parameters

ParameterTypeDescription
groupstringA render role group.

Returns

readonly string[]

An array of the names of all render roles belonging to the specified group.


hasRenderRole()

hasRenderRole(role): boolean

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:314

Checks whether a render role has been added to this renderer.

Parameters

ParameterTypeDescription
rolenumberThe render role to check.

Returns

boolean

Whether the render role has been added to this renderer.

Inherited from

MapWaypointRenderer.hasRenderRole


insertRenderRole()

insertRenderRole(name, insertBefore, def?, group?): boolean

Defined in: src/sdk/components/mapsystem/MapSystemWaypointsRenderer.ts:105

Adds a new named render role to this renderer and inserts it before an existing render role in this renderer's render role selection priority order. Roles positioned earlier in the order have a higher priority for being chosen when roles are selected for rendering waypoints.

Parameters

ParameterTypeDefault valueDescription
namestringundefinedThe name of the render role to add.
insertBeforestringundefinedThe name of the role before which to insert the new role in this renderer's render role selection priority order. If the name does not match any of this renderer's existing render roles, the new role will be placed at the end of the priority order.
def?MapWaypointRenderRoleDef<Waypoint>undefinedThe 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.
group?stringMapSystemWaypointsRenderer.DefaultGroupThe group in which to include the new render role, if any. Defaults to MapSystemWaypointsRenderer.DefaultGroup.

Returns

boolean

Whether the role was successfully inserted.


isRegistered()

isRegistered(waypoint, role?): boolean

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:460

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

ParameterTypeDescription
waypointWaypointA waypoint.
role?numberThe specific role(s) to check.

Returns

boolean

whether the waypoint is registered with this renderer.

Inherited from

MapWaypointRenderer.isRegistered


register()

register(waypoint, role, sourceId): void

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:484

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

ParameterTypeDescription
waypointWaypointThe waypoint to register.
rolenumberThe role(s) under which the waypoint should be registered.
sourceIdstringA unique string ID for the source of the registration.

Returns

void

Inherited from

MapWaypointRenderer.register


removeRenderedIcon()

protected removeRenderedIcon(uid): void

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:674

Removes a rendered icon from this renderer's tracked list of rendered icons and notifies subscribers of the removal.

Parameters

ParameterTypeDescription
uidstringThe UID of the waypoint for the icon to remove.

Returns

void

Inherited from

MapWaypointRenderer.removeRenderedIcon


removeRenderedLabel()

protected removeRenderedLabel(uid): void

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:687

Removes a rendered label from this renderer's tracked list of rendered labels and notifies subscribers of the removal.

Parameters

ParameterTypeDescription
uidstringThe UID of the waypoint for the label to remove.

Returns

void

Inherited from

MapWaypointRenderer.removeRenderedLabel


removeRenderRole()

removeRenderRole(role): boolean

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:343

Removes a render role from this renderer.

Parameters

ParameterTypeDescription
rolenumberThe render role to remove.

Returns

boolean

Whether the render role was successfully removed.

Inherited from

MapWaypointRenderer.removeRenderRole


renderedIcons()

renderedIcons(): IterableIterator<Readonly<MapWaypointRenderedIcon<Waypoint>>>

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:540

Gets an iterable of all currently rendered waypoint icons, in no particular order.

The definition of rendered used by this method is when an icon is drawn to its target canvas context. An icon that has been drawn but is not visible to the user due to downstream effects (for example, if the canvas is hidden or the drawn label is occluded by a clip path) is still considered to be rendered.

Returns

IterableIterator<Readonly<MapWaypointRenderedIcon<Waypoint>>>

An iterable of all currently rendered waypoint icons, in no particular order.

Inherited from

MapWaypointRenderer.renderedIcons


renderedLabels()

renderedLabels(): IterableIterator<Readonly<MapWaypointRenderedLabel<Waypoint>>>

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:553

Gets an iterable of all currently rendered waypoint labels, in no particular order.

The definition of rendered used by this method is when a label is registered with the text label manager. A label that is registered with the text label manager but is not visible to the user due to downstream effects (for example, if the manager has culled the label or has not been updated to draw the label) is still considered to be rendered.

Returns

IterableIterator<Readonly<MapWaypointRenderedLabel<Waypoint>>>

An iterable of all currently rendered waypoint labels, in no particular order.

Inherited from

MapWaypointRenderer.renderedLabels


renderRoles()

renderRoles(): IterableIterator<number>

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:369

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

MapWaypointRenderer.renderRoles


sendIconRenderEvent()

protected sendIconRenderEvent(type, waypoint, renderedRole, icon): void

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:702

Sends an icon render event.

Parameters

ParameterTypeDescription
typeMapWaypointRenderEventTypeThe type of the event.
waypointWaypointThe event's waypoint.
renderedRolenumberThe event's render role.
iconMapWaypointIcon<Waypoint>The event's icon.

Returns

void

Inherited from

MapWaypointRenderer.sendIconRenderEvent


sendLabelRenderEvent()

protected sendLabelRenderEvent(type, waypoint, renderedRole, label): void

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:719

Sends a label render event.

Parameters

ParameterTypeDescription
typeMapWaypointRenderEventTypeThe type of the event.
waypointWaypointThe event's waypoint.
renderedRolenumberThe event's render role.
labelMapCullableTextLabelThe event's label.

Returns

void

Inherited from

MapWaypointRenderer.sendLabelRenderEvent


setCanvasContext()

setCanvasContext(role, context): boolean

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:424

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

ParameterTypeDescription
rolenumberA render role.
contextCanvasRenderingContext2DA canvas 2D rendering context.

Returns

boolean

Whether the context was set.

Inherited from

MapWaypointRenderer.setCanvasContext


setIconFactory()

setIconFactory(role, factory): boolean

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:388

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

ParameterTypeDescription
rolenumberA render role.
factoryMapWaypointRendererIconFactory<Waypoint>A waypoint icon factory.

Returns

boolean

Whether the factory was set.

Inherited from

MapWaypointRenderer.setIconFactory


setLabelFactory()

setLabelFactory(role, factory): boolean

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:406

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

ParameterTypeDescription
rolenumberA render role.
factoryMapWaypointRendererLabelFactory<Waypoint>A waypoint label factory.

Returns

boolean

Whether the factory was set.

Inherited from

MapWaypointRenderer.setLabelFactory


setVisibilityHandler()

setVisibilityHandler(role, handler): boolean

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:442

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

ParameterTypeDescription
rolenumberA render role.
handler(waypoint) => booleanA function that determines if a waypoint should be visible.

Returns

boolean

Whether the handler was set.

Inherited from

MapWaypointRenderer.setVisibilityHandler


update()

update(mapProjection): void

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:563

Redraws waypoints registered with this renderer.

Parameters

ParameterTypeDescription
mapProjectionMapProjectionThe map projection to use.

Returns

void

Inherited from

MapWaypointRenderer.update


DEFAULT_RENDER_ROLE_SELECTOR()

readonly static DEFAULT_RENDER_ROLE_SELECTOR<T>(entry, roleDefinitions): number

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:214

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

ParameterTypeDescription
entryMapWaypointRendererEntry<T>A waypoint entry.
roleDefinitionsReadonlyMap<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

MapWaypointRenderer.DEFAULT_RENDER_ROLE_SELECTOR


ENTRY_SORT_FUNC()

protected readonly static ENTRY_SORT_FUNC(a, b): number

Defined in: src/sdk/components/map/MapWaypointRenderer.ts:200

Sorts waypoint entries such that those with icons of higher priority are sorted after those with icons of lower priority.

Parameters

ParameterTypeDescription
aMapWaypointRendererEntry<any>The first waypoint entry to sort.
bMapWaypointRendererEntry<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

MapWaypointRenderer.ENTRY_SORT_FUNC