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

DomCR / ACadSharp / 14834551532

05 May 2025 10:40AM UTC coverage: 75.488% (+0.4%) from 75.056%
14834551532

Pull #641

github

web-flow
Merge 658b524fc into 9a87bd970
Pull Request #641: MultiLeader SPIKE

5714 of 8329 branches covered (68.6%)

Branch coverage included in aggregate %.

220 of 245 new or added lines in 7 files covered. (89.8%)

86 existing lines in 13 files now uncovered.

22880 of 29550 relevant lines covered (77.43%)

82421.21 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
                /// <summary>
21
                /// Gets the default MLine style
22
                /// </summary>
23
                public static MultiLeaderStyle Default { get { return new MultiLeaderStyle(DefaultName); } }
6,696✔
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;
2,865✔
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="MultiLeaderAnnotContext.LeaderLine.Arrowhead"/> property when the
44
                /// <see cref="LeaderLinePropertOverrideFlags.Arrowhead"/> flag is set in the
45
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.OverrideFlags"/> property.
46
                /// </para>
47
                /// </remarks>
48
                [DxfCodeValue(DxfReferenceType.Handle, 341)]
49
                public BlockRecord Arrowhead
50
                {
51
                        get { return this._arrowhead; }
216✔
52
                        set
53
                        {
214✔
54
                                this._arrowhead = this.updateTable(value, this.Document?.BlockRecords);
214!
55
                        }
214✔
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="MultiLeaderAnnotContext.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="MultiLeaderAnnotContext.LeaderLine.ArrowheadSize"/> property when the
69
                /// <see cref="LeaderLinePropertOverrideFlags.ArrowheadSize"/> flag is set in the
70
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.OverrideFlags"/> property.
71
                /// </para>
72
                /// </remarks>
73
                [DxfCodeValue(44)]
74
                public double ArrowheadSize { get; set; } = 0.18;
2,865✔
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="MultiLeaderAnnotContext.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; }
216✔
91
                        set
92
                        {
214✔
93
                                this._blockContent = this.updateTable(value, this.Document?.BlockRecords);
214!
94
                        }
214✔
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="MultiLeaderAnnotContext.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;
2,865✔
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="MultiLeaderAnnotContext.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; }
347✔
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="MultiLeaderAnnotContext.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;
2,865✔
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="MultiLeaderAnnotContext.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
                [DxfCodeValue(47, 49, 140)]
148
                public XYZ BlockContentScale { get; set; } = new XYZ(1);
2,915✔
149

150
                //        TODO What is the meaning of this property?
151
                /// <summary>
152
                /// Break Gap Size
153
                /// </summary>
154
                [DxfCodeValue(143)]
155
                public double BreakGapSize { get; set; } = 0.125;
2,865✔
156

157
                /// <summary>
158
                /// Gets or sets a value indicating the content type for the multileader.
159
                /// </summary>
160
                /// <remarks>
161
                /// <para>
162
                /// This value can be overridden by the <see cref="MultiLeader.ContentType"/> property when the
163
                /// <see cref="MultiLeaderPropertyOverrideFlags.ContentType"/> flag is set in the
164
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
165
                /// </para>
166
                /// </remarks>
167
                [DxfCodeValue(170)]
168
                public LeaderContentType ContentType { get; set; } = LeaderContentType.MText;
2,864✔
169

170
                /// <summary>
171
                /// Gests or sets a default text that is to be set when a mutileader is being created
172
                /// with this <see cref="MultiLeaderStyle"/>.
173
                /// </summary>
174
                [DxfCodeValue(300)]
175
                public string DefaultTextContents { get; set; } = string.Empty;
2,864✔
176

177
                /// <summary>
178
                /// Gets or sets a text containing the description of this <see cref="MultiLeaderStyle"/>.
179
                /// </summary>
180
                [DxfCodeValue(3)]
181
                public string Description { get; set; } = string.Empty;
2,864✔
182

183
                //        TODO: Cannot be overridden? Is this property only relevant in AutoCAD?
184
                /// <summary>
185
                /// Gets or sets a value indicating whether rotation of the block content is enabled.
186
                /// </summary>
187
                [DxfCodeValue(294)]
188
                public bool EnableBlockContentRotation { get; set; }
348✔
189

190
                //        TODO: Cannot be overridden? Is this property only relevant in AutoCAD?
191
                /// <summary>
192
                /// Gets or sets a value indicating whether scaling of the block content is enabled.
193
                /// </summary>
194
                [DxfCodeValue(293)]
195
                public bool EnableBlockContentScale { get; set; }
348✔
196

197
                /// <summary>
198
                /// Gets or sets a value indicating that leader lines are to be drawn with a dogleg.
199
                /// </summary>
200
                /// <remarks>
201
                /// <para>
202
                /// This value can be overridden by the <see cref="MultiLeader.EnableDogleg"/> property
203
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.EnableDogleg"/> flag is set in the
204
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
205
                /// </para><para>
206
                /// Note that this setting has no effect when the <see cref="TextAttachmentDirection"/>
207
                /// is <see cref="TextAttachmentDirectionType.Vertical"/>.
208
                /// </para>
209
                /// </remarks>
210
                [DxfCodeValue(291)]
211
                public bool EnableDogleg { get; set; } = true;
2,865✔
212

213
                //        TODO It seems that this value indicates that for a new leader that is being created
214
                //                 with this <see cref="MultiLeaderStyle" /> landing i.e. a dogleg is enabled.
215
                //                 But why can this value be overridden?
216
                //
217
                /// <summary>
218
                /// Gets or sets a value indicating whether landing is enabled.
219
                /// </summary>
220
                /// <remarks>
221
                /// <para>
222
                /// This value can be overridden by the <see cref="MultiLeader.EnableLanding"/> property
223
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.EnableLanding"/> flag is set in the
224
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
225
                /// </para>
226
                /// </remarks>
227
                [DxfCodeValue(290)]
228
                public bool EnableLanding { get; set; } = true;
2,865✔
229

230
                /// <summary>
231
                /// Gets or sets a snap angle value for the first leader segment when a leader line
232
                /// is being created for the mutileader.
233
                /// </summary>
234
                /// <remarks>
235
                /// This property supports creating and editing a multileader but has no meaning for
236
                /// the display of multileaders.
237
                /// </remarks>
238
                /// <value>
239
                /// An angle value in radians or zero if no angle contstraint is set.
240
                /// </value>
241
                [DxfCodeValue(40)]
242
                public double FirstSegmentAngleConstraint { get; set; }
348✔
243

244
                /// <summary>
245
                /// Is Annotative
246
                /// </summary>
247
                [DxfCodeValue(296)]
248
                public bool IsAnnotative { get; set; }
348✔
249

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

263
                /// <summary>
264
                /// Gets or sets the landing gap. This is the distance between the leader end point or, if present,
265
                /// the end of the dogleg and the text label or the content block.
266
                /// </summary>
267
                /// <remarks>
268
                /// <para>
269
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.LandingGap"/> property
270
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.LandingGap"/> flag is set in the
271
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
272
                /// </para>
273
                /// </remarks>
274
                [DxfCodeValue(42)]
275
                public double LandingGap { get; set; } = 0.09;
2,865✔
276

277
                //        TODO What is the meaning of this property? Is it relevant for drawing a multileader?
278
                /// <summary>
279
                /// DrawLeaderOrder Type
280
                /// </summary>
281
                [DxfCodeValue(172)]
282
                public LeaderDrawOrderType LeaderDrawOrder { get; set; }
347✔
283

284
                /// <summary>
285
                /// Gets or sets a <see cref="LineType"/> object specifying line-type properties for the
286
                /// musltileader. This setting applies for all leader lines of the multileader.
287
                /// </summary>
288
                /// <remarks>
289
                /// <para>
290
                /// This setting can be overridden by the <see cref="MultiLeader.LeaderLineType"/> property
291
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.LeaderLineType"/> flag is set in the
292
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
293
                /// </para><para>
294
                /// The setting for all leader lines can be overridden for each individual leader line by the
295
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.LineType"/> property when the
296
                /// <see cref="LeaderLinePropertOverrideFlags.LineType"/> flag is set in the
297
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.OverrideFlags"/> property.
298
                /// </para>
299
                /// </remarks>
300
                [DxfCodeValue(DxfReferenceType.Handle, 340)]
301
                public LineType LeaderLineType
302
                {
303
                        get { return this._leaderLineType; }
189✔
304
                        set
305
                        {
498✔
306
                                if (value == null)
498!
NEW
307
                                {
×
NEW
308
                                        throw new ArgumentNullException(nameof(value));
×
309
                                }
310

311
                                if (this.Document != null)
498✔
312
                                {
284✔
313
                                        this._leaderLineType = this.updateTable(value, this.Document.LineTypes);
284✔
314
                                }
284✔
315
                                else
316
                                {
214✔
317
                                        this._leaderLineType = value;
214✔
318
                                }
214✔
319
                        }
498✔
320
                }
321

322
                /// <summary>
323
                /// Gets or sets a value specifying the lineweight to be applied to all leader lines of the multileader.
324
                /// </summary>
325
                /// <remarks>
326
                /// <para>
327
                /// This value can be overridden by the <see cref="MultiLeader.LeaderLineWeight"/> property when the
328
                /// <see cref="MultiLeaderPropertyOverrideFlags.LeaderLineWeight"/> flag is set in the
329
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
330
                /// </para><para>
331
                /// The value for all leader lines can be overridden for each individual leader line by the
332
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.LineWeight"/> property when the
333
                /// <see cref="LeaderLinePropertOverrideFlags.LineWeight"/> flag is set in the
334
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.OverrideFlags"/> property.
335
                /// </para>
336
                /// </remarks>
337
                [DxfCodeValue(92)]
338
                public LineweightType LeaderLineWeight { get; set; } = LineweightType.ByBlock;
2,864✔
339

340
                /// <summary>
341
                /// Gets or sets color to be applied all leader lines of the multileader.
342
                /// </summary>
343
                /// <remarks>
344
                /// <para>
345
                /// This value can be overridden by the <see cref="MultiLeader.LineColor"/> property when the
346
                /// <see cref="MultiLeaderPropertyOverrideFlags.LineColor"/> flag is set in the
347
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
348
                /// </para><para>
349
                /// The value for all leader lines can be overridden for each individual leader line by the
350
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.LineColor"/> property when the
351
                /// <see cref="LeaderLinePropertOverrideFlags.LineColor"/> flag is set in the
352
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.OverrideFlags"/> property.
353
                /// </para>
354
                /// </remarks>
355
                [DxfCodeValue(91)]
356
                public Color LineColor { get; set; }
348✔
357

358
                /// <summary>
359
                /// Gets or sets the max number of segments when a new leader is being created for a multileader.
360
                /// </summary>
361
                /// <remarks>
362
                /// This property supports creating and editing a multileader but has no meaning for
363
                /// the display of multileaders.
364
                /// </remarks>
365
                [DxfCodeValue(90)]
366
                public int MaxLeaderSegmentsPoints { get; set; } = 2;
2,865✔
367

368
                //        TODO What is the meaning of this property? Is it relevant for drawing a multileader?
369
                /// <summary>
370
                /// DrawMLeaderOrder Type
371
                /// </summary>
372
                [DxfCodeValue(171)]
373
                public MultiLeaderDrawOrderType MultiLeaderDrawOrder { get; set; }
347✔
374

375
                /// <inheritdoc/>
376
                public override string ObjectName => DxfFileToken.ObjectMLeaderStyle;
63✔
377

378
                /// <inheritdoc/>
379
                public override ObjectType ObjectType => ObjectType.UNLISTED;
38✔
380

381
                /// <summary>
382
                /// Overwrite Property Value
383
                /// </summary>
384
                /// <remarks>
385
                /// Property changed, meaning not totally clear
386
                /// might be set to true if something changed after loading,
387
                /// or might be used to trigger updates in dependent MLeaders.
388
                /// sequence seems to be different in DXF
389
                /// </remarks>
390
                [DxfCodeValue(295)]
391
                public bool OverwritePropertyValue { get; set; }
348✔
392

393
                /// <summary>
394
                /// Gets or sets a value indicating whether leaders are to be displayed as polyline,
395
                /// a spline curve or invisible. This setting applies for all leader lines of the
396
                /// multileader.
397
                /// </summary>
398
                /// <remarks>
399
                /// <para>
400
                /// This value can be overridden by the <see cref="MultiLeader.PathType"/> property when the
401
                /// <see cref="MultiLeaderPropertyOverrideFlags.PathType"/> flag is set in the
402
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
403
                /// </para><para>
404
                /// The value for all leader lines can be overridden for each individual leader line by the
405
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.PathType"/> property when the
406
                /// <see cref="LeaderLinePropertOverrideFlags.PathType"/> flag is set in the
407
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.OverrideFlags"/> property.
408
                /// </para>
409
                /// </remarks>
410
                [DxfCodeValue(173)]
411
                public MultiLeaderPathType PathType { get; set; }
347✔
412

413
                /// <summary>
414
                /// Gets or sets the scale factor for the <see cref="ArrowheadSize"/>, <see cref="LandingDistance"/>,
415
                /// <see cref="LandingGap"/>, <see cref="TextHeight"/>, and the elements of <see cref="BlockContentScale"/>.
416
                /// </summary>
417
                /// <remarks>
418
                /// <para>
419
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.ScaleFactor"/> property
420
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.ScaleFactor"/> flag is set in the
421
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
422
                /// </para>
423
                /// </remarks>
424
                [DxfCodeValue(142)]
425
                public double ScaleFactor { get; set; } = 1;
2,865✔
426

427
                /// <summary>
428
                /// Gets or sets a snap angle value for the second leader segment when a leader line
429
                /// is being created for the mutileader.
430
                /// </summary>
431
                /// <remarks>
432
                /// This property supports creating and editing a multileader but has no meaning for
433
                /// the display of multileaders.
434
                /// </remarks>
435
                /// <value>
436
                /// An angle value in radians or zero if no angle contstraint is set.
437
                /// </value>
438
                [DxfCodeValue(41)]
439
                public double SecondSegmentAngleConstraint { get; set; }
348✔
440

441
                /// <inheritdoc/>
NEW
442
                public override string SubclassMarker => DxfSubclassMarker.MLeaderStyle;
×
443

444
                //        TODO Is this property only relevant for new leaders?
445
                /// <summary>
446
                /// Text Align Always Left
447
                /// </summary>
448
                [DxfCodeValue(297)]
449
                public bool TextAlignAlwaysLeft { get; set; }
348✔
450

451
                /// <summary>
452
                /// Gets or sets the text alignment, i.e. the alignment of text lines if the a multiline
453
                /// text label, relative to the <see cref="MultiLeaderAnnotContext.TextLocation"/>.
454
                /// </summary>
455
                /// <remarks>
456
                /// <para>
457
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.TextAlignment"/> property
458
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextAlignment"/> flag is set in the
459
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
460
                /// </para>
461
                /// </remarks>
462
                [DxfCodeValue(176)]
463
                public TextAlignmentType TextAlignment { get; set; }
347✔
464

465
                //        TODO How to set this value?
466
                /// <summary>
467
                /// Gets or sets a value indicating the text angle.
468
                /// </summary>
469
                /// <remarks>
470
                /// <para>
471
                /// This value can be overridden by the <see cref="MultiLeader.TextAngle"/> property
472
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextAngle"/> flag is set in the
473
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
474
                /// </para>
475
                /// </remarks>
476
                [DxfCodeValue(175)]
477
                public TextAngleType TextAngle { get; set; } = TextAngleType.Horizontal;
2,864✔
478

479
                //        TODO Check
480
                //                 whether this property is relevant for both text an block content
481
                //                 How it can be overridden by LeaderRoot.AttachmentDirection
482
                /// <summary>
483
                /// Gets or sets the Text attachment direction for text or block contents, rename?
484
                /// This property defines whether the leaders attach to the left/right of the content block/text,
485
                /// or attach to the top/bottom.
486
                /// </summary>
487
                /// <remarks>
488
                /// <para>
489
                /// This value can be overridden by the <see cref="MultiLeader.TextAttachmentDirection"/> property
490
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextAttachmentDirection"/> flag is set in the
491
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
492
                /// </para><para>
493
                /// The value for all leader lines can be overridden for each individual leader line by the
494
                /// <see cref="MultiLeaderAnnotContext.LeaderRoot.TextAttachmentDirection"/> property when the
495
                /// <see cref="LeaderLinePropertOverrideFlags.TextAttachmentDirection"/> flag is set in the
496
                /// <see cref="MultiLeaderAnnotContext.LeaderLine.OverrideFlags"/> property.
497
                /// </para>
498
                /// </remarks>
499
                /// <value>
500
                /// A <see cref="TextAttachmentDirectionType"/>.
501
                /// </value>
502
                [DxfCodeValue(271)]
503
                public TextAttachmentDirectionType TextAttachmentDirection { get; set; }
169✔
504

505
                /// <summary>
506
                /// Gets or sets the text bottom attachment type.
507
                /// This value controls the position of the connection point of the leader
508
                /// attached to the bottom of the text label.
509
                /// </summary>
510
                /// <remarks>
511
                /// <para>
512
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.TextBottomAttachment"/> property
513
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextBottomAttachment"/> flag is set in the
514
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
515
                /// </para><para>
516
                /// This property is only relevant if <see cref="TextAttachmentDirection"/> is
517
                /// <see cref="TextAttachmentDirectionType.Vertical"/> and a leader attached
518
                /// to the bottom of the text label exists.
519
                /// </para>
520
                /// </remarks>
521
                /// <value>
522
                /// A <see cref="TextAttachmentType"/> having the values
523
                ///         9 = Center,
524
                ///         10 = Underline and Center
525
                /// can be used ("vertical" attachment types).
526
                /// </value>
527
                [DxfCodeValue(272)]
528
                public TextAttachmentType TextBottomAttachment { get; set; } 
169✔
529

530
                /// <summary>
531
                /// Get or sets the color for the text label of the multileader.
532
                /// </summary>
533
                /// <remarks>
534
                /// <para>
535
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.TextColor"/> property
536
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextColor"/> flag is set in the
537
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
538
                /// </para>
539
                /// </remarks>
540
                [DxfCodeValue(93)]
541
                public Color TextColor { get; set; } = Color.ByBlock;
2,865✔
542

543
                /// <summary>
544
                /// Gets or sets a value indicating that the text label is to be drawn with a frame.
545
                /// </summary>
546
                /// <remarks>
547
                /// <para>
548
                /// This value can be overridden by the <see cref="MultiLeader.TextFrame"/> property
549
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextFrame"/> flag is set in the
550
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
551
                /// </para>
552
                /// </remarks>
553
                [DxfCodeValue(292)]
554
                public bool TextFrame { get; set; }
348✔
555

556
                /// <summary>
557
                /// Get or sets the text height for the text label of the multileader.
558
                /// </summary>
559
                /// <remarks>
560
                /// <para>
561
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.TextHeight"/> property
562
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextHeight"/> flag is set in the
563
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
564
                /// </para>
565
                /// </remarks>
566
                [DxfCodeValue(45)]
567
                public double TextHeight { get; set; } = 0.18;
2,865✔
568

569
                /// <summary>
570
                /// Gets or sets the Text Left Attachment Type.
571
                /// This value controls the position of the connection point of the leader
572
                /// attached to the left side of the text label.
573
                /// </summary>
574
                /// <remarks>
575
                /// <para>
576
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.TextLeftAttachment"/> property
577
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextLeftAttachment"/> flag is set in the
578
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
579
                /// </para><para>
580
                /// This property is only relevant if <see cref="TextAttachmentDirection"/> is
581
                /// <see cref="TextAttachmentDirectionType.Horizontal"/> and a leader attached
582
                /// to the left side of the text label exists.
583
                /// </para>
584
                /// </remarks>
585
                /// <value>
586
                /// A <see cref="TextAttachmentType"/> having the values 0-8
587
                /// can be used ("horizontal" attachment types).
588
                /// </value>
589
                [DxfCodeValue(174)]
590
                public TextAttachmentType TextLeftAttachment { get; set; }
347✔
591

592
                /// <summary>
593
                /// Gets or sets the Text Right Attachment Type.
594
                /// This value controls the position of the connection point of the leader
595
                /// attached to the right side of the text label.
596
                /// </summary>
597
                /// <remarks>
598
                /// <para>
599
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.TextRightAttachment"/> property
600
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextRightAttachment"/> flag is set in the
601
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
602
                /// </para><para>
603
                /// This property is only relevant if <see cref="TextAttachmentDirection"/> is
604
                /// <see cref="TextAttachmentDirectionType.Horizontal"/> and a leader attached
605
                /// to the right side of the text label exists.
606
                /// </para>
607
                /// </remarks>
608
                /// <value>
609
                /// A <see cref="TextAttachmentType"/> having the values 0-8
610
                /// can be used ("horizontal" attachment types).
611
                /// </value>
612
                [DxfCodeValue(178)]
613
                public TextAttachmentType TextRightAttachment { get; set; }
347✔
614

615
                /// <summary>
616
                /// Gets or sets the <see cref="TextStyle"/> to be used to display the text label of the
617
                /// multileader.
618
                /// </summary>
619
                /// <remarks>
620
                /// <para>
621
                /// This value can be overridden by the <see cref="MultiLeaderAnnotContext.TextStyle"/> property
622
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextStyle"/> flag is set in the
623
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
624
                /// </para>
625
                /// </remarks>
626
                [DxfCodeValue(DxfReferenceType.Handle, 342)]
627
                public TextStyle TextStyle
628
                {
629
                        get { return this._textStyle; }
189✔
630
                        set
631
                        {
498✔
632
                                if (value == null)
498!
NEW
633
                                {
×
NEW
634
                                        throw new ArgumentNullException(nameof(value));
×
635
                                }
636

637
                                if (this.Document != null)
498✔
638
                                {
284✔
639
                                        this._textStyle = this.updateTable(value, this.Document.TextStyles);
284✔
640
                                }
284✔
641
                                else
642
                                {
214✔
643
                                        this._textStyle = value;
214✔
644
                                }
214✔
645
                        }
498✔
646
                }
647

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

673
                /// <summary>
674
                /// Undocumented in ODS and DXF-ref boolean, found in DXF
675
                /// </summary>
676
                [DxfCodeValue(298)]
677
                internal bool UnknownFlag298 { get; set; }
98✔
678

679
                /// <summary>
680
                /// Default multiline style name
681
                /// </summary>
682
                public const string DefaultName = "Standard";
683

684
                private BlockRecord _arrowhead;
685

686
                private BlockRecord _blockContent;
687

688
                private LineType _leaderLineType = LineType.ByLayer;
2,517✔
689

690
                private TextStyle _textStyle = TextStyle.Default;
2,517✔
691

692
                /// <summary>
693
                /// Initializes a new instance of the <see cref="MultiLeaderStyle"/> class.
694
                /// </summary>
695
                public MultiLeaderStyle() : this(string.Empty) { }
855✔
696

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

706
                /// <inheritdoc/>
707
                public override CadObject Clone()
708
                {
214✔
709
                        MultiLeaderStyle clone = (MultiLeaderStyle)base.Clone();
214✔
710
                        clone.TextStyle = (TextStyle)this._textStyle.Clone();
214✔
711
                        clone.LeaderLineType = (LineType)this._leaderLineType.Clone();
214✔
712

713
                        clone.Arrowhead = (BlockRecord)this._arrowhead?.Clone();
214!
714
                        clone.BlockContent = (BlockRecord)this._blockContent?.Clone();
214!
715

716
                        return clone;
214✔
717
                }
214✔
718

719
                internal override void AssignDocument(CadDocument doc)
720
                {
514✔
721
                        base.AssignDocument(doc);
514✔
722

723
                        this._textStyle = this.updateTable(this._textStyle, doc.TextStyles);
514✔
724
                        this._leaderLineType = this.updateTable(this._leaderLineType, doc.LineTypes);
514✔
725
                        this._arrowhead = this.updateTable(this._arrowhead, doc.BlockRecords);
514✔
726
                        this._blockContent = this.updateTable(this._blockContent, doc.BlockRecords);
514✔
727

728
                        doc.TextStyles.OnRemove += this.tableOnRemove;
514✔
729
                        doc.LineTypes.OnRemove += this.tableOnRemove;
514✔
730
                        doc.BlockRecords.OnRemove += this.tableOnRemove;
514✔
731
                }
514✔
732

733
                internal override void UnassignDocument()
734
                {
×
735
                        this.Document.TextStyles.OnRemove -= this.tableOnRemove;
×
736
                        this.Document.LineTypes.OnRemove -= this.tableOnRemove;
×
737
                        this.Document.BlockRecords.OnRemove -= this.tableOnRemove;
×
738

739
                        base.UnassignDocument();
×
740

741
                        this._textStyle = (TextStyle)this._textStyle.Clone();
×
742
                        this._leaderLineType = (LineType)this._leaderLineType.Clone();
×
743
                        this._arrowhead = (BlockRecord)this._arrowhead?.Clone();
×
744
                        this._blockContent = (BlockRecord)this._blockContent?.Clone();
×
745
                }
×
746

747
                protected virtual void tableOnRemove(object sender, CollectionChangedEventArgs e)
748
                {
9✔
749
                        if (e.Item.Equals(this._textStyle))
9!
750
                        {
×
751
                                this._textStyle = this.Document.TextStyles[Layer.DefaultName];
×
752
                        }
×
753

754
                        if (e.Item.Equals(this._leaderLineType))
9!
755
                        {
×
756
                                this._leaderLineType = this.Document.LineTypes[LineType.ByLayerName];
×
757
                        }
×
758

759
                        if (e.Item.Equals(this.Arrowhead))
9!
760
                        {
×
761
                                this._arrowhead = null;
×
762
                        }
×
763

764
                        if (e.Item.Equals(this.BlockContent))
9!
765
                        {
×
766
                                this._blockContent = null;
×
767
                        }
×
768
                }
9✔
769
        }
770
}
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