@emberbox/ui 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emberbox/ui",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "Shared look and building blocks of the Emberbox tools, built on Nuxt UI.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -35,11 +35,14 @@ export {
35
35
  type MarkKind, type Organisation, type SvgElement, type SymbolShape, type SymbolSpec, type UnitSize,
36
36
  } from './symbols/tactical'
37
37
  export {
38
- BASIC_FORMS, DRIVES, FLIGHTS, ORGANISATION_COLOURS, SIGN_ORGANISATIONS, SIGN_SIZES, SUPPLEMENTS, VEHICLE_BODIES, tacticalSign,
39
- tacticalSignTree, type BasicForm, type Drive, type Flight, type SignOrganisation, type SignSize, type SignStyle, type Supplement,
40
- type TacticalSignSpec, type VehicleBody,
38
+ BASIC_FORMS, DRIVES, FLIGHTS, ORGANISATION_COLOURS, SIGN_FIGURES, SIGN_ORGANISATIONS, SIGN_SIZES, SUPPLEMENTS, VEHICLE_BODIES,
39
+ tacticalSign, tacticalSignTree, type BasicForm, type Drive, type Flight, type SignFigure, type SignOrganisation, type SignSize,
40
+ type SignStyle, type Supplement, type TacticalSignSpec, type VehicleBody,
41
41
  } from './symbols/signs'
42
42
  export {CATALOG_SOURCE, TACTICAL_SIGN_CATALOG, catalogSignTree, type CatalogEntry} from './symbols/catalog'
43
+ export {ABILITIES, type Ability, type AbilityName, type AbilityPart} from './symbols/abilities'
44
+ export {ADDITIONAL_SIGNS, additionalSign, additionalSignTree, type AdditionalSign, type AdditionalSignName} from './symbols/additional'
45
+ export type {BoxPart} from './symbols/svg'
43
46
 
