/// <summary> /// Initializes a new instance of the <c>PolygonMesh</c> class. /// </summary> /// <param name="u">Number of vertexes along the U direction (local X axis).</param> /// <param name="v">Number of vertexes along the V direction (local Y axis).</param> /// <param name="vertexes">Array of UxV vertexes that represents the mesh grid.</param> public PolygonMesh(short u, short v, IEnumerable <Vector3> vertexes) : base(EntityType.PolygonMesh, DxfObjectCode.Polyline) { if (u < 2 || u > 256) { throw new ArgumentOutOfRangeException(nameof(this.u), this.u, "The number of vertexes along the U direction must be between 2 and 256."); } this.u = u; if (v < 2 || v > 256) { throw new ArgumentOutOfRangeException(nameof(this.v), this.v, "The number of vertexes along the V direction must be between 2 and 256."); } this.v = v; if (vertexes == null) { throw new ArgumentNullException(nameof(vertexes)); } this.vertexes = vertexes.ToArray(); if (this.vertexes.Length != u * v) { throw new ArgumentException("The number of vertexes must be equal to UxV.", nameof(vertexes)); } this.densityU = 0; this.densityV = 0; this.smoothType = PolylineSmoothType.NoSmooth; this.flags = PolylineTypeFlags.PolygonMesh; }
/// <summary> /// Initializes a new instance of the <c>Polyline3d</c> class. /// </summary> /// <param name="vertexes">3d polyline <see cref="PolylineVertex">vertex</see> list.</param> /// <param name="isClosed">Sets if the polyline is closed.</param> public Polyline(List<PolylineVertex> vertexes, bool isClosed = false) : base (EntityType.Polyline, DxfObjectCode.Polyline) { if (vertexes == null) throw new ArgumentNullException(nameof(vertexes)); this.vertexes = vertexes; this.flags = isClosed ? PolylineTypeFlags.ClosedPolylineOrClosedPolygonMeshInM | PolylineTypeFlags.Polyline3D : PolylineTypeFlags.Polyline3D; this.smoothType = PolylineSmoothType.NoSmooth; this.endSequence = new EndSequence(); }
/// <summary> /// Initializes a new instance of the <c>Polyline3d</c> class. /// </summary> /// <param name="vertexes">3d polyline <see cref="PolylineVertex">vertex</see> list.</param> /// <param name="isClosed">Sets if the polyline is closed.</param> public Polyline(List <PolylineVertex> vertexes, bool isClosed = false) : base(EntityType.Polyline, DxfObjectCode.Polyline) { if (vertexes == null) { throw new ArgumentNullException("vertexes"); } this.vertexes = vertexes; this.flags = isClosed ? PolylineTypeFlags.ClosedPolylineOrClosedPolygonMeshInM | PolylineTypeFlags.Polyline3D : PolylineTypeFlags.Polyline3D; this.smoothType = PolylineSmoothType.NoSmooth; this.endSequence = new EndSequence(); }
/// <summary> /// Initializes a new instance of the <c>Polyline3d</c> class. /// </summary> /// <param name="vertexes">3d polyline <see cref="Vector3">vertex</see> list.</param> /// <param name="isClosed">Sets if the polyline is closed, by default it will create an open polyline.</param> public Polyline3D(IEnumerable <Vector3> vertexes, bool isClosed) : base(EntityType.Polyline3D, DxfObjectCode.Polyline) { if (vertexes == null) { throw new ArgumentNullException(nameof(vertexes)); } this.vertexes = new List <Vector3>(vertexes); this.flags = isClosed ? PolylineTypeFlags.ClosedPolylineOrClosedPolygonMeshInM | PolylineTypeFlags.Polyline3D : PolylineTypeFlags.Polyline3D; this.smoothType = PolylineSmoothType.NoSmooth; }
/// <summary> /// Initializes a new instance of the <c>Polyline3d</c> class. /// </summary> /// <param name="vertexes">3d polyline <see cref="Vector3">vertex</see> list.</param> /// <param name="isClosed">Sets if the polyline is closed.</param> public Polyline(IList<Vector3> vertexes, bool isClosed = false) : base(EntityType.Polyline, DxfObjectCode.Polyline) { if (vertexes == null) throw new ArgumentNullException(nameof(vertexes)); this.vertexes = new List<PolylineVertex>(vertexes.Count); foreach (Vector3 vertex in vertexes) this.vertexes.Add(new PolylineVertex(vertex)); this.flags = isClosed ? PolylineTypeFlags.ClosedPolylineOrClosedPolygonMeshInM | PolylineTypeFlags.Polyline3D : PolylineTypeFlags.Polyline3D; this.smoothType = PolylineSmoothType.NoSmooth; this.endSequence = new EndSequence(); }
/// <summary> /// Initializes a new instance of the <c>Polyline2D</c> class. /// </summary> /// <param name="vertexes">Polyline2D <see cref="Polyline2DVertex">vertex</see> list in object coordinates.</param> /// <param name="isClosed">Sets if the polyline is closed (default: false).</param> public Polyline2D(IEnumerable <Polyline2DVertex> vertexes, bool isClosed) : base(EntityType.Polyline2D, DxfObjectCode.LwPolyline) { if (vertexes == null) { throw new ArgumentNullException(nameof(vertexes)); } this.vertexes = new List <Polyline2DVertex>(vertexes); this.elevation = 0.0; this.thickness = 0.0; this.flags = isClosed ? PolylineTypeFlags.ClosedPolylineOrClosedPolygonMeshInM : PolylineTypeFlags.OpenPolyline; this.smoothType = PolylineSmoothType.NoSmooth; }
/// <summary> /// Initializes a new instance of the <c>Polyline3d</c> class. /// </summary> /// <param name="vertexes">3d polyline <see cref="Vector3">vertex</see> list.</param> /// <param name="isClosed">Sets if the polyline is closed.</param> public Polyline(IList <Vector3> vertexes, bool isClosed = false) : base(EntityType.Polyline, DxfObjectCode.Polyline) { if (vertexes == null) { throw new ArgumentNullException(nameof(vertexes)); } this.vertexes = new List <PolylineVertex>(vertexes.Count); foreach (Vector3 vertex in vertexes) { this.vertexes.Add(new PolylineVertex(vertex)); } this.flags = isClosed ? PolylineTypeFlags.ClosedPolylineOrClosedPolygonMeshInM | PolylineTypeFlags.Polyline3D : PolylineTypeFlags.Polyline3D; this.smoothType = PolylineSmoothType.NoSmooth; this.endSequence = new EndSequence(); }
/// <summary> /// Initializes a new instance of the <c>Polyline3d</c> class. /// </summary> /// <param name="vertexes">3d polyline <see cref="Vector3">vertex</see> list.</param> /// <param name="isClosed">Sets if the polyline is closed, by default it will create an open polyline.</param> public Polyline(IEnumerable<Vector3> vertexes, bool isClosed) : base(EntityType.Polyline, DxfObjectCode.Polyline) { if (vertexes == null) throw new ArgumentNullException(nameof(vertexes)); this.vertexes = new ObservableCollection<PolylineVertex>(); this.vertexes.BeforeAddItem += this.Vertexes_BeforeAddItem; this.vertexes.AddItem += this.Vertexes_AddItem; this.vertexes.BeforeRemoveItem += this.Vertexes_BeforeRemoveItem; this.vertexes.RemoveItem += this.Vertexes_RemoveItem; foreach (Vector3 vertex in vertexes) this.vertexes.Add(new PolylineVertex(vertex)); this.flags = isClosed ? PolylinetypeFlags.ClosedPolylineOrClosedPolygonMeshInM | PolylinetypeFlags.Polyline3D : PolylinetypeFlags.Polyline3D; this.smoothType = PolylineSmoothType.NoSmooth; this.endSequence = new EndSequence(this); }
/// <summary> /// Initializes a new instance of the <c>Polyline3d</c> class. /// </summary> /// <param name="vertexes">3d polyline <see cref="PolylineVertex">vertex</see> list.</param> /// <param name="isClosed">Sets if the polyline is closed (default: false).</param> public Polyline(IEnumerable <PolylineVertex> vertexes, bool isClosed) : base(EntityType.Polyline, DxfObjectCode.Polyline) { if (vertexes == null) { throw new ArgumentNullException("vertexes"); } this.vertexes = new ObservableCollection <PolylineVertex>(); this.vertexes.BeforeAddItem += this.Vertexes_BeforeAddItem; this.vertexes.AddItem += this.Vertexes_AddItem; this.vertexes.BeforeRemoveItem += this.Vertexes_BeforeRemoveItem; this.vertexes.RemoveItem += this.Vertexes_RemoveItem; this.vertexes.AddRange(vertexes); this.flags = isClosed ? PolylinetypeFlags.ClosedPolylineOrClosedPolygonMeshInM | PolylinetypeFlags.Polyline3D : PolylinetypeFlags.Polyline3D; this.smoothType = PolylineSmoothType.NoSmooth; this.endSequence = new EndSequence(this); }
/// <summary> /// Initializes a new instance of the <c>Polyline3d</c> class. /// </summary> /// <param name="vertexes">3d polyline <see cref="Vector3">vertex</see> list.</param> /// <param name="isClosed">Sets if the polyline is closed, by default it will create an open polyline.</param> public Polyline(IEnumerable <Vector3> vertexes, bool isClosed) : base(EntityType.Polyline, DxfObjectCode.Polyline) { if (vertexes == null) { throw new ArgumentNullException(nameof(vertexes)); } this.vertexes = new ObservableCollection <PolylineVertex>(); this.vertexes.BeforeAddItem += Vertexes_BeforeAddItem; this.vertexes.AddItem += Vertexes_AddItem; this.vertexes.BeforeRemoveItem += Vertexes_BeforeRemoveItem; this.vertexes.RemoveItem += Vertexes_RemoveItem; foreach (Vector3 vertex in vertexes) { this.vertexes.Add(new PolylineVertex(vertex)); } flags = isClosed ? PolylinetypeFlags.ClosedPolylineOrClosedPolygonMeshInM | PolylinetypeFlags.Polyline3D : PolylinetypeFlags.Polyline3D; smoothType = PolylineSmoothType.NoSmooth; endSequence = new EndSequence(this); }