Rogue Wave Views Maps Package API Reference Guide |
Rogue Wave Views Documentation Home |
This class manages the load-on-demand process. More...
#include <ilviews/maps/tiling/tilectrl.h>
Public Member Functions | |
IlvTileController (IlvManager *manager, const IlvRect &tileOrigin, IlvTileCache *cache=0, IlBoolean startEnabled=IlTrue) | |
Creates an instance of a tile controller for the manager. More... | |
void | addTileListener (IlvTileListener *listener) |
Adds a listener that will be notified of the changes in the tile status. More... | |
void | enableStart (const IlvRect &tileOrigin, const IlvRect &size) |
Enables the start (delayed start due to tile loader initialization). More... | |
void | fireLoadError (IlvTile *tile, IlvMapsError errorCode) |
Notifies all the listeners of a tile error while loading. More... | |
void | fireTileChanged (IlvTile *tile, IlvTileStatus oldStatus, IlvTileStatus newStatus) |
Notifies all the listeners of a tile change. More... | |
IlvTileCache * | getCache () const |
Returns the cache that manages the cached tiles of the controller. More... | |
IlInt | getControlledTilesCount () const |
This method returns the number of tiles controlled by this controller, that is tiles that are either locked or cached. More... | |
virtual IlvMapsError | getInitStatus () const |
Returns the initialization status of this tile controller. More... | |
IlvTiledLayer * | getLayer () const |
Returns the layer if the tile controller is the tile controller of an IlvTiledLayer . More... | |
IlvManager * | getManager () const |
Returns the manager of the tile controller. More... | |
const IlvRect & | getSize () const |
Returns the specified size of the tile controller. More... | |
IlvTile * | getTile (IlInt column, IlInt row) const |
Returns the specified tile or a null pointer if the tile is neither loaded nor cached. More... | |
void | getTileIndexes (const IlvRect &rect, IlInt &upperRow, IlInt &lowerRow, IlInt &leftCol, IlInt &rightCol) const |
Returns the indexes of the tiles intersecting rect (rect is expressed in the manager coordinate system). More... | |
IlvTileLoader * | getTileLoader () const |
Returns the tile loader of the controller. More... | |
const IlvRect & | getTileOrigin () const |
Returns the bounding box of the tile (0, 0) . More... | |
IlBoolean | hasBounds () const |
Returns IlTrue if a size has been specified for the layer. | |
IlBoolean | isStarted () const |
Checks if the load-on-demand process has started. More... | |
void | lockTile (IlInt column, IlInt row, IlAny source) |
Loads the specified tile. More... | |
void | mapToTiles (IlvTileControllerMapFunction func, IlAny arg) |
Maps a function to all tiles. More... | |
IlBoolean | mapToTilesUntilMatch (IlvTileControllerMatchFunction f, IlAny arg) |
Maps a function to all tiles. More... | |
void | removeTileListener (IlvTileListener *listener) |
Removes the listener from the tile controller. More... | |
void | setSize (const IlvRect &size) |
Specifies the area in which the tiles are contained. More... | |
void | setTileLoader (IlvTileLoader *tileLoader) |
Sets the tile loader of the controller. More... | |
void | start () |
Starts the load-on-demand process. | |
void | tileBBox (IlInt column, IlInt row, IlvRect &result) const |
Computes the bounding box of the specified tile and sets it to result. More... | |
IlBoolean | unLockTile (IlInt row, IlInt column, IlAny source) |
Removes the lock of the specified tile for the source object. More... | |
void | unLockTiles (IlAny source) |
Unlocks all the tiles that have been locked by the specified object. More... | |
void | updateView (IlvView *view) |
Updates a view and loads the required tiles. More... | |
Static Public Member Functions | |
static void | IgnoreView (IlvView *view, IlBoolean ignore=IlTrue) |
Specifies to all the tile loaders to ignore the locks generated when the tile becomes visible in the specified view. More... | |
static IlBoolean | IsIgnoringView (IlvView *view) |
Returns IlTrue if the view is ignored by the tile controllers. More... | |
Protected Member Functions | |
virtual void | setInitStatus (IlvMapsError status) |
Sets the initialization status of this tile controller. More... | |
This class manages the load-on-demand process.
Library: ilvmaps
It divides the space into a number of identical rectangular areas called tiles. Each time a tile becomes visible in a view of the manager to which it is attached, the tile controller notifies a loader (called tile loader) to load the data attached to this tile. A cache releases the invisible tiles (called the cached tiles) when it is necessary to free memory.
A predefined class called 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.
IlvTileController::IlvTileController | ( | IlvManager * | manager, |
const IlvRect & | tileOrigin, | ||
IlvTileCache * | cache = 0 , |
||
IlBoolean | startEnabled = IlTrue |
||
) |
Creates an instance of a tile controller for the manager.
The tile controller will manage the loading and caching of tiles depending on what is visible in the views of the manager.
manager | The manager. |
tileOrigin | The position of the tile of row 0 and column 0 . |
cache | An optional parameter specifying a cache instance. If this parameter is not provided or set to a null value, the default tile cache will be used by the controller. |
startEnabled | Specifies if the load-on-demand process is ready to start. |
void IlvTileController::addTileListener | ( | IlvTileListener * | listener | ) |
Adds a listener that will be notified of the changes in the tile status.
The listener is not owned by the controller. It will not be deleted by the controller, and must be deleted by the application.
listener | The tile listener to be added. |
Enables the start (delayed start due to tile loader initialization).
tileOrigin | The layer's tile origin. |
size | The size of the layer. |
void IlvTileController::fireLoadError | ( | IlvTile * | tile, |
IlvMapsError | errorCode | ||
) |
Notifies all the listeners of a tile error while loading.
Calls loadError()
method of all listeners registered with this IlvTileController
.
tile | The tile involved. |
errorCode | The error code. |
void IlvTileController::fireTileChanged | ( | IlvTile * | tile, |
IlvTileStatus | oldStatus, | ||
IlvTileStatus | newStatus | ||
) |
Notifies all the listeners of a tile change.
Calls tileChanged()
method of all listeners registered with this IlvTileController
.
tile | The tile whose status has changed. |
oldStatus | The tile previous status. |
newStatus | The tile current status. |
IlvTileCache* IlvTileController::getCache | ( | ) | const |
Returns the cache that manages the cached tiles of the controller.
IlvTileCache
object managing the tiles. IlInt IlvTileController::getControlledTilesCount | ( | ) | const |
This method returns the number of tiles controlled by this controller, that is tiles that are either locked or cached.
|
virtual |
Returns the initialization status of this tile controller.
IlvMaps::NoError()
if this tile controller has been initialized successfully, an error otherwise. IlvTiledLayer* IlvTileController::getLayer | ( | ) | const |
Returns the layer if the tile controller is the tile controller of an IlvTiledLayer
.
IlvTiledLayer
object. IlvManager* IlvTileController::getManager | ( | ) | const |
Returns the manager of the tile controller.
IlvManager
object of the controller. const IlvRect& IlvTileController::getSize | ( | ) | const |
Returns the specified size of the tile controller.
If no size has been specified, the width and height of the returned rect are set to 0
.
IlvRect
object that should not be modified. Returns the specified tile or a null pointer if the tile is neither loaded nor cached.
column | The column of the tile. |
row | The row of the tile. |
IlvTile
object that should not be deleted. void IlvTileController::getTileIndexes | ( | const IlvRect & | rect, |
IlInt & | upperRow, | ||
IlInt & | lowerRow, | ||
IlInt & | leftCol, | ||
IlInt & | rightCol | ||
) | const |
Returns the indexes of the tiles intersecting rect (rect is expressed in the manager coordinate system).
rect | The rectangle expressed in the manager coordinate system. |
upperRow | This variable is set to the index of the upper row intersecting the rectangle. |
lowerRow | This variable is set to the index of the lower row intersecting the rectangle. |
leftCol | This variable is set to the index of the most left column intersecting the rectangle. |
rightCol | This variable is set to the index of the most right column intersecting the rectangle. |
IlvTileLoader* IlvTileController::getTileLoader | ( | ) | const |
Returns the tile loader of the controller.
IlvTileLoader
object of the controller. const IlvRect& IlvTileController::getTileOrigin | ( | ) | const |
Returns the bounding box of the tile (0, 0)
.
IlvRect
object containing the bounding box. Specifies to all the tile loaders to ignore the locks generated when the tile becomes visible in the specified view.
This can be used, for example, to avoid loading tiles that become visible in an overview.
view | The view to be ignored. |
ignore | If set to IlTrue , the view will be ignored, otherwise the events in the view will be processed normally. When an ignored view is deleted, IgnoreView(views, false) must be called. |
Returns IlTrue
if the view is ignored by the tile controllers.
view | The view to check. |
IlBoolean IlvTileController::isStarted | ( | ) | const |
Checks if the load-on-demand process has started.
IlTrue
if the load-on-demand process has started. Loads the specified tile.
If the tile is locked for the first time, it will be loaded. When a tile is no longer locked, it is cached. Tiles are automatically locked if they are visible in a view of the manager (unless the view is ignored). This method can be called by the application to force the loading of a specific tile, even if it is not yet visible, or to prevent it from being disposed of.
column | The column of the tile. |
row | The row of the tile. |
source | The object that locks the tile. |
unLockTile()
must be called before this object is deleted. void IlvTileController::mapToTiles | ( | IlvTileControllerMapFunction | func, |
IlAny | arg | ||
) |
Maps a function to all tiles.
This method maps the specified function func to all locked or cached tiles managed by this tile controller.
func | The map function. |
arg | The user argument. |
IlBoolean IlvTileController::mapToTilesUntilMatch | ( | IlvTileControllerMatchFunction | f, |
IlAny | arg | ||
) |
Maps a function to all tiles.
This method maps the specified function f to all locked or cached tiles managed by this tile controller, until the match function f returns IlTrue
for a tile.
f | The map function. |
arg | The user argument. |
IlTrue
if a tile matched, IlFalse
otherwise. void IlvTileController::removeTileListener | ( | IlvTileListener * | listener | ) |
Removes the listener from the tile controller.
listener | The listener to be removed. |
|
protectedvirtual |
Sets the initialization status of this tile controller.
Subclasses of IlvTileController
should call this method when their initialization is not successful.
status | The initialization status. |
void IlvTileController::setSize | ( | const IlvRect & | size | ) |
Specifies the area in which the tiles are contained.
If the rect parameter has a width and height of 0
there is no limit to the tiling grid.
size | The area in which the tiles are contained. |
void IlvTileController::setTileLoader | ( | IlvTileLoader * | tileLoader | ) |
Sets the tile loader of the controller.
tileLoader | The tile loader used by the controller. The tile loader is not owned by the tile controller. |
Computes the bounding box of the specified tile and sets it to result.
column | The column of the tile. |
row | The row of the tile. |
result | A rectangle that will contain the result. |
Removes the lock of the specified tile for the source object.
If a tile has no longer a lock, it is cached. This method is automatically called if a tile becomes invisible in a view of the manager. It can be used by the application to remove the locks that it has placed using the lockTile()
method.
row | The row of the tile to unLock. |
column | The column of the tile to unLock. |
source | The object that locked the tiles. |
IlTrue
if the operation changes the status of the tile to IlvTileCached
. void IlvTileController::unLockTiles | ( | IlAny | source | ) |
Unlocks all the tiles that have been locked by the specified object.
If a tile has no longer a lock, it is cached.
source | The object that locked the tiles. |
void IlvTileController::updateView | ( | IlvView * | view | ) |
Updates a view and loads the required tiles.
It can be used, for example, to reactivate a view that was ignored until then by the load-on-demand process.
view | The manager view to be updated. |
© Copyright 2016, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.