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

DomCR / ACadSharp / 18679832337

21 Oct 2025 09:46AM UTC coverage: 77.883% (-0.2%) from 78.126%
18679832337

push

github

web-flow
Merge pull request #832 from DomCR/multileader-dxf

multileader dxf

6920 of 9695 branches covered (71.38%)

Branch coverage included in aggregate %.

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

77 existing lines in 8 files now uncovered.

26664 of 33426 relevant lines covered (79.77%)

110330.18 hits per line

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

75.57
/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
                /// <summary>
21
                /// Gets the default MultiLeaderStyle
22
                /// </summary>
23
                public static MultiLeaderStyle Default { get { return new MultiLeaderStyle(DefaultName); } }
19,275✔
24

25
                //        TODO What is the meaning of this property?
26
                /// <summary>
27
                /// Align Space
28
                /// </summary>
29
                [DxfCodeValue(46)]
30
                public double AlignSpace { get; set; } = 0.0;
8,525✔
31

32
                /// <summary>
33
                /// Gets or sets a <see cref="BlockRecord"/> representing the arrowhead
34
                /// to be displayed with every leader line.
35
                /// </summary>
36
                /// <remarks>
37
                /// <para>
38
                /// This value can be overridden by the <see cref="MultiLeader.Arrowhead"/> property
39
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.Arrowhead"/> flag is set in the
40
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
41
                /// </para><para>
42
                /// The value for all leader lines can be overridden for each individual leader line by the
43
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.Arrowhead"/> property when the
44
                /// <see cref="LeaderLinePropertOverrideFlags.Arrowhead"/> flag is set in the
45
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.OverrideFlags"/> property.
46
                /// </para>
47
                /// </remarks>
48
                [DxfCodeValue(DxfReferenceType.Handle, 341)]
49
                public BlockRecord Arrowhead
50
                {
51
                        get { return this._arrowhead; }
1,782✔
52
                        set
53
                        {
394✔
54
                                this._arrowhead = CadObject.updateCollection(value, this.Document?.BlockRecords);
394!
55
                        }
394✔
56
                }
57

58
                /// <summary>
59
                /// Gests or sets the arrowhead size.
60
                /// </summary>
61
                /// <remarks>
62
                /// <para>
63
                /// This value can be overridden by the <see cref="MultiLeaderObjectContextData.ArrowheadSize"/> property
64
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.ArrowheadSize"/> flag is set in the
65
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
66
                /// </para><para>
67
                /// The value for all leader lines can be overridden for each individual leader line by the
68
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.ArrowheadSize"/> property when the
69
                /// <see cref="LeaderLinePropertOverrideFlags.ArrowheadSize"/> flag is set in the
70
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.OverrideFlags"/> property.
71
                /// </para>
72
                /// </remarks>
73
                [DxfCodeValue(44)]
74
                public double ArrowheadSize { get; set; } = 0.18;
8,525✔
75

76
                /// <summary>
77
                /// Gets a <see cref="BlockRecord"/> containing elements
78
                /// to be drawn as content for the multileader.
79
                /// </summary>
80
                /// <remarks>
81
                /// <para>
82
                /// Thw standard content block can be overridden by the <see cref="MultiLeaderObjectContextData.BlockContent"/>
83
                /// property when the <see cref="MultiLeaderPropertyOverrideFlags.BlockContent"/> flag is set in the
84
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
85
                /// </para>
86
                /// </remarks>
87
                [DxfCodeValue(DxfReferenceType.Handle, 343)]
88
                public BlockRecord BlockContent
89
                {
90
                        get { return this._blockContent; }
1,782✔
91
                        set
92
                        {
394✔
93
                                this._blockContent = CadObject.updateCollection(value, this.Document?.BlockRecords);
394!
94
                        }
394✔
95
                }
96

97
                /// <summary>
98
                /// Gets or sets the block-content color.
99
                /// </summary>
100
                /// <remarks>
101
                /// <para>
102
                /// This value can be overridden by the <see cref="MultiLeaderObjectContextData.BlockContentColor"/> property
103
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.BlockContentColor"/> flag is set in the
104
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
105
                /// </para>
106
                /// </remarks>
107
                [DxfCodeValue(94)]
108
                public Color BlockContentColor { get; set; } = Color.ByBlock;
8,053✔
109

110
                /// <summary>
