GLMapVectorImageFactory
Objective-C
@interface GLMapVectorImageFactory : NSObject
Swift
class GLMapVectorImageFactory : NSObject
GLMapVectorImageFactory is used to render images from SVG files. The image factory caches rendered images for future use.
-
Unavailable
It’s a singleton object. Use
[GLMapVectorImageFactory sharedFactory]Default -init is disabled.
Declaration
Objective-C
- (instancetype _Nonnull)init; -
Disables disk caching if set to
YES. The default value isNO.Declaration
Objective-C
@property BOOL disableCaching;Swift
var disableCaching: Bool { get set } -
Returns the singleton factory object.
Declaration
Objective-C
@property (class, nonatomic, readonly) GLMapVectorImageFactory *_Nonnull sharedFactory;Swift
class var shared: GLMapVectorImageFactory { get } -
If not nil, the GLMapVectorImageFactory will try to get image data using this block. If no data is returned, it will fallback to direct file reading.
Declaration
Objective-C
@property (strong) GLMapResourceBlock _Nonnull resourceBlock;Swift
var resourceBlock: GLMapResourceBlock { get set } -
If the timestamp is changed, the image will be updated.
Declaration
Objective-C
@property (strong) GLMapTimestampBlock _Nonnull timestampBlock;Swift
var timestampBlock: GLMapTimestampBlock { get set } -
Removes all memory cached images.
Declaration
Objective-C
- (void)clearCaches;Swift
func clearCaches() -
Deletes all cached image files.
Declaration
Objective-C
- (void)deleteCachedFiles;Swift
func deleteCachedFiles() -
Renders
UIImagefrom an SVG file.Declaration
Objective-C
- (nullable PlatformImage *)imageFromSvg:(nonnull NSString *)imagePath;Swift
func image(fromSvg imagePath: String) -> NSImage?Parameters
imagePathThe path to the SVG file.
Return Value
Returns the rendered image.
-
Renders
UIImagefrom an SVG file.Declaration
Objective-C
- (nullable PlatformImage *)imageFromSvg:(nonnull NSString *)imagePath withScale:(double)scale;Swift
func image(fromSvg imagePath: String, withScale scale: Double) -> NSImage?Parameters
imagePathThe path to the SVG file.
scaleThe scale applied during rendering. 1.0 - original image size.
Return Value
Returns the rendered image.
-
Renders
UIImagefrom an SVG file.Declaration
Objective-C
- (nullable PlatformImage *)imageFromSvg:(nonnull NSString *)imagePath withScale:(double)scale andTintColor:(GLMapColor)tintColor;Swift
func image(fromSvg imagePath: String, withScale scale: Double, andTintColor tintColor: GLMapColor) -> NSImage?Parameters
imagePathThe path to the SVG file.
scaleThe scale applied during rendering. 1.0 - original image size.
tintColorThe tint color applied to the image. Use
0, when no tint required.Return Value
Returns the rendered image.
-
Renders
UIImagefrom an SVG file.Declaration
Objective-C
- (nullable PlatformImage *)imageFromSvg:(nonnull NSString *)imagePath withSize:(CGSize)size andTintColor:(GLMapColor)tintColor;Swift
func image(fromSvg imagePath: String, with size: CGSize, andTintColor tintColor: GLMapColor) -> NSImage?Parameters
imagePathThe path to the SVG file.
sizeThe target image size.
tintColorThe tint color applied to the image. Use
0, when no tint required.Return Value
Returns the rendered image.
-
Renders
UIImagefrom an SVG file.Declaration
Objective-C
- (nullable PlatformImage *)imageFromSvg:(nonnull NSString *)imagePath withSize:(CGSize)size isInCenter:(BOOL)isInCenter andTintColor:(GLMapColor)tintColor;Swift
func image(fromSvg imagePath: String, with size: CGSize, isInCenter: Bool, andTintColor tintColor: GLMapColor) -> NSImage?Parameters
imagePathThe path to the SVG file.
sizeThe target image size.
isInCenterImage placement inside the canvas.
tintColorThe tint color applied to the image. Use
0, when no tint required.Return Value
Returns the rendered image.
-
Renders
UIImagefrom an SVG file.Declaration
Objective-C
- (nullable PlatformImage *)imageFromSvg:(nonnull NSString *)imagePath transform:(GLMapVectorImageTransform *_Nullable) transform;Swift
func image(fromSvg imagePath: String, transform: GLMapVectorImageTransform?) -> NSImage?Parameters
imagePathThe path to the SVG file.
transformThe transform to apply.
Return Value
Returns the rendered image.
-
Returns the cached image for a key.
Declaration
Objective-C
- (nullable PlatformImage *)cachedImageWithKey:(nonnull NSString *)key timestamp:(double)timestamp;Swift
func cachedImage(withKey key: String, timestamp: Double) -> NSImage?Parameters
keyThe key of the cached image.
timestampThe timestamp to check modifications.
Return Value
The cached image or nil if no image is cached for the key or the timestamps are not equal.
-
Caches an image.
Declaration
Objective-C
- (void)cacheImage:(nonnull PlatformImage *)img withKey:(nonnull NSString *)key timestamp:(double)timestamp;Swift
func cacheImage(_ img: NSImage, withKey key: String, timestamp: Double)Parameters
imgThe image to cache.
keyThe key of the image.
timestampThe timestamp of the image. If NaN, the image will be cached only in memory.
-
Deletes a cached image.
Declaration
Objective-C
- (void)deleteCached:(nonnull NSString *)key;Swift
func deleteCached(_ key: String)Parameters
keyThe key of the image.
Install in Dash
GLMapVectorImageFactory Class Reference