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

DomCR / ACadSharp / 14305968221

07 Apr 2025 09:41AM UTC coverage: 75.187% (-1.0%) from 76.181%
14305968221

push

github

DomCR
badge fix

5615 of 8186 branches covered (68.59%)

Branch coverage included in aggregate %.

22386 of 29056 relevant lines covered (77.04%)

72281.98 hits per line

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

81.82
/src/ACadSharp/Entities/Hatch.BoundaryPath.cs
1
using ACadSharp.Attributes;
2
using CSMath;
3
using CSUtilities.Extensions;
4
using System.Collections.Generic;
5
using System.Collections.ObjectModel;
6
using System.Collections.Specialized;
7
using System.Linq;
8

9
namespace ACadSharp.Entities
10
{
11
        public partial class Hatch
12
        {
13
                public partial class BoundaryPath : IGeometricEntity
14
                {
15
                        /// <summary>
16
                        /// Number of edges in this boundary path.
17
                        /// </summary>
18
                        /// <remarks>
19
                        /// Only if boundary is not a polyline.
20
                        /// </remarks>
21
                        [DxfCodeValue(DxfReferenceType.Count, 93)]
22
                        public ObservableCollection<Edge> Edges { get; private set; } = new();
27,816✔
23

24
                        /// <summary>
25
                        /// Source boundary objects.
26
                        /// </summary>
27
                        [DxfCodeValue(DxfReferenceType.Count, 97)]
28
                        public List<Entity> Entities { get; set; } = new List<Entity>();
5,481✔
29

30
                        /// <summary>
31
                        /// Boundary path type flag
32
                        /// </summary>
33
                        [DxfCodeValue(92)]
34
                        public BoundaryPathFlags Flags
35
                        {
36
                                get
37
                                {
1,483✔
38
                                        if (this.IsPolyline)
1,483✔
39
                                        {
158✔
40
                                                this._flags = this._flags.AddFlag(BoundaryPathFlags.Polyline);
158✔
41
                                        }
158✔
42
                                        else
43
                                        {
1,325✔
44
                                                this._flags = this._flags.RemoveFlag(BoundaryPathFlags.Polyline);
1,325✔
45
                                        }
1,325✔
46

47
                                        return this._flags;
1,483✔
48
                                }
1,483✔
49
                                set
50
                                {
2,699✔
51
                                        this._flags = value;
2,699✔
52
                                }
2,699✔
53
                        }
54

55
                        /// <summary>
56
                        /// Flag that indicates that this boundary path is formed by a polyline.
57
                        /// </summary>
58
                        public bool IsPolyline { get { return this.Edges.OfType<Polyline>().Any(); } }
19,635✔
59

60
                        private BoundaryPathFlags _flags;
61

62
                        /// <summary>
63
                        /// Default constructor.
64
                        /// </summary>
65
                        public BoundaryPath()
2,702✔
66
                        {
2,702✔
67
                                this.Edges.CollectionChanged += this.onEdgesCollectionChanged;
2,702✔
68
                        }
2,702✔
69

70
                        /// <inheritdoc/>
71
                        public void ApplyTransform(Transform transform)
72
                        {
×
73
                                throw new System.NotImplementedException();
×
74
                        }
75

76
                        /// <inheritdoc/>
77
                        public BoundaryPath Clone()
78
                        {
×
79
                                BoundaryPath path = (BoundaryPath)this.MemberwiseClone();
×
80

81
                                path.Entities = new List<Entity>();
×
82
                                path.Entities.AddRange(this.Entities.Select(e => (Entity)e.Clone()));
×
83

84
                                path.Edges = new ObservableCollection<Edge>(
×
85
                                        this.Edges.Select(e => e.Clone()));
×
86

87
                                return path;
×
88
                        }
×
89

90
                        /// <inheritdoc/>
91
                        public BoundingBox GetBoundingBox()
92
                        {
3✔
93
                                BoundingBox box = BoundingBox.Null;
3✔
94

95
                                foreach (Edge edge in this.Edges)
15✔
96
                                {
3✔
97
                                        box = box.Merge(edge.GetBoundingBox());
3✔
98
                                }
3✔
99

100
                                foreach (Entity entity in this.Entities)
13✔
101
                                {
2✔
102
                                        box = box.Merge(entity.GetBoundingBox());
2✔
103
                                }
2✔
104

105
                                return box;
3✔
106
                        }
3✔
107

108
                        private void onAdd(NotifyCollectionChangedEventArgs e)
109
                        {
7,762✔
110
                                foreach (Edge edge in e.NewItems)
38,808✔
111
                                {
7,762✔
112
                                        if (this.Edges.Count > 1 && this.IsPolyline)
7,762✔
113
                                        {
2✔
114
                                                throw new System.InvalidOperationException();
2✔
115
                                        }
116
                                }
7,760✔
117
                        }
7,760✔
118

119
                        private void onEdgesCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
120
                        {
7,762✔
121
                                switch (e.Action)
7,762✔
122
                                {
123
                                        case System.Collections.Specialized.NotifyCollectionChangedAction.Add:
124
                                                this.onAdd(e);
7,762✔
125
                                                break;
7,760✔
126
                                        case System.Collections.Specialized.NotifyCollectionChangedAction.Remove:
127
                                                break;
×
128
                                        case System.Collections.Specialized.NotifyCollectionChangedAction.Replace:
129
                                                break;
×
130
                                        case System.Collections.Specialized.NotifyCollectionChangedAction.Move:
131
                                                break;
×
132
                                        case System.Collections.Specialized.NotifyCollectionChangedAction.Reset:
133
                                                break;
×
134
                                }
135
                        }
7,760✔
136
                }
137
        }
138
}
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