111
                /// Gets or sets a value indicating whether the multileader connects to the content-block extents
112
                /// or to the content-block base point.
113
                /// </summary>
114
                /// <remarks>
115
                /// <para>
116
                /// This value can be overridden by the <see cref="MultiLeaderObjectContextData.BlockContentConnection"/> property
117
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.BlockContentConnection"/> flag is set in the
118
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
119
                /// </para>
120
                /// </remarks>
121
                [DxfCodeValue(177)]
122
                public BlockContentConnectionType BlockContentConnection { get; set; }
1,341✔
123

124
                /// <summary>
125
                /// Gets or sets the block content rotation.
126
                /// </summary>
127
                /// <remarks>
128
                /// <para>
129
                /// This value can be overridden by the <see cref="MultiLeaderObjectContextData.BlockContentRotation"/> property
130
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.BlockContentRotation"/> flag is set in the
131
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
132
                /// </para>
133
                /// </remarks>
134
                [DxfCodeValue(DxfReferenceType.IsAngle, 141)]
135
                public double BlockContentRotation { get; set; } = 0.0;
8,525✔
136

137
                /// <summary>
138
                /// Gets or sets the scale factor for block content.
139
                /// </summary>
140
                /// <remarks>
141
                /// <para>
142
                /// This value can be overridden by the <see cref="MultiLeaderObjectContextData.BlockContentScale"/> property
143
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.BlockContentScale"/> flag is set in the
144
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
145
                /// </para>
146
                /// </remarks>
147
                public XYZ BlockContentScale
148
                {
149
                        get
150
                        {
1,215✔
151
                                return this._blockContentScale;
1,215✔
152
                        }
1,215✔
153
                        set
154
                        {
285✔
155
                                this._blockContentScale = value;
285✔
156
                        }
285✔
157
                }
158

159
                /// <summary>
160
                /// Gets or sets the scale factor along the X-axis for the block content.
161
                /// </summary>
162
                [DxfCodeValue(47)]
163
                public double BlockContentScaleX
164
                {
NEW
165
                        get { return this._blockContentScale.X; }
×
166
                        set
167
                        {
473✔
168
                                this._blockContentScale.X = value;
473✔
169
                        }
473✔
170
                }
171

172
                /// <summary>
173
                /// Gets or sets the scale factor applied to the Y-axis of the block content.
174
                /// </summary>
175
                [DxfCodeValue(49)]
176
                public double BlockContentScaleY
177
                {
NEW
178
                        get { return this._blockContentScale.Y; }
×
179
                        set
180
                        {
473✔
181
                                this._blockContentScale.Y = value;
473✔
182
                        }
473✔
183
                }
184

185
                /// <summary>
186
                /// Gets or sets the scale factor along the Z-axis for the block content.
187
                /// </summary>
188
                [DxfCodeValue(140)]
189
                public double BlockContentScaleZ
190
                {
NEW
191
                        get { return this._blockContentScale.Z; }
×
192
                        set
193
                        {
473✔
194
                                this._blockContentScale.Z = value;
473✔
195
                        }
473✔
196
                }
197

198
                //        TODO What is the meaning of this property?
199
                /// <summary>
200
                /// Break Gap Size
201
                /// </summary>
202
                [DxfCodeValue(143)]
203
                public double BreakGapSize { get; set; } = 0.125;
8,525✔
204

205
                /// <summary>
206
                /// Gets or sets a value indicating the content type for the multileader.
207
                /// </summary>
208
                /// <remarks>
209
                /// <para>
210
                /// This value can be overridden by the <see cref="MultiLeader.ContentType"/> property when the
211
                /// <see cref="MultiLeaderPropertyOverrideFlags.ContentType"/> flag is set in the
212
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
213
                /// </para>
214
                /// </remarks>
215
                [DxfCodeValue(170)]
216
                public LeaderContentType ContentType { get; set; } = LeaderContentType.MText;
8,524✔
217

218
                /// <summary>
219
                /// Gests or sets a default text that is to be set when a mutileader is being created
220
                /// with this <see cref="MultiLeaderStyle"/>.
221
                /// </summary>
222
                [DxfCodeValue(300)]
223
                public string DefaultTextContents { get; set; } = string.Empty;
8,524✔
224

225
                /// <summary>
