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

DomCR / ACadSharp / 14305968221

07 Apr 2025 09:41AM UTC coverage: 75.187% (-1.0%) from 76.181%
14305968221

push

github

DomCR
badge fix

5615 of 8186 branches covered (68.59%)

Branch coverage included in aggregate %.

22386 of 29056 relevant lines covered (77.04%)

72281.98 hits per line

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

81.63
/src/ACadSharp/Entities/Shape.cs
1
using ACadSharp.Attributes;
2
using ACadSharp.Tables;
3
using CSMath;
4
using System;
5

6
namespace ACadSharp.Entities
7
{
8
        /// <summary>
9
        /// Represents a <see cref="Shape"/> entity.
10
        /// </summary>
11
        /// <remarks>
12
        /// Object name <see cref="DxfFileToken.EntityShape"/> <br/>
13
        /// Dxf class name <see cref="DxfSubclassMarker.Shape"/>
14
        /// </remarks>
15
        [DxfName(DxfFileToken.EntityShape)]
16
        [DxfSubClass(DxfSubclassMarker.Shape)]
17
        public class Shape : Entity
18
        {
19
                /// <inheritdoc/>
20
                public override ObjectType ObjectType => ObjectType.SHAPE;
1✔
21

22
                /// <inheritdoc/>
23
                public override string ObjectName => DxfFileToken.EntityShape;
39✔
24

25
                /// <inheritdoc/>
26
                public override string SubclassMarker => DxfSubclassMarker.Shape;
2,042✔
27

28
                /// <summary>
29
                /// Thickness.
30
                /// </summary>
31
                [DxfCodeValue(39)]
32
                public double Thickness { get; set; } = 0.0;
541✔
33

34
                /// <summary>
35
                /// Insertion point (in WCS).
36
                /// </summary>
37
                [DxfCodeValue(10, 20, 30)]
38
                public XYZ InsertionPoint { get; set; }
1,593✔
39

40
                /// <summary>
41
                /// Size.
42
                /// </summary>
43
                [DxfCodeValue(40)]
44
                public double Size { get; set; } = 1.0;
779✔
45

46
                /// <summary>
47
                /// Shape name.
48
                /// </summary>
49
                [DxfCodeValue(DxfReferenceType.Name, 2)]
50
                public TextStyle ShapeStyle
51
                {
52
                        get { return this._style; }
87✔
53
                        set
54
                        {
142✔
55
                                if (value == null || !value.IsShapeFile)
142!
56
                                {
×
57
                                        throw new ArgumentNullException(nameof(value));
×
58
                                }
59

60
                                if (this.Document != null)
142✔
61
                                {
133✔
62
                                        this._style = this.updateTable(value, this.Document.TextStyles);
133✔
63
                                }
133✔
64
                                else
65
                                {
9✔
66
                                        this._style = value;
9✔
67
                                }
9✔
68
                        }
142✔
69
                }
70

71
                /// <summary>
72
                /// Rotation angle.
73
                /// </summary>
74
                [DxfCodeValue(DxfReferenceType.IsAngle, 50)]
75
                public double Rotation { get; set; } = 0;
541✔
76

77
                /// <summary>
78
                /// Relative X scale factor.
79
                /// </summary>
80
                [DxfCodeValue(41)]
81
                public double RelativeXScale { get; set; } = 1;
541✔
82

83
                /// <summary>
84
                /// Oblique angle.
85
                /// </summary>
86
                [DxfCodeValue(DxfReferenceType.IsAngle, 51)]
87
                public double ObliqueAngle { get; set; } = 0;
541✔
88

89
                /// <summary>
90
                /// Extrusion direction.
91
                /// </summary>
92
                [DxfCodeValue(210, 220, 230)]
93
                public XYZ Normal { get; set; } = XYZ.AxisZ;
541✔
94

95
                internal ushort ShapeIndex { get; set; }
133✔
96

97
                private TextStyle _style;
98

99
                internal Shape() : base() { }
1,113✔
100

101
                /// <summary>
102
                /// Initializes a shape by the <see cref="TextStyle"/>
103
                /// </summary>
104
                /// <param name="textStyle">Text style with the flag <see cref="TextStyle.IsShapeFile"/></param>
105
                public Shape(TextStyle textStyle)
6✔
106
                {
6✔
107
                        this.ShapeStyle = textStyle;
6✔
108
                }
6✔
109

110
                /// <inheritdoc/>
111
                public override CadObject Clone()
112
                {
3✔
113
                        Shape clone = (Shape)base.Clone();
3✔
114

115
                        clone.ShapeStyle = (TextStyle)(this.ShapeStyle?.Clone());
3!
116

117
                        return clone;
3✔
118
                }
3✔
119

120
                /// <inheritdoc/>
121
                public override BoundingBox GetBoundingBox()
122
                {
1✔
123
                        return new BoundingBox(this.InsertionPoint);
1✔
124
                }
1✔
125

126
                /// <inheritdoc/>
127
                public override void ApplyTransform(Transform transform)
128
                {
×
129
                        this.Normal = this.transformNormal(transform, this.Normal);
×
130
                        this.InsertionPoint = transform.Translate(this.InsertionPoint);
×
131
                }
×
132
        }
133
}
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