style: apply CSharpier formatting to all C# sources

Repo-wide sweep with the pinned CSharpier 1.3.0 tool. Whitespace and
line-wrapping only; OpenNest.Engine.Tests (109) and OpenNest.IO.Tests
pass after reformat, full solution builds 0 errors.

Added .csharpierignore so csproj/config XML keeps its existing layout
(CSharpier's XML wrapping churns attributes with zero benefit).

Formatting is now enforceable: dotnet csharpier check . passes.
This commit is contained in:
aj
2026-09-20 16:41:50 -04:00
parent 8e6fa677fb
commit aec0523062
476 changed files with 16592 additions and 7800 deletions
+3 -3
View File
@@ -1,6 +1,6 @@
using OpenNest.Geometry;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using OpenNest.Geometry;
namespace OpenNest.RectanglePacking
{
@@ -24,7 +24,7 @@ namespace OpenNest.RectanglePacking
{
Location = this.Location,
Size = this.Size,
Items = new List<Item>(Items)
Items = new List<Item>(Items),
};
}
}
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using OpenNest.Geometry;
using OpenNest.Math;
using System.Collections.Generic;
namespace OpenNest.RectanglePacking
{
@@ -8,11 +8,7 @@ namespace OpenNest.RectanglePacking
{
public static Bin CreateBin(Box area, double partSpacing)
{
var bin = new Bin
{
Location = area.Location,
Size = area.Size
};
var bin = new Bin { Location = area.Location, Size = area.Size };
bin.Width += partSpacing;
bin.Length += partSpacing;
@@ -31,7 +27,7 @@ namespace OpenNest.RectanglePacking
{
Id = id,
Location = box.Location,
Size = box.Size
Size = box.Size,
};
}
@@ -1,14 +1,12 @@
using OpenNest.Math;
using System;
using System;
using OpenNest.Math;
namespace OpenNest.RectanglePacking
{
internal class FillBestFit : FillEngine
{
public FillBestFit(Bin bin)
: base(bin)
{
}
: base(bin) { }
public override void Fill(Item item)
{
@@ -29,8 +27,7 @@ namespace OpenNest.RectanglePacking
Bin.Items.AddRange(bin1.Items);
else
Bin.Items.AddRange(bin2.Items);
}
}
public override void Fill(Item item, int maxCount)
{
@@ -60,8 +57,10 @@ namespace OpenNest.RectanglePacking
var normalPrimary = combo.Count1;
var rotatePrimary = combo.Count2;
var normalSecondary = (int)System.Math.Floor((binSecondary + Tolerance.Epsilon) / secondarySize);
var rotateSecondary = (int)System.Math.Floor((binSecondary + Tolerance.Epsilon) / primarySize);
var normalSecondary = (int)
System.Math.Floor((binSecondary + Tolerance.Epsilon) / secondarySize);
var rotateSecondary = (int)
System.Math.Floor((binSecondary + Tolerance.Epsilon) / primarySize);
var (normalRows, normalCols) = horizontal
? (normalSecondary, normalPrimary)
@@ -1,5 +1,5 @@
using OpenNest.Geometry;
using System.Collections.Generic;
using System.Collections.Generic;
using OpenNest.Geometry;
namespace OpenNest.RectanglePacking
{
@@ -16,7 +16,13 @@ namespace OpenNest.RectanglePacking
public abstract void Fill(Item item, int maxCount);
protected List<Item> FillGrid(Item item, int rows, int columns, int maxCount, bool columnMajor = true)
protected List<Item> FillGrid(
Item item,
int rows,
int columns,
int maxCount,
bool columnMajor = true
)
{
var items = new List<Item>();
@@ -6,9 +6,7 @@ namespace OpenNest.RectanglePacking
internal class FillNoRotation : FillEngine
{
public FillNoRotation(Bin bin)
: base(bin)
{
}
: base(bin) { }
public NestDirection NestDirection { get; set; }
@@ -59,7 +57,9 @@ namespace OpenNest.RectanglePacking
columns = (int)System.Math.Ceiling((double)maxCount / rows);
}
Bin.Items.AddRange(FillGrid(item, rows, columns, maxCount, columnMajor: item.Width > item.Length));
Bin.Items.AddRange(
FillGrid(item, rows, columns, maxCount, columnMajor: item.Width > item.Length)
);
}
}
}
@@ -5,9 +5,7 @@ namespace OpenNest.RectanglePacking
internal class FillSameRotation : FillEngine
{
public FillSameRotation(Bin bin)
: base(bin)
{
}
: base(bin) { }
public override void Fill(Item item)
{
+20 -18
View File
@@ -8,9 +8,7 @@ namespace OpenNest.RectanglePacking
public Box CenterRemnant { get; private set; }
public FillSpiral(Bin bin)
: base(bin)
{
}
: base(bin) { }
public override void Fill(Item item)
{
@@ -19,7 +17,8 @@ namespace OpenNest.RectanglePacking
public override void Fill(Item item, int maxCount)
{
if (item == null) return;
if (item == null)
return;
// Width = Y axis, Length = X axis
var comboY = BestCombination.FindFrom2(item.Width, item.Length, Bin.Width);
@@ -28,15 +27,13 @@ namespace OpenNest.RectanglePacking
if (!comboY.Found || !comboX.Found)
return;
var q14size = new Size(
item.Width * comboY.Count1,
item.Length * comboX.Count1);
var q23size = new Size(
item.Length * comboY.Count2,
item.Width * comboX.Count2);
var q14size = new Size(item.Width * comboY.Count1, item.Length * comboX.Count1);
var q23size = new Size(item.Length * comboY.Count2, item.Width * comboX.Count2);
if ((q14size.Width > q23size.Width && q14size.Length > q23size.Length) ||
(q23size.Width > q14size.Width && q23size.Length > q14size.Length))
if (
(q14size.Width > q23size.Width && q14size.Length > q23size.Length)
|| (q23size.Width > q14size.Width && q23size.Length > q14size.Length)
)
return; // cant do an efficient spiral fill
// Q1: normal orientation at bin origin
@@ -57,9 +54,7 @@ namespace OpenNest.RectanglePacking
// Q4: normal orientation, diagonal from Q1
item.Rotate();
item.Location = new Vector(
Bin.X + q23size.Length,
Bin.Y + q23size.Width);
item.Location = new Vector(Bin.X + q23size.Length, Bin.Y + q23size.Width);
var q4 = FillGrid(item, comboY.Count1, comboX.Count1, maxCount);
Bin.Items.AddRange(q4);
@@ -69,14 +64,21 @@ namespace OpenNest.RectanglePacking
var centerW = System.Math.Abs(q14size.Length - q23size.Length);
var centerH = System.Math.Abs(q14size.Width - q23size.Width);
if (comboY.Count1 > 0 && comboY.Count2 > 0 && comboX.Count1 > 0 && comboX.Count2 > 0
&& centerW > Tolerance.Epsilon && centerH > Tolerance.Epsilon)
if (
comboY.Count1 > 0
&& comboY.Count2 > 0
&& comboX.Count1 > 0
&& comboX.Count2 > 0
&& centerW > Tolerance.Epsilon
&& centerH > Tolerance.Epsilon
)
{
CenterRemnant = new Box(
Bin.X + System.Math.Min(q14size.Length, q23size.Length),
Bin.Y + System.Math.Min(q14size.Width, q23size.Width),
centerW,
centerH);
centerH
);
}
}
}
+11 -7
View File
@@ -1,6 +1,6 @@
using OpenNest.Geometry;
using System.Collections.Generic;
using OpenNest.Geometry;
using OpenNest.Math;
using System.Collections.Generic;
namespace OpenNest.RectanglePacking
{
@@ -23,7 +23,7 @@ namespace OpenNest.RectanglePacking
IsRotated = this.IsRotated,
Location = this.Location,
Size = this.Size,
Id = this.Id
Id = this.Id,
};
}
}
@@ -42,10 +42,14 @@ namespace OpenNest.RectanglePacking
foreach (var box in items)
{
if (box.Left < minX) minX = box.Left;
if (box.Right > maxX) maxX = box.Right;
if (box.Bottom < minY) minY = box.Bottom;
if (box.Top > maxY) maxY = box.Top;
if (box.Left < minX)
minX = box.Left;
if (box.Right > maxX)
maxX = box.Right;
if (box.Bottom < minY)
minY = box.Bottom;
if (box.Top > maxY)
maxY = box.Top;
}
return new Box(minX, minY, maxX - minX, maxY - minY);
@@ -1,21 +1,25 @@
using OpenNest.Geometry;
using OpenNest.Math;
using System.Collections.Generic;
using System.Linq;
using OpenNest.Geometry;
using OpenNest.Math;
namespace OpenNest.RectanglePacking
{
internal class PackBottomLeft : PackEngine
{
public PackBottomLeft(Bin bin)
: base(bin)
{
}
: base(bin) { }
public override void Pack(List<Item> items)
{
var byArea = items.Select(i => i.Clone() as Item).OrderByDescending(i => i.Area()).ToList();
var byLength = items.Select(i => i.Clone() as Item).OrderByDescending(i => System.Math.Max(i.Width, i.Length)).ToList();
var byArea = items
.Select(i => i.Clone() as Item)
.OrderByDescending(i => i.Area())
.ToList();
var byLength = items
.Select(i => i.Clone() as Item)
.OrderByDescending(i => System.Math.Max(i.Width, i.Length))
.ToList();
var resultA = PackWithOrder(byArea);
var resultB = PackWithOrder(byLength);
@@ -1,6 +1,6 @@
using OpenNest.Geometry;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using OpenNest.Geometry;
namespace OpenNest.RectanglePacking
{