@emberbox/ui 0.8.0 → 0.10.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/dist/vite/logo.d.ts +1 -1
- package/logos/lernkarten-180.png +0 -0
- package/logos/lernkarten-192.png +0 -0
- package/logos/lernkarten-512.png +0 -0
- package/logos/lernkarten-maskable-192.png +0 -0
- package/logos/lernkarten-maskable-512.png +0 -0
- package/logos/lernkarten.svg +1 -0
- package/package.json +2 -1
- package/src/index.ts +7 -0
- package/src/symbols/abilities.ts +156 -0
- package/src/symbols/catalog.ts +163 -0
- package/src/symbols/signs.ts +423 -0
- package/src/symbols/svg.ts +83 -0
- package/src/symbols/tactical.ts +4 -68
- package/src/vite/logo.ts +1 -1
package/dist/vite/logo.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Plugin } from 'vite';
|
|
2
2
|
/** The tools for which `@emberbox/ui` ships a logo. */
|
|
3
|
-
export type Logo = 'emberbox' | 'alarmzettel' | 'statussim' | 'calltaker' | 'planspiel';
|
|
3
|
+
export type Logo = 'emberbox' | 'alarmzettel' | 'statussim' | 'calltaker' | 'planspiel' | 'lernkarten';
|
|
4
4
|
/**
|
|
5
5
|
* Serves a tool's logo as `favicon.svg`, `apple-touch-icon.png`, `logo-192.png`, `logo-512.png` and the
|
|
6
6
|
* maskable `logo-maskable-192.png` and `logo-maskable-512.png` at the root, in the dev server as in
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" rx="8" fill="#d5271b"/><g transform="translate(14 14) scale(1.5)" color="#fff"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0zM22 10v6"/><path d="M6 12.5V16a6 3 0 0 0 12 0v-3.5"/></g></g></svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emberbox/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.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",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"files": [
|
|
13
13
|
"src",
|
|
14
14
|
"!src/**/*.test.ts",
|
|
15
|
+
"!src/**/__snapshots__",
|
|
15
16
|
"dist",
|
|
16
17
|
"logos"
|
|
17
18
|
],
|
package/src/index.ts
CHANGED
|
@@ -34,6 +34,13 @@ export {
|
|
|
34
34
|
markSymbolTree, unitSymbol, unitSymbolTree,
|
|
35
35
|
type MarkKind, type Organisation, type SvgElement, type SymbolShape, type SymbolSpec, type UnitSize,
|
|
36
36
|
} from './symbols/tactical'
|
|
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,
|
|
41
|
+
} from './symbols/signs'
|
|
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'
|
|
37
44
|
|
|
38
45
|
/**
|
|
39
46
|
* Vue plugin that installs Nuxt UI in the Emberbox style. Icons come only from the bundled set; a
|
|
@@ -0,0 +1,156 @@
|
|
|
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
|
+
/** One stroke, filled shape or piece of writing of an ability, on the 100 × 60 box. */
|
|
10
|
+
export type AbilityPart =
|
|
11
|
+
| {d: string, filled?: boolean, width?: number}
|
|
12
|
+
| {circle: [number, number, number], filled?: boolean}
|
|
13
|
+
| {text: string, x: number, y: number, size: number}
|
|
14
|
+
|
|
15
|
+
/** An ability of chapter 4 with its number, name after the recommendations and printed page. */
|
|
16
|
+
export interface Ability {
|
|
17
|
+
number: string
|
|
18
|
+
name: string
|
|
19
|
+
page: number
|
|
20
|
+
parts: readonly AbilityPart[]
|
|
21
|
+
/** Spans the whole inside of the form, as annex C draws firefighting and the CBRN cross, instead of keeping its proportions. */
|
|
22
|
+
stretch?: boolean
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const CBRN: AbilityPart[] = [{circle: [34, 10, 6], filled: true}, {circle: [66, 10, 6], filled: true}, {d: 'M34 10 L68 54 M66 10 L32 54'}]
|
|
26
|
+
/** A wavy line at a height, from one x to another in waves of 10. */
|
|
27
|
+
function waves(y: number, from = 30, to = 70): AbilityPart {
|
|
28
|
+
const more = Math.max(0, Math.round((to - from) / 10) - 1)
|
|
29
|
+
return {d: `M${from} ${y} q5 -5 10 0${' t10 0'.repeat(more)}`}
|
|
30
|
+
}
|
|
31
|
+
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
|
+
const VET: AbilityPart = {d: 'M36 6 H44 L56 54 L68 6 H76'}
|
|
33
|
+
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}`})
|
|
34
|
+
|
|
35
|
+
/** The abilities of chapter 4, keyed by a short English name. */
|
|
36
|
+
export const ABILITIES = {
|
|
37
|
+
'cbrn': {number: '4.1.1', name: 'Abwehr gefährlicher Stoffe und Güter, ABC-/CBRN-Schutz', page: 22, parts: CBRN, stretch: true},
|
|
38
|
+
'cbrn-measuring': {number: '4.1.2', name: 'Messen, Spüren, Detektieren', page: 22, parts: [...CBRN, {d: 'M14 46 L86 20'}], stretch: true},
|
|
39
|
+
'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},
|
|
40
|
+
'water-pollution': {number: '4.1.4', name: 'Beseitigen von Umweltschäden auf Gewässern', page: 22,
|
|
41
|
+
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)]},
|
|
42
|
+
'water-treatment': {number: '4.1.5', name: 'Trinkwasseraufbereitung', page: 22,
|
|
43
|
+
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'}]},
|
|
44
|
+
'radiological': {number: '4.1.6', name: 'Atomare (radiologische/nukleare) Stoffe', page: 23,
|
|
45
|
+
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}]},
|
|
46
|
+
'biological': {number: '4.1.7', name: 'Biologische Stoffe', page: 23,
|
|
47
|
+
parts: [{circle: [50, 20, 12]}, {circle: [40, 38, 12]}, {circle: [60, 38, 12]}]},
|
|
48
|
+
'chemical': {number: '4.1.8', name: 'Chemische Stoffe', page: 23, parts: [{d: 'M44 4 V22 L32 56 H68 L56 22 V4'}]},
|
|
49
|
+
'care': {number: '4.2.1', name: 'Grundzeichen Betreuung', page: 23, parts: [{d: 'M30 56 L50 4 L70 56'}]},
|
|
50
|
+
'psychosocial': {number: '4.2.2', name: 'Psychosoziale Notfallversorgung, Notfallbegleitung, Krisenintervention', page: 23,
|
|
51
|
+
parts: [{d: 'M32 44 L50 4 L68 44'}, {text: 'PSNV', x: 50, y: 52, size: 12}]},
|
|
52
|
+
'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'}]},
|
|
53
|
+
'rest': {number: '4.2.4', name: 'Temporäre (Not-)Unterbringung/Versorgung mit Ruhemöglichkeit (einschl. Sitzgelegenheiten)', page: 23,
|
|
54
|
+
parts: [{d: 'M26 14 V50 M74 14 V50 M26 38 H74 M26 34 Q50 20 74 34'}]},
|
|
55
|
+
'seating': {number: '4.2.5', name: 'Temporäre (Not-)Unterbringung/Versorgung mit Sitzgelegenheit', page: 24, parts: [{d: 'M40 6 V54 M40 28 H62 V54'}]},
|
|
56
|
+
'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},
|
|
57
|
+
'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'}]},
|
|
58
|
+
'foam': {number: '4.3.3', name: 'Schaummittel', page: 24, parts: [{d: 'M38 16 H62 L50 44 Z', filled: true}]},
|
|
59
|
+
'solid-agent': {number: '4.3.4', name: 'Sonderlöschmittel fest', page: 24, parts: [{d: 'M38 18 H62 V42 H38 Z', filled: true}]},
|
|
60
|
+
'gaseous-agent': {number: '4.3.5', name: 'Sonderlöschmittel gasförmig', page: 24, parts: [{circle: [50, 30, 11], filled: true}]},
|
|
61
|
+
'breathing-protection': {number: '4.3.6', name: 'Atemschutz (umluftunabhängig)', page: 24,
|
|
62
|
+
parts: [{d: 'M42 6 H58 V38 Q58 46 50 48 Q42 46 42 38 Z M50 48 V52'}, {circle: [50, 55, 3]}]},
|
|
63
|
+
'reconnaissance': {number: '4.4.1', name: 'Erkunden, Beobachten, Überwachen', page: 24, parts: [{d: 'M24 54 L76 6'}], stretch: true},
|
|
64
|
+
'locating-biological': {number: '4.4.2', name: 'Orten, biologisch', page: 25,
|
|
65
|
+
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'}]},
|
|
66
|
+
'locating-technical': {number: '4.4.3', name: 'Orten, technisch', page: 25,
|
|
67
|
+
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)]},
|
|
68
|
+
'salvage': {number: '4.5.1', name: 'Bergen, Bergung', page: 25, parts: [{d: 'M20 18 H34 A16 16 0 0 0 66 18 H80'}]},
|
|
69
|
+
'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'}]},
|
|
70
|
+
'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'}]},
|
|
71
|
+
'aerial-platform': {number: '4.5.4', name: 'Retten aus Höhen und Tiefen mit Hubarbeitsbühne/Teleskopgelenkmast', page: 25,
|
|
72
|
+
parts: [{d: 'M30 56 L36 34 L60 26 M60 12 H74 V26 H60 Z'}]},
|
|
73
|
+
'boats': {number: '4.5.5', name: 'Einsatz von Wasserfahrzeugen', page: 25,
|
|
74
|
+
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)]},
|
|
75
|
+
'mountain-rescue': {number: '4.5.6', name: 'Bergrettung', page: 25, parts: [DIAMOND(50, 18, 12), {d: 'M50 32 L62 54 H38 Z', filled: true}]},
|
|
76
|
+
'special-rescue': {number: '4.5.7', name: 'Spezielle Rettung aus Höhen und Tiefen', page: 25,
|
|
77
|
+
parts: [DIAMOND(50, 30, 12), {d: 'M50 16 V4 M50 44 V56'}, ARROW_HEAD(50, 4, 0, -1), ARROW_HEAD(50, 56, 0, 1)]},
|
|
78
|
+
'water-rescue': {number: '4.5.8', name: 'Wasserrettung (einschl. Tauchen)', page: 25, parts: [waves(10), waves(18), DIAMOND(50, 40, 14)]},
|
|
79
|
+
'medical': {number: '4.6.1', name: 'Grundzeichen Sanität', page: 26, parts: [{d: 'M50 4 V56 M24 30 H76'}]},
|
|
80
|
+
'nursing': {number: '4.6.2', name: 'Pflege', page: 26, parts: [{d: 'M50 4 V56 M24 30 H76 M36 24 V36'}]},
|
|
81
|
+
'emergency-medicine': {number: '4.6.3', name: 'Rettungswesen, Intensivmedizin/Notfallmedizin', page: 26, parts: [{d: 'M50 4 V56 M24 30 H76 M64 24 V36'}]},
|
|
82
|
+
'doctors': {number: '4.6.4', name: 'Arztwesen', page: 26, parts: [{d: 'M50 4 V56 M24 30 H76 M44 46 H56'}]},
|
|
83
|
+
'patient-transport': {number: '4.6.5', name: 'Patiententransport', page: 26,
|
|
84
|
+
parts: [{circle: [50, 30, 14]}, {d: 'M40 20 L60 40 M60 20 L40 40 M50 4 V56 M24 30 H76'}]},
|
|
85
|
+
'hospital': {number: '4.6.6', name: 'Krankenhaus, stationäre Versorgung', page: 26,
|
|
86
|
+
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'}]},
|
|
87
|
+
'flood-defence': {number: '4.7.1', name: 'Abwehr von Wassergefahren, Deichverteidigung', page: 26,
|
|
88
|
+
parts: [waves(14, 26, 46), waves(20, 26, 46), {d: 'M26 52 H44 L56 16 H70 L74 28'}]},
|
|
89
|
+
'excavator': {number: '4.7.2', name: 'Baggerarbeiten', page: 26, parts: [{d: 'M32 56 L44 16 L58 8 L72 20 L66 28'}]},
|
|
90
|
+
'lighting': {number: '4.7.3', name: 'Beleuchten', page: 27, parts: [{d: 'M42 56 V16 Q42 6 54 8'}, {circle: [58, 16, 7]}]},
|
|
91
|
+
'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)]},
|
|
92
|
+
'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)]},
|
|
93
|
+
'ordnance-disposal': {number: '4.7.6', name: 'Entschärfen, Kampfmittelräumung', page: 27,
|
|
94
|
+
parts: [{circle: [50, 30, 18]}, {circle: [50, 30, 10], filled: true}, {d: 'M50 6 V12 M50 48 V54 M26 30 H32 M68 30 H74'}]},
|
|
95
|
+
'hand-tools': {number: '4.7.7', name: 'Einsatz von Handwerkzeugen/Handarbeit', page: 27,
|
|
96
|
+
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}]},
|
|
97
|
+
'forklift': {number: '4.7.8', name: 'Hebearbeit, Umschlagen von Lasten', page: 27, parts: [{d: 'M40 4 V56 M46 10 V48 H66'}]},
|
|
98
|
+
'crane': {number: '4.7.9', name: 'Hebearbeit, Heben von Lasten', page: 27, parts: [{d: 'M38 56 V8 H62 V16 Q62 22 56 20'}]},
|
|
99
|
+
'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)]},
|
|
100
|
+
'telehandler': {number: '4.7.11', name: 'Kombinationsarbeit Heben/Räumen', page: 27, parts: [{d: 'M28 56 L56 24 H72 M56 24 V12'}]},
|
|
101
|
+
'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'}]},
|
|
102
|
+
'chainsaw': {number: '4.7.13', name: 'Motorsägearbeiten', page: 27,
|
|
103
|
+
parts: [{d: 'M36 20 H68 Q76 20 76 30 Q76 40 68 40 H36 Z M36 24 H30 V36 H36'}]},
|
|
104
|
+
'pumping': {number: '4.7.14', name: 'Pumpen, Lenzen, Beseitigen von Wasserschäden', page: 28,
|
|
105
|
+
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'}]},
|
|
106
|
+
'clearing': {number: '4.7.15', name: 'Räumarbeiten mit Maschine', page: 28, parts: [{d: 'M26 40 H54 M54 26 V40 H74'}]},
|
|
107
|
+
'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'}]},
|
|
108
|
+
'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}]},
|
|
109
|
+
'technical-rescue': {number: '4.7.18', name: 'Technische Hilfeleistung (einschl. Retten)', page: 28,
|
|
110
|
+
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'}]},
|
|
111
|
+
'transporting': {number: '4.7.19', name: 'Transportieren', page: 28,
|
|
112
|
+
parts: [{circle: [50, 30, 22]}, {d: 'M50 8 V52 M28 30 H72 M34 14 L66 46 M66 14 L34 46'}]},
|
|
113
|
+
'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'}]},
|
|
114
|
+
'heights': {number: '4.7.21', name: 'Höhenunterschiede überwinden', page: 28,
|
|
115
|
+
parts: [{d: 'M50 10 H74 M50 10 V50 M26 50 H50'}, ARROW_HEAD(50, 50, 0, 1), ARROW_HEAD(50, 10, 0, -1)]},
|
|
116
|
+
'securing': {number: '4.7.22', name: 'Absicherung', page: 28, parts: [{d: 'M30 54 H70 L56 6 H44 Z M40 22 H60 M36 38 H64'}]},
|
|
117
|
+
'optical-warning': {number: '4.7.23', name: 'Warnen/Informieren mit optischen Anzeigen', page: 28,
|
|
118
|
+
parts: [{d: 'M30 8 H70 V44 H30 Z M50 44 V52 M40 52 H60'}, {text: 'i', x: 50, y: 27, size: 22}]},
|
|
119
|
+
'loudspeaker': {number: '4.7.24', name: 'Warnen mit Lautsprecherdurchsagen', page: 28,
|
|
120
|
+
parts: [{d: 'M30 22 H40 L58 10 V50 L40 38 H30 Z M64 20 Q70 30 64 40 M70 14 Q80 30 70 46'}]},
|
|
121
|
+
'siren': {number: '4.7.25', name: 'Warnen mit Sirene', page: 28, parts: [{d: 'M28 24 Q50 0 72 24 Z M50 24 V56'}]},
|
|
122
|
+
'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)]},
|
|
123
|
+
'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'}]},
|
|
124
|
+
'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)]},
|
|
125
|
+
'container': {number: '4.8.1', name: '(Transport-)Behälter', page: 29, parts: [{d: 'M30 6 V54 H70 V6'}]},
|
|
126
|
+
'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'}]},
|
|
127
|
+
'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'}]},
|
|
128
|
+
'temporary-bridge': {number: '4.8.4', name: 'Behelfsbrückenbau', page: 29,
|
|
129
|
+
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}]},
|
|
130
|
+
'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'}]},
|
|
131
|
+
'maintenance': {number: '4.8.6', name: 'Instandhaltung, Instandsetzung, materielle Infrastruktur', page: 29,
|
|
132
|
+
parts: [{d: 'M28 16 Q38 30 28 44 M38 30 H62 M72 16 Q62 30 72 44'}]},
|
|
133
|
+
'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'}]},
|
|
134
|
+
'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'}]},
|
|
135
|
+
'shower': {number: '4.8.9', name: 'Sanitäre Einrichtung, Dusch-, Waschmöglichkeit(en)', page: 30,
|
|
136
|
+
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'}]},
|
|
137
|
+
'toilets': {number: '4.8.10', name: 'Sanitäre Einrichtung, WC/sanitäre Anlagen', page: 30, parts: [{text: 'WC', x: 50, y: 32, size: 26}]},
|
|
138
|
+
'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)]},
|
|
139
|
+
'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'}]},
|
|
140
|
+
'catering': {number: '4.8.13', name: 'Verpflegung', page: 30, parts: [{d: 'M68 18 A18 18 0 1 0 68 42 L50 30 Z'}]},
|
|
141
|
+
'cooking': {number: '4.8.14', name: 'Zubereiten von Verpflegung', page: 30,
|
|
142
|
+
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}]},
|
|
143
|
+
'tent': {number: '4.8.15', name: 'Zelt, Schnelleinsatzzelt', page: 30, parts: [{d: 'M30 56 V22 L40 8 H60 L70 22 V56'}]},
|
|
144
|
+
'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'}]},
|
|
145
|
+
'communication': {number: '4.9.1', name: 'Information und Kommunikation (IuK)/Fernmeldewesen', page: 30, parts: [{d: 'M24 16 L44 44 L52 22 L76 50'}]},
|
|
146
|
+
'veterinary': {number: '4.10.1', name: 'Veterinärwesen', page: 31, parts: [VET]},
|
|
147
|
+
'slaughtering': {number: '4.10.2', name: '(Not-)Schlachten, Keulen', page: 31, parts: [{d: 'M24 26 H76 M24 40 L30 30 L36 40 Z'}]},
|
|
148
|
+
'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'}]},
|
|
149
|
+
'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'}]},
|
|
150
|
+
'cattle': {number: '4.10.5', name: 'Rind', page: 31, parts: [VET, {d: 'M28 44 L32 52 L36 44 L40 52 L44 44'}]},
|
|
151
|
+
'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'}]},
|
|
152
|
+
'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}]},
|
|
153
|
+
} as const satisfies Record<string, Ability>
|
|
154
|
+
|
|
155
|
+
/** An ability of chapter 4. */
|
|
156
|
+
export type AbilityName = keyof typeof ABILITIES
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import {ABILITIES, type AbilityName} from './abilities'
|
|
2
|
+
import {tacticalSignTree, type TacticalSignSpec} from './signs'
|
|
3
|
+
import type {SvgElement} from './svg'
|
|
4
|
+
import {markSymbolTree, type MarkKind} from './tactical'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* One sign of the catalogue: its number and name after the recommendations "Taktische Zeichen im
|
|
8
|
+
* Bevölkerungsschutz" (BBK, 2024), shortened where the printed name runs on, the printed page it is
|
|
9
|
+
* on, and how the library draws it. Numbers repeat in a few places of the recommendations (5.1.1
|
|
10
|
+
* and 5.1.2 name both a vehicle and a section), so `id` is what tells entries apart.
|
|
11
|
+
*
|
|
12
|
+
* A few signs the library draws are not part of the recommendations, such as the marks of the
|
|
13
|
+
* water supply; they carry `recommended: false`, no page and a number of their own, and should not
|
|
14
|
+
* be asked about as if they were.
|
|
15
|
+
*/
|
|
16
|
+
export interface CatalogEntry {
|
|
17
|
+
id: string
|
|
18
|
+
number: string
|
|
19
|
+
name: string
|
|
20
|
+
page?: number
|
|
21
|
+
recommended: boolean
|
|
22
|
+
drawing: {sign: TacticalSignSpec} | {mark: MarkKind}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The source the catalogue follows, to be named wherever its signs are shown. */
|
|
26
|
+
export const CATALOG_SOURCE = 'Bundesamt für Bevölkerungsschutz und Katastrophenhilfe (BBK): Taktische Zeichen im Bevölkerungsschutz – '
|
|
27
|
+
+ 'Empfehlungen zur Einführung einer FwDV 102/DV 102, Stand Mai 2024, ISBN 978-3-949117-29-9'
|
|
28
|
+
|
|
29
|
+
function entry(number: string, name: string, page: number, sign: TacticalSignSpec, id = number): CatalogEntry {
|
|
30
|
+
return {id, number, name, page, recommended: true, drawing: {sign}}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function ownMark(number: string, name: string, mark: MarkKind): CatalogEntry {
|
|
34
|
+
return {id: number, number, name, recommended: false, drawing: {mark}}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** The drawing of a catalogue entry as a tree of SVG elements. */
|
|
38
|
+
export function catalogSignTree(entry: CatalogEntry): SvgElement {
|
|
39
|
+
return 'sign' in entry.drawing ? tacticalSignTree(entry.drawing.sign) : markSymbolTree(entry.drawing.mark)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const FIRE = {organisation: 'fire'} as const
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The signs of chapters 1 to 4, 5.1, 5.4, 5.5 and annex C of the recommendations, in their order,
|
|
46
|
+
* then the library's own water supply marks. Chapter 1 is drawn black on white as printed, chapter 4
|
|
47
|
+
* on a plain formation; colours are shown on a tactical formation, supplements, vehicles and sizes
|
|
48
|
+
* in fire service red. Letters that annex C writes inside a symbol ("P", "G", "ATF") stand in field A
|
|
49
|
+
* here, and the flying line of C.1.13 sits under the form as in 5.1.4.
|
|
50
|
+
*/
|
|
51
|
+
export const TACTICAL_SIGN_CATALOG: readonly CatalogEntry[] = [
|
|
52
|
+
entry('1.1', 'Taktische Formation', 14, {form: 'formation'}),
|
|
53
|
+
entry('1.2', 'Person', 14, {form: 'person'}),
|
|
54
|
+
entry('1.3', 'Landfahrzeug', 14, {form: 'land-vehicle'}),
|
|
55
|
+
entry('1.4', 'Luftfahrzeug', 14, {form: 'aircraft'}),
|
|
56
|
+
entry('1.5', 'Wasserfahrzeug', 14, {form: 'watercraft'}),
|
|
57
|
+
entry('1.6', 'Stelle, Platz, Einrichtung', 14, {form: 'place'}),
|
|
58
|
+
entry('1.7', 'Gebäude', 14, {form: 'building'}),
|
|
59
|
+
entry('1.8', 'Raum, Behälter, Ressource, Grundzeichen für Funkgeräte', 14, {form: 'room'}),
|
|
60
|
+
entry('1.9', 'Gebiet, Fläche, Bereich', 15, {form: 'area'}),
|
|
61
|
+
entry('1.10', 'Maßnahme', 15, {form: 'measure'}),
|
|
62
|
+
entry('1.11', 'Gefahr', 15, {form: 'hazard'}),
|
|
63
|
+
entry('1.12', 'Markanter Punkt/Markierung', 15, {form: 'landmark'}),
|
|
64
|
+
entry('1.13', 'Ereignis', 15, {form: 'event'}),
|
|
65
|
+
entry('1.14', 'Spontanhelfer', 15, {form: 'volunteer', organisation: 'civil'}),
|
|
66
|
+
entry('2.1', 'Feuerwehr', 16, {form: 'formation', organisation: 'fire', abbreviation: true}),
|
|
67
|
+
entry('2.2', '(Hilfs-)Organisationen', 16, {form: 'formation', organisation: 'aid', abbreviation: true}),
|
|
68
|
+
entry('2.3', 'Technisches Hilfswerk', 16, {form: 'formation', organisation: 'thw', abbreviation: true}),
|
|
69
|
+
entry('2.4', 'Führung, Leitung', 17, {form: 'formation', organisation: 'command'}),
|
|
70
|
+
entry('2.5', 'Polizei', 17, {form: 'formation', organisation: 'police', abbreviation: true}),
|
|
71
|
+
entry('2.6', 'Bundeswehr', 17, {form: 'formation', organisation: 'military', abbreviation: true}),
|
|
72
|
+
entry('2.7', 'Sonstige Gefahrenabwehr', 17, {form: 'formation', organisation: 'other', abbreviation: true}),
|
|
73
|
+
entry('2.8', 'Zivile Einheiten/ungebundene Kräfte', 17, {form: 'formation', organisation: 'civil', abbreviation: true}),
|
|
74
|
+
entry('3.1', 'Schwerpunkt Einsatzführung (Balken oben)', 20, {form: 'formation', ...FIRE, supplements: ['command']}),
|
|
75
|
+
entry('3.2', 'Person mit Sonderfunktion (Litze)', 20, {form: 'person', ...FIRE, supplements: ['special-function']}),
|
|
76
|
+
entry('3.3', 'Schwerpunkt Versorgung, Entsorgung, Logistik (Balken unten)', 20, {form: 'formation', ...FIRE, supplements: ['logistics']}),
|
|
77
|
+
entry('3.4', 'Drohne, unbemannt', 20, {form: 'aircraft', ...FIRE, supplements: ['uncrewed']}),
|
|
78
|
+
entry('3.5', 'Zweirad, Fahrrad', 20, {form: 'formation', ...FIRE, supplements: ['bicycle']}),
|
|
79
|
+
entry('3.6', 'Zweirad, Kraftrad', 21, {form: 'formation', ...FIRE, supplements: ['motorcycle']}),
|
|
80
|
+
entry('3.7', 'Temporär ortsfeste Struktur (mit festem Dach)', 21, {form: 'place', ...FIRE, supplements: ['roof']}),
|
|
81
|
+
...Object.entries(ABILITIES).map(([name, ability]) => entry(ability.number, ability.name, ability.page, {form: 'formation', abilities: [name as AbilityName]})),
|
|
82
|
+
entry('5.1.1', 'Fahrzeug, ungeschützt', 32, {form: 'land-vehicle', ...FIRE}, '5.1.1-unprotected'),
|
|
83
|
+
entry('5.1.2', 'Fahrzeug, geschützt', 32, {form: 'land-vehicle', ...FIRE, protected: true}, '5.1.2-protected'),
|
|
84
|
+
entry('5.1.1.1', 'Kraftfahrzeug, straßenfähig (Kategorie 1)', 32, {form: 'land-vehicle', ...FIRE, drive: 'road'}),
|
|
85
|
+
entry('5.1.1.2', 'Kraftfahrzeug, geländefähig (Kategorie 2)', 32, {form: 'land-vehicle', ...FIRE, drive: 'offroad'}),
|
|
86
|
+
entry('5.1.1.3', 'Kraftfahrzeug, geländegängig (Kategorie 3)', 32, {form: 'land-vehicle', ...FIRE, drive: 'all-terrain'}),
|
|
87
|
+
entry('5.1.1.4', 'Amphibienfahrzeug', 32, {form: 'land-vehicle', ...FIRE, drive: 'amphibious'}),
|
|
88
|
+
entry('5.1.1.5', 'Kettenfahrzeug', 33, {form: 'land-vehicle', ...FIRE, drive: 'tracked'}),
|
|
89
|
+
entry('5.1.1.6', 'Schienenfahrzeug', 33, {form: 'land-vehicle', ...FIRE, drive: 'rail'}),
|
|
90
|
+
entry('5.1.1.7', 'Kraftfahrzeug, aufgleisbar', 33, {form: 'land-vehicle', ...FIRE, drive: 'rail-capable'}),
|
|
91
|
+
entry('5.1.1.8', 'Kraftfahrzeug, straßenfähig, Typ Wechsellader', 33, {form: 'land-vehicle', ...FIRE, body: 'swap-loader', drive: 'road'}),
|
|
92
|
+
entry('5.1.1.9', 'Kraftfahrzeug, straßenfähig, Typ Wechselbehälter/Container', 33, {form: 'formation', ...FIRE, body: 'container-carrier', drive: 'road'}),
|
|
93
|
+
entry('5.1.2.1', 'Anhänger, allgemein', 33, {form: 'land-vehicle', ...FIRE, body: 'trailer'}),
|
|
94
|
+
entry('5.1.2.2', 'Anhänger, Typ Abrollbehälter', 33, {form: 'land-vehicle', ...FIRE, body: 'roll-off-trailer'}),
|
|
95
|
+
entry('5.1.2.3', 'Anhänger, Typ Wechselbehälter/Container', 33, {form: 'formation', ...FIRE, body: 'container-trailer'}),
|
|
96
|
+
entry('5.1.2.4', 'Anhänger, von PKW gezogen', 33, {form: 'land-vehicle', ...FIRE, body: 'trailer', drive: 'towed-by-car'}),
|
|
97
|
+
entry('5.1.2.5', 'Anhänger, von LKW gezogen', 33, {form: 'land-vehicle', ...FIRE, body: 'trailer', drive: 'towed-by-truck'}),
|
|
98
|
+
entry('5.1.3.1', 'Abrollbehälter', 34, {form: 'land-vehicle', ...FIRE, body: 'roll-off-container'}),
|
|
99
|
+
entry('5.1.3.2', 'Wechselbehälter/Container', 34, {form: 'formation', ...FIRE, body: 'swap-container'}),
|
|
100
|
+
entry('5.1.3.3', 'Wechselbrücke', 34, {form: 'formation', ...FIRE, body: 'swap-body'}),
|
|
101
|
+
entry('5.1.3.4', 'Behälter zieh-/schiebbar (z. B. Rollcontainer)', 34, {form: 'land-vehicle', ...FIRE, body: 'roll-container'}),
|
|
102
|
+
entry('5.1.4.1', 'Einsatz von Luftfahrzeugen/Fliegen allgemein', 34, {form: 'aircraft', ...FIRE, flight: 'flying'}),
|
|
103
|
+
entry('5.1.4.2', 'Drehflügler/Hubschrauber', 34, {form: 'aircraft', ...FIRE, flight: 'rotary-wing'}),
|
|
104
|
+
entry('5.1.4.3', 'Flächenflügler/Flugzeug', 34, {form: 'aircraft', ...FIRE, flight: 'fixed-wing'}),
|
|
105
|
+
entry('5.4.1', 'Trupp/selbstständiger Trupp', 37, {form: 'formation', ...FIRE, size: 'squad'}),
|
|
106
|
+
entry('5.4.2', 'Staffel', 37, {form: 'formation', ...FIRE, size: 'section'}),
|
|
107
|
+
entry('5.4.3', 'Gruppe', 37, {form: 'formation', ...FIRE, size: 'group'}),
|
|
108
|
+
entry('5.4.4', 'Zug', 37, {form: 'formation', ...FIRE, size: 'platoon'}),
|
|
109
|
+
entry('5.5.1', 'Bereitschaft (Verband I)', 37, {form: 'formation', ...FIRE, size: 'association-1'}),
|
|
110
|
+
entry('5.5.2', 'Abteilung (Verband II)', 37, {form: 'formation', ...FIRE, size: 'association-2'}),
|
|
111
|
+
entry('5.5.3', 'Großverband (Verband III)', 37, {form: 'formation', ...FIRE, size: 'association-3'}),
|
|
112
|
+
entry('C.1.1', 'Löschstaffel (Staffellöschfahrzeug)', 71, {form: 'formation', ...FIRE, size: 'section', abilities: ['firefighting']}),
|
|
113
|
+
entry('C.1.2', 'Löschgruppe (Löschgruppenfahrzeug)', 71, {form: 'formation', ...FIRE, size: 'group', abilities: ['firefighting']}),
|
|
114
|
+
entry('C.1.3', 'Löschzug einer Feuerwehr', 71, {form: 'formation', ...FIRE, size: 'platoon', abilities: ['firefighting']}),
|
|
115
|
+
entry('C.1.4', 'Rüstzug einer Feuerwehr', 71, {form: 'formation', ...FIRE, size: 'platoon', abilities: ['technical-rescue']}),
|
|
116
|
+
entry('C.1.5', 'Fachzug', 71, {form: 'formation', ...FIRE, size: 'platoon', designation: 'FZ-'}),
|
|
117
|
+
entry('C.1.6', 'Fachdienst Brandschutz', 71, {form: 'formation', ...FIRE, size: 'association-1', abilities: ['firefighting'], designation: 'FD'}),
|
|
118
|
+
entry('C.1.7', 'CBRN-Erkundungstrupp (CBRN-ErkKW)', 71, {form: 'formation', ...FIRE, size: 'squad', abilities: ['cbrn-measuring']}),
|
|
119
|
+
entry('C.1.8', 'Staffel Dekontamination von Personal (GW-Dekon P)', 71, {form: 'formation', ...FIRE, size: 'section', abilities: ['decontamination'], designation: 'P'}),
|
|
120
|
+
entry('C.1.9', 'ABC-Erkundungsgruppe einer Feuerwehr', 71, {form: 'formation', ...FIRE, size: 'group', abilities: ['cbrn-measuring']}),
|
|
121
|
+
entry('C.1.10', 'Dekontaminationsgruppe Gerät einer Feuerwehr', 71, {form: 'formation', ...FIRE, size: 'group', abilities: ['decontamination'], designation: 'G'}),
|
|
122
|
+
entry('C.1.11', 'Gefahrstoffzug/ABC-Zug/CBRN-Zug einer Feuerwehr', 72, {form: 'formation', ...FIRE, size: 'platoon', abilities: ['cbrn']}),
|
|
123
|
+
entry('C.1.12', 'Analytische Task Force (ATF)', 72, {form: 'formation', ...FIRE, size: 'platoon', abilities: ['cbrn-measuring'], designation: 'ATF'}),
|
|
124
|
+
entry('C.1.13', 'Flugdrohnentrupp einer Feuerwehr', 72, {form: 'formation', ...FIRE, size: 'squad', supplements: ['uncrewed'], flight: 'flying'}),
|
|
125
|
+
entry('C.1.14', 'Drohnentrupp einer Feuerwehr (allgemein)', 72, {form: 'formation', ...FIRE, size: 'squad', supplements: ['uncrewed']}),
|
|
126
|
+
entry('C.1.15', 'Tauchergruppe einer Feuerwehr', 72, {form: 'formation', ...FIRE, size: 'group', abilities: ['water-rescue']}),
|
|
127
|
+
entry('C.2.1', 'Kommandowagen', 72, {form: 'land-vehicle', ...FIRE, drive: 'road', supplements: ['command'], designation: 'KdoW'}),
|
|
128
|
+
entry('C.2.2', 'Einsatzleitwagen 1', 72, {form: 'land-vehicle', ...FIRE, drive: 'road', supplements: ['command'], designation: 'ELW 1'}),
|
|
129
|
+
entry('C.2.3', 'Einsatzleitwagen 2', 72, {form: 'land-vehicle', ...FIRE, drive: 'road', supplements: ['command'], designation: 'ELW 2'}),
|
|
130
|
+
entry('C.2.4', 'Tragkraftspritzenfahrzeug', 72, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['firefighting'], designation: 'TSF'}),
|
|
131
|
+
entry('C.2.5', 'Tragkraftspritzenfahrzeug mit Wasser', 72, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['firefighting'], designation: 'TSF-W'}),
|
|
132
|
+
entry('C.2.6', 'Kleinlöschfahrzeug', 73, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['firefighting'], designation: 'KLF'}),
|
|
133
|
+
entry('C.2.7', 'Mittleres Löschfahrzeug', 73, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['firefighting'], designation: 'MLF'}),
|
|
134
|
+
entry('C.2.8', '(Hilfeleistungs-)Löschfahrzeug 10', 73, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['firefighting'], designation: '(H)LF 10'}),
|
|
135
|
+
entry('C.2.9', '(Hilfeleistungs-)Löschfahrzeug 20', 73, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['firefighting'], designation: '(H)LF 20'}),
|
|
136
|
+
entry('C.2.10', 'Löschgruppenfahrzeug 20 Katastrophenschutz', 73, {form: 'land-vehicle', ...FIRE, drive: 'offroad', abilities: ['firefighting'], designation: 'LF 20 KatS'}),
|
|
137
|
+
entry('C.2.11', 'Tanklöschfahrzeug 2.000', 73, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['firefighting'], designation: 'TLF 2.000'}),
|
|
138
|
+
entry('C.2.12', 'Tanklöschfahrzeug 3.000', 73, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['firefighting'], designation: 'TLF 3.000'}),
|
|
139
|
+
entry('C.2.13', 'Tanklöschfahrzeug 4.000', 73, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['firefighting'], designation: 'TLF 4.000'}),
|
|
140
|
+
entry('C.2.14', 'Automatikdrehleiter mit Rettungskorb 12/9', 73, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['turntable-ladder'], designation: 'DLAK 12/9'}),
|
|
141
|
+
entry('C.2.15', 'Automatikdrehleiter mit Rettungskorb 18/12', 73, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['turntable-ladder'], designation: 'DLAK 18/12'}),
|
|
142
|
+
entry('C.2.16', 'Automatikdrehleiter mit Rettungskorb 23/12', 74, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['turntable-ladder'], designation: 'DLAK 23/12'}),
|
|
143
|
+
entry('C.2.17', 'Hubarbeitsbühne (HAB) oder Teleskopgelenkmast (TGM)', 74, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['aerial-platform'], designation: 'HAB'}),
|
|
144
|
+
entry('C.2.18', 'Rüstwagen', 74, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['technical-rescue']}),
|
|
145
|
+
entry('C.2.19', 'Wechselladerfahrzeug', 74, {form: 'land-vehicle', ...FIRE, drive: 'road', body: 'swap-loader'}),
|
|
146
|
+
entry('C.2.20', 'Gerätewagen Gefahrgut', 74, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['cbrn'], designation: 'GW-G'}),
|
|
147
|
+
entry('C.2.21', 'Gerätewagen Logistik 1', 74, {form: 'land-vehicle', ...FIRE, drive: 'road', supplements: ['logistics'], designation: 'GW-L1'}),
|
|
148
|
+
entry('C.2.22', 'Gerätewagen Logistik 2', 74, {form: 'land-vehicle', ...FIRE, drive: 'road', supplements: ['logistics'], designation: 'GW-L2'}),
|
|
149
|
+
entry('C.2.23', 'Mannschaftstransportfahrzeug, 9-sitzig', 75, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['transporting'], designation: 'MTF'}),
|
|
150
|
+
entry('C.2.24', 'CBRN-Erkundungswagen', 75, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['cbrn-measuring'], designation: 'CBRN ErkW'}),
|
|
151
|
+
entry('C.2.25', 'Gerätewagen Dekontamination Personal', 75, {form: 'land-vehicle', ...FIRE, drive: 'offroad', abilities: ['decontamination'], designation: 'GW Dekon P'}),
|
|
152
|
+
entry('C.2.26', 'Schlauchwagen Katastrophenschutz', 75, {form: 'land-vehicle', ...FIRE, drive: 'offroad', abilities: ['water-conveying'], designation: 'SW KatS'}),
|
|
153
|
+
entry('C.2.27', 'Feuerwehrkran 30', 75, {form: 'land-vehicle', ...FIRE, drive: 'road', abilities: ['crane'], designation: 'FwK 30'}),
|
|
154
|
+
entry('C.2.28', 'Teleskoplader', 75, {form: 'land-vehicle', ...FIRE, drive: 'offroad', abilities: ['telehandler'], designation: 'Telelader'}),
|
|
155
|
+
entry('C.2.29', 'Tragkraftspritzenanhänger', 76, {form: 'land-vehicle', ...FIRE, body: 'trailer', drive: 'towed-by-car', abilities: ['firefighting']}),
|
|
156
|
+
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'}),
|
|
157
|
+
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']}),
|
|
158
|
+
ownMark('W.1', 'Unterflurhydrant', 'hydrant-underground'),
|
|
159
|
+
ownMark('W.2', 'Überflurhydrant', 'hydrant-pillar'),
|
|
160
|
+
ownMark('W.3', 'Offenes Gewässer', 'open-water'),
|
|
161
|
+
ownMark('W.4', 'Löschwasserbehälter', 'water-tank'),
|
|
162
|
+
ownMark('W.5', 'Verteiler', 'dividing-breeching'),
|
|
163
|
+
]
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tactical signs built from the building blocks of the recommendations "Taktische Zeichen im
|
|
3
|
+
* Bevölkerungsschutz" of the BBK (2024, for FwDV 102 / DV 102): a basic form (chapter 1), the
|
|
4
|
+
* colour of an organisation (chapter 2) in one of three styles, supplementary signs (chapter 3),
|
|
5
|
+
* a unit size or association (5.4, 5.5), and for vehicles how they move and what they carry (5.1).
|
|
6
|
+
* The drawings follow the system of the recommendations without copying their artwork.
|
|
7
|
+
*
|
|
8
|
+
* Colours are fixed values, not theme variables, because the same signs go into map icons as
|
|
9
|
+
* markup strings where no stylesheet applies. They are the HEX column of annex O; for orange the
|
|
10
|
+
* annex gives 250–130–0 as RGB but #FA8C00 as HEX, and the HEX value is used. Signs are drawn for a
|
|
11
|
+
* light background, as on paper: size marks, frames and wheels are black, so a page in dark mode
|
|
12
|
+
* shows them on a light backdrop.
|
|
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.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import {ABILITIES, type Ability, type AbilityName, type AbilityPart} from './abilities'
|
|
20
|
+
import {SIGN_FONT, canvas, element, group, label, renderSvg, type SvgElement} from './svg'
|
|
21
|
+
|
|
22
|
+
/** The basic forms of chapter 1, in its order. */
|
|
23
|
+
export const BASIC_FORMS = [
|
|
24
|
+
'formation', 'person', 'land-vehicle', 'aircraft', 'watercraft', 'place', 'building', 'room', 'area',
|
|
25
|
+
'measure', 'hazard', 'landmark', 'event', 'volunteer',
|
|
26
|
+
] as const
|
|
27
|
+
|
|
28
|
+
/** A basic form of a tactical sign. */
|
|
29
|
+
export type BasicForm = typeof BASIC_FORMS[number]
|
|
30
|
+
|
|
31
|
+
/** The organisations of chapter 2, in its order. */
|
|
32
|
+
export const SIGN_ORGANISATIONS = ['fire', 'aid', 'thw', 'command', 'police', 'military', 'other', 'civil'] as const
|
|
33
|
+
|
|
34
|
+
/** An organisation whose colour a sign carries. */
|
|
35
|
+
export type SignOrganisation = typeof SIGN_ORGANISATIONS[number]
|
|
36
|
+
|
|
37
|
+
/** How the colour is applied: filling the form, only as its outline, or black on white. */
|
|
38
|
+
export type SignStyle = 'filled' | 'outline' | 'mono'
|
|
39
|
+
|
|
40
|
+
/** The tactical units of 5.4 and the associations of 5.5. */
|
|
41
|
+
export const SIGN_SIZES = ['squad', 'section', 'group', 'platoon', 'association-1', 'association-2', 'association-3'] as const
|
|
42
|
+
|
|
43
|
+
/** The size of what a sign stands for. */
|
|
44
|
+
export type SignSize = typeof SIGN_SIZES[number]
|
|
45
|
+
|
|
46
|
+
/** The supplementary signs of chapter 3, in its order. */
|
|
47
|
+
export const SUPPLEMENTS = ['command', 'special-function', 'logistics', 'uncrewed', 'bicycle', 'motorcycle', 'roof'] as const
|
|
48
|
+
|
|
49
|
+
/** A supplementary sign. */
|
|
50
|
+
export type Supplement = typeof SUPPLEMENTS[number]
|
|
51
|
+
|
|
52
|
+
/** How a land vehicle or trailer runs, after 5.1.1 and 5.1.2: its wheels, tracks or rails. */
|
|
53
|
+
export const DRIVES = ['road', 'offroad', 'all-terrain', 'amphibious', 'tracked', 'rail', 'rail-capable', 'towed-by-car', 'towed-by-truck'] as const
|
|
54
|
+
|
|
55
|
+
/** The running gear of a land vehicle or trailer. */
|
|
56
|
+
export type Drive = typeof DRIVES[number]
|
|
57
|
+
|
|
58
|
+
/** What a land vehicle is or carries, after 5.1.1 to 5.1.3: trailers, swap bodies and containers. */
|
|
59
|
+
export const VEHICLE_BODIES = [
|
|
60
|
+
'swap-loader', 'container-carrier', 'trailer', 'roll-off-trailer', 'container-trailer',
|
|
61
|
+
'roll-off-container', 'swap-container', 'swap-body', 'roll-container',
|
|
62
|
+
] as const
|
|
63
|
+
|
|
64
|
+
/** The body of a land vehicle. */
|
|
65
|
+
export type VehicleBody = typeof VEHICLE_BODIES[number]
|
|
66
|
+
|
|
67
|
+
/** How an aircraft flies, after 5.1.4. */
|
|
68
|
+
export const FLIGHTS = ['flying', 'rotary-wing', 'fixed-wing'] as const
|
|
69
|
+
|
|
70
|
+
/** The flight of an aircraft. */
|
|
71
|
+
export type Flight = typeof FLIGHTS[number]
|
|
72
|
+
|
|
73
|
+
/** What a tactical sign is drawn from. */
|
|
74
|
+
export interface TacticalSignSpec {
|
|
75
|
+
form: BasicForm
|
|
76
|
+
organisation?: SignOrganisation
|
|
77
|
+
style?: SignStyle
|
|
78
|
+
size?: SignSize
|
|
79
|
+
supplements?: readonly Supplement[]
|
|
80
|
+
/** For land vehicles: a protected vehicle has a straight top and an inward-curving underside (5.1). */
|
|
81
|
+
protected?: boolean
|
|
82
|
+
drive?: Drive
|
|
83
|
+
body?: VehicleBody
|
|
84
|
+
flight?: Flight
|
|
85
|
+
/** Abilities of chapter 4 drawn inside the form, the main one first; they stack from the bottom up (6.1). */
|
|
86
|
+
abilities?: readonly AbilityName[]
|
|
87
|
+
/** A short designation in the upper left corner (field A), such as "ELW 1", as annex C shows it. */
|
|
88
|
+
designation?: string
|
|
89
|
+
/** Writing inside the form, such as a function or a vehicle name. */
|
|
90
|
+
text?: string
|
|
91
|
+
/** Shows the organisation's short name, which chapter 2 asks for whenever colour is missing. */
|
|
92
|
+
abbreviation?: boolean
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** The colour, its writing colour and short name of each organisation, after chapter 2 and annex O. */
|
|
96
|
+
export const ORGANISATION_COLOURS: Readonly<Record<SignOrganisation, Readonly<{fill: string, text: string, abbreviation: string}>>> = {
|
|
97
|
+
fire: {fill: '#FA321E', text: '#000000', abbreviation: 'Fw'},
|
|
98
|
+
aid: {fill: '#FFFFFF', text: '#000000', abbreviation: 'HiOrg'},
|
|
99
|
+
thw: {fill: '#003399', text: '#FFFFFF', abbreviation: 'THW'},
|
|
100
|
+
command: {fill: '#FAFA00', text: '#000000', abbreviation: ''},
|
|
101
|
+
police: {fill: '#64DC32', text: '#000000', abbreviation: 'Pol'},
|
|
102
|
+
military: {fill: '#B4783C', text: '#FFFFFF', abbreviation: 'Bw'},
|
|
103
|
+
other: {fill: '#FA8C00', text: '#000000', abbreviation: 'Sonst.'},
|
|
104
|
+
civil: {fill: '#BEBEBE', text: '#000000', abbreviation: 'ZIV'},
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const BLACK = '#000000'
|
|
108
|
+
const WHITE = '#FFFFFF'
|
|
109
|
+
const HAZARD_RED = '#FA321E'
|
|
110
|
+
const MEASURE_BLUE = '#3264FA'
|
|
111
|
+
const STROKE = 3
|
|
112
|
+
|
|
113
|
+
/** Where a form lies on the canvas and where its writing, bars and short name go. */
|
|
114
|
+
interface Layout {
|
|
115
|
+
d: string
|
|
116
|
+
closed: boolean
|
|
117
|
+
left: number
|
|
118
|
+
right: number
|
|
119
|
+
top: number
|
|
120
|
+
bottom: number
|
|
121
|
+
textWidth: number
|
|
122
|
+
textY: number
|
|
123
|
+
/** The command bar along the top inside the form (3.1), following a curved top. */
|
|
124
|
+
commandBar: string
|
|
125
|
+
/** The logistics bar along the bottom inside the form (3.3). */
|
|
126
|
+
logisticsBar: string
|
|
127
|
+
/** Where the short name sits; outside the form where the form has no room for it. */
|
|
128
|
+
short: {x: number, y: number, inside: boolean}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** A layout with straight bars inset from the bounds and the short name in the lower right corner. */
|
|
132
|
+
function layout(d: string, left: number, right: number, top: number, bottom: number, textWidth: number, textY: number,
|
|
133
|
+
extra: Partial<Layout> = {}): Layout {
|
|
134
|
+
return {
|
|
135
|
+
d, closed: true, left, right, top, bottom, textWidth, textY,
|
|
136
|
+
commandBar: `M${left + 5} ${top + 6} H${right - 5}`,
|
|
137
|
+
logisticsBar: `M${left + 5} ${bottom - 6} H${right - 5}`,
|
|
138
|
+
short: {x: right - 14, y: bottom - 8, inside: true},
|
|
139
|
+
...extra,
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const SHORT_BESIDE = {x: 104, y: 42, inside: false}
|
|
144
|
+
|
|
145
|
+
/** The layout of each basic form. */
|
|
146
|
+
const FORMS: Record<BasicForm, Layout> = {
|
|
147
|
+
'formation': layout('M10 16 H110 V68 H10 Z', 10, 110, 16, 68, 86, 42),
|
|
148
|
+
'person': layout('M60 16 L86 42 L60 68 L34 42 Z', 34, 86, 16, 68, 30, 42,
|
|
149
|
+
{commandBar: 'M48 28 H72', logisticsBar: 'M48 56 H72', short: SHORT_BESIDE}),
|
|
150
|
+
'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'}),
|
|
151
|
+
'aircraft': layout('M22 62 A38 38 0 0 1 98 62 Z', 22, 98, 24, 62, 56, 48,
|
|
152
|
+
{commandBar: 'M40 34 H80', short: {x: 84, y: 56, inside: true}}),
|
|
153
|
+
'watercraft': layout('M22 20 A38 38 0 0 0 98 20 Z', 22, 98, 20, 58, 56, 34,
|
|
154
|
+
{logisticsBar: 'M40 48 H80', short: {x: 80, y: 28, inside: true}}),
|
|
155
|
+
'place': layout('M86 42 A26 26 0 1 1 34 42 A26 26 0 1 1 86 42 Z', 34, 86, 16, 68, 40, 42,
|
|
156
|
+
{commandBar: 'M42 26 H78', logisticsBar: 'M42 58 H78', short: SHORT_BESIDE}),
|
|
157
|
+
'building': layout('M24 32 L60 16 L96 32 V68 H24 Z', 24, 96, 16, 68, 60, 50, {commandBar: 'M29 38 H91'}),
|
|
158
|
+
'room': layout('M34 16 H86 V68 H34 Z', 34, 86, 16, 68, 44, 42, {short: SHORT_BESIDE}),
|
|
159
|
+
'area': layout('M28 30 Q34 16 54 20 Q78 12 90 24 Q100 36 92 50 Q96 64 76 66 Q58 70 44 64 Q24 66 22 52 Q18 40 28 30 Z',
|
|
160
|
+
22, 96, 16, 68, 56, 42, {commandBar: 'M34 28 H86', logisticsBar: 'M34 58 H86'}),
|
|
161
|
+
'measure': layout('M28 18 H92 L60 68 Z', 28, 92, 18, 68, 36, 34, {logisticsBar: 'M50 50 H70', short: SHORT_BESIDE}),
|
|
162
|
+
'hazard': layout('M60 16 L92 66 H28 Z', 28, 92, 16, 66, 36, 52, {commandBar: 'M50 32 H70', short: SHORT_BESIDE}),
|
|
163
|
+
'landmark': layout('M46 16 H74 V54 L60 68 L46 54 Z', 46, 74, 16, 68, 24, 36, {short: SHORT_BESIDE}),
|
|
164
|
+
'event': {...layout('M38 22 L60 64 L82 22', 38, 82, 22, 64, 30, 34, {short: SHORT_BESIDE}), closed: false},
|
|
165
|
+
'volunteer': layout('M47 29 A13 13 0 0 1 73 29 A13 13 0 0 1 73 55 A13 13 0 0 1 47 55 A13 13 0 0 1 47 29 Z',
|
|
166
|
+
34, 86, 16, 68, 34, 42, {commandBar: 'M46 28 H74', logisticsBar: 'M46 56 H74', short: SHORT_BESIDE}),
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** The colours a sign is drawn in. */
|
|
170
|
+
interface Paint {
|
|
171
|
+
fill: string
|
|
172
|
+
line: string
|
|
173
|
+
text: string
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* The colours of a sign. In black and white everything is black on white. Otherwise a hazard is
|
|
178
|
+
* red and a measure blue, whatever the organisation, and an event has no fill. Filled signs carry a
|
|
179
|
+
* black outline, outlined signs the organisation's colour (black for the white of the aid
|
|
180
|
+
* organisations). A sign without an organisation is drawn black on white, as chapter 1 shows the
|
|
181
|
+
* basic forms; a volunteer without one is grey, as 1.14 asks.
|
|
182
|
+
*/
|
|
183
|
+
function paint(spec: TacticalSignSpec): Paint {
|
|
184
|
+
const style = spec.style ?? 'filled'
|
|
185
|
+
if (style === 'mono') return {fill: WHITE, line: BLACK, text: BLACK}
|
|
186
|
+
if (spec.form === 'hazard') return {fill: 'none', line: HAZARD_RED, text: HAZARD_RED}
|
|
187
|
+
if (spec.form === 'measure') return {fill: 'none', line: MEASURE_BLUE, text: MEASURE_BLUE}
|
|
188
|
+
if (spec.form === 'event') return {fill: 'none', line: BLACK, text: BLACK}
|
|
189
|
+
const organisation = spec.organisation ?? (spec.form === 'volunteer' ? 'civil' : undefined)
|
|
190
|
+
if (!organisation) return {fill: WHITE, line: BLACK, text: BLACK}
|
|
191
|
+
const colour = ORGANISATION_COLOURS[organisation]
|
|
192
|
+
if (style === 'outline') {
|
|
193
|
+
const line = colour.fill === WHITE ? BLACK : colour.fill
|
|
194
|
+
return {fill: WHITE, line, text: line}
|
|
195
|
+
}
|
|
196
|
+
return {fill: colour.fill, line: BLACK, text: colour.text}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function dot(cx: number, cy: number): SvgElement {
|
|
200
|
+
return element('circle', {cx, cy, r: 3, fill: BLACK})
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function bar(cx: number, bottom: number): SvgElement {
|
|
204
|
+
return element('rect', {x: cx - 2.5, y: bottom - 12, width: 5, height: 12, fill: BLACK})
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/** The marks of a unit size or association, resting just above `above`. */
|
|
208
|
+
function sizeMark(size: SignSize, above: number): SvgElement[] {
|
|
209
|
+
const y = above - 7
|
|
210
|
+
switch (size) {
|
|
211
|
+
case 'squad': return [dot(60, y)]
|
|
212
|
+
case 'section': return [dot(60, y - 6), dot(60, y + 1)]
|
|
213
|
+
case 'group': return [dot(52, y), dot(68, y)]
|
|
214
|
+
case 'platoon': return [dot(50, y), dot(60, y), dot(70, y)]
|
|
215
|
+
case 'association-1': return [bar(60, above - 3)]
|
|
216
|
+
case 'association-2': return [bar(52, above - 3), bar(68, above - 3)]
|
|
217
|
+
case 'association-3': return [bar(48, above - 3), bar(60, above - 3), bar(72, above - 3)]
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const ABILITY_STROKE = 2.5
|
|
222
|
+
|
|
223
|
+
/** One part of an ability, drawn in its 100 × 60 box; `width` is the stroke width in that box. */
|
|
224
|
+
function abilityPart(part: AbilityPart, colour: string, width: number): SvgElement {
|
|
225
|
+
const stroke = {stroke: colour, 'stroke-width': round(width), 'stroke-linecap': 'round', 'stroke-linejoin': 'round'}
|
|
226
|
+
if ('text' in part) {
|
|
227
|
+
return {tag: 'text', attributes: {x: part.x, y: part.y, fill: colour, 'font-size': part.size, ...SIGN_FONT,
|
|
228
|
+
'text-anchor': 'middle', 'dominant-baseline': 'central'}, text: part.text}
|
|
229
|
+
}
|
|
230
|
+
const fill = part.filled ? colour : 'none'
|
|
231
|
+
if ('circle' in part) return element('circle', {cx: part.circle[0], cy: part.circle[1], r: part.circle[2], fill, ...stroke})
|
|
232
|
+
return element('path', {d: part.d, fill, ...stroke, ...(part.width ? {'stroke-width': round(part.width * width / ABILITY_STROKE)} : {})})
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** The room inside a form that abilities may take, clear of the designation and the command and logistics bars. */
|
|
236
|
+
function abilityRoom(spec: TacticalSignSpec, form: Layout): {left: number, top: number, width: number, height: number} {
|
|
237
|
+
const supplements = spec.supplements ?? []
|
|
238
|
+
const top = form.top + (supplements.includes('command') ? 12 : 4) + (spec.designation ? 10 : 0)
|
|
239
|
+
const bottom = form.bottom - (supplements.includes('logistics') ? 12 : 4)
|
|
240
|
+
return {left: form.left + 6, top, width: form.right - form.left - 12, height: bottom - top}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* The abilities inside a form: each gets an equal slice of the room, the first (main) one at the
|
|
245
|
+
* bottom, and is scaled evenly into it. A single ability that stretches spans the whole room
|
|
246
|
+
* instead, below a designation if there is one, as annex C draws it; its paths are stretched, its
|
|
247
|
+
* dots stay round.
|
|
248
|
+
* Stroke widths are set in each box so the lines keep the weight of the form's outline.
|
|
249
|
+
*/
|
|
250
|
+
function abilityMarks(spec: TacticalSignSpec, form: Layout, colour: string): SvgElement[] {
|
|
251
|
+
const names = spec.abilities ?? []
|
|
252
|
+
const room = abilityRoom(spec, form)
|
|
253
|
+
const only = names.length === 1 ? (ABILITIES[names[0]!] as Ability) : undefined
|
|
254
|
+
if (only?.stretch) {
|
|
255
|
+
const sx = room.width / 100
|
|
256
|
+
const sy = room.height / 60
|
|
257
|
+
const lines = only.parts.filter(part => !('circle' in part)).map(part => abilityPart(part, colour, ABILITY_STROKE / Math.min(sx, sy)))
|
|
258
|
+
const dots = only.parts.flatMap(part => 'circle' in part
|
|
259
|
+
? [element('circle', {cx: round(room.left + part.circle[0] * sx), cy: round(room.top + part.circle[1] * sy),
|
|
260
|
+
r: round(part.circle[2] * Math.min(sx, sy)), fill: part.filled ? colour : 'none', stroke: colour, 'stroke-width': ABILITY_STROKE})]
|
|
261
|
+
: [])
|
|
262
|
+
return [group(lines, {transform: `translate(${round(room.left)} ${round(room.top)}) scale(${round(sx)} ${round(sy)})`}), ...dots]
|
|
263
|
+
}
|
|
264
|
+
const slot = room.height / names.length
|
|
265
|
+
return names.map((name, index) => {
|
|
266
|
+
const scale = Math.min(room.width / 100, slot / 60)
|
|
267
|
+
const x = room.left + (room.width - 100 * scale) / 2
|
|
268
|
+
const y = room.top + slot * (names.length - 1 - index) + (slot - 60 * scale) / 2
|
|
269
|
+
const parts = ABILITIES[name].parts.map(part => abilityPart(part, colour, ABILITY_STROKE / scale))
|
|
270
|
+
return group(parts, {transform: `translate(${round(x)} ${round(y)}) scale(${round(scale)})`})
|
|
271
|
+
})
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function round(value: number): number {
|
|
275
|
+
return Math.round(value * 1000) / 1000
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/** The designation in the upper left corner of a form (field A), below a command bar if there is one. */
|
|
279
|
+
function designation(spec: TacticalSignSpec, text: string, form: Layout, colour: string): SvgElement {
|
|
280
|
+
const below = (spec.supplements ?? []).includes('command') ? 12 : 0
|
|
281
|
+
return {
|
|
282
|
+
tag: 'text',
|
|
283
|
+
attributes: {x: form.left + 5, y: form.top + 8 + below, fill: colour, 'font-size': 10, ...SIGN_FONT, 'dominant-baseline': 'central'},
|
|
284
|
+
text,
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/** A line of the given colour and width. */
|
|
289
|
+
function line(d: string, colour: string, width = STROKE): SvgElement {
|
|
290
|
+
return element('path', {d, fill: 'none', stroke: colour, 'stroke-width': width, 'stroke-linecap': 'round', 'stroke-linejoin': 'round'})
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const ROOF_HEIGHT = 11
|
|
294
|
+
|
|
295
|
+
/** The drawing of a supplementary sign of chapter 3 on a form. */
|
|
296
|
+
function supplement(kind: Supplement, form: Layout, colour: string): SvgElement[] {
|
|
297
|
+
const y = form.textY
|
|
298
|
+
switch (kind) {
|
|
299
|
+
case 'command': return [line(form.commandBar, BLACK, 5)]
|
|
300
|
+
case 'logistics': return [line(form.logisticsBar, BLACK, 5)]
|
|
301
|
+
case 'special-function': return [line(`M52 ${form.top + 8} H68`, colour)]
|
|
302
|
+
case 'uncrewed': return [line(`M50 ${y - 14} L60 ${y - 6} L70 ${y - 14}`, colour, 4)]
|
|
303
|
+
case 'bicycle': return [line(`M50 ${y - 6} Q60 ${y - 18} 70 ${y - 6} M60 ${y - 12} V${y + 12}`, colour)]
|
|
304
|
+
case 'motorcycle': return [line(`M50 ${y - 6} Q60 ${y - 18} 70 ${y - 6} M58 ${y - 12} V${y + 12} M62 ${y - 12} V${y + 12}`, colour)]
|
|
305
|
+
case 'roof': return [line(`M${form.left + 4} ${form.top - 3} L60 ${form.top - 3 - ROOF_HEIGHT} L${form.right - 4} ${form.top - 3}`, BLACK)]
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function wheel(cx: number, cy: number, colour: string): SvgElement {
|
|
310
|
+
return element('circle', {cx, cy, r: 4, fill: WHITE, stroke: colour, 'stroke-width': 2})
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/** The running gear below a vehicle. */
|
|
314
|
+
function driveMarks(drive: Drive, form: Layout, colour: string, framed: boolean): SvgElement[] {
|
|
315
|
+
const y = form.bottom + (framed ? 10 : 6)
|
|
316
|
+
const left = form.left + 8
|
|
317
|
+
const right = form.right - 8
|
|
318
|
+
const middle = (form.left + form.right) / 2
|
|
319
|
+
switch (drive) {
|
|
320
|
+
case 'road': return [wheel(left, y, colour), wheel(right, y, colour)]
|
|
321
|
+
case 'offroad': return [wheel(left, y, colour), wheel(middle, y, colour), wheel(right, y, colour)]
|
|
322
|
+
case 'all-terrain': return [line(`M${left} ${y} H${right}`, colour, 2), wheel(left, y, colour), wheel(middle, y, colour), wheel(right, y, colour)]
|
|
323
|
+
case 'amphibious': return [wheel(left, y, colour), wheel(right, y, colour),
|
|
324
|
+
line(`M${left + 8} ${y} Q${left + 16} ${y - 8} ${left + 24} ${y} T${left + 40} ${y} T${left + 56} ${y} T${left + 72} ${y}`, colour, 2)]
|
|
325
|
+
case 'tracked': return [element('rect', {x: form.left + 2, y: y - 4, width: form.right - form.left - 4, height: 10, rx: 5, fill: WHITE, stroke: colour, 'stroke-width': 2})]
|
|
326
|
+
case 'rail': return [wheel(left - 2, y, colour), wheel(left + 8, y, colour), wheel(right - 8, y, colour), wheel(right + 2, y, colour)]
|
|
327
|
+
case 'rail-capable': return [wheel(left - 2, y, colour), wheel(left + 8, y, colour), wheel(middle, y, colour), wheel(right - 8, y, colour), wheel(right + 2, y, colour)]
|
|
328
|
+
case 'towed-by-car': return [wheel(middle, y, colour)]
|
|
329
|
+
case 'towed-by-truck': return [wheel(middle - 5, y, colour), wheel(middle + 5, y, colour)]
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/** The hook of a roll-off container at the top left of a body. */
|
|
334
|
+
function rollOffHook(form: Layout, colour: string): SvgElement {
|
|
335
|
+
return line(`M${form.left + 4} ${form.top + 6} Q${form.left} ${form.top} ${form.left + 6} ${form.top - 2}`, colour, 2)
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/** The two lifting eyes of a swap body or container on top. */
|
|
339
|
+
function containerEyes(form: Layout, colour: string): SvgElement {
|
|
340
|
+
const top = form.top
|
|
341
|
+
return line(`M${form.left + 4} ${top} Q${form.left + 4} ${top - 6} ${form.left + 10} ${top - 6} Q${form.left + 16} ${top - 6} ${form.left + 16} ${top}`
|
|
342
|
+
+ ` M${form.right - 16} ${top} Q${form.right - 16} ${top - 6} ${form.right - 10} ${top - 6} Q${form.right - 4} ${top - 6} ${form.right - 4} ${top}`, colour, 2)
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/** The L-shaped frame that carries a swap body. */
|
|
346
|
+
function carrierFrame(form: Layout, colour: string): SvgElement {
|
|
347
|
+
return line(`M${form.left - 6} ${form.top + 2} V${form.bottom + 4} H${form.right + 4}`, colour, 2)
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/** The drawbar on the left of a trailer, at 60 % of its height, ending at the body or its frame. */
|
|
351
|
+
function drawbar(form: Layout, colour: string, framed: boolean): SvgElement {
|
|
352
|
+
const y = form.top + (form.bottom - form.top) * 0.6
|
|
353
|
+
const end = form.left - (framed ? 6 : 0)
|
|
354
|
+
return line(`M${end - 7} ${y} H${end} M${end - 7} ${y - 3} V${y + 3}`, colour, 2)
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
const FRAMED: ReadonlySet<VehicleBody> = new Set(['swap-loader', 'container-carrier', 'roll-off-trailer', 'container-trailer'])
|
|
358
|
+
const TRAILERS: ReadonlySet<VehicleBody> = new Set(['trailer', 'roll-off-trailer', 'container-trailer'])
|
|
359
|
+
const BOXES: ReadonlySet<VehicleBody> = new Set(['container-carrier', 'container-trailer', 'swap-container', 'swap-body'])
|
|
360
|
+
|
|
361
|
+
/** What a vehicle body adds around its form. */
|
|
362
|
+
function bodyMarks(body: VehicleBody, form: Layout, colour: string): SvgElement[] {
|
|
363
|
+
const marks: SvgElement[] = []
|
|
364
|
+
if (FRAMED.has(body)) marks.push(carrierFrame(form, colour))
|
|
365
|
+
if (TRAILERS.has(body)) marks.push(drawbar(form, colour, FRAMED.has(body)))
|
|
366
|
+
if (body === 'swap-loader' || body === 'roll-off-trailer' || body === 'roll-off-container') marks.push(rollOffHook(form, colour))
|
|
367
|
+
if (body === 'container-carrier' || body === 'container-trailer' || body === 'swap-container') marks.push(containerEyes(form, colour))
|
|
368
|
+
if (body === 'swap-body') marks.push(line(`M${form.left + 10} ${form.bottom} V${form.bottom + 8} M${form.right - 10} ${form.bottom} V${form.bottom + 8}`, colour, 2))
|
|
369
|
+
if (body === 'roll-container') marks.push(line(`M${form.right} ${form.top + 2} Q${form.right + 8} ${form.top - 4} ${form.right + 3} ${form.top - 9}`, colour, 2),
|
|
370
|
+
wheel(54, form.bottom + 6, colour), wheel(66, form.bottom + 6, colour))
|
|
371
|
+
return marks
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/** What 5.1.4 adds to an aircraft: the flying line beneath it or its drive inside. */
|
|
375
|
+
function flightMarks(flight: Flight, form: Layout, colour: string): SvgElement[] {
|
|
376
|
+
switch (flight) {
|
|
377
|
+
case 'flying': return [line(`M${form.left - 2} ${form.bottom + 8} H54 L60 ${form.bottom + 14} L66 ${form.bottom + 8} H${form.right + 2}`, colour, 2)]
|
|
378
|
+
case 'rotary-wing': return [element('path', {d: 'M40 40 L60 48 L80 40 V56 L60 48 L40 56 Z', fill: colour})]
|
|
379
|
+
case 'fixed-wing': return [element('path', {d: 'M60 48 C52 36 38 38 38 48 C38 58 52 60 60 48 C68 36 82 38 82 48 C82 58 68 60 60 48 Z', fill: colour})]
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* The layout of a sign: a protected land vehicle has a straight top and a curved underside, a body
|
|
385
|
+
* that is a container sits as a box above its gear, and a roll container is narrow.
|
|
386
|
+
*/
|
|
387
|
+
function layoutOf(spec: TacticalSignSpec): Layout {
|
|
388
|
+
const form = FORMS[spec.form]
|
|
389
|
+
if (spec.form === 'land-vehicle' && spec.protected) return {...form, d: 'M10 16 H110 V60 Q60 52 10 60 Z', commandBar: 'M15 22 H105'}
|
|
390
|
+
if (spec.body && BOXES.has(spec.body)) return layout('M14 18 H106 V60 H14 Z', 14, 106, 18, 60, 80, 39)
|
|
391
|
+
if (spec.body === 'roll-container') return layout('M42 18 Q60 22 78 18 V62 H42 Z', 42, 78, 18, 62, 30, 40, {short: SHORT_BESIDE})
|
|
392
|
+
return form
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/** The sign as a tree of SVG elements on the common canvas. */
|
|
396
|
+
export function tacticalSignTree(spec: TacticalSignSpec): SvgElement {
|
|
397
|
+
const form = layoutOf(spec)
|
|
398
|
+
const colours = paint(spec)
|
|
399
|
+
const supplements = spec.supplements ?? []
|
|
400
|
+
const parts: SvgElement[] = [element('path', {
|
|
401
|
+
d: form.d,
|
|
402
|
+
fill: form.closed ? colours.fill : 'none',
|
|
403
|
+
stroke: colours.line,
|
|
404
|
+
'stroke-width': STROKE,
|
|
405
|
+
'stroke-linejoin': 'round',
|
|
406
|
+
})]
|
|
407
|
+
if (spec.body) parts.push(...bodyMarks(spec.body, form, colours.line))
|
|
408
|
+
if (spec.drive) parts.push(...driveMarks(spec.drive, form, colours.line, spec.body !== undefined && FRAMED.has(spec.body)))
|
|
409
|
+
if (spec.flight) parts.push(...flightMarks(spec.flight, form, colours.line))
|
|
410
|
+
for (const kind of supplements) parts.push(...supplement(kind, form, colours.line))
|
|
411
|
+
if (spec.size) parts.push(...sizeMark(spec.size, form.top))
|
|
412
|
+
if (spec.abilities?.length) parts.push(...abilityMarks(spec, form, colours.text))
|
|
413
|
+
if (spec.designation) parts.push(designation(spec, spec.designation, form, colours.text))
|
|
414
|
+
if (spec.text) parts.push(label(spec.text, 60, form.textY, colours.text, form.textWidth))
|
|
415
|
+
const short = spec.abbreviation && spec.organisation ? ORGANISATION_COLOURS[spec.organisation].abbreviation : ''
|
|
416
|
+
if (short) parts.push(label(short, form.short.x, form.short.y, form.short.inside ? colours.text : BLACK, 24, 10))
|
|
417
|
+
return canvas([group(parts)])
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/** The sign as SVG markup, for map icons. */
|
|
421
|
+
export function tacticalSign(spec: TacticalSignSpec): string {
|
|
422
|
+
return renderSvg(tacticalSignTree(spec))
|
|
423
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The small SVG toolkit every symbol of the library is built with: a tree of elements that
|
|
3
|
+
* `TacticalSymbol` renders as Vue nodes and `renderSvg` writes as escaped markup.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** One SVG element of a symbol, with its attributes and either child elements or text. */
|
|
7
|
+
export interface SvgElement {
|
|
8
|
+
tag: string
|
|
9
|
+
attributes: Record<string, string | number>
|
|
10
|
+
children?: SvgElement[]
|
|
11
|
+
text?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** The attributes of an SVG element. */
|
|
15
|
+
export type Attributes = SvgElement['attributes']
|
|
16
|
+
|
|
17
|
+
/** The width of every symbol's canvas. */
|
|
18
|
+
export const SYMBOL_WIDTH = 120
|
|
19
|
+
/** The height of every symbol's canvas. */
|
|
20
|
+
export const SYMBOL_HEIGHT = 80
|
|
21
|
+
|
|
22
|
+
/** The default width of writing inside a symbol before it is squeezed. */
|
|
23
|
+
export const MAX_TEXT_WIDTH = 86
|
|
24
|
+
|
|
25
|
+
/** An SVG element without children. */
|
|
26
|
+
export function element(tag: string, attributes: Attributes): SvgElement {
|
|
27
|
+
return {tag, attributes}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** A group of elements. */
|
|
31
|
+
export function group(children: SvgElement[], attributes: Attributes = {}): SvgElement {
|
|
32
|
+
return {tag: 'g', attributes, children}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Escapes text for use inside SVG or HTML markup. */
|
|
36
|
+
export function escapeSvg(text: string): string {
|
|
37
|
+
return text.replace(/[&<>"']/g, character => `&#${character.charCodeAt(0)};`)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Writes a symbol tree as SVG markup, escaping every attribute value and text. Tag and attribute
|
|
42
|
+
* names are written as they are, so the tree must be built by code, as the trees of this library are.
|
|
43
|
+
*/
|
|
44
|
+
export function renderSvg(node: SvgElement): string {
|
|
45
|
+
const attributes = Object.entries(node.attributes)
|
|
46
|
+
.map(([name, value]) => ` ${name}="${escapeSvg(String(value))}"`)
|
|
47
|
+
.join('')
|
|
48
|
+
const content = node.text !== undefined
|
|
49
|
+
? escapeSvg(node.text)
|
|
50
|
+
: (node.children ?? []).map(renderSvg).join('')
|
|
51
|
+
return content ? `<${node.tag}${attributes}>${content}</${node.tag}>` : `<${node.tag}${attributes}/>`
|
|
52
|
+
}
|
|
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
|
+
|
|
57
|
+
/** Writing at a point, squeezed to `maxWidth` when it is long. */
|
|
58
|
+
export function label(text: string, x: number, y: number, colour: string, maxWidth = MAX_TEXT_WIDTH, size?: number): SvgElement {
|
|
59
|
+
const fontSize = size ?? (text.length > 8 ? 17 : 22)
|
|
60
|
+
const squeeze: Attributes = text.length * fontSize * 0.5 > maxWidth
|
|
61
|
+
? {textLength: maxWidth, lengthAdjust: 'spacingAndGlyphs'}
|
|
62
|
+
: {}
|
|
63
|
+
return {
|
|
64
|
+
tag: 'text',
|
|
65
|
+
attributes: {
|
|
66
|
+
x, y, fill: colour, 'font-size': fontSize, ...SIGN_FONT, 'text-anchor': 'middle',
|
|
67
|
+
'dominant-baseline': 'central', ...squeeze,
|
|
68
|
+
},
|
|
69
|
+
text,
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** The SVG element of the common 120 × 80 canvas around a symbol's content. */
|
|
74
|
+
export function canvas(children: SvgElement[]): SvgElement {
|
|
75
|
+
return {
|
|
76
|
+
tag: 'svg',
|
|
77
|
+
attributes: {
|
|
78
|
+
xmlns: 'http://www.w3.org/2000/svg', viewBox: `0 0 ${SYMBOL_WIDTH} ${SYMBOL_HEIGHT}`,
|
|
79
|
+
width: SYMBOL_WIDTH, height: SYMBOL_HEIGHT,
|
|
80
|
+
},
|
|
81
|
+
children,
|
|
82
|
+
}
|
|
83
|
+
}
|
package/src/symbols/tactical.ts
CHANGED
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
* image) for it to apply.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
import {canvas, element, label, renderSvg, type Attributes, type SvgElement} from './svg'
|
|
15
|
+
|
|
16
|
+
export {SYMBOL_HEIGHT, SYMBOL_WIDTH, escapeSvg, renderSvg, type SvgElement} from './svg'
|
|
17
|
+
|
|
14
18
|
/** The organisation a unit belongs to, which sets its colours. */
|
|
15
19
|
export type Organisation = 'fire' | 'medical'
|
|
16
20
|
|
|
@@ -43,23 +47,9 @@ export interface SymbolSpec {
|
|
|
43
47
|
size?: UnitSize
|
|
44
48
|
}
|
|
45
49
|
|
|
46
|
-
/** One SVG element of a symbol, with its attributes and either child elements or text. */
|
|
47
|
-
export interface SvgElement {
|
|
48
|
-
tag: string
|
|
49
|
-
attributes: Record<string, string | number>
|
|
50
|
-
children?: SvgElement[]
|
|
51
|
-
text?: string
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/** The width of every symbol's canvas. */
|
|
55
|
-
export const SYMBOL_WIDTH = 120
|
|
56
|
-
/** The height of every symbol's canvas. */
|
|
57
|
-
export const SYMBOL_HEIGHT = 80
|
|
58
|
-
|
|
59
50
|
const RED = 'var(--color-signal-500)'
|
|
60
51
|
const WHITE = 'white'
|
|
61
52
|
const STROKE = 3
|
|
62
|
-
const MAX_TEXT_WIDTH = 86
|
|
63
53
|
const SQUAD_TEXT_WIDTH = 62
|
|
64
54
|
|
|
65
55
|
interface Colours {
|
|
@@ -68,13 +58,6 @@ interface Colours {
|
|
|
68
58
|
text: string
|
|
69
59
|
}
|
|
70
60
|
|
|
71
|
-
type Attributes = SvgElement['attributes']
|
|
72
|
-
|
|
73
|
-
/** An SVG element without children. */
|
|
74
|
-
function element(tag: string, attributes: Attributes): SvgElement {
|
|
75
|
-
return {tag, attributes}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
61
|
/** The attributes of an outlined form. */
|
|
79
62
|
function outlined(fill: string, line: string): Attributes {
|
|
80
63
|
return {fill, stroke: line, 'stroke-width': STROKE}
|
|
@@ -92,42 +75,6 @@ function colours(organisation: Organisation): Colours {
|
|
|
92
75
|
: {fill: RED, line: RED, text: WHITE}
|
|
93
76
|
}
|
|
94
77
|
|
|
95
|
-
/** Escapes text for use inside SVG or HTML markup. */
|
|
96
|
-
export function escapeSvg(text: string): string {
|
|
97
|
-
return text.replace(/[&<>"']/g, character => `&#${character.charCodeAt(0)};`)
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Writes a symbol tree as SVG markup, escaping every attribute value and text. Tag and attribute
|
|
102
|
-
* names are written as they are, so the tree must be built by code, as the trees of this module are.
|
|
103
|
-
*/
|
|
104
|
-
export function renderSvg(node: SvgElement): string {
|
|
105
|
-
const attributes = Object.entries(node.attributes)
|
|
106
|
-
.map(([name, value]) => ` ${name}="${escapeSvg(String(value))}"`)
|
|
107
|
-
.join('')
|
|
108
|
-
const content = node.text !== undefined
|
|
109
|
-
? escapeSvg(node.text)
|
|
110
|
-
: (node.children ?? []).map(renderSvg).join('')
|
|
111
|
-
return content ? `<${node.tag}${attributes}>${content}</${node.tag}>` : `<${node.tag}${attributes}/>`
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/** The writing inside a symbol, squeezed to fit when it is long. */
|
|
115
|
-
function label(text: string, x: number, y: number, colour: string, maxWidth = MAX_TEXT_WIDTH): SvgElement {
|
|
116
|
-
const size = text.length > 8 ? 17 : 22
|
|
117
|
-
const squeeze: Attributes = text.length * size * 0.5 > maxWidth
|
|
118
|
-
? {textLength: maxWidth, lengthAdjust: 'spacingAndGlyphs'}
|
|
119
|
-
: {}
|
|
120
|
-
return {
|
|
121
|
-
tag: 'text',
|
|
122
|
-
attributes: {
|
|
123
|
-
x, y, fill: colour, 'font-size': size, 'font-weight': 700,
|
|
124
|
-
'font-family': 'Barlow Condensed, Barlow, sans-serif', 'text-anchor': 'middle',
|
|
125
|
-
'dominant-baseline': 'central', ...squeeze,
|
|
126
|
-
},
|
|
127
|
-
text,
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
78
|
/** Where the dots of each unit size sit above the symbol: one, two stacked, two apart, three in a row. */
|
|
132
79
|
const SIZE_DOTS: Record<UnitSize, [number, number][]> = {
|
|
133
80
|
squad: [[60, 6]],
|
|
@@ -220,14 +167,3 @@ export function markSymbol(kind: MarkKind): string {
|
|
|
220
167
|
return renderSvg(markSymbolTree(kind))
|
|
221
168
|
}
|
|
222
169
|
|
|
223
|
-
/** The SVG element of the common canvas around a symbol's content. */
|
|
224
|
-
function canvas(children: SvgElement[]): SvgElement {
|
|
225
|
-
return {
|
|
226
|
-
tag: 'svg',
|
|
227
|
-
attributes: {
|
|
228
|
-
xmlns: 'http://www.w3.org/2000/svg', viewBox: `0 0 ${SYMBOL_WIDTH} ${SYMBOL_HEIGHT}`,
|
|
229
|
-
width: SYMBOL_WIDTH, height: SYMBOL_HEIGHT,
|
|
230
|
-
},
|
|
231
|
-
children,
|
|
232
|
-
}
|
|
233
|
-
}
|
package/src/vite/logo.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type {Plugin} from 'vite'
|
|
|
4
4
|
import {type RootFile, rootFilesPlugin} from './root-files.js'
|
|
5
5
|
|
|
6
6
|
/** The tools for which `@emberbox/ui` ships a logo. */
|
|
7
|
-
export type Logo = 'emberbox' | 'alarmzettel' | 'statussim' | 'calltaker' | 'planspiel'
|
|
7
|
+
export type Logo = 'emberbox' | 'alarmzettel' | 'statussim' | 'calltaker' | 'planspiel' | 'lernkarten'
|
|
8
8
|
|
|
9
9
|
const LOGOS = fileURLToPath(new URL('../../logos/', import.meta.url))
|
|
10
10
|
|