226
                /// Gets or sets a text containing the description of this <see cref="MultiLeaderStyle"/>.
227
                /// </summary>
228
                [DxfCodeValue(3)]
229
                public string Description { get; set; } = string.Empty;
8,524✔
230

231
                //        TODO: Cannot be overridden? Is this property only relevant in AutoCAD?
232
                /// <summary>
233
                /// Gets or sets a value indicating whether rotation of the block content is enabled.
234
                /// </summary>
235
                [DxfCodeValue(294)]
236
                public bool EnableBlockContentRotation { get; set; }
1,342✔
237

238
                //        TODO: Cannot be overridden? Is this property only relevant in AutoCAD?
239
                /// <summary>
240
                /// Gets or sets a value indicating whether scaling of the block content is enabled.
241
                /// </summary>
242
                [DxfCodeValue(293)]
243
                public bool EnableBlockContentScale { get; set; }
1,342✔
244

245
                /// <summary>
246
                /// Gets or sets a value indicating that leader lines are to be drawn with a dogleg.
247
                /// </summary>
248
                /// <remarks>
249
                /// <para>
250
                /// This value can be overridden by the <see cref="MultiLeader.EnableDogleg"/> property
251
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.EnableDogleg"/> flag is set in the
252
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
253
                /// </para><para>
254
                /// Note that this setting has no effect when the <see cref="TextAttachmentDirection"/>
255
                /// is <see cref="TextAttachmentDirectionType.Vertical"/>.
256
                /// </para>
257
                /// </remarks>
258
                [DxfCodeValue(291)]
259
                public bool EnableDogleg { get; set; } = true;
8,525✔
260

261
                //        TODO It seems that this value indicates that for a new leader that is being created
262
                //                 with this <see cref="MultiLeaderStyle" /> landing i.e. a dogleg is enabled.
263
                //                 But why can this value be overridden?
264
                //
265
                /// <summary>
266
                /// Gets or sets a value indicating whether landing is enabled.
267
                /// </summary>
268
                /// <remarks>
269
                /// <para>
270
                /// This value can be overridden by the <see cref="MultiLeader.EnableLanding"/> property
271
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.EnableLanding"/> flag is set in the
272
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
273
                /// </para>
274
                /// </remarks>
275
                [DxfCodeValue(290)]
276
                public bool EnableLanding { get; set; } = true;
8,525✔
277

278
                /// <summary>
279
                /// Gets or sets a snap angle value for the first leader segment when a leader line
280
                /// is being created for the mutileader.
281
                /// </summary>
282
                /// <remarks>
283
                /// This property supports creating and editing a multileader but has no meaning for
284
                /// the display of multileaders.
285
                /// </remarks>
286
                /// <value>
287
                /// An angle value in radians or zero if no angle contstraint is set.
288
                /// </value>
289
                [DxfCodeValue(40)]
290
                public double FirstSegmentAngleConstraint { get; set; }
1,342✔
291

292
                /// <summary>
293
                /// Is Annotative
294
                /// </summary>
295
                [DxfCodeValue(296)]
296
                public bool IsAnnotative { get; set; }
1,342✔
297

298
                /// <summary>
299
                /// Gets or sets the landing distance, i.e. the length of the dogleg.
300
                /// </summary>
301
                /// <remarks>
302
                /// <para>
303
                /// This value can be overridden by the <see cref="MultiLeader.LandingDistance"/> property
304
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.LandingDistance"/> flag is set in the
305
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
306
                /// </para>
307
                /// </remarks>
308
                [DxfCodeValue(43)]
309
                public double LandingDistance { get; set; } = 0.36;
8,525✔
310

311
                /// <summary>
312
                /// Gets or sets the landing gap. This is the distance between the leader end point or, if present,
313
                /// the end of the dogleg and the text label or the content block.
314
                /// </summary>
315
                /// <remarks>
316
                /// <para>
317
                /// This value can be overridden by the <see cref="MultiLeaderObjectContextData.LandingGap"/> property
318
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.LandingGap"/> flag is set in the
319
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
320
                /// </para>
321
                /// </remarks>
322
                [DxfCodeValue(42)]
323
                public double LandingGap { get; set; } = 0.09;
8,525✔
324

325
                //        TODO What is the meaning of this property? Is it relevant for drawing a multileader?
326
                /// <summary>
327
                /// DrawLeaderOrder Type
328
                /// </summary>
329
                [DxfCodeValue(172)]
330
                public LeaderDrawOrderType LeaderDrawOrder { get; set; }
1,341✔
331

332
                /// <summary>
333
                /// Gets or sets a <see cref="LineType"/> object specifying line-type properties for the
334
                /// musltileader. This setting applies for all leader lines of the multileader.
335
                /// </summary>
336
                /// <remarks>
337
                /// <para>
338
                /// This setting can be overridden by the <see cref="MultiLeader.LeaderLineType"/> property
339
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.LeaderLineType"/> flag is set in the
340
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
341
                /// </para><para>
342
                /// The setting for all leader lines can be overridden for each individual leader line by the
343
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.LineType"/> property when the
344
                /// <see cref="LeaderLinePropertOverrideFlags.LineType"/> flag is set in the
345
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.OverrideFlags"/> property.
346
                /// </para>
347
                /// </remarks>
348
                [DxfCodeValue(DxfReferenceType.Handle, 340)]
349
                public LineType LeaderLineType
350
                {
351
                        get { return this._leaderLineType; }
1,755✔
352
                        set
353
                        {
1,150✔
354
                                if (value == null)
1,150!
355
                                {
×
356
                                        throw new ArgumentNullException(nameof(value));
×
357
                                }
358

359
                                if (this.Document != null)
1,150✔
360
                                {
756✔
361
                                        this._leaderLineType = CadObject.updateCollection(value, this.Document.LineTypes);
756✔
362
                                }
756✔
363
                                else
364
                                {
394✔
365
                                        this._leaderLineType = value;
394✔
366
                                }
394✔
367
                        }
1,150✔
368
                }
369

370
                /// <summary>
371
                /// Gets or sets a value specifying the lineweight to be applied to all leader lines of the multileader.
372
                /// </summary>
373
                /// <remarks>
374
                /// <para>
375
                /// This value can be overridden by the <see cref="MultiLeader.LeaderLineWeight"/> property when the
376
                /// <see cref="MultiLeaderPropertyOverrideFlags.LeaderLineWeight"/> flag is set in the
377
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
378
                /// </para><para>
379
                /// The value for all leader lines can be overridden for each individual leader line by the
380
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.LineWeight"/> property when the
381
                /// <see cref="LeaderLinePropertOverrideFlags.LineWeight"/> flag is set in the
382
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.OverrideFlags"/> property.
383
                /// </para>
384
                /// </remarks>
385
                [DxfCodeValue(92)]
386
                public LineWeightType LeaderLineWeight { get; set; } = LineWeightType.ByBlock;
8,524✔
387

388
                /// <summary>
389
                /// Gets or sets color to be applied all leader lines of the multileader.
390
                /// </summary>
391
                /// <remarks>
392
                /// <para>
393
                /// This value can be overridden by the <see cref="MultiLeader.LineColor"/> property when the
394
                /// <see cref="MultiLeaderPropertyOverrideFlags.LineColor"/> flag is set in the
395
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
396
                /// </para><para>
397
                /// The value for all leader lines can be overridden for each individual leader line by the
398
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.LineColor"/> property when the
399
                /// <see cref="LeaderLinePropertOverrideFlags.LineColor"/> flag is set in the
400
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.OverrideFlags"/> property.
401
                /// </para>
402
                /// </remarks>
403
                [DxfCodeValue(91)]
404
                public Color LineColor { get; set; }
870✔
405

406
                /// <summary>
407
                /// Gets or sets the max number of segments when a new leader is being created for a multileader.
408
                /// </summary>
409
                /// <remarks>
410
                /// This property supports creating and editing a multileader but has no meaning for
411
                /// the display of multileaders.
412
                /// </remarks>
413
                [DxfCodeValue(90)]
414
                public int MaxLeaderSegmentsPoints { get; set; } = 2;
8,525✔
415

416
                //        TODO What is the meaning of this property? Is it relevant for drawing a multileader?
417
                /// <summary>
418
                /// DrawMLeaderOrder Type
419
                /// </summary>
420
                [DxfCodeValue(171)]
421
                public MultiLeaderDrawOrderType MultiLeaderDrawOrder { get; set; }
1,341✔
422

423
                /// <inheritdoc/>
424
                public override string ObjectName => DxfFileToken.ObjectMLeaderStyle;
23,377✔
425

426
                /// <inheritdoc/>
427
                public override ObjectType ObjectType => ObjectType.UNLISTED;
270✔
428

429
                /// <summary>
430
                /// Overwrite Property Value
431
                /// </summary>
432
                /// <remarks>
433
                /// Property changed, meaning not totally clear
434
                /// might be set to true if something changed after loading,
435
                /// or might be used to trigger updates in dependent MLeaders.
436
                /// sequence seems to be different in DXF
437
                /// </remarks>
438
                [DxfCodeValue(295)]
439
                public bool OverwritePropertyValue { get; set; }
1,342✔
440

441
                /// <summary>
442
                /// Gets or sets a value indicating whether leaders are to be displayed as polyline,
443
                /// a spline curve or invisible. This setting applies for all leader lines of the
444
                /// multileader.
445
                /// </summary>
446
                /// <remarks>
447
                /// <para>
448
                /// This value can be overridden by the <see cref="MultiLeader.PathType"/> property when the
449
                /// <see cref="MultiLeaderPropertyOverrideFlags.PathType"/> flag is set in the
450
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
451
                /// </para><para>
452
                /// The value for all leader lines can be overridden for each individual leader line by the
453
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.PathType"/> property when the
454
                /// <see cref="LeaderLinePropertOverrideFlags.PathType"/> flag is set in the
455
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.OverrideFlags"/> property.
456
                /// </para>
457
                /// </remarks>
458
                [DxfCodeValue(173)]
459
                public MultiLeaderPathType PathType { get; set; }
1,341✔
460

461
                /// <summary>
462
                /// Gets or sets the scale factor for the <see cref="ArrowheadSize"/>, <see cref="LandingDistance"/>,
463
                /// <see cref="LandingGap"/>, <see cref="TextHeight"/>, and the elements of <see cref="BlockContentScale"/>.
464
                /// </summary>
465
                /// <remarks>
466
                /// <para>
467
                /// This value can be overridden by the <see cref="MultiLeaderObjectContextData.ScaleFactor"/> property
468
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.ScaleFactor"/> flag is set in the
469
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
470
                /// </para>
471
                /// </remarks>
472
                [DxfCodeValue(142)]
473
                public double ScaleFactor { get; set; } = 1;
8,525✔
474

475
                /// <summary>
476
                /// Gets or sets a snap angle value for the second leader segment when a leader line
477
                /// is being created for the mutileader.
478
                /// </summary>
479
                /// <remarks>
480
                /// This property supports creating and editing a multileader but has no meaning for
481
                /// the display of multileaders.
482
                /// </remarks>
483
                /// <value>
484
                /// An angle value in radians or zero if no angle contstraint is set.
485
                /// </value>
486
                [DxfCodeValue(41)]
487
                public double SecondSegmentAngleConstraint { get; set; }
1,342✔
488

489
                /// <inheritdoc/>
490
                public override string SubclassMarker => DxfSubclassMarker.MLeaderStyle;
20,462✔
491

492
                //        TODO Is this property only relevant for new leaders?
493
                /// <summary>
494
                /// Text Align Always Left
495
                /// </summary>
496
                [DxfCodeValue(297)]
497
                public bool TextAlignAlwaysLeft { get; set; }
1,342✔
498

499
                /// <summary>
500
                /// Gets or sets the text alignment, i.e. the alignment of text lines if the a multiline
501
                /// text label, relative to the <see cref="MultiLeaderObjectContextData.TextLocation"/>.
502
                /// </summary>
503
                /// <remarks>
504
                /// <para>
505
                /// This value can be overridden by the <see cref="MultiLeaderObjectContextData.TextAlignment"/> property
506
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextAlignment"/> flag is set in the
507
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
508
                /// </para>
509
                /// </remarks>
510
                [DxfCodeValue(176)]
511
                public TextAlignmentType TextAlignment { get; set; }
1,341✔
512

513
                //        TODO How to set this value?
514
                /// <summary>
515
                /// Gets or sets a value indicating the text angle.
516
                /// </summary>
517
                /// <remarks>
518
                /// <para>
519
                /// This value can be overridden by the <see cref="MultiLeader.TextAngle"/> property
520
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextAngle"/> flag is set in the
521
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
522
                /// </para>
523
                /// </remarks>
