@orbat-mapper/tactical-map-sheet 0.1.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.
@@ -0,0 +1,425 @@
1
+ import { ControlMeasure, PatternId, TextAmplifiers } from "@orbat-mapper/control-measures";
2
+
3
+ //#region ../../node_modules/.pnpm/@types+geojson@7946.0.16/node_modules/@types/geojson/index.d.ts
4
+ /**
5
+ * The value values for the "type" property of GeoJSON Objects.
6
+ * https://tools.ietf.org/html/rfc7946#section-1.4
7
+ */
8
+ type GeoJsonTypes = GeoJSON["type"];
9
+ /**
10
+ * Bounding box
11
+ * https://tools.ietf.org/html/rfc7946#section-5
12
+ */
13
+ type BBox = [number, number, number, number] | [number, number, number, number, number, number];
14
+ /**
15
+ * A Position is an array of coordinates.
16
+ * https://tools.ietf.org/html/rfc7946#section-3.1.1
17
+ * Array should contain between two and three elements.
18
+ * The previous GeoJSON specification allowed more elements (e.g., which could be used to represent M values),
19
+ * but the current specification only allows X, Y, and (optionally) Z to be defined.
20
+ *
21
+ * Note: the type will not be narrowed down to `[number, number] | [number, number, number]` due to
22
+ * marginal benefits and the large impact of breaking change.
23
+ *
24
+ * See previous discussions on the type narrowing:
25
+ * - {@link https://github.com/DefinitelyTyped/DefinitelyTyped/pull/21590|Nov 2017}
26
+ * - {@link https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/67773|Dec 2023}
27
+ * - {@link https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/71441| Dec 2024}
28
+ *
29
+ * One can use a
30
+ * {@link https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates|user-defined type guard that returns a type predicate}
31
+ * to determine if a position is a 2D or 3D position.
32
+ *
33
+ * @example
34
+ * import type { Position } from 'geojson';
35
+ *
36
+ * type StrictPosition = [x: number, y: number] | [x: number, y: number, z: number]
37
+ *
38
+ * function isStrictPosition(position: Position): position is StrictPosition {
39
+ * return position.length === 2 || position.length === 3
40
+ * };
41
+ *
42
+ * let position: Position = [-116.91, 45.54];
43
+ *
44
+ * let x: number;
45
+ * let y: number;
46
+ * let z: number | undefined;
47
+ *
48
+ * if (isStrictPosition(position)) {
49
+ * // `tsc` would throw an error if we tried to destructure a fourth parameter
50
+ * [x, y, z] = position;
51
+ * } else {
52
+ * throw new TypeError("Position is not a 2D or 3D point");
53
+ * }
54
+ */
55
+ type Position = number[];
56
+ /**
57
+ * The base GeoJSON object.
58
+ * https://tools.ietf.org/html/rfc7946#section-3
59
+ * The GeoJSON specification also allows foreign members
60
+ * (https://tools.ietf.org/html/rfc7946#section-6.1)
61
+ * Developers should use "&" type in TypeScript or extend the interface
62
+ * to add these foreign members.
63
+ */
64
+ interface GeoJsonObject {
65
+ // Don't include foreign members directly into this type def.
66
+ // in order to preserve type safety.
67
+ // [key: string]: any;
68
+ /**
69
+ * Specifies the type of GeoJSON object.
70
+ */
71
+ type: GeoJsonTypes;
72
+ /**
73
+ * Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections.
74
+ * The value of the bbox member is an array of length 2*n where n is the number of dimensions
75
+ * represented in the contained geometries, with all axes of the most southwesterly point
76
+ * followed by all axes of the more northeasterly point.
77
+ * The axes order of a bbox follows the axes order of geometries.
78
+ * https://tools.ietf.org/html/rfc7946#section-5
79
+ */
80
+ bbox?: BBox | undefined;
81
+ }
82
+ /**
83
+ * Union of GeoJSON objects.
84
+ */
85
+ type GeoJSON<G extends Geometry | null = Geometry, P = GeoJsonProperties> = G | Feature<G, P> | FeatureCollection<G, P>;
86
+ /**
87
+ * Geometry object.
88
+ * https://tools.ietf.org/html/rfc7946#section-3
89
+ */
90
+ type Geometry = Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon | GeometryCollection;
91
+ /**
92
+ * Point geometry object.
93
+ * https://tools.ietf.org/html/rfc7946#section-3.1.2
94
+ */
95
+ interface Point extends GeoJsonObject {
96
+ type: "Point";
97
+ coordinates: Position;
98
+ }
99
+ /**
100
+ * MultiPoint geometry object.
101
+ * https://tools.ietf.org/html/rfc7946#section-3.1.3
102
+ */
103
+ interface MultiPoint extends GeoJsonObject {
104
+ type: "MultiPoint";
105
+ coordinates: Position[];
106
+ }
107
+ /**
108
+ * LineString geometry object.
109
+ * https://tools.ietf.org/html/rfc7946#section-3.1.4
110
+ */
111
+ interface LineString extends GeoJsonObject {
112
+ type: "LineString";
113
+ coordinates: Position[];
114
+ }
115
+ /**
116
+ * MultiLineString geometry object.
117
+ * https://tools.ietf.org/html/rfc7946#section-3.1.5
118
+ */
119
+ interface MultiLineString extends GeoJsonObject {
120
+ type: "MultiLineString";
121
+ coordinates: Position[][];
122
+ }
123
+ /**
124
+ * Polygon geometry object.
125
+ * https://tools.ietf.org/html/rfc7946#section-3.1.6
126
+ */
127
+ interface Polygon extends GeoJsonObject {
128
+ type: "Polygon";
129
+ coordinates: Position[][];
130
+ }
131
+ /**
132
+ * MultiPolygon geometry object.
133
+ * https://tools.ietf.org/html/rfc7946#section-3.1.7
134
+ */
135
+ interface MultiPolygon extends GeoJsonObject {
136
+ type: "MultiPolygon";
137
+ coordinates: Position[][][];
138
+ }
139
+ /**
140
+ * Geometry Collection
141
+ * https://tools.ietf.org/html/rfc7946#section-3.1.8
142
+ */
143
+ interface GeometryCollection<G extends Geometry = Geometry> extends GeoJsonObject {
144
+ type: "GeometryCollection";
145
+ geometries: G[];
146
+ }
147
+ type GeoJsonProperties = {
148
+ [name: string]: any;
149
+ } | null;
150
+ /**
151
+ * A feature object which contains a geometry and associated properties.
152
+ * https://tools.ietf.org/html/rfc7946#section-3.2
153
+ */
154
+ interface Feature<G extends Geometry | null = Geometry, P = GeoJsonProperties> extends GeoJsonObject {
155
+ type: "Feature";
156
+ /**
157
+ * The feature's geometry
158
+ */
159
+ geometry: G;
160
+ /**
161
+ * A value that uniquely identifies this feature in a
162
+ * https://tools.ietf.org/html/rfc7946#section-3.2.
163
+ */
164
+ id?: string | number | undefined;
165
+ /**
166
+ * Properties associated with this feature.
167
+ */
168
+ properties: P;
169
+ }
170
+ /**
171
+ * A collection of feature objects.
172
+ * https://tools.ietf.org/html/rfc7946#section-3.3
173
+ */
174
+ interface FeatureCollection<G extends Geometry | null = Geometry, P = GeoJsonProperties> extends GeoJsonObject {
175
+ type: "FeatureCollection";
176
+ features: Array<Feature<G, P>>;
177
+ }
178
+ //#endregion
179
+ //#region src/projection/types.d.ts
180
+ type GeographicPosition = readonly number[];
181
+ interface UtmCrs {
182
+ readonly kind: "utm";
183
+ readonly zone: number;
184
+ readonly hemisphere: "north" | "south";
185
+ }
186
+ interface UpsCrs {
187
+ readonly kind: "ups";
188
+ readonly hemisphere: "north" | "south";
189
+ }
190
+ type GridCrs = UtmCrs | UpsCrs;
191
+ //#endregion
192
+ //#region src/scene.d.ts
193
+ interface SceneRectangle {
194
+ readonly xMm: number;
195
+ readonly yMm: number;
196
+ readonly widthMm: number;
197
+ readonly heightMm: number;
198
+ }
199
+ interface PhysicalPageSize {
200
+ readonly widthMm: number;
201
+ readonly heightMm: number;
202
+ }
203
+ interface MapSheetPatternIdentity {
204
+ readonly id: string;
205
+ readonly pattern: PatternId;
206
+ readonly color: string;
207
+ readonly tileWidthMm: number;
208
+ readonly tileHeightMm: number;
209
+ readonly phaseXMm: number;
210
+ readonly phaseYMm: number;
211
+ }
212
+ //#endregion
213
+ //#region src/mgrs-grid.d.ts
214
+ declare const SUPPORTED_INTERVALS: readonly [100, 1000, 10000, 100000];
215
+ interface MgrsGridOptions {
216
+ readonly intervalMeters?: (typeof SUPPORTED_INTERVALS)[number];
217
+ readonly precision?: 0 | 1 | 2 | 3;
218
+ readonly color?: string;
219
+ readonly lineWidthCssPixels?: number;
220
+ readonly labelSizeCssPixels?: number;
221
+ }
222
+ interface ResolvedMgrsGridMetadata {
223
+ readonly kind: "mgrs";
224
+ readonly intervalMeters: number;
225
+ readonly precision: number;
226
+ }
227
+ //#endregion
228
+ //#region src/marginalia.d.ts
229
+ interface MapSheetMetadata {
230
+ readonly title?: string;
231
+ readonly subtitle?: string;
232
+ readonly classification?: string;
233
+ readonly preparedBy?: string;
234
+ }
235
+ interface MapSheetMarginaliaOptions {
236
+ readonly color?: string;
237
+ readonly showScale?: boolean;
238
+ readonly showScaleBar?: boolean;
239
+ readonly showGridAndNorth?: boolean;
240
+ readonly showRegistrationMarks?: boolean;
241
+ readonly showCalibrationMarks?: boolean;
242
+ readonly showFootprint?: boolean;
243
+ }
244
+ //#endregion
245
+ //#region src/vector-symbol.d.ts
246
+ type MapSheetSymbolSize = {
247
+ readonly value: number;
248
+ readonly unit: "pixels";
249
+ } | {
250
+ readonly value: number;
251
+ readonly unit: "meters";
252
+ readonly minPixels?: number;
253
+ readonly maxPixels?: number;
254
+ };
255
+ interface VectorSymbolAnchor {
256
+ readonly x: number;
257
+ readonly y: number;
258
+ }
259
+ interface ControlledVectorSymbol {
260
+ readonly resourceId: string;
261
+ readonly svg: string;
262
+ readonly octagonSize: number;
263
+ readonly width: number;
264
+ readonly height: number;
265
+ readonly anchor: VectorSymbolAnchor;
266
+ readonly octagonAnchor: VectorSymbolAnchor;
267
+ readonly valid?: boolean;
268
+ readonly validation?: unknown;
269
+ }
270
+ interface MapSheetPointSymbol {
271
+ readonly id: string;
272
+ readonly kind: "point-symbol";
273
+ readonly sidc: string;
274
+ readonly position: Position;
275
+ readonly rotation: number;
276
+ readonly size: MapSheetSymbolSize;
277
+ readonly textAmplifiers?: TextAmplifiers;
278
+ readonly graphicModifiers?: {
279
+ readonly direction?: number;
280
+ };
281
+ readonly style?: {
282
+ readonly opacity?: number;
283
+ readonly colors?: {
284
+ readonly fill?: string;
285
+ readonly frame?: string;
286
+ readonly icon?: string;
287
+ readonly info?: string;
288
+ readonly outline?: string;
289
+ };
290
+ readonly monoColor?: string;
291
+ readonly outlineWidth?: number;
292
+ readonly fill?: boolean;
293
+ readonly frame?: boolean;
294
+ readonly icon?: boolean;
295
+ };
296
+ readonly rendererOptions?: {
297
+ readonly milsymbol?: Record<string, unknown>;
298
+ };
299
+ }
300
+ interface MapSheetCustomSymbol {
301
+ readonly id: string;
302
+ readonly kind: "custom-symbol";
303
+ readonly position: Position;
304
+ readonly rotation: number;
305
+ readonly size: MapSheetSymbolSize;
306
+ readonly opacity?: number;
307
+ readonly vector: ControlledVectorSymbol;
308
+ }
309
+ interface MapSheetPointSymbolCapability {
310
+ render(symbol: MapSheetPointSymbol): ControlledVectorSymbol;
311
+ }
312
+ //#endregion
313
+ //#region src/render-layers.d.ts
314
+ interface MapSheetPortrayalDefaults {
315
+ readonly symbolColor?: string;
316
+ readonly strokeWidthCssPixels?: number;
317
+ readonly strokeDashCssPixels?: readonly number[];
318
+ readonly lineCap?: "butt" | "round" | "square";
319
+ readonly lineJoin?: "bevel" | "round" | "miter";
320
+ readonly labelHeightCssPixels?: number;
321
+ readonly labelSizeClampCssPixels?: {
322
+ readonly min: number;
323
+ readonly max: number;
324
+ };
325
+ }
326
+ type MapSheetAuthoredGraphic = ControlMeasure | MapSheetPointSymbol | MapSheetCustomSymbol;
327
+ interface AuthoredMapSheetGraphic {
328
+ readonly graphic: MapSheetAuthoredGraphic;
329
+ }
330
+ interface TacticalMapSheetLayer {
331
+ readonly id: string;
332
+ readonly graphics: readonly AuthoredMapSheetGraphic[];
333
+ readonly portrayal?: MapSheetPortrayalDefaults;
334
+ }
335
+ interface IdentifiedGraphicWarning {
336
+ readonly layerId: string;
337
+ readonly graphicId: string;
338
+ }
339
+ interface GraphicClippedWarning extends IdentifiedGraphicWarning {
340
+ readonly code: "graphic-clipped";
341
+ }
342
+ interface GraphicOutsideFrameWarning extends IdentifiedGraphicWarning {
343
+ readonly code: "graphic-outside-frame";
344
+ }
345
+ interface GraphicHiddenWarning extends IdentifiedGraphicWarning {
346
+ readonly code: "graphic-hidden";
347
+ }
348
+ interface PointSymbolFallbackWarning extends IdentifiedGraphicWarning {
349
+ readonly code: "point-symbol-fallback";
350
+ }
351
+ type GraphicVisibilityWarning = GraphicClippedWarning | GraphicOutsideFrameWarning | GraphicHiddenWarning;
352
+ type GraphicRenderWarning = GraphicVisibilityWarning | PointSymbolFallbackWarning;
353
+ //#endregion
354
+ //#region src/create-tactical-map-sheet.d.ts
355
+ interface MapSheetPageInput extends PhysicalPageSize {
356
+ readonly marginMm?: number;
357
+ readonly background?: string | "transparent";
358
+ readonly orientation?: "portrait" | "landscape";
359
+ }
360
+ interface TacticalMapSheetRequest {
361
+ readonly page: MapSheetPageInput;
362
+ readonly mapFrame?: SceneRectangle;
363
+ readonly center: GeographicPosition;
364
+ readonly scaleDenominator: number;
365
+ readonly projection?: "auto" | UtmCrs | UpsCrs;
366
+ readonly grid?: MgrsGridOptions | false;
367
+ readonly layers?: readonly TacticalMapSheetLayer[];
368
+ readonly pointSymbols?: MapSheetPointSymbolCapability;
369
+ readonly marginalia?: MapSheetMarginaliaOptions | false;
370
+ readonly metadata?: MapSheetMetadata;
371
+ }
372
+ type UtmProjection = UtmCrs;
373
+ type UpsProjection = UpsCrs;
374
+ interface CrossZoneFootprintWarning {
375
+ readonly code: "cross-zone-footprint";
376
+ readonly selectedZone: number;
377
+ readonly intersectedZones: readonly number[];
378
+ }
379
+ interface CrossProjectionFootprintWarning {
380
+ readonly code: "cross-projection-footprint";
381
+ readonly selectedProjection: "utm" | "ups";
382
+ readonly intersectedProjections: readonly ["ups", "utm"];
383
+ }
384
+ interface ScaleDeviationWarning {
385
+ readonly code: "scale-deviation";
386
+ readonly maximumRelativeDeviation: number;
387
+ }
388
+ type MapSheetProjectionWarning = CrossZoneFootprintWarning | CrossProjectionFootprintWarning | ScaleDeviationWarning;
389
+ type TacticalMapSheetWarning = MapSheetProjectionWarning | GraphicRenderWarning;
390
+ interface MapSheetFontIdentity {
391
+ readonly family: "Open Sans";
392
+ readonly style: "Regular" | "Italic" | "Light";
393
+ readonly version: string;
394
+ readonly sha256: string;
395
+ readonly license: string;
396
+ readonly provenance: string;
397
+ }
398
+ interface TacticalMapSheetResources {
399
+ readonly fonts: readonly MapSheetFontIdentity[];
400
+ readonly patterns: readonly MapSheetPatternIdentity[];
401
+ }
402
+ interface ResolvedMapSheetMetadata {
403
+ readonly center: Position;
404
+ readonly scaleDenominator: number;
405
+ readonly page: PhysicalPageSize;
406
+ readonly mapFrame: SceneRectangle;
407
+ readonly projection: GridCrs & {
408
+ readonly epsg: number;
409
+ readonly centerPointScale: number;
410
+ readonly centerConvergenceDegrees: number;
411
+ readonly maximumFrameScaleDeviation: number;
412
+ };
413
+ readonly grid?: ResolvedMgrsGridMetadata;
414
+ readonly document?: MapSheetMetadata;
415
+ }
416
+ interface TacticalMapSheetResult {
417
+ readonly svg: string;
418
+ readonly footprint: Polygon;
419
+ readonly warnings: readonly TacticalMapSheetWarning[];
420
+ readonly metadata: ResolvedMapSheetMetadata;
421
+ readonly resources: TacticalMapSheetResources;
422
+ }
423
+ declare function createTacticalMapSheet(request: TacticalMapSheetRequest): TacticalMapSheetResult;
424
+ //#endregion
425
+ export { MgrsGridOptions as A, MapSheetCustomSymbol as C, VectorSymbolAnchor as D, MapSheetSymbolSize as E, MapSheetPatternIdentity as M, Polygon as N, MapSheetMarginaliaOptions as O, ControlledVectorSymbol as S, MapSheetPointSymbolCapability as T, GraphicOutsideFrameWarning as _, ResolvedMapSheetMetadata as a, PointSymbolFallbackWarning as b, TacticalMapSheetResources as c, UpsProjection as d, UtmProjection as f, GraphicHiddenWarning as g, GraphicClippedWarning as h, MapSheetPageInput as i, ResolvedMgrsGridMetadata as j, MapSheetMetadata as k, TacticalMapSheetResult as l, AuthoredMapSheetGraphic as m, CrossZoneFootprintWarning as n, ScaleDeviationWarning as o, createTacticalMapSheet as p, MapSheetFontIdentity as r, TacticalMapSheetRequest as s, CrossProjectionFootprintWarning as t, TacticalMapSheetWarning as u, GraphicRenderWarning as v, MapSheetPointSymbol as w, TacticalMapSheetLayer as x, MapSheetPortrayalDefaults as y };
@@ -0,0 +1,2 @@
1
+ import { A as MgrsGridOptions, C as MapSheetCustomSymbol, D as VectorSymbolAnchor, E as MapSheetSymbolSize, M as MapSheetPatternIdentity, O as MapSheetMarginaliaOptions, S as ControlledVectorSymbol, T as MapSheetPointSymbolCapability, _ as GraphicOutsideFrameWarning, a as ResolvedMapSheetMetadata, b as PointSymbolFallbackWarning, c as TacticalMapSheetResources, d as UpsProjection, f as UtmProjection, g as GraphicHiddenWarning, h as GraphicClippedWarning, i as MapSheetPageInput, j as ResolvedMgrsGridMetadata, k as MapSheetMetadata, l as TacticalMapSheetResult, m as AuthoredMapSheetGraphic, n as CrossZoneFootprintWarning, o as ScaleDeviationWarning, p as createTacticalMapSheet, r as MapSheetFontIdentity, s as TacticalMapSheetRequest, t as CrossProjectionFootprintWarning, u as TacticalMapSheetWarning, v as GraphicRenderWarning, w as MapSheetPointSymbol, x as TacticalMapSheetLayer, y as MapSheetPortrayalDefaults } from "./create-tactical-map-sheet-DAKVJ3Bx.mjs";
2
+ export { type AuthoredMapSheetGraphic, type ControlledVectorSymbol, type CrossProjectionFootprintWarning, type CrossZoneFootprintWarning, type GraphicClippedWarning, type GraphicHiddenWarning, type GraphicOutsideFrameWarning, type GraphicRenderWarning, type MapSheetCustomSymbol, type MapSheetFontIdentity, type MapSheetMarginaliaOptions, type MapSheetMetadata, type MapSheetPageInput, type MapSheetPatternIdentity, type MapSheetPointSymbol, type MapSheetPointSymbolCapability, type MapSheetPortrayalDefaults, type MapSheetSymbolSize, type MgrsGridOptions, type PointSymbolFallbackWarning, type ResolvedMapSheetMetadata, type ResolvedMgrsGridMetadata, type ScaleDeviationWarning, type TacticalMapSheetLayer, type TacticalMapSheetRequest, type TacticalMapSheetResources, type TacticalMapSheetResult, type TacticalMapSheetWarning, type UpsProjection, type UtmProjection, type VectorSymbolAnchor, createTacticalMapSheet };
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import { t as createTacticalMapSheet } from "./create-tactical-map-sheet-6DtvTi2G.mjs";
2
+ export { createTacticalMapSheet };
package/dist/pdf.d.mts ADDED
@@ -0,0 +1,13 @@
1
+ import { N as Polygon, a as ResolvedMapSheetMetadata, c as TacticalMapSheetResources, s as TacticalMapSheetRequest, u as TacticalMapSheetWarning } from "./create-tactical-map-sheet-DAKVJ3Bx.mjs";
2
+
3
+ //#region src/pdf.d.ts
4
+ interface TacticalMapSheetPdfResult {
5
+ readonly pdf: Uint8Array;
6
+ readonly footprint: Polygon;
7
+ readonly warnings: readonly TacticalMapSheetWarning[];
8
+ readonly metadata: ResolvedMapSheetMetadata;
9
+ readonly resources: TacticalMapSheetResources;
10
+ }
11
+ declare function renderMapSheetPdf(request: TacticalMapSheetRequest): TacticalMapSheetPdfResult;
12
+ //#endregion
13
+ export { TacticalMapSheetPdfResult, renderMapSheetPdf };