MapboxVectorStyleSet

Objective-C

@interface MapboxVectorStyleSet : NSObject <MaplyVectorStyleDelegate>

Swift

class MapboxVectorStyleSet : NSObject, MaplyVectorStyleDelegate

@brief The Mapbox Vector Style Set parses Mapbox GL Style sheets and turns them into Maply compatible styles. @details A style delegate is required by the Mapnik parser to build geometry out of Mapnik vector tiles. This style delegate can read a Mapbox GL Style sheet and produce compatible styles.

  • @brief Initialize with the style dictionary alreayd parsed from JSON @details We’ll parse the style JSON passed in and return nil on failure. @details The optional filter can be used to reject layers we won’t use

    Declaration

    Objective-C

    - (id _Nullable)initWithDict:(NSDictionary *_Nonnull)styleDict
                        settings:(MaplyVectorStyleSettings *_Nonnull)settings
                           viewC:(NSObject<MaplyRenderControllerProtocol> *_Nonnull)
                                     viewC;

    Swift

    init?(dict styleDict: [AnyHashable : Any], settings: MaplyVectorStyleSettings, viewC: NSObjectProtocol & MaplyRenderControllerProtocol)
  • @brief Initialize with the style JSON and the view controller @details We’ll parse the style JSON passed in and return nil on failure. @details The optional filter can be used to reject layers we won’t use

    Declaration

    Objective-C

    - (id _Nullable)initWithJSON:(NSData *_Nonnull)styleJSON
                        settings:(MaplyVectorStyleSettings *_Nonnull)settings
                           viewC:(NSObject<MaplyRenderControllerProtocol> *_Nonnull)
                                     viewC;

    Swift

    init?(json styleJSON: Data, settings: MaplyVectorStyleSettings, viewC: NSObjectProtocol & MaplyRenderControllerProtocol)
  • @brief Where we can fetch the sprites

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) NSString *spriteURL;

    Swift

    var spriteURL: String? { get set }
  • Tile sources

    Declaration

    Objective-C

    @property (nonatomic, strong, nonnull) NSArray *sources;

    Swift

    var sources: [Any] { get set }
  • All the layer names

    Declaration

    Objective-C

    @property (nonatomic) NSArray<NSString *> *_Nonnull layerNames;

    Swift

    var layerNames: [String] { get set }
  • Type of the given layer

    Declaration

    Objective-C

    - (MapboxLayerType)layerType:(NSString *_Nonnull)layerName;

    Swift

    func layerType(_ layerName: String) -> MapboxLayerType
  • Add the sprint sheet for use in symbols. Return false on failures.

    Declaration

    Objective-C

    - (_Bool)addSprites:(NSDictionary *_Nonnull)spriteDict image:(id)image;

    Swift

    func addSprites(_ spriteDict: [AnyHashable : Any], image: Any!) -> Bool
  • This method will poke around in the given layer to determine a distinc color for it. For circle layers, you get the circle color. For fill and line layers, it’s the paint color. For symbols, you get the text color. This is useful for visualizing layers, it has nothing to do with rendering them.

    Declaration

    Objective-C

    - (id)colorForLayer:(NSString *_Nonnull)layerName;

    Swift

    func color(forLayer layerName: String) -> Any!
  • If there is a background layer, calculate the color for a given zoom level. Otherwise return nil

    Declaration

    Objective-C

    - (id)backgroundColorForZoom:(double)zoom;

    Swift

    func backgroundColor(forZoom zoom: Double) -> Any!
  • Make a layer visible/invisible

    Declaration

    Objective-C

    - (void)setLayerVisible:(NSString *_Nonnull)layerName visible:(_Bool)visible;

    Swift

    func setLayerVisible(_ layerName: String, visible: Bool)
  • Slot for continuous zoom levels. If not set, we won’t use those.

    Declaration

    Objective-C

    - (void)setZoomSlot:(int)zoomSlot;

    Swift

    func setZoomSlot(_ zoomSlot: Int32)
  • Returns a dictionary containing a flexible legend for the layers contained in this style. Each layer is rendered as a representative image at the given size. Layer names that start with the same “_” will be grouped together in the hiearchy if the group parameter is set. Otherwise they’ll be flat.

    Declaration

    Objective-C

    - (NSArray<MaplyLegendEntry *> *_Nonnull)layerLegend:(CGSize)imageSize
                                                   group:(_Bool)useGroups;

    Swift

    func layerLegend(_ imageSize: CGSize, group useGroups: Bool) -> [MaplyLegendEntry]
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, weak, nullable) NSObject<MaplyRenderControllerProtocol> *viewC

    Swift

    weak var viewC: (NSObjectProtocol & MaplyRenderControllerProtocol)? { get set }