44
47
  /**
45
48
  * Vue plugin that installs Nuxt UI in the Emberbox style. Icons come only from the bundled set; a
@@ -0,0 +1,158 @@
1
+ /**
2
+ * The symbols of chapter 4 of the recommendations "Taktische Zeichen im Bevölkerungsschutz" (BBK,
3
+ * 2024): what a unit, vehicle or place can do. Each is drawn on its own 100 × 60 box, which a sign
4
+ * scales into the inside of its basic form; several abilities stack from the bottom up, the main
5
+ * one lowest, as 6.1 asks. The drawings follow the system of the recommendations without copying
6
+ * their artwork.
7
+ */
8
+
9
+ import type {BoxPart} from './svg'
10
+
11
+ /** One stroke, filled shape or piece of writing of an ability, on the 100 × 60 box. */
12
+ export type AbilityPart = BoxPart
13
+
14
+ /** An ability of chapter 4 with its number, name after the recommendations and printed page. */
15
+ export interface Ability {
16
+ number: string
17
+ name: string
18
+ page: number
19
+ parts: readonly AbilityPart[]
20
+ /** Spans the whole inside of the form, as annex C draws firefighting and the CBRN cross, instead of keeping its proportions. */
21
+ stretch?: boolean
22
+ }
23
+
24
+ const CBRN: AbilityPart[] = [{circle: [34, 10, 6], filled: true}, {circle: [66, 10, 6], filled: true}, {d: 'M34 10 L68 54 M66 10 L32 54'}]
25
+ /** A wavy line at a height, from one x to another in waves of 10. */
26
+ export function waves(y: number, from = 30, to = 70): AbilityPart {
27
+ const more = Math.max(0, Math.round((to - from) / 10) - 1)
28
+ return {d: `M${from} ${y} q5 -5 10 0${' t10 0'.repeat(more)}`}
29
+ }
30
+ /** A diamond around a point. */
31
+ export const DIAMOND = (cx: number, cy: number, r: number): AbilityPart => ({d: `M${cx} ${cy - r} L${cx + r} ${cy} L${cx} ${cy + r} L${cx - r} ${cy} Z`})
32
+ /** The V of veterinary care. */
33
+ export const VET: AbilityPart = {d: 'M36 6 H44 L56 54 L68 6 H76'}
34
+ /** An open arrow head at a point, pointing along (dx, dy). */
35
+ export const ARROW_HEAD = (x: number, y: number, dx: number, dy: number): AbilityPart => ({d: `M${x - dx * 6 - dy * 4} ${y - dy * 6 + dx * 4} L${x} ${y} L${x - dx * 6 + dy * 4} ${y - dy * 6 - dx * 4}`})
36
+
37
+ /** The abilities of chapter 4, keyed by a short English name. */
38
+ export const ABILITIES = {
39
+ 'cbrn': {number: '4.1.1', name: 'Abwehr gefährlicher Stoffe und Güter, ABC-/CBRN-Schutz', page: 22, parts: CBRN, stretch: true},
40
+ 'cbrn-measuring': {number: '4.1.2', name: 'Messen, Spüren, Detektieren', page: 22, parts: [...CBRN, {d: 'M14 46 L86 20'}], stretch: true},
41
+ 'decontamination': {number: '4.1.3', name: 'Dekontaminieren', page: 22, parts: [...CBRN, ARROW_HEAD(32, 54, -0.6, 0.8), ARROW_HEAD(68, 54, 0.6, 0.8)], stretch: true},
42
+ 'water-pollution': {number: '4.1.4', name: 'Beseitigen von Umweltschäden auf Gewässern', page: 22,
43
+ parts: [{circle: [36, 6, 5], filled: true}, {circle: [64, 6, 5], filled: true}, {d: 'M36 6 L62 36 M64 6 L38 36'}, ARROW_HEAD(38, 36, -0.6, 0.8), ARROW_HEAD(62, 36, 0.6, 0.8), waves(46), waves(54)]},
44
+ 'water-treatment': {number: '4.1.5', name: 'Trinkwasseraufbereitung', page: 22,
45
+ parts: [{d: 'M32 14 A20 20 0 0 0 36 50'}, {d: 'M64 10 A20 20 0 0 1 68 46'}, ARROW_HEAD(36, 50, 0.3, 1), ARROW_HEAD(68, 46, -0.2, 1), {d: 'M38 30 q4 -4 8 0 t8 0 t8 0 M40 38 H58 M54 38 V44'}]},
46
+ 'radiological': {number: '4.1.6', name: 'Atomare (radiologische/nukleare) Stoffe', page: 23,
47
+ parts: [{circle: [50, 30, 4], filled: true}, {d: 'M50 38 L56 50 A21 21 0 0 1 44 50 Z M43 26 L30 26 A21 21 0 0 1 36 15 Z M57 26 L64 15 A21 21 0 0 1 70 26 Z', filled: true}]},
48
+ 'biological': {number: '4.1.7', name: 'Biologische Stoffe', page: 23,
49
+ parts: [{circle: [50, 20, 12]}, {circle: [40, 38, 12]}, {circle: [60, 38, 12]}]},
50
+ 'chemical': {number: '4.1.8', name: 'Chemische Stoffe', page: 23, parts: [{d: 'M44 4 V22 L32 56 H68 L56 22 V4'}]},
51
+ 'care': {number: '4.2.1', name: 'Grundzeichen Betreuung', page: 23, parts: [{d: 'M30 56 L50 4 L70 56'}]},
52
+ 'psychosocial': {number: '4.2.2', name: 'Psychosoziale Notfallversorgung, Notfallbegleitung, Krisenintervention', page: 23,
53
+ parts: [{d: 'M32 44 L50 4 L68 44'}, {text: 'PSNV', x: 50, y: 52, size: 12}]},
54
+ 'pastoral': {number: '4.2.3', name: 'Seelsorge (religiös/interkonfessionell)', page: 23, parts: [{d: 'M44 4 V56 M56 4 V56 M34 18 H66 M34 28 H66'}]},
55
+ 'rest': {number: '4.2.4', name: 'Temporäre (Not-)Unterbringung/Versorgung mit Ruhemöglichkeit (einschl. Sitzgelegenheiten)', page: 23,
56
+ parts: [{d: 'M26 14 V50 M74 14 V50 M26 38 H74 M26 34 Q50 20 74 34'}]},
57
+ 'seating': {number: '4.2.5', name: 'Temporäre (Not-)Unterbringung/Versorgung mit Sitzgelegenheit', page: 24, parts: [{d: 'M40 6 V54 M40 28 H62 V54'}]},
58
+ 'firefighting': {number: '4.3.1', name: 'Brandbekämpfung, Löscheinsatz (einschl. Retten)', page: 24, parts: [{d: 'M4 30 H96 M66 30 L96 4 M66 30 L96 56'}], stretch: true},
59
+ 'extinguishing-water': {number: '4.3.2', name: 'Löschwasser, (Brauch-)Wasser', page: 24, parts: [{d: 'M26 34 q6 -12 12 0 t12 0 t12 0 t12 0'}]},
60
+ 'foam': {number: '4.3.3', name: 'Schaummittel', page: 24, parts: [{d: 'M38 16 H62 L50 44 Z', filled: true}]},
61
+ 'solid-agent': {number: '4.3.4', name: 'Sonderlöschmittel fest', page: 24, parts: [{d: 'M38 18 H62 V42 H38 Z', filled: true}]},
62
+ 'gaseous-agent': {number: '4.3.5', name: 'Sonderlöschmittel gasförmig', page: 24, parts: [{circle: [50, 30, 11], filled: true}]},
63
+ 'breathing-protection': {number: '4.3.6', name: 'Atemschutz (umluftunabhängig)', page: 24,
64
+ parts: [{d: 'M42 6 H58 V38 Q58 46 50 48 Q42 46 42 38 Z M50 48 V52'}, {circle: [50, 55, 3]}]},
65
+ 'reconnaissance': {number: '4.4.1', name: 'Erkunden, Beobachten, Überwachen', page: 24, parts: [{d: 'M24 54 L76 6'}], stretch: true},
66
+ 'locating-biological': {number: '4.4.2', name: 'Orten, biologisch', page: 25,
67
+ parts: [{d: 'M20 46 L34 22 M34 46 L20 22 M27 22 H64 M58 46 L64 22 L70 46 M64 22 L76 8 L82 22 Z'}]},
68
+ 'locating-technical': {number: '4.4.3', name: 'Orten, technisch', page: 25,
69
+ parts: [{d: 'M26 30 Q34 6 58 12'}, {d: 'M34 34 L48 46 L52 36 L72 54'}, ARROW_HEAD(72, 54, 0.7, 0.7)]},
70
+ 'salvage': {number: '4.5.1', name: 'Bergen, Bergung', page: 25, parts: [{d: 'M20 18 H34 A16 16 0 0 0 66 18 H80'}]},
71
+ 'ladder': {number: '4.5.2', name: 'Retten aus Höhen und Tiefen mit tragbaren Leitern', page: 25, parts: [{d: 'M40 4 V56 M60 4 V56 M40 16 H60 M40 30 H60 M40 44 H60'}]},
72
+ 'turntable-ladder': {number: '4.5.3', name: 'Retten aus Höhen und Tiefen mit Drehleiter', page: 25, parts: [{d: 'M28 56 L60 24 M60 12 H74 V26 H60 Z'}]},
73
+ 'aerial-platform': {number: '4.5.4', name: 'Retten aus Höhen und Tiefen mit Hubarbeitsbühne/Teleskopgelenkmast', page: 25,
74
+ parts: [{d: 'M30 56 L36 34 L60 26 M60 12 H74 V26 H60 Z'}]},
75
+ 'boats': {number: '4.5.5', name: 'Einsatz von Wasserfahrzeugen', page: 25,
76
+ parts: [{d: 'M42 24 H58 A8 8 0 0 1 42 24'}, waves(26, 22, 38), waves(26, 62, 78), waves(32, 22, 38), waves(32, 62, 78)]},
77
+ 'mountain-rescue': {number: '4.5.6', name: 'Bergrettung', page: 25, parts: [DIAMOND(50, 18, 12), {d: 'M50 32 L62 54 H38 Z', filled: true}]},
78
+ 'special-rescue': {number: '4.5.7', name: 'Spezielle Rettung aus Höhen und Tiefen', page: 25,
79
+ parts: [DIAMOND(50, 30, 12), {d: 'M50 16 V4 M50 44 V56'}, ARROW_HEAD(50, 4, 0, -1), ARROW_HEAD(50, 56, 0, 1)]},
80
+ 'water-rescue': {number: '4.5.8', name: 'Wasserrettung (einschl. Tauchen)', page: 25, parts: [waves(10), waves(18), DIAMOND(50, 40, 14)]},
81
+ 'medical': {number: '4.6.1', name: 'Grundzeichen Sanität', page: 26, parts: [{d: 'M50 4 V56 M24 30 H76'}]},
82
+ 'nursing': {number: '4.6.2', name: 'Pflege', page: 26, parts: [{d: 'M50 4 V56 M24 30 H76 M36 24 V36'}]},
83
+ 'emergency-medicine': {number: '4.6.3', name: 'Rettungswesen, Intensivmedizin/Notfallmedizin', page: 26, parts: [{d: 'M50 4 V56 M24 30 H76 M64 24 V36'}]},
84
+ 'doctors': {number: '4.6.4', name: 'Arztwesen', page: 26, parts: [{d: 'M50 4 V56 M24 30 H76 M44 46 H56'}]},
85
+ 'patient-transport': {number: '4.6.5', name: 'Patiententransport', page: 26,
86
+ parts: [{circle: [50, 30, 14]}, {d: 'M40 20 L60 40 M60 20 L40 40 M50 4 V56 M24 30 H76'}]},
87
+ 'hospital': {number: '4.6.6', name: 'Krankenhaus, stationäre Versorgung', page: 26,
88
+ parts: [{d: 'M24 20 L50 6 L76 20 V56 H24 Z M24 20 H76 M24 38 H76 M37 28 V48 M50 28 V48 M63 28 V48'}]},
89
+ 'flood-defence': {number: '4.7.1', name: 'Abwehr von Wassergefahren, Deichverteidigung', page: 26,
90
+ parts: [waves(14, 26, 46), waves(20, 26, 46), {d: 'M26 52 H44 L56 16 H70 L74 28'}]},
91
+ 'excavator': {number: '4.7.2', name: 'Baggerarbeiten', page: 26, parts: [{d: 'M32 56 L44 16 L58 8 L72 20 L66 28'}]},
92
+ 'lighting': {number: '4.7.3', name: 'Beleuchten', page: 27, parts: [{d: 'M42 56 V16 Q42 6 54 8'}, {circle: [58, 16, 7]}]},
93
+ 'ventilating': {number: '4.7.4', name: 'Belüften', page: 27, parts: [{d: 'M24 12 Q44 12 50 26 H76 M24 48 Q44 48 50 34 H76 M50 4 V20 M50 40 V56'}, ARROW_HEAD(76, 26, 1, 0), ARROW_HEAD(76, 34, 1, 0)]},
94
+ 'extracting': {number: '4.7.5', name: 'Entlüften', page: 27, parts: [{d: 'M24 26 H50 Q56 12 76 12 M24 34 H50 Q56 48 76 48 M50 4 V20 M50 40 V56'}, ARROW_HEAD(76, 12, 1, 0), ARROW_HEAD(76, 48, 1, 0)]},
95
+ 'ordnance-disposal': {number: '4.7.6', name: 'Entschärfen, Kampfmittelräumung', page: 27,
96
+ parts: [{circle: [50, 30, 18]}, {circle: [50, 30, 10], filled: true}, {d: 'M50 6 V12 M50 48 V54 M26 30 H32 M68 30 H74'}]},
97
+ 'hand-tools': {number: '4.7.7', name: 'Einsatz von Handwerkzeugen/Handarbeit', page: 27,
98
+ parts: [{d: 'M32 8 L68 52 M68 8 L32 52'}, {d: 'M26 4 L38 10 L34 16 Z', filled: true}, {d: 'M70 4 Q80 8 74 16 Q66 14 70 4 Z', filled: true}]},
99
+ 'forklift': {number: '4.7.8', name: 'Hebearbeit, Umschlagen von Lasten', page: 27, parts: [{d: 'M40 4 V56 M46 10 V48 H66'}]},
100
+ 'crane': {number: '4.7.9', name: 'Hebearbeit, Heben von Lasten', page: 27, parts: [{d: 'M38 56 V8 H62 V16 Q62 22 56 20'}]},
101
+ 'lifting': {number: '4.7.10', name: '(An-)Heben von Personen oder Lasten', page: 27, parts: [DIAMOND(50, 38, 12), {d: 'M50 26 V6'}, ARROW_HEAD(50, 6, 0, -1)]},
102
+ 'telehandler': {number: '4.7.11', name: 'Kombinationsarbeit Heben/Räumen', page: 27, parts: [{d: 'M28 56 L56 24 H72 M56 24 V12'}]},
103
+ 'manipulating': {number: '4.7.12', name: '(Fern-)Manipulieren, mechanisch/mit Greifwerkzeug', page: 27, parts: [{d: 'M24 30 H50 L62 18 L72 22 M50 30 L62 42 L72 38'}]},
104
+ 'chainsaw': {number: '4.7.13', name: 'Motorsägearbeiten', page: 27,
105
+ parts: [{d: 'M36 20 H68 Q76 20 76 30 Q76 40 68 40 H36 Z M36 24 H30 V36 H36'}]},
106
+ 'pumping': {number: '4.7.14', name: 'Pumpen, Lenzen, Beseitigen von Wasserschäden', page: 28,
107
+ parts: [{circle: [50, 30, 12]}, {d: 'M50 18 Q60 8 68 14 M62 30 Q72 40 66 48 M50 42 Q40 52 32 46 M38 30 Q28 20 34 12'}]},
108
+ 'clearing': {number: '4.7.15', name: 'Räumarbeiten mit Maschine', page: 28, parts: [{d: 'M26 40 H54 M54 26 V40 H74'}]},
109
+ 'protection': {number: '4.7.16', name: 'Sicherheit, Schutz vor Einwirkungen', page: 28, parts: [{d: 'M36 8 Q50 2 64 8 V34 Q64 50 50 56 Q36 50 36 34 Z'}]},
110
+ 'blasting': {number: '4.7.17', name: 'Sprengen, Sprengkörper, Blindgänger', page: 28, parts: [{d: 'M42 6 H58 V36 Q58 54 50 56 Q42 54 42 36 Z', filled: true}]},
111
+ 'technical-rescue': {number: '4.7.18', name: 'Technische Hilfeleistung (einschl. Retten)', page: 28,
112
+ parts: [{d: 'M38 24 H62 V36 H38 Z M38 30 H28 L20 22 M28 30 L18 36 M22 26 L16 30 M62 30 H72 L80 22 M72 30 L82 38'}]},
113
+ 'transporting': {number: '4.7.19', name: 'Transportieren', page: 28,
114
+ parts: [{circle: [50, 30, 22]}, {d: 'M50 8 V52 M28 30 H72 M34 14 L66 46 M66 14 L34 46'}]},
115
+ 'door-opening': {number: '4.7.20', name: 'Türöffnung', page: 28, parts: [{d: 'M38 6 H62 V54 H38 Z M38 6 L50 12 V58 L38 54'}]},
116
+ 'heights': {number: '4.7.21', name: 'Höhenunterschiede überwinden', page: 28,
117
+ parts: [{d: 'M50 10 H74 M50 10 V50 M26 50 H50'}, ARROW_HEAD(50, 50, 0, 1), ARROW_HEAD(50, 10, 0, -1)]},
118
+ 'securing': {number: '4.7.22', name: 'Absicherung', page: 28, parts: [{d: 'M30 54 H70 L56 6 H44 Z M40 22 H60 M36 38 H64'}]},
119
+ 'optical-warning': {number: '4.7.23', name: 'Warnen/Informieren mit optischen Anzeigen', page: 28,
120
+ parts: [{d: 'M30 8 H70 V44 H30 Z M50 44 V52 M40 52 H60'}, {text: 'i', x: 50, y: 27, size: 22}]},
121
+ 'loudspeaker': {number: '4.7.24', name: 'Warnen mit Lautsprecherdurchsagen', page: 28,
122
+ parts: [{d: 'M30 22 H40 L58 10 V50 L40 38 H30 Z M64 20 Q70 30 64 40 M70 14 Q80 30 70 46'}]},
123
+ 'siren': {number: '4.7.25', name: 'Warnen mit Sirene', page: 28, parts: [{d: 'M28 24 Q50 0 72 24 Z M50 24 V56'}]},
124
+ 'water-conveying': {number: '4.7.26', name: 'Wasserförderung', page: 29, parts: [{d: 'M30 22 q5 -8 10 0 t10 0 t10 0 M26 38 H74'}, {circle: [26, 38, 3]}, ARROW_HEAD(74, 38, 1, 0)]},
125
+ 'water-retention': {number: '4.7.27', name: 'Wasserrückhaltung, Wasserbevorratung', page: 29, parts: [{d: 'M28 52 H72 V12 M34 30 q4 -8 8 0 t8 0 t8 0 t8 0'}]},
126
+ 'pulling': {number: '4.7.28', name: 'Ziehen von Lasten', page: 29, parts: [{d: 'M24 18 H44 V42 H24 Z M44 30 H76'}, ARROW_HEAD(76, 30, 1, 0)]},
127
+ 'container': {number: '4.8.1', name: '(Transport-)Behälter', page: 29, parts: [{d: 'M30 6 V54 H70 V6'}]},
128
+ 'consumables': {number: '4.8.2', name: 'Betriebsstoffe und Verbrauchsgüter', page: 29, parts: [{d: 'M30 6 H70 L54 24 V56 M46 56 V24 L30 6'}]},
129
+ 'bridge': {number: '4.8.3', name: 'Brücke/Übergang, Übergabe', page: 29, parts: [{d: 'M24 10 L32 18 H68 L76 10 M24 50 L32 42 H68 L76 50'}]},
130
+ 'temporary-bridge': {number: '4.8.4', name: 'Behelfsbrückenbau', page: 29,
131
+ parts: [{d: 'M24 6 L32 12 H68 L76 6 M24 30 L32 24 H68 L76 30'}, {d: 'M38 56 V40 H62 V56 M50 40 V56', width: 5}]},
132
+ 'disposal': {number: '4.8.5', name: 'Entsorgung', page: 29, parts: [{d: 'M36 12 H64 M46 8 H54 M38 12 V54 H62 V12 M44 20 V48 M50 20 V48 M56 20 V48'}]},
133
+ 'maintenance': {number: '4.8.6', name: 'Instandhaltung, Instandsetzung, materielle Infrastruktur', page: 29,
134
+ parts: [{d: 'M28 16 Q38 30 28 44 M38 30 H62 M72 16 Q62 30 72 44'}]},
135
+ 'sandbag': {number: '4.8.7', name: 'Sandsack', page: 29, parts: [{d: 'M44 6 H56 L54 12 Q66 16 64 34 Q64 54 50 56 Q36 54 36 34 Q34 16 46 12 Z'}]},
136
+ 'sandbag-filling': {number: '4.8.8', name: 'Sandsackbefüllung', page: 30, parts: [{d: 'M30 54 V6 H70 V54 M30 6 L42 22 H58 L70 6 M42 22 V34 H58 V22'}]},
137
+ 'shower': {number: '4.8.9', name: 'Sanitäre Einrichtung, Dusch-, Waschmöglichkeit(en)', page: 30,
138
+ parts: [{d: 'M58 54 V16 Q58 6 48 6 Q38 6 38 16 M32 16 H44 M34 24 V30 M38 24 V30 M42 24 V30'}]},
139
+ 'toilets': {number: '4.8.10', name: 'Sanitäre Einrichtung, WC/sanitäre Anlagen', page: 30, parts: [{text: 'WC', x: 50, y: 32, size: 26}]},
140
+ 'power': {number: '4.8.11', name: 'Stromversorgung', page: 30, parts: [{d: 'M56 4 L40 30 L58 30 L44 56'}, ARROW_HEAD(44, 56, -0.5, 1)]},
141
+ 'drinking-water': {number: '4.8.12', name: 'Trinkwasser', page: 30, parts: [{d: 'M24 26 H66 Q74 26 74 36 M50 26 V20 M44 20 H56'}]},
142
+ 'catering': {number: '4.8.13', name: 'Verpflegung', page: 30, parts: [{d: 'M68 18 A18 18 0 1 0 68 42 L50 30 Z'}]},
143
+ 'cooking': {number: '4.8.14', name: 'Zubereiten von Verpflegung', page: 30,
144
+ parts: [{d: 'M74 18 A18 18 0 1 0 74 42 L56 30 Z'}, {d: 'M30 6 Q38 6 38 16 Q38 24 32 26 V56 H28 V26 Q22 24 22 16 Q22 6 30 6 Z', filled: true}]},
145
+ 'tent': {number: '4.8.15', name: 'Zelt, Schnelleinsatzzelt', page: 30, parts: [{d: 'M30 56 V22 L40 8 H60 L70 22 V56'}]},
146
+ 'pole-tent': {number: '4.8.16', name: 'Zelt, Stangengerüstzelt', page: 30, parts: [{d: 'M26 56 L54 8 M74 56 L46 8 M26 56 H74'}]},
147
+ 'communication': {number: '4.9.1', name: 'Information und Kommunikation (IuK)/Fernmeldewesen', page: 30, parts: [{d: 'M24 16 L44 44 L52 22 L76 50'}]},
148
+ 'veterinary': {number: '4.10.1', name: 'Veterinärwesen', page: 31, parts: [VET]},
149
+ 'slaughtering': {number: '4.10.2', name: '(Not-)Schlachten, Keulen', page: 31, parts: [{d: 'M24 26 H76 M24 40 L30 30 L36 40 Z'}]},
150
+ 'poultry': {number: '4.10.3', name: 'Geflügel', page: 31, parts: [VET, {d: 'M30 52 V42 L34 46 L36 38 L40 46 L44 40 V52 Z'}]},
151
+ 'horses': {number: '4.10.4', name: 'Pferd', page: 31, parts: [VET, {d: 'M28 52 H32 V46 A6 6 0 1 1 40 46 V52 H44'}]},
152
+ 'cattle': {number: '4.10.5', name: 'Rind', page: 31, parts: [VET, {d: 'M28 44 L32 52 L36 44 L40 52 L44 44'}]},
153
+ 'sheep': {number: '4.10.6', name: 'Schaf', page: 31, parts: [VET, {d: 'M28 48 q2 -8 8 -6 q6 -4 8 4 q4 6 -2 10 q-6 4 -10 0 q-6 0 -4 -8 Z'}]},
154
+ 'pigs': {number: '4.10.7', name: 'Schwein', page: 31, parts: [VET, {d: 'M26 48 A10 7 0 1 0 46 48 A10 7 0 1 0 26 48 Z'}, {circle: [32, 48, 2], filled: true}, {circle: [40, 48, 2], filled: true}]},
155
+ } as const satisfies Record<string, Ability>
156
+
157
+ /** An ability of chapter 4. */
158
+ export type AbilityName = keyof typeof ABILITIES
@@ -0,0 +1,214 @@
1
+ /**
2
+ * The additional signs of chapter 5 of the recommendations "Taktische Zeichen im
3
+ * Bevölkerungsschutz" (BBK, 2024) that stand on their own rather than inside a basic form:
4
+ * directions and movements (5.2), administrative levels (5.7) and the signs of hazards and damage
5
+ * (5.8). Each is drawn on its own 100 × 60 box in the colours 5.8 recommends: people and units
6
+ * black, damage and hazards red, water and own forces blue. The drawings follow the system of the
7
+ * recommendations without copying their artwork.
8
+ */
9
+
10
+ import {ARROW_HEAD, DIAMOND, VET, waves} from './abilities'
11
+ import {BLACK, HAZARD_RED as RED, MEASURE_BLUE as BLUE, WHITE, asterisk, boxPart, canvas, group, renderSvg, round, starOffsets, type BoxPart, type SvgElement} from './svg'
12
+
13
+ /** An additional sign with its number, name after the recommendations and printed page. */
14
+ export interface AdditionalSign {
15
+ number: string
16
+ name: string
17
+ page: number
18
+ parts: readonly BoxPart[]
19
+ }
20
+
21
+ /** The green of 5.8.2, taken from the printed signs; annex O names no green for it. */
22
+ const GREEN = '#2E9E3E'
23
+
24
+ const red = (part: BoxPart): BoxPart => ({...part, colour: RED})
25
+ const blue = (part: BoxPart): BoxPart => ({...part, colour: BLUE})
26
+
27
+ /** A block arrow of the tactics of 5.8.1, starting at `x` and 56 long. */
28
+ function tacticArrow(x: number): BoxPart {
29
+ return {d: `M${x} 22 Q${x + 18} 14 ${x + 36} 16 V8 L${x + 56} 28 L${x + 36} 48 V40 Q${x + 18} 38 ${x} 48`}
30
+ }
31
+
32
+ const TRIANGLE: BoxPart = {d: 'M50 4 L80 56 H20 Z'}
33
+ const PERSON = DIAMOND(50, 30, 22)
34
+
35
+ /** A hazard of 5.8.1: a red triangle around its mark. */
36
+ function hazard(...inside: BoxPart[]): BoxPart[] {
37
+ return [TRIANGLE, ...inside].map(red)
38
+ }
39
+
40
+ /** A person of 5.8.8 moved up to make room for a mark below. */
41
+ const RAISED = DIAMOND(50, 26, 20)
42
+
43
+ /** A grade of activity or failure of 5.8.2: a square with `red` of its four quarters red, clockwise from the upper right. */
44
+ function activity(red: number): BoxPart[] {
45
+ const quarters = ['M50 8 H72 V30 H50 Z', 'M50 30 H72 V52 H50 Z', 'M28 30 H50 V52 H28 Z', 'M28 8 H50 V30 H28 Z']
46
+ return [
47
+ ...quarters.map((d, index) => ({d, filled: true, width: 0.1, colour: index < red ? RED : GREEN})),
48
+ {d: 'M28 8 H72 V52 H28 Z'},
49
+ {circle: [50, 30, 8], filled: true, colour: WHITE},
50
+ {circle: [50, 30, 8]},
51
+ {text: String(red), x: 50, y: 30, size: 12},
52
+ ]
53
+ }
54
+
55
+ /** A grade of destruction of 5.8.4: as many red strokes each way as the grade. */
56
+ function destruction(grade: number): BoxPart[] {
57
+ const offsets = grade === 1 ? [0] : grade === 2 ? [-6, 6] : [-9, 0, 9]
58
+ const step = (o: number) => round(o * Math.SQRT1_2)
59
+ const lines = offsets.flatMap(o => [
60
+ `M${34 + step(o)} ${14 - step(o)} L${66 + step(o)} ${46 - step(o)}`,
61
+ `M${66 + step(o)} ${14 + step(o)} L${34 + step(o)} ${46 + step(o)}`,
62
+ ])
63
+ return [{d: lines.join(' '), colour: RED}]
64
+ }
65
+
66
+ /** A phase of a fire of 5.8.5: one to three red flames on a common base. */
67
+ function fire(phase: number): BoxPart[] {
68
+ const left = 50 - phase * 7
69
+ const flames = Array.from({length: phase}, (_, index) => `M${left + index * 14} 50 L${left + index * 14 + 14} 12 V50`).join(' ')
70
+ return [{d: `${flames} M${left} 50 H${left + phase * 14}`, colour: RED}]
71
+ }
72
+
73
+ /** A tendency of 5.8.3: an arrow in a square. */
74
+ function tendency(from: [number, number], to: [number, number]): BoxPart[] {
75
+ const length = Math.hypot(to[0] - from[0], to[1] - from[1])
76
+ return [{d: 'M30 10 H70 V50 H30 Z'}, {d: `M${from[0]} ${from[1]} L${to[0]} ${to[1]}`},
77
+ ARROW_HEAD(to[0], to[1], (to[0] - from[0]) / length, (to[1] - from[1]) / length)]
78
+ }
79
+
80
+ /** Three of a weather mark side by side. */
81
+ function three(mark: (x: number) => string): BoxPart {
82
+ return {d: [32, 50, 68].map(mark).join(' ')}
83
+ }
84
+
85
+ /** The stars of an administrative level of 5.7. */
86
+ function stars(level: number): BoxPart[] {
87
+ const r = level === 6 ? 5 : 6
88
+ return starOffsets(level).map(([dx, dy]) => ({d: asterisk(round(50 + dx * 1.4), round(30 + dy * 1.4), r)}))
89
+ }
90
+
91
+ /** The additional signs of chapter 5, keyed by a short English name, in the order of the recommendations. */
92
+ export const ADDITIONAL_SIGNS = {
93
+ 'advance': {number: '5.2.1', name: 'Richtung des Vortragens einer Maßnahme', page: 35,
94
+ parts: [{d: 'M14 25 H74 M14 35 H74'}, {d: 'M68 16 L84 30 L68 44'}]},
95
+ 'movement-start': {number: '5.2.2', name: 'Beginn einer Bewegung', page: 35, parts: [{d: 'M16 20 V40 M16 30 H82'}, ARROW_HEAD(82, 30, 1, 0)]},
96
+ 'direction': {number: '5.2.3', name: 'Richtung, gerichtete Bewegung, Verbindung', page: 35, parts: [{d: 'M16 30 H82'}, ARROW_HEAD(82, 30, 1, 0)]},
97
+ 'two-ways': {number: '5.2.4', name: 'Bewegung in zwei Richtungen (z. B. Sichten, Ordnen, Verteilen)', page: 35,
98
+ parts: [{d: 'M16 30 H84'}, ARROW_HEAD(84, 30, 1, 0), ARROW_HEAD(16, 30, -1, 0)]},
99
+ 'movement-end': {number: '5.2.5', name: 'Ende einer Bewegung', page: 35, parts: [{d: 'M16 30 H82 M84 20 V40'}, ARROW_HEAD(82, 30, 1, 0)]},
100
+ 'gathering': {number: '5.2.6', name: 'Sammeln, Zusammenführen', page: 35, parts: [{d: 'M14 30 H60'}, ARROW_HEAD(60, 30, 1, 0), {circle: [71, 30, 10]}]},
101
+
102
+ 'municipality': {number: '5.7.1', name: 'Gemeinde, kreisangehörige Stadt, Amt', page: 40, parts: stars(1)},
103
+ 'district': {number: '5.7.2', name: 'Kreis / Landkreis, kreisfreie Stadt', page: 40, parts: stars(2)},
104
+ 'region': {number: '5.7.3', name: 'Bezirk / Regierungspräsidium', page: 40, parts: stars(3)},
105
+ 'state': {number: '5.7.4', name: 'Bundesland / Freistaat', page: 40, parts: stars(4)},
106
+ 'nation': {number: '5.7.5', name: 'Nationalstaat', page: 40, parts: stars(5)},
107
+ 'european-union': {number: '5.7.6', name: 'Europäische Union', page: 40, parts: stars(6)},
108
+
109
+ 'rescue': {number: '5.8.1.1', name: 'Einsatztaktik: Retten', page: 41, parts: [red({d: 'M22 8 L14 12 V48 L22 52'}), blue(tacticArrow(24))]},
110
+ 'attack': {number: '5.8.1.2', name: 'Einsatztaktik: Angreifen', page: 41, parts: [blue(tacticArrow(14)), red({d: 'M76 8 L84 12 V48 L76 52'})]},
111
+ 'defend': {number: '5.8.1.3', name: 'Einsatztaktik: Verteidigen', page: 41, parts: [red(tacticArrow(12)), blue({d: 'M86 8 L76 14 V46 L86 52'})]},
112
+ 'retreat': {number: '5.8.1.4', name: 'Einsatztaktik: Rückzug', page: 41, parts: [red({d: 'M14 8 L22 12 V48 L14 52'}), blue(tacticArrow(30))]},
113
+ 'flooded': {number: '5.8.1.5', name: 'überschwemmtes Gebiet', page: 41, parts: [
114
+ {d: 'M10 30 A40 26 0 1 0 90 30 A40 26 0 1 0 10 30 Z'}, waves(16, 32, 68), waves(46, 32, 68), waves(32, 16, 36), waves(32, 64, 84),
115
+ {text: 'W', x: 50, y: 30, size: 16},
116
+ ].map(blue)},
117
+ 'water-ingress': {number: '5.8.1.6', name: 'Gefahr durch Wassereinbruch', page: 41, parts: [TRIANGLE, waves(38, 36, 64), waves(46, 36, 64)].map(blue)},
118
+ 'dangerous-goods': {number: '5.8.1.7', name: 'gefährliche Stoffe, z. B. GS, Chlor', page: 41, parts: hazard({text: 'GS', x: 50, y: 42, size: 16})},
119
+ 'radioactivity': {number: '5.8.1.8', name: 'Gefahr durch Radioaktivität', page: 41, parts: hazard(
120
+ {d: 'M50 40 L55.5 49.5 A11 11 0 0 1 44.5 49.5 Z M50 40 L55.5 30.5 A11 11 0 0 1 61 40 Z M50 40 L39 40 A11 11 0 0 1 44.5 30.5 Z', filled: true},
121
+ )},
122
+ 'electricity': {number: '5.8.1.9', name: 'Gefahr durch elektrische Energie', page: 42,
123
+ parts: hazard({d: 'M54 22 L46 38 H56 L49 52'}, ARROW_HEAD(49, 52, -0.45, 0.9))},
124
+ 'mineral-oil': {number: '5.8.1.10', name: 'Gefahr durch Mineralöl', page: 42, parts: hazard({text: 'Ö', x: 50, y: 42, size: 16})},
125
+ 'explosion': {number: '5.8.1.11', name: 'Gefahr durch Explosion', page: 42, parts: hazard({text: 'Ex', x: 50, y: 42, size: 16})},
126
+ 'explosives': {number: '5.8.1.12', name: 'Gefahr durch explosionsfähige Kampfmittel oder Explosivstoffe', page: 42,
127
+ parts: hazard({circle: [50, 41, 4], filled: true}, {circle: [50, 41, 9]}, {d: 'M50 26 V29 M40 31 L42 33 M60 31 L58 33'})},
128
+ 'presumed': {number: '5.8.1.13', name: 'Hinweis auf Vermutung oder unbestätigte Information/Gefahr', page: 42,
129
+ parts: [red({text: '?', x: 50, y: 30, size: 40})]},
130
+ 'acute': {number: '5.8.1.14', name: 'Hinweis auf akute Situation; aktuell größte Gefahr', page: 42, parts: [red({text: '!', x: 50, y: 30, size: 40})]},
131
+
132
+ 'activity-1': {number: '5.8.2.1', name: 'geringfügig erhöhte Aktivität; bis 25 % Ausfall; Einsatzwert bei 75 %', page: 43, parts: activity(1)},
133
+ 'activity-2': {number: '5.8.2.2', name: 'moderat erhöhte Aktivität; bis 50 % Ausfall; Einsatzwert bei 50 %', page: 43, parts: activity(2)},
134
+ 'activity-3': {number: '5.8.2.3', name: 'deutlich erhöhte Aktivität; bis 75 % Ausfall; Einsatzwert bei 25 %', page: 43, parts: activity(3)},
135
+ 'activity-4': {number: '5.8.2.4', name: 'stark erhöhte Aktivität; Totalausfall', page: 43, parts: activity(4)},
136
+ 'rising': {number: '5.8.3.1', name: 'Tendenz steigend / zunehmend / ausdehnend', page: 43, parts: tendency([36, 44], [64, 16])},
137
+ 'steady': {number: '5.8.3.2', name: 'Tendenz unverändert / gleichbleibend', page: 43, parts: tendency([36, 30], [64, 30])},
138
+ 'falling': {number: '5.8.3.3', name: 'Tendenz fallend / abnehmend / verkleinernd', page: 43, parts: tendency([36, 16], [64, 44])},
139
+ 'damaged': {number: '5.8.4.1', name: 'angeschlagen, beschädigt', page: 44, parts: destruction(1)},
140
+ 'partly-destroyed': {number: '5.8.4.2', name: 'teilzerstört, teilweise zusammengebrochen', page: 44, parts: destruction(2)},
141
+ 'destroyed': {number: '5.8.4.3', name: 'total zerstört, zusammengebrochen', page: 44, parts: destruction(3)},
142
+ 'incipient-fire': {number: '5.8.5.1', name: 'Entstehungsbrand', page: 44, parts: fire(1)},
143
+ 'developed-fire': {number: '5.8.5.2', name: 'fortentwickelter Brand', page: 44, parts: fire(2)},
144
+ 'full-fire': {number: '5.8.5.3', name: 'Vollbrand', page: 44, parts: fire(3)},
145
+
146
+ 'injured-animal': {number: '5.8.6.1', name: 'verletztes / erkranktes Tier', page: 45, parts: [VET, {d: 'M56 14 V40'}]},
147
+ 'contaminated-animal': {number: '5.8.6.2', name: 'kontaminiertes Tier', page: 45,
148
+ parts: [VET, {d: 'M56 14 V40'}, {circle: [72, 4, 2.5], filled: true}, {circle: [84, 4, 2.5], filled: true}, {d: 'M72 4 L84 14 M84 4 L72 14'}]},
149
+ 'dead-animal': {number: '5.8.6.3', name: 'totes Tier', page: 45, parts: [VET, {d: 'M56 2 V30 M50 10 H62'}]},
150
+
151
+ 'sunny': {number: '5.8.7.1', name: 'sonnig', page: 45, parts: [{circle: [50, 30, 10]},
152
+ {d: 'M50 8 V14 M50 46 V52 M28 30 H34 M66 30 H72 M35 15 L39 19 M65 15 L61 19 M35 45 L39 41 M65 45 L61 41'}]},
153
+ 'cloudy': {number: '5.8.7.2', name: 'wolkig', page: 45,
154
+ parts: [{d: 'M28 46 H72 Q84 46 82 34 Q80 24 70 26 Q66 12 52 14 Q40 14 38 26 Q24 24 22 36 Q22 46 28 46 Z'}]},
155
+ 'cloud-cover': {number: '5.8.7.3', name: 'Bedeckungsgrad des Himmels in 1/8-Abstufungen, hier: 4/8 bewölkt', page: 45,
156
+ parts: [{circle: [50, 30, 16]}, {d: 'M50 14 A16 16 0 0 1 50 46 Z', filled: true}]},
157
+ 'foggy': {number: '5.8.7.4', name: 'nebelig (ggf. in Kombination mit 5.8.7.2)', page: 45, parts: [{d: 'M26 22 H74 M26 30 H74 M26 38 H74'}]},
158
+ 'rainy': {number: '5.8.7.5', name: 'regnerisch (in Kombination mit 5.8.7.2)', page: 45,
159
+ parts: [{d: [[38, 14], [54, 14], [70, 14], [34, 30], [50, 30], [66, 30], [30, 46], [46, 46], [62, 46]]
160
+ .map(([x, y]) => `M${x! + 3} ${y! - 6} L${x! - 3} ${y! + 6}`).join(' ')}]},
161
+ 'hail': {number: '5.8.7.6', name: 'hagelnd (in Kombination mit 5.8.7.2)', page: 46,
162
+ parts: [three(x => `M${x + 2} 8 L${x} 20 M${x} 40 L${x - 2} 52`), ...[32, 50, 68].map(x => ({circle: [x, 30, 4]} as BoxPart))]},
163
+ 'thunderstorm': {number: '5.8.7.7', name: 'gewittrig (in Kombination mit 5.8.7.2)', page: 46,
164
+ parts: [three(x => `M${x + 4} 10 L${x - 4} 30 H${x + 4} L${x - 3} 48`), ...[32, 50, 68].map(x => ARROW_HEAD(x - 3, 48, -0.35, 0.94))]},
165
+ 'snowy': {number: '5.8.7.8', name: 'schneiend (in Kombination mit 5.8.7.2)', page: 46, parts: [three(x => asterisk(x, 30, 8))]},
166
+ 'temperature': {number: '5.8.7.9', name: 'Temperatur (frostig/kalt/heiß/extrem)', page: 46,
167
+ parts: [{d: 'M44 38 V12 A6 6 0 0 1 56 12 V38 A9 9 0 1 1 44 38 Z'}, {d: 'M64 14 H74 M64 22 H74 M64 30 H74'}]},
168
+ 'windy': {number: '5.8.7.10', name: 'windig (ggf. ergänzt um die Stärke in der Anzahl der Striche oder in Beaufort oder km/h)', page: 46,
169
+ parts: [{d: 'M18 40 H82 M22 40 L16 30 M30 40 L24 30 M38 40 L32 30'}, ARROW_HEAD(82, 40, 1, 0)]},
170
+
171
+ 'unharmed': {number: '5.8.8.1', name: 'unverletzt, exponiert', page: 47, parts: [PERSON]},
172
+ 'affected': {number: '5.8.8.2', name: 'betroffen', page: 47, parts: [PERSON, {text: 'B', x: 72, y: 10, size: 12}]},
173
+ 'injured': {number: '5.8.8.3', name: 'verletzt', page: 47, parts: [PERSON, {d: 'M50 8 V52'}]},
174
+ 'triage': {number: '5.8.8.4', name: 'verletzt, mit Angabe der Sichtungskategorie (SK I–IV)', page: 47,
175
+ parts: [PERSON, {d: 'M50 8 V52'}, {text: 'II', x: 34, y: 52, size: 12}]},
176
+ 'transport-priority': {number: '5.8.8.5', name: 'verletzt, mit Transportpriorität', page: 47,
177
+ parts: [PERSON, {d: 'M50 8 V52'}, {text: 'TP', x: 72, y: 10, size: 12}]},
178
+ 'contaminated': {number: '5.8.8.6', name: 'kontaminiert', page: 47,
179
+ parts: [PERSON, {d: 'M50 8 V52'}, {circle: [64, 4, 2.5], filled: true}, {circle: [76, 4, 2.5], filled: true}, {d: 'M64 4 L76 14 M76 4 L64 14'}]},
180
+ 'dead': {number: '5.8.8.7', name: 'tot', page: 47, parts: [PERSON, {d: 'M50 8 V52 M39 19 H61'}]},
181
+ 'missing': {number: '5.8.8.8', name: 'vermisst', page: 47, parts: [PERSON, {d: 'M24 26 L46 4 M76 34 L54 56'}]},
182
+ 'in-water': {number: '5.8.8.9', name: 'in Wassergefahr', page: 47, parts: [DIAMOND(50, 34, 20), waves(8, 30, 70), waves(14, 30, 70)]},
183
+ 'trapped': {number: '5.8.8.10', name: 'in Zwangslage (verschüttet / eingeklemmt / eingeschlossen)', page: 47,
184
+ parts: [DIAMOND(50, 34, 20), {d: 'M24 8 H76'}]},
185
+ 'rescued': {number: '5.8.8.11', name: 'gerettet / befreit', page: 48, parts: [RAISED, {d: 'M24 54 H76'}]},
186
+ 'awaiting-transport': {number: '5.8.8.12', name: 'zu transportieren, Transport noch ausstehend', page: 48,
187
+ parts: [RAISED, {d: 'M28 54 H76 M28 48 V60'}, ARROW_HEAD(76, 54, 1, 0)]},
188
+ 'in-transport': {number: '5.8.8.13', name: 'Transport einer Person, aktuell', page: 48, parts: [RAISED, {d: 'M28 54 H76'}, ARROW_HEAD(76, 54, 1, 0)]},
189
+ 'transported': {number: '5.8.8.14', name: 'transportiert, Ziel der Bewegung erreicht', page: 48,
190
+ parts: [RAISED, {d: 'M28 54 H76 M78 48 V60'}, ARROW_HEAD(76, 54, 1, 0)]},
191
+ 'special-care': {number: '5.8.8.15', name: 'besonders betreuungsbedürftig / unbegleitet / aufsichtspflichtig', page: 48,
192
+ parts: [PERSON, {d: 'M50 8 L38 56 M50 8 L62 56'}]},
193
+ 'nursing-care': {number: '5.8.8.16', name: 'pflegebedürftig', page: 48, parts: [PERSON, {d: 'M38 18 V42'}]},
194
+ 'reduced-mobility': {number: '5.8.8.17', name: 'mobilitätseingeschränkt', page: 48, parts: [RAISED, {circle: [40, 54, 3]}, {circle: [60, 54, 3]}]},
195
+
196
+ 'road-closed': {number: '5.8.9.1', name: 'gesperrt (i. S. v. für Einsatzkräfte befahrbar)', page: 49, parts: [{d: 'M50 6 V54 M38 20 L62 40 M62 20 L38 40'}]},
197
+ 'one-way': {number: '5.8.9.2', name: 'Einbahnstraßenregelung', page: 49, parts: [{d: 'M44 6 V54 M56 12 V54 M56 12 L64 26'}]},
198
+ 'road-difficult': {number: '5.8.9.3', name: 'schwierig befahrbar / teilblockiert', page: 49, parts: [{d: 'M45 6 V54 M55 6 V54'}]},
199
+ 'road-blocked': {number: '5.8.9.4', name: 'nicht befahrbar / blockiert', page: 49, parts: [{d: 'M38 6 V54 M46 6 V54 M54 6 V54 M62 6 V54'}]},
200
+ } as const satisfies Record<string, AdditionalSign>
201
+
202
+ /** The short English name of an additional sign. */
203
+ export type AdditionalSignName = keyof typeof ADDITIONAL_SIGNS
204
+
205
+ /** An additional sign as an SVG tree on the common canvas, its box in the middle at its own size. */
206
+ export function additionalSignTree(name: AdditionalSignName): SvgElement {
207
+ const sign: AdditionalSign = ADDITIONAL_SIGNS[name]
208
+ return canvas([group(sign.parts.map(part => boxPart(part, BLACK)), {transform: 'translate(10 10)'})])
209
+ }
210
+
211
+ /** An additional sign as SVG markup. */
212
+ export function additionalSign(name: AdditionalSignName): string {
213
+ return renderSvg(additionalSignTree(name))
214
+ }
@@ -1,3 +1,5 @@
1
+ import {ABILITIES, type AbilityName} from './abilities'
2
+ import {ADDITIONAL_SIGNS, additionalSignTree, type AdditionalSignName} from './additional'
1
3
  import {tacticalSignTree, type TacticalSignSpec} from './signs'
