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

DomCR / ACadSharp / 18093480635

29 Sep 2025 10:12AM UTC coverage: 77.923% (-0.4%) from 78.349%
18093480635

push

github

web-flow
Merge pull request #776 from DomCR/svg-linetypes

Svg linetypes

6787 of 9447 branches covered (71.84%)

Branch coverage included in aggregate %.

112 of 319 new or added lines in 10 files covered. (35.11%)

11 existing lines in 3 files now uncovered.

26081 of 32733 relevant lines covered (79.68%)

109509.64 hits per line

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

82.5
/src/ACadSharp/Extensions/PolylineExtensions.cs
1
using ACadSharp.Entities;
2
using CSMath;
3
using System;
4
using System.Collections.Generic;
5
using System.Linq;
6

7
namespace ACadSharp.Extensions
8
{
9
        public static class PolylineExtensions
10
        {
11
                public static IEnumerable<T> GetPoints<T>(this IPolyline polyline)
12
                        where T : IVector, new()
NEW
13
                {
×
NEW
14
                        return polyline.Vertices.Select(v => v.Location.Convert<T>());
×
NEW
15
                }
×
16

17
                public static IEnumerable<T> GetPoints<T>(this IPolyline polyline, int precision)
18
                        where T : IVector, new()
19
                {
13✔
20
                        if (precision < 2)
13!
NEW
21
                        {
×
NEW
22
                                throw new ArgumentOutOfRangeException(nameof(precision), precision, "The arc precision must be equal or greater than two.");
×
23
                        }
24

25
                        var points = new List<T>();
13✔
26
                        for (int i = 0; i < polyline.Vertices.Count(); i++)
128✔
27
                        {
58✔
28
                                IVertex curr = polyline.Vertices.ElementAt(i);
58✔
29
                                IVertex next = polyline.Vertices.ElementAtOrDefault(i + 1);
58✔
30

31
                                if (next == null && polyline.IsClosed)
58✔
32
                                {
6✔
33
                                        next = polyline.Vertices.First();
6✔
34
                                }
6✔
35
                                else if (next == null)
52✔
36
                                {
7✔
37
                                        break;
7✔
38
                                }
39

40
                                if (curr.Bulge == 0)
51✔
41
                                {
33✔
42
                                        if (i == 0)
33✔
43
                                        {
13✔
44
                                                points.Add((T)curr.Location);
13✔
45
                                        }
13✔
46

47
                                        points.Add((T)next.Location);
33✔
48
                                }
33✔
49
                                else
50
                                {
18✔
51
                                        XY p1 = curr.Location.Convert<XY>();
18✔
52
                                        XY p2 = next.Location.Convert<XY>();
18✔
53

54
                                        IEnumerable<T> lst = Arc.CreateFromBulge(p1, p2, curr.Bulge)
18✔
55
                                                .PolygonalVertexes(precision)
18✔
56
                                                .Select(p => p.Convert<T>());
4,656✔
57

58
                                        var f = lst.First().Round(8);
18✔
59
                                        var l = lst.Last().Round(8);
18✔
60

61
                                        if (i == 0)
18!
NEW
62
                                        {
×
NEW
63
                                                points.AddRange(lst);
×
NEW
64
                                        }
×
65
                                        else if (f.Equals(curr.Location.Convert<T>().Round(8)))
18!
66
                                        {
6✔
67
                                                points.AddRange(lst.Skip(1));
6✔
68
                                        }
6✔
69
                                        else if (l.Equals(curr.Location.Convert<T>().Round(8)))
12!
70
                                        {
12✔
71
                                                lst = lst.Reverse();
12✔
72
                                                points.AddRange(lst.Skip(1));
12✔
73
                                        }
12✔
74
                                }
18✔
75
                        }
51✔
76

77
                        return points;
13✔
78
                }
13✔
79
        }
80
}
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