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:
@@ -1,7 +1,7 @@
|
||||
using OpenNest.CNC.CuttingStrategy;
|
||||
using OpenNest.Math;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenNest.CNC.CuttingStrategy;
|
||||
using OpenNest.Math;
|
||||
|
||||
namespace OpenNest.Engine.Sequencing
|
||||
{
|
||||
@@ -50,9 +50,7 @@ namespace OpenNest.Engine.Sequencing
|
||||
private static List<PartRow> GroupIntoRows(IReadOnlyList<Part> parts, double minDistance)
|
||||
{
|
||||
// Sort parts by Y center
|
||||
var sorted = parts
|
||||
.OrderBy(p => p.BoundingBox.Center.Y)
|
||||
.ToList();
|
||||
var sorted = parts.OrderBy(p => p.BoundingBox.Center.Y).ToList();
|
||||
|
||||
var rows = new List<PartRow>();
|
||||
|
||||
|
||||
@@ -12,9 +12,11 @@ namespace OpenNest.Engine.Sequencing
|
||||
// corrected extents: Size.Length = X-extent, Size.Width = Y-extent.
|
||||
var origin = plate.BoundingBox(false);
|
||||
var plateBox = new OpenNest.Geometry.Box(
|
||||
origin.X, origin.Y,
|
||||
origin.X,
|
||||
origin.Y,
|
||||
plate.Size.Length,
|
||||
plate.Size.Width);
|
||||
plate.Size.Width
|
||||
);
|
||||
|
||||
return parts
|
||||
.OrderBy(p => MinEdgeDistance(p.BoundingBox.Center, plateBox))
|
||||
@@ -23,14 +25,20 @@ namespace OpenNest.Engine.Sequencing
|
||||
.ToList();
|
||||
}
|
||||
|
||||
private static double MinEdgeDistance(OpenNest.Geometry.Vector center, OpenNest.Geometry.Box plateBox)
|
||||
private static double MinEdgeDistance(
|
||||
OpenNest.Geometry.Vector center,
|
||||
OpenNest.Geometry.Box plateBox
|
||||
)
|
||||
{
|
||||
var distLeft = center.X - plateBox.Left;
|
||||
var distRight = plateBox.Right - center.X;
|
||||
var distBottom = center.Y - plateBox.Bottom;
|
||||
var distTop = plateBox.Top - center.Y;
|
||||
|
||||
return System.Math.Min(System.Math.Min(distLeft, distRight), System.Math.Min(distBottom, distTop));
|
||||
return System.Math.Min(
|
||||
System.Math.Min(distLeft, distRight),
|
||||
System.Math.Min(distBottom, distTop)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using OpenNest.Math;
|
||||
using System.Collections.Generic;
|
||||
using OpenNest.Math;
|
||||
|
||||
namespace OpenNest.Engine.Sequencing
|
||||
{
|
||||
@@ -27,7 +27,10 @@ namespace OpenNest.Engine.Sequencing
|
||||
return result;
|
||||
}
|
||||
|
||||
private static List<Part> NearestNeighbor(IReadOnlyList<Part> parts, OpenNest.Geometry.Vector exit)
|
||||
private static List<Part> NearestNeighbor(
|
||||
IReadOnlyList<Part> parts,
|
||||
OpenNest.Geometry.Vector exit
|
||||
)
|
||||
{
|
||||
var remaining = new List<Part>(parts);
|
||||
var ordered = new List<Part>(parts.Count);
|
||||
@@ -97,7 +100,12 @@ namespace OpenNest.Engine.Sequencing
|
||||
/// Only the segment around the reversed segment [i..j] needs to be checked,
|
||||
/// but here we compute the full route cost for correctness.
|
||||
/// </summary>
|
||||
private static double RouteDistance(List<Part> ordered, OpenNest.Geometry.Vector exit, int i, int j)
|
||||
private static double RouteDistance(
|
||||
List<Part> ordered,
|
||||
OpenNest.Geometry.Vector exit,
|
||||
int i,
|
||||
int j
|
||||
)
|
||||
{
|
||||
// Full route distance: exit -> ordered[0] -> ... -> ordered[n-1]
|
||||
var total = 0.0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using OpenNest.CNC.CuttingStrategy;
|
||||
using System;
|
||||
using OpenNest.CNC.CuttingStrategy;
|
||||
|
||||
namespace OpenNest.Engine.Sequencing
|
||||
{
|
||||
@@ -16,7 +16,8 @@ namespace OpenNest.Engine.Sequencing
|
||||
SequenceMethod.LeastCode => new LeastCodeSequencer(),
|
||||
SequenceMethod.Advanced => new AdvancedSequencer(parameters),
|
||||
_ => throw new NotSupportedException(
|
||||
$"Sequence method '{parameters.Method}' is not supported.")
|
||||
$"Sequence method '{parameters.Method}' is not supported."
|
||||
),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace OpenNest.Engine.Sequencing
|
||||
2 => new Vector(0, yExtent),
|
||||
3 => new Vector(0, 0),
|
||||
4 => new Vector(xExtent, 0),
|
||||
_ => new Vector(xExtent, yExtent)
|
||||
_ => new Vector(xExtent, yExtent),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user