mirror of
https://github.com/eliasstepanik/OSCADSharpDotnet7.git
synced 2026-01-25 12:08:26 +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, 5, 10).Rotate(0, 90, 0)
|
||||||
.Translate(0, 0, 10).Scale(1, 1, 2);
|
.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);
|
ids.Add(obj.Id);
|
||||||
|
|
||||||
Assert.AreEqual(ids.Count, ids.Distinct().Count());
|
Assert.AreEqual(ids.Count, ids.Distinct().Count());
|
||||||
|
|||||||
@ -21,12 +21,12 @@ namespace OSCADSharp
|
|||||||
|
|
||||||
public override Vector3 Position()
|
public override Vector3 Position()
|
||||||
{
|
{
|
||||||
return children[0].Position();
|
return m_children[0].Position();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Bounds Bounds()
|
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)
|
internal MultiStatementObject(string outerStatement, IEnumerable<OSCADObject> children)
|
||||||
{
|
{
|
||||||
this.outerStatement = outerStatement;
|
this.outerStatement = outerStatement;
|
||||||
this.children = children.ToList();
|
this.m_children = children.ToList();
|
||||||
foreach (var child in children)
|
foreach (var child in children)
|
||||||
{
|
{
|
||||||
child.Parent = this;
|
child.Parent = this;
|
||||||
@ -28,7 +28,7 @@ namespace OSCADSharp
|
|||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
foreach (var child in this.children)
|
foreach (var child in this.m_children)
|
||||||
{
|
{
|
||||||
sb.Append(child.ToString());
|
sb.Append(child.ToString());
|
||||||
}
|
}
|
||||||
@ -40,7 +40,7 @@ namespace OSCADSharp
|
|||||||
public override OSCADObject Clone()
|
public override OSCADObject Clone()
|
||||||
{
|
{
|
||||||
List<OSCADObject> childClones = new List<OSCADObject>();
|
List<OSCADObject> childClones = new List<OSCADObject>();
|
||||||
foreach (var child in this.children)
|
foreach (var child in this.m_children)
|
||||||
{
|
{
|
||||||
childClones.Add(child.Clone());
|
childClones.Add(child.Clone());
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ namespace OSCADSharp
|
|||||||
|
|
||||||
public override Vector3 Position()
|
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());
|
return Vector3.Average(positions.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ namespace OSCADSharp
|
|||||||
var newBottomLeft = new Vector3();
|
var newBottomLeft = new Vector3();
|
||||||
var newTopRight = new Vector3();
|
var newTopRight = new Vector3();
|
||||||
|
|
||||||
foreach (var child in this.children)
|
foreach (var child in this.m_children)
|
||||||
{
|
{
|
||||||
var bounds = child.Bounds();
|
var bounds = child.Bounds();
|
||||||
if (bounds.XMin < newBottomLeft.X)
|
if (bounds.XMin < newBottomLeft.X)
|
||||||
|
|||||||
@ -17,7 +17,7 @@ namespace OSCADSharp
|
|||||||
{
|
{
|
||||||
this.obj = obj;
|
this.obj = obj;
|
||||||
|
|
||||||
this.children.Add(obj);
|
this.m_children.Add(obj);
|
||||||
obj.Parent = this;
|
obj.Parent = this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,14 +11,14 @@ namespace OSCADSharp
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal static class Ids
|
internal static class Ids
|
||||||
{
|
{
|
||||||
private static uint globalId = 0;
|
private static int globalId = 0;
|
||||||
private static object idLockObject = new object();
|
private static object idLockObject = new object();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a unique auto-incrementing integer id
|
/// Gets a unique auto-incrementing integer id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
internal static uint Get()
|
internal static int Get()
|
||||||
{
|
{
|
||||||
lock (idLockObject)
|
lock (idLockObject)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,6 +5,8 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
[assembly: CLSCompliant(true)]
|
||||||
|
|
||||||
namespace OSCADSharp
|
namespace OSCADSharp
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -14,13 +16,13 @@ namespace OSCADSharp
|
|||||||
public abstract class OSCADObject : IBindable
|
public abstract class OSCADObject : IBindable
|
||||||
{
|
{
|
||||||
#region Attributes
|
#region Attributes
|
||||||
private uint id = Ids.Get();
|
private int id = Ids.Get();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The unique Id of the object
|
/// The unique Id of the object
|
||||||
/// these values auto-increment
|
/// these values auto-increment
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint Id { get { return this.id; } }
|
public int Id { get { return this.id; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Name of this OSCADObject
|
/// Name of this OSCADObject
|
||||||
@ -775,7 +777,7 @@ namespace OSCADSharp
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Internal collection of children for this object
|
/// Internal collection of children for this object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected List<OSCADObject> children = new List<OSCADObject>();
|
protected List<OSCADObject> m_children = new List<OSCADObject>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns all chidren of this OSCADObject
|
/// Returns all chidren of this OSCADObject
|
||||||
@ -786,12 +788,12 @@ namespace OSCADSharp
|
|||||||
{
|
{
|
||||||
if(recursive == false)
|
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)
|
// 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)
|
// 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>();
|
List<OSCADObject> allChildren = new List<OSCADObject>();
|
||||||
OSCADObject child = null;
|
OSCADObject child = null;
|
||||||
|
|
||||||
@ -800,7 +802,7 @@ namespace OSCADSharp
|
|||||||
child = toTraverse.Pop();
|
child = toTraverse.Pop();
|
||||||
allChildren.Add(child);
|
allChildren.Add(child);
|
||||||
|
|
||||||
foreach (var subChild in child.children)
|
foreach (var subChild in child.m_children)
|
||||||
{
|
{
|
||||||
toTraverse.Push(subChild);
|
toTraverse.Push(subChild);
|
||||||
}
|
}
|
||||||
@ -864,12 +866,12 @@ namespace OSCADSharp
|
|||||||
{
|
{
|
||||||
if(left.GetType() == typeof(Union))
|
if(left.GetType() == typeof(Union))
|
||||||
{
|
{
|
||||||
left.children.Add(right);
|
left.m_children.Add(right);
|
||||||
return left;
|
return left;
|
||||||
}
|
}
|
||||||
else if(right.GetType() == typeof(Union))
|
else if(right.GetType() == typeof(Union))
|
||||||
{
|
{
|
||||||
right.children.Add(left);
|
right.m_children.Add(left);
|
||||||
return right;
|
return right;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -888,12 +890,12 @@ namespace OSCADSharp
|
|||||||
{
|
{
|
||||||
if (left.GetType() == typeof(Difference))
|
if (left.GetType() == typeof(Difference))
|
||||||
{
|
{
|
||||||
left.children.Add(right);
|
left.m_children.Add(right);
|
||||||
return left;
|
return left;
|
||||||
}
|
}
|
||||||
else if (right.GetType() == typeof(Difference))
|
else if (right.GetType() == typeof(Difference))
|
||||||
{
|
{
|
||||||
right.children.Add(left);
|
right.m_children.Add(left);
|
||||||
return right;
|
return right;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user