@orbat-mapper/tactical-map-sheet 0.4.17 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@ import GeographicLibMgrs from "geographiclib-mgrs";
2
2
  import PolarStereographic from "geographiclib-mgrs/src/polar-stereographic.mjs";
3
3
  import opentype from "opentype.js";
4
4
  import { DEFAULT_LABEL_HEIGHT_CSS_PIXELS, DEFAULT_LABEL_SIZE_CLAMP_CSS_PIXELS, DEFAULT_LINE_CAP, DEFAULT_LINE_JOIN, DEFAULT_PORTRAYAL, DEFAULT_STROKE_DASH_CSS_PIXELS, DEFAULT_STROKE_WIDTH_CSS_PIXELS, getFillPatternDefinition, renderControlMeasure, resolveConstructionMetersPerCssPixel, resolveSymbolColor } from "@orbat-mapper/control-measures";
5
- import { effectivePointSymbolPixelSize, resolvePointSymbolOffset, resolveTextAppearance, scalePointSymbolLayout } from "@orbat-mapper/tactical-draw";
5
+ import { effectivePointSymbolPixelSize, resolveHighlightCasing, 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;
@@ -1499,6 +1499,26 @@ function textFromFeature(feature, portrayal, context, constructionMetersPerCssPi
1499
1499
  } : {}
1500
1500
  };
1501
1501
  }
1502
+ /**
1503
+ * The Highlight casing beneath each path a highlighted line or area part drew:
1504
+ * the same geometry as one solid stroke in the resolved `highlightColor`,
1505
+ * `highlightCasingWidth` wide and never filled, so an area is cased along its
1506
+ * outline only and a transparent stroke is still cased.
1507
+ */
1508
+ function highlightCasings(feature, parts, portrayal) {
1509
+ const casing = resolveHighlightCasing(feature, portrayal.strokeWidthCssPixels);
1510
+ if (!casing) return [];
1511
+ return parts.flatMap((part) => part.kind === "path" ? [{
1512
+ kind: "path",
1513
+ points: part.points,
1514
+ ...part.closed ? { closed: true } : {},
1515
+ strokeColor: casing.color,
1516
+ strokeWidthMm: casing.width * MILLIMETRES_PER_CSS_PIXEL,
1517
+ strokeDashMm: [],
1518
+ lineCap: "round",
1519
+ lineJoin: "round"
1520
+ }] : []);
1521
+ }
1502
1522
  function elementsFromGeometry(feature, portrayal, context, constructionMetersPerCssPixel) {
1503
1523
  const text = textFromFeature(feature, portrayal, context, constructionMetersPerCssPixel);
1504
1524
  if (text) return [text];
@@ -1695,7 +1715,7 @@ function renderGraphic(layerId, authored, portrayal, context) {
1695
1715
  graphicId: graphic.id
1696
1716
  }] };
1697
1717
  const constructionMetersPerCssPixel = resolveConstructionMetersPerCssPixel(graphic.controlPoints, context.groundMetersPerCssPixel);
1698
- const elements = rendered.features.flatMap((feature, index) => {
1718
+ const featureElements = rendered.features.map((feature, index) => {
1699
1719
  try {
1700
1720
  const geometry = featureOutOfRange[index] ? clipGeometryToBounds(feature.geometry, frameBounds) : feature.geometry;
1701
1721
  return geometry ? elementsFromGeometry({
@@ -1706,6 +1726,7 @@ function renderGraphic(layerId, authored, portrayal, context) {
1706
1726
  throw new Error(`Cannot render Graphic "${graphic.id}": ${String(error)}`, { cause: error });
1707
1727
  }
1708
1728
  });
1729
+ const elements = [...featureElements.flatMap((parts, index) => highlightCasings(rendered.features[index], parts, portrayal)), ...featureElements.flat()];
1709
1730
  if (elements.length === 0 && rendered.features.every((feature) => feature.properties.text !== void 0)) return { warnings: [{
1710
1731
  code: "graphic-hidden",
1711
1732
  layerId,
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, r as mapSheetRasterPointToGeographic, s as mgrsToProjected, t as createTacticalMapSheet, u as projectedToMgrs } from "./create-tactical-map-sheet-CjaUXinf.mjs";
1
+ import { a as geographicToMgrs, c as normalizeMgrsReference, d as snapGeographicToMgrs, f as snapProjectedToMgrs, i as resolveMapSheetRasterPlan, l as parseMgrsReference, o as mgrsToGeographic, r as mapSheetRasterPointToGeographic, s as mgrsToProjected, t as createTacticalMapSheet, u as projectedToMgrs } from "./create-tactical-map-sheet-BJLUJ9b5.mjs";
2
2
  //#region src/paper.ts
3
3
  const A0 = Object.freeze({
4
4
  widthMm: 841,
package/dist/pdf.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as openSansMiddleBaselineOffset, g as openSansCentralBaselineOffset, h as POINTS_PER_MILLIMETRE, m as MILLIMETRES_PER_CSS_PIXEL, n as createTacticalMapSheetDocument, p as formatDecimal } from "./create-tactical-map-sheet-CjaUXinf.mjs";
1
+ import { _ as openSansMiddleBaselineOffset, g as openSansCentralBaselineOffset, h as POINTS_PER_MILLIMETRE, m as MILLIMETRES_PER_CSS_PIXEL, n as createTacticalMapSheetDocument, p as formatDecimal } from "./create-tactical-map-sheet-BJLUJ9b5.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");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbat-mapper/tactical-map-sheet",
3
- "version": "0.4.17",
3
+ "version": "0.5.0",
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.36.0",
34
- "@orbat-mapper/tactical-draw": "^0.19.0"
33
+ "@orbat-mapper/control-measures": "^0.37.0",
34
+ "@orbat-mapper/tactical-draw": "^0.21.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@napi-rs/canvas": "1.0.7",
@@ -45,7 +45,7 @@
45
45
  "typescript": "~5.9.3",
46
46
  "vite": "^8.0.16",
47
47
  "vitest": "^4.1.8",
48
- "@orbat-mapper/point-symbols": "0.2.17"
48
+ "@orbat-mapper/point-symbols": "0.2.19"
49
49
  },
50
50
  "inlinedDependencies": {
51
51
  "@types/geojson": "7946.0.16"