mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-10-04 20:42:11 -04:00
The dialog rendered the same best-parts layout as transparent ghost parts already shown live on the main plate view, and its embedded view reset zoom on every improvement while lacking placed parts, work-area and cut-off context. The progress dialog is now a compact stats strip (266px wide) with the plate counter preserved for multi-plate runs. Removes the never-called SetStationaryParts stationary-preview path along with PreviewPlate/UpdatePreview/CreatePreviewPlate.
63 lines
1.4 KiB
C#
63 lines
1.4 KiB
C#
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
|
|
namespace OpenNest.Controls
|
|
{
|
|
internal class PreviewManager
|
|
{
|
|
private readonly PlateView view;
|
|
private readonly List<LayoutPart> activeParts = new List<LayoutPart>();
|
|
|
|
public PreviewManager(PlateView view)
|
|
{
|
|
this.view = view;
|
|
}
|
|
|
|
public IReadOnlyList<LayoutPart> PreviewParts => activeParts;
|
|
|
|
public Brush PreviewBrush => view.ColorScheme.ActivePreviewPartBrush;
|
|
|
|
public Pen PreviewPen => view.ColorScheme.ActivePreviewPartPen;
|
|
|
|
public void SetActiveParts(List<Part> parts)
|
|
{
|
|
activeParts.Clear();
|
|
|
|
if (parts != null)
|
|
{
|
|
foreach (var part in parts)
|
|
activeParts.Add(LayoutPart.Create(part, view));
|
|
}
|
|
|
|
view.Invalidate();
|
|
}
|
|
|
|
public void ClearPreviewParts()
|
|
{
|
|
activeParts.Clear();
|
|
view.Invalidate();
|
|
}
|
|
|
|
public void AcceptPreviewParts(List<Part> parts)
|
|
{
|
|
if (parts != null)
|
|
{
|
|
foreach (var part in parts)
|
|
view.Plate.Parts.Add(part);
|
|
}
|
|
|
|
activeParts.Clear();
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
activeParts.ForEach(p => p.Update(view));
|
|
}
|
|
|
|
public void Clear()
|
|
{
|
|
activeParts.Clear();
|
|
}
|
|
}
|
|
}
|