/
Collection.cs
48 lines (42 loc) · 1.76 KB
/
Collection.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System.Collections.Generic;
namespace Speckle.Core.Models;
/// <summary>
/// A simple container for organising objects within a model and preserving object hierarchy.
/// A container is defined by a human-readable <see cref="name"/>, a unique <see cref="Base.applicationId"/>, and its list of contained <see cref="elements"/>.
/// The <see cref="elements"/> can include an unrestricted number of <see cref="Base"/> objects including additional nested <see cref="Collection"/>s.
/// </summary>
/// <remarks>
/// A <see cref="Collection"/> can be for example a Layer in Rhino/AutoCad, a collection in Blender, or a Category in Revit.
/// The location of each collection in the hierarchy of collections in a commit will be retrieved through commit traversal.
/// </remarks>
public class Collection : Base
{
public Collection() { }
/// <summary>
/// Constructor for a basic collection.
/// </summary>
/// <param name="name">The human-readable name of this collection</param>
/// <param name="collectionType"></param>
public Collection(string name, string collectionType)
{
this.name = name;
this.collectionType = collectionType;
}
/// <summary>
/// The human-readable name of the <see cref="Collection"/>.
/// </summary>
/// <remarks>This name is not necessarily unique within a commit. Set the applicationId for a unique identifier.</remarks>
public string name { get; set; }
/// <summary>
/// The type of this collection
/// </summary>
public string collectionType { get; set; }
/// <summary>
/// The elements contained in this <see cref="Collection"/>.
/// </summary>
/// <remarks>
/// This can include additional nested <see cref="Collection"/>s.
/// </remarks>
[DetachProperty]
public List<Base> elements { get; set; } = new();
}