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 int
DEFAULT_CACHE_SIZE
Default max number of icon images to retain in cache
-
Constructor Summary
Constructors Constructor Description IconCache()
Constructor, created with cache size ofDEFAULT_CACHE_SIZE
IconCache(int size)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clear the cacheBufferedImage
createIcon(IconRow icon)
Create or retrieve from cache an icon image for the icon rowBufferedImage
createIcon(IconRow icon, float scale)
Create or retrieve from cache an icon image for the icon rowstatic BufferedImage
createIcon(IconRow icon, float scale, IconCache iconCache)
Create or retrieve from cache an icon image for the icon rowstatic BufferedImage
createIcon(IconRow icon, IconCache iconCache)
Create or retrieve from cache an icon image for the icon rowstatic BufferedImage
createIconNoCache(IconRow icon)
Create an icon image for the icon row without cachingstatic BufferedImage
createIconNoCache(IconRow icon, float scale)
Create an icon image for the icon row without cachingBufferedImage
get(long iconRowId)
Get the cached image for the icon row id or null if not cachedBufferedImage
get(IconRow iconRow)
Get the cached image for the icon row or null if not cachedBufferedImage
put(long iconRowId, BufferedImage image)
Cache the icon image for the icon row idBufferedImage
put(IconRow iconRow, BufferedImage image)
Cache the icon image for the icon rowBufferedImage
remove(long iconRowId)
Remove the cached image for the icon row idBufferedImage
remove(IconRow iconRow)
Remove the cached image for the icon rowvoid
resize(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
-
-