GLMapVectorCascadeStyle

Objective-C


@interface GLMapVectorCascadeStyle : NSObject

Swift

class GLMapVectorCascadeStyle : NSObject

GLMapVectorCascadeStyle is used to define appearance of GLMapVectorObject. One style could be used with many GLMapVectorObjects. Style is used to render a map, which is stored inside DefaultStyle.bundle/Style.mapcss. Detailed MapCSS specification is located at: http://www.mapcss.org MapCSS examples: Any point with tag natural=peak should be displayed on zoom level 11+ with a triangle icon tinted with brown color.

node|z11-[natural=peak] {
icon-image:"triangle.svg";
icon-tint:brown;
}

Any point with tag natural=peak should display its localized name on zoom level 13+.

node|z13-[natural=peak] {
text: eval( locTag('name') );
text-color:brown;
font-size:12;
}
  • Unavailable

    Please use [GLMapVectorCascadeStyle createStyle:] or [GLMapVectorCascadeStyle createStyle:error:]

    Unavailable. Please use [GLMapVectorCascadeStyle createStyle:] or [GLMapVectorCascadeStyle createStyle:error:].

    Declaration

    Objective-C

    - (instancetype _Nonnull)init;
  • Helper to parse a style string without loading it from a file. Example: GLMapVectorCascadeStyle *style = [GLMapVectorCascadeStyle createStyle:@"area{fill-color:#10106050;}" ];

    Declaration

    Objective-C

    + (instancetype _Nullable)createStyle:(nonnull NSString *)style;

    Swift

    class func createStyle(_ style: String) -> Self?

    Parameters

    style

    NSString with style rules in MapCSS format

    Return Value

    New GLMapVectorCascadeStyle object

  • Creates an optimized version of the style with resolved zoom tests.

    Declaration

    Objective-C

    - (nonnull GLMapVectorCascadeStyle *)optimizedForZoomRange:(NSRange)range;

    Swift

    func optimized(forZoom range: NSRange) -> GLMapVectorCascadeStyle

    Parameters

    range

    Valid zoom range.

    Return Value

    Optimized version of the style.

  • Sets custom tint function for loading svg files

    Declaration

    Objective-C

    - (void)setTintFunction:(nonnull TintFunctionBlock)function
                   cacheKey:(nonnull NSString *)cacheKey;

    Swift

    func setTintFunction(_ function: @escaping TintFunctionBlock, cacheKey: String)

    Parameters

    function

    Custom tint function.

    cacheKey

    Unique key used for caching.

  • Updates the draw attributes of a vector object.

    Declaration

    Objective-C

    - (BOOL)updateDrawAttributesOfVectorObject:(nonnull GLMapVectorObject *)object
                                      mapState:(GLMapViewState *_Nullable)mapState
                                  forZoomLevel:(int)zoomLevel;

    Swift

    func updateDrawAttributes(of object: GLMapVectorObject, mapState: GLMapViewState?, forZoomLevel zoomLevel: Int32) -> Bool

    Parameters

    object

    Vector object to update.

    mapState

    Map state to calculate all parameters, or nil to leave them unchanged.

    zoomLevel

    Zoom level to test.

    Return Value

    YES if the object is visible.

  • Returns all icon-image values used by this style.

    Declaration

    Objective-C

    - (nonnull NSSet<NSString *> *)allIconNames;

    Swift

    func allIconNames() -> Set<String>

    Return Value

    Set of icon names.