Class TileOrganizer
java.lang.Object
org.apache.sis.internal.referencing.j2d.TileOrganizer
Creates a collection of
Tiles from their grid to CRS affine transforms.
When the Rectangle that describe the destination region is known for each tiles,
the Tile(Rectangle, Dimension) constructor should be invoked directly.
But in some cases the destination rectangle is not known directly. Instead we have a set of tiles,
all of them with an upper-left corner located at (0,0), but different grid to CRS
affine transforms read from World Files.
This TileOrganizer class infers the destination regions automatically
from the set of affine transforms.- Since:
- 1.1
- Version:
- 1.1
- Author:
- Martin Desruisseaux (Geomatys)
-
Constructor Summary
ConstructorsConstructorDescriptionTileOrganizer(Point location) Creates an initially empty tile collection with the given location. -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds a tile to the collection of tiles to process.Returns the location of the tile collections to be created.tiles()Returns the tiles.toString()Returns a string representation of the tiles contained in this object.protected booleanunavailableSize(Tile tile, IOException exception) Invoked when an I/O error occurred inTile.getSize()orTile.getRegion().
-
Constructor Details
-
TileOrganizer
Creates an initially empty tile collection with the given location.- Parameters:
location- the location, ornullfor (0,0).
-
-
Method Details
-
getLocation
Returns the location of the tile collections to be created. The location is often (0,0) as expected inBufferedImage, but does not have to.- Returns:
- origin of the tile collections to be created.
-
add
Adds a tile to the collection of tiles to process. Each tile can be added only once.- Parameters:
tile- the tile to add.- Returns:
trueif the tile has been successfully added, orfalseif the tile does not need to be processed by this class.
-
tiles
Returns the tiles. Keys are pyramid geometry (containing mosaic bounds and grid to CRS transforms) and values are the tiles in that pyramid. This method usually returns a singleton map, but more entries may be present if this method was not able to build a single pyramid using all provided tiles.Invoking this method clear the collection. On return, this instance is empty. This is because current implementation modify its workspace directly for efficiency.
- Returns:
- all tiles added to this
TileOrganizer, grouped by pyramids. - Throws:
IOException- if a call toTile.getSize()orTile.getRegion()failed, andunavailableSize(Tile, IOException)did not consumed the exception.
-
toString
Returns a string representation of the tiles contained in this object. Since this method is for debugging purpose, only the first tiles may be formatted in order to avoid consuming to much space in the debugger.
-