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

DomCR / ACadSharp / 14702671167

28 Apr 2025 07:33AM UTC coverage: 75.025% (-0.01%) from 75.038%
14702671167

Pull #641

github

web-flow
Merge d7793927e into 1ccb9aaaf
Pull Request #641: MultiLeader SPIKE

5704 of 8369 branches covered (68.16%)

Branch coverage included in aggregate %.

77 of 83 new or added lines in 4 files covered. (92.77%)

11 existing lines in 3 files now uncovered.

22792 of 29613 relevant lines covered (76.97%)

82205.56 hits per line

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

62.98
/src/ACadSharp/Entities/MultiLeader.cs
1
using System;
2
using System.Collections.Generic;
3
using ACadSharp.Attributes;
4
using ACadSharp.Objects;
5
using ACadSharp.Tables;
6

7
using CSMath;
8

9
namespace ACadSharp.Entities
10
{
11
        /// <summary>
12
        /// Represents a <see cref="MultiLeader"/> entity.
13
        /// </summary>
14
        /// <remarks>
15
        /// Object name <see cref="DxfFileToken.EntityMultiLeader"/> <br/>
16
        /// Dxf class name <see cref="DxfSubclassMarker.MultiLeader"/>
17
        /// </remarks>
18
        [DxfName(DxfFileToken.EntityMultiLeader)]
19
        [DxfSubClass(DxfSubclassMarker.MultiLeader)]
20
        public partial class MultiLeader : Entity
21
        {
22
                /// <summary>
23
                /// Gets or sets a <see cref="BlockRecord"/> representing the arrowhead
24
                /// (see <see cref="MultiLeaderStyle.Arrowhead"/>) to be displayed with every leader line.
25
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
26
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.Arrowhead"/> flag is set in the
27
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
28
                /// </summary>
29
                /// <remarks>
30
                /// The value for all leader lines can be overridden for each individual leader line by the
31
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.Arrowhead"/> property when the
32
                /// <see cref="LeaderLinePropertOverrideFlags.Arrowhead"/> flag is set in the
33
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.OverrideFlags"/> property.
34
                /// </remarks>
35
                [DxfCodeValue(DxfReferenceType.Handle, 342)]
36
                public BlockRecord Arrowhead
37
                {
38
                        get { return this._arrowhead; }
×
39
                        set
40
                        {
×
41
                                this._arrowhead = this.updateTable(value, this.Document?.BlockRecords);
×
42
                        }
×
43
                }
44

45
                /// <summary>
46
                /// Gets or sets the arrowhead size (see <see cref="MultiLeaderStyle.Arrowhead"/>)
47
                /// for every leader line
48
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.ArrowheadSize"/> flag is set in the
49
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
50
                /// </summary>
51
                /// <remarks>
52
                /// <para>
53
                /// The value for all leader lines can be overridden for each individual leader line by the
54
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.ArrowheadSize"/> property when the
55
                /// <see cref="LeaderLinePropertOverrideFlags.ArrowheadSize"/> flag is set in the
56
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.OverrideFlags"/> property.
57
                /// </para><para>
58
                /// This property is also exposed by the <see cref="MultiLeaderAnnotContext"/> class. Values
59
                /// should be equal, the value <see cref="MultiLeaderAnnotContext.ArrowheadSize"/> is
60
                /// assumed to be used.
61
                /// </para>
62
                /// </remarks>
63
                [DxfCodeValue(42)]
64
                public double ArrowheadSize { get; set; } = 0.18;
4,211✔
65

66
                ///<subject>
67
                /// Gets a list of <see cref="BlockAttribute"/> objects representing
68
                /// a reference to a "block attribute"? and some properties to adjust
69
                /// the attribute.
70
                /// </subject>
71
                public IList<BlockAttribute> BlockAttributes { get; private set; } = new List<BlockAttribute>();
4,002✔
72

73
                /// <summary>
74
                /// Gets a <see cref="BlockRecord"/> containing elements
75
                /// to be drawn as content for the multileader.
76
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
77
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.BlockContent"/> flag is set (see
78
                /// <see cref="PropertyOverrideFlags"/> property).
79
                /// </summary>
80
                /// <remarks>
81
                /// This property is also exposed by the <see cref="MultiLeaderAnnotContext"/> class. Values
82
                /// should be equal, the value <see cref="MultiLeaderAnnotContext.BlockContent"/> is
83
                /// assumed to be used.
84
                /// </remarks>
85
                [DxfCodeValue(DxfReferenceType.Handle, 344)]
86
                public BlockRecord BlockContent
87
                {
NEW
88
                        get { return this._blockContent; }
×
89
                        set
NEW
90
                        {
×
NEW
91
                                this._blockContent = this.updateTable(value, this.Document?.BlockRecords);
×
NEW
92
                        }
×
93
                }
94

95
                /// <summary>
96
                /// Gets or sets the block-content color.
97
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
98
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.BlockContentColor"/> flag is set (see
99
                /// <see cref="PropertyOverrideFlags"/> property).
100
                /// </summary>
101
                /// <remarks>
102
                /// This property is also exposed by the <see cref="MultiLeaderAnnotContext"/> class. Values
103
                /// should be equal, the value <see cref="MultiLeaderAnnotContext.BlockContentColor"/> is
104
                /// assumed to be used.
105
                /// </remarks>
106
                [DxfCodeValue(93)]
107
                public Color BlockContentColor { get; set; } = Color.ByBlock;
4,211✔
108

109
                /// <summary>
110
                /// Gets or sets a value indicating whether the multileader connects to the content-block extents
111
                /// or to the content-block base point
112
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.BlockContentConnection"/> flag is set in the
113
                /// <see cref="PropertyOverrideFlags"/> property.
114
                /// </summary>
115
                /// <remarks>
116
                /// This property is also exposed by the <see cref="MultiLeaderAnnotContext"/> class. Values
117
                /// should be equal, the value <see cref="MultiLeaderAnnotContext.BlockContentConnection"/> is
118
                /// assumed to be used.
119
                /// </remarks>
120
                [DxfCodeValue(176)]
121
                public BlockContentConnectionType BlockContentConnection { get; set; } = BlockContentConnectionType.BlockExtents;
4,206✔
122

123
                /// <summary>
124
                /// Gets or sets the rotation of the block content of the multileader.
125
                /// </summary>
126
                /// <remarks>
127
                /// This property is also exposed by the <see cref="MultiLeaderAnnotContext"/> class. Values
128
                /// should be equal, the value <see cref="MultiLeaderAnnotContext.BlockContentRotation"/> is
129
                /// assumed to be used.
130
                /// </remarks>
131
                [DxfCodeValue(DxfReferenceType.IsAngle, 43)]
132
                public double BlockContentRotation { get; set; } = 1.0;
4,211✔
133

134
                /// <summary>
135
                /// Gets or sets the scale factor for block content.
136
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
137
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.BlockContentScale"/> flag is set (see
138
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property).
139
                /// </summary>
140
                /// <remarks>
141
                /// This property is also exposed by the <see cref="MultiLeaderAnnotContext"/> class. Values
142
                /// should be equal, the value <see cref="MultiLeaderAnnotContext.BlockContentScale"/> is
143
                /// assumed to be used.
144
                /// </remarks>
145
                [DxfCodeValue(10, 20, 30)]
146
                public XYZ BlockContentScale { get; set; } = new XYZ(1);
4,211✔
147

148
                /// <summary>
149
                /// Gets or sets a value indicating whether the content of this <see cref="MultiLeader"/>
150
                /// is a text label, a content block, or a tolerance.
151
                /// </summary>
152
                [DxfCodeValue(172)]
153
                public LeaderContentType ContentType { get; set; }
2,205✔
154

155
                /// <summary>
156
                /// Contains the multileader content (block/text) and the leaders.
157
                /// </summary>
158
                public MultiLeaderAnnotContext ContextData { get; private set; } = new MultiLeaderAnnotContext();
15,351✔
159

160
                /// <summary>
161
                /// Enable Annotation Scale
162
                /// </summary>
163
                [DxfCodeValue(293)]
164
                public bool EnableAnnotationScale { get; set; }
2,210✔
165

166
                /// <summary>
167
                /// Gets or sets a value indicating that leader lines of this <see cref="MultiLeader"/>
168
                /// are to be drawn with a dogleg (see <see cref="MultiLeaderStyle.EnableDogleg"/>).
169
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
170
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.EnableDogleg"/> flag is set in the
171
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
172
                /// </summary>
173
                [DxfCodeValue(291)]
174
                public bool EnableDogleg { get; set; } = true;
4,211✔
175

176
                /// <summary>
177
                /// Gets or sets a value indicating whether landing is enabled.
178
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
179
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.EnableLanding"/> flag is set in the
180
                /// <see cref="PropertyOverrideFlags"/> property.
181
                /// </summary>
182
                [DxfCodeValue(290)]
183
                public bool EnableLanding { get; set; } = true;
4,211✔
184

185
                /// <summary>
186
                /// Leader extended to text
187
                /// </summary>
188
                public bool ExtendedToText { get; set; } = false;
2,576✔
189

190
                /// <summary>
191
                /// Gets or sets the landing distance, i.e. the length of the dogleg, for this <see cref="MultiLeader"/>.
192
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
193
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.LandingDistance"/> flag is set in the
194
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
195
                /// </summary>
196
                /// <remarks><para>
197
                /// There is only one field for the landing distance in the multileader property grid.
198
                /// The value entered arrives in this property and the <see cref="Objects.MultiLeaderAnnotContext.LeaderRoot.LandingDistance"/>
199
                /// property. If two leader roots exist both receive the same value. I seems
200
                /// <see cref="MultiLeaderPropertyOverrideFlags.LandingDistance"/> flag is never set.
201
                /// </para>
202
                /// </remarks>
203
                [DxfCodeValue(41)]
204
                public double LandingDistance { get; set; } = 0.36;
4,305✔
205

206
                //  TODO Additional Line Type? see Entity.LineType.
207
                /// <summary>
208
                /// Gets or sets <see cref="LineType"/> of the leader lines of this <see cref="MultiLeader"/>
209
                /// (see <see cref="MultiLeaderStyle.LeaderLineType"/>).
210
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
211
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.LeaderLineType"/> flag is set in the
212
                /// <see cref="PropertyOverrideFlags"/> property.
213
                /// </summary>
214
                /// <remarks>
215
                /// The setting for all leader lines can be overridden for each individual leader line by the
216
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.LineType"/> property when the
217
                /// <see cref="LeaderLinePropertOverrideFlags.LineType"/> flag is set in the
218
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.OverrideFlags"/> property.
219
                /// </remarks>
220
                [DxfCodeValue(DxfReferenceType.Handle, 341)]
221
                public LineType LeaderLineType
222
                {
223
                        get { return this._leaderLineType; }
×
224
                        set
225
                        {
1,995✔
226
                                if (value == null)
1,995!
227
                                {
×
228
                                        throw new ArgumentNullException(nameof(value));
×
229
                                }
230

231
                                if (this.Document != null)
1,995!
232
                                {
1,995✔
233
                                        this._leaderLineType = this.updateTable(value, this.Document.LineTypes);
1,995✔
234
                                }
1,995✔
235
                                else
236
                                {
×
237
                                        this._leaderLineType = value;
×
238
                                }
×
239
                        }
1,995✔
240
                }
241

242
                //  TODO Additional Line Weight? see Entity.LineWeight.
243
                /// <summary>
244
                /// Gets or sets a value specifying the line weight to be applied to all leader lines of this
245
                /// <see cref="MultiLeader"/> (see <see cref="MultiLeaderStyle.LeaderLineWeight"/>).
246
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
247
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.LeaderLineWeight"/> flag is set in the
248
                /// <see cref="PropertyOverrideFlags"/> property.
249
                /// </summary>
250
                /// <remarks>
251
                /// The value for all leader lines can be overridden for each individual leader line by the
252
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.LineWeight"/> property when the
253
                /// <see cref="LeaderLinePropertOverrideFlags.LineWeight"/> flag is set in the
254
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.OverrideFlags"/> property.
255
                /// </remarks>
256
                [DxfCodeValue(171)]
257
                public LineweightType LeaderLineWeight { get; set; } = LineweightType.ByBlock;
4,206✔
258

259
                /// <summary>
260
                /// Gets or sets color of the leader lines of this <see cref="MultiLeader"/>
261
                /// (see <see cref="MultiLeaderStyle.LineColor"/>).
262
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
263
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.LineColor"/> flag is set in the
264
                /// <see cref="PropertyOverrideFlags"/> property.
265
                /// </summary>
266
                /// <remarks>
267
                /// The value for all leader lines can be overridden for each individual leader line by the
268
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.LineColor"/> property when the
269
                /// <see cref="LeaderLinePropertOverrideFlags.LineColor"/> flag is set in the
270
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.OverrideFlags"/> property.
271
                /// </remarks>
272
                [DxfCodeValue(91)]
273
                public Color LineColor { get; set; } = Color.ByBlock;
4,211✔
274

275
                /// <inheritdoc/>
276
                public override string ObjectName => DxfFileToken.EntityMultiLeader;
211✔
277

278
                /// <inheritdoc/>
279
                public override ObjectType ObjectType => ObjectType.UNLISTED;
1✔
280

281
                /// <summary>
282
                /// Gets or sets a value indicating the path type of this <see cref="MultiLeader"/>
283
                /// (see <see cref="MultiLeaderStyle.PathType"/>).
284
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
285
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.PathType"/> flag is set in the
286
                /// <see cref="PropertyOverrideFlags"/> property.
287
                /// </summary>
288
                [DxfCodeValue(170)]
289
                public MultiLeaderPathType PathType { get; set; } = MultiLeaderPathType.StraightLineSegments;
4,206✔
290

291
                /// <summary>
292
                /// Gets or sets a value containing a list of flags indicating which multileader
293
                /// properties specified by the associated <see cref="MultiLeaderStyle"/>
294
                /// are to be overridden by properties specified by this <see cref="MultiLeader"/>
295
                /// or the attached <see cref="MultiLeaderAnnotContext"/>.
296
                /// </summary>
297
                [DxfCodeValue(90)]
298
                public MultiLeaderPropertyOverrideFlags PropertyOverrideFlags { get; set; }
2,205✔
299

300
                /// <summary>
301
                /// Gets or sets a scale factor (see <see cref="MultiLeaderStyle.ScaleFactor"/>).
302
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
303
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.ScaleFactor"/> flag is set (see
304
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property).
305
                /// The scale factor is applied by AutoCAD.
