Interface ImageCacheHelper
-
- All Known Implementing Classes:
- ImageCacheHelperImpl
public interface ImageCacheHelper
-
-
Method Summary
Methods Modifier and Type Method and Description voidclearCache(java.lang.String mapName)Delete all cached images of the map.voidclearCache(java.lang.String mapName, java.lang.String cachePath)Delete all cached images of the map.java.lang.StringgetCacheKey(MapParameter mapParam, ImageOutputOption outputOption)Get the cache keyword, excluding the range center point and image size and other factors.java.lang.StringgetImageFileName(MapParameter mapParam, ImageOutputOption outputOption)According to the map parameters and image output settings, get the cache file name.java.lang.StringgetImageURL(MapParameter mapParameter, ImageOutputOption outputOption)According to the map parameters and image output settings, get the full URL of the cache image.java.lang.StringgetTempImageFileName(MapParameter mapParam, ImageOutputOption outputOption)According to the map parameters and image output settings, get the cache file name.java.lang.StringgetTempKey(MapParameter mapParam, ImageOutputOption outputOption)Get the temporary cache keyword, excluding the range center point and image size and other factors.java.lang.StringpathToUrl(java.lang.String path)
-
-
-
Method Detail
-
getImageFileName
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.
- Parameters:
mapParam- map parameters.outputOption- Picture output settings.- Returns:
- the file name of the cache image.
- See Also:
DefaultUGCCachePolicy#getCenterIndex(MapParameter),DefaultUGCCachePolicy#getImageCacheKey(MapParameter,ImageOutputOption)
-
getTempImageFileName
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
ImageCacheHelperImpl.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.
- Parameters:
mapParam- map parameters.outputOption- Picture output settings.- Returns:
- the file name of the cache image.
- See Also:
DefaultUGCCachePolicy#getCenterIndex(MapParameter),DefaultUGCCachePolicy#getImageCacheKey(MapParameter,ImageOutputOption)
-
getImageURL
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:
- outputSite is the root directory of the image access address. The default is: "http://localhost:8090/output".
- Cache is the total directory of the map image cache that is generated using the caching policy, whose default is "cache".
- mapName is the hash code that is generated after the map name is sorted (the leading spaces and trailing spaces in the map name are deleted).
- picWidth and picHeight are the cache image width (16 hexadecimal) and height (16 hexadecimal), e.g., when the directory name is **_200×200, it means the cache image size is 512×512, the unit is pixel.
- ScaleRatio is the scale level, the same scale of pictures are generated in the same scale level directory. When the scale is greater than 0 or less than or equal to 1, the directory name is {[1/mapScale]}, [] rounding; when the scale is greater than 1, the directory name is {N+mapScale}.
- RegionInfo refers to the spatial region, the spatial region refers to that the map will be divided into a number of blocks in accordance with the grid algorithm, where each block represents a spatial region. The form of the spatial area is X * Y, the directory with the same X value contains the same column of pictures, the directory with the same Y value contains the same row of pictures. The value of X gradually increases from the left to the right, and the value of Y increases gradually from bottom to top.
- CenterIndex is the center index of the cache image.
- imageCacheKey the cache image keyword.
- Postfix is a file suffix, which means the image file format.
- Parameters:
mapParameter- map parametersoutputOption- Picture output settings.- Returns:
- The full URL format of the cache image.
-
getCacheKey
java.lang.String getCacheKey(MapParameter mapParam, ImageOutputOption outputOption)
Get the cache keyword, excluding the range center point and image size and other factors.After the service is restarted, the keyword will not change.
- Parameters:
mapParam-outputOption-- Returns:
-
getTempKey
java.lang.String getTempKey(MapParameter mapParam, ImageOutputOption outputOption)
Get the temporary cache keyword, excluding the range center point and image size and other factors.After the service is restarted, the keyword will change.
- Parameters:
mapParam-outputOption-- Returns:
-
pathToUrl
java.lang.String pathToUrl(java.lang.String path)
-
clearCache
void clearCache(java.lang.String mapName)
Delete all cached images of the map.
- Parameters:
mapName-
-
clearCache
void clearCache(java.lang.String mapName, java.lang.String cachePath)Delete all cached images of the map.
- Parameters:
mapName- Map namecachePath- Cache directory
-
-