Package org.mapsforge.map.layer.labels
Class TileBasedLabelStore
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- java.util.LinkedHashMap<K,V>
-
- org.mapsforge.core.util.LRUCache<K,V>
-
- org.mapsforge.core.util.WorkingSetCache<org.mapsforge.core.model.Tile,java.util.List<org.mapsforge.core.mapelements.MapElementContainer>>
-
- org.mapsforge.map.layer.labels.TileBasedLabelStore
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.util.Map<org.mapsforge.core.model.Tile,java.util.List<org.mapsforge.core.mapelements.MapElementContainer>>
,LabelStore
public class TileBasedLabelStore extends org.mapsforge.core.util.WorkingSetCache<org.mapsforge.core.model.Tile,java.util.List<org.mapsforge.core.mapelements.MapElementContainer>> implements LabelStore
A LabelStore where the data is stored per tile.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TileBasedLabelStore(int capacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
int
getVersion()
Returns a version number, which changes every time an update is made to the LabelStore.java.util.List<org.mapsforge.core.mapelements.MapElementContainer>
getVisibleItems(org.mapsforge.core.model.Tile upperLeft, org.mapsforge.core.model.Tile lowerRight)
Gets the items that are visible on a set of tiles.protected boolean
removeEldestEntry(java.util.Map.Entry<org.mapsforge.core.model.Tile,java.util.List<org.mapsforge.core.mapelements.MapElementContainer>> eldest)
boolean
requiresTile(org.mapsforge.core.model.Tile tile)
Returns if a tile is in the current tile set and no data is stored for this tile.void
storeMapItems(org.mapsforge.core.model.Tile tile, java.util.List<org.mapsforge.core.mapelements.MapElementContainer> mapItems)
Stores a list of MapElements against a tile.-
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, values
-
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.mapsforge.map.layer.labels.LabelStore
clear
-
-
-
-
Method Detail
-
destroy
public void destroy()
-
storeMapItems
public void storeMapItems(org.mapsforge.core.model.Tile tile, java.util.List<org.mapsforge.core.mapelements.MapElementContainer> mapItems)
Stores a list of MapElements against a tile.- Parameters:
tile
- tile on which the mapItems reside.mapItems
- the map elements.
-
getVersion
public int getVersion()
Description copied from interface:LabelStore
Returns a version number, which changes every time an update is made to the LabelStore.- Specified by:
getVersion
in interfaceLabelStore
- Returns:
- the version number
-
getVisibleItems
public java.util.List<org.mapsforge.core.mapelements.MapElementContainer> getVisibleItems(org.mapsforge.core.model.Tile upperLeft, org.mapsforge.core.model.Tile lowerRight)
Description copied from interface:LabelStore
Gets the items that are visible on a set of tiles.- Specified by:
getVisibleItems
in interfaceLabelStore
- Parameters:
upperLeft
- tile in upper left corner of visible area.lowerRight
- tile in lower right corner of visible area.- Returns:
- a list of MapElements that are visible on the tiles.
-
requiresTile
public boolean requiresTile(org.mapsforge.core.model.Tile tile)
Returns if a tile is in the current tile set and no data is stored for this tile.- Parameters:
tile
- the tile- Returns:
- true if the tile is in the current tile set, but no data is stored for it.
-
removeEldestEntry
protected boolean removeEldestEntry(java.util.Map.Entry<org.mapsforge.core.model.Tile,java.util.List<org.mapsforge.core.mapelements.MapElementContainer>> eldest)
- Overrides:
removeEldestEntry
in classorg.mapsforge.core.util.LRUCache<org.mapsforge.core.model.Tile,java.util.List<org.mapsforge.core.mapelements.MapElementContainer>>
-
-