• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DomCR / ACadSharp / 18679225130

21 Oct 2025 09:23AM UTC coverage: 77.89% (-0.2%) from 78.126%
18679225130

Pull #832

github

web-flow
Merge 2743be894 into 03242f9d6
Pull Request #832: multileader dxf

6920 of 9695 branches covered (71.38%)

Branch coverage included in aggregate %.

341 of 429 new or added lines in 16 files covered. (79.49%)

80 existing lines in 9 files now uncovered.

26667 of 33426 relevant lines covered (79.78%)

108166.73 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

27.37
/src/ACadSharp/Objects/MultiLeaderObjectContextData.LeaderLine.cs
1
using System;
2
using System.Collections.Generic;
3
using ACadSharp.Attributes;
4
using ACadSharp.Tables;
5
using CSMath;
6

7
namespace ACadSharp.Objects
8
{
9
        public partial class MultiLeaderObjectContextData
10
        {
11
                /// <summary>
12
                ///        Represents a leader line
13
                /// </summary>
14
                /// <remarks>
15
                /// Appears as 304        DXF: “LEADER_LINE“
16
                /// </remarks>
17
                public class LeaderLine : ICloneable
18
                {
19
                        /// <summary>
20
                        /// Gets or sets a <see cref="BlockRecord"/> containig elements
21
                        /// to be dawn as arrow symbol.
22
                        /// </summary>
23
                        [DxfCodeValue(DxfReferenceType.Handle, 341)]
24
                        public BlockRecord Arrowhead { get; set; }
3✔
25

26
                        /// <summary>
27
                        /// Arrowhead size
28
                        /// </summary>
29
                        [DxfCodeValue(40)]
30
                        public double ArrowheadSize { get; set; }
858✔
31

32
                        /// <summary>
33
                        /// Break info count
34
                        /// </summary>
35
                        public int BreakInfoCount { get; set; }
3,998✔
36

37
                        /// <summary>
38
                        /// Leader line index.
39
                        /// </summary>
40
                        [DxfCodeValue(91)]
41
                        public int Index { get; set; }
5,814✔
42

43
                        /// <summary>
44
                        /// Line color
45
                        /// </summary>
46
                        [DxfCodeValue(92)]
47
                        public Color LineColor { get; set; }
858✔
48

49
                        /// <summary>
50
                        /// Line type
51
                        /// </summary>
52
                        [DxfCodeValue(DxfReferenceType.Handle, 340)]
53
                        public LineType LineType
54
                        {
55
                                get { return this._lineType; }
9✔
56
                                set
57
                                {
×
58
                                        if (value == null)
×
59
                                        {
×
60
                                                _lineType = null;
×
61
                                                return;
×
62
                                        }
63

64
                                        if (this.Document != null)
×
65
                                        {
×
66
                                                if (this.Document.LineTypes.TryGetValue(((LineType)value).Name, out LineType lt))
×
67
                                                {
×
68
                                                        this._lineType = lt;
×
69
                                                }
×
70
                                                else
71
                                                {
×
72
                                                        this._lineType = value;
×
73
                                                        this.Document.LineTypes.Add(this._lineType);
×
74
                                                }
×
75
                                        }
×
76
                                }
×
77
                        }
78

79
                        /// <summary>
80
                        /// Line weight
81
                        /// </summary>
82
                        [DxfCodeValue(171)]
83
                        public LineWeightType LineWeight { get; set; }
858✔
84

85
                        /// <summary>
86
                        /// Override flags
87
                        /// </summary>
88
                        [DxfCodeValue(93)]
89
                        public LeaderLinePropertOverrideFlags OverrideFlags { get; set; }
858✔
90

91
                        //R2010
92
                        /// <summary>
93
                        /// Leader type
94
                        /// </summary>
95
                        [DxfCodeValue(170)]
96
                        public MultiLeaderPathType PathType { get; set; }
867✔
97

98
                        /// <summary>
99
                        /// Get the list of points of this <see cref="LeaderLine"/>.
100
                        /// </summary>
101
                        public IList<XYZ> Points { get; private set; } = new List<XYZ>();
38,611✔
102

103
                        /// <summary>
104
                        /// Segment index
105
                        /// </summary>
106
                        [DxfCodeValue(90)]
NEW
107
                        public int SegmentIndex { get; set; }
×
108

109
                        /// <summary>
110
                        /// Start/end point pairs
111
                        /// </summary>
112
                        public IList<StartEndPointPair> StartEndPoints { get; private set; } = new List<StartEndPointPair>();
5,424✔
113

114
                        internal CadDocument Document { get; set; }
6,414✔
115

116
                        private LineType _lineType;
117

118
                        public LeaderLine()
5,424✔
119
                        { }
10,848✔
120

121
                        public void AssignDocument(CadDocument doc)
122
                        {
5,634✔
123
                                this.Document = doc;
5,634✔
124

125
                                if (_lineType != null)
5,634!
126
                                {
×
127
                                        if (doc.LineTypes.TryGetValue(_lineType.Name, out LineType existing))
×
128
                                        {
×
129
                                                this._lineType = existing;
×
130
                                        }
×
131
                                        else
132
                                        {
×
133
                                                doc.LineTypes.Add(_lineType);
×
134
                                        }
×
135
                                }
×
136

137
                                doc.LineTypes.OnRemove += this.tableOnRemove;
5,634✔
138
                        }
5,634✔
139

140
                        public object Clone()
NEW
141
                        {
×
NEW
142
                                LeaderLine clone = (LeaderLine)this.MemberwiseClone();
×
143

NEW
144
                                clone.LineType = (LineType)this.LineType?.Clone();
×
NEW
145
                                clone.Arrowhead = (BlockRecord)this.Arrowhead?.Clone();
×
146

NEW
147
                                clone.Points = new List<XYZ>();
×
NEW
148
                                foreach (var point in this.Points)
×
NEW
149
                                {
×
NEW
150
                                        clone.Points.Add(point);
×
NEW
151
                                }
×
152

NEW
153
                                clone.StartEndPoints = new List<StartEndPointPair>();
×
NEW
154
                                foreach (var startEndPoint in this.StartEndPoints)
×
NEW
155
                                {
×
NEW
156
                                        clone.StartEndPoints.Add((StartEndPointPair)startEndPoint.Clone());
×
NEW
157
                                }
×
158

NEW
159
                                return clone;
×
NEW
160
                        }
×
161

162
                        public void UassignDocument()
163
                        {
390✔
164
                                this.Document.LineTypes.OnRemove -= this.tableOnRemove;
390✔
165

166
                                this.Document = null;
390✔
167

168
                                this._lineType = (LineType)this._lineType?.Clone();
390!
169
                        }
390✔
170

171
                        private void tableOnRemove(object sender, CollectionChangedEventArgs e)
172
                        {
×
173
                                if (e.Item.Equals(this._lineType))
×
174
                                {
×
175
                                        this._lineType = null;
×
176
                                }
×
177
                        }
×
178
                }
179
        }
180
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc