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

DomCR / ACadSharp / 14834885843

05 May 2025 11:00AM UTC coverage: 75.496% (+0.4%) from 75.056%
14834885843

Pull #641

github

web-flow
Merge 49993bc63 into 9a87bd970
Pull Request #641: MultiLeader SPIKE

5716 of 8329 branches covered (68.63%)

Branch coverage included in aggregate %.

223 of 249 new or added lines in 7 files covered. (89.56%)

85 existing lines in 12 files now uncovered.

22882 of 29551 relevant lines covered (77.43%)

82418.69 hits per line

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

25.76
/src/ACadSharp/Objects/MultiLeaderAnnotContextClasses.cs
1
using System;
2
using System.Collections.Generic;
3

4
using ACadSharp.Attributes;
5
using ACadSharp.Tables;
6

7
using CSMath;
8

9

10
namespace ACadSharp.Objects
11
{
12

13
        /// <summary>
14
        /// Nested classes in MultiLeaderAnnotContext
15
        /// </summary>
16
        public partial class MultiLeaderAnnotContext : NonGraphicalObject
17
        {
18
                /// <summary>
19
                /// Represents a leader root
20
                /// </summary>
21
                /// <remarks>
22
                /// Appears in DXF as 302 DXF: “LEADER“
23
                /// </remarks>
24
                public class LeaderRoot : ICloneable
25
                {
26
                        public LeaderRoot() { }
5,985✔
27

28
                        /// <summary>
29
                        /// Is content valid (ODA writes true)
30
                        /// </summary>
31
                        [DxfCodeValue(290)]
32
                        public bool ContentValid { get; set; }
1,995✔
33

34
                        /// <summary>
35
                        /// Unknown (ODA writes true)
36
                        /// </summary>
37
                        [DxfCodeValue(291)]
38
                        internal bool Unknown { get; set; } = true;
3,990✔
39

40
                        /// <summary>
41
                        /// Connection point
42
                        /// </summary>
43
                        [DxfCodeValue(10, 20, 30)]
44
                        public XYZ ConnectionPoint { get; set; }
2,205✔
45

46
                        /// <summary>
47
                        /// Direction
48
                        /// </summary>
49
                        [DxfCodeValue(11, 21, 31)]
50
                        public XYZ Direction { get; set; }
2,205✔
51

52
                        /// <summary>
53
                        /// Gets a list of <see cref="StartEndPointPair" />.
54
                        /// </summary>
55
                        public IList<StartEndPointPair> BreakStartEndPointsPairs { get; private set; } = new List<StartEndPointPair>();
1,995✔
56

57
                        /// <summary>
58
                        /// Leader index
59
                        /// </summary>
60
                        [DxfCodeValue(90)]
61
                        public int LeaderIndex { get; set; }
2,205✔
62

63
                        /// <summary>
64
                        /// Landing distance
65
                        /// </summary>
66
                        [DxfCodeValue(40)]
67
                        public double LandingDistance { get; set; }
2,205✔
68

69
                        /// <summary>
70
                        /// Gets a list of <see cref="LeaderLine"/> objects representing
71
                        /// leader lines starting from the landing point
72
                        /// of the multi leader.
73
                        /// </summary>
74
                        public IList<LeaderLine> Lines { get; private set; } = new List<LeaderLine>();
6,615✔
75

76
                        //R2010
77
                        /// <summary>
78
                        /// Attachment direction
79
                        /// </summary>
80
                        [DxfCodeValue(271)]
81
                        public TextAttachmentDirectionType TextAttachmentDirection { get; set; }
855✔
82

83
                        public object Clone()
84
                        {
×
85
                                LeaderRoot clone = (LeaderRoot)base.MemberwiseClone();
×
86

87
                                clone.BreakStartEndPointsPairs = new List<StartEndPointPair>();
×
88
                                foreach (var breakStartEndPoint in this.BreakStartEndPointsPairs)
×
89
                                {
×
90
                                        clone.BreakStartEndPointsPairs.Add((StartEndPointPair)breakStartEndPoint.Clone());
×
91
                                }
×
92

93
                                clone.Lines = new List<LeaderLine>();
×
94
                                foreach (var line in this.Lines)
×
95
                                {
×
96
                                        clone.Lines.Add((LeaderLine)line.Clone());
×
97
                                }
×
98

99
                                return clone;
×
100
                        }
×
101
                }
102

103
                /// <summary>
104
                /// Start/end point pairs
105
                /// 3BD        11        Start Point
106
                /// 3BD        12        End point
107
                /// </summary>
108
                public struct StartEndPointPair : ICloneable
109
                {
110
                        public StartEndPointPair(XYZ startPoint, XYZ endPoint)
NEW
111
                        {
×
112
                                StartPoint = startPoint;
×
113
                                EndPoint = endPoint;
×
114
                        }
×
115

116
                        /// <summary>
117
                        /// Break start point
118
                        /// </summary>
119
                        [DxfCodeValue(12, 22, 32)]
120
                        public XYZ StartPoint { get; private set; }
×
121

122
                        /// <summary>
123
                        /// Break end point
124
                        /// </summary>
125
                        [DxfCodeValue(13, 23, 33)]
126
                        public XYZ EndPoint { get; private set; }
×
127

128
                        public object Clone()
129
                        {
×
130
                                return this.MemberwiseClone();
×
131
                        }
×
132
                }
133

134

135
                /// <summary>
136
                ///        Represents a leader line
137
                /// </summary>
138
                /// <remarks>
139
                /// Appears as 304        DXF: “LEADER_LINE“
140
                /// </remarks>
141
                public class LeaderLine : ICloneable
142
                {
143
                        internal CadDocument Document { get; set; }
2,625✔
144
                        private LineType _lineType = null;
1,995✔
145

146
                        public LeaderLine() { }
5,985✔
147

148
                        /// <summary>
149
                        /// Get the list of points of this <see cref="LeaderLine"/>.
150
                        /// </summary>
151
                        public IList<XYZ> Points { get; private set; } = new List<XYZ>();
4,200✔
152

153
                        /// <summary>
154
                        /// Break info count
155
                        /// </summary>
156
                        public int BreakInfoCount { get; set; }
3,990✔
157

158
                        /// <summary>
159
                        /// Segment index
160
                        /// </summary>
161
                        [DxfCodeValue(90)]
162
                        public int SegmentIndex { get; set; }
×
163

164
                        /// <summary>
165
                        /// Start/end point pairs
166
                        /// </summary>
167
                        public IList<StartEndPointPair> StartEndPoints { get; private set; } = new List<StartEndPointPair>();
1,995✔
168

169
                        /// <summary>
170
                        /// Leader line index.
171
                        /// </summary>
172
                        [DxfCodeValue(91)]
173
                        public int Index { get; set; }
2,205✔
174

175
                        //R2010
176
                        /// <summary>
177
                        /// Leader type
178
                        /// </summary>
179
                        [DxfCodeValue(170)]
180
                        public MultiLeaderPathType PathType { get; set; } = MultiLeaderPathType.StraightLineSegments;
2,850✔
181

182
                        /// <summary>
183
                        /// Line color
184
                        /// </summary>
185
                        [DxfCodeValue(92)]
186
                        public Color LineColor { get; set; } = Color.ByBlock;
2,850✔
187

188
                        /// <summary>
189
                        /// Line type
190
                        /// </summary>
191
                        [DxfCodeValue(DxfReferenceType.Handle, 340)]
192
                        public LineType LineType
193
                        {
194
                                get { return this._lineType; }
×
195
                                set
196
                                {
×
197
                                        if (value == null)
×
198
                                        {
×
199
                                                _lineType = null;
×
200
                                                return;
×
201
                                        }
202

203
                                        if (this.Document != null)
×
204
                                        {
×
205
                                                if (this.Document.LineTypes.TryGetValue(((LineType)value).Name, out LineType lt))
×
206
                                                {
×
207
                                                        this._lineType = lt;
×
208
                                                }
×
209
                                                else
210
                                                {
×
211
                                                        this._lineType = value;
×
212
                                                        this.Document.LineTypes.Add(this._lineType);
×
213
                                                }
×
214
                                        }
×
215
                                }
×
216
                        }
217

218
                        /// <summary>
219
                        /// Line weight
220
                        /// </summary>
221
                        [DxfCodeValue(171)]
222
                        public LineweightType LineWeight { get; set; }
855✔
223

224
                        /// <summary>
225
                        /// Arrowhead size
226
                        /// </summary>
227
                        [DxfCodeValue(40)]
228
                        public double ArrowheadSize { get; set; }
855✔
229

230
                        /// <summary>
231
                        /// Gets or sets a <see cref="BlockRecord"/> containig elements
232
                        /// to be dawn as arrow symbol.
233
                        /// </summary>
234
                        [DxfCodeValue(DxfReferenceType.Handle, 341)]
235
                        public BlockRecord Arrowhead { get; set; }
×
236

237
                        /// <summary>
238
                        /// Override flags
239
                        /// </summary>
240
                        [DxfCodeValue(93)]
241
                        public LeaderLinePropertOverrideFlags OverrideFlags { get; set; }
855✔
242

243
                        public object Clone()
244
                        {
×
245
                                LeaderLine clone = (LeaderLine)this.MemberwiseClone();
×
246

247
                                clone.LineType = (LineType)this.LineType?.Clone();
×
248
                                clone.Arrowhead = (BlockRecord)this.Arrowhead?.Clone();
×
249

250
                                clone.Points = new List<XYZ>();
×
251
                                foreach (var point in this.Points)
×
252
                                {
×
253
                                        clone.Points.Add(point);
×
254
                                }
×
255

256
                                clone.StartEndPoints = new List<StartEndPointPair>();
×
257
                                foreach (var startEndPoint in this.StartEndPoints)
×
258
                                {
×
259
                                        clone.StartEndPoints.Add((StartEndPointPair)startEndPoint.Clone());
×
260
                                }
×
261

262
                                return clone;
×
263
                        }
×
264

265
                        public void AssignDocument(CadDocument doc)
266
                        {
2,205✔
267
                                this.Document = doc;
2,205✔
268

269
                                if (_lineType != null)
2,205!
270
                                {
×
271
                                        if (doc.LineTypes.TryGetValue(_lineType.Name, out LineType existing))
×
272
                                        {
×
273
                                                this._lineType = existing;
×
274
                                        }
×
275
                                        else
276
                                        {
×
277
                                                doc.LineTypes.Add(_lineType);
×
278
                                        }
×
279
                                }
×
280

281
                                doc.LineTypes.OnRemove += this.tableOnRemove;
2,205✔
282
                        }
2,205✔
283

284
                        public void UassignDocument()
285
                        {
210✔
286
                                this.Document.LineTypes.OnRemove -= this.tableOnRemove;
210✔
287

288
                                this.Document = null;
210✔
289

290
                                this._lineType = (LineType)this._lineType?.Clone();
210!
291
                        }
210✔
292

293
                        private void tableOnRemove(object sender, CollectionChangedEventArgs e)
294
                        {
×
295
                                if (e.Item.Equals(this._lineType))
×
296
                                {
×
297
                                        this._lineType = null;
×
298
                                }
×
299
                        }
×
300
                }
301
        }
302
}
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