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

DomCR / ACadSharp / 14432853472

13 Apr 2025 08:02PM UTC coverage: 75.253% (-0.01%) from 75.265%
14432853472

Pull #614

github

web-flow
Merge b54b762a3 into 0a8954d60
Pull Request #614: Issue 612 dxf to dwg

5663 of 8245 branches covered (68.68%)

Branch coverage included in aggregate %.

20 of 23 new or added lines in 6 files covered. (86.96%)

14 existing lines in 3 files now uncovered.

22499 of 29178 relevant lines covered (77.11%)

83278.78 hits per line

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

81.34
/src/ACadSharp/Tables/DimensionStyle.cs
1
using ACadSharp.Attributes;
2
using ACadSharp.Types.Units;
3
using System;
4

5
//        TODO should the described coupling of properties be implemented in this class,
6
//                 e.g., GenerateTolerances and LimitsGeneration?
7

8
namespace ACadSharp.Tables
9
{
10
        /// <summary>
11
        /// Represents a <see cref="DimensionStyle"/> table entry.
12
        /// </summary>
13
        /// <remarks>
14
        /// Object name <see cref="DxfFileToken.TableDimstyle"/> <br/>
15
        /// Dxf class name <see cref="DxfSubclassMarker.DimensionStyle"/>
16
        /// </remarks>
17
        [DxfName(DxfFileToken.TableDimstyle)]
18
        [DxfSubClass(DxfSubclassMarker.DimensionStyle)]
19
        public class DimensionStyle : TableEntry
20
        {
21
                public static DimensionStyle Default { get { return new DimensionStyle(DefaultName); } }
28,392✔
22

23
                /// <summary>
24
                /// Specifies a text prefix or suffix (or both) to the alternate dimension
25
                /// measurement for all types of dimensions except angular
26
                /// (see DIMAPOST System Variable).
27
                /// </summary>
28
                /// <remarks><para>
29
                /// For instance, if the current units are Architectural, <see cref="AlternateUnitDimensioning"/>
30
                /// is on (true), <see cref="AlternateUnitScaleFactor"/> is 25.4 (the number of millimeters per inch),
31
                /// <see cref="AlternateUnitDecimalPlaces"/> is 2, and <i>AlternateDimensioningSuffix</i> is set to "mm",
32
                /// a distance of 10 units would be displayed as 10"[254.00mm].
33
                /// </para><para>
34
                /// To turn off an established prefix or suffix (or both), set it to a single period (.).
35
                /// </para>
36
                /// </remarks>
37
                [DxfCodeValue(4)]
38
                public string AlternateDimensioningSuffix { get; set; } = "[]";
14,839✔
39

40
                /// <summary>
41
                /// Controls the number of decimal places in alternate units
42
                /// (see DIMALTD System Variable).
43
                /// </summary>
44
                /// <remarks>
45
                /// If <see cref="AlternateUnitDimensioning"/> is turned on (true), <i>AlternateUnitDecimalPlaces</i>
46
                /// specifies the number of digits displayed to the right of the decimal point in the alternate
47
                /// measurement.
48
                /// </remarks>
49
                [DxfCodeValue(171)]
50
                public short AlternateUnitDecimalPlaces { get; set; } = 3;
15,298✔
51

52
                /// <summary>Controls the display of alternate units in dimensions
53
                /// (see DIMALT System Variable).
54
                /// </summary>
55
                /// <value>
56
                /// <b>true</b> enables alternate units; <b>false</b> disables alternate units.
57
                /// </value>
58
                [DxfCodeValue(170)]
59
                public bool AlternateUnitDimensioning { get; set; } = false;
14,842✔
60

61
                /// <summary>
62
                /// Gets or sets the units format for alternate units of all dimension sub-styles
63
                /// except Angular
64
                /// (see DIMALTU System Variable).
65
                /// </summary>
66
                [DxfCodeValue(273)]
67
                public LinearUnitFormat AlternateUnitFormat { get; set; } = LinearUnitFormat.Decimal;
14,571✔
68

69
                /// <summary>
70
                /// Rounds off the alternate dimension units
71
                /// (see DIMALTRND System Variable).
72
                /// </summary>
73
                [DxfCodeValue(148)]
74
                public double AlternateUnitRounding { get; set; } = 0.0d;
14,417✔
75

76
                /// <summary>
77
                /// Controls the multiplier for alternate units
78
                /// (see DIMALTF System Variable).
79
                /// </summary>
80
                /// <remarks>
81
                /// If <see cref="AlternateUnitDimensioning"/> is turned on (true), the value of this
82
                /// property (AlternateUnitScaleFactor) multiplies linear dimensions by a factor to produce
83
                /// a value in an alternate system of measurement. The initial value represents the number
84
                /// of millimeters in an inch.
85
                /// </remarks>
86
                [DxfCodeValue(143)]
87
                public double AlternateUnitScaleFactor { get; set; } = 25.4;
15,298✔
88

89
                /// <summary>
90
                /// Gets or sets the number of decimal places for the tolerance values in the alternate
91
                /// units of a dimension
92
                /// (see DIMALTTD System Variable).
93
                /// </summary>
94
                [DxfCodeValue(274)]
95
                public short AlternateUnitToleranceDecimalPlaces { get; set; } = 3;
15,030✔
96

97
                /// <summary>
98
                /// Controls suppression of zeros in tolerance values
99
                /// (see DIMALTTZ System Variable).
100
                /// </summary>
101
                [DxfCodeValue(286)]
102
                public ZeroHandling AlternateUnitToleranceZeroHandling { get; set; } = ZeroHandling.SuppressZeroFeetAndInches;
14,571✔
103

104
                /// <summary>
105
                /// Controls the suppression of zeros for alternate unit dimension values
106
                /// (see DIMALTZ System Variable).
107
                /// </summary>
108
                [DxfCodeValue(285)]
109
                public ZeroHandling AlternateUnitZeroHandling { get; set; } = ZeroHandling.SuppressZeroFeetAndInches;
14,571✔
110

111
                /// <summary>
112
                /// Controls the number of precision places displayed in angular dimensions
113
                /// (see DIMADEC System Variable).
114
                /// </summary>
115
                /// <value><para>
116
                /// <b>-1</b>: Angular dimensions display the number of decimal places specified by
117
                /// the <see cref="DecimalPlaces"/> property
118
                /// </para><para>
119
                /// <b>0-8</b>: Specifies the number of decimal places displayed in angular dimensions
120
                /// (independent of the value of the <see cref="DecimalPlaces"/> property).
121
                /// </para>
122
                /// </value>
123
                [DxfCodeValue(179)]
124
                public short AngularDimensionDecimalPlaces { get; set; } = 0;
14,447✔
125

126
                /// <summary>
127
                /// Gets or sets the units format for angular dimensions
128
                /// (see DIMAUNIT System Variable).
129
                /// </summary>
130
                [DxfCodeValue(275)]
131
                public AngularUnitFormat AngularUnit { get; set; } = AngularUnitFormat.DecimalDegrees;
14,541✔
132

133
                /// <summary>
134
                /// Suppresses zeros for angular dimensions
135
                /// (see DIMAZIN System Variable).
136
                /// </summary>
137
                [DxfCodeValue(79)]
138
                public ZeroHandling AngularZeroHandling { get; set; } = ZeroHandling.SuppressZeroFeetAndInches;
14,414✔
139

140
                /// <summary>
141
                /// Controls display of the arc symbol in an arc length dimension
142
                /// (see DIMARCSYM System Variable).
143
                /// </summary>
144
                [DxfCodeValue(90)]
145
                public ArcLengthSymbolPosition ArcLengthSymbolPosition { get; set; } = ArcLengthSymbolPosition.BeforeDimensionText;
14,192✔
146

147
                /// <summary>
148
                /// Gets or sets the arrowhead block displayed at the ends of dimension lines
149
                /// (see DIMBLK System Variable).
150
                /// </summary>
151
                /// <value>
152
                /// A <see cref="BlockRecord"/> that makes up an arrowhead or null if the default,
153
                /// closed-filled arrowhead is to be displayed.
154
                /// </value>
155
                /// <remarks>
156
                /// <para>
157
                /// Note: Annotative blocks cannot be used as custom arrowheads for dimensions or leaders.
158
                /// </para>
159
                /// </remarks>
160
                [DxfCodeValue(DxfReferenceType.Handle, 342)]
161
                public BlockRecord ArrowBlock
162
                {
163
                        get { return this._dimArrowBlock; }
9,765✔
164
                        set
165
                        {
348✔
166
                                this._dimArrowBlock = this.updateTable(value, this.Document?.BlockRecords);
348✔
167
                        }
348✔
168
                }
169

170
                /// <summary>
171
                /// Controls the size of dimension line and leader line arrowheads. Also controls the
172
                /// size of hook lines
173
                /// (see DIMASZ System Variable).
174
                /// </summary>
175
                [DxfCodeValue(41)]
176
                public double ArrowSize
177
                {
178
                        get { return this._arrowSize; }
690✔
179
                        set
180
                        {
1,982✔
181
                                if (value < 0)
1,982!
182
                                {
×
183
                                        throw new ArgumentOutOfRangeException(nameof(value), value, $"The {nameof(ArrowSize)} must be equals or greater than zero.");
×
184
                                }
185
                                this._arrowSize = value;
1,982✔
186
                        }
1,982✔
187
                }
188

189
                /// <summary>
190
                /// Controls drawing of circle or arc center marks and centerlines by the
191
                /// DIMCENTER, DIMDIAMETER, and DIMRADIUS commands
192
                /// (see DIMCEN System Variable).
193
                /// </summary>
194
                /// <remarks>
195
                /// For DIMDIAMETER and DIMRADIUS, the center mark is drawn only if you place
196
                /// the dimension line outside the circle or arc.
197
                /// </remarks>
198
                /// <value>
199
                /// <para>
200
                /// <b>0</b>
201
                /// </para><para>
202
                /// No center marks or lines are drawn
203
                /// </para><para>
204
                /// <b>&lt;0</b>
205
                /// </para><para>
206
                /// Centerlines are drawn
207
                /// </para><para>
208
                /// <b>&gt;0</b>
209
                /// </para><para>
210
                /// Center marks are drawn
211
                /// </para>
212
                /// </value>
213
                [DxfCodeValue(141)]
214
                public double CenterMarkSize { get; set; } = 2.5;
15,298✔
215

216
                /// <summary>
217
                /// Controls options for user-positioned text
218
                /// (see DIMUPT System Variable).
219
                /// </summary>
220
                /// <value>
221
                /// <para>
222
                /// <b>false</b>: Cursor controls only the dimension line location.
223
                /// </para><para>
224
                /// <b>true</b>: Cursor controls both the text position and the dimension line location,
225
                /// </para>
226
                /// </value>
227
                [DxfCodeValue(288)]
228
                public bool CursorUpdate { get; set; } = false;
14,574✔
229

230
                /// <summary>
231
                /// Gets or sets the number of decimal places displayed for the primary
232
                /// units of a dimension
233
                /// (see DIMDEC System Variable).
234
                /// </summary>
235
                [DxfCodeValue(271)]
236
                public short DecimalPlaces { get; set; } = 2;
15,030✔
237

238
                /// <summary>
239
                /// Specifies a single-character decimal separator to use when creating dimensions whose unit
240
                /// format is decimal
241
                /// (see DIMDSEP System Variable).
242
                /// </summary>
243
                /// <remarks>
244
                /// When prompted, enter a single character at the Command prompt. If dimension units is set
245
                /// to Decimal, the <i>DecimalSeparator</i> character is used instead of the default decimal point.
246
                /// If <i>DecimalSeparator</i> is set to NULL (default value), the decimal point is used as
247
                /// the dimension separator.
248
                /// </remarks>
249
                [DxfCodeValue(278)]
250
                public char DecimalSeparator { get; set; } = '.';
14,873✔
251

252
                /// <summary>
253
                /// Gets or sets the arrowhead for the first end of the dimension line when
254
                /// <see cref="SeparateArrowBlocks"/> is on (true)
255
                /// (see DIMBLK1 System Variable).
256
                /// </summary>
257
                /// <value>
258
                /// A <see cref="BlockRecord"/> that makes up an arrowhead or null if the default,
259
                /// closed-filled arrowhead is to be displayed.
260
                /// </value>
261
                /// <remarks>
262
                /// <para>
263
                /// Note: Annotative blocks cannot be used as custom arrowheads for dimensions or leaders.
264
                /// </para>
265
                /// </remarks>
266
                [DxfCodeValue(DxfReferenceType.Handle, 343)]
267
                public BlockRecord DimArrow1
268
                {
269
                        get { return this._dimArrow1; }
9,765✔
270
                        set
271
                        {
348✔
272
                                this._dimArrow1 = this.updateTable(value, this.Document?.BlockRecords);
348✔
273
                        }
348✔
274
                }
275

276
                /// <summary>
277
                /// Gets or sets the arrowhead for the first end of the dimension line when
278
                /// <see cref="SeparateArrowBlocks"/> is on (true)
279
                /// (see DIMBLK2 System Variable).
280
                /// </summary>
281
                /// <value>
282
                /// A <see cref="BlockRecord"/> that makes up an arrowhead or null if the default,
283
                /// closed-filled arrowhead is to be displayed.
284
                /// </value>
285
                /// <remarks>
286
                /// <para>
287
                /// Note: Annotative blocks cannot be used as custom arrowheads for dimensions or leaders.
288
                /// </para>
289
                /// </remarks>
290
                [DxfCodeValue(DxfReferenceType.Handle, 344)]
291
                public BlockRecord DimArrow2
292
                {
293
                        get { return this._dimArrow2; }
9,765✔
294
                        set
295
                        {
348✔
296
                                this._dimArrow2 = this.updateTable(value, this.Document?.BlockRecords);
348✔
297
                        }
348✔
298
                }
299

300
                /// <summary>
301
                /// Determines how dimension text and arrows are arranged when space is not sufficient to
302
                /// place both within the extension lines.
303
                /// (see DIMFIT System Variable).
304
                /// </summary>
305
                [DxfCodeValue(287)]
306
                public short DimensionFit { get; set; }
1,046✔
307

308
                /// <summary>
309
                /// Gets or sets colors to dimension lines, arrowheads, and dimension leader lines
310
                /// (see DIMCLRD System Variable).
311
                /// </summary>
312
                /// <remarks>
313
                /// Also controls the color of leader lines created with the LEADER command.
314
                /// </remarks>
315
                [DxfCodeValue(176)]
316
                public Color DimensionLineColor { get; set; } = Color.ByBlock;
15,303✔
317

318
                /// <summary>
319
                /// Sets the distance the dimension line extends beyond the extension line when
320
                /// oblique strokes are drawn instead of arrowheads.
321
                /// (see DIMDLE System Variable).
322
                /// </summary>
323
                [DxfCodeValue(46)]
324
                public double DimensionLineExtension { get; set; } = 0.0d;
14,842✔
325

326
                /// <summary>
327
                /// Gets or sets the distance around the dimension text when the dimension line breaks to
328
                /// accommodate dimension text
329
                /// (see DIMGAP System Variable).
330
                /// </summary>
331
                /// <remarks>
332
                /// <para>
333
                /// Also sets the gap between annotation and a hook line created with the LEADER command.
334
                /// If you enter a negative value, <i>DimensionLineGap</i> places a box around the dimension text.
335
                /// </para><para>
336
                /// The value of <i>DimensionLineGap</i> is also used as the minimum length of each segment
337
                /// of the dimension line. To locate the components of a linear dimension within the extension
338
                /// lines, enough space must be available for both arrowheads (2 x <see cref="ArrowSize"/>),
339
                /// both dimension line segments (2 x <i>DimensionLineGap</i>), a gap on either side of the
340
                /// dimension text (another 2 x <i>DimensionLineGap</i>), and the length of the dimension text,
341
                /// which depends on its size and number of decimal places displayed.
342
                /// </para>
343
                /// </remarks>
344
                [DxfCodeValue(147)]
345
                public double DimensionLineGap { get; set; } = 0.6250;
15,317✔
346

347
                /// <summary>
348
                /// Controls the spacing of the dimension lines in baseline dimensions
349
                /// (see DIMDLI System Variable).
350
                /// </summary>
351
                /// <remarks>
352
                /// Each dimension line is offset from the previous one by this amount, if necessary,
353
                /// to avoid drawing over it. Changes made with <i>DimensionLineIncrement</i> are
354
                /// not applied to existing dimensions.
355
                /// </remarks>
356
                [DxfCodeValue(43)]
357
                public double DimensionLineIncrement { get; set; } = 3.75d;
15,298✔
358

359
                /// <summary>
360
                /// Assigns line weight to dimension lines
361
                /// (see DIMLWD System Variable).
362
                /// </summary>
363
                /// <value>
364
                /// Positive values represent line weight in hundredths of millimeters.
365
                /// (Multiply a value by 2540 to convert values from inches to hundredths of millimeters.)
366
                /// </value>
367
                [DxfCodeValue(371)]
368
                public LineweightType DimensionLineWeight { get; set; } = LineweightType.ByBlock;
14,642✔
369

370
                /// <summary>
371
                /// Determines how dimension text and arrows are arranged when space is not sufficient
372
                /// to place both within the extension lines.
373
                /// (see DIMATFIT System Variable).
374
                /// </summary>
375
                /// <remarks>
376
                /// A leader is added to moved dimension text when <see cref="TextMovement"/> is set to
377
                /// <see cref="TextMovement.AddLeaderWhenTextMoved"/>.
378
                /// </remarks>
379
                [DxfCodeValue(289)]
380
                public TextArrowFitType DimensionTextArrowFit { get; set; } = TextArrowFitType.BestFit;
13,671✔
381

382
                //Obsolete in the documentation
383
                /// <summary>
384
                /// DIMUNIT (obsolete, now use DIMLUNIT AND DIMFRAC)
385
                /// </summary>
386
                [DxfCodeValue(270)]
387
                public short DimensionUnit { get; set; } = 2;
13,246✔
388

389
                /// <summary>
390
                /// Gets or sets colors to extension lines, center marks, and centerlines
391
                /// (see DIMCLRE System Variable).
392
                /// </summary>
393
                [DxfCodeValue(177)]
394
                public Color ExtensionLineColor { get; set; } = Color.ByBlock;
15,303✔
395

396
                /// <summary>
397
                /// Specifies how far to extend the extension line beyond the dimension line
398
                /// (see DIMEXE System Variable).
399
                /// </summary>
400
                [DxfCodeValue(44)]
401
                public double ExtensionLineExtension { get; set; } = 1.2500d;
15,298✔
402

403
                /// <summary>
404
                /// Specifies how far extension lines are offset from origin points
405
                /// (see DIMEXO System Variable).
406
                /// </summary>
407
                /// <remarks>
408
                /// With fixed-length extension lines, this value determines the minimum offset.
409
                /// </remarks>
410
                [DxfCodeValue(42)]
411
                public double ExtensionLineOffset { get; set; } = 0.6250d;
15,298✔
412

413
                /// <summary>
414
                /// Assigns line weight to extension lines
415
                /// (see DIMLWE System Variable).
416
                /// </summary>
417
                /// <value>
418
                /// Positive values represent line weight in hundredths of millimeters.
419
                /// (Multiply a value by 2540 to convert values from inches to hundredths of millimeters.)
420
                /// </value>
421
                [DxfCodeValue(372)]
422
                public LineweightType ExtensionLineWeight { get; set; } = LineweightType.ByBlock;
14,414✔
423

424
                /// <summary>
425
                /// Sets the total length of the extension lines starting from the dimension line
426
                /// toward the dimension origin
427
                /// (see DIMFXL System Variable).
428
                /// </summary>
429
                [DxfCodeValue(49)]
430
                public double FixedExtensionLineLength { get; set; } = 1.0d;
14,033✔
431

432
                /// <summary>
433
                /// Gets or sets the fraction format when <see cref="LinearUnitFormat"/> is set to 4 (Architectural) or 5 (Fractional).
434
                /// (see DIMFRAC System Variable).
435
                /// </summary>
436
                [DxfCodeValue(276)]
437
                public FractionFormat FractionFormat { get; set; } = FractionFormat.Horizontal;
14,414✔
438

439
                /// <summary>
440
                /// Appends tolerances to dimension text
441
                /// (see DIMTOL System Variable).
442
                /// </summary>
443
                /// <remarks>
444
                /// Setting <i>GenerateTolerances</i> to on (true) turns <see cref="LimitsGeneration"/> off (false).
445
                /// </remarks>
446
                [DxfCodeValue(71)]
447
                public bool GenerateTolerances { get; set; } = false;
14,842✔
448

449
                /// <summary>
450
                /// Controls whether extension lines are set to a fixed length
451
                /// (see DIMFXLON System Variable).
452
                /// </summary>
453
                /// <value>
454
                /// <b>true</b> when extension lines are set to the length specified by
455
                /// <see cref="FixedExtensionLineLength"/>; otherwise, <b>false</b>.
456
                /// </value>
457
                [DxfCodeValue(290)]
458
                public bool IsExtensionLineLengthFixed { get; set; } = false;
14,033✔
459

460
                /// <summary>
461
                /// Determines the angle of the transverse segment of the dimension line in a jogged radius dimension in radians.
462
                /// (see DIMJOGANG System Variable).
463
                /// </summary>
464
                /// <value>
465
                /// Jogged radius dimensions are often created when the center point is located off the page. Valid settings range is 5 to 90 degrees.
466
                /// </value>
467
                [DxfCodeValue(DxfReferenceType.IsAngle, 50)]
468
                public double JoggedRadiusDimensionTransverseSegmentAngle
469
                {
470
                        get
471
                        {
198✔
472
                                return _joggedRadiusDimensionTransverseSegmentAngle;
198✔
473
                        }
198✔
474
                        set
475
                        {
749✔
476
                                //5 - 90
477
                                if (value < CSMath.MathHelper.DegToRad(5) || value > Math.PI / 2)
749!
UNCOV
478
                                {
×
UNCOV
479
                                        throw new ArgumentOutOfRangeException(nameof(value), value, $"The {nameof(JoggedRadiusDimensionTransverseSegmentAngle)} must be in range of 5 to 90 degrees.");
×
480
                                }
481

482
                                _joggedRadiusDimensionTransverseSegmentAngle = value;
749✔
483
                        }
749✔
484
                }
485

486
                /// <summary>
487
                /// Specifies the arrow type for leaders
488
                /// (see DIMLDRBLK System Variable).
489
                /// </summary>
490
                /// <value>
491
                /// A <see cref="BlockRecord"/> that makes up an arrowhead or null if the default,
492
                /// closed-filled arrowhead is to be displayed.
493
                /// </value>
494
                /// <remarks>
495
                /// Note: Annotative blocks cannot be used as custom arrowheads for dimensions or leaders.
496
                /// </remarks>
497
                [DxfCodeValue(DxfReferenceType.Handle, 341)]
498
                public BlockRecord LeaderArrow
499
                {
500
                        get { return this._leaderArrow; }
9,744✔
501
                        set
502
                        {
348✔
503
                                this._leaderArrow = this.updateTable(value, this.Document?.BlockRecords);
348✔
504
                        }
348✔
505
                }
506

507
                /// <summary>
508
                /// Generates dimension limits as the default text
509
                /// (see DIMLIM System Variable).
510
                /// </summary>
511
                /// <remarks>
512
                /// Setting <i>LimitsGeneration</i> to on (true) turns <see cref="GenerateTolerances"/> off (false).
513
                /// </remarks>
514
                [DxfCodeValue(72)]
515
                public bool LimitsGeneration { get; set; } = false;
14,842✔
516

517
                /// <summary>
518
                /// Sets a scale factor for linear dimension measurements
519
                /// (see DIMLFAC System Variable).
520
                /// </summary>
521
                /// <remarks>
522
                /// <para>
523
                /// All linear dimension distances, including radii, diameters, and coordinates, are multiplied
524
                /// by this <i>LinearScaleFactor</i> before being converted to dimension text.
525
                /// Positive values of <i>LinearScaleFactor</i> are applied to dimensions in both model space and
526
                /// paper space; negative values are applied to paper space only.
527
                /// </para><para>
528
                /// <i>LinearScaleFactor</i> applies primarily to non-associative dimensions (DIMASSOC set 0 or 1).
529
                /// For non-associative dimensions in paper space, <i>LinearScaleFactor</i> must be set individually
530
                /// for each layout viewport to accommodate viewport scaling.
531
                /// </para><para>
532
                /// <i>LinearScaleFactor</i> has no effect on angular dimensions, and is not applied to the values held in
533
                /// <see cref="Rounding"/>, <see cref="MinusTolerance"/>, or <see cref="PlusTolerance"/>.
534
                /// </para>
535
                /// </remarks>
536
                [DxfCodeValue(144)]
537
                public double LinearScaleFactor { get; set; } = 1.0;
14,842✔
538

539
                /// <summary>
540
                /// Gets or sets units for all dimension types except Angular
541
                /// (see DIMLUNIT System Variable).
542
                /// </summary>
543
                [DxfCodeValue(277)]
544
                public LinearUnitFormat LinearUnitFormat { get; set; } = LinearUnitFormat.Decimal;
14,414✔
545

546
                /// <summary>
547
                /// Line type for the main line of the dimension.
548
                /// </summary>
549
                [DxfCodeValue(DxfReferenceType.Handle, 345)]
550
                public LineType LineType
551
                {
552
                        get { return this._lineType; }
9,219✔
553
                        set
554
                        {
566✔
555
                                this._lineType = this.updateTable(value, this.Document?.LineTypes);
566✔
556
                        }
566✔
557
                }
558

559
                /// <summary>
560
                /// Line type for the extension line 1.
561
                /// </summary>
562
                [DxfCodeValue(DxfReferenceType.Handle, 346)]
563
                public LineType LineTypeExt1
564
                {
565
                        get { return this._lineTypeExt1; }
9,219✔
566
                        set
567
                        {
566✔
568
                                this._lineTypeExt1 = this.updateTable(value, this.Document?.LineTypes);
566✔
569
                        }
566✔
570
                }
571

572
                /// <summary>
573
                /// Line type for the extension line 2.
574
                /// </summary>
575
                [DxfCodeValue(DxfReferenceType.Handle, 347)]
576
                public LineType LineTypeExt2
577
                {
578
                        get { return this._lineTypeExt2; }
9,219✔
579
                        set
580
                        {
566✔
581
                                this._lineTypeExt2 = this.updateTable(value, this.Document?.LineTypes);
566✔
582
                        }
566✔
583
                }
584

585
                /// <summary>
586
                /// Gets or sets the minimum (or lower) tolerance limit for dimension text when
587
                /// <see cref="GenerateTolerances"/> or <see cref="LimitsGeneration"/> is on (true).
588
                /// (see DIMTM System Variable).
589
                /// </summary>
590
                /// <remarks>
591
                /// <para>
592
                /// <i>MinusTolerance</i> accepts signed values. If <see cref="GenerateTolerances"/> is on
593
                /// and <see cref="PlusTolerance"/> and <i>MinusTolerance</i> are set to the same value,
594
                /// a tolerance value is drawn.
595
                /// </para><para>
596
                /// If <i>MinusTolerance</i> and <see cref="PlusTolerance"/> values differ, the upper
597
                /// tolerance is drawn above the lower, and a plus sign is added to the <see cref="PlusTolerance"/>
598
                /// value if it is positive.
599
                /// </para><para>
600
                /// For <i>MinusTolerance</i>, the program uses the negative of the value you enter
601
                /// (adding a minus sign if you specify a positive number and a plus sign if you specify a negative
602
                /// number).
603
                /// </para>
604
                /// </remarks>
605
                [DxfCodeValue(48)]
606
                public double MinusTolerance { get; set; } = 0.0d;
14,842✔
607

608
                /// <inheritdoc/>
609
                public override string ObjectName => DxfFileToken.TableDimstyle;
162✔
610

611
                /// <inheritdoc/>
612
                public override ObjectType ObjectType => ObjectType.DIMSTYLE;
76✔
613

614
                /// <summary>
615
                /// Gets or sets the maximum (or upper) tolerance limit for dimension text when
616
                /// <see cref="GenerateTolerances"/> or <see cref="LimitsGeneration"/> is on (true)
617
                /// (see DIMTP System Variable).
618
                /// </summary>
619
                [DxfCodeValue(47)]
620
                public double PlusTolerance { get; set; } = 0.0d;
14,842✔
621

622
                /// <summary>
623
                /// Specifies a text prefix or suffix (or both) to the dimension measurement
624
                /// (see DIMPOST System Variable).
625
                /// </summary>
626
                /// <remarks><para>
627
                /// For example, to establish a suffix for millimeters, set <i>PostFix</i> to mm;
628
                /// a distance of 19.2 units would be displayed as 19.2 mm.
629
                /// </para><para>
630
                /// If tolerances are turned on, the suffix is applied to the tolerances
631
                /// as well as to the main dimension.
632
                /// </para><para>
633
                /// Use &lt;&gt; to indicate placement of the text in relation to the dimension value.
634
                /// For example, enter &lt;&gt; mm to display a 5.0 millimeter radial dimension as "5.0mm".
635
                /// If you entered mm &lt;&gt;, the dimension would be displayed as "mm 5.0". Use the &lt;&gt;
636
                /// mechanism for angular dimensions.
637
                /// </para>
638
                /// </remarks>
639
                [DxfCodeValue(3)]
640
                public string PostFix { get; set; } = "<>";
14,839✔
641

642
                /// <summary>
643
                /// Rounds all dimensioning distances to the specified value
644
                /// (see DIMRND System Variable).
645
                /// </summary>
646
                /// <remarks>
647
                /// <para>
648
                /// For instance, if <i>Rounding</i> is set to 0.25, all distances round
649
                /// to the nearest 0.25 unit. If you set the value to 1.0, all distances round to the
650
                /// nearest integer.
651
                /// </para><para>
652
                /// Note that the number of digits edited after the decimal point depends on the
653
                /// precision set by <see cref="DecimalPlaces"/>.
654
                /// </para><para>
655
                /// This  does not apply to angular dimensions.
656
                /// </para>
657
                /// </remarks>
658
                [DxfCodeValue(45)]
659
                public double Rounding { get; set; } = 0.0d;
14,842✔
660

661
                /// <summary>
662
                /// Gets or sets the overall scale factor applied to dimensioning variables that specify
663
                /// sizes, distances, or offsets
664
                /// (see DIMSCALE System Variable).
665
                /// </summary>
666
                /// <remarks>
667
                /// <para>
668
                /// This ScaleFactor does not affect measured lengths, coordinates, or angles.
669
                /// </para><para>
670
                /// Use <i>ScaleFactor</i> to control the overall scale of dimensions. However, if the current
671
                /// dimension style is annotative, <i>ScaleFactor</i> is automatically set to zero and the
672
                /// dimension scale is controlled by the CANNOSCALE system variable. <i>ScaleFactor</i> cannot
673
                /// be set to a non-zero value when using annotative dimensions.
674
                /// </para><para>
675
                /// Also affects the leader objects with the LEADER command.
676
                /// </para><para>
677
                /// Use MLEADERSCALE to scale multileader objects created with the MLEADER command.
678
                /// </para>
679
                /// </remarks>
680
                /// <value>
681
                /// <para>
682
                /// <b>0.0</b>
683
                /// </para><para>
684
                /// A reasonable default value is computed based on the scaling between the current
685
                /// model space viewport and paper space. If you are in paper space or model space
686
                /// and not using the paper space feature, the scale factor is 1.0.
687
                /// </para><para>
688
                /// <b>&gt;0</b>
689
                /// </para><para>
690
                /// A scale factor is computed that leads text sizes, arrowhead sizes, and other scaled
691
                /// distances to plot at their face values.
692
                /// </para>
693
                /// </value>
694
                [DxfCodeValue(40)]
695
                public double ScaleFactor
696
                {
697
                        get => _scaleFactor; set
230✔
698
                        {
1,984✔
699
                                if (value < 0)
1,984!
700
                                {
×
701
                                        throw new ArgumentOutOfRangeException(nameof(value), value, $"The {nameof(ScaleFactor)} must be equals or greater than zero.");
×
702
                                }
703

704
                                _scaleFactor = value;
1,984✔
705
                        }
1,984✔
706
                }
707

708
                /// <summary>
709
                /// Controls the display of dimension line arrowhead blocks
710
                /// (see DIMSAH System Variable).
711
                /// </summary>
712
                /// <value>
713
                /// <b>true</b> if arrowhead blocks set by <see cref="DimArrow1"/> and <see cref="DimArrow2"/>
714
                /// shall be used;
715
                /// <b>false</b> if arrowhead block set by <see cref="ArrowBlock"/> shall be used.
716
                /// </value>
717
                [DxfCodeValue(173)]
718
                public bool SeparateArrowBlocks { get; set; } = true;
14,842✔
719

720
                /// <summary>
721
                /// Specifies the text style of the dimension
722
                /// (see DIMTXSTY System Variable).
723
                /// </summary>
724
                [DxfCodeValue(DxfReferenceType.Handle, 340)]
725
                public TextStyle Style
726
                {
727
                        get { return this._style; }
9,783✔
728
                        set
729
                        {
2,474✔
730
                                if (value == null)
2,474!
731
                                {
×
732
                                        throw new ArgumentNullException(nameof(value));
×
733
                                }
734

735
                                this._style = this.updateTable(value, this.Document?.TextStyles);
2,474✔
736
                        }
2,474✔
737
                }
738

739
                /// <inheritdoc/>
740
                public override string SubclassMarker => DxfSubclassMarker.DimensionStyle;
33,635✔
741

742
                /// <summary>
743
                /// Controls suppression of the first dimension line and arrowhead
744
                /// (see DIMSD1 System Variable).
745
                /// </summary>
746
                /// <value>
747
                /// <b>true</b> if the first dimension line is to be suppressed; otherwise, <b>false</b>.
748
                /// </value>
749
                [DxfCodeValue(281)]
750
                public bool SuppressFirstDimensionLine { get; set; } = false;
14,405✔
751

752
                /// <summary>
753
                /// Suppresses display of the first extension line
754
                /// (see DIMSE1 System Variable).
755
                /// </summary>
756
                /// <value><b>true</b> if the first extension line is to be suppressed; otherwise <b>false</b>.
757
                /// </value>
758
                [DxfCodeValue(75)]
759
                public bool SuppressFirstExtensionLine { get; set; } = false;
15,011✔
760

761
                /// <summary>
762
                /// Suppresses arrowheads if not enough space is available inside the extension lines
763
                /// (see DIMSOXD System Variable).
764
                /// </summary>
765
                /// <value>
766
                /// <b>true</b> if arrowheads are to be suppressed; otherwise, <b>false</b>.
767
                /// </value>
768
                [DxfCodeValue(175)]
769
                public bool SuppressOutsideExtensions { get; set; } = false;
14,842✔
770

771
                /// <summary>
772
                /// Controls suppression of the second dimension line and arrowhead
773
                /// (see DIMSD2 System Variable).
774
                /// </summary>
775
                /// <value>
776
                /// <b>true</b> if the second dimension line is to be suppressed; otherwise, <b>false</b>.
777
                /// </value>
778
                [DxfCodeValue(282)]
779
                public bool SuppressSecondDimensionLine { get; set; } = false;
14,405✔
780

781
                /// <summary>
782
                /// Suppresses display of the second extension line
783
                /// (see DIMSE2 System Variable).
784
                /// </summary>
785
                /// <value><b>true</b> if the second extension line is to be suppressed; otherwise <b>false</b>.
786
                /// </value>
787
                [DxfCodeValue(76)]
788
                public bool SuppressSecondExtensionLine { get; set; } = false;
15,011✔
789

790
                /// <summary>
791
                /// Sets the color for the text background in dimensions.
792
                /// (see DIMTFILLCLR System Variable).
793
                /// </summary>
794
                //[DxfCodeValue(70)]        //Not present in the dxf documentation
795
                public Color TextBackgroundColor { get; set; } = Color.ByBlock;
13,879✔
796

797
                /// <summary>
798
                /// Controls the background of dimension text
799
                /// (see DIMTFILL System Variable).
800
                /// </summary>
801
                [DxfCodeValue(69)]
802
                public DimensionTextBackgroundFillMode TextBackgroundFillMode { get; set; } = DimensionTextBackgroundFillMode.NoBackground;
14,186✔
803

804
                /// <summary>
805
                /// Assigns colors to dimension text
806
                /// (see DIMCLRT System Variable).
807
                /// </summary>
808
                /// <remarks>
809
                /// The color can be any valid color number.
810
                /// </remarks>
811
                [DxfCodeValue(178)]
812
                public Color TextColor { get; set; } = Color.ByBlock;
15,075✔
813

814
                /// <summary>
815
                /// Specifies the reading direction of the dimension text
816
                /// (see DIMTXTDIRECTION System Variable).
817
                /// </summary>
818
                [DxfCodeValue(295)]
819
                public TextDirection TextDirection { get; set; } = TextDirection.LeftToRight;
13,675✔
820

821
                /// <summary>
822
                /// Specifies the height of dimension text, unless the current text style has a fixed height
823
                /// (see DIMTXT System Variable).
824
                /// </summary>
825
                [DxfCodeValue(140)]
826
                public double TextHeight
827
                {
828
                        get { return _textHeight; }
690✔
829
                        set
830
                        {
1,982✔
831
                                if (value <= 0)
1,982!
832
                                {
×
833
                                        throw new ArgumentOutOfRangeException(nameof(value), value, $"The {nameof(TextHeight)} must be greater than zero.");
×
834
                                }
835

836
                                _textHeight = value;
1,982✔
837
                        }
1,982✔
838
                }
839

840
                /// <summary>
841
                /// Controls the horizontal positioning of dimension text
842
                /// (see DIMJUST System Variable).
843
                /// </summary>
844
                [DxfCodeValue(280)]
845
                public DimensionTextHorizontalAlignment TextHorizontalAlignment { get; set; } = DimensionTextHorizontalAlignment.Centered;
14,571✔
846

847
                /// <summary>
848
                /// Draws text between extension lines
849
                /// (see DIMTIX System Variable).
850
                /// </summary>
851
                /// <value><para>
852
                /// <b>false</b>: For linear and angular dimensions, dimension text is placed
853
                /// inside the extension lines if there is sufficient room.
854
                /// </para><para>
855
                /// <b>true</b>: Draws dimension text between the extension lines even if it
856
                /// would ordinarily be placed outside those lines.
857
                /// For radius and diameter dimensions, TextInsideExtensions on (true) always forces
858
                /// the dimension text outside the circle or arc.
859
                /// </para>
860
                /// </value>
861
                [DxfCodeValue(174)]
862
                public bool TextInsideExtensions { get; set; } = false;
14,842✔
863

864
                /// <summary>
865
                /// Controls the position of dimension text inside the extension lines for all
866
                /// dimension types except Ordinate.
867
                /// (see DIMTIH System Variable).
868
                /// </summary>
869
                /// <value><b>true</b> if the text is to be drawn horizontally;
870
                /// <b>false </b> if the text is to be aligned with the dimension line.</value>
871
                [DxfCodeValue(73)]
872
                public bool TextInsideHorizontal { get; set; } = false;
15,298✔
873

874
                /// <summary>
875
                /// Sets dimension text movement rules
876
                /// (see DIMTMOVE System Variable).
877
                /// </summary>
878
                [DxfCodeValue(279)]
879
                public TextMovement TextMovement { get; set; } = TextMovement.MoveLineWithText;
14,414✔
880

881
                /// <summary>
882
                /// Controls whether a dimension line is drawn between the extension lines even when the text
883
                /// is placed outside.
884
                /// (see DIMTOFL System Variable).
885
                /// </summary>
886
                /// <remarks>
887
                /// For radius and diameter dimensions, a dimension line is drawn inside the circle or arc when the text,
888
                /// arrowheads, and leader are placed outside.
889
                /// </remarks>
890
                /// <value>
891
                /// <para>
892
                /// <b>true</b>: Draws dimension lines between the measured points even when arrowheads are placed
893
                /// outside the measured points
894
                /// </para><para>
895
                /// <b>false</b>: Does not draw dimension lines between the measured points when arrowheads are placed
896
                /// outside the measured points
897
                /// </para>
898
                /// </value>
899
                [DxfCodeValue(172)]
900
                public bool TextOutsideExtensions { get; set; }
2,212✔
901

902
                /// <summary>
903
                /// Controls the position of dimension text outside the extension lines
904
                /// (see DIMTOH System Variable).
905
                /// </summary>
906
                /// <value><b>true</b> if the text is to be drawn horizontally;
907
                /// <b>false </b> if the text is to be aligned with the dimension line.</value>
908
                [DxfCodeValue(74)]
909
                public bool TextOutsideHorizontal { get; set; } = false;
15,298✔
910

911
                /// <summary>
912
                /// Controls the vertical position of text in relation to the dimension line
913
                /// (see DIMTAD System Variable).
914
                /// </summary>
915
                [DxfCodeValue(77)]
916
                public DimensionTextVerticalAlignment TextVerticalAlignment { get; set; } = DimensionTextVerticalAlignment.Above;
15,295✔
917

918
                /// <summary>
919
                /// Controls the vertical position of dimension text above or below the dimension line
920
                /// (see DIMTVP System Variable).
921
                /// </summary>
922
                /// <remarks>
923
                /// The <i>TextVerticalPosition</i> value is used when <see cref="TextVerticalAlignment"/>
924
                /// is off. The magnitude of the vertical offset of text is the product of the text height
925
                /// and <i>TextVerticalPosition</i>. Setting <i>TextVerticalPosition</i> to 1.0 is equivalent
926
                /// to setting <see cref="TextVerticalAlignment"/> to on. The dimension line splits to
927
                /// accommodate the text only if the absolute value of <i>TextVerticalPosition</i> is less than 0.7.
928
                /// </remarks>
929
                [DxfCodeValue(145)]
930
                public double TextVerticalPosition { get; set; } = 0.0d;
14,842✔
931

932
                /// <summary>
933
                /// Specifies the size of oblique strokes drawn instead of arrowheads for linear, radius,
934
                /// and diameter dimensioning
935
                /// (see DIMTSZ System Variable).
936
                /// </summary>
937
                /// <value>
938
                /// <para>
939
                /// <b>0</b>
940
                /// </para><para>
941
                /// Draws arrowheads.
942
                /// </para><para>
943
                /// <b>&gt;0</b>
944
                /// </para><para>
945
                /// Draws oblique strokes instead of arrowheads.
946
                /// The size of the oblique strokes is determined by this value multiplied by the value
947
                /// of <see cref="ScaleFactor"/>.
948
                /// </para>
949
                /// </value>
950
                [DxfCodeValue(142)]
951
                public double TickSize { get; set; } = 0.0d;
14,842✔
952

953
                /// <summary>
954
                /// Gets or sets the vertical justification for tolerance values relative to the nominal dimension text.
955
                /// (see DIMTOLJ System Variable).
956
                /// </summary>
957
                [DxfCodeValue(283)]
958
                public ToleranceAlignment ToleranceAlignment { get; set; } = ToleranceAlignment.Bottom;
15,027✔
959

960
                /// <summary>
961
                /// Gets or sets the number of decimal places to display in tolerance values
962
                /// for the primary units in a dimension
963
                /// (see DIMTDEC System Variable).
964
                /// </summary>
965
                [DxfCodeValue(272)]
966
                public short ToleranceDecimalPlaces { get; set; } = 2;
15,030✔
967

968
                /// <summary>
969
                /// Specifies a scale factor for the text height of fractions and tolerance values relative
970
                /// to the dimension text height, as set by <see cref="TextHeight"/>
971
                /// (see DIMTFAC System Variable).
972
                /// </summary>
973
                /// <remarks>
974
                /// For example, if <i>ToleranceScaleFactor</i> is set to 1.0, the text height of fractions and
975
                /// tolerances is the same height as the dimension text. If <i>ToleranceScaleFactor</i> is set
976
                /// to 0.7500, the text height of fractions and tolerances is three-quarters the size of
977
                /// dimension text.
978
                /// </remarks>
979
                [DxfCodeValue(146)]
980
                public double ToleranceScaleFactor { get; set; } = 1.0;
14,842✔
981

982
                /// <summary>
983
                /// Controls the suppression of zeros in tolerance values
984
                /// (see DIMTZIN System Variable).
985
                /// </summary>
986
                /// <remarks>
987
                /// Value 0-3 affect feet-and-inch dimensions only.
988
                /// </remarks>
989
                [DxfCodeValue(284)]
990
                public ZeroHandling ToleranceZeroHandling { get; set; } = ZeroHandling.SuppressDecimalTrailingZeroes;
15,027✔
991

992
                /// <summary>
993
                /// Controls the suppression of zeros in the primary unit value
994
                /// (see DIMZIN System Variable).
995
                /// </summary>
996
                [DxfCodeValue(78)]
997
                public ZeroHandling ZeroHandling { get; set; } = ZeroHandling.SuppressDecimalTrailingZeroes;
15,295✔
998

999
                internal double AltMzf { get; set; }
468✔
1000

1001
                internal string AltMzs { get; set; }
468✔
1002

1003
                internal double Mzf { get; set; }
468✔
1004

1005
                internal string Mzs { get; set; }
468✔
1006

1007
                public const string DefaultName = "Standard";
1008

1009
                private double _arrowSize = 0.18;
13,086✔
1010

1011
                private BlockRecord _dimArrow1 = null;
13,086✔
1012

1013
                private BlockRecord _dimArrow2 = null;
13,086✔
1014

1015
                private BlockRecord _dimArrowBlock = null;
13,086✔
1016

1017
                private double _joggedRadiusDimensionTransverseSegmentAngle = System.Math.PI / 4.0;
13,086✔
1018

1019
                private BlockRecord _leaderArrow = null;
13,086✔
1020

1021
                private LineType _lineType;
1022

1023
                private LineType _lineTypeExt1;
1024

1025
                private LineType _lineTypeExt2;
1026

1027
                private double _scaleFactor = 1.0d;
13,086✔
1028

1029
                private TextStyle _style = TextStyle.Default;
13,086✔
1030

1031
                private double _textHeight = 0.18;
13,086✔
1032

1033
                /// <inheritdoc/>
1034
                public DimensionStyle(string name) : base(name)
10,642✔
1035
                {
10,642✔
1036
                }
10,642✔
1037

1038
                internal DimensionStyle() : base()
2,444✔
1039
                {
2,444✔
1040
                }
2,444✔
1041

1042
                /// <inheritdoc/>
1043
                public override CadObject Clone()
1044
                {
338✔
1045
                        DimensionStyle clone = (DimensionStyle)base.Clone();
338✔
1046

1047
                        clone.Style = (TextStyle)this.Style?.Clone();
338!
1048
                        clone.LeaderArrow = (BlockRecord)this.LeaderArrow?.Clone();
338!
1049
                        clone.ArrowBlock = (BlockRecord)this.ArrowBlock?.Clone();
338!
1050
                        clone.DimArrow1 = (BlockRecord)this.DimArrow1?.Clone();
338!
1051
                        clone.DimArrow2 = (BlockRecord)this.DimArrow2?.Clone();
338!
1052
                        clone.LineType = (LineType)this.LineType?.Clone();
338✔
1053
                        clone.LineTypeExt1 = (LineType)this.LineTypeExt1?.Clone();
338✔
1054
                        clone.LineTypeExt2 = (LineType)this.LineTypeExt2?.Clone();
338✔
1055

1056
                        return clone;
338✔
1057
                }
338✔
1058

1059
                internal override void AssignDocument(CadDocument doc)
1060
                {
2,707✔
1061
                        base.AssignDocument(doc);
2,707✔
1062

1063
                        this._style = this.updateTable(this.Style, doc.TextStyles);
2,707✔
1064

1065
                        this._lineType = this.updateTable(this.LineType, doc.LineTypes);
2,707✔
1066
                        this._lineTypeExt1 = this.updateTable(this.LineTypeExt1, doc.LineTypes);
2,707✔
1067
                        this._lineTypeExt2 = this.updateTable(this.LineTypeExt2, doc.LineTypes);
2,707✔
1068

1069
                        this._leaderArrow = this.updateTable(this.LeaderArrow, doc.BlockRecords);
2,707✔
1070
                        this._dimArrow1 = this.updateTable(this.DimArrow1, doc.BlockRecords);
2,707✔
1071
                        this._dimArrow2 = this.updateTable(this.DimArrow2, doc.BlockRecords);
2,707✔
1072
                        this._dimArrowBlock = this.updateTable(this.ArrowBlock, doc.BlockRecords);
2,707✔
1073

1074
                        doc.DimensionStyles.OnRemove += this.tableOnRemove;
2,707✔
1075
                        doc.LineTypes.OnRemove += this.tableOnRemove;
2,707✔
1076
                        doc.BlockRecords.OnRemove += this.tableOnRemove;
2,707✔
1077
                }
2,707✔
1078

1079
                internal override void UnassignDocument()
1080
                {
×
1081
                        this.Document.DimensionStyles.OnRemove -= this.tableOnRemove;
×
1082
                        this.Document.LineTypes.OnRemove -= this.tableOnRemove;
×
1083
                        this.Document.BlockRecords.OnRemove -= this.tableOnRemove;
×
1084

1085
                        base.UnassignDocument();
×
1086

1087
                        this.Style = (TextStyle)this.Style.Clone();
×
1088

1089
                        this.LineType = (LineType)(this.LineType?.Clone());
×
1090
                        this.LineTypeExt1 = (LineType)(this.LineTypeExt1?.Clone());
×
1091
                        this.LineTypeExt2 = (LineType)(this.LineTypeExt2?.Clone());
×
1092

1093
                        this.LeaderArrow = (BlockRecord)(this.LeaderArrow?.Clone());
×
1094
                        this.DimArrow1 = (BlockRecord)(this.DimArrow1?.Clone());
×
1095
                        this.DimArrow2 = (BlockRecord)(this.DimArrow2?.Clone());
×
1096
                        this.ArrowBlock = (BlockRecord)(this.ArrowBlock?.Clone());
×
1097
                }
×
1098

1099
                protected void tableOnRemove(object sender, CollectionChangedEventArgs e)
1100
                {
16✔
1101
                        if (e.Item.Equals(this.Style))
16!
1102
                        {
×
1103
                                this.Style = this.Document.TextStyles[TextStyle.DefaultName];
×
1104
                        }
×
1105

1106
                        if (e.Item is LineType ltype)
16✔
1107
                        {
7✔
1108
                                this.LineType = this.checkRemovedEntry(ltype, this.LineType);
7✔
1109
                                this.LineTypeExt1 = this.checkRemovedEntry(ltype, this.LineTypeExt1);
7✔
1110
                                this.LineTypeExt2 = this.checkRemovedEntry(ltype, this.LineTypeExt2);
7✔
1111
                        }
7✔
1112
                        else if (e.Item is BlockRecord blk)
9✔
1113
                        {
9✔
1114
                                this.LeaderArrow = this.checkRemovedEntry(blk, this.LeaderArrow);
9✔
1115
                                this.DimArrow1 = this.checkRemovedEntry(blk, this.DimArrow1);
9✔
1116
                                this.DimArrow2 = this.checkRemovedEntry(blk, this.DimArrow2);
9✔
1117
                                this.ArrowBlock = this.checkRemovedEntry(blk, this.ArrowBlock);
9✔
1118
                        }
9✔
1119
                }
16✔
1120

1121
                private T checkRemovedEntry<T>(T entry, T original)
1122
                {
57✔
1123
                        if (entry.Equals(original))
57✔
1124
                        {
7✔
1125
                                return default(T);
7✔
1126
                        }
1127
                        else
1128
                        {
50✔
1129
                                return original;
50✔
1130
                        }
1131
                }
57✔
1132
        }
1133
}
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