Skip to content

Commit

Permalink
Restructures proxies, removes layer colors, and adds color proxy class (
Browse files Browse the repository at this point in the history
  • Loading branch information
clairekuang authored Aug 2, 2024
1 parent 77ffcea commit 9da1d79
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 27 deletions.
4 changes: 1 addition & 3 deletions src/Speckle.Core/Models/Collections/Collection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ public Collection() { }
/// 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)
public Collection(string name)
{
this.name = name;
this.collectionType = collectionType;
}

/// <summary>
Expand Down
12 changes: 0 additions & 12 deletions src/Speckle.Core/Models/Collections/Interfaces.cs

This file was deleted.

11 changes: 2 additions & 9 deletions src/Speckle.Core/Models/Collections/Layer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,16 @@ namespace Speckle.Core.Models.Collections;
/// <summary>
/// A specialized collection that represents a CAD-app layer. We expect this to grow in the future with possibly other shared props.
/// </summary>
public class Layer : Collection, IHasColor
public class Layer : Collection
{
public Layer() { }

/// <summary>
/// Constructor for a basic Layer.
/// </summary>
/// <param name="name">The human-readable name of this collection</param>
/// <param name="color"></param>
public Layer(string name, int color)
public Layer(string name)
{
this.name = name;
this.color = color;
}

/// <summary>
/// The argb int value of the layer color
/// </summary>
public int color { get; set; }
}
2 changes: 2 additions & 0 deletions src/Speckle.Core/Models/Instances/InstanceDefinitionProxy.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Speckle.Core.Models.Proxies;

namespace Speckle.Core.Models.Instances;

/// <summary>
Expand Down
31 changes: 31 additions & 0 deletions src/Speckle.Core/Models/Proxies/ColorProxy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System.Drawing;
using Speckle.Core.Models.Proxies;

namespace Speckle.Core.Models.Proxies;

/// <summary>
/// Represents a color that is found on objects and collections in a root collection
/// </summary>
public class ColorProxy : Base, IProxyCollection
{
public ColorProxy() { }

public ColorProxy(int color, string applicationId, string? name)
{
value = color;
this.applicationId = applicationId;
this.name = name;
}

public List<string> objects { get; set; }

/// <summary>
/// The argb int of the color
/// </summary>
public int value { get; set; }

/// <summary>
/// The name, if any, of the color
/// </summary>
public string? name { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Speckle.Core.Models.Instances;
namespace Speckle.Core.Models.Proxies;

/// <summary>
/// Grouped objects with a meaningful way for host application so use this proxy if you want to group object references for any purpose.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Speckle.Core.Models.Instances;
namespace Speckle.Core.Models.Proxies;

/// <summary>
/// Collection to proxy objects that lies in definitions, groups or whatever logic in the host app.
Expand Down
2 changes: 1 addition & 1 deletion src/Speckle.Objects/Other/RenderMaterial.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Drawing;
using Speckle.Core.Kits;
using Speckle.Core.Models;
using Speckle.Core.Models.Instances;
using Speckle.Core.Models.Proxies;
using Speckle.Newtonsoft.Json;

namespace Objects.Other;
Expand Down

0 comments on commit 9da1d79

Please sign in to comment.