Ejemplo n.º 1
0
 private void fireTilesChangedIncludeBorder(Set<Tile> tiles) {
   if (showBorder
       && (tileProvider instanceof Dimension)
       && (((Dimension) tileProvider).getDim() == DIM_NORMAL)
       && (((Dimension) tileProvider).getBorder() != null)) {
     final Set<Point> coordSet = new HashSet<>();
     for (Tile tile : tiles) {
       final int tileX = tile.getX(),
           tileY = tile.getY(),
           borderSize = ((Dimension) tileProvider).getBorderSize();
       for (int dx = -borderSize; dx <= borderSize; dx++) {
         for (int dy = -borderSize; dy <= borderSize; dy++) {
           coordSet.add(getTileCoordinates(tileX + dx, tileY + dy));
         }
       }
     }
     for (TileListener listener : listeners) {
       listener.tilesChanged(this, coordSet);
     }
   } else {
     Set<Point> coords = tiles.stream().map(this::getTileCoordinates).collect(Collectors.toSet());
     for (TileListener listener : listeners) {
       listener.tilesChanged(this, coords);
     }
   }
 }
Ejemplo n.º 2
0
 /**
  * Convert the actual tile coordinates to zoom-corrected (tile provider coordinate system)
  * coordinates.
  *
  * @param tile The tile of which to convert the coordinates.
  * @return The coordinates of the tile in the tile provider coordinate system (corrected for
  *     zoom).
  */
 private Point getTileCoordinates(Tile tile) {
   return getTileCoordinates(tile.getX(), tile.getY());
 }