using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RichCreator.Utility.Structs { /// /// 多边形 /// public class ZTPolygon { public ZTPolygon() { } public ZTPolygon(ZTPoint[] points) { this.Points = points; } public ZTPoint[] Points { get;set; } public int Length { get { return Points.Length; } } public ZTPoint this[int index] { get { return Points[index]; } set { Points[index] = value; } } public static bool operator !=(ZTPolygon a, ZTPolygon b) { if (a == b) { return false; } return true; } public static bool operator ==(ZTPolygon a, ZTPolygon b) { if (a.Length != b.Length) { return false; } for (int i = 0; i < a.Length; i++) { if (!a[i].Equals(b[i])) { return false; } } return true; } public static implicit operator ZTPoint[] (ZTPolygon polygon) { return polygon.Points; } public static implicit operator ZTPolygon(ZTPoint[] points) { return new ZTPolygon(points); } } }