Skip to content

ui/map/EntityRenderer

Classes

abstract EntityRenderer

Defined in: ui/map/EntityRenderer.ts:69

Extended by

Type Parameters

T

T extends EntityData

Constructors

Constructor
new EntityRenderer<T>(
   map, 
   displayOptions, 
config): EntityRenderer<T>;

Defined in: ui/map/EntityRenderer.ts:81

Parameters
map

Map$1

displayOptions

DisplayOptions

config

EntityRenderConfig

Returns

EntityRenderer\<T>

Properties

map
protected map: Map$1;

Defined in: ui/map/EntityRenderer.ts:70

displayOptions
protected displayOptions: DisplayOptions;

Defined in: ui/map/EntityRenderer.ts:71

config
protected config: EntityRenderConfig;

Defined in: ui/map/EntityRenderer.ts:72

selectedEntity
protected selectedEntity: string | null = null;

Defined in: ui/map/EntityRenderer.ts:75

entityData
protected entityData: T | null = null;

Defined in: ui/map/EntityRenderer.ts:76

featureCache
protected featureCache: Map<string, Feature<Point, GeoJsonProperties>>;

Defined in: ui/map/EntityRenderer.ts:79

Methods

initialize()
initialize(forceImmediate?): void;

Defined in: ui/map/EntityRenderer.ts:92

Initialize the entity renderer Creates sprites and sets up map layers

Parameters
forceImmediate?

boolean = false

Force immediate setup even if style check fails (use when called from map load callback)

Returns

void

setupEntities()
protected setupEntities(): void;

Defined in: ui/map/EntityRenderer.ts:106

Set up entity sprites and layers

Returns

void

createSprites()
protected createSprites(): void;

Defined in: ui/map/EntityRenderer.ts:121

Create sprites for entity states: normal, selected, and optionally conflict. Drawn once at a fixed oversampled resolution; the on-screen size is controlled solely by the layer's icon-size property.

Returns

void

setupLayers()
protected setupLayers(): void;

Defined in: ui/map/EntityRenderer.ts:187

Set up entity map layers Creates sources and layers for entity points and labels

Returns

void

getProtectedZoneRadius()
protected getProtectedZoneRadius(entityData, index): number;

Defined in: ui/map/EntityRenderer.ts:373

Get the protected zone radius for an entity

Parameters
entityData

T

Entity data

index

number

Index of the entity in the data arrays

Returns

number

Radius in meters, or 0 if no protected zone

updateEntityDisplay()
updateEntityDisplay(entityData): void;

Defined in: ui/map/EntityRenderer.ts:382

Update entity display with new data using efficient incremental updates

Parameters
entityData

T

Entity data to display

Returns

void

updateProtectedZones()
protected updateProtectedZones(entityData): void;

Defined in: ui/map/EntityRenderer.ts:499

Update protected zones display Creates circle polygon features for each entity's protected zone using turf.js

Parameters
entityData

T

Returns

void

buildEntityLabel()
abstract protected buildEntityLabel(entityData, index): string;

Defined in: ui/map/EntityRenderer.ts:563

Build entity label text - must be implemented by subclasses

Parameters
entityData

T

Entity data

index

number

Index of the entity in the data arrays

Returns

string

getConflictStatus()
protected getConflictStatus(_entityData, _index): boolean;

Defined in: ui/map/EntityRenderer.ts:570

Get conflict status for an entity - can be overridden by subclasses

Parameters
_entityData

T

_index

number

Returns

boolean

shouldShowLabels()
abstract protected shouldShowLabels(): boolean;

Defined in: ui/map/EntityRenderer.ts:579

Determine if labels should be shown - can be overridden by subclasses

Returns

boolean

shouldShowEntities()
abstract protected shouldShowEntities(): boolean;

Defined in: ui/map/EntityRenderer.ts:584

Determine if entities should be shown - can be overridden by subclasses

Returns

boolean

shouldShowProtectedZones()
abstract protected shouldShowProtectedZones(): boolean;

Defined in: ui/map/EntityRenderer.ts:589

