public class IlvTileController extends Object implements IlvPersistentObject
The tile controller has two modes: indexed mode and free mode.
addTile(ilog.views.tiling.IlvFreeTile)
. There can be gaps between the tiles and tiles can
overlap. The row and column index of the tile doesn't play a role in
this mode. The controller does not allocate tiles automatically but
merely manages the loading of the contents of a tile when the tile
becomes visible. IlvTiledLayer
implements
this mechanism to dynamically load graphic objects when they become
visible in a view. Using an IlvTiledLayer
does not always
require direct use of its tile controller, unless a fine control
is needed.IlvTiledLayer
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
FREE
The free mode of the tile controller: the tiles must be provided to
the controller via
addTile(ilog.views.tiling.IlvFreeTile) . |
static int |
INDEXED
The indexed mode of the tile controller: the space is divided into
a number of identical rectangular tile areas.
|
static int |
LEFT_COLUMN_INDEX
The index that contains the rank of the column farthest to the left
in the array of integers returned by
getTileIndexes . |
static int |
LOWER_ROW_INDEX
The index that contains the rank of the lower row
in the array of integers returned by
getTileIndexes . |
static int |
RIGHT_COLUMN_INDEX
The index that contains the rank of the column farthest to the right
in the array of integers returned by
getTileIndexes . |
static int |
UPPER_ROW_INDEX
The index that contains the rank of the upper row
in the array of integers returned by
getTileIndexes . |
Constructor and Description |
---|
IlvTileController(IlvInputStream stream)
Reads the tile controller from an
IlvInputStream . |
IlvTileController(IlvManager manager)
Creates an instance of a tile controller for the manager.
|
IlvTileController(IlvManager manager,
IlvRect tileOrigin)
Creates an instance of a tile controller for the manager.
|
IlvTileController(IlvManager manager,
IlvRect tileOrigin,
IlvTileCache cache)
Creates an instance of a tile controller for the manager and specifies
the cache.
|
IlvTileController(IlvManager manager,
IlvTileCache cache)
Creates an instance of a tile controller for the manager and specifies
the cache.
|
Modifier and Type | Method and Description |
---|---|
void |
addTile(IlvFreeTile tile)
Adds a free tile to this tile controller.
|
void |
addTileListener(TileListener listener)
Adds a listener that will be notified of the changes in the tile status.
|
void |
dispose()
Stops the load-on-demand mechanism.
|
IlvTileCache |
getCache()
Returns the cache that manages the cached tiles of the controller.
|
Collection |
getIntersectingTiles(IlvRect rect)
Gets all tiles intersecting the specified rectangle.
|
IlvTiledLayer |
getLayer()
Returns the layer if the tile controller is the tile controller
of an
IlvTiledLayer . |
IlvTileLockFilter |
getLockFilter()
Returns the lock filter of the controller.
|
IlvManager |
getManager()
Returns the manager of the tile controller.
|
int |
getMode()
Returns the mode of the controller.
|
IlvRect |
getSize()
Returns the specified size of the tile controller if it has been
specified.
|
IlvTile |
getTile(int column,
int row)
Returns the specified tile or
null if the tile is neither
loaded nor cached. |
int[] |
getTileIndexes(IlvRect rect)
Returns the indexes of the tiles intersecting
rect
(rect is expressed
in the manager coordinate system). |
IlvTileLoader |
getTileLoader()
Returns the tile loader of the controller.
|
IlvRect |
getTileOrigin()
Returns the bounding box of the tile (0, 0).
|
Collection |
getTiles()
Returns a collection of all tiles managed by this controller.
|
void |
ignoreView(IlvManagerView view,
boolean ignore)
Specifies to the tile loader to never load a tile if it is
visible in the specified view.
|
boolean |
isIgnoringView(IlvManagerView view)
Returns
true if the view is ignored by the tile controller. |
boolean |
isPrintingErrors()
Returns whether this tile controller is printing the errors occurring
while loading a tile.
|
boolean |
isUnlockFilteredTiles()
Indicates if unlocking locked filtered tiles is allowed or not.
|
void |
lockTile(IlvTile tile,
Object source)
Loads the specified tile.
|
void |
lockTile(int column,
int row,
Object source)
Loads the specified tile.
|
void |
removeAllFreeTiles()
Removes all the free tiles.
|
void |
removeTileListener(TileListener listener)
Removes the listener from the tile controller.
|
void |
setLockFilter(IlvTileLockFilter lockFilter)
Sets a filter that allows a view to lock tiles.
|
void |
setPrintingErrors(boolean print)
Specifies whether this tile controller should print all
errors occurring while loading a tile.
|
void |
setSize(IlvRect rect)
Specifies the area in which the tiles are contained.
|
void |
setTileLoader(IlvTileLoader tileLoader)
Sets the tile loader of the controller.
|
void |
setUnlockFilteredTiles(boolean unlockFilteredTiles)
Allows or avoids to unlock filtered tiles which are already locked
but which are not anymore lockable.
|
void |
tileBBox(int column,
int row,
IlvRect result)
Computes the bounding box of the specified tile and
sets it to
result . |
boolean |
unlockTile(int row,
int column,
Object source)
Removes the lock of the specified tile for the source object.
|
void |
unlockTiles(Object source)
Unlocks all the tiles that have been locked by the specified object.
|
void |
updateView(IlvManagerView view)
Updates a view and loads the required tiles.
|
void |
write(IlvOutputStream stream)
Writes the tile controller to an
IlvOutputStream . |
public static final int INDEXED
getMode()
,
Constant Field Valuespublic static final int FREE
addTile(ilog.views.tiling.IlvFreeTile)
. There can be gaps between the tiles
and tiles can overlap. The row and column index of the tile doesn't play
a role in this mode.getMode()
,
Constant Field Valuespublic static final int LEFT_COLUMN_INDEX
getTileIndexes
.public static final int RIGHT_COLUMN_INDEX
getTileIndexes
.public static final int UPPER_ROW_INDEX
getTileIndexes
.public static final int LOWER_ROW_INDEX
getTileIndexes
.public IlvTileController(IlvManager manager, IlvRect tileOrigin)
manager
- The managertileOrigin
- The position of the tile of row 0 and column 0getMode()
public IlvTileController(IlvManager manager, IlvRect tileOrigin, IlvTileCache cache)
manager
- The managertileOrigin
- The position of the tile of row 0 and column 0cache
- The tile cache that will manage the tiles cached by
this controller. A cache can be shared by several tile
controllers or tiled layers.getMode()
public IlvTileController(IlvManager manager)
manager
- The managerpublic IlvTileController(IlvManager manager, IlvTileCache cache)
manager
- The managercache
- The tile cache that will manage the tiles cached by
this controller. A cache can be shared by several tile
controllers or tiled layers.public IlvTileController(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
.stream
- The input streamIlvReadFileException
- if the format is not correct.public int getMode()
INDEXED
- the space is divided into a number of identical
rectangular tile areas. The individual tiles can be accessed by row and
column index. The tiles are allocated automatically when needed.FREE
- the tiles must be provided to the controller via
addTile(ilog.views.tiling.IlvFreeTile)
. There can be gaps between the tiles and tiles can
overlap. The row and column index of the tile doesn't play a role in
this mode. The controller does not allocate tiles automatically but
merely manages the loading of the contents of a tile when the tile
becomes visible. public void setLockFilter(IlvTileLockFilter lockFilter)
null
is provided, tiles can be locked by any view where they
become visible.public IlvTileLockFilter getLockFilter()
null
.public void setPrintingErrors(boolean print)
public boolean isPrintingErrors()
public void setSize(IlvRect rect)
rect
parameter is set to null
,
there is no limit to the tiling grid.
Only in indexed mode, setting the size has an effect.
In free mode, the size is always calculated from the tiles added to
the controller.rect
- The area in which the tiles are contained.public IlvRect getSize()
public int[] getTileIndexes(IlvRect rect)
rect
(rect
is expressed
in the manager coordinate system).
The following example prints the list of tiles that are visible in a rectangle.
int indexes[] = tileController.getTileIndexes(new IlvRect(0, 0, 100, 100)); int left = indexes[IlvTileController.LEFT_COLUMN_INDEX]; int right = indexes[IlvTileController.RIGHT_COLUMN_INDEX]; int top = indexes[IlvTileController.UPPER_ROW_INDEX]; int bottom = indexes[IlvTileController.LOWER_ROW_INDEX]; for (int i = left; i < right; i++) for (int j = top; j < bottom; j++) System.out.println("Tile " + i + "," + j + " intersects the rectangle");
rect
- The rectangle expressed in the manager coordinate systemLEFT_COLUMN_INDEX
,
RIGHT_COLUMN_INDEX
,
UPPER_ROW_INDEX
,
LOWER_ROW_INDEX
public IlvRect getTileOrigin()
public void tileBBox(int column, int row, IlvRect result)
result
.column
- The column of the tilerow
- The row of the tileresult
- A rectangle that will contain the resultpublic IlvTile getTile(int column, int row)
null
if the tile is neither
loaded nor cached.public void lockTile(int column, int row, Object source)
column
- The column of the tilerow
- The row of the tilesource
- The object that locks the tilepublic Collection getIntersectingTiles(IlvRect rect)
public Collection getTiles()
null
.public void addTile(IlvFreeTile tile)
tile
- The tile to add.public void lockTile(IlvTile tile, Object source)
tile
- The tile.source
- The object that locks the tile.public IlvTileCache getCache()
public final IlvManager getManager()
public void ignoreView(IlvManagerView view, boolean ignore)
updateView(ilog.views.IlvManagerView)
explicitly after you
enable or disable the ignoring of a view.view
- The view to ignoreignore
- If set to true
, the view will be ignored, otherwise,
the events in the view will be processed normallypublic boolean isIgnoringView(IlvManagerView view)
true
if the view is ignored by the tile controller.view
- The viewpublic void unlockTiles(Object source)
source
- The object that locked the tileslockTile(int, int, java.lang.Object)
public boolean unlockTile(int row, int column, Object source)
lockTile
method.row
- The row of the tile to unlockcolumn
- The column of the tile to unlocksource
- The object that locked the tileslockTile(int, int, java.lang.Object)
public void updateView(IlvManagerView view)
view
- The manager view to updatepublic IlvTiledLayer getLayer()
IlvTiledLayer
.public void addTileListener(TileListener listener)
listener
- The tile listener to addpublic void removeTileListener(TileListener listener)
listener
- The listener to removepublic final IlvTileLoader getTileLoader()
public void setTileLoader(IlvTileLoader tileLoader)
public void write(IlvOutputStream stream) throws IOException
IlvOutputStream
.write
in interface IlvPersistentObject
stream
- the output streamIOException
- if an error occurs while saving.public void dispose()
public boolean isUnlockFilteredTiles()
public void setUnlockFilteredTiles(boolean unlockFilteredTiles)
public void removeAllFreeTiles()
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.