refactor: rootCollection to use IProperties

This commit is contained in:
Björn
2025-10-29 14:39:06 +02:00
parent 59a4f8f864
commit 67236abafe
3 changed files with 16 additions and 14 deletions
+2 -9
View File
@@ -2,6 +2,7 @@ using Speckle.Objects.Geometry;
using Speckle.Objects.Other;
using Speckle.Objects.Primitive;
using Speckle.Sdk.Models;
using Speckle.Sdk.Models.Proxies;
namespace Speckle.Objects;
@@ -110,15 +111,7 @@ public interface IDisplayValue<out T> : ISpeckleObject
#region Data objects
/// <summary>
/// Specifies properties on objects to be used for data-based workflows
/// </summary>
public interface IProperties : ISpeckleObject
{
Dictionary<string, object?> properties { get; }
}
public interface IDataObject : IProperties, IDisplayValue<IReadOnlyList<Base>>
public interface IDataObject : IProperties, IDisplayValue<IReadOnlyList<Base>>, ISpeckleObject
{
/// <summary>
/// The name of the object, primarily used to decorate the object for consumption in frontend and other apps
@@ -1,3 +1,5 @@
using Speckle.Sdk.Models.Proxies;
namespace Speckle.Sdk.Models.Collections;
/// <summary>
@@ -5,7 +7,7 @@ namespace Speckle.Sdk.Models.Collections;
/// Extends Collection to include model-wide properties that apply to the entire model.
/// </summary>
[SpeckleType("Speckle.Core.Models.Collections.RootCollection")]
public class RootCollection : Collection
public class RootCollection : Collection, IProperties
{
public RootCollection() { }
@@ -15,8 +17,5 @@ public class RootCollection : Collection
/// <summary>
/// Model-wide properties that apply to the entire model.
/// </summary>
/// <remarks>
/// These are intended for model-level metadata such as total area, project information, or analysis results.
/// </remarks>
public Dictionary<string, object?>? properties { get; set; }
public Dictionary<string, object?> properties { get; set; } = new();
}
@@ -0,0 +1,10 @@
namespace Speckle.Sdk.Models.Proxies;
/// <summary>
/// Specifies properties on objects to be used for data-based workflows.
/// Can be applied to both objects and collections.
/// </summary>
public interface IProperties
{
Dictionary<string, object?> properties { get; }
}