public final class ImageCacheHelperImpl extends java.lang.Object implements ImageCacheHelper
Cache image tool class, to provide image cache directory calculation way.
Constructor and Description |
---|
ImageCacheHelperImpl(java.lang.String outputDir, java.lang.String outputSite)
Image cache tool class, used to obtain the file path to the temporary cache.
|
ImageCacheHelperImpl(java.lang.String outputDir, java.lang.String outputSite, java.lang.String tmpFolder)
Image cache tool class, used to obtain the file path to the temporary cache.
|
Modifier and Type | Method and Description |
---|---|
void |
clearCache(java.lang.String mapName)
Delete all cached images of the map.
|
void |
clearCache(java.lang.String mapName, java.lang.String cachePath)
Delete all cached images of the map.
|
java.lang.String |
getCacheKey(MapParameter mapParam, ImageOutputOption outputOption)
Get the cache keyword, excluding the range center point and image size and other factors.
|
java.lang.String |
getImageFileName(MapParameter mapParam, ImageOutputOption outputOption)
According to the map parameters and image output settings, get the cache file name.
|
java.lang.String |
getImageURL(MapParameter mapParameter, ImageOutputOption outputOption)
According to the map parameters and image output settings, get the full URL of the cache image.
|
java.lang.String |
getTempImageFileName(MapParameter mapParam, ImageOutputOption outputOption)
According to the map parameters and image output settings, get the cache file name.
|
java.lang.String |
getTempKey(MapParameter mapParam, ImageOutputOption outputOption)
Get the temporary cache keyword, excluding the range center point and image size and other factors.
|
java.lang.String |
pathToUrl(java.lang.String path) |
public ImageCacheHelperImpl(java.lang.String outputDir, java.lang.String outputSite)
Image cache tool class, used to obtain the file path to the temporary cache.
outputDir
-outputSite
-public ImageCacheHelperImpl(java.lang.String outputDir, java.lang.String outputSite, java.lang.String tmpFolder)
Image cache tool class, used to obtain the file path to the temporary cache.
outputDir
-outputSite
-public java.lang.String getImageFileName(MapParameter mapParam, ImageOutputOption outputOption)
According to the map parameters and image output settings, get the cache file name.
Cache file name format: {centerIndex}_{imageCacheKey}.{postfix} (image center point index _ cache picture keyword. Image file format). Default cache image in PNG format.
getImageFileName
in interface ImageCacheHelper
mapParam
- map parameters.outputOption
- Picture output settings.DefaultUGCCachePolicy#getCenterIndex(MapParameter)
, DefaultUGCCachePolicy#getImageCacheKey(MapParameter,ImageOutputOption)
public java.lang.String getTempImageFileName(MapParameter mapParam, ImageOutputOption outputOption)
According to the map parameters and image output settings, get the cache file name.
Note: the method will get different image file name every time it restarts the service; if you want to get a unchanged file name, please use getCacheKey(MapParameter,ImageOutputOption)
Cache file name format: {centerIndex}_{imageCacheKey}.{postfix} (image center point index _ cache picture keyword. Image file format). Default cache image in PNG format.
getTempImageFileName
in interface ImageCacheHelper
mapParam
- map parameters.outputOption
- Picture output settings.DefaultUGCCachePolicy#getCenterIndex(MapParameter)
, DefaultUGCCachePolicy#getImageCacheKey(MapParameter,ImageOutputOption)
public java.lang.String getImageURL(MapParameter mapParameter, ImageOutputOption outputOption)
According to the map parameters and image output settings, get the full URL of the cache image.
The full URL format of the cache image is: {outputSite}/{cache}/{mapName}_{picWidth}x{picHeight}/{scaleRatio}/{regionInfo}/{centerIndex}_{imageCacheKey}.{postfix}.
Where:
getImageURL
in interface ImageCacheHelper
mapParameter
- map parametersoutputOption
- Picture output settings.public java.lang.String getCacheKey(MapParameter mapParam, ImageOutputOption outputOption)
After the service is restarted, the keyword will not change.
getCacheKey
in interface ImageCacheHelper
mapParam
-outputOption
-public java.lang.String getTempKey(MapParameter mapParam, ImageOutputOption outputOption)
After the service is restarted, the keyword will change.
getTempKey
in interface ImageCacheHelper
mapParam
-outputOption
-public java.lang.String pathToUrl(java.lang.String path)
pathToUrl
in interface ImageCacheHelper
public void clearCache(java.lang.String mapName)
Delete all cached images of the map.
clearCache
in interface ImageCacheHelper
mapName
-public void clearCache(java.lang.String mapName, java.lang.String cachePath)
Delete all cached images of the map.
clearCache
in interface ImageCacheHelper
mapName
- Map namecachePath
- Cache directory