public void mergeLinks() { int numRects = rects.Count; if (numRects == 1) { return; } LinkedRectangle curRect = new LinkedRectangle((LinkedRectangle)rects[0]); ArrayList nv = new ArrayList(); for (int ri = 1; ri < numRects; ri++) { LinkedRectangle r = (LinkedRectangle)rects[ri]; if (r.getLineArea() == curRect.getLineArea()) { curRect.SetWidth(r.getX() + r.getWidth() - curRect.getX()); } else { nv.Add(curRect); curRect = new LinkedRectangle(r); } if (ri == numRects - 1) { nv.Add(curRect); } } rects = nv; }
public LinkedRectangle(LinkedRectangle lr) { this.link = lr.getRectangle(); this.lineArea = lr.getLineArea(); this.inlineArea = lr.getInlineArea(); }