Renamed BlockFormatter -> SingleBlockFormatter

BlockStatementObject -> MultiBlockStatementObject
This commit is contained in:
Mike Smith 2016-02-14 11:26:47 -08:00
parent e1aa360635
commit 81b49cf994
15 changed files with 20 additions and 20 deletions

View File

@ -10,7 +10,7 @@ namespace OSCADSharp.Booleans
/// <summary>
/// Subtracts the 2nd (and all further) child nodes from the first one (logical and not).
/// </summary>
internal class Difference : BlockStatementObject
internal class Difference : MultiBlockStatementObject
{
/// <summary>
/// Creates a subtraction of child nodes

View File

@ -10,7 +10,7 @@ namespace OSCADSharp.Booleans
/// <summary>
/// Creates the intersection of all child nodes
/// </summary>
internal class Intersection : BlockStatementObject
internal class Intersection : MultiBlockStatementObject
{
/// <summary>
/// Creates the intersection of all child nodes

View File

@ -10,7 +10,7 @@ namespace OSCADSharp.Booleans
/// <summary>
/// A union of child nodes. This is the sum of all children (logical or).
/// </summary>
internal class Union : BlockStatementObject
internal class Union : MultiBlockStatementObject
{
/// <summary>
/// Create a union that is the combination of all children

View File

@ -43,8 +43,8 @@
<Compile Include="Sizes.cs" />
<Compile Include="Transforms\IMimicer.cs" />
<Compile Include="Transforms\LinearExtrudedObject.cs" />
<Compile Include="Scripting\BlockFormatter.cs" />
<Compile Include="Scripting\BlockStatementObject.cs" />
<Compile Include="Scripting\SingleBlockFormatter.cs" />
<Compile Include="Scripting\MultiBlockStatementObject.cs" />
<Compile Include="Booleans\Difference.cs" />
<Compile Include="Booleans\Intersection.cs" />
<Compile Include="Booleans\Union.cs" />

View File

@ -11,11 +11,11 @@ namespace OSCADSharp.Scripting
/// A statement that has multiple child nodes, whose ToString output
/// is more or less just an aggregate of the children
/// </summary>
internal class BlockStatementObject : OSCADObject
internal class MultiBlockStatementObject : OSCADObject
{
private string outerStatement;
internal BlockStatementObject(string outerStatement, IEnumerable<OSCADObject> children)
internal MultiBlockStatementObject(string outerStatement, IEnumerable<OSCADObject> children)
{
this.outerStatement = outerStatement;
this.children = children.ToList();
@ -29,7 +29,7 @@ namespace OSCADSharp.Scripting
sb.Append(child.ToString());
}
var formatter = new BlockFormatter(this.outerStatement, sb.ToString());
var formatter = new SingleBlockFormatter(this.outerStatement, sb.ToString());
return formatter.ToString();
}
@ -41,7 +41,7 @@ namespace OSCADSharp.Scripting
childClones.Add(child.Clone());
}
return new BlockStatementObject(this.outerStatement, childClones);
return new MultiBlockStatementObject(this.outerStatement, childClones);
}
}
}

View File

@ -11,13 +11,13 @@ namespace OSCADSharp.Scripting
/// A class that creates blocks of curly-braced script with the
/// specified level of indentation
/// </summary>
internal class BlockFormatter
internal class SingleBlockFormatter
{
private string outerCode;
private string innerCode;
private string indentationAmount = " ";
internal BlockFormatter(string outerCode, string innerCode)
internal SingleBlockFormatter(string outerCode, string innerCode)
{
this.outerCode = outerCode;
this.innerCode = innerCode;

View File

@ -122,7 +122,7 @@ namespace OSCADSharp.Solids
sb.Append(");");
var formatter = new BlockFormatter(String.Format("linear_extrude(height = {0})", 1), sb.ToString());
var formatter = new SingleBlockFormatter(String.Format("linear_extrude(height = {0})", 1), sb.ToString());
return formatter.ToString();
}
#endregion

View File

@ -37,7 +37,7 @@ namespace OSCADSharp.Transforms
public override string ToString()
{
string colorCommand = String.Format("color(\"{0}\", {1})", this.ColorName, this.Opacity);
var formatter = new BlockFormatter(colorCommand, this.obj.ToString());
var formatter = new SingleBlockFormatter(colorCommand, this.obj.ToString());
return formatter.ToString();
}

View File

@ -45,7 +45,7 @@ namespace OSCADSharp.Transforms
public override string ToString()
{
string extrudeCommand = String.Format("linear_extrude(height = {0})", this.Height.ToString());
var formatter = new BlockFormatter(extrudeCommand, this.obj.ToString());
var formatter = new SingleBlockFormatter(extrudeCommand, this.obj.ToString());
return formatter.ToString();
}
}

View File

@ -10,7 +10,7 @@ namespace OSCADSharp.Transforms
/// <summary>
/// Creates an object that's the minkowski sum of child objects
/// </summary>
internal class MinkowskiedObject : BlockStatementObject
internal class MinkowskiedObject : MultiBlockStatementObject
{
public MinkowskiedObject(IEnumerable<OSCADObject> children) : base("minkowski()", children)

View File

@ -36,7 +36,7 @@ namespace OSCADSharp.Transforms
public override string ToString()
{
string mirrorCommand = String.Format("mirror([{0}, {1}, {2}])", this.Normal.X, this.Normal.Y, this.Normal.Z);
var formatter = new BlockFormatter(mirrorCommand, this.obj.ToString());
var formatter = new SingleBlockFormatter(mirrorCommand, this.obj.ToString());
return formatter.ToString();
}

View File

@ -35,7 +35,7 @@ namespace OSCADSharp.Transforms
{
string resizeCommand = String.Format("resize([{0}, {1}, {2}])", this.Size.X.ToString(),
this.Size.Y.ToString(), this.Size.Z.ToString());
var formatter = new BlockFormatter(resizeCommand, this.obj.ToString());
var formatter = new SingleBlockFormatter(resizeCommand, this.obj.ToString());
return formatter.ToString();
}

View File

@ -35,7 +35,7 @@ namespace OSCADSharp.Transforms
{
string rotateCommand = String.Format("rotate([{0}, {1}, {2}])",
this.Angle.X.ToString(), this.Angle.Y.ToString(), this.Angle.Z.ToString());
var formatter = new BlockFormatter(rotateCommand, this.obj.ToString());
var formatter = new SingleBlockFormatter(rotateCommand, this.obj.ToString());
return formatter.ToString();
}

View File

@ -35,7 +35,7 @@ namespace OSCADSharp.Transforms
{
string scaleCommand = String.Format("scale(v = [{0}, {1}, {2}])",
this.ScaleFactor.X.ToString(), this.ScaleFactor.Y.ToString(), this.ScaleFactor.Z.ToString());
var formatter = new BlockFormatter(scaleCommand, this.obj.ToString());
var formatter = new SingleBlockFormatter(scaleCommand, this.obj.ToString());
return formatter.ToString();
}

View File

@ -32,7 +32,7 @@ namespace OSCADSharp.Transforms
{
string translateCommmand = String.Format("translate(v = [{0}, {1}, {2}])",
this.Vector.X.ToString(), this.Vector.Y.ToString(), this.Vector.Z.ToString());
var formatter = new BlockFormatter(translateCommmand, this.obj.ToString());
var formatter = new SingleBlockFormatter(translateCommmand, this.obj.ToString());
return formatter.ToString();
}