/** * Simplifies a part of the <code>points</code>. The <code>fromIndex</code> and <code>lastIndex</code> * are guaranteed to be kept. * * @param points The PointList to simplify * @param fromIndex Start index to simplify, should be >= <code>lastIndex</code> * @param lastIndex Simplify up to this index * @return The number of removed points */ public int simplify(PointList points, int fromIndex, int lastIndex) { int removed = 0; int size = lastIndex - fromIndex; if (approx) { int delta = 500; int segments = size / delta + 1; int start = fromIndex; for (int i = 0; i < segments; i++) { // start of next is end of last segment, except for the last removed += subSimplify(points, start, Math.min(lastIndex, start + delta)); start += delta; } } else { removed = subSimplify(points, fromIndex, lastIndex); } if (removed > 0) compressNew(points, removed); return removed; }
counter = subSimplify(points, fromIndex, indexWithMaxDist); counter += subSimplify(points, indexWithMaxDist, lastIndex);
/** * Simplifies a part of the <code>points</code>. The <code>fromIndex</code> and <code>lastIndex</code> * are guaranteed to be kept. * * @param points The PointList to simplify * @param fromIndex Start index to simplify, should be >= <code>lastIndex</code> * @param lastIndex Simplify up to this index * @return The number of removed points */ public int simplify(PointList points, int fromIndex, int lastIndex) { int removed = 0; int size = lastIndex - fromIndex; if (approx) { int delta = 500; int segments = size / delta + 1; int start = fromIndex; for (int i = 0; i < segments; i++) { // start of next is end of last segment, except for the last removed += subSimplify(points, start, Math.min(lastIndex, start + delta)); start += delta; } } else { removed = subSimplify(points, fromIndex, lastIndex); } if (removed > 0) compressNew(points, removed); return removed; }
counter = subSimplify(points, fromIndex, indexWithMaxDist); counter += subSimplify(points, indexWithMaxDist, lastIndex);