Merge branch 'Refactor/BindingRefactor' of https://github.com/Exolun/OSCADSharp into Refactor/BindingRefactor

This commit is contained in:
Michael Smith 2016-03-17 23:02:37 -07:00
commit 27a50f8025
9 changed files with 25 additions and 24 deletions

View File

@ -21,7 +21,7 @@ namespace OSCADSharp
this.propertyNametoOpenSCADFieldMappings = new Dictionary<string, string>(); this.propertyNametoOpenSCADFieldMappings = new Dictionary<string, string>();
} }
public Bindings(Dictionary<string, string> mappings) internal Bindings(Dictionary<string, string> mappings)
{ {
this.propertyNametoOpenSCADFieldMappings = mappings; this.propertyNametoOpenSCADFieldMappings = mappings;
} }

View File

@ -19,8 +19,8 @@ namespace OSCADSharp
{"height", "z" } {"height", "z" }
}; };
public BindableVector SizeBinding = new BindableVector(new Vector3(), sizeSynonyms); public BindableVector SizeBinding { get; set; } = new BindableVector(new Vector3(), sizeSynonyms);
public BindableBoolean CenterBinding = new BindableBoolean("center"); public BindableBoolean CenterBinding { get; set; } = new BindableBoolean("center");
public void Bind<T>(T obj, string property, Variable variable) public void Bind<T>(T obj, string property, Variable variable)
{ {

View File

@ -23,6 +23,6 @@ namespace OSCADSharp.IO
/// Path to the OpenSCAD executable for file invocation /// Path to the OpenSCAD executable for file invocation
/// (Default value is set the default install directory on Windows) /// (Default value is set the default install directory on Windows)
/// </summary> /// </summary>
public static string OpenSCADPath = new OpenSCADPathFinder().GetPath(); public static string OpenSCADPath { get; set; } = new OpenSCADPathFinder().GetPath();
} }
} }

View File

@ -78,13 +78,14 @@ namespace OSCADSharp
return piOver180 * degrees; return piOver180 * degrees;
} }
private static readonly Matrix identity = new Matrix(new double[] { internal static Matrix Identity()
1, 0, 0, 0, {
0, 1, 0, 0, return new Matrix(new double[] {
0, 0, 1, 0, 1, 0, 0, 0,
0, 0, 0, 1 0, 1, 0, 0,
}, 4, 4); 0, 0, 1, 0,
internal static Matrix Identity { get { return identity; } } 0, 0, 0, 1}, 4, 4); ;
}
/// <summary> /// <summary>
/// Gets a transformation matrix for performing rotations on the X-Axis /// Gets a transformation matrix for performing rotations on the X-Axis
@ -95,7 +96,7 @@ namespace OSCADSharp
internal static Matrix XRotation(double angle) internal static Matrix XRotation(double angle)
{ {
if (angle == 0) if (angle == 0)
return Identity; return Identity();
double radAngle = toRadians(angle); double radAngle = toRadians(angle);
double[] rotationArr = new double[] { double[] rotationArr = new double[] {
@ -117,7 +118,7 @@ namespace OSCADSharp
internal static Matrix YRotation(double angle) internal static Matrix YRotation(double angle)
{ {
if (angle == 0) if (angle == 0)
return Identity; return Identity();
double radAngle = toRadians(angle); double radAngle = toRadians(angle);
double[] rotationArr = new double[] { double[] rotationArr = new double[] {
@ -139,7 +140,7 @@ namespace OSCADSharp
internal static Matrix ZRotation(double angle) internal static Matrix ZRotation(double angle)
{ {
if (angle == 0) if (angle == 0)
return Identity; return Identity();
double radAngle = toRadians(angle); double radAngle = toRadians(angle);
double[] rotationArr = new double[] { double[] rotationArr = new double[] {

View File

@ -779,7 +779,7 @@ namespace OSCADSharp
/// <summary> /// <summary>
/// Internal collection of children for this object /// Internal collection of children for this object
/// </summary> /// </summary>
protected List<OSCADObject> m_children = new List<OSCADObject>(); protected List<OSCADObject> m_children { get; set; } = new List<OSCADObject>();
/// <summary> /// <summary>
/// Returns all chidren of this OSCADObject /// Returns all chidren of this OSCADObject

View File

@ -11,7 +11,7 @@ namespace OSCADSharp
/// </summary> /// </summary>
internal abstract class SingleStatementObject : OSCADObject internal abstract class SingleStatementObject : OSCADObject
{ {
protected OSCADObject obj; protected OSCADObject obj { get; set; }
protected SingleStatementObject(OSCADObject obj) protected SingleStatementObject(OSCADObject obj)
{ {

View File

@ -8,8 +8,8 @@ namespace OSCADSharp
{ {
internal class SphereScriptBuilder internal class SphereScriptBuilder
{ {
private IBindings bindings; private readonly IBindings bindings;
private Sphere sphere; private readonly Sphere sphere;
internal SphereScriptBuilder(IBindings bindings, Sphere sphere) internal SphereScriptBuilder(IBindings bindings, Sphere sphere)
{ {

View File

@ -14,27 +14,27 @@ namespace OSCADSharp.Utility
/// <summary> /// <summary>
/// One imperial inch /// One imperial inch
/// </summary> /// </summary>
public const double One = 25.4; public static double One { get; private set; } = 25.4;
/// <summary> /// <summary>
/// Half of an imperial inch /// Half of an imperial inch
/// </summary> /// </summary>
public const double Half = One / 2; public static double Half { get; private set; } = One / 2;
/// <summary> /// <summary>
/// Quarter of an imperial inch /// Quarter of an imperial inch
/// </summary> /// </summary>
public const double Quarter = Half / 2; public static double Quarter { get; private set; } = Half / 2;
/// <summary> /// <summary>
/// Eigth of an imperial inch /// Eigth of an imperial inch
/// </summary> /// </summary>
public const double Eigth = Quarter / 2; public static double Eigth { get; private set; } = Quarter / 2;
/// <summary> /// <summary>
/// Sixteenth of an imperial inch /// Sixteenth of an imperial inch
/// </summary> /// </summary>
public const double Sixteenth = Eigth / 2; public static double Sixteenth { get; private set; } = Eigth / 2;
/// <summary> /// <summary>
/// Converts inches to millimeters /// Converts inches to millimeters

View File

@ -16,7 +16,7 @@ namespace OSCADSharp
/// Global variables that can be assigned for output at the /// Global variables that can be assigned for output at the
/// top of OpenSCAD scripts /// top of OpenSCAD scripts
/// </summary> /// </summary>
public static Variables Global = new Variables(); public static Variables Global { get; set; } = new Variables();
private ConcurrentDictionary<string, Variable> variables = new ConcurrentDictionary<string, Variable>(); private ConcurrentDictionary<string, Variable> variables = new ConcurrentDictionary<string, Variable>();
/// <summary> /// <summary>