Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <c>MLineStyle</c> class.
        /// </summary>
        /// <param name="name">MLine style name.</param>
        /// <param name="elements">Elements of the multiline.</param>
        /// <param name="description">MLine style description (optional).</param>
        public MLineStyle(string name, IEnumerable <MLineStyleElement> elements, string description)
            : base(name, DxfObjectCode.MLineStyle, true)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name), "The multiline style name should be at least one character long.");
            }
            if (elements == null)
            {
                throw new ArgumentNullException(nameof(elements));
            }
            this.elements = new ObservableCollection <MLineStyleElement>();

            this.elements.BeforeAddItem    += this.Elements_BeforeAddItem;
            this.elements.AddItem          += this.Elements_AddItem;
            this.elements.BeforeRemoveItem += this.Elements_BeforeRemoveItem;
            this.elements.RemoveItem       += this.Elements_RemoveItem;

            this.elements.AddRange(elements);
            if (this.elements.Count < 1)
            {
                throw new ArgumentOutOfRangeException(nameof(elements), this.elements.Count, "The elements list must have at least one element.");
            }
            this.elements.Sort(); // the elements list must be ordered

            this.flags       = MLineStyleFlags.None;
            this.description = string.IsNullOrEmpty(description) ? string.Empty : description;
            this.fillColor   = AciColor.ByLayer;
            this.startAngle  = 90.0;
            this.endAngle    = 90.0;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <c>MLineStyle</c> class.
 /// </summary>
 /// <param name="name">MLine style name.</param>
 /// <param name="description">MLine style description (optional).</param>
 /// <remarks>By default the multiline style has to elements with offsets 0.5 y -0.5.</remarks>
 public MLineStyle(string name, string description = null)
     : base(name, DxfObjectCode.MLineStyle)
 {
     this.flags       = MLineStyleFlags.None;
     this.description = description;
     this.fillColor   = AciColor.ByLayer;
     this.startAngle  = 90;
     this.endAngle    = 90;
     this.elements    = new List <MLineStyleElement>
     {
         new MLineStyleElement(0.5),
         new MLineStyleElement(-0.5)
     };
 }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <c>MLineStyle</c> class.
        /// </summary>
        /// <param name="name">MLine style name.</param>
        /// <param name="description">MLine style description (optional).</param>
        /// <remarks>By default the multiline style has to elements with offsets 0.5 y -0.5.</remarks>
        public MLineStyle(string name, string description = null)
            : base(name, DxfObjectCode.MLineStyle, true)
        {
            this.reserved = name.Equals("Standard", StringComparison.OrdinalIgnoreCase);
            this.flags    = MLineStyleFlags.None;

            this.description = string.IsNullOrEmpty(description) ? string.Empty : description;
            this.fillColor   = AciColor.ByLayer;
            this.startAngle  = 90.0;
            this.endAngle    = 90.0;
            this.elements    = new List <MLineStyleElement>
            {
                new MLineStyleElement(0.5),
                new MLineStyleElement(-0.5)
            };
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <c>MLineStyle</c> class.
        /// </summary>
        /// <param name="name">MLine style name.</param>
        /// <param name="elements">Elements of the multiline.</param>
        /// <param name="description">MLine style description (optional).</param>
        public MLineStyle(string name, List <MLineStyleElement> elements, string description = null)
            : base(name, DxfObjectCode.MLineStyle, true)
        {
            if (elements == null)
            {
                throw new ArgumentNullException("elements");
            }
            if (elements.Count < 1)
            {
                throw new ArgumentOutOfRangeException("elements", elements.Count, "The elements list must have at least one element.");
            }
            // the elements list must be ordered
            elements.Sort();

            this.elements    = elements;
            this.flags       = MLineStyleFlags.None;
            this.description = string.IsNullOrEmpty(description) ? string.Empty : description;
            this.fillColor   = AciColor.ByLayer;
            this.startAngle  = 90.0;
            this.endAngle    = 90.0;
        }
Exemplo n.º 5
0
        public override void CopyFrom(DxfHandledObject from, CloneContext cloneContext)
        {
            base.CopyFrom(from, cloneContext);
            DxfMLineStyle dxfMlineStyle = (DxfMLineStyle)from;

            this.string_0          = dxfMlineStyle.string_0;
            this.mlineStyleFlags_0 = dxfMlineStyle.mlineStyleFlags_0;
            this.string_1          = dxfMlineStyle.string_1;
            this.color_0           = dxfMlineStyle.color_0;
            this.double_0          = dxfMlineStyle.double_0;
            this.double_1          = dxfMlineStyle.double_1;
            foreach (DxfMLineStyle.Element element in dxfMlineStyle.list_0)
            {
                this.list_0.Add(element.Clone(cloneContext));
            }
            if (dxfMlineStyle.Handle != 24UL)
            {
                return;
            }
            this.SetHandle(24UL);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <c>MLineStyle</c> class.
        /// </summary>
        /// <param name="name">MLine style name.</param>
        /// <param name="elements">Elements of the multiline.</param>
        /// <param name="description">MLine style description (optional).</param>
        public MLineStyle(string name, IEnumerable<MLineStyleElement> elements, string description)
            : base(name, DxfObjectCode.MLineStyle, true)
        {
            if (string.IsNullOrEmpty(name))
                throw new ArgumentNullException(nameof(name), "The multiline style name should be at least one character long.");
            if (elements == null)
                throw new ArgumentNullException(nameof(elements));
            this.elements = new ObservableCollection<MLineStyleElement>();

            this.elements.BeforeAddItem += this.Elements_BeforeAddItem;
            this.elements.AddItem += this.Elements_AddItem;
            this.elements.BeforeRemoveItem += this.Elements_BeforeRemoveItem;
            this.elements.RemoveItem += this.Elements_RemoveItem;

            this.elements.AddRange(elements);
            if (this.elements.Count < 1)
                throw new ArgumentOutOfRangeException(nameof(elements), this.elements.Count, "The elements list must have at least one element.");
            this.elements.Sort(); // the elements list must be ordered

            this.flags = MLineStyleFlags.None;
            this.description = string.IsNullOrEmpty(description) ? string.Empty : description;
            this.fillColor = AciColor.ByLayer;
            this.startAngle = 90.0;
            this.endAngle = 90.0;
        }