@orbat-mapper/tactical-map-sheet 0.8.6 → 0.9.1

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.
@@ -1,8 +1,8 @@
1
1
  import GeographicLibMgrs from "geographiclib-mgrs";
2
2
  import PolarStereographic from "geographiclib-mgrs/src/polar-stereographic.mjs";
3
3
  import opentype from "opentype.js";
4
- import { DEFAULT_LABEL_HEIGHT_CSS_PIXELS, DEFAULT_LABEL_SIZE_BAND, DEFAULT_LINE_CAP, DEFAULT_LINE_JOIN, DEFAULT_PORTRAYAL, DEFAULT_STROKE_DASH_CSS_PIXELS, DEFAULT_STROKE_WIDTH_CSS_PIXELS, getFillPatternDefinition, labelTextOffsetEms, renderControlMeasure, resolveConstructionMetersPerCssPixel, resolveSymbolColor } from "@orbat-mapper/control-measures";
5
- import { effectivePointSymbolPixelSize, highlightBandsInPaintOrder, resolvePointSymbolOffset, resolveTextAppearance, scalePointSymbolLayout } from "@orbat-mapper/tactical-draw";
4
+ import { DEFAULT_LABEL_HEIGHT_CSS_PIXELS, DEFAULT_LABEL_SIZE_BAND, DEFAULT_LINE_CAP, DEFAULT_LINE_JOIN, DEFAULT_PORTRAYAL, DEFAULT_STROKE_DASH_CSS_PIXELS, DEFAULT_STROKE_WIDTH_CSS_PIXELS, getFillPatternDefinition, labelTextOffsetEms, renderControlMeasure, resolveConstructionMetersPerCssPixel, resolveHighlightAppearance, resolveSymbolColor } from "@orbat-mapper/control-measures";
5
+ import { DEFAULT_MARKER_SIZE, buildCollocationRender, collocationLeaderStrokes, collocationOpacity, effectivePointSymbolPixelSize, highlightBandsForStyle, highlightBandsInPaintOrder, layoutCollocation, resolvePointSymbolOffset, resolveTextAppearance, scalePointSymbolLayout } from "@orbat-mapper/tactical-draw";
6
6
  import { SaxesParser } from "saxes";
7
7
  //#region src/projection/geographic-lib.ts
8
8
  const backend = GeographicLibMgrs.UTMUPS;
@@ -674,15 +674,16 @@ function serializeElement(element) {
674
674
  ].join(" ");
675
675
  const viewBox = element.viewBox.map((value) => formatDecimal(value)).join(" ");
676
676
  const vector = `<svg width="${formatDecimal(element.width)}" height="${formatDecimal(element.height)}" viewBox="${viewBox}">${element.nodes.map(serializeVectorNode).join("")}</svg>`;
677
- return `<g data-vector-resource="${escapeXml(element.resourceId)}" data-octagon-anchor="${formatDecimal(element.octagonAnchor.x)} ${formatDecimal(element.octagonAnchor.y)}" transform="${transform}" opacity="${formatDecimal(element.opacity)}"${element.usesFont ? " font-family=\"Open Sans\"" : ""}>${vector}</g>`;
677
+ return `<g data-vector-resource="${escapeXml(element.resourceId)}" data-octagon-anchor="${formatDecimal(element.octagonAnchor.x)} ${formatDecimal(element.octagonAnchor.y)}" transform="${transform}" opacity="${formatDecimal(element.opacity)}"${element.usesFont ? " font-family=\"Open Sans\"" : ""}${serializeAttributes(element.attributes)}>${vector}</g>`;
678
678
  }
679
679
  if (element.kind === "text") return serializeText(element);
680
680
  if (element.points.length === 0) throw new Error("Cannot serialize an empty path");
681
681
  const commands = [element.points, ...element.holes ?? []].flatMap((ring, ringIndex) => [...ring.map((point, index) => `${index === 0 ? "M" : "L"} ${formatDecimal(point.xMm)} ${formatDecimal(point.yMm)}`), ...ringIndex > 0 || element.closed ? ["Z"] : []]);
682
682
  const fillAttribute = ` fill="${element.fillPatternId ? `url(#${escapeXml(element.fillPatternId)})` : escapeXml(element.fillColor ?? "none")}"`;
683
683
  const fillRule = element.holes ? ` fill-rule="evenodd"` : "";
684
+ const fillOpacity = element.fillOpacity !== void 0 ? ` fill-opacity="${formatDecimal(element.fillOpacity)}"` : "";
684
685
  const attributes = serializeAttributes(element.attributes);
685
- if (element.strokeWidthMm === 0) return `<path d="${commands.join(" ")}" stroke="none"${fillAttribute}${fillRule}${attributes}/>`;
686
+ if (element.strokeWidthMm === 0) return `<path d="${commands.join(" ")}" stroke="none"${fillAttribute}${fillRule}${fillOpacity}${attributes}/>`;
686
687
  return [
687
688
  `<path d="${commands.join(" ")}"`,
688
689
  ` stroke="${escapeXml(element.strokeColor)}"`,
@@ -693,6 +694,7 @@ function serializeElement(element) {
693
694
  element.fillColor || element.fillPatternId ? ` paint-order="fill stroke"` : "",
694
695
  fillAttribute,
695
696
  fillRule,
697
+ fillOpacity,
696
698
  attributes,
697
699
  "/>"
698
700
  ].join("");
@@ -1097,14 +1099,19 @@ function resolveSizePixels(size, groundMetersPerCssPixel) {
1097
1099
  }
1098
1100
  return effectivePointSymbolPixelSize({ size }, groundMetersPerCssPixel);
1099
1101
  }
1102
+ /** A symbol's drawn opacity, 0–1: a point symbol's style opacities multiplied, or a custom symbol's own. */
1103
+ function symbolOpacity(symbol) {
1104
+ const opacity = symbol.kind === "point-symbol" ? (symbol.style?.opacity ?? 1) * (symbol.style?.overallOpacity ?? 1) : symbol.opacity ?? 1;
1105
+ if (!Number.isFinite(opacity) || opacity < 0 || opacity > 1) throw new RangeError("Symbol opacity must be between 0 and 1");
1106
+ return opacity;
1107
+ }
1100
1108
  function renderVectorSymbol(symbol, vector, context) {
1101
1109
  validateVectorMetadata(vector);
1102
1110
  const imported = importVectorSvg(vector.svg);
1103
1111
  requireFinite(symbol.rotation, "Symbol rotation");
1104
1112
  const projected = geographicLibGridProjection.forward(context.crs, symbol.position);
1105
1113
  const position = projectedToScenePoint(projected, context);
1106
- const opacity = symbol.kind === "point-symbol" ? (symbol.style?.opacity ?? 1) * (symbol.style?.overallOpacity ?? 1) : symbol.opacity ?? 1;
1107
- if (!Number.isFinite(opacity) || opacity < 0 || opacity > 1) throw new RangeError("Symbol opacity must be between 0 and 1");
1114
+ const opacity = symbolOpacity(symbol);
1108
1115
  const octagonSizeMm = resolveSizePixels(symbol.size, context.groundMetersPerCssPixel) * MILLIMETRES_PER_CSS_PIXEL;
1109
1116
  return {
1110
1117
  kind: "vector-symbol",
@@ -1549,6 +1556,399 @@ function renderNoteElements(note, capability, context) {
1549
1556
  }] };
1550
1557
  }
1551
1558
  //#endregion