2
4
  import type {SvgElement} from './svg'
3
5
  import {markSymbolTree, type MarkKind} from './tactical'
@@ -18,7 +20,7 @@ export interface CatalogEntry {
18
20
  name: string
19
21
  page?: number
20
22
  recommended: boolean
21
- drawing: {sign: TacticalSignSpec} | {mark: MarkKind}
23
+ drawing: {sign: TacticalSignSpec} | {additional: AdditionalSignName} | {mark: MarkKind}
22
24
  }
23
25
 
24
26
  /** The source the catalogue follows, to be named wherever its signs are shown. */
@@ -29,21 +31,37 @@ function entry(number: string, name: string, page: number, sign: TacticalSignSpe
29
31
  return {id, number, name, page, recommended: true, drawing: {sign}}
30
32
  }
31
33
 
34
+ /** The additional signs of chapter 5 whose number starts with `section`, as catalogue entries. */
35
+ function additionalEntries(section: string): CatalogEntry[] {
36
+ return Object.entries(ADDITIONAL_SIGNS)
37
+ .filter(([, sign]) => sign.number.startsWith(`${section}.`))
38
+ .map(([name, sign]) => ({id: sign.number, number: sign.number, name: sign.name, page: sign.page, recommended: true,
39
+ drawing: {additional: name as AdditionalSignName}}))
40
+ }
41
+
32
42
  function ownMark(number: string, name: string, mark: MarkKind): CatalogEntry {
33
43
  return {id: number, number, name, recommended: false, drawing: {mark}}
34
44
  }
