Example #1
0
        /// <summary>
        /// Initializes a new instance of the <c>MLine</c> class.
        /// </summary>
        /// <param name="vertexes">MLine <see cref="Vector2">vertex</see> location list in object coordinates.</param>
        /// <param name="style">MLine <see cref="MLineStyle">style.</see></param>
        /// <param name="scale">MLine scale.</param>
        /// <param name="isClosed">Sets if the multiline is closed</param>
        public MLine(IEnumerable <Vector2> vertexes, MLineStyle style, double scale, bool isClosed = false)
            : base(EntityType.MLine, DxfObjectCode.MLine)
        {
            this.scale = scale;
            if (style == null)
            {
                throw new ArgumentNullException("style", "The MLine style cannot be null.");
            }
            if (isClosed)
            {
                this.flags = MLineFlags.Has | MLineFlags.Closed;
            }
            else
            {
                this.flags = MLineFlags.Has;
            }

            this.style         = style;
            this.justification = MLineJustification.Zero;
            this.isClosed      = isClosed;
            this.noStartCaps   = false;
            this.noEndCaps     = false;
            this.elevation     = 0.0;
            if (vertexes == null)
            {
                throw new ArgumentNullException("vertexes");
            }
            this.SetVertexes(vertexes);
        }
        /// <summary>
        /// Initializes a new instance of the <c>MLine</c> class.
        /// </summary>
        /// <param name="vertexes">MLine <see cref="Vector2">vertex</see> location list in object coordinates.</param>
        /// <param name="style">MLine <see cref="MLineStyle">style.</see></param>
        /// <param name="scale">MLine scale.</param>
        /// <param name="isClosed">Sets if the multiline is closed  (default: false).</param>
        public MLine(IEnumerable <Vector2> vertexes, MLineStyle style, double scale, bool isClosed)
            : base(EntityType.MLine, DxfObjectCode.MLine)
        {
            this.scale = scale;
            if (style == null)
            {
                throw new ArgumentNullException(nameof(style));
            }
            if (isClosed)
            {
                this.flags = MLineFlags.Has | MLineFlags.Closed;
            }
            else
            {
                this.flags = MLineFlags.Has;
            }

            this.style         = style;
            this.justification = MLineJustification.Zero;
            this.elevation     = 0.0;
            if (vertexes == null)
            {
                throw new ArgumentNullException(nameof(vertexes));
            }
            this.vertexes = new List <MLineVertex>();
            foreach (Vector2 point in vertexes)
            {
                this.vertexes.Add(new MLineVertex(point, Vector2.Zero, Vector2.Zero, null));
            }
            this.Update();
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <c>MLine</c> class.
        /// </summary>
        /// <param name="vertexes">MLine <see cref="Vector2">vertex</see> location list in object coordinates.</param>
        /// <param name="style">MLine <see cref="MLineStyle">style.</see></param>
        /// <param name="scale">MLine scale.</param>
        /// <param name="isClosed">Sets if the multiline is closed</param>
        public MLine(ICollection<Vector2> vertexes, MLineStyle style, double scale, bool isClosed = false)
            : base(EntityType.MLine, DxfObjectCode.MLine)
        {
            this.scale = scale;
            if (style == null)
                throw new ArgumentNullException("style", "The MLine style cannot be null.");
            if (isClosed)
                this.flags = MLineFlags.Has | MLineFlags.Closed;
            else
                this.flags = MLineFlags.Has;

            this.style = style;
            this.justification = MLineJustification.Zero;
            this.elevation = 0.0;
            if (vertexes == null)
                throw new ArgumentNullException("vertexes");
            this.SetVertexes(vertexes);
        }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <c>MLine</c> class.
        /// </summary>
        /// <param name="vertexes">MLine <see cref="Vector2">vertex</see> location list in object coordinates.</param>
        /// <param name="style">MLine <see cref="MLineStyle">style.</see></param>
        /// <param name="scale">MLine scale.</param>
        /// <param name="isClosed">Sets if the multiline is closed  (default: false).</param>
        public MLine(IEnumerable<Vector2> vertexes, MLineStyle style, double scale, bool isClosed)
            : base(EntityType.MLine, DxfObjectCode.MLine)
        {
            this.scale = scale;
            if (style == null)
                throw new ArgumentNullException(nameof(style));
            if (isClosed)
                this.flags = MLineFlags.Has | MLineFlags.Closed;
            else
                this.flags = MLineFlags.Has;

            this.style = style;
            this.justification = MLineJustification.Zero;
            this.elevation = 0.0;
            if (vertexes == null)
                throw new ArgumentNullException(nameof(vertexes));
            this.vertexes = new List<MLineVertex>();
            foreach (Vector2 point in vertexes)
                this.vertexes.Add(new MLineVertex(point, Vector2.Zero, Vector2.Zero, null));
            this.Update();
        }