306
                /// </summary>
307
                /// <remarks>
308
                /// This property is also exposed by the <see cref="MultiLeaderAnnotContext"/> class. Values
309
                /// should be equal, the value <see cref="MultiLeaderAnnotContext.ScaleFactor"/> is
310
                /// assumed to be relevant.
311
                /// </remarks>
312
                [DxfCodeValue(45)]
313
                public double ScaleFactor { get; set; } = 1;
4,211✔
314

315
                /// <summary>
316
                /// Gets a <see cref="MultiLeaderStyle"/> providing reusable style information
317
                /// for this <see cref="MultiLeader"/>.
318
                /// </summary>
319
                [DxfCodeValue(DxfReferenceType.Handle, 340)]
320
                public MultiLeaderStyle Style
321
                {
322
                        get { return this._style; }
630✔
323
                        set
324
                        {
1,995✔
325
                                if (value == null)
1,995!
326
                                {
×
327
                                        throw new ArgumentNullException(nameof(value));
×
328
                                }
329

330
                                if (this.Document != null)
1,995!
331
                                {
1,995✔
332
                                        this._style = this.updateCollection(value, this.Document.MLeaderStyles);
1,995✔
333
                                }
1,995✔
334
                                else
335
                                {
×
336
                                        this._style = value;
×
337
                                }
×
338
                        }
1,995✔
339
                }