35
45
 
36
46
  /** The drawing of a catalogue entry as a tree of SVG elements. */
37
47
  export function catalogSignTree(entry: CatalogEntry): SvgElement {
38
- return 'sign' in entry.drawing ? tacticalSignTree(entry.drawing.sign) : markSymbolTree(entry.drawing.mark)
48
+ if ('sign' in entry.drawing) return tacticalSignTree(entry.drawing.sign)
49
+ if ('additional' in entry.drawing) return additionalSignTree(entry.drawing.additional)
50
+ return markSymbolTree(entry.drawing.mark)
39
51
  }
40
52
 
41
53
  const FIRE = {organisation: 'fire'} as const
54
+ const COMMAND = {organisation: 'command', supplements: ['command']} as const
55
+ const LEADER = {form: 'person', supplements: ['command']} as const
42
56
 
43
57
  /**
44
- * The signs of chapters 1, 2, 3 and 5.1, 5.4 and 5.5 of the recommendations, in their order, then
45
- * the library's own water supply marks. Chapter 1 is drawn black on white as printed; colours are
46
- * shown on a tactical formation, supplements, vehicles and sizes in fire service red.
58
+ * The signs of chapters 1 to 6 and annexes C and D of the recommendations, in their order, then the
59
+ * library's own water supply marks. Where a chapter explains a way of writing rather than a sign
60
+ * (5.3, 5.6, 5.8.1.13 before a sign, 6.1, 6.2), its example stands for it. Chapter 1 is drawn black
61
+ * on white as printed, chapter 4 on a plain formation; colours are shown on a tactical formation,
62
+ * supplements, vehicles and sizes in fire service red. Letters that annex C writes inside a symbol
63
+ * ("P", "G", "ATF") stand in field A here, and the flying line of C.1.13 sits under the form as in
64
+ * 5.1.4.
47
65
  */
