@orbat-mapper/control-measures 0.2.0-alpha.3 → 0.2.0-alpha.5
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/{index-BJYbQlzo.d.mts → index-Ddt-obht.d.mts} +59 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/preview/index.d.mts +1 -1
- package/dist/preview/index.mjs +1 -1
- package/dist/{renderControlMeasure-DkXDSrLz.mjs → renderControlMeasure-CDCoQlZ-.mjs} +329 -24
- package/package.json +1 -1
|
@@ -36,6 +36,12 @@ interface ControlMeasureDrawRule {
|
|
|
36
36
|
* Defaults to 0 (the entire array is user-clicked spine). See ADR-0008.
|
|
37
37
|
*/
|
|
38
38
|
readonly trailingFixedSlots?: number;
|
|
39
|
+
/**
|
|
40
|
+
* The user-spine points form a closed ring even though the first point is not
|
|
41
|
+
* duplicated at the end. TacticalDraw uses this to treat the last→first edge
|
|
42
|
+
* like every other edge for completion and midpoint insertion.
|
|
43
|
+
*/
|
|
44
|
+
readonly closedRing?: boolean;
|
|
39
45
|
derive(points: readonly Position[]): Position[];
|
|
40
46
|
transform(event: AnchorTransformEvent): Position[];
|
|
41
47
|
}
|
|
@@ -43,7 +49,7 @@ interface ControlMeasureDrawRule {
|
|
|
43
49
|
//#region src/metadata.d.ts
|
|
44
50
|
type ControlMeasureGeometryType = Geometry["type"];
|
|
45
51
|
type ControlMeasureGeometry = "point" | "line" | "area";
|
|
46
|
-
declare const DRAW_RULE_IDS: readonly ["Area1", "Area7", "Area8", "Area11", "Area12", "Area15", "Area21", "Axis1", "Line1", "Line3", "Line9", "Line10", "Line23", "Line24", "Line29", "Point12"];
|
|
52
|
+
declare const DRAW_RULE_IDS: readonly ["Area1", "Area7", "Area8", "Area11", "Area12", "Area15", "Area21", "Axis1", "Line1", "Line3", "Line9", "Line10", "Line23", "Line24", "Line29", "Point12", "Rectangle"];
|
|
47
53
|
type DrawRuleId = (typeof DRAW_RULE_IDS)[number];
|
|
48
54
|
interface BaseParamDescriptor {
|
|
49
55
|
key: string;
|
|
@@ -613,6 +619,47 @@ declare function createBlockArrow(coordinates: Position[], options?: BlockArrowO
|
|
|
613
619
|
fill: boolean;
|
|
614
620
|
}>;
|
|
615
621
|
//#endregion
|
|
622
|
+
//#region src/generators/cm99-generic-graphics/params.d.ts
|
|
623
|
+
interface SmoothPathOptions {
|
|
624
|
+
/** Curve the rendered path through the unchanged control points. */
|
|
625
|
+
smooth?: boolean;
|
|
626
|
+
/** Number of samples per segment when smoothing is enabled. */
|
|
627
|
+
smoothResolution?: number;
|
|
628
|
+
}
|
|
629
|
+
interface FilledAreaOptions {
|
|
630
|
+
/** Fill the polygon interior; false renders only its outline. */
|
|
631
|
+
filled?: boolean;
|
|
632
|
+
}
|
|
633
|
+
//#endregion
|
|
634
|
+
//#region src/generators/cm99-generic-graphics/line.d.ts
|
|
635
|
+
type GenericLineOptions = SmoothPathOptions;
|
|
636
|
+
declare const DEFAULT_GENERIC_LINE_OPTIONS: Required<GenericLineOptions>;
|
|
637
|
+
declare function createGenericLine(coordinates: Position[], options?: GenericLineOptions): FeatureCollection<LineString>;
|
|
638
|
+
//#endregion
|
|
639
|
+
//#region src/generators/cm99-generic-graphics/polygon.d.ts
|
|
640
|
+
interface GenericPolygonOptions extends SmoothPathOptions, FilledAreaOptions {}
|
|
641
|
+
declare const DEFAULT_GENERIC_POLYGON_OPTIONS: Required<GenericPolygonOptions>;
|
|
642
|
+
declare function createGenericPolygon(coordinates: Position[], options?: GenericPolygonOptions): FeatureCollection<Polygon, {
|
|
643
|
+
part: string;
|
|
644
|
+
fill: boolean;
|
|
645
|
+
}>;
|
|
646
|
+
//#endregion
|
|
647
|
+
//#region src/generators/cm99-generic-graphics/rectangle.d.ts
|
|
648
|
+
type GenericRectangleOptions = FilledAreaOptions;
|
|
649
|
+
declare const DEFAULT_GENERIC_RECTANGLE_OPTIONS: Required<GenericRectangleOptions>;
|
|
650
|
+
declare function createGenericRectangle(coordinates: Position[], options?: GenericRectangleOptions): FeatureCollection<Polygon, {
|
|
651
|
+
part: string;
|
|
652
|
+
fill: boolean;
|
|
653
|
+
}>;
|
|
654
|
+
//#endregion
|
|
655
|
+
//#region src/generators/cm99-generic-graphics/circle.d.ts
|
|
656
|
+
type GenericCircleOptions = FilledAreaOptions;
|
|
657
|
+
declare const DEFAULT_GENERIC_CIRCLE_OPTIONS: Required<GenericCircleOptions>;
|
|
658
|
+
declare function createGenericCircle(coordinates: Position[], options?: GenericCircleOptions): FeatureCollection<Polygon, {
|
|
659
|
+
part: string;
|
|
660
|
+
fill: boolean;
|
|
661
|
+
}>;
|
|
662
|
+
//#endregion
|
|
616
663
|
//#region src/generators/cm15-maneuver-areas/airborneAttack.d.ts
|
|
617
664
|
type AirborneAttackOptions = AttackOptions;
|
|
618
665
|
declare const DEFAULT_AIRBORNE_ATTACK_OPTIONS: Required<AirborneAttackOptions>;
|
|
@@ -1265,6 +1312,10 @@ declare const DEFINITIONS: {
|
|
|
1265
1312
|
"supporting-attack": ControlMeasureDefinition<"supporting-attack", typeof createSupportingAttack>;
|
|
1266
1313
|
"classic-arrow": ControlMeasureDefinition<"classic-arrow", typeof createClassicArrow>;
|
|
1267
1314
|
"block-arrow": ControlMeasureDefinition<"block-arrow", typeof createBlockArrow>;
|
|
1315
|
+
line: ControlMeasureDefinition<"line", typeof createGenericLine>;
|
|
1316
|
+
polygon: ControlMeasureDefinition<"polygon", typeof createGenericPolygon>;
|
|
1317
|
+
rectangle: ControlMeasureDefinition<"rectangle", typeof createGenericRectangle>;
|
|
1318
|
+
circle: ControlMeasureDefinition<"circle", typeof createGenericCircle>;
|
|
1268
1319
|
"airborne-attack": ControlMeasureDefinition<"airborne-attack", typeof createAirborneAttack>;
|
|
1269
1320
|
"attack-helicopter": ControlMeasureDefinition<"attack-helicopter", typeof createAttackHelicopter>;
|
|
1270
1321
|
"support-by-fire": ControlMeasureDefinition<"support-by-fire", typeof createSupportByFire>;
|
|
@@ -1599,6 +1650,9 @@ declare const blockDrawRule: ControlMeasureDrawRule;
|
|
|
1599
1650
|
*/
|
|
1600
1651
|
declare const disruptDrawRule: ControlMeasureDrawRule;
|
|
1601
1652
|
//#endregion
|
|
1653
|
+
//#region src/draw-rules/area15.d.ts
|
|
1654
|
+
declare const centerRadiusDrawRule: ControlMeasureDrawRule;
|
|
1655
|
+
//#endregion
|
|
1602
1656
|
//#region src/draw-rules/point12.d.ts
|
|
1603
1657
|
/**
|
|
1604
1658
|
* Point12 anchor draw rule for the obstacle-bypass family.
|
|
@@ -1669,6 +1723,9 @@ declare const supportByFireDrawRule: ControlMeasureDrawRule;
|
|
|
1669
1723
|
//#region src/draw-rules/axis1.d.ts
|
|
1670
1724
|
declare const axis1DrawRule: ControlMeasureDrawRule;
|
|
1671
1725
|
//#endregion
|
|
1726
|
+
//#region src/draw-rules/rectangle.d.ts
|
|
1727
|
+
declare const rectangleDrawRule: ControlMeasureDrawRule;
|
|
1728
|
+
//#endregion
|
|
1672
1729
|
//#region src/generators/cm14-maneuver-lines/ambush.d.ts
|
|
1673
1730
|
/**
|
|
1674
1731
|
* Configuration options for the Ambush tactical symbol.
|
|
@@ -1710,4 +1767,4 @@ interface TacticalArrowOptions {
|
|
|
1710
1767
|
*/
|
|
1711
1768
|
declare const DEFAULT_TACTICAL_ARROW_OPTIONS: Required<TacticalArrowOptions>;
|
|
1712
1769
|
//#endregion
|
|
1713
|
-
export {
|
|
1770
|
+
export { getControlMeasureMetadataByValue as $, GenericLineOptions as $t, getMetersPerPixel as A, BypassOptions as At, FeaturePartProps as B, DEFAULT_SUPPORT_BY_FIRE_OPTIONS as Bt, snapToMidpointPerpendicular as C, DEFAULT_ANTITANK_DITCH_OPTIONS as Ct, BaselineFrameOrigin as D, DEFAULT_CLEAR_OPTIONS as Dt, BaselineFrameOptions as E, ClearOptions as Et, resolveStyleHints as F, DEFAULT_BLOCK_MISSION_TASK_OPTIONS as Ft, isKind as G, DEFAULT_AIRBORNE_ATTACK_OPTIONS as Gt, controlMeasureIdFromFeature as H, AttackHelicopterOptions as Ht, RenderOptions as I, DEFAULT_FLOT_OPTIONS as It, CONTROL_MEASURE_METADATA as J, DEFAULT_GENERIC_RECTANGLE_OPTIONS as Jt, ControlMeasureStyle as K, DEFAULT_GENERIC_CIRCLE_OPTIONS as Kt, renderControlMeasure as L, FLOTOptions as Lt, SimpleStyleProps as M, BreachOptions as Mt, SimpleStyleRender as N, DEFAULT_BREACH_OPTIONS as Nt, createBaselineFrame as O, CanalizeOptions as Ot, toSimpleStyle as P, BlockMissionTaskOptions as Pt, getControlMeasureMetadata as Q, DEFAULT_GENERIC_LINE_OPTIONS as Qt, ControlMeasureRender as R, AttackByFireOptions as Rt, pointOnMidpointPerpendicularAxis as S, ControlMeasureDrawRule as Sn, AntitankDitchOptions as St, BaselineFrameNormal as T, DelayOptions as Tt, ControlMeasure as U, DEFAULT_ATTACK_HELICOPTER_OPTIONS as Ut, StyleHints as V, SupportByFireOptions as Vt, cloneControlMeasure as W, AirborneAttackOptions as Wt, ControlMeasureKind as X, DEFAULT_GENERIC_POLYGON_OPTIONS as Xt, ControlMeasureId as Y, GenericRectangleOptions as Yt, OptionsByKind as Z, GenericPolygonOptions as Zt, blockDrawRule as _, ControlMeasureGeometry as _n, FortifiedAreaOptions as _t, rectangleDrawRule as a, computeInitialWidthPoint as an, ObstacleBypassDifficultOptions as at, createMidpointPerpendicularDrawRule as b, ParamDescriptor as bn, AntitankWallOptions as bt, line24DrawRule as c, unproject as cn, DEFAULT_TURN_OPTIONS as ct, line1DrawRule as d, DEFAULT_FINAL_PROTECTIVE_FIRE_OPTIONS as dn, FixOptions as dt, DEFAULT_SUPPORTING_ATTACK_OPTIONS as en, getDefaultOptions as et, ambushDrawRule as f, FinalProtectiveFireOptions as fn, DEFAULT_DISRUPT_OPTIONS as ft, disruptDrawRule as g, StrongPointOptions as gn, DEFAULT_FORTIFIED_AREA_OPTIONS as gt, centerRadiusDrawRule as h, DEFAULT_STRONG_POINT_OPTIONS as hn, DEFAULT_BLOCK_OPTIONS as ht, DEFAULT_AMBUSH_OPTIONS as i, calculateMetrics as in, DEFAULT_OBSTACLE_BYPASS_DIFFICULT_OPTIONS as it, roundToFixed as j, DEFAULT_BYPASS_OPTIONS as jt, EPSILON as k, DEFAULT_CANALIZE_OPTIONS as kt, line23DrawRule as l, DEFAULT_ENCIRCLEMENT_OPTIONS as ln, TurnOptions as lt, point12DrawRule as m, PrincipalDirectionOfFireOptions as mn, BlockOptions as mt, TacticalArrowOptions as n, DEFAULT_MAIN_ATTACK_OPTIONS as nn, DEFAULT_OBSTACLE_BYPASS_IMPOSSIBLE_OPTIONS as nt, axis1DrawRule as o, Point2D as on, DEFAULT_OBSTACLE_BYPASS_EASY_OPTIONS as ot, attackByFireDrawRule as p, DEFAULT_PRINCIPAL_DIRECTION_OF_FIRE_OPTIONS as pn, DisruptOptions as pt, CONTROL_MEASURE_IDS as q, GenericCircleOptions as qt, AmbushOptions as r, MainAttackOptions as rn, ObstacleBypassImpossibleOptions as rt, supportByFireDrawRule as s, project as sn, ObstacleBypassEasyOptions as st, DEFAULT_TACTICAL_ARROW_OPTIONS as t, SupportingAttackOptions as tn, listControlMeasureMetadata as tt, turnDrawRule as u, EncirclementOptions as un, DEFAULT_FIX_OPTIONS as ut, MidpointPerpendicularDrawRuleOptions as v, ControlMeasureGeometryType as vn, DEFAULT_FORTIFIED_LINE_OPTIONS as vt, BaselineFrame as w, DEFAULT_DELAY_OPTIONS as wt, getMidpointPerpendicularSignedDistance as x, AnchorTransformEvent as xn, DEFAULT_ANTITANK_WALL_OPTIONS as xt, computeDefaultMidpointPerpendicularPoint as y, ControlMeasureMetadata as yn, FortifiedLineOptions as yt, ControlMeasureSnapshot as z, DEFAULT_ATTACK_BY_FIRE_OPTIONS as zt };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { type AirborneAttackOptions, type AmbushOptions, type AnchorTransformEvent, type AntitankDitchOptions, type AntitankWallOptions, type AttackByFireOptions, type AttackHelicopterOptions, type BaselineFrame, type BaselineFrameNormal, type BaselineFrameOptions, type BaselineFrameOrigin, type BlockMissionTaskOptions, type BlockOptions, type BreachOptions, type BypassOptions, CONTROL_MEASURE_IDS, CONTROL_MEASURE_METADATA, type CanalizeOptions, type ClearOptions, type ControlMeasure, type ControlMeasureDrawRule, type ControlMeasureGeometry, type ControlMeasureGeometryType, type ControlMeasureId, type ControlMeasureKind, type ControlMeasureMetadata, type ControlMeasureRender, type ControlMeasureSnapshot, type ControlMeasureStyle, DEFAULT_AIRBORNE_ATTACK_OPTIONS, DEFAULT_AMBUSH_OPTIONS, DEFAULT_ANTITANK_DITCH_OPTIONS, DEFAULT_ANTITANK_WALL_OPTIONS, DEFAULT_ATTACK_BY_FIRE_OPTIONS, DEFAULT_ATTACK_HELICOPTER_OPTIONS, DEFAULT_BLOCK_MISSION_TASK_OPTIONS, DEFAULT_BLOCK_OPTIONS, DEFAULT_BREACH_OPTIONS, DEFAULT_BYPASS_OPTIONS, DEFAULT_CANALIZE_OPTIONS, DEFAULT_CLEAR_OPTIONS, DEFAULT_DELAY_OPTIONS, DEFAULT_DISRUPT_OPTIONS, DEFAULT_ENCIRCLEMENT_OPTIONS, DEFAULT_FINAL_PROTECTIVE_FIRE_OPTIONS, DEFAULT_FIX_OPTIONS, DEFAULT_FLOT_OPTIONS, DEFAULT_FORTIFIED_AREA_OPTIONS, DEFAULT_FORTIFIED_LINE_OPTIONS, DEFAULT_MAIN_ATTACK_OPTIONS, DEFAULT_OBSTACLE_BYPASS_DIFFICULT_OPTIONS, DEFAULT_OBSTACLE_BYPASS_EASY_OPTIONS, DEFAULT_OBSTACLE_BYPASS_IMPOSSIBLE_OPTIONS, DEFAULT_PRINCIPAL_DIRECTION_OF_FIRE_OPTIONS, DEFAULT_STRONG_POINT_OPTIONS, DEFAULT_SUPPORTING_ATTACK_OPTIONS, DEFAULT_SUPPORT_BY_FIRE_OPTIONS, DEFAULT_TACTICAL_ARROW_OPTIONS, DEFAULT_TURN_OPTIONS, type DelayOptions, type DisruptOptions, EPSILON, type EncirclementOptions, type FLOTOptions, type FeaturePartProps, type FinalProtectiveFireOptions, type FixOptions, type FortifiedAreaOptions, type FortifiedLineOptions, type MainAttackOptions, type MidpointPerpendicularDrawRuleOptions, type ObstacleBypassDifficultOptions, type ObstacleBypassEasyOptions, type ObstacleBypassImpossibleOptions, type OptionsByKind, type ParamDescriptor, type Point2D, type PrincipalDirectionOfFireOptions, type RenderOptions, type SimpleStyleProps, type SimpleStyleRender, type StrongPointOptions, type StyleHints, type SupportByFireOptions, type SupportingAttackOptions, type TacticalArrowOptions, type TurnOptions, ambushDrawRule, attackByFireDrawRule, axis1DrawRule, blockDrawRule, calculateMetrics, cloneControlMeasure, computeDefaultMidpointPerpendicularPoint, computeInitialWidthPoint, controlMeasureIdFromFeature, createBaselineFrame, createMidpointPerpendicularDrawRule, disruptDrawRule, getControlMeasureMetadata, getControlMeasureMetadataByValue, getDefaultOptions, getMetersPerPixel, getMidpointPerpendicularSignedDistance, isKind, line1DrawRule, line23DrawRule, line24DrawRule, listControlMeasureMetadata, point12DrawRule, pointOnMidpointPerpendicularAxis, project, renderControlMeasure, resolveStyleHints, roundToFixed, snapToMidpointPerpendicular, supportByFireDrawRule, toSimpleStyle, turnDrawRule, unproject };
|
|
1
|
+
import { $ as getControlMeasureMetadataByValue, $t as GenericLineOptions, A as getMetersPerPixel, At as BypassOptions, B as FeaturePartProps, Bt as DEFAULT_SUPPORT_BY_FIRE_OPTIONS, C as snapToMidpointPerpendicular, Ct as DEFAULT_ANTITANK_DITCH_OPTIONS, D as BaselineFrameOrigin, Dt as DEFAULT_CLEAR_OPTIONS, E as BaselineFrameOptions, Et as ClearOptions, F as resolveStyleHints, Ft as DEFAULT_BLOCK_MISSION_TASK_OPTIONS, G as isKind, Gt as DEFAULT_AIRBORNE_ATTACK_OPTIONS, H as controlMeasureIdFromFeature, Ht as AttackHelicopterOptions, I as RenderOptions, It as DEFAULT_FLOT_OPTIONS, J as CONTROL_MEASURE_METADATA, Jt as DEFAULT_GENERIC_RECTANGLE_OPTIONS, K as ControlMeasureStyle, Kt as DEFAULT_GENERIC_CIRCLE_OPTIONS, L as renderControlMeasure, Lt as FLOTOptions, M as SimpleStyleProps, Mt as BreachOptions, N as SimpleStyleRender, Nt as DEFAULT_BREACH_OPTIONS, O as createBaselineFrame, Ot as CanalizeOptions, P as toSimpleStyle, Pt as BlockMissionTaskOptions, Q as getControlMeasureMetadata, Qt as DEFAULT_GENERIC_LINE_OPTIONS, R as ControlMeasureRender, Rt as AttackByFireOptions, S as pointOnMidpointPerpendicularAxis, Sn as ControlMeasureDrawRule, St as AntitankDitchOptions, T as BaselineFrameNormal, Tt as DelayOptions, U as ControlMeasure, Ut as DEFAULT_ATTACK_HELICOPTER_OPTIONS, V as StyleHints, Vt as SupportByFireOptions, W as cloneControlMeasure, Wt as AirborneAttackOptions, X as ControlMeasureKind, Xt as DEFAULT_GENERIC_POLYGON_OPTIONS, Y as ControlMeasureId, Yt as GenericRectangleOptions, Z as OptionsByKind, Zt as GenericPolygonOptions, _ as blockDrawRule, _n as ControlMeasureGeometry, _t as FortifiedAreaOptions, a as rectangleDrawRule, an as computeInitialWidthPoint, at as ObstacleBypassDifficultOptions, b as createMidpointPerpendicularDrawRule, bn as ParamDescriptor, bt as AntitankWallOptions, c as line24DrawRule, cn as unproject, ct as DEFAULT_TURN_OPTIONS, d as line1DrawRule, dn as DEFAULT_FINAL_PROTECTIVE_FIRE_OPTIONS, dt as FixOptions, en as DEFAULT_SUPPORTING_ATTACK_OPTIONS, et as getDefaultOptions, f as ambushDrawRule, fn as FinalProtectiveFireOptions, ft as DEFAULT_DISRUPT_OPTIONS, g as disruptDrawRule, gn as StrongPointOptions, gt as DEFAULT_FORTIFIED_AREA_OPTIONS, h as centerRadiusDrawRule, hn as DEFAULT_STRONG_POINT_OPTIONS, ht as DEFAULT_BLOCK_OPTIONS, i as DEFAULT_AMBUSH_OPTIONS, in as calculateMetrics, it as DEFAULT_OBSTACLE_BYPASS_DIFFICULT_OPTIONS, j as roundToFixed, jt as DEFAULT_BYPASS_OPTIONS, k as EPSILON, kt as DEFAULT_CANALIZE_OPTIONS, l as line23DrawRule, ln as DEFAULT_ENCIRCLEMENT_OPTIONS, lt as TurnOptions, m as point12DrawRule, mn as PrincipalDirectionOfFireOptions, mt as BlockOptions, n as TacticalArrowOptions, nn as DEFAULT_MAIN_ATTACK_OPTIONS, nt as DEFAULT_OBSTACLE_BYPASS_IMPOSSIBLE_OPTIONS, o as axis1DrawRule, on as Point2D, ot as DEFAULT_OBSTACLE_BYPASS_EASY_OPTIONS, p as attackByFireDrawRule, pn as DEFAULT_PRINCIPAL_DIRECTION_OF_FIRE_OPTIONS, pt as DisruptOptions, q as CONTROL_MEASURE_IDS, qt as GenericCircleOptions, r as AmbushOptions, rn as MainAttackOptions, rt as ObstacleBypassImpossibleOptions, s as supportByFireDrawRule, sn as project, st as ObstacleBypassEasyOptions, t as DEFAULT_TACTICAL_ARROW_OPTIONS, tn as SupportingAttackOptions, tt as listControlMeasureMetadata, u as turnDrawRule, un as EncirclementOptions, ut as DEFAULT_FIX_OPTIONS, v as MidpointPerpendicularDrawRuleOptions, vn as ControlMeasureGeometryType, vt as DEFAULT_FORTIFIED_LINE_OPTIONS, w as BaselineFrame, wt as DEFAULT_DELAY_OPTIONS, x as getMidpointPerpendicularSignedDistance, xn as AnchorTransformEvent, xt as DEFAULT_ANTITANK_WALL_OPTIONS, y as computeDefaultMidpointPerpendicularPoint, yn as ControlMeasureMetadata, yt as FortifiedLineOptions, z as ControlMeasureSnapshot, zt as DEFAULT_ATTACK_BY_FIRE_OPTIONS } from "./index-Ddt-obht.mjs";
|
|
2
|
+
export { type AirborneAttackOptions, type AmbushOptions, type AnchorTransformEvent, type AntitankDitchOptions, type AntitankWallOptions, type AttackByFireOptions, type AttackHelicopterOptions, type BaselineFrame, type BaselineFrameNormal, type BaselineFrameOptions, type BaselineFrameOrigin, type BlockMissionTaskOptions, type BlockOptions, type BreachOptions, type BypassOptions, CONTROL_MEASURE_IDS, CONTROL_MEASURE_METADATA, type CanalizeOptions, type ClearOptions, type ControlMeasure, type ControlMeasureDrawRule, type ControlMeasureGeometry, type ControlMeasureGeometryType, type ControlMeasureId, type ControlMeasureKind, type ControlMeasureMetadata, type ControlMeasureRender, type ControlMeasureSnapshot, type ControlMeasureStyle, DEFAULT_AIRBORNE_ATTACK_OPTIONS, DEFAULT_AMBUSH_OPTIONS, DEFAULT_ANTITANK_DITCH_OPTIONS, DEFAULT_ANTITANK_WALL_OPTIONS, DEFAULT_ATTACK_BY_FIRE_OPTIONS, DEFAULT_ATTACK_HELICOPTER_OPTIONS, DEFAULT_BLOCK_MISSION_TASK_OPTIONS, DEFAULT_BLOCK_OPTIONS, DEFAULT_BREACH_OPTIONS, DEFAULT_BYPASS_OPTIONS, DEFAULT_CANALIZE_OPTIONS, DEFAULT_CLEAR_OPTIONS, DEFAULT_DELAY_OPTIONS, DEFAULT_DISRUPT_OPTIONS, DEFAULT_ENCIRCLEMENT_OPTIONS, DEFAULT_FINAL_PROTECTIVE_FIRE_OPTIONS, DEFAULT_FIX_OPTIONS, DEFAULT_FLOT_OPTIONS, DEFAULT_FORTIFIED_AREA_OPTIONS, DEFAULT_FORTIFIED_LINE_OPTIONS, DEFAULT_GENERIC_CIRCLE_OPTIONS, DEFAULT_GENERIC_LINE_OPTIONS, DEFAULT_GENERIC_POLYGON_OPTIONS, DEFAULT_GENERIC_RECTANGLE_OPTIONS, DEFAULT_MAIN_ATTACK_OPTIONS, DEFAULT_OBSTACLE_BYPASS_DIFFICULT_OPTIONS, DEFAULT_OBSTACLE_BYPASS_EASY_OPTIONS, DEFAULT_OBSTACLE_BYPASS_IMPOSSIBLE_OPTIONS, DEFAULT_PRINCIPAL_DIRECTION_OF_FIRE_OPTIONS, DEFAULT_STRONG_POINT_OPTIONS, DEFAULT_SUPPORTING_ATTACK_OPTIONS, DEFAULT_SUPPORT_BY_FIRE_OPTIONS, DEFAULT_TACTICAL_ARROW_OPTIONS, DEFAULT_TURN_OPTIONS, type DelayOptions, type DisruptOptions, EPSILON, type EncirclementOptions, type FLOTOptions, type FeaturePartProps, type FinalProtectiveFireOptions, type FixOptions, type FortifiedAreaOptions, type FortifiedLineOptions, type GenericCircleOptions, type GenericLineOptions, type GenericPolygonOptions, type GenericRectangleOptions, type MainAttackOptions, type MidpointPerpendicularDrawRuleOptions, type ObstacleBypassDifficultOptions, type ObstacleBypassEasyOptions, type ObstacleBypassImpossibleOptions, type OptionsByKind, type ParamDescriptor, type Point2D, type PrincipalDirectionOfFireOptions, type RenderOptions, type SimpleStyleProps, type SimpleStyleRender, type StrongPointOptions, type StyleHints, type SupportByFireOptions, type SupportingAttackOptions, type TacticalArrowOptions, type TurnOptions, ambushDrawRule, attackByFireDrawRule, axis1DrawRule, blockDrawRule, calculateMetrics, centerRadiusDrawRule, cloneControlMeasure, computeDefaultMidpointPerpendicularPoint, computeInitialWidthPoint, controlMeasureIdFromFeature, createBaselineFrame, createMidpointPerpendicularDrawRule, disruptDrawRule, getControlMeasureMetadata, getControlMeasureMetadataByValue, getDefaultOptions, getMetersPerPixel, getMidpointPerpendicularSignedDistance, isKind, line1DrawRule, line23DrawRule, line24DrawRule, listControlMeasureMetadata, point12DrawRule, pointOnMidpointPerpendicularAxis, project, rectangleDrawRule, renderControlMeasure, resolveStyleHints, roundToFixed, snapToMidpointPerpendicular, supportByFireDrawRule, toSimpleStyle, turnDrawRule, unproject };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as point12DrawRule, A as DEFAULT_GENERIC_POLYGON_OPTIONS, B as DEFAULT_ANTITANK_WALL_OPTIONS, C as DEFAULT_FIX_OPTIONS, D as DEFAULT_DELAY_OPTIONS, E as DEFAULT_DISRUPT_OPTIONS, F as DEFAULT_BREACH_OPTIONS, G as axis1DrawRule, H as DEFAULT_AMBUSH_OPTIONS, I as DEFAULT_BLOCK_MISSION_TASK_OPTIONS, J as line23DrawRule, K as supportByFireDrawRule, L as DEFAULT_BLOCK_OPTIONS, M as DEFAULT_GENERIC_CIRCLE_OPTIONS, N as DEFAULT_CANALIZE_OPTIONS, O as DEFAULT_CLEAR_OPTIONS, P as DEFAULT_BYPASS_OPTIONS, Q as attackByFireDrawRule, R as DEFAULT_ATTACK_HELICOPTER_OPTIONS, S as DEFAULT_FLOT_OPTIONS, T as DEFAULT_ENCIRCLEMENT_OPTIONS, U as DEFAULT_AIRBORNE_ATTACK_OPTIONS, V as DEFAULT_ANTITANK_DITCH_OPTIONS, W as rectangleDrawRule, X as line1DrawRule, Y as turnDrawRule, Z as ambushDrawRule, _ as DEFAULT_OBSTACLE_BYPASS_EASY_OPTIONS, at as getMidpointPerpendicularSignedDistance, b as DEFAULT_FORTIFIED_AREA_OPTIONS, c as getDefaultOptions, ct as createBaselineFrame, d as DEFAULT_SUPPORTING_ATTACK_OPTIONS, dt as project, et as centerRadiusDrawRule, f as DEFAULT_SUPPORT_BY_FIRE_OPTIONS, ft as unproject, g as DEFAULT_OBSTACLE_BYPASS_IMPOSSIBLE_OPTIONS, h as DEFAULT_PRINCIPAL_DIRECTION_OF_FIRE_OPTIONS, ht as roundToFixed, i as CONTROL_MEASURE_METADATA, it as createMidpointPerpendicularDrawRule, j as DEFAULT_GENERIC_LINE_OPTIONS, k as DEFAULT_GENERIC_RECTANGLE_OPTIONS, l as listControlMeasureMetadata, lt as calculateMetrics, m as DEFAULT_TACTICAL_ARROW_OPTIONS, mt as getMetersPerPixel, n as resolveStyleHints, nt as blockDrawRule, o as getControlMeasureMetadata, ot as pointOnMidpointPerpendicularAxis, p as DEFAULT_STRONG_POINT_OPTIONS, pt as EPSILON, q as line24DrawRule, r as CONTROL_MEASURE_IDS, rt as computeDefaultMidpointPerpendicularPoint, s as getControlMeasureMetadataByValue, st as snapToMidpointPerpendicular, t as renderControlMeasure, tt as disruptDrawRule, u as DEFAULT_TURN_OPTIONS, ut as computeInitialWidthPoint, v as DEFAULT_OBSTACLE_BYPASS_DIFFICULT_OPTIONS, w as DEFAULT_FINAL_PROTECTIVE_FIRE_OPTIONS, x as DEFAULT_FORTIFIED_LINE_OPTIONS, y as DEFAULT_MAIN_ATTACK_OPTIONS, z as DEFAULT_ATTACK_BY_FIRE_OPTIONS } from "./renderControlMeasure-CDCoQlZ-.mjs";
|
|
2
2
|
//#region src/instance.ts
|
|
3
3
|
function isKind(cm, kind) {
|
|
4
4
|
return cm.kind === kind;
|
|
@@ -99,4 +99,4 @@ function toHexChannel(value) {
|
|
|
99
99
|
return Math.max(0, Math.min(255, Math.round(value))).toString(16).padStart(2, "0");
|
|
100
100
|
}
|
|
101
101
|
//#endregion
|
|
102
|
-
export { CONTROL_MEASURE_IDS, CONTROL_MEASURE_METADATA, DEFAULT_AIRBORNE_ATTACK_OPTIONS, DEFAULT_AMBUSH_OPTIONS, DEFAULT_ANTITANK_DITCH_OPTIONS, DEFAULT_ANTITANK_WALL_OPTIONS, DEFAULT_ATTACK_BY_FIRE_OPTIONS, DEFAULT_ATTACK_HELICOPTER_OPTIONS, DEFAULT_BLOCK_MISSION_TASK_OPTIONS, DEFAULT_BLOCK_OPTIONS, DEFAULT_BREACH_OPTIONS, DEFAULT_BYPASS_OPTIONS, DEFAULT_CANALIZE_OPTIONS, DEFAULT_CLEAR_OPTIONS, DEFAULT_DELAY_OPTIONS, DEFAULT_DISRUPT_OPTIONS, DEFAULT_ENCIRCLEMENT_OPTIONS, DEFAULT_FINAL_PROTECTIVE_FIRE_OPTIONS, DEFAULT_FIX_OPTIONS, DEFAULT_FLOT_OPTIONS, DEFAULT_FORTIFIED_AREA_OPTIONS, DEFAULT_FORTIFIED_LINE_OPTIONS, DEFAULT_MAIN_ATTACK_OPTIONS, DEFAULT_OBSTACLE_BYPASS_DIFFICULT_OPTIONS, DEFAULT_OBSTACLE_BYPASS_EASY_OPTIONS, DEFAULT_OBSTACLE_BYPASS_IMPOSSIBLE_OPTIONS, DEFAULT_PRINCIPAL_DIRECTION_OF_FIRE_OPTIONS, DEFAULT_STRONG_POINT_OPTIONS, DEFAULT_SUPPORTING_ATTACK_OPTIONS, DEFAULT_SUPPORT_BY_FIRE_OPTIONS, DEFAULT_TACTICAL_ARROW_OPTIONS, DEFAULT_TURN_OPTIONS, EPSILON, ambushDrawRule, attackByFireDrawRule, axis1DrawRule, blockDrawRule, calculateMetrics, cloneControlMeasure, computeDefaultMidpointPerpendicularPoint, computeInitialWidthPoint, controlMeasureIdFromFeature, createBaselineFrame, createMidpointPerpendicularDrawRule, disruptDrawRule, getControlMeasureMetadata, getControlMeasureMetadataByValue, getDefaultOptions, getMetersPerPixel, getMidpointPerpendicularSignedDistance, isKind, line1DrawRule, line23DrawRule, line24DrawRule, listControlMeasureMetadata, point12DrawRule, pointOnMidpointPerpendicularAxis, project, renderControlMeasure, resolveStyleHints, roundToFixed, snapToMidpointPerpendicular, supportByFireDrawRule, toSimpleStyle, turnDrawRule, unproject };
|
|
102
|
+
export { CONTROL_MEASURE_IDS, CONTROL_MEASURE_METADATA, DEFAULT_AIRBORNE_ATTACK_OPTIONS, DEFAULT_AMBUSH_OPTIONS, DEFAULT_ANTITANK_DITCH_OPTIONS, DEFAULT_ANTITANK_WALL_OPTIONS, DEFAULT_ATTACK_BY_FIRE_OPTIONS, DEFAULT_ATTACK_HELICOPTER_OPTIONS, DEFAULT_BLOCK_MISSION_TASK_OPTIONS, DEFAULT_BLOCK_OPTIONS, DEFAULT_BREACH_OPTIONS, DEFAULT_BYPASS_OPTIONS, DEFAULT_CANALIZE_OPTIONS, DEFAULT_CLEAR_OPTIONS, DEFAULT_DELAY_OPTIONS, DEFAULT_DISRUPT_OPTIONS, DEFAULT_ENCIRCLEMENT_OPTIONS, DEFAULT_FINAL_PROTECTIVE_FIRE_OPTIONS, DEFAULT_FIX_OPTIONS, DEFAULT_FLOT_OPTIONS, DEFAULT_FORTIFIED_AREA_OPTIONS, DEFAULT_FORTIFIED_LINE_OPTIONS, DEFAULT_GENERIC_CIRCLE_OPTIONS, DEFAULT_GENERIC_LINE_OPTIONS, DEFAULT_GENERIC_POLYGON_OPTIONS, DEFAULT_GENERIC_RECTANGLE_OPTIONS, DEFAULT_MAIN_ATTACK_OPTIONS, DEFAULT_OBSTACLE_BYPASS_DIFFICULT_OPTIONS, DEFAULT_OBSTACLE_BYPASS_EASY_OPTIONS, DEFAULT_OBSTACLE_BYPASS_IMPOSSIBLE_OPTIONS, DEFAULT_PRINCIPAL_DIRECTION_OF_FIRE_OPTIONS, DEFAULT_STRONG_POINT_OPTIONS, DEFAULT_SUPPORTING_ATTACK_OPTIONS, DEFAULT_SUPPORT_BY_FIRE_OPTIONS, DEFAULT_TACTICAL_ARROW_OPTIONS, DEFAULT_TURN_OPTIONS, EPSILON, ambushDrawRule, attackByFireDrawRule, axis1DrawRule, blockDrawRule, calculateMetrics, centerRadiusDrawRule, cloneControlMeasure, computeDefaultMidpointPerpendicularPoint, computeInitialWidthPoint, controlMeasureIdFromFeature, createBaselineFrame, createMidpointPerpendicularDrawRule, disruptDrawRule, getControlMeasureMetadata, getControlMeasureMetadataByValue, getDefaultOptions, getMetersPerPixel, getMidpointPerpendicularSignedDistance, isKind, line1DrawRule, line23DrawRule, line24DrawRule, listControlMeasureMetadata, point12DrawRule, pointOnMidpointPerpendicularAxis, project, rectangleDrawRule, renderControlMeasure, resolveStyleHints, roundToFixed, snapToMidpointPerpendicular, supportByFireDrawRule, toSimpleStyle, turnDrawRule, unproject };
|
package/dist/preview/index.d.mts
CHANGED
package/dist/preview/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as DEFINITIONS, t as renderControlMeasure } from "../renderControlMeasure-
|
|
1
|
+
import { a as DEFINITIONS, t as renderControlMeasure } from "../renderControlMeasure-CDCoQlZ-.mjs";
|
|
2
2
|
//#region src/preview/index.ts
|
|
3
3
|
/**
|
|
4
4
|
* Unitless `previewSample` points (~`[-1, 1]`) are scaled by this degree offset
|
|
@@ -483,6 +483,33 @@ function samePosition(a, b) {
|
|
|
483
483
|
return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
|
|
484
484
|
}
|
|
485
485
|
//#endregion
|
|
486
|
+
//#region src/draw-rules/area1.ts
|
|
487
|
+
function derive$8(points) {
|
|
488
|
+
return clonePositions(points);
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Area1 anchor draw rule — a free closed area (Battle Position, Strong Point,
|
|
492
|
+
* Encirclement, Fortified Area).
|
|
493
|
+
*
|
|
494
|
+
* Every anchor is a fully free, user-clicked ring vertex; the rule imposes no
|
|
495
|
+
* constraint and derives no extra slots, so `derive`/`transform` pass the
|
|
496
|
+
* points through unchanged. It is the area analog of the free-line {@link
|
|
497
|
+
* line1DrawRule}: variable-length (no `canonicalPointCount`) with a three-point
|
|
498
|
+
* floor to close a polygon. Behaviorally a no-op over the bare variable-length
|
|
499
|
+
* path — it exists so these drawable areas expose a named rule on
|
|
500
|
+
* `metadata.rule` rather than leaving it `undefined`, matching every other
|
|
501
|
+
* doctrinal draw rule. Ring closure is a generator concern, not a draw-rule one.
|
|
502
|
+
*/
|
|
503
|
+
const area1DrawRule = {
|
|
504
|
+
id: "area1",
|
|
505
|
+
minimumUserPoints: 3,
|
|
506
|
+
closedRing: true,
|
|
507
|
+
derive: derive$8,
|
|
508
|
+
transform(event) {
|
|
509
|
+
return derive$8(event.next);
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
//#endregion
|
|
486
513
|
//#region src/draw-rules/area11.ts
|
|
487
514
|
const blockDrawRule = createMidpointPerpendicularDrawRule({ id: "area11:block" });
|
|
488
515
|
//#endregion
|
|
@@ -505,14 +532,14 @@ const disruptDrawRule = createMidpointPerpendicularDrawRule({
|
|
|
505
532
|
* that fixes both the radius and the bearing of the symbol's opening. Both
|
|
506
533
|
* points are user-clicked, so the canonical array is just the (clamped) input.
|
|
507
534
|
*/
|
|
508
|
-
function derive$
|
|
535
|
+
function derive$7(points) {
|
|
509
536
|
return clonePositions(points.slice(0, 2));
|
|
510
537
|
}
|
|
511
|
-
const
|
|
512
|
-
id: "area15:
|
|
538
|
+
const centerRadiusDrawRule = {
|
|
539
|
+
id: "area15:center-radius",
|
|
513
540
|
minimumUserPoints: 2,
|
|
514
541
|
canonicalPointCount: 2,
|
|
515
|
-
derive: derive$
|
|
542
|
+
derive: derive$7,
|
|
516
543
|
transform(event) {
|
|
517
544
|
const { previous, next, activePointIndex } = event;
|
|
518
545
|
if (activePointIndex === 0 && previous.length >= 2 && next.length >= 2) {
|
|
@@ -521,9 +548,11 @@ const isolateDrawRule = {
|
|
|
521
548
|
const origin = previous[1];
|
|
522
549
|
return [clonePosition(next[0]), [origin[0] + dx, origin[1] + dy]];
|
|
523
550
|
}
|
|
524
|
-
return derive$
|
|
551
|
+
return derive$7(next);
|
|
525
552
|
}
|
|
526
553
|
};
|
|
554
|
+
/** Backward-compatible doctrinal name for Area15's shared center-radius rule. */
|
|
555
|
+
const isolateDrawRule = centerRadiusDrawRule;
|
|
527
556
|
//#endregion
|
|
528
557
|
//#region src/draw-rules/point12.ts
|
|
529
558
|
/**
|
|
@@ -564,20 +593,20 @@ const ambushDrawRule = createMidpointPerpendicularDrawRule({
|
|
|
564
593
|
});
|
|
565
594
|
//#endregion
|
|
566
595
|
//#region src/draw-rules/line1.ts
|
|
567
|
-
function derive$
|
|
596
|
+
function derive$6(points) {
|
|
568
597
|
return clonePositions(points);
|
|
569
598
|
}
|
|
570
599
|
const line1DrawRule = {
|
|
571
600
|
id: "line1",
|
|
572
601
|
minimumUserPoints: 2,
|
|
573
|
-
derive: derive$
|
|
602
|
+
derive: derive$6,
|
|
574
603
|
transform(event) {
|
|
575
|
-
return derive$
|
|
604
|
+
return derive$6(event.next);
|
|
576
605
|
}
|
|
577
606
|
};
|
|
578
607
|
//#endregion
|
|
579
608
|
//#region src/draw-rules/line3.ts
|
|
580
|
-
function derive$
|
|
609
|
+
function derive$5(points) {
|
|
581
610
|
return clonePositions(points);
|
|
582
611
|
}
|
|
583
612
|
/**
|
|
@@ -592,23 +621,23 @@ const line3DrawRule = {
|
|
|
592
621
|
id: "line3",
|
|
593
622
|
minimumUserPoints: 3,
|
|
594
623
|
canonicalPointCount: 3,
|
|
595
|
-
derive: derive$
|
|
624
|
+
derive: derive$5,
|
|
596
625
|
transform(event) {
|
|
597
|
-
return derive$
|
|
626
|
+
return derive$5(event.next);
|
|
598
627
|
}
|
|
599
628
|
};
|
|
600
629
|
//#endregion
|
|
601
630
|
//#region src/draw-rules/line9.ts
|
|
602
|
-
function derive$
|
|
631
|
+
function derive$4(points) {
|
|
603
632
|
return clonePositions(points);
|
|
604
633
|
}
|
|
605
634
|
const line9DrawRule = {
|
|
606
635
|
id: "line9",
|
|
607
636
|
minimumUserPoints: 2,
|
|
608
637
|
canonicalPointCount: 2,
|
|
609
|
-
derive: derive$
|
|
638
|
+
derive: derive$4,
|
|
610
639
|
transform(event) {
|
|
611
|
-
return derive$
|
|
640
|
+
return derive$4(event.next);
|
|
612
641
|
}
|
|
613
642
|
};
|
|
614
643
|
//#endregion
|
|
@@ -714,7 +743,7 @@ const line24DrawRule = createMidpointPerpendicularDrawRule({
|
|
|
714
743
|
});
|
|
715
744
|
//#endregion
|
|
716
745
|
//#region src/draw-rules/area8.ts
|
|
717
|
-
function derive$
|
|
746
|
+
function derive$3(points) {
|
|
718
747
|
if (points.length < 2) return clonePositions(points);
|
|
719
748
|
if (points.length !== 2) return clonePositions(points.slice(0, 4));
|
|
720
749
|
const p1 = clonePosition(points[0]);
|
|
@@ -738,16 +767,16 @@ const supportByFireDrawRule = {
|
|
|
738
767
|
id: "area8:support-by-fire",
|
|
739
768
|
minimumUserPoints: 2,
|
|
740
769
|
canonicalPointCount: 4,
|
|
741
|
-
derive: derive$
|
|
770
|
+
derive: derive$3,
|
|
742
771
|
transform(event) {
|
|
743
772
|
const { next } = event;
|
|
744
773
|
if (next.length === 4) return clonePositions(next);
|
|
745
|
-
return derive$
|
|
774
|
+
return derive$3(next);
|
|
746
775
|
}
|
|
747
776
|
};
|
|
748
777
|
//#endregion
|
|
749
778
|
//#region src/draw-rules/axis1.ts
|
|
750
|
-
function derive$
|
|
779
|
+
function derive$2(points) {
|
|
751
780
|
if (points.length < 2) return clonePositions(points);
|
|
752
781
|
if (points.length === 2) {
|
|
753
782
|
const tip = clonePosition(points[0]);
|
|
@@ -785,10 +814,10 @@ const axis1DrawRule = {
|
|
|
785
814
|
id: "axis1",
|
|
786
815
|
minimumUserPoints: 2,
|
|
787
816
|
trailingFixedSlots: 1,
|
|
788
|
-
derive: derive$
|
|
817
|
+
derive: derive$2,
|
|
789
818
|
transform(event) {
|
|
790
819
|
const { previous, next, activePointIndex } = event;
|
|
791
|
-
if (next.length < 3 || previous.length < 3) return derive$
|
|
820
|
+
if (next.length < 3 || previous.length < 3) return derive$2(next);
|
|
792
821
|
if (!(activePointIndex === 0 || activePointIndex === 1)) return clonePositions(next);
|
|
793
822
|
const metrics = calculateMetrics(previous);
|
|
794
823
|
if (!metrics) return clonePositions(next);
|
|
@@ -799,7 +828,7 @@ const axis1DrawRule = {
|
|
|
799
828
|
};
|
|
800
829
|
//#endregion
|
|
801
830
|
//#region src/draw-rules/area21.ts
|
|
802
|
-
function derive(points) {
|
|
831
|
+
function derive$1(points) {
|
|
803
832
|
if (points.length === 2) return clonePositions([
|
|
804
833
|
points[0],
|
|
805
834
|
points[1],
|
|
@@ -812,6 +841,24 @@ const searchAreaDrawRule = {
|
|
|
812
841
|
minimumUserPoints: 3,
|
|
813
842
|
minimumPreviewPoints: 2,
|
|
814
843
|
canonicalPointCount: 3,
|
|
844
|
+
derive: derive$1,
|
|
845
|
+
transform(event) {
|
|
846
|
+
return derive$1(event.next);
|
|
847
|
+
}
|
|
848
|
+
};
|
|
849
|
+
//#endregion
|
|
850
|
+
//#region src/draw-rules/rectangle.ts
|
|
851
|
+
/**
|
|
852
|
+
* Axis-aligned rectangle: P1 and P2 are opposite corners. Both are user-clicked
|
|
853
|
+
* and persisted; the generator derives the other two corners.
|
|
854
|
+
*/
|
|
855
|
+
function derive(points) {
|
|
856
|
+
return clonePositions(points.slice(0, 2));
|
|
857
|
+
}
|
|
858
|
+
const rectangleDrawRule = {
|
|
859
|
+
id: "rectangle",
|
|
860
|
+
minimumUserPoints: 2,
|
|
861
|
+
canonicalPointCount: 2,
|
|
815
862
|
derive,
|
|
816
863
|
transform(event) {
|
|
817
864
|
return derive(event.next);
|
|
@@ -2470,6 +2517,7 @@ const BATTLE_POSITION = defineControlMeasure({
|
|
|
2470
2517
|
metadata: BATTLE_POSITION_METADATA,
|
|
2471
2518
|
generator: createBattlePosition,
|
|
2472
2519
|
defaultOptions: DEFAULT_BATTLE_POSITION_OPTIONS,
|
|
2520
|
+
rule: area1DrawRule,
|
|
2473
2521
|
previewSample: {
|
|
2474
2522
|
controlPoints: [
|
|
2475
2523
|
[-1, -.5],
|
|
@@ -2567,7 +2615,7 @@ const BLOCK_ARROW_METADATA = {
|
|
|
2567
2615
|
id: "block-arrow",
|
|
2568
2616
|
name: "Block Arrow",
|
|
2569
2617
|
description: "Solid filled arrow with a controllable shaft width and selectable head (triangle, barbed, concave, diamond, harpoon, swallowtail, tee). Not a doctrinal symbol.",
|
|
2570
|
-
entity: "Generic
|
|
2618
|
+
entity: "Generic Graphics",
|
|
2571
2619
|
entityType: "Illustrative Arrow",
|
|
2572
2620
|
entitySubtype: "Block Arrow",
|
|
2573
2621
|
value: "990001",
|
|
@@ -3595,7 +3643,7 @@ const CLASSIC_ARROW_METADATA = {
|
|
|
3595
3643
|
id: "classic-arrow",
|
|
3596
3644
|
name: "Classic Arrow",
|
|
3597
3645
|
description: "Clean straight arrow with a selectable head (triangle, barbed, concave, diamond, harpoon, swallowtail, chevron, circle, tee, open). Not a doctrinal symbol.",
|
|
3598
|
-
entity: "Generic
|
|
3646
|
+
entity: "Generic Graphics",
|
|
3599
3647
|
entityType: "Illustrative Arrow",
|
|
3600
3648
|
entitySubtype: "Classic Arrow",
|
|
3601
3649
|
value: "990002",
|
|
@@ -3878,6 +3926,256 @@ function normalizeSmoothResolution(value) {
|
|
|
3878
3926
|
return Math.min(MAX_SMOOTH_RESOLUTION, Math.max(MIN_SMOOTH_RESOLUTION, Math.round(value)));
|
|
3879
3927
|
}
|
|
3880
3928
|
//#endregion
|
|
3929
|
+
//#region src/generators/cm99-generic-graphics/params.ts
|
|
3930
|
+
const SMOOTH_PATH_PARAMS = [{
|
|
3931
|
+
key: "smooth",
|
|
3932
|
+
label: "Smooth",
|
|
3933
|
+
description: "Curve the path through the control points.",
|
|
3934
|
+
type: "boolean"
|
|
3935
|
+
}, {
|
|
3936
|
+
key: "smoothResolution",
|
|
3937
|
+
label: "Smooth resolution",
|
|
3938
|
+
description: "Number of samples per segment when smooth mode is enabled.",
|
|
3939
|
+
type: "number",
|
|
3940
|
+
min: 2,
|
|
3941
|
+
max: 64,
|
|
3942
|
+
step: 1,
|
|
3943
|
+
visibleWhen: (opts) => Boolean(opts.smooth)
|
|
3944
|
+
}];
|
|
3945
|
+
const FILLED_AREA_PARAMS = [{
|
|
3946
|
+
key: "filled",
|
|
3947
|
+
label: "Filled",
|
|
3948
|
+
description: "Fill the interior instead of rendering an outline only.",
|
|
3949
|
+
type: "boolean"
|
|
3950
|
+
}];
|
|
3951
|
+
//#endregion
|
|
3952
|
+
//#region src/generators/cm99-generic-graphics/circle.ts
|
|
3953
|
+
const CIRCLE_SEGMENTS = 64;
|
|
3954
|
+
const DEFAULT_GENERIC_CIRCLE_OPTIONS = { filled: false };
|
|
3955
|
+
const GENERIC_CIRCLE_METADATA = {
|
|
3956
|
+
id: "circle",
|
|
3957
|
+
name: "Circle",
|
|
3958
|
+
description: "A non-doctrinal circle defined by a center and radius point.",
|
|
3959
|
+
entity: "Generic Graphics",
|
|
3960
|
+
entityType: "Basic Shape",
|
|
3961
|
+
entitySubtype: "Circle",
|
|
3962
|
+
value: "990104",
|
|
3963
|
+
minCoordinates: 2,
|
|
3964
|
+
maxCoordinates: 2,
|
|
3965
|
+
geometry: "area",
|
|
3966
|
+
geometryTypes: ["Polygon"],
|
|
3967
|
+
drawRule: "Area15",
|
|
3968
|
+
params: FILLED_AREA_PARAMS
|
|
3969
|
+
};
|
|
3970
|
+
function createGenericCircle(coordinates, options = {}) {
|
|
3971
|
+
const center = project(coordinates[0][0], coordinates[0][1]);
|
|
3972
|
+
const radiusVector = vecSub(project(coordinates[1][0], coordinates[1][1]), center);
|
|
3973
|
+
const radius = vecMag(radiusVector);
|
|
3974
|
+
if (radius < 1e-6) return {
|
|
3975
|
+
type: "FeatureCollection",
|
|
3976
|
+
features: []
|
|
3977
|
+
};
|
|
3978
|
+
const startAngle = Math.atan2(radiusVector[1], radiusVector[0]);
|
|
3979
|
+
const ring = [];
|
|
3980
|
+
for (let index = 0; index <= CIRCLE_SEGMENTS; index++) {
|
|
3981
|
+
const angle = startAngle + index / CIRCLE_SEGMENTS * Math.PI * 2;
|
|
3982
|
+
ring.push(unproject(center[0] + Math.cos(angle) * radius, center[1] + Math.sin(angle) * radius));
|
|
3983
|
+
}
|
|
3984
|
+
return {
|
|
3985
|
+
type: "FeatureCollection",
|
|
3986
|
+
features: [{
|
|
3987
|
+
type: "Feature",
|
|
3988
|
+
properties: {
|
|
3989
|
+
part: "circle",
|
|
3990
|
+
fill: options.filled ?? DEFAULT_GENERIC_CIRCLE_OPTIONS.filled
|
|
3991
|
+
},
|
|
3992
|
+
geometry: {
|
|
3993
|
+
type: "Polygon",
|
|
3994
|
+
coordinates: [ring]
|
|
3995
|
+
}
|
|
3996
|
+
}]
|
|
3997
|
+
};
|
|
3998
|
+
}
|
|
3999
|
+
const GENERIC_CIRCLE = defineControlMeasure({
|
|
4000
|
+
metadata: GENERIC_CIRCLE_METADATA,
|
|
4001
|
+
generator: createGenericCircle,
|
|
4002
|
+
defaultOptions: DEFAULT_GENERIC_CIRCLE_OPTIONS,
|
|
4003
|
+
rule: centerRadiusDrawRule,
|
|
4004
|
+
previewSample: { controlPoints: [[0, 0], [.8, 0]] }
|
|
4005
|
+
});
|
|
4006
|
+
//#endregion
|
|
4007
|
+
//#region src/generators/cm99-generic-graphics/line.ts
|
|
4008
|
+
const DEFAULT_GENERIC_LINE_OPTIONS = {
|
|
4009
|
+
smooth: false,
|
|
4010
|
+
smoothResolution: 12
|
|
4011
|
+
};
|
|
4012
|
+
const GENERIC_LINE_METADATA = {
|
|
4013
|
+
id: "line",
|
|
4014
|
+
name: "Line",
|
|
4015
|
+
description: "A non-doctrinal free polyline through two or more control points.",
|
|
4016
|
+
entity: "Generic Graphics",
|
|
4017
|
+
entityType: "Basic Shape",
|
|
4018
|
+
entitySubtype: "Line",
|
|
4019
|
+
value: "990101",
|
|
4020
|
+
minCoordinates: 2,
|
|
4021
|
+
geometry: "line",
|
|
4022
|
+
geometryTypes: ["LineString"],
|
|
4023
|
+
drawRule: "Line1",
|
|
4024
|
+
params: SMOOTH_PATH_PARAMS
|
|
4025
|
+
};
|
|
4026
|
+
function createGenericLine(coordinates, options = {}) {
|
|
4027
|
+
const projected = coordinates.map((point) => project(point[0], point[1]));
|
|
4028
|
+
if (!projected.some((point, index) => {
|
|
4029
|
+
const next = projected[index + 1];
|
|
4030
|
+
return next ? Math.hypot(next[0] - point[0], next[1] - point[1]) >= 1e-6 : false;
|
|
4031
|
+
})) return {
|
|
4032
|
+
type: "FeatureCollection",
|
|
4033
|
+
features: []
|
|
4034
|
+
};
|
|
4035
|
+
const { smooth, smoothResolution } = {
|
|
4036
|
+
...DEFAULT_GENERIC_LINE_OPTIONS,
|
|
4037
|
+
...options
|
|
4038
|
+
};
|
|
4039
|
+
const resolution = normalizeSmoothResolution$2(smoothResolution, 12);
|
|
4040
|
+
return {
|
|
4041
|
+
type: "FeatureCollection",
|
|
4042
|
+
features: [{
|
|
4043
|
+
type: "Feature",
|
|
4044
|
+
properties: { part: "line" },
|
|
4045
|
+
geometry: {
|
|
4046
|
+
type: "LineString",
|
|
4047
|
+
coordinates: (smooth ? catmullRom(projected, resolution) : projected).map((point) => unproject(point[0], point[1]))
|
|
4048
|
+
}
|
|
4049
|
+
}]
|
|
4050
|
+
};
|
|
4051
|
+
}
|
|
4052
|
+
const GENERIC_LINE = defineControlMeasure({
|
|
4053
|
+
metadata: GENERIC_LINE_METADATA,
|
|
4054
|
+
generator: createGenericLine,
|
|
4055
|
+
defaultOptions: DEFAULT_GENERIC_LINE_OPTIONS,
|
|
4056
|
+
rule: line1DrawRule,
|
|
4057
|
+
previewSample: { controlPoints: [
|
|
4058
|
+
[-1, -.4],
|
|
4059
|
+
[0, .5],
|
|
4060
|
+
[1, -.2]
|
|
4061
|
+
] }
|
|
4062
|
+
});
|
|
4063
|
+
//#endregion
|
|
4064
|
+
//#region src/generators/cm99-generic-graphics/polygon.ts
|
|
4065
|
+
const DEFAULT_GENERIC_POLYGON_OPTIONS = {
|
|
4066
|
+
smooth: false,
|
|
4067
|
+
smoothResolution: 12,
|
|
4068
|
+
filled: false
|
|
4069
|
+
};
|
|
4070
|
+
const GENERIC_POLYGON_METADATA = {
|
|
4071
|
+
id: "polygon",
|
|
4072
|
+
name: "Polygon",
|
|
4073
|
+
description: "A non-doctrinal free polygon with one outer ring.",
|
|
4074
|
+
entity: "Generic Graphics",
|
|
4075
|
+
entityType: "Basic Shape",
|
|
4076
|
+
entitySubtype: "Polygon",
|
|
4077
|
+
value: "990102",
|
|
4078
|
+
minCoordinates: 3,
|
|
4079
|
+
geometry: "area",
|
|
4080
|
+
geometryTypes: ["Polygon"],
|
|
4081
|
+
drawRule: "Area1",
|
|
4082
|
+
params: [...SMOOTH_PATH_PARAMS, ...FILLED_AREA_PARAMS]
|
|
4083
|
+
};
|
|
4084
|
+
function createGenericPolygon(coordinates, options = {}) {
|
|
4085
|
+
const projected = coordinates.map((point) => project(point[0], point[1]));
|
|
4086
|
+
const ringPoints = projected.length > 1 && vecMag(vecSub(projected[0], projected.at(-1))) < 1e-6 ? projected.slice(0, -1) : projected;
|
|
4087
|
+
if (ringPoints.length < 3) return {
|
|
4088
|
+
type: "FeatureCollection",
|
|
4089
|
+
features: []
|
|
4090
|
+
};
|
|
4091
|
+
const { smooth, smoothResolution, filled } = {
|
|
4092
|
+
...DEFAULT_GENERIC_POLYGON_OPTIONS,
|
|
4093
|
+
...options
|
|
4094
|
+
};
|
|
4095
|
+
const resolution = normalizeSmoothResolution$2(smoothResolution, 12);
|
|
4096
|
+
const ring = smooth ? closedCatmullRom(ringPoints, resolution) : [...ringPoints, ringPoints[0]];
|
|
4097
|
+
return {
|
|
4098
|
+
type: "FeatureCollection",
|
|
4099
|
+
features: [{
|
|
4100
|
+
type: "Feature",
|
|
4101
|
+
properties: {
|
|
4102
|
+
part: "polygon",
|
|
4103
|
+
fill: filled
|
|
4104
|
+
},
|
|
4105
|
+
geometry: {
|
|
4106
|
+
type: "Polygon",
|
|
4107
|
+
coordinates: [ring.map((point) => unproject(point[0], point[1]))]
|
|
4108
|
+
}
|
|
4109
|
+
}]
|
|
4110
|
+
};
|
|
4111
|
+
}
|
|
4112
|
+
const GENERIC_POLYGON = defineControlMeasure({
|
|
4113
|
+
metadata: GENERIC_POLYGON_METADATA,
|
|
4114
|
+
generator: createGenericPolygon,
|
|
4115
|
+
defaultOptions: DEFAULT_GENERIC_POLYGON_OPTIONS,
|
|
4116
|
+
rule: area1DrawRule,
|
|
4117
|
+
previewSample: { controlPoints: [
|
|
4118
|
+
[-.9, -.7],
|
|
4119
|
+
[.8, -.6],
|
|
4120
|
+
[1, .5],
|
|
4121
|
+
[-.4, .8]
|
|
4122
|
+
] }
|
|
4123
|
+
});
|
|
4124
|
+
//#endregion
|
|
4125
|
+
//#region src/generators/cm99-generic-graphics/rectangle.ts
|
|
4126
|
+
const DEFAULT_GENERIC_RECTANGLE_OPTIONS = { filled: false };
|
|
4127
|
+
const GENERIC_RECTANGLE_METADATA = {
|
|
4128
|
+
id: "rectangle",
|
|
4129
|
+
name: "Rectangle",
|
|
4130
|
+
description: "A non-doctrinal axis-aligned rectangle defined by two opposite corners.",
|
|
4131
|
+
entity: "Generic Graphics",
|
|
4132
|
+
entityType: "Basic Shape",
|
|
4133
|
+
entitySubtype: "Rectangle",
|
|
4134
|
+
value: "990103",
|
|
4135
|
+
minCoordinates: 2,
|
|
4136
|
+
maxCoordinates: 2,
|
|
4137
|
+
geometry: "area",
|
|
4138
|
+
geometryTypes: ["Polygon"],
|
|
4139
|
+
drawRule: "Rectangle",
|
|
4140
|
+
params: FILLED_AREA_PARAMS
|
|
4141
|
+
};
|
|
4142
|
+
function createGenericRectangle(coordinates, options = {}) {
|
|
4143
|
+
const p1 = project(coordinates[0][0], coordinates[0][1]);
|
|
4144
|
+
const p2 = project(coordinates[1][0], coordinates[1][1]);
|
|
4145
|
+
if (Math.abs(p2[0] - p1[0]) < 1e-6 || Math.abs(p2[1] - p1[1]) < 1e-6) return {
|
|
4146
|
+
type: "FeatureCollection",
|
|
4147
|
+
features: []
|
|
4148
|
+
};
|
|
4149
|
+
const ring = [
|
|
4150
|
+
p1,
|
|
4151
|
+
[p2[0], p1[1]],
|
|
4152
|
+
p2,
|
|
4153
|
+
[p1[0], p2[1]],
|
|
4154
|
+
p1
|
|
4155
|
+
].map((point) => unproject(point[0], point[1]));
|
|
4156
|
+
return {
|
|
4157
|
+
type: "FeatureCollection",
|
|
4158
|
+
features: [{
|
|
4159
|
+
type: "Feature",
|
|
4160
|
+
properties: {
|
|
4161
|
+
part: "rectangle",
|
|
4162
|
+
fill: options.filled ?? DEFAULT_GENERIC_RECTANGLE_OPTIONS.filled
|
|
4163
|
+
},
|
|
4164
|
+
geometry: {
|
|
4165
|
+
type: "Polygon",
|
|
4166
|
+
coordinates: [ring]
|
|
4167
|
+
}
|
|
4168
|
+
}]
|
|
4169
|
+
};
|
|
4170
|
+
}
|
|
4171
|
+
const GENERIC_RECTANGLE = defineControlMeasure({
|
|
4172
|
+
metadata: GENERIC_RECTANGLE_METADATA,
|
|
4173
|
+
generator: createGenericRectangle,
|
|
4174
|
+
defaultOptions: DEFAULT_GENERIC_RECTANGLE_OPTIONS,
|
|
4175
|
+
rule: rectangleDrawRule,
|
|
4176
|
+
previewSample: { controlPoints: [[-.9, -.55], [.9, .55]] }
|
|
4177
|
+
});
|
|
4178
|
+
//#endregion
|
|
3881
4179
|
//#region src/generators/cm34-mission-tasks/clear.ts
|
|
3882
4180
|
/**
|
|
3883
4181
|
* Default options for the CLEAR symbol.
|
|
@@ -4477,6 +4775,7 @@ const ENCIRCLEMENT = defineControlMeasure({
|
|
|
4477
4775
|
metadata: ENCIRCLEMENT_METADATA,
|
|
4478
4776
|
generator: createEncirclement,
|
|
4479
4777
|
defaultOptions: DEFAULT_ENCIRCLEMENT_OPTIONS,
|
|
4778
|
+
rule: area1DrawRule,
|
|
4480
4779
|
previewSample: {
|
|
4481
4780
|
controlPoints: [
|
|
4482
4781
|
[-1, -.5],
|
|
@@ -5243,6 +5542,7 @@ const FORTIFIED_AREA = defineControlMeasure({
|
|
|
5243
5542
|
metadata: FORTIFIED_AREA_METADATA,
|
|
5244
5543
|
generator: createFortifiedArea,
|
|
5245
5544
|
defaultOptions: DEFAULT_FORTIFIED_AREA_OPTIONS,
|
|
5545
|
+
rule: area1DrawRule,
|
|
5246
5546
|
previewSample: { controlPoints: [
|
|
5247
5547
|
[-1, -.5],
|
|
5248
5548
|
[1, -.5],
|
|
@@ -6271,6 +6571,7 @@ const STRONG_POINT = defineControlMeasure({
|
|
|
6271
6571
|
metadata: STRONG_POINT_METADATA,
|
|
6272
6572
|
generator: createStrongPoint,
|
|
6273
6573
|
defaultOptions: DEFAULT_STRONG_POINT_OPTIONS,
|
|
6574
|
+
rule: area1DrawRule,
|
|
6274
6575
|
previewSample: {
|
|
6275
6576
|
controlPoints: [
|
|
6276
6577
|
[-1, -.5],
|
|
@@ -6624,6 +6925,10 @@ const DEFINITIONS = {
|
|
|
6624
6925
|
"supporting-attack": SUPPORTING_ATTACK,
|
|
6625
6926
|
"classic-arrow": CLASSIC_ARROW,
|
|
6626
6927
|
"block-arrow": BLOCK_ARROW,
|
|
6928
|
+
line: GENERIC_LINE,
|
|
6929
|
+
polygon: GENERIC_POLYGON,
|
|
6930
|
+
rectangle: GENERIC_RECTANGLE,
|
|
6931
|
+
circle: GENERIC_CIRCLE,
|
|
6627
6932
|
"airborne-attack": AIRBORNE_ATTACK,
|
|
6628
6933
|
"attack-helicopter": ATTACK_HELICOPTER,
|
|
6629
6934
|
"support-by-fire": SUPPORT_BY_FIRE,
|
|
@@ -6874,4 +7179,4 @@ function assertNever(value) {
|
|
|
6874
7179
|
throw new Error(`Unhandled control measure kind: ${String(value)}`);
|
|
6875
7180
|
}
|
|
6876
7181
|
//#endregion
|
|
6877
|
-
export {
|
|
7182
|
+
export { point12DrawRule as $, DEFAULT_GENERIC_POLYGON_OPTIONS as A, DEFAULT_ANTITANK_WALL_OPTIONS as B, DEFAULT_FIX_OPTIONS as C, DEFAULT_DELAY_OPTIONS as D, DEFAULT_DISRUPT_OPTIONS as E, DEFAULT_BREACH_OPTIONS as F, axis1DrawRule as G, DEFAULT_AMBUSH_OPTIONS as H, DEFAULT_BLOCK_MISSION_TASK_OPTIONS as I, line23DrawRule as J, supportByFireDrawRule as K, DEFAULT_BLOCK_OPTIONS as L, DEFAULT_GENERIC_CIRCLE_OPTIONS as M, DEFAULT_CANALIZE_OPTIONS as N, DEFAULT_CLEAR_OPTIONS as O, DEFAULT_BYPASS_OPTIONS as P, attackByFireDrawRule as Q, DEFAULT_ATTACK_HELICOPTER_OPTIONS as R, DEFAULT_FLOT_OPTIONS as S, DEFAULT_ENCIRCLEMENT_OPTIONS as T, DEFAULT_AIRBORNE_ATTACK_OPTIONS as U, DEFAULT_ANTITANK_DITCH_OPTIONS as V, rectangleDrawRule as W, line1DrawRule as X, turnDrawRule as Y, ambushDrawRule as Z, DEFAULT_OBSTACLE_BYPASS_EASY_OPTIONS as _, DEFINITIONS as a, getMidpointPerpendicularSignedDistance as at, DEFAULT_FORTIFIED_AREA_OPTIONS as b, getDefaultOptions as c, createBaselineFrame as ct, DEFAULT_SUPPORTING_ATTACK_OPTIONS as d, project as dt, centerRadiusDrawRule as et, DEFAULT_SUPPORT_BY_FIRE_OPTIONS as f, unproject as ft, DEFAULT_OBSTACLE_BYPASS_IMPOSSIBLE_OPTIONS as g, DEFAULT_PRINCIPAL_DIRECTION_OF_FIRE_OPTIONS as h, roundToFixed as ht, CONTROL_MEASURE_METADATA as i, createMidpointPerpendicularDrawRule as it, DEFAULT_GENERIC_LINE_OPTIONS as j, DEFAULT_GENERIC_RECTANGLE_OPTIONS as k, listControlMeasureMetadata as l, calculateMetrics as lt, DEFAULT_TACTICAL_ARROW_OPTIONS as m, getMetersPerPixel as mt, resolveStyleHints as n, blockDrawRule as nt, getControlMeasureMetadata as o, pointOnMidpointPerpendicularAxis as ot, DEFAULT_STRONG_POINT_OPTIONS as p, EPSILON as pt, line24DrawRule as q, CONTROL_MEASURE_IDS as r, computeDefaultMidpointPerpendicularPoint as rt, getControlMeasureMetadataByValue as s, snapToMidpointPerpendicular as st, renderControlMeasure as t, disruptDrawRule as tt, DEFAULT_TURN_OPTIONS as u, computeInitialWidthPoint as ut, DEFAULT_OBSTACLE_BYPASS_DIFFICULT_OPTIONS as v, DEFAULT_FINAL_PROTECTIVE_FIRE_OPTIONS as w, DEFAULT_FORTIFIED_LINE_OPTIONS as x, DEFAULT_MAIN_ATTACK_OPTIONS as y, DEFAULT_ATTACK_BY_FIRE_OPTIONS as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orbat-mapper/control-measures",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.5",
|
|
4
4
|
"description": "Library for drawing tactical graphics and control measures according to MIL-STD-2525 and APP-6 standards.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Orbat Mapper",
|