340

341
                /// <inheritdoc/>
342
                public override string SubclassMarker => DxfSubclassMarker.MultiLeader;
2✔
343

344
                /// <summary>
345
                /// Text Align in IPE (meaning unknown)
346
                /// </summary>
347
                [DxfCodeValue(178)]
348
                public short TextAligninIPE { get; set; }
2,210✔
349

350
                /// <summary>
351
                /// Gets or sets the text alignement type.
352
                /// </summary>
353
                /// <remarks><para>
354
                /// The Open Design Specification for DWG documents this property as <i>Unknown</i>,
355
                /// DXF reference as <i>Text Aligment Type</i>.
356
                /// Available DWG and DXF sample documents saved by AutoCAD return always 0=Left.
357
                /// </para><para>
358
                /// This property is also exposed by the <see cref="MultiLeaderAnnotContext"/> class. Values
359
                /// should be equal, the value <see cref="MultiLeaderAnnotContext.TextAlignment"/> is
360
                /// assumed to be used.
361
                /// </para>
362
                /// </remarks>
363
                [DxfCodeValue(175)]
364
                public TextAlignmentType TextAlignment { get; set; }
2,205✔
365

366
                /// <summary>
367
                /// Gets or sets a value indicating the text angle.
368
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
369
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextAngle"/> flag is set (see
370
                /// <see cref="PropertyOverrideFlags"/> property).