48
66
  export const TACTICAL_SIGN_CATALOG: readonly CatalogEntry[] = [
49
67
  entry('1.1', 'Taktische Formation', 14, {form: 'formation'}),
@@ -75,6 +93,7 @@ export const TACTICAL_SIGN_CATALOG: readonly CatalogEntry[] = [
75
93
  entry('3.5', 'Zweirad, Fahrrad', 20, {form: 'formation', ...FIRE, supplements: ['bicycle']}),
76
94
  entry('3.6', 'Zweirad, Kraftrad', 21, {form: 'formation', ...FIRE, supplements: ['motorcycle']}),
77
95
  entry('3.7', 'Temporär ortsfeste Struktur (mit festem Dach)', 21, {form: 'place', ...FIRE, supplements: ['roof']}),
96
+ ...Object.entries(ABILITIES).map(([name, ability]) => entry(ability.number, ability.name, ability.page, {form: 'formation', abilities: [name as AbilityName]})),
78
97
  entry('5.1.1', 'Fahrzeug, ungeschützt', 32, {form: 'land-vehicle', ...FIRE}, '5.1.1-unprotected'),
79
98
  entry('5.1.2', 'Fahrzeug, geschützt', 32, {form: 'land-vehicle', ...FIRE, protected: true}, '5.1.2-protected'),
80
99
  entry('5.1.1.1', 'Kraftfahrzeug, straßenfähig (Kategorie 1)', 32, {form: 'land-vehicle', ...FIRE, drive: 'road'}),
@@ -98,6 +117,9 @@ export const TACTICAL_SIGN_CATALOG: readonly CatalogEntry[] = [
98
117
  entry('5.1.4.1', 'Einsatz von Luftfahrzeugen/Fliegen allgemein', 34, {form: 'aircraft', ...FIRE, flight: 'flying'}),
99
118
  entry('5.1.4.2', 'Drehflügler/Hubschrauber', 34, {form: 'aircraft', ...FIRE, flight: 'rotary-wing'}),
100
119
  entry('5.1.4.3', 'Flächenflügler/Flugzeug', 34, {form: 'aircraft', ...FIRE, flight: 'fixed-wing'}),
120
+ ...additionalEntries('5.2'),
121
+ entry('5.3', 'Stärkeangabe, z. B. 1/1/6/40/48 (Gesamtstärke unterstrichen)', 35,
122
+ {form: 'formation', ...FIRE, size: 'association-1', strength: '1/1/6/40/48'}),
101
123
  entry('5.4.1', 'Trupp/selbstständiger Trupp', 37, {form: 'formation', ...FIRE, size: 'squad'}),
102
124
  entry('5.4.2', 'Staffel', 37, {form: 'formation', ...FIRE, size: 'section'}),
103
125
  entry('5.4.3', 'Gruppe', 37, {form: 'formation', ...FIRE, size: 'group'}),
@@ -105,6 +127,106 @@ export const TACTICAL_SIGN_CATALOG: readonly CatalogEntry[] = [
105
127
  entry('5.5.1', 'Bereitschaft (Verband I)', 37, {form: 'formation', ...FIRE, size: 'association-1'}),
106
128
  entry('5.5.2', 'Abteilung (Verband II)', 37, {form: 'formation', ...FIRE, size: 'association-2'}),
107
129
  entry('5.5.3', 'Großverband (Verband III)', 37, {form: 'formation', ...FIRE, size: 'association-3'}),
130
+ entry('5.6', 'Taktische Zeitangabe, z. B. 040835jun23 = 4. Juni 2023, 08:35 Uhr', 38,
131
+ {form: 'formation', ...FIRE, size: 'group', time: '040835jun23'}),
132
+ ...additionalEntries('5.7'),
133
+ ...additionalEntries('5.8'),
134
+ entry('5.8.1.13', 'Hinweis auf Vermutung, dem Taktischen Zeichen vorangestellt', 42, {form: 'person', certainty: 'presumed'}, '5.8.1.13-before-sign'),
135
+ entry('6.1', 'Ergänzende Angaben in den Feldern A und B, z. B. Strömungsretter der DLRG', 50,
136
+ {form: 'formation', organisation: 'aid', designation: 'Strömungsretter', abilities: ['water-rescue'], fieldB: 'DLRG'}),
137
+ entry('6.2', 'Identifizierung Taktischer Formationen, z. B. 2-1-3', 52, {form: 'formation', ...FIRE, size: 'group', identification: '2-1-3'}),
138
+ entry('C.1.1', 'Löschstaffel (Staffellöschfahrzeug)', 71, {form: 'formation', ...FIRE, size: 'section', abilities: ['firefighting']}),
139
+ entry('C.1.2', 'Löschgruppe (Löschgruppenfahrzeug)', 71, {form: 'formation', ...FIRE, size: 'group', abilities: ['firefighting']}),
140
+ entry('C.1.3', 'Löschzug einer Feuerwehr', 71, {form: 'formation', ...FIRE, size: 'platoon', abilities: ['firefighting']}),
141
+ entry('C.1.4', 'Rüstzug einer Feuerwehr', 71, {form: 'formation', ...FIRE, size: 'platoon', abilities: ['technical-rescue']}),
142
+ entry('C.1.5', 'Fachzug', 71, {form: 'formation', ...FIRE, size: 'platoon', designation: 'FZ-'}),
143
+ entry('C.1.6', 'Fachdienst Brandschutz', 71, {form: 'formation', ...FIRE, size: 'association-1', abilities: ['firefighting'], designation: 'FD'}),
144
+ entry('C.1.7', 'CBRN-Erkundungstrupp (CBRN-ErkKW)', 71, {form: 'formation', ...FIRE, size: 'squad', abilities: ['cbrn-measuring']}),
145
+ entry('C.1.8', 'Staffel Dekontamination von Personal (GW-Dekon P)', 71, {form: 'formation', ...FIRE, size: 'section', abilities: ['decontamination'], designation: 'P'}),
146
+ entry('C.1.9', 'ABC-Erkundungsgruppe einer Feuerwehr', 71, {form: 'formation', ...FIRE, size: 'group', abilities: ['cbrn-measuring']}),
147
+ entry('C.1.10', 'Dekontaminationsgruppe Gerät einer Feuerwehr', 71, {form: 'formation', ...FIRE, size: 'group', abilities: ['decontamination'], designation: 'G'}),
148
+ entry('C.1.11', 'Gefahrstoffzug/ABC-Zug/CBRN-Zug einer Feuerwehr', 72, {form: 'formation', ...FIRE, size: 'platoon', abilities: ['cbrn']}),
149
+ entry('C.1.12', 'Analytische Task Force (ATF)', 72, {form: 'formation', ...FIRE, size: 'platoon', abilities: ['cbrn-measuring'], designation: 'ATF'}),
150
+ entry('C.1.13', 'Flugdrohnentrupp einer Feuerwehr', 72, {form: 'formation', ...FIRE, size: 'squad', supplements: ['uncrewed'], flight: 'flying'}),
151
+ entry('C.1.14', 'Drohnentrupp einer Feuerwehr (allgemein)', 72, {form: 'formation', ...FIRE, size: 'squad', supplements: ['uncrewed']}),
152
+ entry('C.1.15', 'Tauchergruppe einer Feuerwehr', 72, {form: 'formation', ...FIRE, size: 'group', abilities: ['water-rescue']}),
153
+ entry('C.2.1', 'Kommandowagen', 72, {form: 'land-vehicle', ...FIRE, drive: 'road', supplements: ['command'], designation: 'KdoW'}),
154
+ entry('C.2.2', 'Einsatzleitwagen 1', 72, {form: 'land-vehicle', ...FIRE, drive: 'road', supplements: ['command'], designation: 'ELW 1'}),
155
+ entry('C.2.3', 'Einsatzleitwagen 2', 72, {form: 'land-vehicle', ...FIRE, drive: 'road', supplements: ['command'], designation: 'ELW 2'}),
156
+ entry('C.2.4', 'Tragkraftspritzenfahrzeug', 72, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['firefighting'], designation: 'TSF'}),
157
+ entry('C.2.5', 'Tragkraftspritzenfahrzeug mit Wasser', 72, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['firefighting'], designation: 'TSF-W'}),
158
+ entry('C.2.6', 'Kleinlöschfahrzeug', 73, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['firefighting'], designation: 'KLF'}),
159
+ entry('C.2.7', 'Mittleres Löschfahrzeug', 73, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['firefighting'], designation: 'MLF'}),
160
+ entry('C.2.8', '(Hilfeleistungs-)Löschfahrzeug 10', 73, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['firefighting'], designation: '(H)LF 10'}),
161
+ entry('C.2.9', '(Hilfeleistungs-)Löschfahrzeug 20', 73, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['firefighting'], designation: '(H)LF 20'}),
162
+ entry('C.2.10', 'Löschgruppenfahrzeug 20 Katastrophenschutz', 73, {form: 'land-vehicle', ...FIRE, drive: 'offroad', abilities: ['firefighting'], designation: 'LF 20 KatS'}),
163
+ entry('C.2.11', 'Tanklöschfahrzeug 2.000', 73, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['firefighting'], designation: 'TLF 2.000'}),
164
+ entry('C.2.12', 'Tanklöschfahrzeug 3.000', 73, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['firefighting'], designation: 'TLF 3.000'}),
165
+ entry('C.2.13', 'Tanklöschfahrzeug 4.000', 73, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['firefighting'], designation: 'TLF 4.000'}),
166
+ entry('C.2.14', 'Automatikdrehleiter mit Rettungskorb 12/9', 73, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['turntable-ladder'], designation: 'DLAK 12/9'}),
167
+ entry('C.2.15', 'Automatikdrehleiter mit Rettungskorb 18/12', 73, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['turntable-ladder'], designation: 'DLAK 18/12'}),
168
+ entry('C.2.16', 'Automatikdrehleiter mit Rettungskorb 23/12', 74, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['turntable-ladder'], designation: 'DLAK 23/12'}),
169
+ entry('C.2.17', 'Hubarbeitsbühne (HAB) oder Teleskopgelenkmast (TGM)', 74, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['aerial-platform'], designation: 'HAB'}),
170
+ entry('C.2.18', 'Rüstwagen', 74, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['technical-rescue']}),
171
+ entry('C.2.19', 'Wechselladerfahrzeug', 74, {form: 'land-vehicle', ...FIRE, drive: 'road', body: 'swap-loader'}),
172
+ entry('C.2.20', 'Gerätewagen Gefahrgut', 74, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['cbrn'], designation: 'GW-G'}),
173
+ entry('C.2.21', 'Gerätewagen Logistik 1', 74, {form: 'land-vehicle', ...FIRE, drive: 'road', supplements: ['logistics'], designation: 'GW-L1'}),
174
+ entry('C.2.22', 'Gerätewagen Logistik 2', 74, {form: 'land-vehicle', ...FIRE, drive: 'road', supplements: ['logistics'], designation: 'GW-L2'}),
175
+ entry('C.2.23', 'Mannschaftstransportfahrzeug, 9-sitzig', 75, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['transporting'], designation: 'MTF'}),
176
+ entry('C.2.24', 'CBRN-Erkundungswagen', 75, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['cbrn-measuring'], designation: 'CBRN ErkW'}),
177
+ entry('C.2.25', 'Gerätewagen Dekontamination Personal', 75, {form: 'land-vehicle', ...FIRE, drive: 'offroad', abilities: ['decontamination'], designation: 'GW Dekon P'}),
178
+ entry('C.2.26', 'Schlauchwagen Katastrophenschutz', 75, {form: 'land-vehicle', ...FIRE, drive: 'offroad', abilities: ['water-conveying'], designation: 'SW KatS'}),
179
+ entry('C.2.27', 'Feuerwehrkran 30', 75, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['crane'], designation: 'FwK 30'}),
180
+ entry('C.2.28', 'Teleskoplader', 75, {form: 'land-vehicle', ...FIRE, drive: 'offroad', abilities: ['telehandler'], designation: 'Telelader'}),
181
+ entry('C.2.29', 'Tragkraftspritzenanhänger', 76, {form: 'land-vehicle', ...FIRE, body: 'trailer', drive: 'towed-by-car', abilities: ['firefighting']}),
182
+ entry('C.2.30', 'Feuerwehr Netzersatzanlage 120 kVA', 76, {form: 'land-vehicle', ...FIRE, body: 'trailer', drive: 'towed-by-car', supplements: ['logistics'], abilities: ['power'], designation: '120'}),
183
+ entry('C.2.31', 'Geschützte Löschdrohne/Löschroboter auf Kettenfahrgestell', 76, {form: 'land-vehicle', ...FIRE, protected: true, drive: 'tracked', supplements: ['uncrewed'], abilities: ['firefighting']}),
184
+ entry('D.1.1', 'Befehlsstelle, Führungsstelle (aktiv im Einsatz), mit Linie zum Standort', 76,
185
+ {form: 'formation', ...COMMAND, designation: 'Bezeichnung', located: true}),
186
+ entry('D.1.2', 'Katastrophenschutzleitung im Einsatz', 76, {form: 'formation', ...COMMAND, text: 'KatSL'}),
187
+ entry('D.1.3', 'Technische Einsatzleitung „Evakuierung“ im Einsatz', 76, {form: 'formation', ...COMMAND, text: 'TEL', subtitle: 'Evakuierung'}),
188
+ entry('D.1.4', 'Einsatzleitung im Einsatz', 76, {form: 'formation', ...COMMAND, text: 'EL'}),
189
+ entry('D.1.5', 'Einsatzabschnittsleitung „Nord“ im Einsatz', 77, {form: 'formation', ...COMMAND, text: 'EAL', subtitle: 'Nord'}),
190
+ entry('D.1.6', 'Untereinsatzabschnittsleitung im Einsatz', 77, {form: 'formation', ...COMMAND, text: 'UEAL'}),
191
+ entry('D.1.7', 'Führungsgruppe TEL i. S. einer Stabsstelle', 77, {form: 'formation', ...COMMAND, size: 'group', text: 'TEL'}),
192
+ entry('D.1.8', 'Führungsgruppe einer Feuerwehrbereitschaft', 77, {form: 'formation', ...FIRE, supplements: ['command'], size: 'group', text: 'Ber'}),
193
+ entry('D.1.9', 'Zugtrupp einer Sanitätseinheit', 77, {form: 'formation', organisation: 'aid', supplements: ['command'], size: 'squad', abilities: ['medical']}),
194
+ entry('D.2.1', 'Bereitstellungsraum', 77, {form: 'place', organisation: 'command', figure: 'staging-area'}),
195
+ entry('D.2.2', 'Bereitstellungsraum mit Meldekopf', 77, {form: 'place', organisation: 'command', figure: 'staging-area-with-report'}),
196
+ entry('D.2.3', 'Meldekopf', 77, {form: 'place', organisation: 'command', text: 'M'}),
197
+ entry('D.2.4', 'Lotsenstelle/Abholpunkt', 77, {form: 'place', organisation: 'command', text: 'L'}),
198
+ entry('D.2.5', 'Leitstelle', 78, {form: 'place', organisation: 'command', supplements: ['roof', 'command'], text: 'LtS'}),
199
+ entry('D.2.6', 'Hubschrauberlandezone/Übergabepunkt Luft-Boden', 78, {form: 'place', organisation: 'command', figure: 'landing-zone'}),
200
+ entry('D.2.7', 'Hubschrauberlandeplatz, gesicherte Infrastruktur/für Notfälle vorbereitet (auch temporär)', 78,
201
+ {form: 'place', organisation: 'command', supplements: ['roof'], figure: 'landing-zone'}),
202
+ entry('D.3.1', 'Leiter der Technischen Einsatzleitung des Landkreises Ahrweiler', 78,
203
+ {...LEADER, organisation: 'command', level: 2, text: 'TEL', fieldB: 'AW'}),
204
+ entry('D.3.2', 'Einsatzleiter', 78, {...LEADER, organisation: 'command', text: 'EL'}),
205
+ entry('D.3.3', 'Leitender Notarzt', 78, {...LEADER, organisation: 'command', level: 2, text: 'LNA'}),
206
+ entry('D.3.4', 'Organisatorischer Leiter', 78, {...LEADER, organisation: 'command', level: 2, text: 'OrgL'}),
207
+ entry('D.3.5', 'Einsatzabschnittsleiter', 78, {...LEADER, organisation: 'command', text: 'EAL'}),
208
+ entry('D.3.6', 'Untereinsatzabschnittsleiter', 78, {...LEADER, organisation: 'command', text: 'UEAL'}),
209
+ entry('D.3.7', 'Zugführer eines Löschzuges der Feuerwehr', 78, {...LEADER, ...FIRE, size: 'platoon', abilities: ['firefighting']}),
210
+ entry('D.3.8', 'Zugführer eines Technischen Zuges des THW', 79, {...LEADER, organisation: 'thw', size: 'platoon', text: 'TZ'}),
211
+ entry('D.3.9', 'Zugführer eines Sanitätszuges des Arbeiter-Samariter-Bundes', 79,
212
+ {...LEADER, organisation: 'aid', size: 'platoon', abilities: ['medical'], fieldB: 'ASB'}),
213
+ entry('D.3.10', 'Zugführer einer Einsatzeinheit des Deutschen Roten Kreuzes', 79,
214
+ {...LEADER, organisation: 'aid', size: 'platoon', abilities: ['care', 'medical'], fieldB: 'DRK'}),
215
+ entry('D.3.11', 'Zugführer eines Betreuungszuges des Arbeiter-Samariter-Bundes', 79,
216
+ {...LEADER, organisation: 'aid', size: 'platoon', abilities: ['care'], fieldB: 'ASB'}),
217
+ entry('D.3.12', 'Gruppenführer einer Betreuungsgruppe des Malteser Hilfsdienstes', 79,
218
+ {...LEADER, organisation: 'aid', size: 'group', abilities: ['care'], fieldB: 'MHD'}),
219
+ entry('D.3.13', 'Gruppenführer einer Schnell-Einsatz-Gruppe der Johanniter-Unfall-Hilfe', 79,
220
+ {...LEADER, organisation: 'aid', size: 'group', text: 'SEG', fieldB: 'JUH'}),
221
+ entry('D.3.14', 'Fachberater des THW, in Hauptfunktion stellvertretender Ortsbeauftragter', 79,
222
+ {form: 'person', organisation: 'thw', supplements: ['special-function'], text: 'THW', fieldB: 'stv OB'}),
223
+ entry('D.3.15', 'Rotkreuzbeauftragter', 79, {form: 'person', organisation: 'aid', supplements: ['special-function'], text: 'RKB', fieldB: 'DRK'}),
224
+ entry('D.4.1', 'Leiter der Kreisleitstelle des Kreises Steinfurt', 80, {...LEADER, organisation: 'command', level: 2, text: 'LtS', fieldB: 'ST'}),
225
+ entry('D.4.2', 'Kreisbrandmeister des Kreises Mettmann', 80, {...LEADER, ...FIRE, level: 2, text: 'KBM', fieldB: 'ME'}),
226
+ entry('D.4.3', 'Leiter der Gefahrenabwehr in der kreisfreien Stadt Mönchengladbach', 80,
227
+ {...LEADER, organisation: 'command', level: 2, text: 'LtrGA', fieldB: 'MG'}),
228
+ entry('D.4.4', 'Leiter der Gefahrenabwehrkräfte der Bundespolizei', 80, {...LEADER, organisation: 'police', level: 5, fieldB: 'BuPol'}),
229
+ entry('D.4.5', 'Leiter (Koordinator) einer internationalen Hilfsaktion', 80, {...LEADER, organisation: 'command', level: 6}),
108
230
  ownMark('W.1', 'Unterflurhydrant', 'hydrant-underground'),
