![]() |
MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
|
Provides access to settings that allow an application to fine-tune the behaviour of tiled buffered layers.
When tiled buffering is active, buffered layers are drawn in a background thread to a set of images, and these images are drawn to the screen in the application's drawing thread instead of drawing the buffered layers themselves. This provides significant performance benefits when using complex but otherwise unchanging data layers.
As the buffered layers are already drawn in a background thread, these layers should not use an asynchronous loader such as the TSLMTFileLoader. When using a data layer containing a TSLFileLoaderRemote (such as the TSLWMSDataLayer) the data layer should be set to use synchronous loading through the appropriate data layer specific API methods.
When new tiles are available for drawing, the drawing surface's draw callback will be invoked from the background thread to request an application redraw. Refer to TSLDrawingSurface::setRedrawCallback for more details.
Many data layers internally provide a mechanism managing changes to the layer between the application thread and the internal background thread used to draw the buffered layers. For these layers the application can simply update the layer as normal and the changes will be automatically reflected in the buffered tiles.
Some layers do not provide this mechanism. When buffering these layers the application must ensure that they use the lockBackgroundThread and unlockBackgroundThread methods to ensure that they have exclusive access to the layer when changing its contents. This applies to the following data layers:
When rotating the drawing surface text and symbols in buffered layers will always rotate with the surface regardless of their rotation settings. This is because the buffered tiles are drawn in the background thread unrotated.
Public Member Functions | |
unsigned int | cacheSize () const |
bool | cacheSize (unsigned int newSize) |
bool | clearCache () |
unsigned int | drawExtentExpansion () const |
bool | drawExtentExpansion (unsigned int amount) |
bool | lockBackgroundThread () |
unsigned int | tileSize () const |
bool | tileSize (unsigned int size) |
bool | unlockBackgroundThread () |
unsigned int TSLDrawingSurfaceTiledBufferControl::cacheSize | ( | ) | const |
Returns the size of the tile cache in Kb.
bool TSLDrawingSurfaceTiledBufferControl::cacheSize | ( | unsigned int | newSize | ) |
Sets the size of the tile cache used to store buffered tiles. A larger cache size allows for more tiles to be stored, which reduces the frequency of tile redrawing when panning around a map.
The default cache size is 128Mb.
Argument size description:
newSize: The size of the tile cache to use, in Kb.
Returns true if the cache size was updated, or false if tiled buffering has been disabled in the drawing surface.
bool TSLDrawingSurfaceTiledBufferControl::clearCache | ( | ) |
Forcibly deletes all buffered tiles generated so far. This method may be useful when modifying buffered layers in ways that are not automatically detected in order to force the buffered tiles to be redrawn.
unsigned int TSLDrawingSurfaceTiledBufferControl::drawExtentExpansion | ( | ) | const |
Returns the number of tiles that draw extents will be expanded by.
bool TSLDrawingSurfaceTiledBufferControl::drawExtentExpansion | ( | unsigned int | amount | ) |
When drawing, the extent used to determine the buffered tiles needed for the current view area is expanded by this number of tiles. This allows pre-loading of tiles outside of the current view area so that they are immediately available when panning the view.
The default expansion amount is one tile. Larger values allow for more tiles to be preloaded at the current view resolution.
amount | The amount to expand draw requests by in number of tiles. |
bool TSLDrawingSurfaceTiledBufferControl::lockBackgroundThread | ( | ) |
Locks a mutex that stops the background thread from accessing data layers in the drawing surface.
Some data layers do not provide an automatic mechanism for thread-safe updates when the contents of the layer is updated. For these layers the application must must this method when changing the contents of the layer to ensure that the layer will only be accessed from one thread at a time. See the class documentation for more details.
Applications should not call other methods on this class while holding the mutex or the application may deadlock.
The application must call unlockBackgroundThread to release the mutex.
unsigned int TSLDrawingSurfaceTiledBufferControl::tileSize | ( | ) | const |
Returns the current size of buffered tiles, in pixels.
bool TSLDrawingSurfaceTiledBufferControl::tileSize | ( | unsigned int | size | ) |
Sets the size of buffered tiles, in pixels.
The default tile size is 512x512.
size | The new tile size to use |
bool TSLDrawingSurfaceTiledBufferControl::unlockBackgroundThread | ( | ) |
Releases the mutex acquired by lockBackgroundThread(). If an application calls lockBackgroundThread() it must call this method to release the mutex before any further buffered tiles can be generated.