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

DomCR / ACadSharp / 12905761471

22 Jan 2025 10:03AM UTC coverage: 2.0% (-74.0%) from 75.963%
12905761471

push

github

DomCR
version 1.0.6

104 of 7676 branches covered (1.35%)

Branch coverage included in aggregate %.

590 of 27024 relevant lines covered (2.18%)

5.13 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.Collections.Generic;
5

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

22
                /// <inheritdoc/>
23
                public override string ObjectName => DxfFileToken.EntityLwPolyline;
×
24

25
                /// <inheritdoc/>
26
                public override string SubclassMarker => DxfSubclassMarker.LwPolyline;
×
27

28
                /// <summary>
29
                /// Polyline flags.
30
                /// </summary>
31
                [DxfCodeValue(70)]
32
                public LwPolylineFlags Flags { get; set; }
×
33

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

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

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

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

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

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

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

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

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

104
                        XYZ first = (XYZ)this.Vertices[0].Location;
×
105
                        XYZ second = (XYZ)this.Vertices[1].Location;
×
106

107
                        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));
×
108
                        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));
×
109

110
                        for (int i = 2; i < this.Vertices.Count; i++)
×
111
                        {
×
112
                                XYZ curr = (XYZ)this.Vertices[i].Location;
×
113

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

118
                        return new BoundingBox(min, max);
×
119
                }
×
120
        }
121
}
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