• 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/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
                        /// Flag that indicates that this boundary path is formed by a polyline.
17
                        /// </summary>
18
                        public bool IsPolyline { get { return this.Edges.OfType<Polyline>().Any(); } }
×
19

20
                        /// <summary>
21
                        /// Boundary path type flag
22
                        /// </summary>
23
                        [DxfCodeValue(92)]
24
                        public BoundaryPathFlags Flags
25
                        {
26
                                get
27
                                {
×
28
                                        if (this.IsPolyline)
×
29
                                        {
×
30
                                                this._flags = this._flags.AddFlag(BoundaryPathFlags.Polyline);
×
31
                                        }
×
32
                                        else
33
                                        {
×
34
                                                this._flags = this._flags.RemoveFlag(BoundaryPathFlags.Polyline);
×
35
                                        }
×
36

37
                                        return this._flags;
×
38
                                }
×
39
                                set
40
                                {
×
41
                                        this._flags = value;
×
42
                                }
×
43
                        }
44

45
                        /// <summary>
46
                        /// Number of edges in this boundary path.
47
                        /// </summary>
48
                        /// <remarks>
49
                        /// Only if boundary is not a polyline.
50
                        /// </remarks>
51
                        [DxfCodeValue(DxfReferenceType.Count, 93)]
52
                        public ObservableCollection<Edge> Edges { get; private set; } = new();
×
53

54
                        /// <summary>
55
                        /// Source boundary objects.
56
                        /// </summary>
57
                        [DxfCodeValue(DxfReferenceType.Count, 97)]
58
                        public List<Entity> Entities { get; set; } = new List<Entity>();
×
59

60
                        private BoundaryPathFlags _flags;
61

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

70
                        /// <inheritdoc/>
71
                        public BoundingBox GetBoundingBox()
72
                        {
×
73
                                BoundingBox box = BoundingBox.Null;
×
74

75
                                foreach (Edge edge in this.Edges)
×
76
                                {
×
77
                                        box = box.Merge(edge.GetBoundingBox());
×
78
                                }
×
79

80
                                foreach (Entity entity in this.Entities)
×
81
                                {
×
82
                                        box = box.Merge(entity.GetBoundingBox());
×
83
                                }
×
84

85
                                return box;
×
86
                        }
×
87

88
                        /// <inheritdoc/>
89
                        public BoundaryPath Clone()
90
                        {
×
91
                                BoundaryPath path = (BoundaryPath)this.MemberwiseClone();
×
92

93
                                path.Entities = new List<Entity>();
×
94
                                path.Entities.AddRange(this.Entities.Select(e => (Entity)e.Clone()));
×
95

96
                                path.Edges = new ObservableCollection<Edge>(
×
97
                                        this.Edges.Select(e => e.Clone()));
×
98

99
                                return path;
×
100
                        }
×
101

102
                        private void onEdgesCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
103
                        {
×
104
                                switch (e.Action)
×
105
                                {
106
                                        case System.Collections.Specialized.NotifyCollectionChangedAction.Add:
107
                                                this.onAdd(e);
×
108
                                                break;
×
109
                                        case System.Collections.Specialized.NotifyCollectionChangedAction.Remove:
110
                                                break;
×
111
                                        case System.Collections.Specialized.NotifyCollectionChangedAction.Replace:
112
                                                break;
×
113
                                        case System.Collections.Specialized.NotifyCollectionChangedAction.Move:
114
                                                break;
×
115
                                        case System.Collections.Specialized.NotifyCollectionChangedAction.Reset:
116
                                                break;
×
117
                                }
118
                        }
×
119

120
                        private void onAdd(NotifyCollectionChangedEventArgs e)
121
                        {
×
122
                                foreach (Edge edge in e.NewItems)
×
123
                                {
×
124
                                        if (this.Edges.Count > 1 && this.IsPolyline)
×
125
                                        {
×
126
                                                throw new System.InvalidOperationException();
×
127
                                        }
128
                                }
×
129
                        }
×
130
                }
131
        }
132
}
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