![]() |
Maria GDK 5.1.0.6
Documentation of native code in develop branch
|
#include <MSymbolCache.h>
Classes | |
| struct | SymbolCell |
Public Types | |
| using | SymbolIndexT = std::uint32_t |
| using | LayerIndexT = std::uint16_t |
Public Member Functions | |
| SymbolCache (const std::shared_ptr< STK::ShaderProgramManager > &shaderManager, const std::shared_ptr< Maria::ISymbolProvider > &symbolProvider, std::uint16_t gridSize=32, std::uint16_t cellSize=64, double symbolScale=1.0, bool generateMipmaps=false) | |
| uint32_t | getSymbolCacheId () const |
| uint32_t | getTextureGeneration () const |
| bool | getGenerateMipmaps () const |
| SymbolIndexT | getSymbolIndex (const std::string &symbolType, const std::string &symbolCode, SymbolColorScheme colorScheme=SymbolColorScheme::Medium, SymbolColorOverride colorOverride=SymbolColorOverride::SymColorDefault, STK::RGBA lineColor=0) |
| SymbolIndexT | getSymbolIndex (const std::string &symbolType, const std::string &symbolCode, const std::string &typeId, SymbolColorScheme colorScheme=SymbolColorScheme::Medium, SymbolColorOverride colorOverride=SymbolColorOverride::SymColorDefault, STK::RGBA lineColor=0) |
| bool | getSymbolIndex (const std::string &symbolType, const std::string &symbolCode, SymbolColorScheme colorScheme, SymbolColorOverride symbolColorOverride, STK::RGBA lineColor, const std::string &typeId, SymbolIndexT &index, float ¢erX, float ¢erY) |
| SymbolCell | getSymbolCell (const std::string &symbolType, const std::string &symbolCode, SymbolColorScheme colorScheme, SymbolColorOverride symbolColorOverride, STK::RGBA lineColor, const std::string &typeId="") |
| void | updateTexture () |
| void | setSymbolGrid (int gridSize, int cellSize) |
| int | numPendingRequests () const |
| std::shared_ptr< Maria::SymbolTexture > | getSymbolTexture (LayerIndexT layer) |
| GLuint | getTextureHandle (const LayerIndexT layer) |
| STK::Vector4f | calcTextureTransform (const SymbolIndexT symbolIndex) const |
| auto | getGridSize () const |
| auto | getCellSize () const |
| LayerIndexT | calcLayer (const SymbolIndexT symbolIndex) const |
| void | freeSymbol (SymbolIndexT symbolIndex) |
| bool | needsUpdate () const |
| void | logProfiling () |
| void | resetProfiling () |
Protected Member Functions | |
| decltype(_symbols) ::iterator | findOldestSymbol () |
| void | updateTextureSubImage (const MariaProtobuf::SymbolProviderResult &sym) |
| void | updateTextureFBO (const MariaProtobuf::SymbolProviderResult &rs) |
| bool | InitShader () |
| std::shared_ptr< STK::Image > | createImage (const MariaProtobuf::SymbolProviderResult &sym) |
| std::string | createKey (const std::string &symbolType, const std::string &symbolCode, SymbolColorScheme colorScheme, SymbolColorOverride colorOverride, STK::RGBA lineColor) |
| SymbolIndexT | getNewId () |
Protected Attributes | |
| unsigned int | _symbolCacheId {0} |
| std::shared_ptr< STK::ShaderProgramManager > | _shaderManager |
| std::shared_ptr< Maria::ISymbolProvider > | _symbolProvider |
| std::uint16_t | _gridSize { 32 } |
| std::uint16_t | _cellSize { 64 } |
| bool | _stretchToFrame { true } |
| bool | _cropTransparent { true } |
| double | _symbolScale { 1.0 } |
| std::list< SymbolIndexT > | _freeIds |
| std::atomic< int > | _numPendingRequests { 0 } |
| std::shared_ptr< STK::VertexBufferP > | quad_vtx_ |
| std::shared_ptr< STK::ShaderProgram > | _shader |
| std::vector< std::shared_ptr< Maria::SymbolTexture > > | _symbolSheets |
| int | _texUnit |
| bool | _generateMipmaps |
| uint32_t | _textureGeneration { 0 } |
| std::map< std::string, SymbolCell > | _symbols |
| STK::BenchmarkTimer | _tGetIndex |
| STK::BenchmarkTimer | _tGetIndexRequest |
| STK::BenchmarkTimer | _tUpdateTexture |
SymbolCache - Short description. Detailed description.
|
inline |
Calculate which texture layer this index belongs to.
|
inline |
Calculate a texture transform offset/scale given a symbol index. This will return 4 values (x offset, y offset, x scale, y scale) representing the scale and offset of the given symbol inside a texture atlas sheet.
|
inline |
Mark this symbol ID as free, so that it can be recycled.
|
inline |
Get the size of each grid cell. This is also the maximum resolution of the symbols in the cache.
|
inline |
Return the grid size. The grid size defines both the number of columns and rows on each level of the texture array.
| SymbolCache::SymbolIndexT SymbolCache::getSymbolIndex | ( | const std::string & | symbolType, |
| const std::string & | symbolCode, | ||
| SymbolColorScheme | colorScheme = SymbolColorScheme::Medium, |
||
| SymbolColorOverride | colorOverride = SymbolColorOverride::SymColorDefault, |
||
| STK::RGBA | lineColor = 0 |
||
| ) |
Get the symbol index for the given symbol. This method will check the cache for the given symbol code. If not found, a new index is reserved and a request is made to the symbol service for this symbol code. Until the symbol has been received and the texture has been updated, this index will give a blank texture.
| void SymbolCache::setSymbolGrid | ( | int | gridSize, |
| int | cellSize | ||
| ) |
Set new symbol grid sizes. This method sets the maximum pixel size of each cached symbol cell, and the grid size of the cache. Each texture layer in the cache can contain gridSize x gridSize symbols, and the texture size is gridSize*cellSize. This will clear all currently cached symbols.
| void SymbolCache::updateTexture | ( | ) |
Update texture with all new symbols that have been read from the provider since the last time. This method should be called from the render thread.