• 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/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)]
UNCOV
22
                        public ObservableCollection<Edge> Edges { get; private set; } = new();
×
23

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

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

UNCOV
47
                                        return this._flags;
×
UNCOV
48
                                }
×
49
                                set
UNCOV
50
                                {
×
UNCOV
51
                                        this._flags = value;
×
UNCOV
52
                                }
×
53
                        }
54

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

60
                        private BoundaryPathFlags _flags;
61

62
                        /// <summary>
63
                        /// Default constructor.
64
                        /// </summary>
UNCOV
65
                        public BoundaryPath()
×
UNCOV
66
                        {
×
UNCOV
67
                                this.Edges.CollectionChanged += this.onEdgesCollectionChanged;
×
UNCOV
68
                        }
×
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()
UNCOV
92
                        {
×
UNCOV
93
                                BoundingBox box = BoundingBox.Null;
×
94

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

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

UNCOV
105
                                return box;
×
UNCOV
106
                        }
×
107

108
                        private void onAdd(NotifyCollectionChangedEventArgs e)
UNCOV
109
                        {
×
UNCOV
110
                                foreach (Edge edge in e.NewItems)
×
UNCOV
111
                                {
×
UNCOV
112
                                        if (this.Edges.Count > 1 && this.IsPolyline)
×
UNCOV
113
                                        {
×
UNCOV
114
                                                throw new System.InvalidOperationException();
×
115
                                        }
UNCOV
116
                                }
×
UNCOV
117
                        }
×
118

119
                        private void onEdgesCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
UNCOV
120
                        {
×
UNCOV
121
                                switch (e.Action)
×
122
                                {
123
                                        case System.Collections.Specialized.NotifyCollectionChangedAction.Add:
UNCOV
124
                                                this.onAdd(e);
×
UNCOV
125
                                                break;
×
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
                                }
UNCOV
135
                        }
×
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