1559
+ //#region src/collocation.ts
1560
+ /**
1561
+ * A tactical-draw `Collocation` as a {@link MapSheetCollocation} (#755): every
1562
+ * field is copied and each member's graphic goes through `member`, the same
1563
+ * converter a host uses for standalone symbols. Parts, Highlight and member
1564
+ * order are kept.
1565
+ *
1566
+ * ```ts
1567
+ * const sheet = toMapSheetCollocation(collocation, (graphic) =>
1568
+ * graphic.kind === "marker" ? markerSymbol(graphic) : graphic,
1569
+ * );
1570
+ * ```
1571
+ */
1572
+ function toMapSheetCollocation(collocation, member) {
1573
+ return {
1574
+ ...collocation,
1575
+ members: collocation.members.map((entry) => ({
1576
+ ...entry,
1577
+ graphic: member(entry.graphic)
1578
+ }))
1579
+ };
1580
+ }
1581
+ const MM = MILLIMETRES_PER_CSS_PIXEL;
1582
+ function noop() {}
1583
+ /**
1584
+ * The collocation render for map-sheet members, built once with a per-kind
1585
+ * capability table. Point-symbol members go through the host capability (its
1586
+ * `collocation` support when present). Custom-symbol members join as the
1587
+ * Marker kind, drawn from their vector by a capability without collocation
1588
+ * support, so they take the engine fallback; their registration and size
1589
+ * reference are then the vector's octagon, as for a point symbol.
1590
+ */
1591
+ function buildRender(collocation, capability, highlight, ordinary) {
1592
+ const customs = /* @__PURE__ */ new Map();
1593
+ const engine = {
1594
+ id: collocation.id,
1595
+ kind: "collocation",
1596
+ ...collocation.position ? { position: collocation.position } : {},
1597
+ members: collocation.members.map((member) => {
1598
+ const { graphic } = member;
1599
+ const entry = {
1600
+ ...member.part ? { part: member.part } : {},
1601
+ ...member.highlight !== void 0 ? { highlight: member.highlight } : {}
1602
+ };
1603
+ if (graphic.kind === "point-symbol") return {
1604
+ ...entry,
1605
+ graphic
1606
+ };
1607
+ customs.set(graphic.id, graphic.vector);
1608
+ return {
1609
+ ...entry,
1610
+ graphic: {
1611
+ id: graphic.id,
1612
+ kind: "marker",
1613
+ symbolId: graphic.vector.resourceId,
1614
+ rotation: graphic.rotation,
1615
+ ...graphic.position ? { position: graphic.position } : {},
1616
+ schemaVersion: 1
1617
+ }
1618
+ };
1619
+ }),
1620
+ ...collocation.placements ? { placements: collocation.placements } : {},
1621
+ ...collocation.size ? { size: collocation.size } : {},
1622
+ ...collocation.options ? { options: collocation.options } : {},
1623
+ schemaVersion: 1
1624
+ };
1625
+ const pointOf = (graphic) => graphic;
1626
+ const support = capability?.collocation;
1627
+ const render = buildCollocationRender(engine, {
1628
+ marker: { render: (marker) => {
1629
+ const vector = customs.get(marker.id);
1630
+ return {
1631
+ resourceId: vector.resourceId,
1632
+ svg: vector.svg,
1633
+ width: vector.width,
1634
+ height: vector.height,
1635
+ anchor: { ...vector.anchor }
1636
+ };
1637
+ } },
1638
+ ...capability ? { pointSymbol: {
1639
+ defaultSize: capability.defaultSize ?? DEFAULT_MARKER_SIZE,
1640
+ defaultRotation: 0,
1641
+ render: (symbol) => {
1642
+ const vector = ordinary(pointOf(symbol), symbol.position);
1643
+ return {
1644
+ resourceId: vector.resourceId,
1645
+ svg: vector.svg,
1646
+ octagonSize: vector.octagonSize,
1647
+ width: vector.width,
1648
+ height: vector.height,
1649
+ anchor: { ...vector.anchor },
1650
+ octagonAnchor: { ...vector.octagonAnchor },
1651
+ valid: vector.valid !== false
1652
+ };
1653
+ },
1654
+ invalidate: noop,
1655
+ ...support ? { collocation: {
1656
+ role: (graphic) => support.role(pointOf(graphic)),
1657
+ render: (graphic, context) => support.render(pointOf(graphic), context),
1658
+ sizeReference: (graphic) => support.sizeReference(pointOf(graphic))
1659
+ } } : {}
1660
+ } } : {}
1661
+ }, highlight ? { highlight } : {});
1662
+ return {
1663
+ ...render,
1664
+ members: render.members.map((member) => {
1665
+ const vector = customs.get(member.memberId);
1666
+ if (!vector || !member.render) return member;
1667
+ return {
1668
+ ...member,
1669
+ render: {
1670
+ ...member.render,
1671
+ registration: { ...vector.octagonAnchor },
1672
+ sizeReference: vector.octagonSize
1673
+ }
1674
+ };
1675
+ })
1676
+ };
1677
+ }
1678
+ function offsetPoint(origin, [x, y]) {
1679
+ return {
1680
+ xMm: origin.xMm + x * MM,
1681
+ yMm: origin.yMm + y * MM
1682
+ };
1683
+ }
1684
+ function strokePath(points, color, widthPx, attributes, extra = {}) {
1685
+ return {
1686
+ kind: "path",
1687
+ points,
1688
+ strokeColor: color,
1689
+ strokeWidthMm: widthPx * MM,
1690
+ strokeDashMm: [],
1691
+ lineCap: "round",
1692
+ lineJoin: "round",
1693
+ ...extra,
1694
+ attributes
1695
+ };
1696
+ }
1697
+ /** A ground mark as page paths, from the layout's shape: a white-filled ring, a filled dot or a cross. */
1698
+ function markPaths(centre, mark, attributes) {
1699
+ const at = (path) => path.map((p) => offsetPoint(centre, p));
1700
+ if (mark.mark === "cross") return mark.paths.map((path) => strokePath(at(path), mark.color, mark.strokeWidth, { ...attributes }));
1701
+ const fill = mark.mark === "dot" ? mark.color : "#ffffff";
1702
+ const width = mark.mark === "dot" ? .5 : mark.strokeWidth;
1703
+ return mark.paths.map((path) => strokePath(at(path), mark.color, width, attributes, {
1704
+ closed: true,
1705
+ fillColor: fill
1706
+ }));
1707
+ }
1708
+ /** The Highlight bands, bottom to top, stroked along a path drawn `strokeWidth` px wide. */
1709
+ function highlightPaths(path, strokeWidthPx, appearance) {
1710
+ const { color, width, glow } = resolveHighlightAppearance(appearance);
1711
+ return highlightBandsForStyle({
1712
+ highlightColor: color,
1713
+ highlightWidth: width,
1714
+ highlightGlow: glow,
1715
+ strokeWidth: strokeWidthPx
1716
+ }, strokeWidthPx).map((band) => ({
1717
+ kind: "path",
1718
+ points: path.points,
1719
+ ...path.closed ? { closed: true } : {},
1720
+ strokeColor: band.color,
1721
+ strokeWidthMm: band.width * MM,
1722
+ ...band.opacity < 1 ? { strokeOpacity: band.opacity } : {},
1723
+ strokeDashMm: [],
1724
+ lineCap: "round",
1725
+ lineJoin: "round",
1726
+ attributes: {
1727
+ ...path.attributes,
1728
+ "data-highlight": band.slot
1729
+ }
1730
+ }));
1731
+ }
1732
+ function partElements(layout, origin, leaderColor, members, appearance) {
1733
+ const part = layout.part;
1734
+ const at = (line) => line.map((p) => offsetPoint(origin, p));
1735
+ const strokes = [...layout.lines.map((line) => ({
1736
+ line,
1737
+ width: layout.lineWidth,
1738
+ color: layout.lineColor,
1739
+ dash: [],
1740
+ element: "line"
1741
+ })), ...collocationLeaderStrokes(layout).map((line) => ({
1742
+ line,
1743
+ width: layout.leaderWidth,
1744
+ color: leaderColor,
1745
+ dash: layout.leaderDash,
1746
+ element: line === layout.tick ? "tick" : "leader"
1747
+ }))];
1748
+ const halo = layout.haloExtra !== void 0 && layout.haloColor !== void 0 ? strokes.map(({ line, width }) => strokePath(at(line), layout.haloColor, width + layout.haloExtra, {
1749
+ "data-part": part,
1750
+ "data-element": "halo"
1751
+ })) : [];
1752
+ const lines = strokes.map(({ line, width, color, dash, element }) => strokePath(at(line), color, width, {
1753
+ "data-part": part,
1754
+ "data-element": element
1755
+ }, { strokeDashMm: dash.map((value) => value * MM) }));
1756
+ const icons = layout.members.flatMap((member) => {
1757
+ const attributes = {
1758
+ "data-part": part,
1759
+ "data-member": member.memberId
1760
+ };
1761
+ const box = member.highlightCasing;
1762
+ const casing = box ? highlightPaths(strokePath(at([
1763
+ [box.x, box.y],
1764
+ [box.x + box.width, box.y],
1765
+ [box.x + box.width, box.y + box.height],
1766
+ [box.x, box.y + box.height]
1767
+ ]), layout.lineColor, 0, {
1768
+ ...attributes,
1769
+ "data-element": "member"
1770
+ }, { closed: true }), 0, appearance) : [];
1771
+ const { icon, registration } = member.render;
1772
+ const imported = importVectorSvg(icon.svg);
1773
+ const symbol = {
1774
+ kind: "vector-symbol",
1775
+ position: offsetPoint(origin, member.topLeft),
1776
+ viewBox: imported.viewBox,
1777
+ nodes: imported.nodes,
1778
+ resourceId: icon.resourceId,
1779
+ width: icon.width,
1780
+ height: icon.height,
1781
+ anchor: {
1782
+ x: 0,
1783
+ y: 0
1784
+ },
1785
+ octagonAnchor: { ...registration },
1786
+ scaleMmPerUnit: member.iconScale * MM,
1787
+ rotationDegrees: 0,
1788
+ opacity: symbolOpacity(members.get(member.memberId)),
1789
+ usesFont: imported.usesFont,
1790
+ attributes
1791
+ };
1792
+ return [...casing, symbol];
1793
+ });
1794
+ const shown = layout.plate;
1795
+ const border = shown?.border;
1796
+ return [
1797
+ ...(shown?.rings ?? []).map((ring) => ({
1798
+ kind: "path",
1799
+ points: at(ring),
1800
+ closed: true,
1801
+ strokeColor: border?.strokeColor ?? shown.fillColor,
1802
+ strokeWidthMm: border ? border.strokeWidth * MM : 0,
1803
+ strokeDashMm: [],
1804
+ lineCap: "butt",
1805
+ lineJoin: "miter",
1806
+ fillColor: shown.fillColor,
1807
+ fillOpacity: shown.fillOpacity,
1808
+ attributes: {
1809
+ "data-part": part,
1810
+ "data-element": "plate"
1811
+ }
1812
+ })),
1813
+ ...halo,
1814
+ ...lines,
1815
+ ...icons
1816
+ ];
1817
+ }
1818
+ /**
1819
+ * Draw a collocation as page elements (ADR-0063, #635): the shared layout at
1820
+ * the sheet's ground resolution, ground marks projected in the grid CRS, and
1821
+ * part line work, leaders and members upright on the page, in the fixed draw
1822
+ * order (spread, ties, member position marks, ground leaders, location mark,
1823
+ * then each part's halo, lines and members).
1824
+ */
1825
+ function renderCollocationElements(collocation, context) {
1826
+ const capability = context.pointSymbols;
1827
+ if (!capability && collocation.members.some((m) => m.graphic.kind === "point-symbol")) throw new Error(`Cannot render Graphic "${collocation.id}": a point-symbol capability is required`);
1828
+ const ordinaryRenders = /* @__PURE__ */ new Map();
1829
+ const ordinary = (graphic, location) => {
1830
+ const cached = ordinaryRenders.get(graphic.id);
1831
+ if (cached) return cached;
1832
+ const vector = capability.render({
1833
+ ...graphic,
1834
+ position: graphic.position ?? location
1835
+ });
1836
+ ordinaryRenders.set(graphic.id, vector);
1837
+ return vector;
1838
+ };
1839
+ const render = buildRender(collocation, capability, context.highlightAppearance, ordinary);
1840
+ const layout = layoutCollocation(render, context.groundMetersPerCssPixel);
1841
+ const location = layout.location;
1842
+ if (!location) return { status: "hidden" };
1843
+ const locationPoint = context.toScenePoint(location);
1844
+ if (!locationPoint) return { status: "out-of-range" };
1845
+ const fallbackMembers = collocation.members.flatMap((member) => member.graphic.kind === "point-symbol" && ordinary({
1846
+ ...member.graphic,
1847
+ size: render.size
1848
+ }, location).valid === false ? [member.graphic.id] : []);
1849
+ const members = new Map(collocation.members.map((m) => [m.graphic.id, m.graphic]));
1850
+ const appearance = context.highlightAppearance;
1851
+ const ground = layout.ground;
1852
+ const elements = [];
1853
+ const project = (positions) => {
1854
+ const points = positions.map((p) => context.toScenePoint(p));
1855
+ return points.every((p) => p !== void 0) ? points : void 0;
1856
+ };
1857
+ if (ground.spread) {
1858
+ const points = project(ground.spread.ring);
1859
+ const style = ground.spread.style;
1860
+ if (points) {
1861
+ const pattern = style.fillPattern && style.fillPattern !== "solid" ? context.registerPattern(style.fillPattern, style.fillColor) : void 0;
1862
+ elements.push({
1863
+ kind: "path",
1864
+ points,
1865
+ closed: true,
1866
+ strokeColor: style.strokeColor,
1867
+ strokeWidthMm: style.strokeWidth * MM,
1868
+ strokeDashMm: style.strokeDash.map((value) => value * MM),
1869
+ lineCap: "butt",
1870
+ lineJoin: "round",
1871
+ fillColor: style.fillColor,
1872
+ ...pattern ? { fillPatternId: pattern } : { fillOpacity: style.fillOpacity },
1873
+ attributes: {
1874
+ "data-part": "ground",
1875
+ "data-element": "spread"
1876
+ }
1877
+ });
1878
+ }
1879
+ }
1880
+ for (const tie of ground.ties) {
1881
+ const points = project(tie.coordinates);
1882
+ if (!points) continue;
1883
+ const path = strokePath(points, tie.color, tie.width, {
1884
+ "data-part": "ground",
1885
+ "data-element": "tie",
1886
+ "data-member": tie.memberId
1887
+ }, { strokeDashMm: tie.dash.map((value) => value * MM) });
1888
+ if (tie.highlight) elements.push(...highlightPaths(path, tie.width, appearance));
1889
+ elements.push(path);
1890
+ }
1891
+ for (const mark of ground.memberPositions) {
1892
+ const point = context.toScenePoint(mark.position);
1893
+ if (!point) continue;
1894
+ const paths = markPaths(point, mark, {
1895
+ "data-part": "ground",
1896
+ "data-element": "member-position",
1897
+ "data-member": mark.memberId
1898
+ });
1899
+ if (mark.highlight) elements.push(...paths.flatMap((path) => highlightPaths(path, mark.mark === "dot" ? 0 : mark.strokeWidth, appearance)));
1900
+ elements.push(...paths);
1901
+ }
1902
+ for (const leader of ground.leaders) {
1903
+ const points = project(leader.coordinates);
1904
+ if (!points) continue;
1905
+ if (leader.haloExtra !== void 0 && leader.haloColor !== void 0) elements.push(strokePath(points, leader.haloColor, leader.width + leader.haloExtra, {
1906
+ "data-part": leader.part,
1907
+ "data-element": "halo"
1908
+ }));
1909
+ elements.push(strokePath(points, leader.color, leader.width, {
1910
+ "data-part": leader.part,
1911
+ "data-element": "ground-leader"
1912
+ }, { strokeDashMm: leader.dash.map((value) => value * MM) }));
1913
+ }
1914
+ if (ground.location) {
1915
+ const mark = ground.location;
1916
+ elements.push(...markPaths(locationPoint, mark, {
1917
+ "data-part": "ground",
1918
+ "data-element": "location"
1919
+ }));
1920
+ }
1921
+ for (const part of [layout.parts.staff, layout.parts.bracket]) {
1922
+ if (!part) continue;
1923
+ const origin = part.mode === "ground" ? context.toScenePoint(part.anchor) : locationPoint;
1924
+ if (!origin) continue;
1925
+ elements.push(...partElements(part, origin, layout.options.leader.strokeColor, members, appearance));
1926
+ }
1927
+ const opacity = collocationOpacity(collocation);
1928
+ return {
1929
+ status: "drawn",
1930
+ elements: opacity < 1 ? elements.map((element) => fadeElement(element, opacity)) : elements,
1931
+ fallbackMembers
1932
+ };
1933
+ }
1934
+ /**
1935
+ * Apply the collocation's `style.opacity` to one element: multiplied into a
1936
+ * symbol's opacity and a path's stroke and fill opacity, Highlight bands
1937
+ * included.
1938
+ */
1939
+ function fadeElement(element, opacity) {
1940
+ if (element.kind === "vector-symbol") return {
1941
+ ...element,
1942
+ opacity: element.opacity * opacity
1943
+ };
1944
+ if (element.kind !== "path") return element;
1945
+ return {
1946
+ ...element,
1947
+ strokeOpacity: (element.strokeOpacity ?? 1) * opacity,
1948
+ ...element.fillColor !== void 0 ? { fillOpacity: (element.fillOpacity ?? 1) * opacity } : {}
1949
+ };
1950
+ }
1951
+ //#endregion
1552
1952
  //#region src/render-layers.ts
