/// <summary> /// // EXP May 24, 2005 GYF /// Use the legacy text interface to build a region. This version uses /// a two-pass method to tighten the fit a bit. /// </summary> /// <param name="textSpec">Legacy style descritption of region</param> /// <param name="directory">Trace information is deposited here. /// Use <em>null</em> if no trace is required</param> /// <returns>A table of HtmIDs or null</returns> public static Int64[,] RegionTighter(String textSpec, string directory) { Int64[,] returnResult; Region reg = new Region(directory); Parser par; ArrayList lohis = new ArrayList(); par = new Parser(); par.input = textSpec; par.buildto(reg); if (par.parse() == false) { return null; } reg.smartintersect(false, HtmState.Instance.minlevel, HtmState.Instance.maxlevel, lohis); // EXP EXP EXP EXP // // I moved the below stuff to be done inside each convex... // and then merge.. // reg.smartintersect() is like reg.intersect, but // does this stuff below for each convex // //if (lohis.Count > 1) { //repeat with the heuristic rule // int fudle; // int hlevel; // int magic = HtmState.Instance.magicnumber; // // make magic 31 for tight fit // // make magic 30 for relaxed fit (unlike jeans) // // // Int64 blorp = HtmState.Instance.tcount; // for (fudle = 0; blorp > 0; fudle++) { // blorp >>= 2; // } // hlevel = (magic - fudle) / 2; // HtmState.Instance.minlevel = hlevel; // Do you reset this anytime? // HtmState.Instance.maxlevel = hlevel + 4; // reasonable cutoff? <EXP> // lohis.Clear(); // reg.intersect(false, // HtmState.Instance.minlevel, // HtmState.Instance.maxlevel, lohis); //} // int rows = lohis.Count / 2; int cols = 2; int k = 0; returnResult = new Int64[rows, cols]; for (int i = 0; i < rows; i++) { returnResult[i, 0] = (Int64)lohis[k++]; returnResult[i, 1] = (Int64)lohis[k++]; } return returnResult; }