diff options
Diffstat (limited to 'UVtools.Core/Layer/LayerIssue.cs')
-rw-r--r-- | UVtools.Core/Layer/LayerIssue.cs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/UVtools.Core/Layer/LayerIssue.cs b/UVtools.Core/Layer/LayerIssue.cs index fb55675..5bac5e8 100644 --- a/UVtools.Core/Layer/LayerIssue.cs +++ b/UVtools.Core/Layer/LayerIssue.cs @@ -424,4 +424,42 @@ namespace UVtools.Core } } #endregion + + #region ResinTrapGround + + public sealed class ResinTrapGroup + { + public List<List<LayerHollowArea>> Groups { get; } = new(); + + public int FindHollowArea(LayerHollowArea hollowArea) + { + for (var i = 0; i < Groups.Count; i++) + { + if (Groups[i].Any(area => ReferenceEquals(area, hollowArea))) + { + return i; + } + } + + return -1; + } + + public int Add(LayerHollowArea hollowArea) + { + var index = FindHollowArea(hollowArea); + if (index < 0) // Not found + { + index = Groups.Count; + Groups.Add(new List<LayerHollowArea>{hollowArea}); + return index; + } + + // Exists + Groups[index].Add(hollowArea); + + return index; + } + } + #endregion + } |