using OpenNest.Engine; using OpenNest.Engine.Fill; using OpenNest.Geometry; using System; using System.Collections.Generic; using System.Threading; namespace OpenNest.Engine.Strategies { public class FillContext { public NestItem Item { get; init; } public Box WorkArea { get; init; } public Plate Plate { get; init; } public int PlateNumber { get; init; } public CancellationToken Token { get; init; } public IProgress Progress { get; init; } public FillPolicy Policy { get; init; } public int MaxQuantity { get; init; } public PartType PartType { get; set; } public List CurrentBest { get; set; } /// For progress reporting only; comparisons use Policy.Comparer. public FillScore CurrentBestScore { get; set; } public NestPhase WinnerPhase { get; set; } public NestPhase ActivePhase { get; set; } public List PhaseResults { get; } = new(); public List AngleResults { get; } = new(); public Dictionary SharedState { get; } = new(); /// /// Standard progress reporting for strategies and fillers. Reports intermediate /// results using the current ActivePhase, PlateNumber, and WorkArea. /// public void ReportProgress(List parts, string description) { NestEngineBase.ReportProgress(Progress, new ProgressReport { Phase = ActivePhase, PlateNumber = PlateNumber, Parts = parts, WorkArea = WorkArea, Description = description, }); } } }