109
231
  ownMark('W.2', 'Überflurhydrant', 'hydrant-pillar'),
110
232
  ownMark('W.3', 'Offenes Gewässer', 'open-water'),
@@ -11,12 +11,15 @@
11
11
  * light background, as on paper: size marks, frames and wheels are black, so a page in dark mode
12
12
  * shows them on a light backdrop.
13
13
  *
14
- * Every sign is drawn on the 120 × 80 canvas of the library. Size marks, roofs and supplements are
15
- * placed relative to the form they belong to, so they fit every basic form; under a roof the size
16
- * marks sit inside the roof, since the canvas has no room above it.
14
+ * Every sign is drawn on the 120 × 80 canvas of the library, which widens only for writing around
15
+ * the sign (a time, a presumption, an identification, a strength, stars above a size mark, the line
16
+ * to a location); the sign itself keeps its place. Size marks, roofs and supplements are placed
17
+ * relative to the form they belong to, so they fit every basic form; under a roof the size marks sit
18
+ * inside the roof, since the canvas has no room above it.
17
19
  */
18
20
 
19
- import {canvas, element, group, label, renderSvg, type SvgElement} from './svg'
21
+ import {ABILITIES, type Ability, type AbilityName} from './abilities'
22
+ import {BLACK, BOX_STROKE, HAZARD_RED, MEASURE_BLUE, SIGN_FONT, SYMBOL_HEIGHT, SYMBOL_WIDTH, WHITE, asterisk, boxPart, canvas, element, group, label, renderSvg, round, starOffsets, type BoxPart, type SvgElement} from './svg'
20
23
 
21
24
  /** The basic forms of chapter 1, in its order. */
