feat: CNX-19 adds render material proxy class (#50)

* adds render material proxy class

* Update RenderMaterial.cs

* Update RenderMaterial.cs

* refactors IProxyCollection interface

* Update RenderMaterial.cs
This commit is contained in:
Claire Kuang
2024-07-24 12:43:39 +01:00
committed by GitHub
parent 059253ff39
commit ce3e591a47
4 changed files with 33 additions and 7 deletions
@@ -1,4 +1,4 @@
namespace Speckle.Core.Models.Instances;
namespace Speckle.Core.Models.Instances;
/// <summary>
/// Grouped objects with a meaningful way for host application so use this proxy if you want to group object references for any purpose.
@@ -8,5 +8,8 @@ public class GroupProxy : Base, IProxyCollection
{
public List<string> objects { get; set; }
/// <summary>
/// Name of the group proxy collection which is unique for rhino, autocad and sketchup
/// </summary>
public string name { get; set; }
}
@@ -1,4 +1,4 @@
namespace Speckle.Core.Models.Instances;
namespace Speckle.Core.Models.Instances;
/// <summary>
/// Collection to proxy objects that lies in definitions, groups or whatever logic in the host app.
@@ -10,9 +10,4 @@ public interface IProxyCollection
/// On receive, they will be mapped to corresponding newly created definition ids.
/// </summary>
public List<string> objects { get; set; }
/// <summary>
/// Name of the proxy collection which is unique for rhino, autocad and sketchup
/// </summary>
public string name { get; set; }
}
@@ -12,5 +12,8 @@ public class InstanceDefinitionProxy : Base, IInstanceComponent, IProxyCollectio
public int maxDepth { get; set; }
/// <summary>
/// Name of the instance definition proxy collection which is unique for rhino, autocad and sketchup
/// </summary>
public string name { get; set; }
}
@@ -1,6 +1,7 @@
using System.Drawing;
using Speckle.Core.Kits;
using Speckle.Core.Models;
using Speckle.Core.Models.Instances;
using Speckle.Newtonsoft.Json;
namespace Objects.Other;
@@ -58,3 +59,27 @@ public class RenderMaterial : Base
set => diffuse = value.ToArgb();
}
}
/// <summary>
/// Used to store render material to object relationships in root collections
/// </summary>
public class RenderMaterialProxy : Base, IProxyCollection
{
public RenderMaterialProxy() { }
public RenderMaterialProxy(RenderMaterial renderMaterial, List<string> objects)
{
value = renderMaterial;
this.objects = objects;
}
/// <summary>
/// The list of application ids of objects that use this render material
/// </summary>
public List<string> objects { get; set; }
/// <summary>
/// The render material used by <see cref="objects"/>
/// </summary>
public RenderMaterial value { get; set; }
}