• 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/SortEntitiesTable.cs
1
using ACadSharp.Attributes;
2
using ACadSharp.Entities;
3
using ACadSharp.Tables;
4
using System;
5
using System.Collections;
6
using System.Collections.Generic;
7
using System.Linq;
8

9
namespace ACadSharp.Objects
10
{
11
        /// <summary>
12
        /// Represents a <see cref="SortEntitiesTable"/> object
13
        /// </summary>
14
        /// <remarks>
15
        /// Object name <see cref="DxfFileToken.ObjectSortEntsTable"/> <br/>
16
        /// Dxf class name <see cref="DxfSubclassMarker.SortentsTable"/>
17
        /// </remarks>
18
        [DxfName(DxfFileToken.ObjectSortEntsTable)]
19
        [DxfSubClass(DxfSubclassMarker.SortentsTable)]
20
        public partial class SortEntitiesTable : NonGraphicalObject, IEnumerable<SortEntitiesTable.Sorter>
21
        {
22
                /// <summary>
23
                /// Block owner where the table is applied
24
                /// </summary>
25
                [DxfCodeValue(330)]
UNCOV
26
                public BlockRecord BlockOwner { get; internal set; }
×
27

28
                /// <inheritdoc/>
UNCOV
29
                public override string ObjectName => DxfFileToken.ObjectSortEntsTable;
×
30

31
                /// <inheritdoc/>
32
                public override ObjectType ObjectType => ObjectType.UNLISTED;
×
33

34
                /// <inheritdoc/>
35
                public override string SubclassMarker => DxfSubclassMarker.SortentsTable;
×
36

37
                /// <summary>
38
                /// Dictionary entry name for the object <see cref="SortEntitiesTable"/>
39
                /// </summary>
40
                public const string DictionaryEntryName = "ACAD_SORTENTS";
41

UNCOV
42
                private List<Sorter> _sorters = new();
×
43

UNCOV
44
                internal SortEntitiesTable()
×
UNCOV
45
                {
×
UNCOV
46
                        this.Name = DictionaryEntryName;
×
UNCOV
47
                }
×
48

UNCOV
49
                internal SortEntitiesTable(BlockRecord owner) : this()
×
UNCOV
50
                {
×
UNCOV
51
                        this.BlockOwner = owner;
×
UNCOV
52
                }
×
53

54
                /// <summary>
55
                /// Sorter attached to an entity.
56
                /// </summary>
57
                /// <param name="entity">Entity in the block to be sorted.</param>
58
                /// <param name="sorterHandle">Sorter handle.</param>
59
                /// <exception cref="ArgumentException"></exception>
60
                public void Add(Entity entity, ulong sorterHandle)
UNCOV
61
                {
×
UNCOV
62
                        this._sorters.Add(new Sorter(entity, sorterHandle));
×
UNCOV
63
                }
×
64

65
                /// <summary>
66
                /// Removes all elements in the collection.
67
                /// </summary>
68
                public void Clear()
69
                {
×
70
                        this._sorters.Clear();
×
71
                }
×
72

73
                /// <inheritdoc/>
74
                public override CadObject Clone()
UNCOV
75
                {
×
UNCOV
76
                        SortEntitiesTable clone = (SortEntitiesTable)base.Clone();
×
77

UNCOV
78
                        clone._sorters = new List<Sorter>();
×
79

UNCOV
80
                        return clone;
×
UNCOV
81
                }
×
82

83
                /// <inheritdoc/>
84
                public IEnumerator<Sorter> GetEnumerator()
UNCOV
85
                {
×
UNCOV
86
                        this._sorters.Sort();
×
UNCOV
87
                        return this._sorters.GetEnumerator();
×
UNCOV
88
                }
×
89

90
                /// <inheritdoc/>
91
                IEnumerator IEnumerable.GetEnumerator()
UNCOV
92
                {
×
UNCOV
93
                        return this.GetEnumerator();
×
UNCOV
94
                }
×
95

96
                /// <summary>
97
                /// Get the sorter handle of an entity, if is not in the sorter table it will return the entity's handle.
98
                /// </summary>
99
                /// <param name="entity"></param>
100
                /// <returns></returns>
101
                public ulong GetSorterHandle(Entity entity)
UNCOV
102
                {
×
UNCOV
103
                        Sorter sorter = this._sorters.FirstOrDefault(s => s.Entity.Equals(entity));
×
104

UNCOV
105
                        if (sorter is not null)
×
UNCOV
106
                        {
×
UNCOV
107
                                return sorter.SortHandle;
×
108
                        }
109
                        else
110
                        {
×
111
                                return entity.Handle;
×
112
                        }
UNCOV
113
                }
×
114

115
                /// <summary>
116
                /// Removes the first occurrence of a specific object from the sorters table.
117
                /// </summary>
118
                /// <param name="entity"></param>
119
                /// <returns></returns>
120
                public bool Remove(Entity entity)
121
                {
×
122
                        var sorter = _sorters.FirstOrDefault(s => s.Entity.Equals(entity));
×
123
                        if (sorter is null)
×
124
                        {
×
125
                                return false;
×
126
                        }
127

128
                        return _sorters.Remove(sorter);
×
129
                }
×
130
        }
131
}
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