371
                /// </summary>
372
                [DxfCodeValue(174)]
373
                public TextAngleType TextAngle { get; set; } = TextAngleType.Horizontal;
4,206✔
374

375
                //        TODO According to the OpenDesign_Specification_for_.dwg_files
376
                //        a list of arror head AND a list of block attributes can occur.
377
                //        If both list are empty it ist expected that two BL-fields should
378
                //        occur yielding count=0 for both lists. But when we read two
379
                //        BL-fields we get out of sync. If we read one BL-field everything
380
                //        works fine.
381
                //        We do not understand what a list of arroheads can be used for,
382
                //        and we do not know how to create such a list.
383
                //        The documentation for arrowheads list in OpenDesign_Specification_for_.dwg_files
384
                //        and the DXF Reference are contradicting.
385
                //        Decision:
386
                //                Ommit the Arrowheads property,
387
                //                try to keep the block attributes.
388
                /// <summary>
389
                /// Gets or sets the Text attachment direction for text or block contents.
390
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
391
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextAttachmentDirection"/> flag is set in the
392
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
393
                /// </summary>
394
                /// <remarks>
395
                /// <para>
396
                /// This property defines whether the leaders attach to the left/right of the content block/text,
397
                /// or attach to the top/bottom.
398
                /// </para><para>
