public void Drawing_CreateBoundingBox()
 {
     var doubles = new[] {0.0, 0.0, 1.0, -2.0};
     var points = VA.Drawing.Point.FromDoubles(doubles);
     var bb0 = new VA.Drawing.BoundingBox(points);
     var bb = bb0.Rectangle;
     Assert.AreEqual(0, bb.Left);
     Assert.AreEqual(0, bb.Top);
     Assert.AreEqual(1, bb.Right);
     Assert.AreEqual(-2, bb.Bottom);
 }
 public static VA.Drawing.Rectangle GetBoundingBox(IEnumerable<VA.Shapes.XFormCells> xfrms)
 {
     var bb = new VA.Drawing.BoundingBox(xfrms.Select(GetRectangle));
     if (!bb.HasValue)
     {
         throw new System.ArgumentException("Could not calculate bounding box");
     }
     else
     {
         return bb.Rectangle;
     }
 }
Пример #3
0
        public void Drawing_CreateBoundingBox()
        {
            var doubles = new[] { 0.0, 0.0, 1.0, -2.0 };
            var points  = VA.Drawing.Point.FromDoubles(doubles);
            var bb0     = new VA.Drawing.BoundingBox(points);
            var bb      = bb0.Rectangle;

            Assert.AreEqual(0, bb.Left);
            Assert.AreEqual(0, bb.Top);
            Assert.AreEqual(1, bb.Right);
            Assert.AreEqual(-2, bb.Bottom);
        }
Пример #4
0
        public static VA.Drawing.Rectangle GetBoundingBox(IEnumerable <VA.Shapes.XFormCells> xfrms)
        {
            var bb = new VA.Drawing.BoundingBox(xfrms.Select(GetRectangle));

            if (!bb.HasValue)
            {
                throw new System.ArgumentException("Could not calculate bounding box");
            }
            else
            {
                return(bb.Rectangle);
            }
        }
Пример #5
0
        public VA.Drawing.Rectangle GetBoundingBoxOfTree()
        {
            if (this.Root.ChildCount < 1)
            {
                throw new System.InvalidOperationException("There are no Nodes in the tree");
            }
            var nodes = this.Nodes.ToList();

            var bb = new VA.Drawing.BoundingBox(nodes.Select(n => n.Rect));

            if (!bb.HasValue)
            {
                throw new System.InvalidOperationException("Internal Error: Could not compute bounding box");
            }
            else
            {
                return(bb.Rectangle);
            }
        }