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:
82
OpenNest.Engine/RectanglePacking/FillEngine.cs
Normal file
82
OpenNest.Engine/RectanglePacking/FillEngine.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenNest.RectanglePacking
|
||||
{
|
||||
internal abstract class FillEngine
|
||||
{
|
||||
public FillEngine(Bin bin)
|
||||
{
|
||||
Bin = bin;
|
||||
}
|
||||
|
||||
public Bin Bin { get; set; }
|
||||
|
||||
public abstract void Fill(Item item);
|
||||
|
||||
public abstract void Fill(Item item, int maxCount);
|
||||
|
||||
/// <summary>
|
||||
/// Vertical pattern.
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="rows"></param>
|
||||
/// <param name="columns"></param>
|
||||
/// <param name="maxCount"></param>
|
||||
protected List<Item> VPattern(Item item, int rows, int columns, int maxCount)
|
||||
{
|
||||
var items = new List<Item>();
|
||||
|
||||
for (int i = 0; i < columns; i++)
|
||||
{
|
||||
var x = item.Width * i + item.X;
|
||||
|
||||
for (int j = 0; j < rows; j++)
|
||||
{
|
||||
var y = item.Height * j + item.Y;
|
||||
|
||||
var addedItem = item.Clone() as Item;
|
||||
addedItem.Location = new Vector(x, y);
|
||||
|
||||
items.Add(addedItem);
|
||||
|
||||
if (items.Count == maxCount)
|
||||
return items;
|
||||
}
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Horizontal pattern.
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="rows"></param>
|
||||
/// <param name="columns"></param>
|
||||
/// <param name="maxCount"></param>
|
||||
protected List<Item> HPattern(Item item, int rows, int columns, int maxCount)
|
||||
{
|
||||
var items = new List<Item>();
|
||||
|
||||
for (int i = 0; i < rows; i++)
|
||||
{
|
||||
var y = item.Height * i + item.Y;
|
||||
|
||||
for (int j = 0; j < rows; j++)
|
||||
{
|
||||
var x = item.Width * j + item.X;
|
||||
|
||||
var addedItem = item.Clone() as Item;
|
||||
addedItem.Location = new Vector(x, y);
|
||||
|
||||
items.Add(addedItem);
|
||||
|
||||
if (items.Count == maxCount)
|
||||
return items;
|
||||
}
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user