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

DomCR / ACadSharp / 14689080655

27 Apr 2025 06:07AM UTC coverage: 75.049% (-0.2%) from 75.239%
14689080655

push

github

web-flow
Merge pull request #621 from nanoLogika/20250402_nka_multileader_clone_bugfix

20250402 nka multileader clone bugfix

5707 of 8369 branches covered (68.19%)

Branch coverage included in aggregate %.

190 of 326 new or added lines in 7 files covered. (58.28%)

3 existing lines in 3 files now uncovered.

22783 of 29593 relevant lines covered (76.99%)

82230.2 hits per line

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

74.05
/src/ACadSharp/Objects/MultiLeaderStyle.cs
1
using System;
2
using ACadSharp.Attributes;
3
using ACadSharp.Entities;
4
using ACadSharp.Tables;
5
using CSMath;
6

7
namespace ACadSharp.Objects
8
{
9
        /// <summary>
10
        /// Represents a <see cref="MultiLeaderStyle"/> object.
11
        /// </summary>
12
        /// <remarks>
13
        /// Object name <see cref="DxfFileToken.ObjectMLeaderStyle"/> <br/>
14
        /// Dxf class name <see cref="DxfSubclassMarker.MLeaderStyle"/>
15
        /// </remarks>
16
        [DxfName(DxfFileToken.ObjectMLeaderStyle)]
17
        [DxfSubClass(DxfSubclassMarker.MLeaderStyle)]
18
        public class MultiLeaderStyle : NonGraphicalObject
19
        {
20
                private LineType _leaderLineType = LineType.ByLayer;
2,357✔
21
                private TextStyle _textStyle = TextStyle.Default;
2,357✔
22
                private BlockRecord _arrowhead;
23
                private BlockRecord _blockContent;
24

25

26
                /// <summary>
27
                /// Default multiline style name
28
                /// </summary>
29
                public const string DefaultName = "Standard";
30

31
                /// <summary>
32
                /// Gets the default MLine style
33
                /// </summary>
34
                public static MultiLeaderStyle Default { get { return new MultiLeaderStyle(DefaultName); } }
6,690✔
35

36
                /// <inheritdoc/>
37
                public override ObjectType ObjectType => ObjectType.UNLISTED;
18✔
38

39
                /// <inheritdoc/>
40
                public override string ObjectName => DxfFileToken.ObjectMLeaderStyle;
43✔
41

42
                /// <inheritdoc/>
43
                public override string SubclassMarker => DxfSubclassMarker.MLeaderStyle;
×
44

45
                /// <summary>
46
                /// Gets or sets a value indicating the content type for the multileader.
47
                /// </summary>
48
                /// <remarks>
49
                /// <para>
50
                /// This value can be overridden by the <see cref="MultiLeader.ContentType"/> property when the
51
                /// <see cref="MultiLeaderPropertyOverrideFlags.ContentType"/> flag is set in the
52
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
53
                /// </para>
54
                /// </remarks>
55
                [DxfCodeValue(170)]
56
                public LeaderContentType ContentType { get; set; }
169✔
57

58
                //        TODO What is the meaning of this property? Is it relevant for drawing a multileader?
59
                /// <summary>
60
                /// DrawMLeaderOrder Type
61
                /// </summary>
62
                [DxfCodeValue(171)]
63
                public MultiLeaderDrawOrderType MultiLeaderDrawOrder { get; set; }
169✔
64

65
                //        TODO What is the meaning of this property? Is it relevant for drawing a multileader?
66
                /// <summary>
67
                /// DrawLeaderOrder Type
68
                /// </summary>
69
                [DxfCodeValue(172)]
70
                public LeaderDrawOrderType LeaderDrawOrder { get; set; }
169✔
71

72
                /// <summary>
73
                /// Gets or sets the max number of segments when a new leader is being created for a multileader.
74
                /// </summary>
75
                /// <remarks>
76
                /// This property supports creating and editing a multileader but has no meaning for
77
                /// the display of multileaders.
78
                /// </remarks>
79
                [DxfCodeValue(90)]
80
                public int MaxLeaderSegmentsPoints { get; set; }
170✔
81

82
                /// <summary>
83
                /// Gets or sets a snap angle value for the first leader segment when a leader line
84
                /// is being created for the mutileader.
85
                /// </summary>
86
                /// <remarks>
87
                /// This property supports creating and editing a multileader but has no meaning for
88
                /// the display of multileaders.
89
                /// </remarks>
90
                /// <value>
91
                /// An angle value in radians or zero if no angle contstraint is set.
92
                /// </value>
93
                [DxfCodeValue(40)]
94
                public double FirstSegmentAngleConstraint { get; set; }
170✔
95

96
                /// <summary>
97
                /// Gets or sets a snap angle value for the second leader segment when a leader line
98
                /// is being created for the mutileader.
99
                /// </summary>
100
                /// <remarks>
101
                /// This property supports creating and editing a multileader but has no meaning for
102
                /// the display of multileaders.
103
                /// </remarks>
104
                /// <value>
105
                /// An angle value in radians or zero if no angle contstraint is set.
106
                /// </value>
107
                [DxfCodeValue(41)]
108
                public double SecondSegmentAngleConstraint { get; set; }
170✔
109

110
                /// <summary>
111
                /// Gets or sets a value indicating whether leaders are to be displayed as polyline,
112
                /// a spline curve or invisible. This setting applies for all leader lines of the
113
                /// multileader.
114
                /// </summary>
115
                /// <remarks>
116
                /// <para>
117
                /// This value can be overridden by the <see cref="MultiLeader.PathType"/> property when the
118
                /// <see cref="MultiLeaderPropertyOverrideFlags.PathType"/> flag is set in the
119
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
120
                /// </para><para>
121
                /// The value for all leader lines can be overridden for each individual leader line by the
122
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.PathType"/> property when the
123
                /// <see cref="LeaderLinePropertOverrideFlags.PathType"/> flag is set in the 
124
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.OverrideFlags"/> property.
125
                /// </para>
126
                /// </remarks>
127
                [DxfCodeValue(173)]
128
                public MultiLeaderPathType PathType { get; set; }
169✔
129

130
                /// <summary>
131
                /// Gets or sets color to be applied all leader lines of the multileader.
132
                /// </summary>
133
                /// <remarks>
134
                /// <para>
135
                /// This value can be overridden by the <see cref="MultiLeader.LineColor"/> property when the
136
                /// <see cref="MultiLeaderPropertyOverrideFlags.LineColor"/> flag is set in the
137
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
138
                /// </para><para>
139
                /// The value for all leader lines can be overridden for each individual leader line by the
140
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.LineColor"/> property when the
141
                /// <see cref="LeaderLinePropertOverrideFlags.LineColor"/> flag is set in the 
142
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.OverrideFlags"/> property.
143
                /// </para>
144
                /// </remarks>
145
                [DxfCodeValue(91)]
146
                public Color LineColor { get; set; }
170✔
147

148
                /// <summary>
149
                /// Gets or sets a <see cref="LineType"/> object specifying line-type properties for the
150
                /// musltileader. This setting applies for all leader lines of the multileader.
151
                /// </summary>
152
                /// <remarks>
153
                /// <para>
154
                /// This setting can be overridden by the <see cref="MultiLeader.LeaderLineType"/> property
155
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.LeaderLineType"/> flag is set in the
156
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
157
                /// </para><para>
158
                /// The setting for all leader lines can be overridden for each individual leader line by the
159
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.LineType"/> property when the
160
                /// <see cref="LeaderLinePropertOverrideFlags.LineType"/> flag is set in the 
161
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.OverrideFlags"/> property.
162
                /// </para>
163
                /// </remarks>
164
                [DxfCodeValue(DxfReferenceType.Handle, 340)]
165
                public LineType LeaderLineType
166
                {
167
                        get { return this._leaderLineType; }
129✔
168
                        set
169
                        {
340✔
170
                                if (value == null)
340!
NEW
171
                                {
×
NEW
172
                                        throw new ArgumentNullException(nameof(value));
×
173
                                }
174

175
                                if (this.Document != null)
340✔
176
                                {
126✔
177
                                        this._leaderLineType = this.updateTable(value, this.Document.LineTypes);
126✔
178
                                }
126✔
179
                                else
180
                                {
214✔
181
                                        this._leaderLineType = value;
214✔
182
                                }
214✔
183
                        }
340✔
184
                }
185

186
                /// <summary>
187
                /// Gets or sets a value specifying the lineweight to be applied to all leader lines of the multileader.
188
                /// </summary>
189
                /// <remarks>
190
                /// <para>
191
                /// This value can be overridden by the <see cref="MultiLeader.LeaderLineWeight"/> property when the
192
                /// <see cref="MultiLeaderPropertyOverrideFlags.LeaderLineWeight"/> flag is set in the
193
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
194
                /// </para><para>
195
                /// The value for all leader lines can be overridden for each individual leader line by the
196
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.LineWeight"/> property when the
197
                /// <see cref="LeaderLinePropertOverrideFlags.LineWeight"/> flag is set in the 
198
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.OverrideFlags"/> property.
199
                /// </para>
200
                /// </remarks>
201
                [DxfCodeValue(92)]
202
                public LineweightType LeaderLineWeight { get; set; }
169✔
203

204
                //        TODO It seems that this value indicates that for a new leader that is being created
205
                //                 with this <see cref="MultiLeaderStyle" /> landing i.e. a dogleg is enabled.
206
                //                 But why can this value be overridden?
207
                //
208
                /// <summary>
209
                /// Gets or sets a value indicating whether landing is enabled.
210
                /// </summary>
211
                /// <remarks>
212
                /// <para>
213
                /// This value can be overridden by the <see cref="MultiLeader.EnableLanding"/> property
214
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.EnableLanding"/> flag is set in the
215
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
216
                /// </para>
217
                /// </remarks>
218
                [DxfCodeValue(290)]
219
                public bool EnableLanding { get; set; }
170✔
220

221
                /// <summary>
222
                /// Gets or sets the landing gap. This is the distance between the leader end point or, if present,
223
                /// the end of the dogleg and the text label or the content block.
224
                /// </summary>
225
                /// <remarks>
226
                /// <para>
227
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.LandingGap"/> property
228
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.LandingGap"/> flag is set in the
229
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
230
                /// </para>
231
                /// </remarks>
232
                [DxfCodeValue(42)]
233
                public double LandingGap { get; set; }
170✔
234

235
                /// <summary>
236
                /// Gets or sets a value indicating that leader lines are to be drawn with a dogleg.
237
                /// </summary>
238
                /// <remarks>
239
                /// <para>
240
                /// This value can be overridden by the <see cref="MultiLeader.EnableDogleg"/> property
241
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.EnableDogleg"/> flag is set in the
242
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
243
                /// </para><para>
244
                /// Note that this setting has no effect when the <see cref="TextAttachmentDirection"/>
245
                /// is <see cref="TextAttachmentDirectionType.Vertical"/>.
246
                /// </para>
247
                /// </remarks>
248
                [DxfCodeValue(291)]
249
                public bool EnableDogleg { get; set; }
170✔
250

251
                /// <summary>
252
                /// Gets or sets the landing distance, i.e. the length of the dogleg. 
253
                /// </summary>
254
                /// <remarks>
255
                /// <para>
256
                /// This value can be overridden by the <see cref="MultiLeader.LandingDistance"/> property
257
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.LandingDistance"/> flag is set in the
258
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
259
                /// </para>
260
                /// </remarks>
261
                [DxfCodeValue(43)]
262
                public double LandingDistance { get; set; }
170✔
263

264
                /// <summary>
265
                /// Gets or sets a text containing the description of this <see cref="MultiLeaderStyle"/>.
266
                /// </summary>
267
                [DxfCodeValue(3)]
268
                public string Description { get; set; }
169✔
269

270
                /// <summary>
271
                /// Gets or sets a <see cref="BlockRecord"/> representing the arrowhead
272
                /// to be displayed with every leader line.
273
                /// </summary>
274
                /// <remarks>
275
                /// <para>
276
                /// This value can be overridden by the <see cref="MultiLeader.Arrowhead"/> property
277
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.Arrowhead"/> flag is set in the
278
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
279
                /// </para><para>
280
                /// The value for all leader lines can be overridden for each individual leader line by the
281
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.Arrowhead"/> property when the
282
                /// <see cref="LeaderLinePropertOverrideFlags.Arrowhead"/> flag is set in the 
283
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.OverrideFlags"/> property.
284
                /// </para>
285
                /// </remarks>
286
                [DxfCodeValue(DxfReferenceType.Handle, 341)]
287
                public BlockRecord Arrowhead
288
                {
289
                        get { return this._arrowhead; }
156✔
290
                        set
291
                        {
214✔
292
                                this._arrowhead = this.updateTable(value, this.Document?.BlockRecords);
214!
293
                        }
214✔
294
                }
295

296
                /// <summary>
297
                /// Gests or sets the arrowhead size.
298
                /// </summary>
299
                /// <remarks>
300
                /// <para>
301
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.ArrowheadSize"/> property
302
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.ArrowheadSize"/> flag is set in the
303
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
304
                /// </para><para>
305
                /// The value for all leader lines can be overridden for each individual leader line by the
306
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.ArrowheadSize"/> property when the
307
                /// <see cref="LeaderLinePropertOverrideFlags.ArrowheadSize"/> flag is set in the 
308
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.OverrideFlags"/> property.
309
                /// </para>
310
                /// </remarks>
311
                [DxfCodeValue(44)]
312
                public double ArrowheadSize { get; set; }
170✔
313

314
                /// <summary>
315
                /// Gests or sets a default text that is to be set when a mutileader is being created
316
                /// with this <see cref="MultiLeaderStyle"/>.
317
                /// </summary>
318
                [DxfCodeValue(300)]
319
                public string DefaultTextContents { get; set; }
169✔
320

321
                /// <summary>
322
                /// Gets or sets the <see cref="TextStyle"/> to be used to display the text label of the
323
                /// multileader.
324
                /// </summary>
325
                /// <remarks>
326
                /// <para>
327
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.TextStyle"/> property
328
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextStyle"/> flag is set in the
329
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
330
                /// </para>
331
                /// </remarks>
332
                [DxfCodeValue(DxfReferenceType.Handle, 342)]
333
                public TextStyle TextStyle
334
                {
335
                        get { return this._textStyle; }
129✔
336
                        set
337
                        {
340✔
338
                                if (value == null)
340!
NEW
339
                                {
×
NEW
340
                                        throw new ArgumentNullException(nameof(value));
×
341
                                }
342

343
                                if (this.Document != null)
340✔
344
                                {
126✔
345
                                        this._textStyle = this.updateTable(value, this.Document.TextStyles);
126✔
346
                                }
126✔
347
                                else
348
                                {
214✔
349
                                        this._textStyle = value;
214✔
350
                                }
214✔
351
                        }
340✔
352
                }
353

354
                /// <summary>
355
                /// Gets or sets the Text Left Attachment Type.
356
                /// This value controls the position of the connection point of the leader
357
                /// attached to the left side of the text label.
358
                /// </summary>
359
                /// <remarks>
360
                /// <para>
361
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.TextLeftAttachment"/> property
362
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextLeftAttachment"/> flag is set in the
363
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
364
                /// </para><para>
365
                /// This property is only relevant if <see cref="TextAttachmentDirection"/> is
366
                /// <see cref="TextAttachmentDirectionType.Horizontal"/> and a leader attached
367
                /// to the left side of the text label exists.
368
                /// </para>
369
                /// </remarks>
370
                /// <value>
371
                /// A <see cref="TextAttachmentType"/> having the values 0-8 
372
                /// can be used ("horizontal" attachment types).
373
                /// </value>
374
                [DxfCodeValue(174)]
375
                public TextAttachmentType TextLeftAttachment { get; set; }
169✔
376

377
                //        TODO How to set this value?
378
                /// <summary>
379
                /// Gets or sets a value indicating the text angle.
380
                /// </summary>
381
                /// <remarks>
382
                /// <para>
383
                /// This value can be overridden by the <see cref="MultiLeader.TextAngle"/> property
384
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextAngle"/> flag is set in the
385
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
386
                /// </para>
387
                /// </remarks>
388
                [DxfCodeValue(175)]
389
                public TextAngleType TextAngle { get; set; }
169✔
390

391
                /// <summary>
392
                /// Gets or sets the text alignment, i.e. the alignment of text lines if the a multiline
393
                /// text label, relative to the <see cref="MultiLeaderAnnotContext.TextLocation"/>.
394
                /// </summary>
395
                /// <remarks>
396
                /// <para>
397
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.TextAlignment"/> property
398
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextAlignment"/> flag is set in the
399
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
400
                /// </para>
401
                /// </remarks>
402
                [DxfCodeValue(176)]
403
                public TextAlignmentType TextAlignment { get; set; }
169✔
404

405
                /// <summary>
406
                /// Gets or sets the Text Right Attachment Type.
407
                /// This value controls the position of the connection point of the leader
408
                /// attached to the right side of the text label.
409
                /// </summary>
410
                /// <remarks>
411
                /// <para>
412
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.TextRightAttachment"/> property
413
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextRightAttachment"/> flag is set in the
414
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
415
                /// </para><para>
416
                /// This property is only relevant if <see cref="TextAttachmentDirection"/> is
417
                /// <see cref="TextAttachmentDirectionType.Horizontal"/> and a leader attached
418
                /// to the right side of the text label exists.
419
                /// </para>
420
                /// </remarks>
421
                /// <value>
422
                /// A <see cref="TextAttachmentType"/> having the values 0-8 
423
                /// can be used ("horizontal" attachment types).
424
                /// </value>
425
                [DxfCodeValue(178)]
426
                public TextAttachmentType TextRightAttachment { get; set; }
169✔
427

428
                /// <summary>
429
                /// Gest or sets the color for the text label of the multileader.
430
                /// </summary>
431
                /// <remarks>
432
                /// <para>
433
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.TextColor"/> property
434
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextColor"/> flag is set in the
435
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
436
                /// </para>
437
                /// </remarks>
438
                [DxfCodeValue(93)]
439
                public Color TextColor { get; set; }
170✔
440

441
                /// <summary>
442
                /// Gest or sets the text height for the text label of the multileader.
443
                /// </summary>
444
                /// <remarks>
445
                /// <para>
446
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.TextHeight"/> property
447
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextHeight"/> flag is set in the
448
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
449
                /// </para>
450
                /// </remarks>
451
                [DxfCodeValue(45)]
452
                public double TextHeight { get; set; }
170✔
453

454
                /// <summary>
455
                /// Gets or sets a value indicating that the text label is to be drawn with a frame.
456
                /// </summary>
457
                /// <remarks>
458
                /// <para>
459
                /// This value can be overridden by the <see cref="MultiLeader.TextFrame"/> property
460
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextFrame"/> flag is set in the
461
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
462
                /// </para>
463
                /// </remarks>
464
                [DxfCodeValue(292)]
465
                public bool TextFrame { get; set; }
170✔
466

467
                //        TODO Is this property only relevant for new leaders?
468
                /// <summary>
469
                /// Text Align Always Left
470
                /// </summary>
471
                [DxfCodeValue(297)]
472
                public bool TextAlignAlwaysLeft { get; set; }
170✔
473

474
                //        TODO What is the meaning of this property?
475
                /// <summary>
476
                /// Align Space
477
                /// </summary>
478
                [DxfCodeValue(46)]
479
                public double AlignSpace { get; set; }
170✔
480

481
                /// <summary>
482
                /// Gets a <see cref="BlockRecord"/> containing elements
483
                /// to be drawn as content for the multileader.
484
                /// </summary>
485
                /// <remarks>
486
                /// <para>
487
                /// Thw standard content block can be overridden by the <see cref="MultiLeaderAnnotContext.BlockContent"/>
488
                /// property when the <see cref="MultiLeaderPropertyOverrideFlags.BlockContent"/> flag is set in the
489
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
490
                /// </para>
491
                /// </remarks>
492
                [DxfCodeValue(DxfReferenceType.Handle, 343)]
493
                public BlockRecord BlockContent
494
                {
495
                        get { return this._blockContent; }
156✔
496
                        set {
214✔
497
                                this._blockContent = this.updateTable(value, this.Document?.BlockRecords);
214!
498
                        }
214✔
499
                }
500

501
                /// <summary>
502
                /// Gets or sets the block-content color.
503
                /// </summary>
504
                /// <remarks>
505
                /// <para>
506
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.BlockContentColor"/> property
507
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.BlockContentColor"/> flag is set in the
508
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
509
                /// </para>
510
                /// </remarks>
511
                [DxfCodeValue(94)]
512
                public Color BlockContentColor { get; set; }
170✔
513

514
                /// <summary>
515
                /// Gets or sets the scale factor for block content.
516
                /// </summary>
517
                /// <remarks>
518
                /// <para>
519
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.BlockContentScale"/> property
520
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.BlockContentScale"/> flag is set in the
521
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
522
                /// </para>
523
                /// </remarks>
524
                [DxfCodeValue(47, 49, 140)]
525
                public XYZ BlockContentScale { get; set; }
220✔
526

527
                //        TODO: Cannot be overridden? Is this property only relevant in AutoCAD?
528
                /// <summary>
529
                /// Gets or sets a value indicating whether scaling of the block content is enabled.
530
                /// </summary>
531
                [DxfCodeValue(293)]
532
                public bool EnableBlockContentScale { get; set; }
170✔
533

534
                /// <summary>
535
                /// Gets or sets the block content rotation.
536
                /// </summary>
537
                /// <remarks>
538
                /// <para>
539
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.BlockContentRotation"/> property
540
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.BlockContentRotation"/> flag is set in the
541
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
542
                /// </para>
543
                /// </remarks>
544
                [DxfCodeValue(DxfReferenceType.IsAngle, 141)]
545
                public double BlockContentRotation { get; set; }
170✔
546

547
                //        TODO: Cannot be overridden? Is this property only relevant in AutoCAD?
548
                /// <summary>
549
                /// Gets or sets a value indicating whether rotation of the block content is enabled.
550
                /// </summary>
551
                [DxfCodeValue(294)]
552
                public bool EnableBlockContentRotation { get; set; }
170✔
553

554
                /// <summary>
555
                /// Gets or sets a value indicating whether the multileader connects to the content-block extents
556
                /// or to the content-block base point.
557
                /// </summary>
558
                /// <remarks>
559
                /// <para>
560
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.BlockContentConnection"/> property
561
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.BlockContentConnection"/> flag is set in the
562
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
563
                /// </para>
564
                /// </remarks>
565
                [DxfCodeValue(177)]
566
                public BlockContentConnectionType BlockContentConnection { get; set; }
169✔
567

568
                /// <summary>
569
                /// Gets or sets the scale factor for the <see cref="ArrowheadSize"/>, <see cref="LandingDistance"/>,
570
                /// <see cref="LandingGap"/>, <see cref="TextHeight"/>, and the elements of <see cref="BlockContentScale"/>.
571
                /// </summary>
572
                /// <remarks>
573
                /// <para>
574
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.ScaleFactor"/> property
575
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.ScaleFactor"/> flag is set in the
576
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
577
                /// </para>
578
                /// </remarks>
579
                [DxfCodeValue(142)]
580
                public double ScaleFactor { get; set; }
170✔
581

582
                /// <summary>
583
                /// Overwrite Property Value
584
                /// </summary>
585
                /// <remarks>
586
                /// Property changed, meaning not totally clear
587
                /// might be set to true if something changed after loading,
588
                /// or might be used to trigger updates in dependent MLeaders.
589
                /// sequence seems to be different in DXF
590
                /// </remarks>
591
                [DxfCodeValue(295)]
592
                public bool OverwritePropertyValue { get; set; }
170✔
593

594
                /// <summary>
595
                /// Is Annotative
596
                /// </summary>
597
                [DxfCodeValue(296)]
598
                public bool IsAnnotative { get; set; }
170✔
599

600
                //        TODO What is the meaning of this property?
601
                /// <summary>
602
                /// Break Gap Size
603
                /// </summary>
604
                [DxfCodeValue(143)]
605
                public double BreakGapSize { get; set; }
170✔
606

607
                //        TODO Check
608
                //                 whether this property is relevant for both text an block content
609
                //                 How it can be overridden by LeaderRoot.AttachmentDirection
610
                /// <summary>
611
                /// Gets or sets the Text attachment direction for text or block contents, rename?
612
                /// This property defines whether the leaders attach to the left/right of the content block/text,
613
                /// or attach to the top/bottom.
614
                /// </summary>
615
                /// <remarks>
616
                /// <para>
617
                /// This value can be overridden by the <see cref="MultiLeader.TextAttachmentDirection"/> property
618
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextAttachmentDirection"/> flag is set in the
619
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
620
                /// </para><para>
621
                /// The value for all leader lines can be overridden for each individual leader line by the
622
                /// <see cref="MultiLeaderAnnotContext.LeaderRoot.TextAttachmentDirection"/> property when the
623
                /// <see cref="LeaderLinePropertOverrideFlags.TextAttachmentDirection"/> flag is set in the 
624
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.OverrideFlags"/> property.
625
                /// </para>
626
                /// </remarks>
627
                /// <value>
628
                /// A <see cref="TextAttachmentDirectionType"/>.
629
                /// </value>
630
                [DxfCodeValue(271)]
631
                public TextAttachmentDirectionType TextAttachmentDirection { get; set; }
169✔
632

633
                /// <summary>
634
                /// Gets or sets the text bottom attachment type.
635
                /// This value controls the position of the connection point of the leader
636
                /// attached to the bottom of the text label.
637
                /// </summary>
638
                /// <remarks>
639
                /// <para>
640
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.TextBottomAttachment"/> property
641
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextBottomAttachment"/> flag is set in the
642
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
643
                /// </para><para>
644
                /// This property is only relevant if <see cref="TextAttachmentDirection"/> is
645
                /// <see cref="TextAttachmentDirectionType.Vertical"/> and a leader attached
646
                /// to the bottom of the text label exists.
647
                /// </para>
648
                /// </remarks>
649
                /// <value>
650
                /// A <see cref="TextAttachmentType"/> having the values
651
                ///         9 = Center,
652
                ///         10 = Underline and Center
653
                /// can be used ("vertical" attachment types).
654
                /// </value>
655
                [DxfCodeValue(272)]
656
                public TextAttachmentType TextBottomAttachment { get; set; }
169✔
657

658
                /// <summary>
659
                /// Gets or sets the text top attachment type.
660
                /// This value controls the position of the connection point of the leader
661
                /// attached to the top of the text label.
662
                /// </summary>
663
                /// <remarks>
664
                /// <para>
665
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.TextTopAttachment"/> property
666
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextTopAttachment"/> flag is set in the
667
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
668
                /// </para><para>
669
                /// This property is only relevant if <see cref="TextAttachmentDirection"/> is
670
                /// <see cref="TextAttachmentDirectionType.Vertical"/> and a leader attached
671
                /// to the top of the text label exists.
672
                /// </para>
673
                /// </remarks>
674
                /// <value>
675
                /// A <see cref="TextAttachmentType"/> having the values
676
                ///         9 = Center,
677
                ///         10 = Underline and Center
678
                /// can be used ("vertical" attachment types).
679
                /// </value>
680
                [DxfCodeValue(273)]
681
                public TextAttachmentType TextTopAttachment { get; set; }
169✔
682

683
                /// <summary>
684
                /// Undocumented in ODS and DXF-ref boolean, found in DXF
685
                /// </summary>
686
                [DxfCodeValue(298)]
687
                public bool UnknownFlag298 { get; set; }
145✔
688

689
                /// <summary>
690
                /// Initializes a new instance of the <see cref="MultiLeaderStyle"/> class.
691
                /// </summary>
692
                public MultiLeaderStyle() : this(string.Empty) { }
381✔
693

694
                /// <summary>
695
                /// Initializes a new instance of the <see cref="MultiLeaderStyle"/> class
696
                /// and sets the name of this style.
697
                /// </summary>
698
                public MultiLeaderStyle(string name) : base()
2,357✔
699
                {
2,357✔
700
                        this.Name = name;
2,357✔
701
                }
2,357✔
702

703
                public override CadObject Clone()
704
                {
214✔
705
                        MultiLeaderStyle clone = (MultiLeaderStyle)base.Clone();
214✔
706
                        clone.TextStyle = (TextStyle)this._textStyle.Clone();
214✔
707
                        clone.LeaderLineType = (LineType)this._leaderLineType.Clone();
214✔
708
                        
709
                        clone.Arrowhead = (BlockRecord)this._arrowhead?.Clone();
214!
710
                        clone.BlockContent = (BlockRecord)this._blockContent?.Clone();
214!
711

712
                        return clone;
214✔
713
                }
214✔
714

715
                internal override void AssignDocument(CadDocument doc)
716
                {
430✔
717
                        base.AssignDocument(doc);
430✔
718

719
                        this._textStyle = this.updateTable(this._textStyle, doc.TextStyles);
430✔
720
                        this._leaderLineType = this.updateTable(this._leaderLineType, doc.LineTypes);
430✔
721
                        this._arrowhead = this.updateTable(this._arrowhead, doc.BlockRecords);
430✔
722
                        this._blockContent = this.updateTable(this._blockContent, doc.BlockRecords);
430✔
723

724
                        doc.TextStyles.OnRemove += this.tableOnRemove;
430✔
725
                        doc.LineTypes.OnRemove += this.tableOnRemove;
430✔
726
                        doc.BlockRecords.OnRemove += this.tableOnRemove;
430✔
727
                }
430✔
728

729
                internal override void UnassignDocument()
NEW
730
                {
×
NEW
731
                        this.Document.TextStyles.OnRemove -= this.tableOnRemove;
×
NEW
732
                        this.Document.LineTypes.OnRemove -= this.tableOnRemove;
×
NEW
733
                        this.Document.BlockRecords.OnRemove -= this.tableOnRemove;
×
734

NEW
735
                        base.UnassignDocument();
×
736

NEW
737
                        this._textStyle = (TextStyle)this._textStyle.Clone();
×
NEW
738
                        this._leaderLineType = (LineType)this._leaderLineType.Clone();
×
NEW
739
                        this._arrowhead = (BlockRecord)this._arrowhead?.Clone();
×
NEW
740
                        this._blockContent = (BlockRecord)this._blockContent?.Clone();
×
NEW
741
                }
×
742

743
                protected virtual void tableOnRemove(object sender, CollectionChangedEventArgs e)
744
                {
9✔
745
                        if (e.Item.Equals(this._textStyle))
9!
NEW
746
                        {
×
NEW
747
                                this._textStyle = this.Document.TextStyles[Layer.DefaultName];
×
NEW
748
                        }
×
749

750
                        if (e.Item.Equals(this._leaderLineType))
9!
NEW
751
                        {
×
NEW
752
                                this._leaderLineType = this.Document.LineTypes[LineType.ByLayerName];
×
NEW
753
                        }
×
754

755
                        if (e.Item.Equals(this.Arrowhead))
9!
NEW
756
                        {
×
NEW
757
                                this._arrowhead = null;
×
NEW
758
                        }
×
759

760
                        if (e.Item.Equals(this.BlockContent))
9!
NEW
761
                        {
×
NEW
762
                                this._blockContent = null;
×
NEW
763
                        }
×
764
                }
9✔
765
        }
766
}
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