//private static List<GroupedText> GetGroups(IEnumerable<Tree> text) //{ // List<GroupedText> groups = new List<GroupedText>(); // if (text.Count() > 0) // { // groups.Add(new GroupedText(text.First())); // text = text.Skip(1); // foreach (Tree txt in text) // { // GroupedText nearest = GetClosest(txt, groups); // int right = nearest.Boundary.Left + nearest.Boundary.Width; // int bottom = nearest.Boundary.Top + nearest.Boundary.Height; // if ((txt.Left < right + MAX_SPACE_DIST) && (txt.Top < bottom + MAX_ROW_DIST)) // nearest.Add(txt); // else // { // GroupedText next = new GroupedText(txt); // groups.Add(next); // } // } // } // foreach (GroupedText group in groups) // group.Group.Sort(BoundingBox.CompareByTopThenLeft); // groups.Sort( CompareGroupBoundingBoxTopTheLeft ); // return groups; //} private static int CompareGroupBoundingBoxTopTheLeft(GroupedText g1, GroupedText g2) { return(BoundingBox.CompareByTopThenLeft(g1.Boundary, g2.Boundary)); }