Ejemplo n.º 1
0
  private void setKeepRect(final Rect keepRect) {
    // Drop tiles outside the new keepRect.

    RectF keepRectF = keepRect.toRectF();

    List<Coordinate> toRemove = new ArrayList<Coordinate>();
    ;
    Iterator<Entry<Coordinate, ITile>> it = mMainTiles.iterator();
    while (it.hasNext()) {
      Entry<Coordinate, ITile> entry = it.next();
      Coordinate coordinate = entry.getValue().coordinate();
      RectF tileRect = entry.getValue().rect().toRectF();
      if (!tileRect.intersectsWith(keepRectF)) toRemove.add(coordinate);
    }
    int removeCount = toRemove.size();
    for (int n = 0; n < removeCount; ++n) removeTile(toRemove.get(n));

    keepRect.copyTo(mKeepRect);
  }