399
                /// The value for all leader lines can be overridden for each individual leader line by the
400
                /// <see cref="Objects.MultiLeaderAnnotContext.LeaderRoot.TextAttachmentDirection"/> property when the
401
                /// <see cref="MultiLeaderPropertyOverrideFlags.TextAttachmentDirection"/> flag is set in the
402
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.OverrideFlags"/> property.
403
                /// </para>
404
                /// </remarks>
405
                /// <value>
406
                /// A <see cref="TextAttachmentDirectionType"/>.
407
                /// </value>
408
                [DxfCodeValue(271)]
409
                public TextAttachmentDirectionType TextAttachmentDirection { get; set; } = TextAttachmentDirectionType.Horizontal;
3,160✔
410

411
                /// <summary>
412
                /// Gets or sets a value indicating the text attachment point.
413
                /// </summary>
414
                /// <remarks><para>
415
                ///        The Open Design Specification for DWG files documents this property as <i>Justification</i>,
416
                /// the DXF reference as <i>Text Attachments point</i>.
417
                /// </para><para>
418
                /// This property is also exposed by the <see cref="MultiLeader"/> class
419
                /// (<see cref="MultiLeader.TextAttachmentPoint"/>).
420
                /// The <see cref="MultiLeaderAnnotContext.TextAttachmentPoint"/> property always has the same value
421
                /// and seems to have the respective value as <see cref="MultiLeaderAnnotContext.TextAlignment"/>.
422
                /// The <see cref="MultiLeaderAnnotContext.TextAttachmentPoint"/> property is to be used.
423
                /// </para>
424
                /// </remarks>
425
                [DxfCodeValue(179)]
426
                public TextAttachmentPointType TextAttachmentPoint { get; set; } = TextAttachmentPointType.Left;
4,300✔
427

428
                /// <summary>
429
                /// Gets or sets the text bottom attachment type (see <see cref="MultiLeaderStyle.TextBottomAttachment"/>).
430
                /// This property override the value from <see cref="MultiLeaderStyle"/>
431
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextBottomAttachment"/> flag is set (see
432
                /// <see cref="PropertyOverrideFlags"/> property).
433
                /// </summary>
434
                /// <remarks>
