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

DomCR / ACadSharp / 17231110568

26 Aug 2025 07:26AM UTC coverage: 78.117% (-0.2%) from 78.27%
17231110568

push

github

web-flow
Merge pull request #749 from DomCR/issue-745_insert-explode

Issue 745 insert explode

6520 of 9071 branches covered (71.88%)

Branch coverage included in aggregate %.

19 of 79 new or added lines in 9 files covered. (24.05%)

45 existing lines in 5 files now uncovered.

25297 of 31659 relevant lines covered (79.9%)

104973.57 hits per line

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

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

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

23
                /// <inheritdoc/>
24
                public override string ObjectName => DxfFileToken.EntityLwPolyline;
20,459✔
25

26
                /// <inheritdoc/>
27
                public override string SubclassMarker => DxfSubclassMarker.LwPolyline;
34,922✔
28

29
                /// <summary>
30
                /// Polyline flags.
31
                /// </summary>
32
                [DxfCodeValue(70)]
33
                public LwPolylineFlags Flags { get; set; }
9,915✔
34

35
                /// <summary>
36
                /// Constant width
37
                /// </summary>
38
                /// <remarks>
39
                /// Not used if variable width (codes 40 and/or 41) is set
40
                /// </remarks>
41
                [DxfCodeValue(43)]
42
                public double ConstantWidth { get; set; } = 0.0;
12,048✔
43

44
                /// <summary>
45
                /// The current elevation of the object.
46
                /// </summary>
47
                [DxfCodeValue(38)]
48
                public double Elevation { get; set; } = 0.0;
8,165✔
49

50
                /// <summary>
51
                /// Specifies the distance a 2D object is extruded above or below its elevation.
52
                /// </summary>
53
                [DxfCodeValue(39)]
54
                public double Thickness { get; set; } = 0.0;
8,174✔
55

56
                /// <summary>
57
                /// Specifies the three-dimensional normal unit vector for the object.
58
                /// </summary>
59
                [DxfCodeValue(210, 220, 230)]
60
                public XYZ Normal { get; set; } = XYZ.AxisZ;
8,174✔
61

62
                /// <summary>
63
                /// Vertices that form this LwPolyline
64
                /// </summary>
65
                [DxfCodeValue(DxfReferenceType.Count, 90)]
66
                public List<Vertex> Vertices { get; set; } = new List<Vertex>();
136,710✔
67

68
                /// <inheritdoc/>
69
                public bool IsClosed
70
                {
71
                        get
72
                        {
10✔
73
                                return this.Flags.HasFlag(LwPolylineFlags.Closed);
10✔
74
                        }
10✔
75
                        set
76
                        {
20✔
77
                                if (value)
20✔
78
                                {
9✔
79
                                        this.Flags = this.Flags.AddFlag(LwPolylineFlags.Closed);
9✔
80
                                }
9✔
81
                                else
82
                                {
11✔
83
                                        this.Flags = this.Flags.RemoveFlag(LwPolylineFlags.Closed);
11✔
84
                                }
11✔
85
                        }
20✔
86
                }
87

88
                /// <inheritdoc/>
89
                IEnumerable<IVertex> IPolyline.Vertices { get { return this.Vertices; } }
156✔
90

91
                /// <inheritdoc/>
92
                public IEnumerable<Entity> Explode()
93
                {
3✔
94
                        return Polyline.Explode(this);
3✔
95
                }
3✔
96

97
                /// <inheritdoc/>
98
                public override BoundingBox GetBoundingBox()
99
                {
9✔
100
                        if (this.Vertices.Count < 2)
9✔
101
                        {
1✔
102
                                return BoundingBox.Null;
1✔
103
                        }
104

105
                        XYZ first = (XYZ)this.Vertices[0].Location;
8✔
106
                        XYZ second = (XYZ)this.Vertices[1].Location;
8✔
107

108
                        XYZ min = new XYZ(System.Math.Min(first.X, second.X), System.Math.Min(first.Y, second.Y), System.Math.Min(first.Z, second.Z));
8✔
109
                        XYZ max = new XYZ(System.Math.Max(first.X, second.X), System.Math.Max(first.Y, second.Y), System.Math.Max(first.Z, second.Z));
8✔
110

111
                        for (int i = 2; i < this.Vertices.Count; i++)
48✔
112
                        {
16✔
113
                                XYZ curr = (XYZ)this.Vertices[i].Location;
16✔
114

115
                                min = new XYZ(System.Math.Min(min.X, curr.X), System.Math.Min(min.Y, curr.Y), System.Math.Min(min.Z, curr.Z));
16✔
116
                                max = new XYZ(System.Math.Max(max.X, curr.X), System.Math.Max(max.Y, curr.Y), System.Math.Max(max.Z, curr.Z));
16✔
117
                        }
16✔
118

119
                        return new BoundingBox(min, max);
8✔
120
                }
9✔
121

122
                /// <inheritdoc/>
123
                public override void ApplyTransform(Transform transform)
124
                {
×
NEW
125
                        var newNormal = this.transformNormal(transform, this.Normal);
×
126

NEW
127
                        this.getWorldMatrix(transform, this.Normal, newNormal, out Matrix3 transOW, out Matrix3 transWO);
×
128

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

NEW
137
                        this.Normal = newNormal;
×
UNCOV
138
                }
×
139
        }
140
}
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