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>();
}
public Bindings(Dictionary<string, string> mappings)
internal Bindings(Dictionary<string, string> mappings)
{
this.propertyNametoOpenSCADFieldMappings = mappings;
}

View File

@ -19,8 +19,8 @@ namespace OSCADSharp
{"height", "z" }
};
public BindableVector SizeBinding = new BindableVector(new Vector3(), sizeSynonyms);
public BindableBoolean CenterBinding = new BindableBoolean("center");
public BindableVector SizeBinding { get; set; } = new BindableVector(new Vector3(), sizeSynonyms);
public BindableBoolean CenterBinding { get; set; } = new BindableBoolean("center");
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
/// (Default value is set the default install directory on Windows)
/// </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;
}
private static readonly Matrix identity = new Matrix(new double[] {
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
}, 4, 4);
internal static Matrix Identity { get { return identity; } }
internal static Matrix Identity()
{
return new Matrix(new double[] {
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1}, 4, 4); ;
}
/// <summary>
/// Gets a transformation matrix for performing rotations on the X-Axis
@ -95,7 +96,7 @@ namespace OSCADSharp
internal static Matrix XRotation(double angle)
{
if (angle == 0)
return Identity;
return Identity();
double radAngle = toRadians(angle);
double[] rotationArr = new double[] {
@ -117,7 +118,7 @@ namespace OSCADSharp
internal static Matrix YRotation(double angle)
{
if (angle == 0)
return Identity;
return Identity();
double radAngle = toRadians(angle);
double[] rotationArr = new double[] {
@ -139,7 +140,7 @@ namespace OSCADSharp
internal static Matrix ZRotation(double angle)
{
if (angle == 0)
return Identity;
return Identity();
double radAngle = toRadians(angle);
double[] rotationArr = new double[] {

View File

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

View File

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

View File

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

View File

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

View File

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