22
25
  export const BASIC_FORMS = [
@@ -81,6 +84,30 @@ export interface TacticalSignSpec {
81
84
  drive?: Drive
82
85
  body?: VehicleBody
83
86
  flight?: Flight
87
+ /** Abilities of chapter 4 drawn inside the form, the main one first; they stack from the bottom up (6.1). */
88
+ abilities?: readonly AbilityName[]
89
+ /** A short designation in the upper left corner (field A), such as "ELW 1", as annex C shows it. */
90
+ designation?: string
91
+ /** A second line under the writing, such as the name of a section ("Nord") or a task ("Evakuierung"). */
92
+ subtitle?: string
93
+ /** Writing in the lower right corner inside the form (field B), such as an origin ("DLRG", "AW"). */
94
+ fieldB?: string
95
+ /** Writing in the free fields X of 6.1, in the upper right and lower left corners, such as "TP" or "K". */
96
+ fieldX?: {upperRight?: string, lowerLeft?: string}
97
+ /** The administrative level of 5.7, from 1 (municipality) to 6 (European Union), as stars above the form. */
98
+ level?: 1 | 2 | 3 | 4 | 5 | 6
99
+ /** A strength of 5.3 below the form, such as "1/1/6/40/48"; the last number, the total, is underlined. */
100
+ strength?: string
101
+ /** A time of 5.6 to the left of the form, such as "040835jun23". */
102
+ time?: string
103
+ /** An identification of 6.2 to the right of the form, such as "2-1-3". */
104
+ identification?: string
105
+ /** A presumption (5.8.1.13, "?") or an acute situation (5.8.1.14, "!") written before the form. */
106
+ certainty?: 'presumed' | 'acute'
107
+ /** A figure of annex D.2 inside the form, such as the tray of a staging area. */
108
+ figure?: SignFigure
109
+ /** Draws the dashed line to the location of a command post (D.1.1) below the form. */
110
+ located?: boolean
84
111
  /** Writing inside the form, such as a function or a vehicle name. */
85
112
  text?: string
86
113
  /** Shows the organisation's short name, which chapter 2 asks for whenever colour is missing. */
@@ -89,7 +116,7 @@ export interface TacticalSignSpec {
89
116
 
90
117
  /** The colour, its writing colour and short name of each organisation, after chapter 2 and annex O. */
91
118
  export const ORGANISATION_COLOURS: Readonly<Record<SignOrganisation, Readonly<{fill: string, text: string, abbreviation: string}>>> = {
92
- fire: {fill: '#FA321E', text: '#FFFFFF', abbreviation: 'Fw'},
119
+ fire: {fill: '#FA321E', text: '#000000', abbreviation: 'Fw'},
93
120
  aid: {fill: '#FFFFFF', text: '#000000', abbreviation: 'HiOrg'},
94
121
  thw: {fill: '#003399', text: '#FFFFFF', abbreviation: 'THW'},
95
122
  command: {fill: '#FAFA00', text: '#000000', abbreviation: ''},
@@ -99,10 +126,6 @@ export const ORGANISATION_COLOURS: Readonly<Record<SignOrganisation, Readonly<{f
99
126
  civil: {fill: '#BEBEBE', text: '#000000', abbreviation: 'ZIV'},
100
127
  }
101
128
 
102
- const BLACK = '#000000'
103
- const WHITE = '#FFFFFF'
104
- const HAZARD_RED = '#FA321E'
105
- const MEASURE_BLUE = '#3264FA'
106
129
  const STROKE = 3
107
130
 
108
131
  /** Where a form lies on the canvas and where its writing, bars and short name go. */
@@ -121,6 +144,12 @@ interface Layout {
121
144
  logisticsBar: string
122
145
  /** Where the short name sits; outside the form where the form has no room for it. */
123
146
  short: {x: number, y: number, inside: boolean}
147
+ /** The font size of writing inside the form where the form is too small for the usual size. */
148
+ textSize?: number
149
+ /** A filled cap in place of the command bar, where the form has no room for a bar (the tip of a person). */
150
+ commandCap?: string
151
+ /** The room for abilities and figures where it is narrower than the bounds, as in a diamond. */
152
+ room?: {left: number, right: number, top: number, bottom: number}
124
153
  }
125
154
 
126
155
  /** A layout with straight bars inset from the bounds and the short name in the lower right corner. */
@@ -141,7 +170,7 @@ const SHORT_BESIDE = {x: 104, y: 42, inside: false}
141
170
  const FORMS: Record<BasicForm, Layout> = {
142
171
  'formation': layout('M10 16 H110 V68 H10 Z', 10, 110, 16, 68, 86, 42),
143
172
  'person': layout('M60 16 L86 42 L60 68 L34 42 Z', 34, 86, 16, 68, 30, 42,
144
- {commandBar: 'M48 28 H72', logisticsBar: 'M48 56 H72', short: SHORT_BESIDE}),
173
+ {commandCap: 'M60 16 L71 27 H49 Z', logisticsBar: 'M48 56 H72', short: SHORT_BESIDE, textSize: 13, room: {left: 46, right: 74, top: 26, bottom: 58}}),
145
174
  'land-vehicle': layout('M10 16 Q60 24 110 16 V60 H10 Z', 10, 110, 16, 60, 86, 40, {commandBar: 'M15 23 Q60 31 105 23'}),
146
175
  'aircraft': layout('M22 62 A38 38 0 0 1 98 62 Z', 22, 98, 24, 62, 56, 48,
147
176
  {commandBar: 'M40 34 H80', short: {x: 84, y: 56, inside: true}}),
@@ -213,6 +242,56 @@ function sizeMark(size: SignSize, above: number): SvgElement[] {
213
242
  }
214
243
  }
215
244
 
245
+ /** The room inside a form that abilities may take, clear of the designation and the command and logistics bars. */
246
+ function abilityRoom(spec: TacticalSignSpec, form: Layout): {left: number, top: number, width: number, height: number} {
247
+ const supplements = spec.supplements ?? []
248
+ const bounds = form.room ?? {left: form.left + 6, right: form.right - 6, top: form.top + 4, bottom: form.bottom - 4}
249
+ const top = (form.room ? bounds.top : bounds.top + (supplements.includes('command') ? 8 : 0)) + (spec.designation || spec.fieldX?.upperRight ? 10 : 0)
250
+ const bottom = supplements.includes('logistics') ? Math.min(bounds.bottom, form.bottom - 12) : bounds.bottom
251
+ return {left: bounds.left, top, width: bounds.right - bounds.left, height: bottom - top}
252
+ }
253
+
254
+ /**
255
+ * The abilities inside a form: each gets an equal slice of the room, the first (main) one at the
256
+ * bottom, and is scaled evenly into it. A single ability that stretches spans the whole room
257
+ * instead, below a designation if there is one, as annex C draws it; its paths are stretched, its
258
+ * dots stay round.
259
+ * Stroke widths are set in each box so the lines keep the weight of the form's outline.
260
+ */
261
+ function abilityMarks(spec: TacticalSignSpec, form: Layout, colour: string): SvgElement[] {
262
+ const names = spec.abilities ?? []
263
+ const room = abilityRoom(spec, form)
264
+ const only = names.length === 1 ? (ABILITIES[names[0]!] as Ability) : undefined
265
+ if (only?.stretch) {
266
+ const sx = room.width / 100
267
+ const sy = room.height / 60
268
+ const lines = only.parts.filter(part => !('circle' in part)).map(part => boxPart(part, colour, BOX_STROKE / Math.min(sx, sy)))
269
+ const dots = only.parts.flatMap(part => 'circle' in part
270
+ ? [element('circle', {cx: round(room.left + part.circle[0] * sx), cy: round(room.top + part.circle[1] * sy),
271
+ r: round(part.circle[2] * Math.min(sx, sy)), fill: part.filled ? colour : 'none', stroke: colour, 'stroke-width': BOX_STROKE})]
272
+ : [])
273
+ return [group(lines, {transform: `translate(${round(room.left)} ${round(room.top)}) scale(${round(sx)} ${round(sy)})`}), ...dots]
274
+ }
275
+ const slot = room.height / names.length
276
+ return names.map((name, index) => {
277
+ const scale = Math.min(room.width / 100, slot / 60)
278
+ const x = room.left + (room.width - 100 * scale) / 2
279
+ const y = room.top + slot * (names.length - 1 - index) + (slot - 60 * scale) / 2
280
+ const parts = ABILITIES[name].parts.map(part => boxPart(part, colour, BOX_STROKE / scale))
281
+ return group(parts, {transform: `translate(${round(x)} ${round(y)}) scale(${round(scale)})`})
282
+ })
283
+ }
284
+
285
+ /** The designation in the upper left corner of a form (field A), below a command bar if there is one. */
286
+ function designation(spec: TacticalSignSpec, text: string, form: Layout, colour: string): SvgElement {
287
+ const below = (spec.supplements ?? []).includes('command') ? 12 : 0
288
+ return {
289
+ tag: 'text',
290
+ attributes: {x: form.left + 5, y: form.top + 8 + below, fill: colour, 'font-size': 10, ...SIGN_FONT, 'dominant-baseline': 'central'},
291
+ text,
292
+ }
293
+ }
294
+
216
295
  /** A line of the given colour and width. */
217
296
  function line(d: string, colour: string, width = STROKE): SvgElement {
218
297
  return element('path', {d, fill: 'none', stroke: colour, 'stroke-width': width, 'stroke-linecap': 'round', 'stroke-linejoin': 'round'})
@@ -224,7 +303,9 @@ const ROOF_HEIGHT = 11
224
303
  function supplement(kind: Supplement, form: Layout, colour: string): SvgElement[] {
225
304
  const y = form.textY
226
305
  switch (kind) {
227
- case 'command': return [line(form.commandBar, BLACK, 5)]
306
+ case 'command': return form.commandCap
307
+ ? [element('path', {d: form.commandCap, fill: BLACK, stroke: BLACK, 'stroke-width': 2, 'stroke-linejoin': 'round'})]
308
+ : [line(form.commandBar, BLACK, 5)]
228
309
  case 'logistics': return [line(form.logisticsBar, BLACK, 5)]
229
310
  case 'special-function': return [line(`M52 ${form.top + 8} H68`, colour)]
230
311
  case 'uncrewed': return [line(`M50 ${y - 14} L60 ${y - 6} L70 ${y - 14}`, colour, 4)]
@@ -337,10 +418,145 @@ export function tacticalSignTree(spec: TacticalSignSpec): SvgElement {
337
418
  if (spec.flight) parts.push(...flightMarks(spec.flight, form, colours.line))
338
419
  for (const kind of supplements) parts.push(...supplement(kind, form, colours.line))
339
420
  if (spec.size) parts.push(...sizeMark(spec.size, form.top))
340
- if (spec.text) parts.push(label(spec.text, 60, form.textY, colours.text, form.textWidth))
421
+ if (spec.abilities?.length) parts.push(...abilityMarks(spec, form, colours.text))
422
+ if (spec.figure) parts.push(figureMark(spec, spec.figure, form, colours.text))
423
+ if (spec.designation) parts.push(designation(spec, spec.designation, form, colours.text))
424
+ const underBar = spec.form === 'place' && (spec.supplements ?? []).includes('command') ? 4 : 0
425
+ const textY = (spec.subtitle ? form.textY - 5 : form.textY) + underBar
426
+ if (spec.text) parts.push(label(spec.text, 60, textY, colours.text, form.textWidth, form.textSize))
427
+ if (spec.subtitle) parts.push(label(spec.subtitle, 60, textY + 13, colours.text, form.textWidth, 9))
428
+ parts.push(...cornerFields(spec, form, colours.text))
341
429
  const short = spec.abbreviation && spec.organisation ? ORGANISATION_COLOURS[spec.organisation].abbreviation : ''
342
430
  if (short) parts.push(label(short, form.short.x, form.short.y, form.short.inside ? colours.text : BLACK, 24, 10))
343
- return canvas([group(parts)])
431
+ const margins = {left: 0, right: 0, top: 0, bottom: 0}
432
+ if (spec.level) {
433
+ const raised = spec.size !== undefined || (spec.supplements ?? []).includes('roof')
434
+ const y = raised ? form.top - (spec.level === 6 ? 26 : 20) : form.top - (spec.level === 6 ? 9 : 7)
435
+ parts.push(stars(spec.level, y))
436
+ const highest = y + Math.min(...starOffsets(spec.level).map(([, dy]) => dy)) - STAR_RADIUS(spec.level) - 1
437
+ margins.top = Math.max(0, Math.ceil(-highest))
438
+ }
439
+ const below = form.bottom + (spec.drive || spec.body ? 14 : 2)
440
+ if (spec.located) {
441
+ parts.push(...locationLine(form))
442
+ margins.bottom = form.bottom + 36 - SYMBOL_HEIGHT
443
+ }
444
+ if (spec.strength) {
445
+ const y = spec.located ? form.bottom + 44 : below + 8
446
+ parts.push(...strengthMark(spec.strength, y))
447
+ margins.bottom = Math.max(margins.bottom, y + 6 - SYMBOL_HEIGHT)
448
+ }
449
+ const ink = spec.style === 'mono' ? BLACK : HAZARD_RED
450
+ let left = form.left - 6
451
+ if (spec.certainty) {
452
+ parts.push(corner(spec.certainty === 'presumed' ? '?' : '!', left, form.textY, ink, 'end', 28))
453
+ left -= writingWidth('?', 28) + 4
454
+ }
455
+ if (spec.time) {
456
+ parts.push(beside(spec.time, left, form.textY, 'end'))
457
+ left -= writingWidth(spec.time, BESIDE_SIZE)
458
+ }
459
+ margins.left = Math.max(0, Math.ceil(2 - left))
460
+ if (spec.identification) {
461
+ const start = short && !form.short.inside ? form.short.x + writingWidth(short, 10) / 2 + 4 : form.right + 6
462
+ parts.push(beside(spec.identification, start, form.textY, 'start'))
463
+ margins.right = Math.max(0, Math.ceil(start + writingWidth(spec.identification, BESIDE_SIZE) + 2 - SYMBOL_WIDTH))
464
+ }
465
+ return canvas([group(parts)], margins)
466
+ }
467
+
468
+ /**
469
+ * Field B in the lower right and the fields X of 6.1 in the upper right and lower left corners:
470
+ * inside the form where it has room, otherwise just outside, beside its edges.
471
+ */
472
+ function cornerFields(spec: TacticalSignSpec, form: Layout, colour: string): SvgElement[] {
473
+ const below = (spec.supplements ?? []).includes('command') && !form.commandCap ? 12 : 0
474
+ const inside = form.short.inside
475
+ const low = form.bottom - 6 - ((spec.supplements ?? []).includes('logistics') ? 8 : 0)
476
+ const fields: SvgElement[] = []
477
+ if (spec.fieldB) {
478
+ fields.push(inside ? corner(spec.fieldB, form.right - 4, low, colour, 'end') : corner(spec.fieldB, 66, form.bottom - 2, BLACK, 'start', 8))
479
+ }
480
+ if (spec.fieldX?.upperRight) {
481
+ fields.push(inside
482
+ ? corner(spec.fieldX.upperRight, form.right - 4, form.top + 8 + below, colour, 'end')
483
+ : corner(spec.fieldX.upperRight, 66, form.top + 2, BLACK, 'start', 8))
484
+ }
485
+ if (spec.fieldX?.lowerLeft) {
486
+ fields.push(inside
487
+ ? corner(spec.fieldX.lowerLeft, form.left + 5, low, colour, 'start')
488
+ : corner(spec.fieldX.lowerLeft, 54, form.bottom - 2, BLACK, 'end', 8))
489
+ }
490
+ return fields
491
+ }
492
+
493
+ const BESIDE_SIZE = 12
494
+
495
+ /** Writing beside a sign, squeezed to its estimated width so the canvas margin always holds it, whatever font a map falls back to. */
496
+ function beside(text: string, x: number, y: number, anchor: 'start' | 'end'): SvgElement {
497
+ const writing = corner(text, x, y, BLACK, anchor, BESIDE_SIZE)
498
+ return {...writing, attributes: {...writing.attributes, textLength: writingWidth(text, BESIDE_SIZE), lengthAdjust: 'spacingAndGlyphs'}}
499
+ }
500
+
501
+ /** Roughly how wide a line of writing is in the sign font, to make room for it beside the sign. */
502
+ function writingWidth(text: string, size: number): number {
503
+ return Math.ceil(text.length * size * 0.55)
504
+ }
505
+
506
+ /** Writing anchored at its start or end, for corners and the writing beside a sign. */
507
+ function corner(text: string, x: number, y: number, colour: string, anchor: 'start' | 'end', size = 9): SvgElement {
508
+ return {tag: 'text', attributes: {x, y, fill: colour, 'font-size': size, ...SIGN_FONT, 'text-anchor': anchor, 'dominant-baseline': 'central'}, text}
509
+ }
510
+
511
+ /** The size of the stars above a form; the ring of the European Union has smaller ones. */
512
+ const STAR_RADIUS = (level: number) => level === 6 ? 3 : 4
513
+
514
+ /** The stars of an administrative level (5.7) above a form; the European Union gets its ring of stars. */
515
+ function stars(level: number, y: number): SvgElement {
516
+ return element('path', {d: starOffsets(level).map(([dx, dy]) => asterisk(60 + dx, y + dy, STAR_RADIUS(level))).join(' '), fill: 'none', stroke: BLACK,
517
+ 'stroke-width': 1.5, 'stroke-linecap': 'round'})
518
+ }
519
+
520
+ /** The figures of annex D.2 drawn inside a place, on the 100 × 60 box of the abilities. */
521
+ export const SIGN_FIGURES = {
522
+ 'staging-area': [{d: 'M18 18 Q50 30 82 18 V50 H18 Z'}],
523
+ 'staging-area-with-report': [{d: 'M22 30 Q50 40 78 30 V58 H22 Z'}, {text: 'M', x: 50, y: 12, size: 24}],
524
+ 'landing-zone': [{d: 'M24 18 L50 30 L24 42 Z M76 18 L50 30 L76 42 Z', filled: true}, {d: 'M14 30 H86'}],
525
+ } as const satisfies Record<string, readonly BoxPart[]>
526
+
527
+ /** A figure of annex D.2. */
528
+ export type SignFigure = keyof typeof SIGN_FIGURES
529
+
530
+ /** A figure inside a form, scaled evenly into the room the abilities would take. */
531
+ function figureMark(spec: TacticalSignSpec, figure: SignFigure, form: Layout, colour: string): SvgElement {
532
+ const room = abilityRoom(spec, form)
533
+ const scale = Math.min(room.width / 100, room.height / 60)
534
+ const x = room.left + (room.width - 100 * scale) / 2
535
+ const y = room.top + (room.height - 60 * scale) / 2
536
+ return group(SIGN_FIGURES[figure].map(part => boxPart(part, colour, BOX_STROKE / scale)),
537
+ {transform: `translate(${round(x)} ${round(y)}) scale(${round(scale)})`})
538
+ }
539
+
540
+ /** The dashed line from a command post to its location on the map, ending in a cross (D.1.1). */
541
+ function locationLine(form: Layout): SvgElement[] {
542
+ const end = {x: form.left + 76, y: form.bottom + 30}
543
+ return [
544
+ element('path', {d: `M${form.left} ${form.bottom} L${end.x} ${end.y}`, stroke: BLACK, 'stroke-width': 1.5, 'stroke-dasharray': '4 3', fill: 'none'}),
545
+ element('path', {d: `M${end.x - 4} ${end.y - 4} L${end.x + 4} ${end.y + 4} M${end.x + 4} ${end.y - 4} L${end.x - 4} ${end.y + 4}`,
546
+ stroke: BLACK, 'stroke-width': 1.5}),
547
+ ]
548
+ }
549
+
550
+ /** A strength of 5.3 below the form, its last number, the total, underlined. */
551
+ function strengthMark(strength: string, y: number): SvgElement[] {
552
+ const parts = strength.split('/')
553
+ const total = parts.pop() ?? ''
554
+ const head = parts.length ? `${parts.join('/')}/` : ''
555
+ return [{tag: 'text', attributes: {x: 60, y, fill: BLACK, 'font-size': 11, ...SIGN_FONT, 'text-anchor': 'middle', 'dominant-baseline': 'central'},
556
+ children: [
557
+ {tag: 'tspan', attributes: {}, text: head},
558
+ {tag: 'tspan', attributes: {'text-decoration': 'underline'}, text: total},
559
+ ]}]
344
560
  }
345
561
 
346
562
  /** The sign as SVG markup, for map icons. */
@@ -51,6 +51,9 @@ export function renderSvg(node: SvgElement): string {
51
51
  return content ? `<${node.tag}${attributes}>${content}</${node.tag}>` : `<${node.tag}${attributes}/>`
52
52
  }
53
53
 
54
+ /** The type every piece of writing in a symbol is set in. */
55
+ export const SIGN_FONT: Attributes = {'font-weight': 700, 'font-family': 'Barlow Condensed, Barlow, sans-serif'}
56
+
54
57
  /** Writing at a point, squeezed to `maxWidth` when it is long. */
55
58
  export function label(text: string, x: number, y: number, colour: string, maxWidth = MAX_TEXT_WIDTH, size?: number): SvgElement {
56
59
  const fontSize = size ?? (text.length > 8 ? 17 : 22)
@@ -60,22 +63,91 @@ export function label(text: string, x: number, y: number, colour: string, maxWid
60
63
  return {
61
64
  tag: 'text',
62
65
  attributes: {
63
- x, y, fill: colour, 'font-size': fontSize, 'font-weight': 700,
64
- 'font-family': 'Barlow Condensed, Barlow, sans-serif', 'text-anchor': 'middle',
66
+ x, y, fill: colour, 'font-size': fontSize, ...SIGN_FONT, 'text-anchor': 'middle',
65
67
  'dominant-baseline': 'central', ...squeeze,
66
68
  },
67
69
  text,
68
70
  }
69
71
  }
70
72
 
71
- /** The SVG element of the common 120 × 80 canvas around a symbol's content. */
72
- export function canvas(children: SvgElement[]): SvgElement {
73
+ /** How far a canvas reaches beyond the common 120 × 80 area on each side, for writing around a sign. */
74
+ export interface Margins {
75
+ left: number
76
+ right: number
77
+ top: number
78
+ bottom: number
79
+ }
80
+
81
+ /**
82
+ * The SVG element of the common 120 × 80 canvas around a symbol's content, widened by `margins`
83
+ * where writing sits beside or below the sign; the sign itself keeps its place and size.
84
+ */
85
+ export function canvas(children: SvgElement[], margins: Margins = {left: 0, right: 0, top: 0, bottom: 0}): SvgElement {
86
+ const width = SYMBOL_WIDTH + margins.left + margins.right
87
+ const height = SYMBOL_HEIGHT + margins.top + margins.bottom
73
88
  return {
74
89
  tag: 'svg',
75
90
  attributes: {
76
- xmlns: 'http://www.w3.org/2000/svg', viewBox: `0 0 ${SYMBOL_WIDTH} ${SYMBOL_HEIGHT}`,
77
- width: SYMBOL_WIDTH, height: SYMBOL_HEIGHT,
91
+ xmlns: 'http://www.w3.org/2000/svg', viewBox: `${-margins.left} ${-margins.top} ${width} ${height}`,
92
+ width, height,
78
93
  },
79
94
  children,
80
95
  }
81
96
  }
97
+
98
+ /** Rounds a coordinate or factor to three decimals, to keep the markup short. */
99
+ export function round(value: number): number {
100
+ return Math.round(value * 1000) / 1000
101
+ }
102
+
103
+ /**
104
+ * One stroke, filled shape or piece of writing of a drawing on its own 100 × 60 box, as the
105
+ * abilities of chapter 4 and the additional signs of chapter 5 are drawn; `colour` overrides the
106
+ * drawing's colour for this part.
107
+ */
108
+ export type BoxPart = (
109
+ | {d: string, filled?: boolean, width?: number}
110
+ | {circle: [number, number, number], filled?: boolean}
111
+ | {text: string, x: number, y: number, size: number}
112
+ ) & {colour?: string}
113
+
114
+ /** The stroke width of a drawing on its 100 × 60 box at its own size. */
115
+ export const BOX_STROKE = 2.5
116
+
117
+ /** One part of a box drawing; `width` is the stroke width in the box, so lines keep their weight however the box is scaled. */
118
+ export function boxPart(part: BoxPart, colour: string, width = BOX_STROKE): SvgElement {
119
+ const ink = part.colour ?? colour
120
+ const stroke = {stroke: ink, 'stroke-width': round(width), 'stroke-linecap': 'round', 'stroke-linejoin': 'round'}
121
+ if ('text' in part) {
122
+ return {tag: 'text', attributes: {x: part.x, y: part.y, fill: ink, 'font-size': part.size, ...SIGN_FONT,
123
+ 'text-anchor': 'middle', 'dominant-baseline': 'central'}, text: part.text}
124
+ }
125
+ const fill = part.filled ? ink : 'none'
126
+ if ('circle' in part) return element('circle', {cx: part.circle[0], cy: part.circle[1], r: part.circle[2], fill, ...stroke})
127
+ return element('path', {d: part.d, fill, ...stroke, ...(part.width ? {'stroke-width': round(part.width * width / BOX_STROKE)} : {})})
128
+ }
129
+
130
+ /** The ink every sign is drawn in. */
131
+ export const BLACK = '#000000'
132
+ /** The white of filled forms and backdrops. */
133
+ export const WHITE = '#FFFFFF'
134
+ /** The red of hazards and damage (annex O, also the fire service colour). */
135
+ export const HAZARD_RED = '#FA321E'
136
+ /** The blue of measures and water (annex O). */
137
+ export const MEASURE_BLUE = '#3264FA'
138
+
139
+ /**
140
+ * Where the stars of an administrative level (5.7) sit around their centre, 10 apart in a row; the
141
+ * European Union (level 6) has six in a ring: one left, two above, two below, one right.
142
+ */
143
+ export function starOffsets(level: number): [number, number][] {
144
+ if (level === 6) return [[-14, 0], [-5, -5], [5, -5], [-5, 5], [5, 5], [14, 0]]
145
+ return Array.from({length: level}, (_, index) => [(index - (level - 1) / 2) * 10, 0])
146
+ }
147
+
148
+ /** The path of a six-armed asterisk, the star of the administrative levels of 5.7. */
149
+ export function asterisk(x: number, y: number, r: number): string {
150
+ const dx = round(r * 0.866)
151
+ const dy = round(r / 2)
152
+ return `M${x} ${y - r} V${y + r} M${round(x - dx)} ${round(y - dy)} L${round(x + dx)} ${round(y + dy)} M${round(x + dx)} ${round(y - dy)} L${round(x - dx)} ${round(y + dy)}`
153
+ }