GLMapVectorImageFactory
Objective-C
@interface GLMapVectorImageFactory : NSObject
Swift
class GLMapVectorImageFactory : NSObject
GLMapVectorImageFactory
used to render images from svg files. Image factory caches rendered images for future use.
-
Unavailable
It’s singleton object. Use
[GLMapVectorImageFactory sharedFactory]
Plain -init is disabled
Declaration
Objective-C
- (instancetype _Nonnull)init;
-
Disables disk caching if set to
YES
. Default value isNO
Declaration
Objective-C
@property BOOL disableCaching;
Swift
var disableCaching: Bool { get set }
-
Returns singleton factory object
Declaration
Objective-C
@property (class, nonatomic, readonly) GLMapVectorImageFactory *_Nonnull sharedFactory;
Swift
class var shared: GLMapVectorImageFactory { get }
-
If not nil - GLMapVectorImageFactory will try to get image data using this block. If no data returned it will fallback to direct file reading
Declaration
Objective-C
@property (strong) GLMapResourceBlock _Nonnull resourceBlock;
Swift
var resourceBlock: GLMapResourceBlock { get set }
-
If timestamp is changed - 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()
-
Delete all cached images files
Declaration
Objective-C
- (void)deleteCachedFiles;
Swift
func deleteCachedFiles()
-
Renders
UIImage
from svg file.Declaration
Objective-C
- (nullable PlatformImage *)imageFromSvg:(nonnull NSString *)imagePath;
Swift
func image(fromSvg imagePath: String) -> NSImage?
Parameters
imagePath
Path to the svg file
Return Value
Returns rendered image
-
Renders
UIImage
from 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
imagePath
Path to the svg file
scale
Scale applied during render. 1.0 - original image size.
Return Value
Returns rendered image
-
Renders
UIImage
from 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
imagePath
Path to the svg file
scale
Scale applied during render. 1.0 - original image size.
tintColor
Tint color applied to the image. Use
0
, when no tint required.Return Value
Returns rendered image
-
Renders
UIImage
from 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
imagePath
Path to the svg file
size
Target image size
tintColor
Tint color applied to the image. Use
0
, when no tint required.Return Value
Returns rendered image
-
Renders
UIImage
from 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
imagePath
Path to the svg file
size
Target image size
isInCenter
Image placement inside the canvas
tintColor
Tint color applied to the image. Use
0
, when no tint required.Return Value
Returns rendered image
-
Renders
UIImage
from 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
imagePath
Path to the svg file
transform
Transform to apply
Return Value
Returns rendered image
-
Returns cached image for key
Declaration
Objective-C
- (nullable PlatformImage *)cachedImageWithKey:(nonnull NSString *)key timestamp:(double)timestamp;
Swift
func cachedImage(withKey key: String, timestamp: Double) -> NSImage?
Parameters
key
key of cached image
timestamp
timestamp to check modifications
Return Value
caceded image or nil if no image cached for key or timestamp are not equal *
-
Caches 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
img
image to cache
key
key of image
timestamp
timestamp of image. If NaN image will be cached only in memory *
-
Deletes cached image
Declaration
Objective-C
- (void)deleteCached:(nonnull NSString *)key;
Swift
func deleteCached(_ key: String)
Parameters
key
key of image *