524
                [DxfCodeValue(175)]
525
                public TextAngleType TextAngle { get; set; } = TextAngleType.Horizontal;
8,524✔
526

527
                //        TODO Check
528
                //                 whether this property is relevant for both text an block content
529
                //                 How it can be overridden by LeaderRoot.AttachmentDirection
530
                /// <summary>
531
                /// Gets or sets the Text attachment direction for text or block contents, rename?
532
                /// This property defines whether the leaders attach to the left/right of the content block/text,
533
                /// or attach to the top/bottom.
534
                /// </summary>
535
                /// <remarks>
536
                /// <para>
537
                /// This value can be overridden by the <see cref="MultiLeader.TextAttachmentDirection"/> property
538
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextAttachmentDirection"/> flag is set in the
539
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
540
                /// </para><para>
541
                /// The value for all leader lines can be overridden for each individual leader line by the
542
                /// <see cref="MultiLeaderObjectContextData.LeaderRoot.TextAttachmentDirection"/> property when the
543
                /// <see cref="LeaderLinePropertOverrideFlags.TextAttachmentDirection"/> flag is set in the
544
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.OverrideFlags"/> property.
545
                /// </para>
546
                /// </remarks>
547
                /// <value>
548
                /// A <see cref="TextAttachmentDirectionType"/>.
549
                /// </value>
550
                [DxfCodeValue(271)]
551
                public TextAttachmentDirectionType TextAttachmentDirection { get; set; }
875✔
552

553
                /// <summary>
554
                /// Gets or sets the text bottom attachment type.
555
                /// This value controls the position of the connection point of the leader
556
                /// attached to the bottom of the text label.
557
                /// </summary>
558
                /// <remarks>
559
                /// <para>
560
                /// This value can be overridden by the <see cref="MultiLeaderObjectContextData.TextBottomAttachment"/> property
561
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextBottomAttachment"/> flag is set in the
562
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
563
                /// </para><para>
564
                /// This property is only relevant if <see cref="TextAttachmentDirection"/> is
565
                /// <see cref="TextAttachmentDirectionType.Vertical"/> and a leader attached
566
                /// to the bottom of the text label exists.
567
                /// </para>
568
                /// </remarks>
569
                /// <value>
570
                /// A <see cref="TextAttachmentType"/> having the values
571
                ///         9 = Center,
572
                ///         10 = Underline and Center
573
                /// can be used ("vertical" attachment types).
574
                /// </value>
575
                [DxfCodeValue(272)]
576
                public TextAttachmentType TextBottomAttachment { get; set; }
875✔
577

578
                /// <summary>
579
                /// Gest or sets the color for the text label of the multileader.
580
                /// </summary>
581
                /// <remarks>
582
                /// <para>
583
                /// This value can be overridden by the <see cref="MultiLeaderObjectContextData.TextColor"/> property
584
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextColor"/> flag is set in the
585
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
586
                /// </para>
587
                /// </remarks>
588
                [DxfCodeValue(93)]
589
                public Color TextColor { get; set; } = Color.ByBlock;
8,053✔
590

591
                /// <summary>
592
                /// Gets or sets a value indicating that the text label is to be drawn with a frame.
593
                /// </summary>
594
                /// <remarks>
595
                /// <para>
596
                /// This value can be overridden by the <see cref="MultiLeader.TextFrame"/> property
597
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextFrame"/> flag is set in the
598
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
599
                /// </para>
600
                /// </remarks>
601
                [DxfCodeValue(292)]
602
                public bool TextFrame { get; set; }
1,342✔
603

604
                /// <summary>
605
                /// Gets or sets the text height for the text label of the multileader.
606
                /// </summary>
607
                /// <remarks>
608
                /// <para>
609
                /// This value can be overridden by the <see cref="MultiLeaderObjectContextData.TextHeight"/> property
610
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextHeight"/> flag is set in the
611
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
612
                /// </para>
613
                /// </remarks>
614
                [DxfCodeValue(45)]
615
                public double TextHeight { get; set; } = 0.18;
8,525✔
616

617
                /// <summary>
618
                /// Gets or sets the Text Left Attachment Type.
619
                /// This value controls the position of the connection point of the leader
620
                /// attached to the left side of the text label.
621
                /// </summary>
622
                /// <remarks>
623
                /// <para>
