GLMapVectorImageFactory


@interface GLMapVectorImageFactory : NSObject

GLMapVectorImageFactory used to render images from svgpb files. Image factory caches rendered images for future use.

SVGPB - is preprocessed small and fast SVG files. SVG tags saved into protocol buffer files to maximize parsing speed. Resulting files 5 times smaller and 10x times faster to parse.

To create svgpb files from your svg images please use open source util from https://github.com/molind/svgpb

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

    Declaration

    Objective-C

    @property (atomic, assign, unsafe_unretained, readwrite) BOOL disableCaching;
  • Returns singleton factory object

    Declaration

    Objective-C

    @property (class, nonatomic, readonly)
        GLMapVectorImageFactory *_Nonnull sharedFactory;
  • 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 (atomic, strong, readwrite) GLMapResourceBlock _Nonnull resourceBlock;
  • If timestamp is changed - image will be updated.

    Declaration

    Objective-C

    @property (atomic, strong, readwrite)
        GLMapTimestampBlock _Nonnull timestampBlock;
  • Removes all memory cached images

    Declaration

    Objective-C

    - (void)clearCaches;
  • Delete all cached images files

    Declaration

    Objective-C

    - (void)deleteCachedFiles;
  • Renders UIImage from svgpb file.

    Declaration

    Objective-C

    - (nullable UIImage *)imageFromSvgpb:(nonnull NSString *)imagePath;

    Parameters

    imagePath

    Path to the svgpb file

    Return Value

    Returns rendered image

  • Renders UIImage from svgpb file.

    Declaration

    Objective-C

    - (nullable UIImage *)imageFromSvgpb:(nonnull NSString *)imagePath
                               withScale:(double)scale;

    Parameters

    imagePath

    Path to the svgpb file

    scale

    Scale applied during render. 1.0 - original image size.

    Return Value

    Returns rendered image

  • Renders UIImage from svgpb file.

    Declaration

    Objective-C

    - (nullable UIImage *)imageFromSvgpb:(nonnull NSString *)imagePath
                               withScale:(double)scale
                            andTintColor:(GLMapColor)tintColor;

    Parameters

    imagePath

    Path to the svgpb 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 svgpb file.

    Declaration

    Objective-C

    - (nullable UIImage *)imageFromSvgpb:(nonnull NSString *)imagePath
                                withSize:(CGSize)size
                            andTintColor:(GLMapColor)tintColor;

    Parameters

    imagePath

    Path to the svgpb 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 svgpb file.

    Declaration

    Objective-C

    - (nullable UIImage *)imageFromSvgpb:(nonnull NSString *)imagePath
                                withSize:(CGSize)size
                             contentMode:(UIViewContentMode)contentMode
                            andTintColor:(GLMapColor)tintColor;

    Parameters

    imagePath

    Path to the svgpb file

    size

    Target image size

    contentMode

    Image placement inside the canvas

    tintColor

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

    Return Value

    Returns rendered image

  • Returns cached image for key

    Declaration

    Objective-C

    - (nullable UIImage *)cachedImageWithKey:(nonnull NSString *)key
                                   timestamp:(double)timestamp;

    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 UIImage *)img
               withKey:(nonnull NSString *)key
             timestamp:(double)timestamp;

    Parameters

    img

    image to cache

    key

    key of image

    timestamp

    timestamp of image. If NaN image will be cached only in memory *