public string ItAdjustsFromRelativeTransforms(RelativeOriginTransform dir) { var element = new Mock<IElement>(); element.SetupGet(x => x.Width).Returns(12); element.SetupGet(x => x.Depth).Returns(12); element.SetupGet(x => x.Height).Returns(12); var trans = new Transform(10,10,10) .Adjust(dir, element.Object); return string.Join(",", new[] {trans.X, trans.Z, trans.Y}); }
private void Plan(IEnumerable<IStatement> statements, SymbolTable symbolTable, Transform transform, ComplexElement def) { foreach (var statement in statements) { if (statement is ElementDefinition) { var anotherDef = (ElementDefinition) statement; var ele = new ComplexElement(); Plan(anotherDef.Statements, symbolTable.Push(), Transform.Identity, ele); symbolTable = symbolTable.AddSymbol(anotherDef.Name, ele); } else if (statement is BuildByIdentifier) { var build = (BuildByIdentifier) statement; var ele = symbolTable[build.Identifier]; var buildInst = new BuildInstruction(build.Shape, build.Dimension, transform.Adjust(build.Location), ele); def.AddBuildInstruction(buildInst); } else if (statement is BuildByStatements) { var build = (BuildByStatements) statement; var ele = new ComplexElement(); Plan(build.Statements, symbolTable, Transform.Identity, ele); var buildInst = new BuildInstruction(build.Shape, build.Dimension, transform.Adjust(build.Location), ele); def.AddBuildInstruction(buildInst); } else if (statement is OriginTransformStatement) { var transStatement = (OriginTransformStatement) statement; if (transStatement.Instructions is AbsoluteTransformInstructions) { var absInstr = (AbsoluteTransformInstructions) transStatement.Instructions; var newTrans = transform.Adjust(absInstr.Direction, absInstr.Degree); Plan(transStatement.Statements,symbolTable,newTrans,def); } else { var absInstr = (RelativeTransformInstructions) transStatement.Instructions; var newTrans = transform.Adjust(absInstr.Direction, def); Plan(transStatement.Statements,symbolTable,newTrans,def); } } } }
public string ItAdjustsFromAbsoluteTransforms(AbsoluteOriginTransform dir, int degree) { var trans = new Transform(10,10,10).Adjust(dir, degree); return string.Join(",", new[] {trans.X, trans.Z, trans.Y}); }
public void Build(IBlockStamp stamp, Transform transform) { throw new NotImplementedException(); }
public void Place(IBlockStamp stamp, Transform transform) { _layout.Build(stamp, transform); }
public void Build(IBlockStamp stamp, Transform transform) { IShapePlan plan = null; switch (_shape) { case BuildShape.Box: plan = new BoxPlan(_dimension); break; case BuildShape.Wall: plan = new WallPlan(_dimension); break; default: throw new RuntimeException("Unknown shape: " + _shape); } foreach (var location in plan.GetLocations() .Select(x => new Location( x.X*_toBuild.Width + Location.X + transform.X, x.Z*_toBuild.Depth + Location.Z + transform.Z, x.Y*_toBuild.Height + Location.Y + transform.Y ))) { _toBuild.Build(stamp, new Transform(location.X, location.Z, location.Y)); } }
public void Build(IBlockStamp stamp, Transform trans) { stamp.PlaceBlock(_block, trans.ToLocation()); }
public void Build(IBlockStamp stamp, Transform transform) { foreach (var buildInstruction in BuildInstructions) { buildInstruction.Build(stamp, transform); } }