Ejemplo n.º 1
0
        public static VisioAutomation.Geometry.Rectangle GetBoundingBox(IEnumerable <ShapeXFormData> xfrms)
        {
            var bb = BoundingBoxBuilder.FromRectangles(xfrms.Select(x => x.GetRectangle()));

            if (!bb.HasValue)
            {
                throw new System.ArgumentException("Could not calculate bounding box");
            }
            return(bb.Value);
        }
Ejemplo n.º 2
0
        public 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 = BoundingBoxBuilder.FromRectangles(nodes.Select(n => n.Rect));

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