435
                /// This property is also exposed by the <see cref="MultiLeaderAnnotContext"/> class. Values
436
                /// should be equal, the value <see cref="MultiLeaderAnnotContext.TextBottomAttachment"/> is
437
                /// assumed to be used.
438
                /// </remarks>
439
                /// <value>
440
                /// A <see cref="TextAttachmentType"/> having the values
441
                ///         9 = Center,
442
                ///         10 = Underline and Center
443
                /// can be used ("vertical" attachment types).
444
                /// </value>
445
                [DxfCodeValue(272)]
446
                [Obsolete("Use ContextData.TextBottomAttachment instead.")]
447
                public TextAttachmentType TextBottomAttachment
448
                {
449
                        get
450
                        {
210✔
451
                                return this.ContextData.TextBottomAttachment;
210✔
452
                        }
210✔
453
                        set
454
                        {
855✔
455
                                this.ContextData.TextBottomAttachment = value;
855✔
456
                        }
855✔
457
                }
458

459
                /// <summary>
460
                /// Gets or sets the color for the display of the text label.
461
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
462
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextColor"/> flag is set (see
463
                /// <see cref="PropertyOverrideFlags"/> property).
464
                /// </summary>
465
                /// <remarks>
466
                /// This property is also exposed by the <see cref="MultiLeaderAnnotContext"/> class. Values
467
                /// should be equal, the value <see cref="MultiLeaderAnnotContext.TextColor"/> is
468
                /// assumed to be used.
469
                /// </remarks>
470
                [DxfCodeValue(92)]
471
                public Color TextColor { get; set; }
2,210✔
472

473
                //  public IList<ArrowheadAssociation> Arrowheads { get; } = new List<ArrowheadAssociation>();
474
                /// <summary>
475
                /// Text Direction Negative
476
                /// </summary>
477
                [DxfCodeValue(294)]
478
                public bool TextDirectionNegative { get; set; }
2,210✔
479

480
                /// <summary>
481
                /// Gets or sets a value indicating that the text label is to be drawn with a frame.
482
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
483
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextFrame"/> flag is set (see
484
                /// <see cref="PropertyOverrideFlags"/> property).
485
                /// </summary>
486
                [DxfCodeValue(292)]
487
                public bool TextFrame { get; set; }
2,304✔
488

489
                /// <summary>
490
                /// Gets or sets the text left attachment type (see <see cref="MultiLeaderStyle.TextLeftAttachment"/>).
491
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
492
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextLeftAttachment"/> flag is set (see
493
                /// <see cref="PropertyOverrideFlags"/> property).
494
                /// </summary>
495
                /// <remarks>
496
                /// This property is also exposed by the <see cref="MultiLeaderAnnotContext"/> class. Values
497
                /// should be equal, the value <see cref="MultiLeaderAnnotContext.TextLeftAttachment"/> is
498
                /// assumed to be used.
499
                /// </remarks>
500
                /// <value>
501
                /// A <see cref="TextAttachmentType"/> having the values 0-8 can be used
502
                /// ("horizontal" attachment types).
503
                /// </value>
504
                [DxfCodeValue(173)]
505
                [Obsolete("Use ContextData.TextLeftAttachment instead.")]
506
                public TextAttachmentType TextLeftAttachment
507
                {
508
                        get
509
                        {
304✔
510
                                return this.ContextData.TextLeftAttachment;
304✔
511
                        }
304✔
512
                        set
513
                        {
1,995✔
514
                                this.ContextData.TextLeftAttachment = value;
1,995✔
515
                        }
1,995✔
516
                }
517

518
                /// <summary>
519
                /// Gets or sets the text right attachment type (see <see cref="MultiLeaderStyle.TextRightAttachment"/>).
520
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
521
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextRightAttachment"/> flag is set (see
522
                /// <see cref="PropertyOverrideFlags"/> property).
523
                /// </summary>
524
                /// <remarks>
525
                /// This property is also exposed by the <see cref="MultiLeaderAnnotContext"/> class. Values
526
                /// should be equal, the value <see cref="MultiLeaderAnnotContext.TextRightAttachment"/> is
527
                /// assumed to be used.
528
                /// </remarks>
529
                /// <value>
530
                /// A <see cref="TextAttachmentType"/> having the values 0-8 can be used
531
                /// ("horizontal" attachment types).
532
                /// </value>
533
                [DxfCodeValue(95)]
534
                [Obsolete("Use ContextData.TextRightAttachment instead.")]
535
                public TextAttachmentType TextRightAttachment
536
                {
537
                        get
538
                        {
210✔
539
                                return this.ContextData.TextRightAttachment;
210✔
540
                        }
210✔
541
                        set
542
                        {
1,995✔
543
                                this.ContextData.TextRightAttachment = value;
1,995✔
544
                        }
1,995✔
545
                }
546

547
                /// <summary>
548
                /// Gets or sets the <see cref="TextStyle"/> to be used to display the text label of this
549
                /// <see cref="MultiLeader"/>.
550
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
551
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextStyle"/> flag is set in the
552
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
553
                /// </summary>
554
                /// <remarks>
555
                /// This property is also exposed by the <see cref="MultiLeaderAnnotContext"/> class
556
                /// (<see cref="MultiLeaderAnnotContext.TextStyle"/>).
557
                /// Values should be equal, the <see cref="MultiLeaderAnnotContext.TextStyle"/>
558
                /// is assumed to be used.
559
                /// </remarks>
560
                [DxfCodeValue(DxfReferenceType.Handle, 343)]
561
                public TextStyle TextStyle
562
                {
563
                        get { return this._textStyle; }
630✔
564
                        set
565
                        {
1,995✔
566
                                if (value == null)
1,995!
567
                                {
×
568
                                        throw new ArgumentNullException(nameof(value));
×
569
                                }
570

571
                                if (this.Document != null)
1,995!
572
                                {
1,995✔
573
                                        this._textStyle = this.updateTable(value, this.Document.TextStyles);
1,995✔
574
                                }
1,995✔
575
                                else
576
                                {
×
577
                                        this._textStyle = value;
×
578
                                }
×
579
                        }
1,995✔
580
                }
581

582
                /// <summary>
583
                /// Gets or sets the text top attachment type (see <see cref="MultiLeaderStyle.TextTopAttachment"/>).
584
                /// This property override the value from <see cref="MultiLeaderStyle"/>
585
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextTopAttachment"/> flag is set (see
586
                /// <see cref="PropertyOverrideFlags"/> property).
587
                /// </summary>
588
                /// <remarks>
589
                /// This property is also exposed by the <see cref="MultiLeaderAnnotContext"/> class. Values
590
                /// should be equal, the value <see cref="MultiLeaderAnnotContext.TextTopAttachment"/> is
591
                /// assumed to be used.
592
                /// </remarks>
593
                /// <value>
594
                /// A <see cref="TextAttachmentType"/> having the values
595
                ///         9 = Center,
596
                ///         10 = Underline and Center
597
                /// can be used ("vertical" attachment types).
598
                /// </value>
599
                [DxfCodeValue(273)]
600
                [Obsolete("Use ContextData.TextTopAttachment instead.")]
601
                public TextAttachmentType TextTopAttachment
602
                {
603
                        get
604
                        {
210✔
605
                                return this.ContextData.TextTopAttachment;
210✔
606
                        }
210✔
607
                        set
608
                        {
855✔
609
                                this.ContextData.TextTopAttachment = value;
855✔
610
                        }
855✔
611
                }
612

613
                private BlockRecord _arrowhead;
614
                private BlockRecord _blockContent;
615
                private LineType _leaderLineType = LineType.ByLayer;
2,001✔
616
                private MultiLeaderStyle _style = MultiLeaderStyle.Default;
2,001✔
617
                private TextStyle _textStyle = TextStyle.Default;
2,001✔
618

619
                /// <inheritdoc/>
620
                public override void ApplyTransform(Transform transform)
621
                {
×
622
                }
×
623

624
                /// <inheritdoc/>
625
                public override CadObject Clone()