Determine if protected zones should be shown - can be overridden by subclasses

Returns

boolean

updateLayerVisibility()
protected updateLayerVisibility(): void;

Defined in: ui/map/EntityRenderer.ts:594

Update layer visibility based on display options

Returns

void

setSelectedEntity()
setSelectedEntity(entityId): void;

Defined in: ui/map/EntityRenderer.ts:616

Set selected entity Updates the selected state and refreshes the display

Parameters
entityId

string | null

Returns

void

updateIconSize()
updateIconSize(iconSize): void;

Defined in: ui/map/EntityRenderer.ts:629

Update icon size

Parameters
iconSize

number

New icon size multiplier

Returns

void

updateColors()
updateColors(colors): void;

Defined in: ui/map/EntityRenderer.ts:642

Update entity colors

Parameters
colors

Partial\<EntityColors>

New color configuration

Returns

void

setEntityShape()
setEntityShape(shapeDrawer): void;

Defined in: ui/map/EntityRenderer.ts:701

Change the entity shape at runtime

Parameters
shapeDrawer

EntityShapeDrawer

New shape drawing function

Returns

void

onStyleChange()
onStyleChange(): void;

Defined in: ui/map/EntityRenderer.ts:725

Handle map style changes Re-creates sprites and layers when the style changes.

If the style is already loaded (e.g. this was invoked from within a 'style.load' handler), run setup synchronously — otherwise once('style.load') would queue the callback until the next style change, which leaves the aircraft layers missing and can race with other renderers re-adding their own layers in the meantime.

Returns

void

destroy()
destroy(): void;

Defined in: ui/map/EntityRenderer.ts:745

Clean up resources

Returns

void

Interfaces

EntityColors

Defined in: ui/map/EntityRenderer.ts:27

Entity colors configuration

Properties

normal
normal: string;

Defined in: ui/map/EntityRenderer.ts:28

selected
selected: string;

Defined in: ui/map/EntityRenderer.ts:29

conflict?
optional conflict?: string;

Defined in: ui/map/EntityRenderer.ts:30

label
label: string;

Defined in: ui/map/EntityRenderer.ts:31


EntityRenderConfig

Defined in: ui/map/EntityRenderer.ts:37

Entity rendering configuration

Properties

entityType
entityType: string;

Defined in: ui/map/EntityRenderer.ts:38

layerPrefix
layerPrefix: string;

Defined in: ui/map/EntityRenderer.ts:39

spritePrefix
spritePrefix: string;

Defined in: ui/map/EntityRenderer.ts:40

colors
colors: EntityColors;

Defined in: ui/map/EntityRenderer.ts:41

iconSize
iconSize: number;

Defined in: ui/map/EntityRenderer.ts:42

shapeDrawer
shapeDrawer: EntityShapeDrawer;

Defined in: ui/map/EntityRenderer.ts:43

enableTrails?
optional enableTrails?: boolean;

Defined in: ui/map/EntityRenderer.ts:44

Type Aliases

EntityShapeDrawer

type EntityShapeDrawer = (ctx, size) => void;

Defined in: ui/map/EntityRenderer.ts:22

Entity shape drawing function type

Parameters

ctx

CanvasRenderingContext2D

Canvas 2D rendering context

size

number

Canvas size (width and height)

Returns

void

Variables

SPRITE_CANVAS_PX

const SPRITE_CANVAS_PX: 128 = 128;

Defined in: ui/map/EntityRenderer.ts:59

Sprite canvas resolution in pixels. Fixed and oversampled: MapLibre scales the sprite down to SPRITE_CSS_SIZE, so it stays crisp on high-DPI screens across the whole icon-size slider range.


SPRITE_CSS_SIZE

const SPRITE_CSS_SIZE: 38.4 = 38.4;

Defined in: ui/map/EntityRenderer.ts:67

Rendered sprite size in CSS pixels at icon-size 1.0. The displayed size is SPRITE_CSS_SIZE * iconSize on every screen. The value keeps the default appearance (0.8 → ~31 px) of the previous renderer, which drew the sprite at 12 * iconSize * 4 canvas pixels.