using OSCADSharp.Scripting; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using OSCADSharp.Spatial; namespace OSCADSharp.Transforms { /// /// An object or objects that have been moved along the specified vector /// internal class TranslatedObject : SingleStatementObject { internal Vector3 Vector { get; set; } /// /// Creates a translated object /// /// Object(s) to translate /// Amount to translate by internal TranslatedObject(OSCADObject obj, Vector3 vector) : base(obj) { this.Vector = vector; } public override string ToString() { string translateCommmand = String.Format("translate(v = [{0}, {1}, {2}])", this.Vector.X.ToString(), this.Vector.Y.ToString(), this.Vector.Z.ToString()); var formatter = new SingleBlockFormatter(translateCommmand, this.obj.ToString()); return formatter.ToString(); } public override OSCADObject Clone() { return new TranslatedObject(this.obj.Clone(), this.Vector) { Name = this.Name }; } public override Vector3 Position() { return this.obj.Position() + this.Vector; } public override Bounds Bounds() { var oldBounds = obj.Bounds(); return new Bounds(oldBounds.BottomLeft + this.Vector, oldBounds.TopRight + this.Vector); } public override void Bind(string property, Variable variable) { throw new NotImplementedException(); } } }