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 is NO.

    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 UIImage from an SVG file.

    Declaration

    Objective-C

    - (nullable PlatformImage *)imageFromSvg:(nonnull NSString *)imagePath;

    Swift

    func image(fromSvg imagePath: String) -> NSImage?

    Parameters

    imagePath

    The path to the SVG file.

    Return Value

    Returns the rendered image.

  • Renders UIImage from 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

    imagePath

    The path to the SVG file.

    scale

    The scale applied during rendering. 1.0 - original image size.

    Return Value

    Returns the rendered image.

  • Renders UIImage from 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

    imagePath

    The path to the SVG file.

    scale

    The scale applied during rendering. 1.0 - original image size.

    tintColor

    The tint color applied to the image. Use 0, when no tint required.

    Return Value

    Returns the rendered image.

  • Renders UIImage from 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

    imagePath

    The path to the SVG file.

    size

    The target image size.

    tintColor

    The tint color applied to the image. Use 0, when no tint required.

    Return Value

    Returns the rendered image.

  • Renders UIImage from 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

    imagePath

    The path to the SVG file.

    size

    The target image size.

    isInCenter

    Image placement inside the canvas.

    tintColor

    The tint color applied to the image. Use 0, when no tint required.

    Return Value

    Returns the rendered image.

  • Renders UIImage from 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

    imagePath

    The path to the SVG file.

    transform

    The 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

    key

    The key of the cached image.

    timestamp

    The 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

    img

    The image to cache.

    key

    The key of the image.

    timestamp

    The 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

    key

    The key of the image.