Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TextElementStateCache

Caches the state of text element groups currently rendered as well as the text element states belonging to them, including their fading state and text deduplication information.

Hierarchy

  • TextElementStateCache

Index

Accessors

size

  • get size(): number

sortedGroupStates

Methods

clear

  • clear(): void

clearTextCache

  • clearTextCache(): void

clearVisited

  • clearVisited(): void

deduplicateElement

  • deduplicateElement(zoomLevel: number, elementState: TextElementState): boolean

getOrSet

  • Gets the state corresponding to a given text element group or sets a newly created state if not found. It updates the states of the text elements belonging to the group using the specified parameters.

    see

    TextElementGroupState construction.

    Parameters

    • textElementGroup: TextElementGroup

      The group of which the state will be obtained.

    • tileKey: TileKey

      The key of the tile to which the group belongs.

    • textElementFilter: TextElementFilter

      Filter used to decide if a text element must be initialized,

    Returns []

    Tuple with the group state as first element and a boolean indicating whether the state was found in cache (true) or newly created (false) as second element.

replaceElement

  • Replaces a visible unvisited text element with a visited duplicate.

    Parameters

    • zoomLevel: number

      Current zoom level.

    • elementState: TextElementState

      State of the text element to deduplicate.

    Returns boolean

    true if an item from the cache has been reused and its state has been replaced, false otherwise.

update

  • update(time: number, disableFading: boolean, findReplacements: boolean, zoomLevel: number): boolean
  • Updates state of all cached groups, discarding those that are not needed anymore.

    Parameters

    • time: number

      The current time.

    • disableFading: boolean

      True if fading is currently disabled, false otherwise.

    • findReplacements: boolean

      True to replace each visible unvisited text element with a visited duplicate.

    • zoomLevel: number

      Current zoom level.

    Returns boolean

    True if any textElementGroup was evicted from cache, false otherwise.

Generated using TypeDoc