626
                {
3✔
627
                        MultiLeader clone = (MultiLeader)base.Clone();
3✔
628

629
                        clone.ContextData = (MultiLeaderAnnotContext)this.ContextData.Clone();
3✔
630

631
                        clone.BlockAttributes = new List<BlockAttribute>();
3✔
632
                        foreach (var att in this.BlockAttributes)
9!
633
                        {
×
634
                                clone.BlockAttributes.Add((BlockAttribute)att.Clone());
×
635
                        }
×
636

637
                        clone._style = (MultiLeaderStyle)this._style.Clone();
3✔
638
                        clone._textStyle = (TextStyle)this._textStyle.Clone();
3✔
639
                        clone._leaderLineType = (LineType)this._leaderLineType.Clone();
3✔
640
                        clone._arrowhead = (BlockRecord)this._arrowhead?.Clone();
3!
641
                        clone._blockContent = (BlockRecord)this._blockContent?.Clone();
3!
642

643
                        return clone;
3✔
644
                }
3✔
645

646
                /// <inheritdoc/>
647
                public override BoundingBox GetBoundingBox()
648
                {
1✔
649
                        return BoundingBox.Null;
1✔
650
                }
1✔
651

652
                internal override void AssignDocument(CadDocument doc)
653
                {
2,206✔
654
                        base.AssignDocument(doc);
2,206✔
655

656
                        this._style = this.updateCollection<MultiLeaderStyle>(this._style, doc.MLeaderStyles);
2,206✔
657
                        this._textStyle = this.updateTable(this._textStyle, doc.TextStyles);
2,206✔
658
                        this._leaderLineType = this.updateTable(this._leaderLineType, doc.LineTypes);
2,206✔
659
                        this._arrowhead = this.updateTable(this._arrowhead, doc.BlockRecords);
2,206✔
660
                        this._blockContent = this.updateTable(this._blockContent, doc.BlockRecords);
2,206✔
661

662
                        this.ContextData.AssignDocument(doc);
2,206✔
663

664
                        doc.LineTypes.OnRemove += this.tableOnRemove;
2,206✔
665
                        doc.TextStyles.OnRemove += this.tableOnRemove;
2,206✔
666
                        doc.MLeaderStyles.OnRemove += this.tableOnRemove;
2,206✔
667
                        doc.BlockRecords.OnRemove += this.tableOnRemove;
2,206✔
668
                }
2,206✔
669

670
                internal override void UnassignDocument()
671
                {
210✔
672
                        this.Document.LineTypes.OnRemove -= this.tableOnRemove;
210✔
673
                        this.Document.TextStyles.OnRemove -= this.tableOnRemove;
210✔
674
                        this.Document.MLeaderStyles.OnRemove -= this.tableOnRemove;
210✔
675
                        this.Document.BlockRecords.OnRemove -= this.tableOnRemove;
210✔
676

677
                        this.ContextData.UnassignDocument();
210✔
678

679
                        base.UnassignDocument();
210✔
680

681
                        this._leaderLineType = (LineType)this._leaderLineType.Clone();
210✔
682
                        this._textStyle = (TextStyle)this._textStyle.Clone();
210✔
683
                        this._style = (MultiLeaderStyle)this._style.Clone();
210✔
684
                        this._arrowhead = (BlockRecord)this._arrowhead?.Clone();
210!
685
                        this._blockContent = (BlockRecord)this._blockContent?.Clone();
210!
686
                }
210✔
687

688
                protected override void tableOnRemove(object sender, CollectionChangedEventArgs e)
NEW
689
                {
×
UNCOV
690
                        base.tableOnRemove(sender, e);
×
691

692
                        if (e.Item.Equals(this._style))
×
693
                        {
×
694
                                this._style = this.Document.MLeaderStyles[MultiLeaderStyle.DefaultName];
×
695
                        }
×
696
                        if (e.Item.Equals(this._leaderLineType))
×
697
                        {
×
698
                                this._leaderLineType = this.Document.LineTypes[LineType.ByLayerName];
×
699
                        }
×
700
                        if (e.Item.Equals(this._textStyle))
×
701
                        {
×
702
                                this._textStyle = this.Document.TextStyles[TextStyle.DefaultName];
×
703
                        }
×
704
                        if (e.Item == this._arrowhead)
×
705
                        {
×
706
                                this._arrowhead = null;
×
707
                        }
×
708
                        if (e.Item == this._blockContent)
×
709
                        {
×
710
                                this._blockContent = null;
×
711
                        }
×
712
                }
×
713
        }
714
}
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