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

DomCR / ACadSharp / 17737836230

15 Sep 2025 03:12PM UTC coverage: 2.092% (-76.2%) from 78.245%
17737836230

push

github

web-flow
Merge pull request #790 from DomCR/addflag-refactor

addflag refactor

141 of 9225 branches covered (1.53%)

Branch coverage included in aggregate %.

0 of 93 new or added lines in 10 files covered. (0.0%)

24910 existing lines in 372 files now uncovered.

724 of 32119 relevant lines covered (2.25%)

5.76 hits per line

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

0.0
/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
                /// <summary>
21
                /// Constant width
22
                /// </summary>
23
                /// <remarks>
24
                /// Not used if variable width (codes 40 and/or 41) is set
25
                /// </remarks>
26
                [DxfCodeValue(43)]
UNCOV
27
                public double ConstantWidth { get; set; } = 0.0;
×
28

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

35
                /// <summary>
36
                /// Polyline flags.
37
                /// </summary>
38
                [DxfCodeValue(70)]
NEW
39
                public LwPolylineFlags Flags { get => _flags; set => _flags = value; }
×
40

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

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

67
                /// <inheritdoc/>
NEW
68
                public override string ObjectName => DxfFileToken.EntityLwPolyline;
×
69

70
                /// <inheritdoc/>
NEW
71
                public override ObjectType ObjectType => ObjectType.LWPOLYLINE;
×
72

73
                /// <inheritdoc/>
NEW
74
                public override string SubclassMarker => DxfSubclassMarker.LwPolyline;
×
75

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

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

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

91
                private LwPolylineFlags _flags;
92

93
                /// <inheritdoc/>
94
                public override void ApplyTransform(Transform transform)
NEW
95
                {
×
NEW
96
                        var newNormal = this.transformNormal(transform, this.Normal);
×
97

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

NEW
100
                        foreach (var vertex in this.Vertices)
×
NEW
101
                        {
×
NEW
102
                                XYZ v = transOW * vertex.Location.Convert<XYZ>();
×
NEW
103
                                v = transform.ApplyTransform(v);
×
NEW
104
                                v = transWO * v;
×
NEW
105
                                vertex.Location = v.Convert<XY>();
×
NEW
106
                        }
×
107

NEW
108
                        this.Normal = newNormal;
×
NEW
109
                }
×
110

111
                /// <inheritdoc/>
112
                public IEnumerable<Entity> Explode()
UNCOV
113
                {
×
UNCOV
114
                        return Polyline.Explode(this);
×
UNCOV
115
                }
×
116

117
                /// <inheritdoc/>
118
                public override BoundingBox GetBoundingBox()
UNCOV
119
                {
×
UNCOV
120
                        if (this.Vertices.Count < 2)
×
UNCOV
121
                        {
×
UNCOV
122
                                return BoundingBox.Null;
×
123
                        }
124

UNCOV
125
                        XYZ first = (XYZ)this.Vertices[0].Location;
×
UNCOV
126
                        XYZ second = (XYZ)this.Vertices[1].Location;
×
127

UNCOV
128
                        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));
×
UNCOV
129
                        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));
×
130

UNCOV
131
                        for (int i = 2; i < this.Vertices.Count; i++)
×
UNCOV
132
                        {
×
UNCOV
133
                                XYZ curr = (XYZ)this.Vertices[i].Location;
×
134

UNCOV
135
                                min = new XYZ(System.Math.Min(min.X, curr.X), System.Math.Min(min.Y, curr.Y), System.Math.Min(min.Z, curr.Z));
×
UNCOV
136
                                max = new XYZ(System.Math.Max(max.X, curr.X), System.Math.Max(max.Y, curr.Y), System.Math.Max(max.Z, curr.Z));
×
UNCOV
137
                        }
×
138

UNCOV
139
                        return new BoundingBox(min, max);
×
UNCOV
140
                }
×
141
        }
142
}
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