Restructure project layout to flatten directory structure

Move all projects from Source/ to repository root for simpler navigation.
- Remove External/ dependency DLLs (will use NuGet packages)
- Remove Installer/ NSIS script
- Replace PartCollection/PlateCollection with ObservableList
- Add packages.config for NuGet dependencies

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-27 20:29:12 -05:00
parent 8367d9f400
commit 2d956fd3f7
189 changed files with 374 additions and 621 deletions

View File

@@ -0,0 +1,121 @@
using System.Collections.Generic;
using System.Linq;
namespace OpenNest.RectanglePacking
{
internal class FirstFitDecreasing : PackEngine
{
private readonly List<Level> levels;
public FirstFitDecreasing(Bin bin)
: base(bin)
{
levels = new List<Level>();
}
public override void Pack(List<Item> items)
{
items = items.OrderBy(i => -i.Height).ToList();
foreach (var item in items)
{
if (item.Height > Bin.Height)
continue;
var level = FindLevel(item);
if (level == null)
continue;
level.AddItem(item);
}
}
private Level FindLevel(Item item)
{
foreach (var level in levels)
{
if (level.Height < item.Height)
continue;
if (level.RemainingWidth < item.Width)
continue;
return level;
}
return CreateNewLevel(item);
}
private Level CreateNewLevel(Item item)
{
var y = Bin.Y;
var lastLevel = levels.LastOrDefault();
if (lastLevel != null)
y = lastLevel.Y + lastLevel.Height;
var remaining = Bin.Top - y;
if (remaining < item.Height)
return null;
var level = new Level(Bin);
level.Y = y;
level.Height = item.Height;
levels.Add(level);
return level;
}
private class Level
{
public Level(Bin parent)
{
Parent = parent;
NextItemLocation = parent.Location;
}
public Bin Parent { get; set; }
private Vector NextItemLocation;
public double X
{
get { return Parent.X; }
}
public double Y
{
get { return NextItemLocation.Y; }
set { NextItemLocation.Y = value; }
}
public double Width
{
get { return Parent.Width; }
}
public double Height { get; set; }
public double Top
{
get { return Y + Height; }
}
public double RemainingWidth
{
get { return X + Width - NextItemLocation.X; }
}
public void AddItem(Item item)
{
item.Location = NextItemLocation;
Parent.Items.Add(item);
NextItemLocation = new Vector(NextItemLocation.X + item.Width, NextItemLocation.Y);
}
}
}
}