Skip to content

API reference / @zaes/military-symbols/map

@zaes/military-symbols/map ​

@zaes/military-symbols/map — military symbols as a family on the symbology engine: the saved object, the store and the painter the map renderers and the editor share. No map library is imported here; the renderers are /openlayers and /maplibre, the editor /editor.

Classes ​

Interfaces ​

Type Aliases ​

CollectionChange ​

ts
type CollectionChange = 
  | {
  id: string;
  type: "add" | "update" | "remove";
}
  | {
  type: "reset";
};

CollectionListener ​

ts
type CollectionListener = (change) => void;

Parameters ​

change ​

CollectionChange

Returns ​

void


MilitaryFeature ​

ts
type MilitaryFeature = SymbolFeature<"military", MilitaryProperties>;

Pixel ​

ts
type Pixel = [number, number];

PointSize ​

ts
type PointSize = keyof typeof POINT_SIZES;

ProjectedPosition ​

ts
type ProjectedPosition = [number, number];

A position in EPSG:3857 meters.

Variables ​

MAP_AMPLIFIERS ​

ts
const MAP_AMPLIFIERS: readonly ["AH", "AI", "AK"];

The amplifiers drawn on the map in map units, not by renderSymbol.


MILITARY_PAINTER ​

ts
const MILITARY_PAINTER: SymbolPainter<MilitaryFeature>;

MILITARY_SCHEMA ​

ts
const MILITARY_SCHEMA: CollectionSchema<"military", MilitaryProperties>;

POINT_SIZES ​

ts
const POINT_SIZES: Readonly<{
  large: 1.5;
  medium: 1;
  small: 0.75;
}>;

Point symbol sizes ​

One vocabulary for how large a point symbol is drawn, shared by every family, so a host offers the same choice for every family: small, medium and large, as multiples of the family's own size (its standard's or its source's). Medium is the family's size. A family takes a default from its configuration and lets a graphic override it.

Functions ​

configureMilitarySymbols() ​

ts
function configureMilitarySymbols(patch): void;

Changes how every military symbol draws. Unknown keys are ignored; the glyph cache is cleared.

Parameters ​

patch ​

Partial<MilitaryConfig>

Returns ​

void


drawnPoints() ​

ts
function drawnPoints(feature): [number, number][];

The points the operator drew, in order: a point's anchor, a line's coordinates, or an area's outer ring without its closing point — made continuous across the antimeridian, since a file from elsewhere folds longitudes into ±180 (179° then -179°), and every measure and paint reads these. A graphic that does not cross is unchanged.

Parameters ​

feature ​

Feature<LineString | Point | Polygon>

Returns ​

[number, number][]


fromMercator() ​

ts
function fromMercator(p): [number, number];

Parameters ​

p ​

readonly number[]

Returns ​

[number, number]


geometryForKind() ​

ts
function geometryForKind(kind, points): LineString | Point | Polygon;

The geometry for drawn points: a point's first point, a line as is, an area as a closed ring.

Parameters ​

kind ​

GeometryKind

points ​

readonly Position[]

Returns ​

LineString | Point | Polygon


getMilitaryConfig() ​

ts
function getMilitaryConfig(): Readonly<MilitaryConfig>;

Returns ​

Readonly<MilitaryConfig>


isMilitarySidc() ​

ts
function isMilitarySidc(name): name is string;

A SIDC this family can draw: a well-formed 2525D/E code whose entity is a frame, an icon or a single point, or a 2525C letter code that renderSymbol draws (once use2525C() has loaded them).

Parameters ​

name ​

unknown

Returns ​

name is string


isPointSize() ​

ts
function isPointSize(s): s is "medium" | "small" | "large";

Parameters ​

s ​

unknown

Returns ​

s is "medium" | "small" | "large"


militaryDisplayName() ​

ts
function militaryDisplayName(name): string;

A symbol's name for people: its entity's path in the catalog, or the code.

Parameters ​

name ​

string

Returns ​

string


militaryGlyph() ​

ts
function militaryGlyph(props): GlyphDef;

The glyph a symbol draws as, at the configured size, cached by everything that changes it.

Parameters ​

props ​

MilitaryProperties

Returns ​

GlyphDef


militaryGroundLines() ​

ts
function militaryGroundLines(props, at): MilitaryGroundLine[];

The amplifiers measured on the ground (AH area of uncertainty, AI dead reckoning trailer, AK pairing line, 5.3.7.13) of a saved symbol at at ([longitude, latitude]), as lines in longitude and latitude for map libraries that draw their own lines. The pairing line starts at the symbol's position.

Parameters ​

props ​

MilitaryProperties

at ​

readonly [number, number]

Returns ​

MilitaryGroundLine[]


militaryImage() ​

ts
function militaryImage(props): MilitaryImage | undefined;

A saved symbol drawn as the map renderers draw it (configureMilitarySymbols' size, display options and amplifier setting, its own size and direction), as an image; undefined for a code this family does not draw. The amplifiers measured on the ground are not in it: see militaryGroundLines.

Parameters ​

props ​

MilitaryProperties

Returns ​

MilitaryImage | undefined


militaryScale() ​

ts
function militaryScale(props, resolution?): number;

How much bigger than medium a symbol draws: its size, and the map's zoom shrink.

Parameters ​

props ​

MilitaryProperties

resolution? ​

number

Returns ​

number


svgToGlyph() ​

ts
function svgToGlyph(rendered, glyphPx): GlyphDef;

The glyph of a rendered symbol: parts in the SVG's own units, the anchor where the symbol's anchor is, and a scale making one unit pxPerUnit CSS pixels (with the engine's GLYPH_PX).

Parameters ​

rendered ​

RenderedSymbol

glyphPx ​

number

Returns ​

GlyphDef


toMercator() ​

ts
function toMercator(lonLat): ProjectedPosition;

Parameters ​

lonLat ​

Position

Returns ​

ProjectedPosition

Released under the MIT License; the drawings derive from Apache-2.0 work.