From 62a0a034a13f81177896214cff5d67d8f178135b Mon Sep 17 00:00:00 2001 From: Michael L Smith Date: Mon, 22 Feb 2016 18:32:17 -0800 Subject: [PATCH] + Decided not to support Bounds() on Text3D objects, since there's a lot of work needed before it will be viable. --- OSCADSharp/OSCADSharp.UnitTests/Solids/Text3DTests.cs | 8 +++----- OSCADSharp/OSCADSharp/Solids/Text3D.cs | 10 +--------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/OSCADSharp/OSCADSharp.UnitTests/Solids/Text3DTests.cs b/OSCADSharp/OSCADSharp.UnitTests/Solids/Text3DTests.cs index 429593c..a9116ac 100644 --- a/OSCADSharp/OSCADSharp.UnitTests/Solids/Text3DTests.cs +++ b/OSCADSharp/OSCADSharp.UnitTests/Solids/Text3DTests.cs @@ -20,12 +20,10 @@ namespace OSCADSharp.UnitTests } [TestMethod] - public void Text_BoundsBasedOnFontSize() + [ExpectedException(typeof(NotSupportedException))] + public void Text_BoundsNotSupported() { - var obj = new Text3D("BBBB", 16); - - Assert.AreEqual(new Vector3(32, 8, 0.5), obj.Bounds().TopRight); - Assert.AreEqual(new Vector3(-32, -8, -0.5), obj.Bounds().BottomLeft); + var obj = new Text3D("BBBB", 16).Bounds(); } } } diff --git a/OSCADSharp/OSCADSharp/Solids/Text3D.cs b/OSCADSharp/OSCADSharp/Solids/Text3D.cs index 180cfd4..888da34 100644 --- a/OSCADSharp/OSCADSharp/Solids/Text3D.cs +++ b/OSCADSharp/OSCADSharp/Solids/Text3D.cs @@ -145,18 +145,10 @@ namespace OSCADSharp.Solids /// /// Returns the approximate boundaries of this OpenSCAD object - /// - /// Disclaimer: The bounds for text are particularly inaccurate, since - /// OSCADSharp doesn't have all font data necessary to calculate the - /// boundaries for all the possible fonts that could be used - /// /// public override Bounds Bounds() { - double fontSize = this.Size ?? 8; - double xAmount = fontSize * this.Text.Length; - - return new Bounds(new Vector3(-xAmount/2, -fontSize/2, -.5), new Vector3(xAmount / 2, fontSize / 2, .5)); + throw new NotSupportedException("Bounds are not supported for objects using Text3D"); } #endregion }