Files
UVtools/UVtools.Core/Layers/IssueOfPoints.cs
T
2021-09-20 21:38:44 +01:00

45 lines
1.3 KiB
C#

/*
* GNU AFFERO GENERAL PUBLIC LICENSE
* Version 3, 19 November 2007
* Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
* Everyone is permitted to copy and distribute verbatim copies
* of this license document, but changing it is not allowed.
*/
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
namespace UVtools.Core.Layers
{
public sealed class IssueOfPoints : Issue
{
/// <summary>
/// Gets the points containing the coordinates of the issue
/// </summary>
public Point[] Points { get; init; }
public IssueOfPoints(Layer layer, IEnumerable<Point> points, Rectangle boundingRectangle = default) : base(layer, boundingRectangle, points.Count())
{
Points = points.ToArray();
PixelsCount = (uint)Points.Length;
FirstPoint = Points[0];
}
private bool Equals(IssueOfPoints other)
{
return Points.SequenceEqual(other.Points);
}
public override bool Equals(object obj)
{
return ReferenceEquals(this, obj) || obj is IssueOfPoints other && Equals(other);
}
public override int GetHashCode()
{
return (Points != null ? Points.GetHashCode() : 0);
}
}
}