mirror of
https://github.com/eliasstepanik/OSCADSharpDotnet7.git
synced 2026-01-27 04:48:27 +00:00
Replaced a bunch of conditionals with new method BindIfVariableNotNull
This commit is contained in:
parent
730b54d703
commit
4c51ffc3f4
@ -767,6 +767,17 @@ namespace OSCADSharp
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal OSCADObject Parent { get; set; }
|
internal OSCADObject Parent { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If the variable is not null, binds it to the property specified
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="property"></param>
|
||||||
|
/// <param name="variable"></param>
|
||||||
|
internal void BindIfVariableNotNull(string property, Variable variable)
|
||||||
|
{
|
||||||
|
if (variable != null)
|
||||||
|
this.Bind(property, variable);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Internal collection of children for this object
|
/// Internal collection of children for this object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -75,14 +75,10 @@ namespace OSCADSharp.Solids
|
|||||||
/// <param name="minimumFragmentSize"></param>
|
/// <param name="minimumFragmentSize"></param>
|
||||||
public Sphere(Variable diameter = null, Variable resolution = null, Variable minimumAngle = null, Variable minimumFragmentSize = null)
|
public Sphere(Variable diameter = null, Variable resolution = null, Variable minimumAngle = null, Variable minimumFragmentSize = null)
|
||||||
{
|
{
|
||||||
if (diameter != null)
|
this.BindIfVariableNotNull("diameter", diameter);
|
||||||
this.Bind("diameter", diameter);
|
this.BindIfVariableNotNull("resolution", resolution);
|
||||||
if (resolution != null)
|
this.BindIfVariableNotNull("minimumangle", minimumAngle);
|
||||||
this.Bind("resolution", resolution);
|
this.BindIfVariableNotNull("minimumfragmentsize", minimumFragmentSize);
|
||||||
if (minimumAngle != null)
|
|
||||||
this.Bind("minimumangle", minimumAngle);
|
|
||||||
if (minimumFragmentSize != null)
|
|
||||||
this.Bind("minimumfragmentsize", minimumFragmentSize);
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -39,10 +39,7 @@ namespace OSCADSharp.Transforms
|
|||||||
internal ColoredObject(OSCADObject obj, Variable colorName, Variable opacity) : base(obj)
|
internal ColoredObject(OSCADObject obj, Variable colorName, Variable opacity) : base(obj)
|
||||||
{
|
{
|
||||||
this.Bind("color", colorName);
|
this.Bind("color", colorName);
|
||||||
if(opacity != null)
|
this.BindIfVariableNotNull("opacity", opacity);
|
||||||
{
|
|
||||||
this.Bind("opacity", opacity);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
|||||||
@ -38,13 +38,9 @@ namespace OSCADSharp.Transforms
|
|||||||
internal MirroredObject(OSCADObject obj, Vector3 normal, Variable x, Variable y, Variable z) : base(obj)
|
internal MirroredObject(OSCADObject obj, Vector3 normal, Variable x, Variable y, Variable z) : base(obj)
|
||||||
{
|
{
|
||||||
this.Normal = new BindableVector(normal);
|
this.Normal = new BindableVector(normal);
|
||||||
|
this.BindIfVariableNotNull("x", x);
|
||||||
if (x != null)
|
this.BindIfVariableNotNull("y", y);
|
||||||
this.Bind("x", x);
|
this.BindIfVariableNotNull("z", z);
|
||||||
if (y != null)
|
|
||||||
this.Bind("y", y);
|
|
||||||
if (z != null)
|
|
||||||
this.Bind("z", z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
|||||||
@ -38,12 +38,9 @@ namespace OSCADSharp.Transforms
|
|||||||
{
|
{
|
||||||
this.Size = new BindableVector(size);
|
this.Size = new BindableVector(size);
|
||||||
|
|
||||||
if (x != null)
|
this.BindIfVariableNotNull("x", x);
|
||||||
this.Bind("x", x);
|
this.BindIfVariableNotNull("y", y);
|
||||||
if (y != null)
|
this.BindIfVariableNotNull("z", z);
|
||||||
this.Bind("y", y);
|
|
||||||
if (z != null)
|
|
||||||
this.Bind("z", z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
|||||||
@ -38,12 +38,9 @@ namespace OSCADSharp.Transforms
|
|||||||
{
|
{
|
||||||
this.Angle = new BindableVector(angle);
|
this.Angle = new BindableVector(angle);
|
||||||
|
|
||||||
if (x != null)
|
this.BindIfVariableNotNull("x", x);
|
||||||
this.Bind("x", x);
|
this.BindIfVariableNotNull("y", y);
|
||||||
if (y != null)
|
this.BindIfVariableNotNull("z", z);
|
||||||
this.Bind("y", y);
|
|
||||||
if (z != null)
|
|
||||||
this.Bind("z", z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
|||||||
@ -38,12 +38,9 @@ namespace OSCADSharp.Transforms
|
|||||||
{
|
{
|
||||||
this.ScaleFactor = new BindableVector(scale);
|
this.ScaleFactor = new BindableVector(scale);
|
||||||
|
|
||||||
if (x != null)
|
this.BindIfVariableNotNull("x", x);
|
||||||
this.Bind("x", x);
|
this.BindIfVariableNotNull("y", y);
|
||||||
if (y != null)
|
this.BindIfVariableNotNull("z", z);
|
||||||
this.Bind("y", y);
|
|
||||||
if (z != null)
|
|
||||||
this.Bind("z", z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
|||||||
@ -35,12 +35,9 @@ namespace OSCADSharp.Transforms
|
|||||||
{
|
{
|
||||||
this.Vector = new BindableVector(vector);
|
this.Vector = new BindableVector(vector);
|
||||||
|
|
||||||
if (x != null)
|
this.BindIfVariableNotNull("x", x);
|
||||||
this.Bind("x", x);
|
this.BindIfVariableNotNull("y", y);
|
||||||
if (y != null)
|
this.BindIfVariableNotNull("z", z);
|
||||||
this.Bind("y", y);
|
|
||||||
if (z != null)
|
|
||||||
this.Bind("z", z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user