@orbat-mapper/control-measures 0.2.0-alpha.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Orbat Mapper
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,110 @@
1
+ # @orbat-mapper/control-measures
2
+
3
+ A TypeScript library for generating tactical control measures as GeoJSON, according to MIL-STD-2525 and APP-6 conventions.
4
+
5
+ ## Features
6
+
7
+ - Framework-agnostic: outputs plain GeoJSON.
8
+ - Type-safe: full TypeScript typings.
9
+ - Map-friendly: works with Leaflet, MapLibre, OpenLayers, or any GeoJSON consumer.
10
+ - Registry-driven: a single `renderControlMeasure(cm, options)` entry point, plus a metadata catalog for discovering every measure and its options.
11
+ - Validation controls: optional `validationMode` per render.
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ # npm
17
+ npm install @orbat-mapper/control-measures
18
+
19
+ # pnpm
20
+ pnpm add @orbat-mapper/control-measures
21
+ ```
22
+
23
+ ## Quick Start
24
+
25
+ The library is registry-driven. Describe a control measure as a `ControlMeasure`
26
+ object — its `kind`, `controlPoints`, and optional `options` — then render it:
27
+
28
+ ```ts
29
+ import { renderControlMeasure, type ControlMeasure } from "@orbat-mapper/control-measures";
30
+
31
+ const mainAttack: ControlMeasure<"main-attack"> = {
32
+ id: "alpha",
33
+ kind: "main-attack",
34
+ controlPoints: [
35
+ [10, 10], // tip
36
+ [5, 5], // spine
37
+ [0, 0], // neck
38
+ [2, 6], // width control
39
+ ],
40
+ };
41
+
42
+ const render = renderControlMeasure(mainAttack, { validationMode: "warn" });
43
+ // render is a ControlMeasureRender: a GeoJSON FeatureCollection whose features
44
+ // carry stable ids (`${cm.id}:${part}:${index}`) and resolved style hints.
45
+ ```
46
+
47
+ `renderControlMeasure` returns a `ControlMeasureRender` — a GeoJSON
48
+ `FeatureCollection` of `FeaturePartProps`-typed features.
49
+
50
+ ## Discovering measures and options
51
+
52
+ Rather than importing per-measure generators, use the catalog to enumerate the
53
+ available control measures and their parameters:
54
+
55
+ ```ts
56
+ import {
57
+ CONTROL_MEASURE_IDS,
58
+ listControlMeasureMetadata,
59
+ getControlMeasureMetadata,
60
+ getDefaultOptions,
61
+ } from "@orbat-mapper/control-measures";
62
+
63
+ CONTROL_MEASURE_IDS; // readonly list of every control-measure id
64
+ listControlMeasureMetadata(); // metadata (geometry, required points, params, symbology)
65
+ getControlMeasureMetadata("block"); // metadata for one measure
66
+ getDefaultOptions("block"); // default options object for one measure
67
+ ```
68
+
69
+ Each measure also exports its options type and defaults constant, e.g.
70
+ `BlockOptions` / `DEFAULT_BLOCK_OPTIONS`, `MainAttackOptions` /
71
+ `DEFAULT_MAIN_ATTACK_OPTIONS`.
72
+
73
+ ## Validation behavior
74
+
75
+ `renderControlMeasure` accepts a `RenderOptions` object whose `validationMode`
76
+ controls how invalid coordinate input is handled:
77
+
78
+ - `validationMode: "silent" | "warn" | "throw"`
79
+
80
+ When omitted, validation follows each measure's built-in default. `"throw"` is
81
+ useful for strict integrations and tests.
82
+
83
+ ## Supported control measures
84
+
85
+ | `kind` | Measure |
86
+ | --- | --- |
87
+ | `ambush` | Ambush |
88
+ | `search-area` | Search Area |
89
+ | `main-attack` | Main Attack |
90
+ | `supporting-attack` | Supporting Attack |
91
+ | `airborne-attack` | Airborne Attack |
92
+ | `attack-helicopter` | Attack Helicopter |
93
+ | `support-by-fire` | Support by Fire |
94
+ | `attack-by-fire` | Attack by Fire |
95
+ | `flot` | FLOT (Forward Line of Own Troops) |
96
+ | `breach` | Breach |
97
+ | `bypass` | Bypass |
98
+ | `canalize` | Canalize |
99
+ | `fortified-line` | Fortified Line |
100
+ | `fortified-area` | Fortified Area |
101
+ | `block` | Block |
102
+ | `disrupt` | Disrupt |
103
+ | `fix` | Fix |
104
+ | `obstacle-bypass-easy` | Obstacle Bypass (Easy) |
105
+ | `obstacle-bypass-difficult` | Obstacle Bypass (Difficult) |
106
+ | `obstacle-bypass-impossible` | Obstacle Bypass (Impossible) |
107
+
108
+ ## License
109
+
110
+ MIT