public static Drawing.Rectangle GetBoundingBox(this IVisio.Selection selection, IVisio.VisBoundingBoxArgs args) { double bbx0, bby0, bbx1, bby1; selection.BoundingBox((short) args, out bbx0, out bby0, out bbx1, out bby1); var r = new Drawing.Rectangle(bbx0, bby0, bbx1, bby1); return r; }
public static Drawing.Rectangle GetBoundingBox(this IVisio.Master master, IVisio.VisBoundingBoxArgs args) { // MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vissdk11/html/vimthBoundingBox_HV81900422.asp double bbx0, bby0, bbx1, bby1; master.BoundingBox((short) args, out bbx0, out bby0, out bbx1, out bby1); var r = new Drawing.Rectangle(bbx0, bby0, bbx1, bby1); return r; }
public static Dictionary<Color, double> ObjectRectangularity(this Color[,] image) { Dictionary<Color, double> result = new Dictionary<Color, double>(); Dictionary<Color, int> areas = image.Areas(); Dictionary<Color, Rectangle> bounds = image.BoundingBox(); foreach ( Color key in areas.Keys ) result.Add(key, areas[key] / (double)( bounds[key].Height * bounds[key].Width ) ); /* Dictionary<Color, Rectangle> bounds = image.BoundingBox(); Dictionary<Color, int> areas = image.Areas(); Dictionary<Color, double> result = bounds.ToDictionary(x => x.Key, x => (double)area[x.Key] / (double)( x.Value.Width * x.Value.Height ));*/ return result; }