Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <c>PolyfaceMesh</c> class.
        /// </summary>
        /// <param name="vertexes">Polyface mesh <see cref="PolyfaceMeshVertex">vertex</see> list.</param>
        /// <param name="faces">Polyface mesh <see cref="PolyfaceMeshFace">faces</see> list.</param>
        public PolyfaceMesh(IEnumerable <PolyfaceMeshVertex> vertexes, IEnumerable <PolyfaceMeshFace> faces)
            : base(EntityType.PolyfaceMesh, DxfObjectCode.Polyline)
        {
            this.flags = PolylinetypeFlags.PolyfaceMesh;
            if (vertexes == null)
            {
                throw new ArgumentNullException(nameof(vertexes));
            }
            this.vertexes = new List <PolyfaceMeshVertex>(vertexes);
            if (this.vertexes.Count < 3)
            {
                throw new ArgumentOutOfRangeException(nameof(vertexes), this.vertexes.Count, "The polyface mesh faces list requires at least three points.");
            }

            if (faces == null)
            {
                throw new ArgumentNullException(nameof(vertexes));
            }
            this.faces = new List <PolyfaceMeshFace>(faces);
            if (this.faces.Count < 1)
            {
                throw new ArgumentOutOfRangeException(nameof(vertexes), this.faces.Count, "The polyface mesh faces list requires at least one face.");
            }

            this.endSequence = new EndSequence(this);
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <c>LwPolyline</c> class.
 /// </summary>
 /// <param name="vertexes">LwPolyline <see cref="LwPolylineVertex">vertex</see> list in object coordinates.</param>
 /// <param name="isClosed">Sets if the polyline is closed  (default: false).</param>
 public LwPolyline(IEnumerable<LwPolylineVertex> vertexes, bool isClosed)
     : base(EntityType.LightWeightPolyline, DxfObjectCode.LightWeightPolyline)
 {
     if (vertexes == null)
         throw new ArgumentNullException(nameof(vertexes));
     this.vertexes = new List<LwPolylineVertex>(vertexes);
     this.elevation = 0.0;
     this.thickness = 0.0;
     this.flags = isClosed ? PolylinetypeFlags.ClosedPolylineOrClosedPolygonMeshInM : PolylinetypeFlags.OpenPolyline;
 }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <c>LwPolyline</c> class.
 /// </summary>
 /// <param name="vertexes">LwPolyline <see cref="Vector2">vertex</see> list in object coordinates.</param>
 /// <param name="isClosed">Sets if the polyline is closed, by default it will create an open polyline.</param>
 public LwPolyline(IEnumerable<Vector2> vertexes, bool isClosed)
     : base(EntityType.LightWeightPolyline, DxfObjectCode.LightWeightPolyline)
 {
     if (vertexes == null)
         throw new ArgumentNullException(nameof(vertexes));
     this.vertexes = new List<LwPolylineVertex>();
     foreach (Vector2 vertex in vertexes)
         this.vertexes.Add(new LwPolylineVertex(vertex));
     this.elevation = 0.0;
     this.thickness = 0.0;
     this.flags = isClosed ? PolylinetypeFlags.ClosedPolylineOrClosedPolygonMeshInM : PolylinetypeFlags.OpenPolyline;
 }
Beispiel #4
0
 /// <summary>
 /// Initializes a new instance of the <c>LwPolyline</c> class.
 /// </summary>
 /// <param name="vertexes">LwPolyline <see cref="Vector2">vertex</see> list in object coordinates.</param>
 /// <param name="isClosed">Sets if the polyline is closed, by default it will create an open polyline.</param>
 public LwPolyline(IEnumerable <Vector2> vertexes, bool isClosed)
     : base(EntityType.LightWeightPolyline, DxfObjectCode.LightWeightPolyline)
 {
     if (vertexes == null)
     {
         throw new ArgumentNullException("vertexes");
     }
     this.vertexes = new List <LwPolylineVertex>();
     foreach (Vector2 vertex in vertexes)
     {
         this.vertexes.Add(new LwPolylineVertex(vertex));
     }
     this.elevation = 0.0;
     this.thickness = 0.0;
     this.flags     = isClosed ? PolylinetypeFlags.ClosedPolylineOrClosedPolygonMeshInM : PolylinetypeFlags.OpenPolyline;
 }
Beispiel #5
0
        /// <summary>
        /// Initializes a new instance of the <c>PolyfaceMesh</c> class.
        /// </summary>
        /// <param name="vertexes">Polyface mesh <see cref="PolyfaceMeshVertex">vertex</see> list.</param>
        /// <param name="faces">Polyface mesh <see cref="PolyfaceMeshFace">faces</see> list.</param>
        public PolyfaceMesh(IEnumerable<PolyfaceMeshVertex> vertexes, IEnumerable<PolyfaceMeshFace> faces)
            : base(EntityType.PolyfaceMesh, DxfObjectCode.Polyline)
        {
            this.flags = PolylinetypeFlags.PolyfaceMesh;
            if (vertexes == null)
                throw new ArgumentNullException(nameof(vertexes));
            this.vertexes = new List<PolyfaceMeshVertex>(vertexes);
            if (this.vertexes.Count < 3)
                throw new ArgumentOutOfRangeException(nameof(vertexes), this.vertexes.Count, "The polyface mesh faces list requires at least three points.");

            if (faces == null)
                throw new ArgumentNullException(nameof(vertexes));
            this.faces = new List<PolyfaceMeshFace>(faces);
            if (this.faces.Count < 1)
                throw new ArgumentOutOfRangeException(nameof(vertexes), this.faces.Count, "The polyface mesh faces list requires at least one face.");

            this.endSequence = new EndSequence(this);
        }
Beispiel #6
0
        /// <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);
        }
Beispiel #7
0
        /// <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);
        }
Beispiel #8
0
        /// <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);
        }
Beispiel #9
0
 public static bool HasFlag(this PolylinetypeFlags flags, PolylinetypeFlags flag)
 {
     return((flags & flag) != 0);
 }