/// <summary> /// Returns a rectangle representing the given ring - if it is an axis-parallel rectangle. Otherwise returns null; /// </summary> /// <param name="name"></param> /// <returns></returns> public RectangleF?GetRingAsRectF(string name) { var poly = this[name]; var rect = PolygonMath.GetBoundingBox(poly); var poly2 = PolygonMath.ToPoly(rect); return(PolygonMath.ArraysEqual(poly, poly2) ? (RectangleF?)rect : null); }