feat: add SourceEntity property to Bend for manual pick tracking

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-25 18:33:24 -04:00
parent 6106df929e
commit 885dec5f0e
2 changed files with 29 additions and 0 deletions

View File

@@ -12,6 +12,9 @@ namespace OpenNest.Bending
public double? Radius { get; set; }
public string NoteText { get; set; }
[System.Text.Json.Serialization.JsonIgnore]
public Entity SourceEntity { get; set; }
public double Length => StartPoint.DistanceTo(EndPoint);
public double AngleRadians => Angle.HasValue

View File

@@ -87,4 +87,30 @@ public class BendModelTests
Assert.Contains("90", str);
Assert.Contains("0.06", str);
}
[Fact]
public void SourceEntity_DefaultsToNull()
{
var bend = new Bend
{
StartPoint = new Vector(0, 0),
EndPoint = new Vector(10, 0),
Direction = BendDirection.Down,
Angle = 90
};
Assert.Null(bend.SourceEntity);
}
[Fact]
public void SourceEntity_StoresReference()
{
var line = new Line(new Vector(0, 0), new Vector(10, 0));
var bend = new Bend
{
StartPoint = line.StartPoint,
EndPoint = line.EndPoint,
SourceEntity = line
};
Assert.Same(line, bend.SourceEntity);
}
}