• 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/Objects/Group.cs
1
using ACadSharp.Attributes;
2
using ACadSharp.Entities;
3
using ACadSharp.Objects.Collections;
4
using CSUtilities.Extensions;
5
using System.Collections.Generic;
6

7
namespace ACadSharp.Objects
8
{
9
        /// <summary>
10
        /// Represents a <see cref="Group"/> object.
11
        /// </summary>
12
        /// <remarks>
13
        /// Object name <see cref="DxfFileToken.TableGroup"/> <br/>
14
        /// Dxf class name <see cref="DxfSubclassMarker.Group"/>
15
        /// </remarks>
16
        [DxfName(DxfFileToken.TableGroup)]
17
        [DxfSubClass(DxfSubclassMarker.Group)]
18
        public class Group : NonGraphicalObject
19
        {
20
                /// <summary>
21
                /// Group description.
22
                /// </summary>
23
                [DxfCodeValue(300)]
UNCOV
24
                public string Description { get; set; } = string.Empty;
×
25

26
                /// <summary>
27
                /// Entities in this group.
28
                /// </summary>
29
                /// <remarks>
30
                /// Hard-pointer handle to entity in group.
31
                /// </remarks>
32
                [DxfCollectionCodeValue(DxfReferenceType.Handle, 340)]
UNCOV
33
                public IEnumerable<Entity> Entities { get { return this._entities; } }
×
34

35
                /// <summary>
36
                /// If the group has an automatic generated name.
37
                /// </summary>
38
                /// <remarks>
39
                /// The name for an unnamed group will be managed by the <see cref="GroupCollection"/>.
40
                /// </remarks>
41
                [DxfCodeValue(70)]
UNCOV
42
                public bool IsUnnamed { get { return this.Name.IsNullOrWhiteSpace() || this.Name.StartsWith("*"); } }
×
43

44
                /// <inheritdoc/>
UNCOV
45
                public override string ObjectName => DxfFileToken.TableGroup;
×
46

47
                /// <inheritdoc/>
UNCOV
48
                public override ObjectType ObjectType => ObjectType.GROUP;
×
49

50
                /// <summary>
51
                /// If the group is selectable.
52
                /// </summary>
53
                [DxfCodeValue(71)]
UNCOV
54
                public bool Selectable { get; set; } = true;
×
55

56
                /// <inheritdoc/>
UNCOV
57
                public override string SubclassMarker => DxfSubclassMarker.Group;
×
58

UNCOV
59
                private List<Entity> _entities = new();
×
60

61
                /// <inheritdoc/>
UNCOV
62
                public Group() : base()
×
UNCOV
63
                {
×
UNCOV
64
                }
×
65

66
                /// <inheritdoc/>
UNCOV
67
                public Group(string name) : base(name)
×
UNCOV
68
                {
×
UNCOV
69
                }
×
70

71
                /// <summary>
72
                /// Add an entity to the group.
73
                /// </summary>
74
                /// <param name="entity"></param>
75
                public void Add(Entity entity)
UNCOV
76
                {
×
UNCOV
77
                        if (this.Document != entity.Document)
×
UNCOV
78
                        {
×
UNCOV
79
                                throw new System.InvalidOperationException("The Group and the entity must belong to the same document.");
×
80
                        }
81

UNCOV
82
                        this._entities.Add(entity);
×
UNCOV
83
                        entity.AddReactor(this);
×
UNCOV
84
                }
×
85

86
                /// <summary>
87
                /// Add multiple entities into the group.
88
                /// </summary>
89
                /// <param name="entities"></param>
90
                public void AddRange(IEnumerable<Entity> entities)
UNCOV
91
                {
×
UNCOV
92
                        foreach (var e in entities)
×
UNCOV
93
                        {
×
UNCOV
94
                                this.Add(e);
×
UNCOV
95
                        }
×
UNCOV
96
                }
×
97

98
                /// <summary>
99
                /// Removes all entities in the group.
100
                /// </summary>
101
                public void Clear()
UNCOV
102
                {
×
UNCOV
103
                        foreach (var e in this._entities)
×
UNCOV
104
                        {
×
UNCOV
105
                                e.RemoveReactor(this);
×
UNCOV
106
                        }
×
107

UNCOV
108
                        this._entities.Clear();
×
UNCOV
109
                }
×
110

111
                /// <summary>
112
                /// Removes the entity from the group.
113
                /// </summary>
114
                /// <param name="entity"></param>
115
                public bool Remove(Entity entity)
116
                {
×
117
                        entity.RemoveReactor(this);
×
118
                        return this._entities.Remove(entity);
×
119
                }
×
120

121
                /// <inheritdoc/>
122
                public override CadObject Clone()
UNCOV
123
                {
×
UNCOV
124
                        Group clone = (Group)base.Clone();
×
125

UNCOV
126
                        clone._entities = new();
×
127

UNCOV
128
                        return clone;
×
UNCOV
129
                }
×
130

131
                internal override void AssignDocument(CadDocument doc)
UNCOV
132
                {
×
UNCOV
133
                        base.AssignDocument(doc);
×
UNCOV
134
                }
×
135

136
                internal override void UnassignDocument()
137
                {
×
138
                        base.UnassignDocument();
×
139

140
                        foreach (var e in this._entities)
×
141
                        {
×
142
                                e.RemoveReactor(this);
×
143
                        }
×
144

145
                        this._entities.Clear();
×
146
                }
×
147
        }
148
}
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