Class IconCache
- java.lang.Object
-
- mil.nga.geopackage.extension.nga.style.IconCache
-
public class IconCache extends Object
Icon Cache of icon bitmaps- Since:
- 3.2.0
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_CACHE_SIZEDefault max number of icon bitmaps to retain in cache
-
Constructor Summary
Constructors Constructor Description IconCache()Constructor, created with cache size ofDEFAULT_CACHE_SIZEIconCache(int size)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear the cacheBitmapcreateIcon(IconRow icon)Create or retrieve from cache an icon bitmap for the icon rowBitmapcreateIcon(IconRow icon, float density)Create or retrieve from cache an icon bitmap for the icon rowstatic BitmapcreateIcon(IconRow icon, float density, IconCache iconCache)Create or retrieve from cache an icon bitmap for the icon rowstatic BitmapcreateIcon(IconRow icon, IconCache iconCache)Create or retrieve from cache an icon bitmap for the icon rowstatic BitmapcreateIconNoCache(IconRow icon)Create an icon bitmap for the icon row without cachingstatic BitmapcreateIconNoCache(IconRow icon, float density)Create an icon bitmap for the icon row without cachingBitmapget(long iconRowId)Get the cached bitmap for the icon row id or null if not cachedBitmapget(IconRow iconRow)Get the cached bitmap for the icon row or null if not cachedBitmapput(long iconRowId, Bitmap bitmap)Cache the icon bitmap for the icon row idBitmapput(IconRow iconRow, Bitmap bitmap)Cache the icon bitmap for the icon rowBitmapremove(long iconRowId)Remove the cached bitmap for the icon row idBitmapremove(IconRow iconRow)Remove the cached bitmap for the icon rowvoidresize(int maxSize)Resize the cache
-
-
-
Field Detail
-
DEFAULT_CACHE_SIZE
public static final int DEFAULT_CACHE_SIZE
Default max number of icon bitmaps to retain in cache- See Also:
- Constant Field Values
-
-
Constructor Detail
-
IconCache
public IconCache()
Constructor, created with cache size ofDEFAULT_CACHE_SIZE
-
IconCache
public IconCache(int size)
Constructor- Parameters:
size- max icon bitmaps to retain in the cache
-
-
Method Detail
-
get
public Bitmap get(IconRow iconRow)
Get the cached bitmap for the icon row or null if not cached- Parameters:
iconRow- icon row- Returns:
- icon bitmap or null
-
get
public Bitmap get(long iconRowId)
Get the cached bitmap for the icon row id or null if not cached- Parameters:
iconRowId- icon row id- Returns:
- icon bitmap or null
-
put
public Bitmap put(IconRow iconRow, Bitmap bitmap)
Cache the icon bitmap for the icon row- Parameters:
iconRow- icon rowbitmap- icon bitmap- Returns:
- previous cached icon bitmap or null
-
put
public Bitmap put(long iconRowId, Bitmap bitmap)
Cache the icon bitmap for the icon row id- Parameters:
iconRowId- icon row idbitmap- icon bitmap- Returns:
- previous cached icon bitmap or null
-
remove
public Bitmap remove(IconRow iconRow)
Remove the cached bitmap for the icon row- Parameters:
iconRow- icon row- Returns:
- removed icon bitmap or null
-
remove
public Bitmap remove(long iconRowId)
Remove the cached bitmap for the icon row id- Parameters:
iconRowId- icon row id- Returns:
- removed icon bitmap or null
-
clear
public void clear()
Clear the cache
-
resize
public void resize(int maxSize)
Resize the cache- Parameters:
maxSize- max size
-
createIcon
public Bitmap createIcon(IconRow icon)
Create or retrieve from cache an icon bitmap for the icon row- Parameters:
icon- icon row- Returns:
- icon bitmap
-
createIcon
public Bitmap createIcon(IconRow icon, float density)
Create or retrieve from cache an icon bitmap for the icon row- Parameters:
icon- icon rowdensity- display density:DisplayMetrics.density- Returns:
- icon bitmap
-
createIconNoCache
public static Bitmap createIconNoCache(IconRow icon)
Create an icon bitmap for the icon row without caching- Parameters:
icon- icon row- Returns:
- icon bitmap
-
createIconNoCache
public static Bitmap createIconNoCache(IconRow icon, float density)
Create an icon bitmap for the icon row without caching- Parameters:
icon- icon rowdensity- display density:DisplayMetrics.density- Returns:
- icon bitmap
-
createIcon
public static Bitmap createIcon(IconRow icon, IconCache iconCache)
Create or retrieve from cache an icon bitmap for the icon row- Parameters:
icon- icon rowiconCache- icon cache- Returns:
- icon bitmap
-
createIcon
public static Bitmap createIcon(IconRow icon, float density, IconCache iconCache)
Create or retrieve from cache an icon bitmap for the icon row- Parameters:
icon- icon rowdensity- display density:DisplayMetrics.densityiconCache- icon cache- Returns:
- icon bitmap
-
-