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();
        }
        protected virtual MLineStyle OnMLineStyleChangedEvent(MLineStyle oldMLineStyle, MLineStyle newMLineStyle)
        {
            MLineStyleChangedEventHandler ae = this.MLineStyleChanged;

            if (ae != null)
            {
                TableObjectChangedEventArgs <MLineStyle> eventArgs = new TableObjectChangedEventArgs <MLineStyle>(oldMLineStyle, newMLineStyle);
                ae(this, eventArgs);
                return(eventArgs.NewValue);
            }
            return(newMLineStyle);
        }
 /// <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>
 public MLine(IEnumerable <Vector2> vertexes, MLineStyle style, double scale)
     : this(vertexes, style, scale, false)
 {
 }