1553
1953
  function geographicBounds(positions, longitudeReference) {
1554
1954
  const longitudes = positions.map((position) => longitudeReference + ((position[0] - longitudeReference) % 360 + 540) % 360 - 180);
@@ -2055,9 +2455,57 @@ function visibilityWarning(layerId, graphicId, elements, frame) {
2055
2455
  graphicId
2056
2456
  };
2057
2457
  }
2458
+ function renderCollocation(layerId, collocation, portrayal, context) {
2459
+ const graphicId = collocation.id;
2460
+ const result = renderCollocationElements(collocation, {
2461
+ ...context.pointSymbols ? { pointSymbols: context.pointSymbols } : {},
2462
+ groundMetersPerCssPixel: context.groundMetersPerCssPixel,
2463
+ ...portrayal.highlightAppearance ? { highlightAppearance: portrayal.highlightAppearance } : {},
2464
+ toScenePoint(position) {
2465
+ try {
2466
+ return toScenePoint(position, context);
2467
+ } catch (error) {
2468
+ if (isGridProjectionRangeError(error)) return void 0;
2469
+ throw error;
2470
+ }
2471
+ },
2472
+ registerPattern: (pattern, color) => registerPattern(pattern, color, context)
2473
+ });
2474
+ if (result.status === "hidden") return { warnings: [{
2475
+ code: "graphic-hidden",
2476
+ layerId,
2477
+ graphicId
2478
+ }] };
2479
+ if (result.status === "out-of-range") return { warnings: [{
2480
+ code: "graphic-outside-frame",
2481
+ layerId,
2482
+ graphicId
2483
+ }] };
2484
+ const warnings = result.fallbackMembers.map((memberId) => ({
2485
+ code: "point-symbol-fallback",
2486
+ layerId,
2487
+ graphicId,
2488
+ memberId
2489
+ }));
2490
+ const visibility = visibilityWarning(layerId, graphicId, result.elements, context.frame);
2491
+ if (visibility) warnings.push(visibility);
2492
+ return {
2493
+ graphic: {
2494
+ id: graphicId,
2495
+ elements: result.elements
2496
+ },
2497
+ warnings
2498
+ };
2499
+ }
2058
2500
  function renderGraphic(layerId, authored, portrayal, context) {
2059
2501
  const graphic = authored.graphic;
2060
2502
  requireIdentifier(graphic.id, "Graphic id");
2503
+ if (graphic.kind === "collocation") try {
2504
+ return renderCollocation(layerId, graphic, portrayal, context);
2505
+ } catch (error) {
2506
+ if (error instanceof Error && error.message.startsWith("Cannot render Graphic")) throw error;
2507
+ throw new Error(`Cannot render Graphic "${graphic.id}": ${String(error)}`, { cause: error });
2508
+ }
2061
2509
  if (graphic.kind === "point-symbol" || graphic.kind === "custom-symbol" || graphic.kind === "note") {
2062
2510
  if (projectionRangeError([graphic.position], context) && !boundsOverlap(geographicBounds([graphic.position], context.footprintRing[0][0]), frameGeographicBounds(context))) return { warnings: [{
2063
2511
  code: "graphic-outside-frame",
@@ -2814,4 +3262,4 @@ function createTacticalMapSheet(request) {
2814
3262
  return createTacticalMapSheetDocument(request).result;
2815
3263
  }
2816
3264
  //#endregion
2817
- export { openSansCentralBaselineOffset as _, geographicToMgrs as a, normalizeMgrsReference as c, snapGeographicToMgrs as d, snapProjectedToMgrs as f, POINTS_PER_MILLIMETRE as g, MILLIMETRES_PER_CSS_PIXEL as h, resolveMapSheetRasterPlan as i, parseMgrsReference as l, formatDecimal as m, createTacticalMapSheetDocument as n, mgrsToGeographic as o, prepareMapSheetNotes as p, mapSheetRasterPointToGeographic as r, mgrsToProjected as s, createTacticalMapSheet as t, projectedToMgrs as u, openSansMiddleBaselineOffset as v };
3265
+ export { POINTS_PER_MILLIMETRE as _, geographicToMgrs as a, normalizeMgrsReference as c, snapGeographicToMgrs as d, snapProjectedToMgrs as f, MILLIMETRES_PER_CSS_PIXEL as g, formatDecimal as h, resolveMapSheetRasterPlan as i, parseMgrsReference as l, prepareMapSheetNotes as m, createTacticalMapSheetDocument as n, mgrsToGeographic as o, toMapSheetCollocation as p, mapSheetRasterPointToGeographic as r, mgrsToProjected as s, createTacticalMapSheet as t, projectedToMgrs as u, openSansCentralBaselineOffset as v, openSansMiddleBaselineOffset as y };
@@ -1,5 +1,5 @@
1
1
  import { ControlMeasure, HighlightAppearance, PatternId, TextAmplifiers } from "@orbat-mapper/control-measures";
2
- import { PointSymbolOffset, PointSymbolRender } from "@orbat-mapper/tactical-draw";
2
+ import { Collocation, CollocationBracketPlacement, CollocationMemberGraphic, CollocationMemberSupport, CollocationOptions, CollocationPart, CollocationStyle, PointSymbolOffset, PointSymbolPlacement, PointSymbolRender } from "@orbat-mapper/tactical-draw";
3
3
  import { NoteCapability, NoteModel } from "@orbat-mapper/tactical-notes";
4
4
 
5
5
  //#region ../../node_modules/.pnpm/@types+geojson@7946.0.16/node_modules/@types/geojson/index.d.ts
@@ -224,6 +224,8 @@ interface ScenePath {
224
224
  /** Stroke opacity multiplied with any alpha in `strokeColor`; omitted means `1`. */
225
225
  readonly strokeOpacity?: number;
226
226
  readonly fillColor?: string;
227
+ /** Fill opacity multiplied with any alpha in `fillColor`; omitted means `1`. */
228
+ readonly fillOpacity?: number;
227
229
  readonly fillPatternId?: string;
228
230
  readonly attributes?: Readonly<Record<string, string | number>>;
229
231
  }
@@ -314,6 +316,7 @@ interface SceneVectorSymbol {
314
316
  * `<svg>` does. Set where content past the viewBox must not reach the page.
315
317
  */
316
318
  readonly clipToViewBox?: boolean;
319
+ readonly attributes?: Readonly<Record<string, string | number>>;
317
320
  }
318
321
  interface SceneRasterImage {
319
322
  /**
@@ -427,6 +430,76 @@ interface MapSheetMarginaliaOptions {
427
430
  readonly showFootprint?: boolean;
428
431
  }
429
432
  //#endregion
433
+ //#region src/collocation.d.ts
434
+ /**
435
+ * A point symbol as a collocation member: its position and size are optional
436
+ * (ADR-0063). Its size is ignored: the collocation's `size` applies.
437
+ */
438
+ type MapSheetCollocationPointSymbol = Omit<MapSheetPointSymbol, "position" | "size"> & {
439
+ readonly position?: Position;
440
+ readonly size?: MapSheetSymbolSize;
441
+ };
442
+ /**
443
+ * A custom symbol as a collocation member: its position and size are optional
444
+ * (ADR-0063). Its size is ignored: the collocation's `size` applies.
445
+ */
446
+ type MapSheetCollocationCustomSymbol = Omit<MapSheetCustomSymbol, "position" | "size"> & {
447
+ readonly position?: Position;
448
+ readonly size?: MapSheetSymbolSize;
449
+ };
450
+ type MapSheetCollocationMemberGraphic = MapSheetCollocationPointSymbol | MapSheetCollocationCustomSymbol;
451
+ interface MapSheetCollocationMember {
452
+ /** The embedded graphic; its `id` is the member id, unique within this collocation only. */
453
+ readonly graphic: MapSheetCollocationMemberGraphic;
454
+ /** Always wins over the capability's role and `options.parts`. */
455
+ readonly part?: CollocationPart;
456
+ /** Print this member in the layer's Highlight appearance. */
457
+ readonly highlight?: boolean;
458
+ }
459
+ /**
460
+ * The map sheet's mirror of tactical-draw's `Collocation` (ADR-0063): several
461
+ * point symbols and custom symbols presented as standing together at one
462
+ * location, in a Staff and a Bracket. Custom symbols always use the engine
463
+ * fallback: Bracket, box = the whole icon, registration at `octagonAnchor`.
464
+ */
465
+ interface MapSheetCollocation {
466
+ readonly id: string;
467
+ readonly kind: "collocation";
468
+ /** The location, if the host owns one; otherwise derived from member positions. */
469
+ readonly position?: Position;
470
+ /** Host order. */
471
+ readonly members: readonly MapSheetCollocationMember[];
472
+ readonly placements?: {
473
+ readonly staff?: PointSymbolPlacement;
474
+ readonly bracket?: CollocationBracketPlacement;
475
+ };
476
+ /**
477
+ * The size every member prints at; members' own sizes are ignored. Absent,
478
+ * the point-symbol capability's `defaultSize` applies.
479
+ */
480
+ readonly size?: MapSheetSymbolSize;
481
+ readonly options?: CollocationOptions;
482
+ /** `opacity` fades everything the collocation prints, on top of each member's own. */
483
+ readonly style?: Readonly<CollocationStyle>;
484
+ readonly properties?: Record<string, unknown>;
485
+ readonly schemaVersion: 1;
486
+ }
487
+ /**
488
+ * A tactical-draw `Collocation` as a {@link MapSheetCollocation} (#755): every
489
+ * field is copied and each member's graphic goes through `member`, the same
490
+ * converter a host uses for standalone symbols. Parts, Highlight and member
491
+ * order are kept.
492
+ *
493
+ * ```ts
494
+ * const sheet = toMapSheetCollocation(collocation, (graphic) =>
495
+ * graphic.kind === "marker" ? markerSymbol(graphic) : graphic,
496
+ * );
497
+ * ```
498
+ */
499
+ declare function toMapSheetCollocation(collocation: Collocation, member: (graphic: CollocationMemberGraphic) => MapSheetCollocationMemberGraphic): MapSheetCollocation;
500
+ /** Collocation member support on {@link MapSheetPointSymbolCapability} (ADR-0063). */
501
+ type MapSheetCollocationMemberSupport = CollocationMemberSupport<MapSheetCollocationPointSymbol>;
502
+ //#endregion
430
503
  //#region src/vector-symbol.d.ts
431
504
  type MapSheetSymbolSize = {
432
505
  readonly value: number;
@@ -496,6 +569,18 @@ interface MapSheetCustomSymbol {
496
569
  }
497
570
  interface MapSheetPointSymbolCapability {
498
571
  render(symbol: MapSheetPointSymbol): ControlledVectorSymbol;
572
+ /**
573
+ * The size a collocation's members print at when it has no `size` of its
574
+ * own; `milsymbolPointSymbols({ collocation: milsymbolCollocation })` provides it. Without it the Marker draw
575
+ * default applies.
576
+ */
577
+ readonly defaultSize?: MapSheetSymbolSize;
578
+ /**
579
+ * Optional collocation member support (ADR-0063), the same shape as
580
+ * tactical-draw's; `milsymbolPointSymbols({ collocation: milsymbolCollocation })` provides it. Without it a
581
+ * point-symbol member stands in the Bracket, drawn from its ordinary render.
582
+ */
583
+ readonly collocation?: MapSheetCollocationMemberSupport;
499
584
  }
500
585
  //#endregion
501
586
  //#region src/note.d.ts
@@ -580,7 +665,7 @@ interface MapSheetPortrayalDefaults {
580
665
  */
581
666
  readonly highlightAppearance?: HighlightAppearance;
582
667
  }
583
- type MapSheetAuthoredGraphic = ControlMeasure | MapSheetPointSymbol | MapSheetCustomSymbol | MapSheetNote;
668
+ type MapSheetAuthoredGraphic = ControlMeasure | MapSheetPointSymbol | MapSheetCustomSymbol | MapSheetNote | MapSheetCollocation;
584
669
  interface AuthoredMapSheetGraphic {
585
670
  readonly graphic: MapSheetAuthoredGraphic;
586
671
  }
@@ -604,6 +689,8 @@ interface GraphicHiddenWarning extends IdentifiedGraphicWarning {
604
689
  }
605
690
  interface PointSymbolFallbackWarning extends IdentifiedGraphicWarning {
606
691
  readonly code: "point-symbol-fallback";
692
+ /** The fallen-back collocation member, when `graphicId` is a collocation. */
693
+ readonly memberId?: string;
607
694
  }
608
695
  type GraphicVisibilityWarning = GraphicClippedWarning | GraphicOutsideFrameWarning | GraphicHiddenWarning;
609
696
  interface PointSymbolOffsetWarning extends IdentifiedGraphicWarning {
@@ -771,4 +858,4 @@ interface TacticalMapSheetResult {
771
858
  }
772
859
  declare function createTacticalMapSheet(request: TacticalMapSheetRequest): TacticalMapSheetResult;
773
860
  //#endregion
774
- export { MapSheetMarginaliaOptions as $, PaperSizeName as A, PointSymbolOffsetWarning as B, ResolvedMapSheetRasterTileMetadata as C, ResolvedRegistrationMark as D, MapSheetRegistrationRequest as E, GraphicOutsideFrameWarning as F, PrepareMapSheetNotesOptions as G, MapSheetNote as H, GraphicRenderWarning as I, MapSheetCustomSymbol as J, prepareMapSheetNotes as K, MapSheetAuthoredGraphic as L, AuthoredMapSheetGraphic as M, GraphicClippedWarning as N, PAPER_SIZES as O, GraphicHiddenWarning as P, VectorSymbolAnchor as Q, MapSheetPortrayalDefaults as R, ResolvedMapSheetRasterLayerMetadata as S, AuthoredRegistrationMark as T, MapSheetNoteCapability as U, TacticalMapSheetLayer as V, MapSheetNoteRaster as W, MapSheetPointSymbolCapability as X, MapSheetPointSymbol as Y, MapSheetSymbolSize as Z, MapSheetRasterLayer as _, ResolvedMapSheetMetadata as a, MapSheetPatternIdentity as at, RasterDpiAnisotropyWarning as b, TacticalMapSheetResources as c, GeographicPosition as ct, UpsProjection as d, UtmCrs as dt, MapSheetMetadata as et, UtmProjection as f, Polygon as ft, MapSheetRasterBasemap as g, MapSheetRasterAttribution as h, MapSheetPageInput as i, MgrsSnapInterval as it, resolvePaperSize as j, PaperOrientation as k, TacticalMapSheetResult as l, GridCrs as lt, LowRasterDpiWarning as m, CrossZoneFootprintWarning as n, ResolvedMgrsGridMetadata as nt, ScaleDeviationWarning as o, MillimetreScene as ot, createTacticalMapSheet as p, Position as pt, ControlledVectorSymbol as q, MapSheetFontIdentity as r, MgrsPrecision as rt, TacticalMapSheetRequest as s, SceneRectangle as st, CrossProjectionFootprintWarning as t, MgrsGridOptions as tt, TacticalMapSheetWarning as u, UpsCrs as ut, MapSheetRasterTile as v, PrinterCalibrationRequest as w, ResolvedMapSheetRasterBasemapMetadata as x, MapSheetRasterWarning as y, PointSymbolFallbackWarning as z };
861
+ export { MapSheetCollocation as $, PaperSizeName as A, PointSymbolOffsetWarning as B, ResolvedMapSheetRasterTileMetadata as C, ResolvedRegistrationMark as D, MapSheetRegistrationRequest as E, GraphicOutsideFrameWarning as F, PrepareMapSheetNotesOptions as G, MapSheetNote as H, GraphicRenderWarning as I, MapSheetCustomSymbol as J, prepareMapSheetNotes as K, MapSheetAuthoredGraphic as L, AuthoredMapSheetGraphic as M, GraphicClippedWarning as N, PAPER_SIZES as O, GraphicHiddenWarning as P, VectorSymbolAnchor as Q, MapSheetPortrayalDefaults as R, ResolvedMapSheetRasterLayerMetadata as S, AuthoredRegistrationMark as T, MapSheetNoteCapability as U, TacticalMapSheetLayer as V, MapSheetNoteRaster as W, MapSheetPointSymbolCapability as X, MapSheetPointSymbol as Y, MapSheetSymbolSize as Z, MapSheetRasterLayer as _, UpsCrs as _t, ResolvedMapSheetMetadata as a, toMapSheetCollocation as at, RasterDpiAnisotropyWarning as b, Position as bt, TacticalMapSheetResources as c, MgrsGridOptions as ct, UpsProjection as d, MgrsSnapInterval as dt, MapSheetCollocationCustomSymbol as et, UtmProjection as f, MapSheetPatternIdentity as ft, MapSheetRasterBasemap as g, GridCrs as gt, MapSheetRasterAttribution as h, GeographicPosition as ht, MapSheetPageInput as i, MapSheetCollocationPointSymbol as it, resolvePaperSize as j, PaperOrientation as k, TacticalMapSheetResult as l, ResolvedMgrsGridMetadata as lt, LowRasterDpiWarning as m, SceneRectangle as mt, CrossZoneFootprintWarning as n, MapSheetCollocationMemberGraphic as nt, ScaleDeviationWarning as o, MapSheetMarginaliaOptions as ot, createTacticalMapSheet as p, MillimetreScene as pt, ControlledVectorSymbol as q, MapSheetFontIdentity as r, MapSheetCollocationMemberSupport as rt, TacticalMapSheetRequest as s, MapSheetMetadata as st, CrossProjectionFootprintWarning as t, MapSheetCollocationMember as tt, TacticalMapSheetWarning as u, MgrsPrecision as ut, MapSheetRasterTile as v, UtmCrs as vt, PrinterCalibrationRequest as w, ResolvedMapSheetRasterBasemapMetadata as x, MapSheetRasterWarning as y, Polygon as yt, PointSymbolFallbackWarning as z };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as MapSheetMarginaliaOptions, A as PaperSizeName, B as PointSymbolOffsetWarning, C as ResolvedMapSheetRasterTileMetadata, D as ResolvedRegistrationMark, E as MapSheetRegistrationRequest, F as GraphicOutsideFrameWarning, G as PrepareMapSheetNotesOptions, H as MapSheetNote, I as GraphicRenderWarning, J as MapSheetCustomSymbol, K as prepareMapSheetNotes, L as MapSheetAuthoredGraphic, M as AuthoredMapSheetGraphic, N as GraphicClippedWarning, O as PAPER_SIZES, P as GraphicHiddenWarning, Q as VectorSymbolAnchor, R as MapSheetPortrayalDefaults, S as ResolvedMapSheetRasterLayerMetadata, T as AuthoredRegistrationMark, U as MapSheetNoteCapability, V as TacticalMapSheetLayer, W as MapSheetNoteRaster, X as MapSheetPointSymbolCapability, Y as MapSheetPointSymbol, Z as MapSheetSymbolSize, _ as MapSheetRasterLayer, a as ResolvedMapSheetMetadata, at as MapSheetPatternIdentity, b as RasterDpiAnisotropyWarning, c as TacticalMapSheetResources, ct as GeographicPosition, d as UpsProjection, dt as UtmCrs, et as MapSheetMetadata, f as UtmProjection, g as MapSheetRasterBasemap, h as MapSheetRasterAttribution, i as MapSheetPageInput, it as MgrsSnapInterval, j as resolvePaperSize, k as PaperOrientation, l as TacticalMapSheetResult, lt as GridCrs, m as LowRasterDpiWarning, n as CrossZoneFootprintWarning, nt as ResolvedMgrsGridMetadata, o as ScaleDeviationWarning, p as createTacticalMapSheet, pt as Position, q as ControlledVectorSymbol, r as MapSheetFontIdentity, rt as MgrsPrecision, s as TacticalMapSheetRequest, st as SceneRectangle, t as CrossProjectionFootprintWarning, tt as MgrsGridOptions, u as TacticalMapSheetWarning, ut as UpsCrs, v as MapSheetRasterTile, w as PrinterCalibrationRequest, x as ResolvedMapSheetRasterBasemapMetadata, y as MapSheetRasterWarning, z as PointSymbolFallbackWarning } from "./create-tactical-map-sheet-CYvzCyFD.mjs";
1
+ import { $ as MapSheetCollocation, A as PaperSizeName, B as PointSymbolOffsetWarning, C as ResolvedMapSheetRasterTileMetadata, D as ResolvedRegistrationMark, E as MapSheetRegistrationRequest, F as GraphicOutsideFrameWarning, G as PrepareMapSheetNotesOptions, H as MapSheetNote, I as GraphicRenderWarning, J as MapSheetCustomSymbol, K as prepareMapSheetNotes, L as MapSheetAuthoredGraphic, M as AuthoredMapSheetGraphic, N as GraphicClippedWarning, O as PAPER_SIZES, P as GraphicHiddenWarning, Q as VectorSymbolAnchor, R as MapSheetPortrayalDefaults, S as ResolvedMapSheetRasterLayerMetadata, T as AuthoredRegistrationMark, U as MapSheetNoteCapability, V as TacticalMapSheetLayer, W as MapSheetNoteRaster, X as MapSheetPointSymbolCapability, Y as MapSheetPointSymbol, Z as MapSheetSymbolSize, _ as MapSheetRasterLayer, _t as UpsCrs, a as ResolvedMapSheetMetadata, at as toMapSheetCollocation, b as RasterDpiAnisotropyWarning, bt as Position, c as TacticalMapSheetResources, ct as MgrsGridOptions, d as UpsProjection, dt as MgrsSnapInterval, et as MapSheetCollocationCustomSymbol, f as UtmProjection, ft as MapSheetPatternIdentity, g as MapSheetRasterBasemap, gt as GridCrs, h as MapSheetRasterAttribution, ht as GeographicPosition, i as MapSheetPageInput, it as MapSheetCollocationPointSymbol, j as resolvePaperSize, k as PaperOrientation, l as TacticalMapSheetResult, lt as ResolvedMgrsGridMetadata, m as LowRasterDpiWarning, mt as SceneRectangle, n as CrossZoneFootprintWarning, nt as MapSheetCollocationMemberGraphic, o as ScaleDeviationWarning, ot as MapSheetMarginaliaOptions, p as createTacticalMapSheet, q as ControlledVectorSymbol, r as MapSheetFontIdentity, rt as MapSheetCollocationMemberSupport, s as TacticalMapSheetRequest, st as MapSheetMetadata, t as CrossProjectionFootprintWarning, tt as MapSheetCollocationMember, u as TacticalMapSheetWarning, ut as MgrsPrecision, v as MapSheetRasterTile, vt as UtmCrs, w as PrinterCalibrationRequest, x as ResolvedMapSheetRasterBasemapMetadata, y as MapSheetRasterWarning, z as PointSymbolFallbackWarning } from "./create-tactical-map-sheet-euR_ZRdX.mjs";
2
2
 
3
3
  //#region src/mgrs.d.ts
4
4
  interface ProjectedGridCoordinate {
@@ -42,4 +42,4 @@ type RasterPlanRequest = Pick<TacticalMapSheetRequest, "page" | "mapFrame" | "ce
42
42
  declare function resolveMapSheetRasterPlan(request: RasterPlanRequest): MapSheetRasterPlan;
43
43
  declare function mapSheetRasterPointToGeographic(plan: MapSheetRasterPlan, normalizedX: number, normalizedY: number): Position;
44
44
  //#endregion
45
- export { type AuthoredMapSheetGraphic, type AuthoredRegistrationMark, type ControlledVectorSymbol, type CrossProjectionFootprintWarning, type CrossZoneFootprintWarning, type GraphicClippedWarning, type GraphicHiddenWarning, type GraphicOutsideFrameWarning, type GraphicRenderWarning, type GridCrs, type LowRasterDpiWarning, type MapSheetAuthoredGraphic, type MapSheetCustomSymbol, type MapSheetFontIdentity, type MapSheetMarginaliaOptions, type MapSheetMetadata, type MapSheetNote, type MapSheetNoteCapability, type MapSheetNoteRaster, type MapSheetPageInput, type MapSheetPatternIdentity, type MapSheetPointSymbol, type MapSheetPointSymbolCapability, type MapSheetPortrayalDefaults, type MapSheetProjectedBounds, type MapSheetRasterAttribution, type MapSheetRasterBasemap, type MapSheetRasterLayer, type MapSheetRasterPlan, type MapSheetRasterTile, type MapSheetRasterWarning, type MapSheetRegistrationRequest, type MapSheetSymbolSize, type MgrsGridOptions, type MgrsPrecision, type MgrsSnapInterval, PAPER_SIZES, type PaperOrientation, type PaperSizeName, type PointSymbolFallbackWarning, type PointSymbolOffsetWarning, type PrepareMapSheetNotesOptions, type PrinterCalibrationRequest, type ProjectedGridCoordinate, type RasterDpiAnisotropyWarning, type ResolvedMapSheetMetadata, type ResolvedMapSheetRasterBasemapMetadata, type ResolvedMapSheetRasterLayerMetadata, type ResolvedMapSheetRasterTileMetadata, type ResolvedMgrsGridMetadata, type ResolvedMgrsReference, type ResolvedRegistrationMark, type ScaleDeviationWarning, type TacticalMapSheetLayer, type TacticalMapSheetRequest, type TacticalMapSheetResources, type TacticalMapSheetResult, type TacticalMapSheetWarning, type UpsCrs, type UpsProjection, type UtmCrs, type UtmProjection, type VectorSymbolAnchor, createTacticalMapSheet, geographicToMgrs, mapSheetRasterPointToGeographic, mgrsToGeographic, mgrsToProjected, normalizeMgrsReference, parseMgrsReference, prepareMapSheetNotes, projectedToMgrs, resolveMapSheetRasterPlan, resolvePaperSize, snapGeographicToMgrs, snapProjectedToMgrs };
45
+ export { type AuthoredMapSheetGraphic, type AuthoredRegistrationMark, type ControlledVectorSymbol, type CrossProjectionFootprintWarning, type CrossZoneFootprintWarning, type GraphicClippedWarning, type GraphicHiddenWarning, type GraphicOutsideFrameWarning, type GraphicRenderWarning, type GridCrs, type LowRasterDpiWarning, type MapSheetAuthoredGraphic, type MapSheetCollocation, type MapSheetCollocationCustomSymbol, type MapSheetCollocationMember, type MapSheetCollocationMemberGraphic, type MapSheetCollocationMemberSupport, type MapSheetCollocationPointSymbol, type MapSheetCustomSymbol, type MapSheetFontIdentity, type MapSheetMarginaliaOptions, type MapSheetMetadata, type MapSheetNote, type MapSheetNoteCapability, type MapSheetNoteRaster, type MapSheetPageInput, type MapSheetPatternIdentity, type MapSheetPointSymbol, type MapSheetPointSymbolCapability, type MapSheetPortrayalDefaults, type MapSheetProjectedBounds, type MapSheetRasterAttribution, type MapSheetRasterBasemap, type MapSheetRasterLayer, type MapSheetRasterPlan, type MapSheetRasterTile, type MapSheetRasterWarning, type MapSheetRegistrationRequest, type MapSheetSymbolSize, type MgrsGridOptions, type MgrsPrecision, type MgrsSnapInterval, PAPER_SIZES, type PaperOrientation, type PaperSizeName, type PointSymbolFallbackWarning, type PointSymbolOffsetWarning, type PrepareMapSheetNotesOptions, type PrinterCalibrationRequest, type ProjectedGridCoordinate, type RasterDpiAnisotropyWarning, type ResolvedMapSheetMetadata, type ResolvedMapSheetRasterBasemapMetadata, type ResolvedMapSheetRasterLayerMetadata, type ResolvedMapSheetRasterTileMetadata, type ResolvedMgrsGridMetadata, type ResolvedMgrsReference, type ResolvedRegistrationMark, type ScaleDeviationWarning, type TacticalMapSheetLayer, type TacticalMapSheetRequest, type TacticalMapSheetResources, type TacticalMapSheetResult, type TacticalMapSheetWarning, type UpsCrs, type UpsProjection, type UtmCrs, type UtmProjection, type VectorSymbolAnchor, createTacticalMapSheet, geographicToMgrs, mapSheetRasterPointToGeographic, mgrsToGeographic, mgrsToProjected, normalizeMgrsReference, parseMgrsReference, prepareMapSheetNotes, projectedToMgrs, resolveMapSheetRasterPlan, resolvePaperSize, snapGeographicToMgrs, snapProjectedToMgrs, toMapSheetCollocation };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as geographicToMgrs, c as normalizeMgrsReference, d as snapGeographicToMgrs, f as snapProjectedToMgrs, i as resolveMapSheetRasterPlan, l as parseMgrsReference, o as mgrsToGeographic, p as prepareMapSheetNotes, r as mapSheetRasterPointToGeographic, s as mgrsToProjected, t as createTacticalMapSheet, u as projectedToMgrs } from "./create-tactical-map-sheet-DGg2sSvm.mjs";
1
+ import { a as geographicToMgrs, c as normalizeMgrsReference, d as snapGeographicToMgrs, f as snapProjectedToMgrs, i as resolveMapSheetRasterPlan, l as parseMgrsReference, m as prepareMapSheetNotes, o as mgrsToGeographic, p as toMapSheetCollocation, r as mapSheetRasterPointToGeographic, s as mgrsToProjected, t as createTacticalMapSheet, u as projectedToMgrs } from "./create-tactical-map-sheet-Gu_V4eUT.mjs";
2
2
  //#region src/paper.ts
3
3
  const A0 = Object.freeze({
4
4
  widthMm: 841,
@@ -80,4 +80,4 @@ function resolvePaperSize(name, orientation = "portrait") {
80
80
  };
81
81
  }
82
82
  //#endregion
83
- export { PAPER_SIZES, createTacticalMapSheet, geographicToMgrs, mapSheetRasterPointToGeographic, mgrsToGeographic, mgrsToProjected, normalizeMgrsReference, parseMgrsReference, prepareMapSheetNotes, projectedToMgrs, resolveMapSheetRasterPlan, resolvePaperSize, snapGeographicToMgrs, snapProjectedToMgrs };
83
+ export { PAPER_SIZES, createTacticalMapSheet, geographicToMgrs, mapSheetRasterPointToGeographic, mgrsToGeographic, mgrsToProjected, normalizeMgrsReference, parseMgrsReference, prepareMapSheetNotes, projectedToMgrs, resolveMapSheetRasterPlan, resolvePaperSize, snapGeographicToMgrs, snapProjectedToMgrs, toMapSheetCollocation };
package/dist/pdf.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as ResolvedMapSheetMetadata, c as TacticalMapSheetResources, ft as Polygon, l as TacticalMapSheetResult, ot as MillimetreScene, s as TacticalMapSheetRequest, u as TacticalMapSheetWarning } from "./create-tactical-map-sheet-CYvzCyFD.mjs";
1
+ import { a as ResolvedMapSheetMetadata, c as TacticalMapSheetResources, l as TacticalMapSheetResult, pt as MillimetreScene, s as TacticalMapSheetRequest, u as TacticalMapSheetWarning, yt as Polygon } from "./create-tactical-map-sheet-euR_ZRdX.mjs";
2
2
 
3
3
  //#region src/pdf.d.ts
4
4
  interface TacticalMapSheetPdfResult {
package/dist/pdf.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as openSansCentralBaselineOffset, g as POINTS_PER_MILLIMETRE, h as MILLIMETRES_PER_CSS_PIXEL, m as formatDecimal, n as createTacticalMapSheetDocument, v as openSansMiddleBaselineOffset } from "./create-tactical-map-sheet-DGg2sSvm.mjs";
1
+ import { _ as POINTS_PER_MILLIMETRE, g as MILLIMETRES_PER_CSS_PIXEL, h as formatDecimal, n as createTacticalMapSheetDocument, v as openSansCentralBaselineOffset, y as openSansMiddleBaselineOffset } from "./create-tactical-map-sheet-Gu_V4eUT.mjs";
2
2
  import { jsPDF } from "jspdf";
3
3
  //#region src/pdf-transparency.ts
4
4
  const FORM_DICTIONARY_MARKER = new TextEncoder().encode("/Subtype /Form\n/BBox");
@@ -593,6 +593,7 @@ function renderElement(pdf, element, formIds) {
593
593
  stroke: element.strokeWidthMm > 0 ? element.strokeColor : void 0,
594
594
  strokeWidth: element.strokeWidthMm,
595
595
  strokeOpacity: element.strokeOpacity ?? DEFAULT_VECTOR_PAINT.strokeOpacity,
596
+ fillOpacity: element.fillOpacity ?? DEFAULT_VECTOR_PAINT.fillOpacity,
596
597
  lineCap: element.lineCap,
597
598
  lineJoin: element.lineJoin,
598
599
  dash: element.strokeDashMm
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbat-mapper/tactical-map-sheet",
3
- "version": "0.8.6",
3
+ "version": "0.9.1",
4
4
  "description": "Scale-accurate projected vector tactical map-sheet renderer.",
5
5
  "license": "MIT",
6
6
  "author": "Orbat Mapper",
@@ -30,8 +30,8 @@
30
30
  "jspdf": "4.2.1",
31
31
  "opentype.js": "2.0.0",
32
32
  "saxes": "6.0.0",
33
- "@orbat-mapper/control-measures": "^0.46.0",
34
- "@orbat-mapper/tactical-draw": "^0.34.0",
33
+ "@orbat-mapper/control-measures": "^0.46.1",
34
+ "@orbat-mapper/tactical-draw": "^0.36.0",
35
35
  "@orbat-mapper/tactical-notes": "^0.2.0"
36
36
  },
37
37
  "devDependencies": {
@@ -46,7 +46,7 @@
46
46
  "typescript": "~5.9.3",
47
47
  "vite": "^8.0.16",
48
48
  "vitest": "^4.1.8",
49
- "@orbat-mapper/point-symbols": "0.2.34"
49
+ "@orbat-mapper/point-symbols": "0.3.1"
50
50
  },
51
51
  "inlinedDependencies": {
52
52
  "@types/geojson": "7946.0.16"