#include <MSymbolCache.h>
|
using | SymbolIndexT = std::uint32_t |
|
using | LayerIndexT = std::uint16_t |
|
|
| 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) |
|
uint32_t | getSymbolCacheId () const |
|
SymbolIndexT | getSymbolIndex (const std::string &symbolType, const std::string &symbolCode, SymbolColorScheme colorScheme=SymbolColorScheme::Medium) |
|
SymbolIndexT | getSymbolIndex (const std::string &symbolType, const std::string &symbolCode, const std::string &typeId, SymbolColorScheme colorScheme=SymbolColorScheme::Medium) |
|
bool | getSymbolIndex (const std::string &symbolType, const std::string &symbolCode, SymbolColorScheme colorScheme, const std::string &typeId, SymbolIndexT &index, float ¢erX, float ¢erY) |
|
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 | needsRedraw () const |
|
|
decltype(_symbols) ::iterator | findOldestSymbol () |
|
void | updateTexture (const MariaProtobuf::SymbolProviderResult &sym) |
|
bool | InitShader () |
|
std::shared_ptr< SymbolTexture > | getSymbolFBO (LayerIndexT layer) |
|
std::shared_ptr< STK::Image > | createImage (const MariaProtobuf::SymbolProviderResult &sym) |
|
std::string | createKey (const std::string &symbolType, const std::string &symbolCode, SymbolColorScheme colorScheme) |
|
SymbolIndexT | getNewId () |
|
|
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 |
|
std::map< std::string, SymbolCell > | _symbols |
|
SymbolCache - Short description. Detailed description.
◆ calcLayer()
LayerIndexT Maria::SymbolCache::calcLayer |
( |
const SymbolIndexT |
symbolIndex | ) |
const |
|
inline |
Calculate which texture layer this index belongs to.
◆ calcTextureTransform()
STK::Vector4f Maria::SymbolCache::calcTextureTransform |
( |
const SymbolIndexT |
symbolIndex | ) |
const |
|
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.
◆ freeSymbol()
void Maria::SymbolCache::freeSymbol |
( |
SymbolIndexT |
symbolIndex | ) |
|
|
inline |
Mark this symbol ID as free, so that it can be recycled.
◆ getCellSize()
auto Maria::SymbolCache::getCellSize |
( |
| ) |
const |
|
inline |
Get the size of each grid cell. This is also the maximum resolution of the symbols in the cache.
◆ getGridSize()
auto Maria::SymbolCache::getGridSize |
( |
| ) |
const |
|
inline |
Return the grid size. The grid size defines both the number of columns and rows on each level of the texture array.
◆ getSymbolIndex()
SymbolCache::SymbolIndexT SymbolCache::getSymbolIndex |
( |
const std::string & |
symbolType, |
|
|
const std::string & |
symbolCode, |
|
|
SymbolColorScheme |
colorScheme = SymbolColorScheme::Medium |
|
) |
| |
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.
◆ setSymbolGrid()
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.
◆ updateTexture()
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.
The documentation for this class was generated from the following files:
- Native/MariaNative/MDrawObject/MSymbolCache.h
- Native/MariaNative/MDrawObject/MSymbolCache.cpp