From 580521f3b086b24b858833e9273f1e32b5d50717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuzhan=20Koral?= <45078678+oguzhankoral@users.noreply.github.com> Date: Wed, 17 Jul 2024 15:47:39 +0200 Subject: [PATCH] Add group proxy (#41) --- .../Models/Instances/GroupProxy.cs | 12 ++++++++++++ .../Models/Instances/IInstanceComponent.cs | 2 +- .../Models/Instances/IProxyCollection.cs | 18 ++++++++++++++++++ .../Instances/InstanceDefinitionProxy.cs | 8 ++++---- .../Models/Instances/InstanceProxy.cs | 8 ++++---- 5 files changed, 39 insertions(+), 9 deletions(-) create mode 100644 src/Speckle.Core/Models/Instances/GroupProxy.cs create mode 100644 src/Speckle.Core/Models/Instances/IProxyCollection.cs diff --git a/src/Speckle.Core/Models/Instances/GroupProxy.cs b/src/Speckle.Core/Models/Instances/GroupProxy.cs new file mode 100644 index 00000000..c0221be6 --- /dev/null +++ b/src/Speckle.Core/Models/Instances/GroupProxy.cs @@ -0,0 +1,12 @@ +namespace Speckle.Core.Models.Instances; + +/// +/// Grouped objects with a meaningful way for host application so use this proxy if you want to group object references for any purpose. +/// i.e. in rhino -> creating group make objects selectable/moveable/editable together. +/// +public class GroupProxy : Base, IProxyCollection +{ + public List objects { get; set; } + + public string name { get; set; } +} diff --git a/src/Speckle.Core/Models/Instances/IInstanceComponent.cs b/src/Speckle.Core/Models/Instances/IInstanceComponent.cs index 9a647860..0fe5d086 100644 --- a/src/Speckle.Core/Models/Instances/IInstanceComponent.cs +++ b/src/Speckle.Core/Models/Instances/IInstanceComponent.cs @@ -8,5 +8,5 @@ public interface IInstanceComponent /// /// The maximum "depth" at which this or was found. On receive, as instances can be composed of other instances, we need to start from the deepest instance elements first when reconstructing them, starting with definitions first. /// - public int MaxDepth { get; set; } + public int maxDepth { get; set; } } diff --git a/src/Speckle.Core/Models/Instances/IProxyCollection.cs b/src/Speckle.Core/Models/Instances/IProxyCollection.cs new file mode 100644 index 00000000..571e2d33 --- /dev/null +++ b/src/Speckle.Core/Models/Instances/IProxyCollection.cs @@ -0,0 +1,18 @@ +namespace Speckle.Core.Models.Instances; + +/// +/// Collection to proxy objects that lies in definitions, groups or whatever logic in the host app. +/// +public interface IProxyCollection +{ + /// + /// The original ids of the objects that are part of this definition, as present in the source host app. + /// On receive, they will be mapped to corresponding newly created definition ids. + /// + public List objects { get; set; } + + /// + /// Name of the proxy collection which is unique for rhino, autocad and sketchup + /// + public string name { get; set; } +} diff --git a/src/Speckle.Core/Models/Instances/InstanceDefinitionProxy.cs b/src/Speckle.Core/Models/Instances/InstanceDefinitionProxy.cs index fc974bfd..47c9430a 100644 --- a/src/Speckle.Core/Models/Instances/InstanceDefinitionProxy.cs +++ b/src/Speckle.Core/Models/Instances/InstanceDefinitionProxy.cs @@ -3,14 +3,14 @@ namespace Speckle.Core.Models.Instances; /// /// A proxy class for an instance definition. /// -public class InstanceDefinitionProxy : Base, IInstanceComponent +public class InstanceDefinitionProxy : Base, IInstanceComponent, IProxyCollection { /// /// The original ids of the objects that are part of this definition, as present in the source host app. On receive, they will be mapped to corresponding newly created definition ids. /// - public List Objects { get; set; } // source app application ids for the objects + public List objects { get; set; } // source app application ids for the objects - public int MaxDepth { get; set; } + public int maxDepth { get; set; } - public string Name { get; set; } + public string name { get; set; } } diff --git a/src/Speckle.Core/Models/Instances/InstanceProxy.cs b/src/Speckle.Core/Models/Instances/InstanceProxy.cs index 246a72e7..ee217d5a 100644 --- a/src/Speckle.Core/Models/Instances/InstanceProxy.cs +++ b/src/Speckle.Core/Models/Instances/InstanceProxy.cs @@ -10,17 +10,17 @@ public class InstanceProxy : Base, IInstanceComponent /// /// The definition id as present in the original host app. On receive, it will be mapped to the newly created definition id. /// - public string DefinitionId { get; set; } + public string definitionId { get; set; } /// /// The transform of the instance reference. /// - public Matrix4x4 Transform { get; set; } + public Matrix4x4 transform { get; set; } /// /// The units of the host application file. /// - public string Units { get; set; } = Kits.Units.Meters; + public string units { get; set; } = Kits.Units.Meters; - public int MaxDepth { get; set; } + public int maxDepth { get; set; } }