mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-14 08:05:07 -05:00
"Fill" said nothing about what the engine does, since every engine fills. It is now Lattice, and Fill stays an alias, so saved selections, scripts and API requests keep working. Engine descriptions are rewritten in plain language and shown beside each name in the desktop engine lists; the main toolbar's tooltip also says when Fill Area falls back to Lattice. Docs also cover the leftover placement from the previous commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
54 lines
2.1 KiB
C#
54 lines
2.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using OpenNest.Engine.Jobs.Placement.Fillers;
|
|
|
|
namespace OpenNest.Engine.Jobs.Placement;
|
|
|
|
/// <summary>
|
|
/// The built-in placement strategies by name: the filler policy and layout behind each one.
|
|
/// <see cref="PlateNesterFactory"/> (whole jobs) and <see cref="PlateFillService"/> (interactive
|
|
/// fills) both resolve names here, each with its own case rule.
|
|
/// </summary>
|
|
internal static class PlacementStrategies
|
|
{
|
|
/// <summary>Names of the Lattice strategy in earlier releases; accepted as aliases.</summary>
|
|
private static readonly string[] LegacyLatticeNames = ["Default", "Fill"];
|
|
|
|
/// <summary>One built-in strategy: its canonical name and the filler it runs.</summary>
|
|
internal sealed record Entry(string Name, PlateFillPolicy Policy, PlateLayout Layout)
|
|
{
|
|
public PlateFiller CreateFiller(Plate plate) => new(plate, Policy, Layout);
|
|
}
|
|
|
|
/// <summary>In <see cref="PlateFillService.BuiltInStrategies"/> order.</summary>
|
|
internal static IReadOnlyList<Entry> Entries { get; } =
|
|
[
|
|
new("Lattice", PlateFillPolicy.Fill, PlateLayout.FillThenPack),
|
|
new("Strip", PlateFillPolicy.Fill, PlateLayout.Strips),
|
|
new("Vertical Remnant", PlateFillPolicy.VerticalRemnant, PlateLayout.FillThenPack),
|
|
new("Horizontal Remnant", PlateFillPolicy.HorizontalRemnant, PlateLayout.FillThenPack),
|
|
];
|
|
|
|
/// <summary>
|
|
/// Finds the strategy <paramref name="name"/> names under <paramref name="comparison"/>;
|
|
/// "Default" and "Fill", the Lattice strategy's earlier names, find Lattice. Null when none
|
|
/// matches.
|
|
/// </summary>
|
|
internal static Entry Find(string name, StringComparison comparison)
|
|
{
|
|
if (name == null)
|
|
return null;
|
|
foreach (var legacy in LegacyLatticeNames)
|
|
{
|
|
if (name.Equals(legacy, comparison))
|
|
return Entries[0];
|
|
}
|
|
foreach (var entry in Entries)
|
|
{
|
|
if (entry.Name.Equals(name, comparison))
|
|
return entry;
|
|
}
|
|
return null;
|
|
}
|
|
}
|