Class IconCache
- java.lang.Object
-
- mil.nga.geopackage.extension.nga.style.IconCache
-
public class IconCache extends Object
Icon Cache of icon images- Since:
- 3.2.0
- Author:
- osbornb
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_CACHE_SIZEDefault max number of icon images 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 cacheBufferedImagecreateIcon(IconRow icon)Create or retrieve from cache an icon image for the icon rowBufferedImagecreateIcon(IconRow icon, float scale)Create or retrieve from cache an icon image for the icon rowstatic BufferedImagecreateIcon(IconRow icon, float scale, IconCache iconCache)Create or retrieve from cache an icon image for the icon rowstatic BufferedImagecreateIcon(IconRow icon, IconCache iconCache)Create or retrieve from cache an icon image for the icon rowstatic BufferedImagecreateIconNoCache(IconRow icon)Create an icon image for the icon row without cachingstatic BufferedImagecreateIconNoCache(IconRow icon, float scale)Create an icon image for the icon row without cachingBufferedImageget(long iconRowId)Get the cached image for the icon row id or null if not cachedBufferedImageget(IconRow iconRow)Get the cached image for the icon row or null if not cachedBufferedImageput(long iconRowId, BufferedImage image)Cache the icon image for the icon row idBufferedImageput(IconRow iconRow, BufferedImage image)Cache the icon image for the icon rowBufferedImageremove(long iconRowId)Remove the cached image for the icon row idBufferedImageremove(IconRow iconRow)Remove the cached image 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 images 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 images to retain in the cache
-
-
Method Detail
-
get
public BufferedImage get(IconRow iconRow)
Get the cached image for the icon row or null if not cached- Parameters:
iconRow- icon row- Returns:
- icon image or null
-
get
public BufferedImage get(long iconRowId)
Get the cached image for the icon row id or null if not cached- Parameters:
iconRowId- icon row id- Returns:
- icon image or null
-
put
public BufferedImage put(IconRow iconRow, BufferedImage image)
Cache the icon image for the icon row- Parameters:
iconRow- icon rowimage- icon image- Returns:
- previous cached icon image or null
-
put
public BufferedImage put(long iconRowId, BufferedImage image)
Cache the icon image for the icon row id- Parameters:
iconRowId- icon row idimage- icon image- Returns:
- previous cached icon image or null
-
remove
public BufferedImage remove(IconRow iconRow)
Remove the cached image for the icon row- Parameters:
iconRow- icon row- Returns:
- removed icon image or null
-
remove
public BufferedImage remove(long iconRowId)
Remove the cached image for the icon row id- Parameters:
iconRowId- icon row id- Returns:
- removed icon image or null
-
clear
public void clear()
Clear the cache
-
resize
public void resize(int maxSize)
Resize the cache- Parameters:
maxSize- max size
-
createIcon
public BufferedImage createIcon(IconRow icon)
Create or retrieve from cache an icon image for the icon row- Parameters:
icon- icon row- Returns:
- icon image
-
createIcon
public BufferedImage createIcon(IconRow icon, float scale)
Create or retrieve from cache an icon image for the icon row- Parameters:
icon- icon rowscale- scale factor- Returns:
- icon image
-
createIconNoCache
public static BufferedImage createIconNoCache(IconRow icon)
Create an icon image for the icon row without caching- Parameters:
icon- icon row- Returns:
- icon image
-
createIconNoCache
public static BufferedImage createIconNoCache(IconRow icon, float scale)
Create an icon image for the icon row without caching- Parameters:
icon- icon rowscale- scale factor- Returns:
- icon image
-
createIcon
public static BufferedImage createIcon(IconRow icon, IconCache iconCache)
Create or retrieve from cache an icon image for the icon row- Parameters:
icon- icon rowiconCache- icon cache- Returns:
- icon image
-
createIcon
public static BufferedImage createIcon(IconRow icon, float scale, IconCache iconCache)
Create or retrieve from cache an icon image for the icon row- Parameters:
icon- icon rowscale- scale factoriconCache- icon cache- Returns:
- icon image
-
-