A tiled layer is a type of manager layer specifically designed to
support load-on-demand. If the IlvTileController associated with this layer
works in indexed mode, the layer is divided into a set of
rectangular tiles of identical size that form a tiling grid (note
that a constructor of IlvTiledLayer takes a mode as a parameter).
The tiling grid is defined by its origin tile that is located at
the intersection of the row and column of index 0, see Tiling grid in indexed mode.
The other tiles in the grid are identified
by their column and row number, starting from the origin tile. The
following code example displays the status of the tile that is at
the intersection of column 10 and row 5:
public static void displayTileStatus(IlvTiledLayer layer) { IlvTile tile = layer.getTileController().getTile(10, 5); if(tile == null) System.out.println("The tile is not loaded yet"); else { int status = tile.getStatus(); if(status == IlvTile.LOCKED) System.out.println("The tile is locked"); else if(status == IlvTile.CACHED) System.out.println("The tile is cached"); else System.out.println("The tile is empty"); } }
You can see in the above code example that the getTile method can sometimes return a null
value. Because the potential number of tiles can be very great—the
number of tiles is even virtually infinite—the
IlvTile
objects are allocated only if the tile is loaded or is in the
cache.
The complete source code of this example can
be found in the following file: