Rewrite LayerPacker as skyline packer, add Extreme Points alternative, manual footprint tuning and reordering UI

- Replace the old layer-grid LayerPacker with a skyline (lowest-slot-first) algorithm:
  grows the footprint only when items truly can't fit within maxBox, lets shorter
  types stack multiple sub-layers into taller leftover space, cascades unfinished
  layers to later types, and allows a staircase profile to minimize wasted volume.
- Fix ItemDatabaseEditor NumericUpDown crash (Value set before Minimum/Maximum) and
  ItemDatabase.Upsert doing INSERT instead of UPDATE (was keyed by Name, now by Id).
- Add Packer3D as a working Extreme Points algorithm (was dead/commented-out code)
  behind a shared IPacker interface, selectable in the UI alongside Skyline.
- Add manual footprint (Skyline) / box-size (Extreme Points) adjustment controls for
  the first box, with correct min/max clamping against the configured max box size.
- Add a "Poradie" column with up/down buttons to reorder packing items; both packers
  now honor that manual order instead of re-sorting by volume.
- Drop multi-box packing (single box only), add a pre-pack volume warning, and make
  unpacked items exportable to PDF / inspectable via a result-label tooltip, both
  grouped by type with dimensions, count and total volume.
- Merge the min/max box dimension groups, hide the now-unused box navigation group,
  and misc UI cleanup (typo fix, group renames, wider item name column).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
roman
2026-08-19 14:23:54 +02:00
co-authored by Claude Sonnet 5
parent 274d607d54
commit 654e1b79d0
10 changed files with 1011 additions and 440 deletions
+13 -10
View File
@@ -170,12 +170,13 @@ namespace BoxPacker3D
// Group unpacked items by name
var grouped = unpackedItems
.GroupBy(it => it.Name)
.Select(g => new {
Name = g.Key,
Count = g.Count(),
W = g.First().W,
H = g.First().H,
D = g.First().D
.Select(g => new {
Name = g.Key,
Count = g.Count(),
W = g.First().W,
H = g.First().H,
D = g.First().D,
TotalVolume = g.Sum(it => it.Volume)
})
.OrderBy(x => x.Name)
.ToList();
@@ -212,8 +213,9 @@ namespace BoxPacker3D
cs.AppendLine("0.25 0.25 0.35 rg BT /F1 9 Tf");
cs.AppendLine($"{Margin + 10:F2} {y + 6:F2} Td");
cs.AppendLine("(Nazov) Tj");
cs.AppendLine($"{250:F2} {0:F2} Td (Rozmery \\(mm\\)) Tj");
cs.AppendLine($"{160:F2} {0:F2} Td (Pocet) Tj ET");
cs.AppendLine($"{190:F2} {0:F2} Td (Rozmery \\(mm\\)) Tj");
cs.AppendLine($"{140:F2} {0:F2} Td (Pocet) Tj");
cs.AppendLine($"{140:F2} {0:F2} Td (Objem typu \\(cm3\\)) Tj ET");
y -= 25;
@@ -233,8 +235,9 @@ namespace BoxPacker3D
cs.AppendLine("0.20 0.20 0.30 rg BT /F2 8 Tf");
cs.AppendLine($"{Margin + 10:F2} {y + 5:F2} Td");
cs.AppendLine($"({EscPdf(item.Name)}) Tj");
cs.AppendLine($"{250:F2} {0:F2} Td ({item.W:F0} x {item.H:F0} x {item.D:F0}) Tj");
cs.AppendLine($"{160:F2} {0:F2} Td ({item.Count}) Tj ET");
cs.AppendLine($"{190:F2} {0:F2} Td ({item.W:F0} x {item.H:F0} x {item.D:F0}) Tj");
cs.AppendLine($"{140:F2} {0:F2} Td ({item.Count}) Tj");
cs.AppendLine($"{140:F2} {0:F2} Td ({item.TotalVolume / 1000.0:F0}) Tj ET");
y -= 18;
rowNum++;