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

DomCR / ACadSharp / 19388119560

15 Nov 2025 09:57AM UTC coverage: 78.209% (+0.04%) from 78.169%
19388119560

push

github

web-flow
Merge pull request #874 from DomCR/issue-872_polyline-getboundingbox-curves-fix

issue 872

7403 of 10253 branches covered (72.2%)

Branch coverage included in aggregate %.

22 of 24 new or added lines in 4 files covered. (91.67%)

2 existing lines in 2 files now uncovered.

27637 of 34550 relevant lines covered (79.99%)

98617.41 hits per line

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

57.69
/src/ACadSharp/Entities/LwPolyLine.cs
1
using ACadSharp.Attributes;
2
using ACadSharp.Extensions;
3
using CSMath;
4
using CSUtilities.Extensions;
5
using System.Collections.Generic;
6
using System.Linq;
7

8
namespace ACadSharp.Entities
9
{
10
        /// <summary>
11
        /// Represents a <see cref="LwPolyline"/> entity
12
        /// </summary>
13
        /// <remarks>
14
        /// Object name <see cref="DxfFileToken.EntityLwPolyline"/> <br/>
15
        /// Dxf class name <see cref="DxfSubclassMarker.LwPolyline"/>
16
        /// </remarks>
17
        [DxfName(DxfFileToken.EntityLwPolyline)]
18
        [DxfSubClass(DxfSubclassMarker.LwPolyline)]
19
        public partial class LwPolyline : Entity, IPolyline
20
        {
21
                /// <summary>
22
                /// Constant width
23
                /// </summary>
24
                /// <remarks>
25
                /// Not used if variable width (codes 40 and/or 41) is set
26
                /// </remarks>
27
                [DxfCodeValue(43)]
28
                public double ConstantWidth { get; set; } = 0.0;
13,156✔
29

30
                /// <summary>
31
                /// The current elevation of the object.
32
                /// </summary>
33
                [DxfCodeValue(38)]
34
                public double Elevation { get; set; } = 0.0;
8,831✔
35

36
                /// <summary>
37
                /// Polyline flags.
38
                /// </summary>
39
                [DxfCodeValue(70)]
40
                public LwPolylineFlags Flags { get => _flags; set => _flags = value; }
10,714✔
41

42
                /// <inheritdoc/>
43
                public bool IsClosed
44
                {
45
                        get
46
                        {
47✔
47
                                return this.Flags.HasFlag(LwPolylineFlags.Closed);
47✔
48
                        }
47✔
49
                        set
50
                        {
20✔
51
                                if (value)
20✔
52
                                {
9✔
53
                                        _flags.AddFlag(LwPolylineFlags.Closed);
9✔
54
                                }
9✔
55
                                else
56
                                {
11✔
57
                                        _flags.RemoveFlag(LwPolylineFlags.Closed);
11✔
58
                                }
11✔
59
                        }
20✔
60
                }
61

62
                /// <summary>
63
                /// Specifies the three-dimensional normal unit vector for the object.
64
                /// </summary>
65
                [DxfCodeValue(210, 220, 230)]
66
                public XYZ Normal { get; set; } = XYZ.AxisZ;
8,840✔
67

68
                /// <inheritdoc/>
69
                public override string ObjectName => DxfFileToken.EntityLwPolyline;
22,603✔
70

71
                /// <inheritdoc/>
72
                public override ObjectType ObjectType => ObjectType.LWPOLYLINE;
9✔
73

74
                /// <inheritdoc/>
75
                public override string SubclassMarker => DxfSubclassMarker.LwPolyline;
38,450✔
76

77
                /// <summary>
78
                /// Specifies the distance a 2D object is extruded above or below its elevation.
79
                /// </summary>
80
                [DxfCodeValue(39)]
81
                public double Thickness { get; set; } = 0.0;
8,840✔
82

83
                /// <summary>
84
                /// Vertices that form this LwPolyline
85
                /// </summary>
86
                [DxfCodeValue(DxfReferenceType.Count, 90)]
87
                public List<Vertex> Vertices { get; private set; } = new List<Vertex>();
149,681✔
88

89
                /// <inheritdoc/>
90
                IEnumerable<IVertex> IPolyline.Vertices { get { return this.Vertices; } }
3,138✔
91

92
                private LwPolylineFlags _flags;
93

94
                /// <inheritdoc/>
95
                public LwPolyline() : base() { }
24,684✔
96

97
                /// <summary>
98
                /// Initializes a new instance of the <see cref="LwPolyline"/> class with the specified vertices.
99
                /// </summary>
100
                /// <remarks>The provided <paramref name="vertices"/> are added to the polyline in the order they appear in
101
                /// the collection.</remarks>
102
                /// <param name="vertices">A collection of <see cref="Vertex"/> objects that define the vertices of the polyline.</param>
103
                public LwPolyline(params IEnumerable<Vertex> vertices)
×
104
                {
×
105
                        this.Vertices.AddRange(vertices);
×
106
                }
×
107

108
                /// <summary>
109
                /// Initializes a new instance of the <see cref="LwPolyline"/> class with the specified vertices.
110
                /// </summary>
111
                /// <remarks>This constructor allows you to create a lightweight polyline by specifying its vertices as a
112
                /// collection of <see cref="XY"/> points. The vertices are internally converted to <see cref="Vertex"/>
113
                /// objects.</remarks>
114
                /// <param name="vertices">A collection of <see cref="XY"/> points representing the vertices of the polyline. Each point defines a vertex in
115
                /// the order it appears in the collection.</param>
116
                public LwPolyline(params IEnumerable<XY> vertices)
117
                        : this(vertices.Select(v => new Vertex(v))) { }
×
118

119
                /// <inheritdoc/>
120
                public override void ApplyTransform(Transform transform)
121
                {
×
122
                        var newNormal = this.transformNormal(transform, this.Normal);
×
123

124
                        this.getWorldMatrix(transform, this.Normal, newNormal, out Matrix3 transOW, out Matrix3 transWO);
×
125

126
                        foreach (var vertex in this.Vertices)
×
127
                        {
×
128
                                XYZ v = transOW * vertex.Location.Convert<XYZ>();
×
129
                                v = transform.ApplyTransform(v);
×
130
                                v = transWO * v;
×
131
                                vertex.Location = v.Convert<XY>();
×
132
                        }
×
133

134
                        this.Normal = newNormal;
×
135
                }
×
136

137
                /// <inheritdoc/>
138
                public override BoundingBox GetBoundingBox()
139
                {
9✔
140
                        if (this.Vertices.Any(v => v.Bulge != 0))
41!
UNCOV
141
                        {
×
NEW
142
                                return BoundingBox.FromPoints(this.GetPoints<XYZ>(byte.MaxValue));
×
143
                        }
144

145
                        return BoundingBox.FromPoints(this.Vertices.Select(v => v.Location.Convert<XYZ>()));
41✔
146
                }
9✔
147
        }
148
}
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