feat(reporting): add multi-plate pagination and dense-label fallback

Slice 2 of the nest report plan: pagination, overflow and dense-label
coverage on top of the Slice 1 one-plate library.

- NestPdfWriter: general multi-plate pagination. Summary/plate tables
  continue across pages with repeated (HeadingFormat) header rows; notes
  flow as an ordinary paragraph instead of a bounded cell; page headers
  are wrapped and sized into the top margin; drawing areas are located
  per page via DocumentRenderer.GetRenderInfoFromPage.
- ReportText: lossless pre-wrapping (MigraDoc clips an over-tall row and
  lets an unbroken token overflow a narrow cell without warning), capped
  table-cell line counts, plate-range compression ("1-2, 4"), and
  A/B/.../AA map-grid row names.
- NestReportDiagram: label placement centers each part ID on its
  PolyLabel pole (matching PlateView's LayoutPart), computed on a
  placement-independent quantized copy so identical parts share one
  label position. Parts whose ID cannot fit legibly at overview scale
  get a lettered/numbered map grid and a zoomed, framed detail page per
  crowded cell; the writer fails with plate/part/ID when even that
  cannot place a label, or a plate would need more than 24 detail views.
- Tests: NestPdfLayoutTests (multi-plate totals/ranges/same-named
  references, table continuation with no lost rows, long name/notes
  wrapping without column overflow, mm units in all four quadrants,
  dense-label detail views with hole avoidance, save/reload of the
  tabbed/lead-in fixture with stale tab flags, invalid later-plate data,
  late write failures against an existing destination, source
  unchanged on success/failure), ReportPdf test helper (page/word/
  content-stream extraction).
- docs/nest-reports.md: replace the Slice 1 one-plate limits section
  with the general pagination/dense-label contract and the process-wide
  PDFsharp/MigraDoc render lock.

Verification: Reporting filter 70/70; full OpenNest.Tests 2524
passed/21 skipped/0 failed; Engine 351/351; IO 77/77;
EnableWindowsTargeting=true full-solution build 0 errors; scoped
dotnet format --verify-no-changes exit 0. Preview PDFs rendered and
visually inspected (evidence: /home/aj/extracted/2026-09-29/opennest-report-slice2/).
Windows runtime, the desktop adapter and packaged-app font deployment
remain unverified (Slice 3).
This commit is contained in:
aj
2026-09-29 15:43:00 -04:00
parent e4d64a88eb
commit b15c4cf6c6
9 changed files with 1328 additions and 228 deletions
@@ -48,6 +48,51 @@ public static class NestReportTestData
return nest;
}
/// <summary>
/// Four layouts: "Bracket" R001 on plates 1, 2 and 4; R002 on plates 1 and 3; the distinct
/// same-named "Bracket" R003 on plates 1 and 3; R004 demanded but unplaced.
/// </summary>
public static Nest CreateMultiPlateNest()
{
var nest = CreateNest();
var first = nest.Plates[0];
var holed = first.Parts[0].BaseDrawing;
var rotated = first.Parts[2].BaseDrawing;
var second = new Plate(24, 48) { Quantity = 3, PartSpacing = 0.25 };
second.Parts.Add(new Part(holed, new Vector(2, 2)));
nest.Plates.Add(second);
var third = new Plate(30, 60) { Quantity = 1, PartSpacing = 0.125 };
third.Parts.Add(new Part(rotated, new Vector(10, 2)));
third.Parts.Add(new Part(first.Parts[3].BaseDrawing, new Vector(20, 2)));
nest.Plates.Add(third);
var fourth = new Plate(24, 48) { Quantity = 1 };
fourth.Parts.Add(new Part(holed, new Vector(20, 8)));
nest.Plates.Add(fourth);
return nest;
}
/// <summary>
/// One 120 x 60 sheet: two large parts and a cluster of tiny holed washers whose IDs cannot
/// be labeled legibly at overview scale, so they need detail views.
/// </summary>
public static Nest CreateDenseNest()
{
var nest = new Nest("Dense label test") { Units = Units.Inches };
var large = CreateHoledDrawing("Large bracket", 2);
var washer = new Drawing("Washer", HoledSquare(1, 0.25));
washer.Quantity.Required = 24;
nest.Drawings.Add(large);
nest.Drawings.Add(washer);
var plate = new Plate(60, 120) { Quantity = 2, PartSpacing = 0.25 };
plate.Parts.Add(new Part(large, new Vector(5, 5)));
plate.Parts.Add(new Part(large, new Vector(20, 5)));
for (var row = 0; row < 4; row++)
for (var column = 0; column < 6; column++)
plate.Parts.Add(new Part(washer, new Vector(62 + column * 1.5, 30 + row * 1.5)));
nest.Plates.Add(plate);
return nest;
}
public static Nest CreateTabbedNest()
{
var drawing = CreateHoledDrawing("Tabbed with hole", 1);
@@ -81,6 +126,15 @@ public static class NestReportTestData
return drawing;
}
private static Program HoledSquare(double size, double radius)
{
var program = RectangleProgram(size, size);
var center = size / 2;
program.Codes.Add(new RapidMove(center + radius, center));
program.Codes.Add(new ArcMove(new Vector(center + radius, center), new Vector(center, center), RotationType.CW));
return program;
}
public static Drawing Rectangle(string name, double length, double width, int required = 1)
{
var drawing = new Drawing(name, RectangleProgram(length, width));