public static string NormalForm(String textSpec, out String errmsg) { Region reg = new Region(); Parser par = new Parser(); par.input = textSpec; par.buildto(reg); if (par.parse() == false) { errmsg = par.errmsg(); return null; } else { errmsg = "ok"; } reg.normalize(); return reg.ToString(); }
/// <summary> /// Normalize the region specification. /// The text interface allow a region to be specified in terms of /// rectangles, circles, polygons, convex hulls of points, etc. /// A so called <i>normal form</i> is a string that contains only /// a union of convexes. /// </summary> /// <param name="textSpec">Legacy style descritption of region</param> /// <returns>A specification consisting of a union of Convexes</returns> public static string NormalForm ( String textSpec ) { Region reg = new Region(); Parser par = new Parser(); par.input = textSpec; par.buildto(reg); if (par.parse() == false) { return null; } reg.normalize(); return reg.ToString(); }