mirror of
https://github.com/eliasstepanik/OSCADSharpDotnet7.git
synced 2026-01-11 13:38:33 +00:00
Added CLS compliant assembly declaration on OSCADSharp in OSCADObject. Renamed children to m_children for cls compliance. Changed object id from uint to int to meet compliance.
This commit is contained in:
parent
5425cad195
commit
47aa3324ce
@ -78,7 +78,7 @@ namespace OSCADSharp.UnitTests
|
||||
.Translate(0, 5, 10).Rotate(0, 90, 0)
|
||||
.Translate(0, 0, 10).Scale(1, 1, 2);
|
||||
|
||||
List<uint> ids = obj.Children().Select(child => child.Id).ToList();
|
||||
List<int> ids = obj.Children().Select(child => child.Id).ToList();
|
||||
ids.Add(obj.Id);
|
||||
|
||||
Assert.AreEqual(ids.Count, ids.Distinct().Count());
|
||||
|
||||
@ -21,12 +21,12 @@ namespace OSCADSharp
|
||||
|
||||
public override Vector3 Position()
|
||||
{
|
||||
return children[0].Position();
|
||||
return m_children[0].Position();
|
||||
}
|
||||
|
||||
public override Bounds Bounds()
|
||||
{
|
||||
return children[0].Bounds();
|
||||
return m_children[0].Bounds();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ namespace OSCADSharp
|
||||
internal MultiStatementObject(string outerStatement, IEnumerable<OSCADObject> children)
|
||||
{
|
||||
this.outerStatement = outerStatement;
|
||||
this.children = children.ToList();
|
||||
this.m_children = children.ToList();
|
||||
foreach (var child in children)
|
||||
{
|
||||
child.Parent = this;
|
||||
@ -28,7 +28,7 @@ namespace OSCADSharp
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (var child in this.children)
|
||||
foreach (var child in this.m_children)
|
||||
{
|
||||
sb.Append(child.ToString());
|
||||
}
|
||||
@ -40,7 +40,7 @@ namespace OSCADSharp
|
||||
public override OSCADObject Clone()
|
||||
{
|
||||
List<OSCADObject> childClones = new List<OSCADObject>();
|
||||
foreach (var child in this.children)
|
||||
foreach (var child in this.m_children)
|
||||
{
|
||||
childClones.Add(child.Clone());
|
||||
}
|
||||
@ -53,7 +53,7 @@ namespace OSCADSharp
|
||||
|
||||
public override Vector3 Position()
|
||||
{
|
||||
var positions = this.children.Select(child => child.Position());
|
||||
var positions = this.m_children.Select(child => child.Position());
|
||||
return Vector3.Average(positions.ToArray());
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ namespace OSCADSharp
|
||||
var newBottomLeft = new Vector3();
|
||||
var newTopRight = new Vector3();
|
||||
|
||||
foreach (var child in this.children)
|
||||
foreach (var child in this.m_children)
|
||||
{
|
||||
var bounds = child.Bounds();
|
||||
if (bounds.XMin < newBottomLeft.X)
|
||||
|
||||
@ -17,7 +17,7 @@ namespace OSCADSharp
|
||||
{
|
||||
this.obj = obj;
|
||||
|
||||
this.children.Add(obj);
|
||||
this.m_children.Add(obj);
|
||||
obj.Parent = this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,14 +11,14 @@ namespace OSCADSharp
|
||||
/// </summary>
|
||||
internal static class Ids
|
||||
{
|
||||
private static uint globalId = 0;
|
||||
private static int globalId = 0;
|
||||
private static object idLockObject = new object();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a unique auto-incrementing integer id
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal static uint Get()
|
||||
internal static int Get()
|
||||
{
|
||||
lock (idLockObject)
|
||||
{
|
||||
|
||||
@ -5,6 +5,8 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
[assembly: CLSCompliant(true)]
|
||||
|
||||
namespace OSCADSharp
|
||||
{
|
||||
/// <summary>
|
||||
@ -14,13 +16,13 @@ namespace OSCADSharp
|
||||
public abstract class OSCADObject : IBindable
|
||||
{
|
||||
#region Attributes
|
||||
private uint id = Ids.Get();
|
||||
private int id = Ids.Get();
|
||||
|
||||
/// <summary>
|
||||
/// The unique Id of the object
|
||||
/// these values auto-increment
|
||||
/// </summary>
|
||||
public uint Id { get { return this.id; } }
|
||||
public int Id { get { return this.id; } }
|
||||
|
||||
/// <summary>
|
||||
/// Name of this OSCADObject
|
||||
@ -775,7 +777,7 @@ namespace OSCADSharp
|
||||
/// <summary>
|
||||
/// Internal collection of children for this object
|
||||
/// </summary>
|
||||
protected List<OSCADObject> children = new List<OSCADObject>();
|
||||
protected List<OSCADObject> m_children = new List<OSCADObject>();
|
||||
|
||||
/// <summary>
|
||||
/// Returns all chidren of this OSCADObject
|
||||
@ -786,12 +788,12 @@ namespace OSCADSharp
|
||||
{
|
||||
if(recursive == false)
|
||||
{
|
||||
return new List<OSCADObject>(this.children);
|
||||
return new List<OSCADObject>(this.m_children);
|
||||
}
|
||||
|
||||
// Initial children are reversed here because for objects with multiple children (such as boolean operations)
|
||||
// the natural collection order would yield opposite the expected order in a stack (first child would be the last popped)
|
||||
Stack<OSCADObject> toTraverse = new Stack<OSCADObject>(this.children.Reverse<OSCADObject>());
|
||||
Stack<OSCADObject> toTraverse = new Stack<OSCADObject>(this.m_children.Reverse<OSCADObject>());
|
||||
List<OSCADObject> allChildren = new List<OSCADObject>();
|
||||
OSCADObject child = null;
|
||||
|
||||
@ -800,7 +802,7 @@ namespace OSCADSharp
|
||||
child = toTraverse.Pop();
|
||||
allChildren.Add(child);
|
||||
|
||||
foreach (var subChild in child.children)
|
||||
foreach (var subChild in child.m_children)
|
||||
{
|
||||
toTraverse.Push(subChild);
|
||||
}
|
||||
@ -864,12 +866,12 @@ namespace OSCADSharp
|
||||
{
|
||||
if(left.GetType() == typeof(Union))
|
||||
{
|
||||
left.children.Add(right);
|
||||
left.m_children.Add(right);
|
||||
return left;
|
||||
}
|
||||
else if(right.GetType() == typeof(Union))
|
||||
{
|
||||
right.children.Add(left);
|
||||
right.m_children.Add(left);
|
||||
return right;
|
||||
}
|
||||
else
|
||||
@ -888,12 +890,12 @@ namespace OSCADSharp
|
||||
{
|
||||
if (left.GetType() == typeof(Difference))
|
||||
{
|
||||
left.children.Add(right);
|
||||
left.m_children.Add(right);
|
||||
return left;
|
||||
}
|
||||
else if (right.GetType() == typeof(Difference))
|
||||
{
|
||||
right.children.Add(left);
|
||||
right.m_children.Add(left);
|
||||
return right;
|
||||
}
|
||||
else
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user