624
                /// This value can be overridden by the <see cref="MultiLeaderObjectContextData.TextLeftAttachment"/> property
625
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextLeftAttachment"/> flag is set in the
626
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
627
                /// </para><para>
628
                /// This property is only relevant if <see cref="TextAttachmentDirection"/> is
629
                /// <see cref="TextAttachmentDirectionType.Horizontal"/> and a leader attached
630
                /// to the left side of the text label exists.
631
                /// </para>
632
                /// </remarks>
633
                /// <value>
634
                /// A <see cref="TextAttachmentType"/> having the values 0-8
635
                /// can be used ("horizontal" attachment types).
636
                /// </value>
637
                [DxfCodeValue(174)]
638
                public TextAttachmentType TextLeftAttachment { get; set; }
1,341✔
639

640
                /// <summary>
641
                /// Gets or sets the Text Right Attachment Type.
642
                /// This value controls the position of the connection point of the leader
643
                /// attached to the right side of the text label.
644
                /// </summary>
645
                /// <remarks>
646
                /// <para>
647
                /// This value can be overridden by the <see cref="MultiLeaderObjectContextData.TextRightAttachment"/> property
648
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextRightAttachment"/> flag is set in the
649
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
650
                /// </para><para>
651
                /// This property is only relevant if <see cref="TextAttachmentDirection"/> is
652
                /// <see cref="TextAttachmentDirectionType.Horizontal"/> and a leader attached
653
                /// to the right side of the text label exists.
654
                /// </para>
655
                /// </remarks>
656
                /// <value>
657
                /// A <see cref="TextAttachmentType"/> having the values 0-8
658
                /// can be used ("horizontal" attachment types).
659
                /// </value>
660
                [DxfCodeValue(178)]
661
                public TextAttachmentType TextRightAttachment { get; set; }
1,341✔
662

663
                /// <summary>
664
                /// Gets or sets the <see cref="TextStyle"/> to be used to display the text label of the
665
                /// multileader.
666
                /// </summary>
667
                /// <remarks>
668
                /// <para>
669
                /// This value can be overridden by the <see cref="MultiLeaderObjectContextData.TextStyle"/> property
670
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextStyle"/> flag is set in the
671
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
672
                /// </para>
673
                /// </remarks>
674
                [DxfCodeValue(DxfReferenceType.Handle, 342)]
675
                public TextStyle TextStyle
676
                {
677
                        get { return this._textStyle; }
1,755✔
678
                        set
679
                        {
1,150✔
680
                                if (value == null)
1,150!
681
                                {
×
682
                                        throw new ArgumentNullException(nameof(value));
×
683
                                }
684

685
                                if (this.Document != null)
1,150✔
686
                                {
756✔
687
                                        this._textStyle = CadObject.updateCollection(value, this.Document.TextStyles);
756✔
688
                                }
756✔
689
                                else
690
                                {
394✔
691
                                        this._textStyle = value;
394✔
692
                                }
394✔
693
                        }
1,150✔
694
                }
695

696
                /// <summary>
697
                /// Gets or sets the text top attachment type.
698
                /// This value controls the position of the connection point of the leader
699
                /// attached to the top of the text label.
700
                /// </summary>
701
                /// <remarks>
702
                /// <para>
703
                /// This value can be overridden by the <see cref="MultiLeaderObjectContextData.TextTopAttachment"/> property
704
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextTopAttachment"/> flag is set in the
705
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
706
                /// </para><para>
707
                /// This property is only relevant if <see cref="TextAttachmentDirection"/> is
708
                /// <see cref="TextAttachmentDirectionType.Vertical"/> and a leader attached
709
                /// to the top of the text label exists.
710
                /// </para>
711
                /// </remarks>
712
                /// <value>
713
                /// A <see cref="TextAttachmentType"/> having the values
714
                ///         9 = Center,
715
                ///         10 = Underline and Center
716
                /// can be used ("vertical" attachment types).
717
                /// </value>
718
                [DxfCodeValue(273)]
719
                public TextAttachmentType TextTopAttachment { get; set; }
875✔
720

721
                /// <summary>
722
                /// Undocumented in ODS and DXF-ref boolean, found in DXF
723
                /// </summary>
724
                [DxfCodeValue(298)]
725
                public bool UnknownFlag298 { get; set; }
381✔
726

