Skip to main content

Class: MapSystemWaypointsRenderer

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.

Hierarchy

Constructors

constructor

new MapSystemWaypointsRenderer(textManager): MapSystemWaypointsRenderer

Constructor.

Parameters

NameTypeDescription
textManagerMapCullableTextLabelManagerThe text manager to use for waypoint labels.

Returns

MapSystemWaypointsRenderer

Overrides

MapWaypointRenderer.constructor

Defined in

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

Properties

currentBit

Protected currentBit: number = 1

Defined in

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


onRolesAdded

Readonly onRolesAdded: SubEvent<MapSystemWaypointsRenderer, void>

An event that fires when any roles are added.

Defined in

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


onWaypointAdded

Readonly onWaypointAdded: SubEvent<any, Waypoint>

An event to subscribe to, fired when waypoints are added to the renderer.

Inherited from

MapWaypointRenderer.onWaypointAdded

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:128


onWaypointRemoved

Readonly onWaypointRemoved: SubEvent<any, Waypoint>

An event to subscribe to, fired when waypoints are removed from the render.

Inherited from

MapWaypointRenderer.onWaypointRemoved

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:133


registered

Protected Readonly registered: Map<string, MapWaypointRendererEntry<Waypoint>>

Inherited from

MapWaypointRenderer.registered

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:116


roleDefinitions

Protected Readonly roleDefinitions: Map<number, MapWaypointRenderRoleDef<Waypoint>>

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

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:123


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


selectRoleToRender

Protected Readonly selectRoleToRender: MapWaypointRenderRoleSelector<Waypoint> = MapWaypointRenderer.DEFAULT_RENDER_ROLE_SELECTOR

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

Inherited from

MapWaypointRenderer.selectRoleToRender

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:143


textManager

Protected Readonly textManager: MapCullableTextLabelManager

The text manager to use for waypoint labels.

Inherited from

MapWaypointRenderer.textManager

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:142


toCleanUp

Protected Readonly toCleanUp: Set<MapWaypointRendererEntry<Waypoint>>

Inherited from

MapWaypointRenderer.toCleanUp

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:117


DefaultGroup

Static Readonly DefaultGroup: "DEFAULT_GROUP"

The default render role group.

Defined in

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


NULL_ROLE_DEF

Static Protected Readonly NULL_ROLE_DEF: Object

A null render role definition. Icons rendered under this role are never visible.

Type declaration

NameType
canvasContextnull
iconFactorynull
labelFactorynull
visibilityHandler() => boolean

Inherited from

MapWaypointRenderer.NULL_ROLE_DEF

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:73

Methods

addRenderRole

addRenderRole(role, def?): false

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

Parameters

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

Returns

false

false.

Overrides

MapWaypointRenderer.addRenderRole

Defined in

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

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

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

NameTypeDescription
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

Defined in

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


clearRenderRoles

clearRenderRoles(): void

Removes all render roles from this renderer.

Returns

void

Inherited from

MapWaypointRenderer.clearRenderRoles

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:205


deregister

deregister(waypoint, role, sourceId): void

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

NameTypeDescription
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

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:334


getNearestWaypoint

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

Gets the nearest waypoint currently registered in the renderer.

Type parameters

NameType
Textends Waypoint = Waypoint

Parameters

NameTypeDescription
posLatLonInterfaceThe position to get the closest waypoint to.
first?(waypoint: Waypoint) => booleanA 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

MapWaypointRenderer.getNearestWaypoint

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:405


getRenderRoleDefinition

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

Gets the definition for a render role.

Parameters

NameTypeDescription
rolenumberA 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

MapWaypointRenderer.getRenderRoleDefinition

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:189


getRoleFromName

getRoleFromName(name): undefined | number

Gets a render role associated with a name.

Parameters

NameTypeDescription
namestringThe name of the role.

Returns

undefined | number

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

Defined in

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


getRoleNamesByGroup

getRoleNamesByGroup(group): readonly string[]

Gets the names of roles in a specified group.

Parameters

NameTypeDescription
groupstringA render role group.

Returns

readonly string[]

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

Defined in

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


hasRenderRole

hasRenderRole(role): boolean

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

Parameters

NameTypeDescription
rolenumberThe render role to check.

Returns

boolean

Whether the render role has been added to this renderer.

Inherited from

MapWaypointRenderer.hasRenderRole

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:152


insertRenderRole

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

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

NameTypeDefault 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.
groupstringMapSystemWaypointsRenderer.DefaultGroupThe group in which to include the new render role, if any. Defaults to MapSystemWaypointsRenderer.DefaultGroup.

Returns

boolean

Whether the role was successfully inserted.

Defined in

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


isRegistered

isRegistered(waypoint, role?): boolean

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

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

Returns

boolean

whether the waypoint is registered with this renderer.

Inherited from

MapWaypointRenderer.isRegistered

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:288


register

register(waypoint, role, sourceId): void

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

NameTypeDescription
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

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:312


removeRenderRole

removeRenderRole(role): boolean

Removes a render role from this renderer.

Parameters

NameTypeDescription
rolenumberThe render role to remove.

Returns

boolean

Whether the render role was successfully removed.

Inherited from

MapWaypointRenderer.removeRenderRole

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:179


renderRoles

renderRoles(): IterableIterator<number>

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

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:198


setCanvasContext

setCanvasContext(role, context): boolean

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

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

Returns

boolean

Whether the context was set.

Inherited from

MapWaypointRenderer.setCanvasContext

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:252


setIconFactory

setIconFactory(role, factory): boolean

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

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

Returns

boolean

Whether the factory was set.

Inherited from

MapWaypointRenderer.setIconFactory

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:216


setLabelFactory

setLabelFactory(role, factory): boolean

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

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

Returns

boolean

Whether the factory was set.

Inherited from

MapWaypointRenderer.setLabelFactory

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:234


setVisibilityHandler

setVisibilityHandler(role, handler): boolean

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

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

Returns

boolean

Whether the handler was set.

Inherited from

MapWaypointRenderer.setVisibilityHandler

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:270


update

update(mapProjection): void

Redraws waypoints registered with this renderer.

Parameters

NameTypeDescription
mapProjectionMapProjectionThe map projection to use.

Returns

void

Inherited from

MapWaypointRenderer.update

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:364


DEFAULT_RENDER_ROLE_SELECTOR

DEFAULT_RENDER_ROLE_SELECTOR<T>(entry, roleDefinitions): number

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

NameType
Textends MapWaypoint

Parameters

NameTypeDescription
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

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:102


ENTRY_SORT_FUNC

ENTRY_SORT_FUNC(a, b): number

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

Parameters

NameTypeDescription
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

Defined in

src/sdk/components/map/MapWaypointRenderer.ts:88