727
                /// <summary>
728
                /// Default multiline style name
729
                /// </summary>
730
                public const string DefaultName = "Standard";
731

732
                private BlockRecord _arrowhead;
733

734
                private BlockRecord _blockContent;
735

736
                private XYZ _blockContentScale = new XYZ(1);
7,183✔
737

738
                private LineType _leaderLineType = LineType.ByLayer;
7,183✔
739

740
                private TextStyle _textStyle = TextStyle.Default;
7,183✔
741

742
                /// <summary>
743
                /// Initializes a new instance of the <see cref="MultiLeaderStyle"/> class.
744
                /// </summary>
745
                public MultiLeaderStyle() : this(string.Empty) { }
2,271✔
746

747
                /// <summary>
748
                /// Initializes a new instance of the <see cref="MultiLeaderStyle"/> class
749
                /// and sets the name of this style.
750
                /// </summary>
751
                public MultiLeaderStyle(string name) : base()
7,183✔
752
                {
7,183✔
753
                        this.Name = name;
7,183✔
754
                }
7,183✔
755

756
                /// <inheritdoc/>
757
                public override CadObject Clone()
758
                {
394✔
759
                        MultiLeaderStyle clone = (MultiLeaderStyle)base.Clone();
394✔
760
                        clone.TextStyle = (TextStyle)this._textStyle.Clone();
394✔
761
                        clone.LeaderLineType = (LineType)this._leaderLineType.Clone();
394✔
762

763
                        clone.Arrowhead = (BlockRecord)this._arrowhead?.Clone();
394!
764
                        clone.BlockContent = (BlockRecord)this._blockContent?.Clone();
394!
765

766
                        return clone;
394✔
767
                }
394✔
768

769
                internal override void AssignDocument(CadDocument doc)
770
                {
1,571✔
771
                        base.AssignDocument(doc);
1,571✔
772

773
                        this._textStyle = CadObject.updateCollection(this._textStyle, doc.TextStyles);
1,571✔
774
                        this._leaderLineType = CadObject.updateCollection(this._leaderLineType, doc.LineTypes);
1,571✔
775
                        this._arrowhead = CadObject.updateCollection(this._arrowhead, doc.BlockRecords);
1,571✔
776
                        this._blockContent = CadObject.updateCollection(this._blockContent, doc.BlockRecords);
1,571✔
777

778
                        doc.TextStyles.OnRemove += this.tableOnRemove;
1,571✔
779
                        doc.LineTypes.OnRemove += this.tableOnRemove;
1,571✔
780
                        doc.BlockRecords.OnRemove += this.tableOnRemove;
1,571✔
781
                }
1,571✔
782

783
                internal override void UnassignDocument()
784
                {
×
785
                        this.Document.TextStyles.OnRemove -= this.tableOnRemove;
×
786
                        this.Document.LineTypes.OnRemove -= this.tableOnRemove;
×
787
                        this.Document.BlockRecords.OnRemove -= this.tableOnRemove;
×
788

789
                        base.UnassignDocument();
×
790

791
                        this._textStyle = (TextStyle)this._textStyle.Clone();
×
792
                        this._leaderLineType = (LineType)this._leaderLineType.Clone();
×
793
                        this._arrowhead = (BlockRecord)this._arrowhead?.Clone();
×
794
                        this._blockContent = (BlockRecord)this._blockContent?.Clone();
×
795
                }
×
796

797
                protected virtual void tableOnRemove(object sender, CollectionChangedEventArgs e)
798
                {
9✔
799
                        if (e.Item.Equals(this._textStyle))
9!
800
                        {
×
801
                                this._textStyle = this.Document.TextStyles[Layer.DefaultName];
×
802
                        }
×
803

804
                        if (e.Item.Equals(this._leaderLineType))
9!
805
                        {
×
806
                                this._leaderLineType = this.Document.LineTypes[LineType.ByLayerName];
×
807
                        }
×
808

809
                        if (e.Item.Equals(this.Arrowhead))
9!
810
                        {
×
811
                                this._arrowhead = null;
×
812
                        }
×
813

814
                        if (e.Item.Equals(this.BlockContent))
9!
815
                        {
×
816
                                this._blockContent = null;
×
817
                        }
×
818
                }
9✔
819
        }
820
}
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

© 2025 Coveralls, Inc