MaplySimpleStyleManager
Objective-C
@interface MaplySimpleStyleManager : NSObject
Swift
class MaplySimpleStyleManager : NSObject
Used to generate icons and parse styles for the GeoJSON simple Style spec. https://github.com/mapbox/simplestyle-spec
Can also be used to define some very simple icon styles directly.
-
Fetch the simple UIImage for the icon with the given name. *
Declaration
Objective-C
+ (id)iconForName:(NSString *_Nonnull)name size:(CGSize)size;
Swift
class func icon(forName name: String, size: CGSize) -> Any!
-
Slightly more complex icon *
Declaration
Objective-C
+ (id)iconForName:(NSString *_Nullable)name size:(CGSize)size color:(id)color circleColor:(id)circleColor strokeSize:(float)strokeSize strokeColor:(id)strokeColor;
Swift
class func icon(forName name: String?, size: CGSize, color: Any!, circleColor: Any!, strokeSize: Float, strokeColor: Any!) -> Any!
-
Set up the icon manager this way to build textures associated with a particular view controller.
Declaration
Objective-C
- (nonnull id)initWithViewC: (NSObject<MaplyRenderControllerProtocol> *_Nonnull)viewC;
Swift
init(viewC: NSObjectProtocol & MaplyRenderControllerProtocol)
-
Markers can be three different sizes. These are the actual sizes associated
Declaration
Objective-C
@property (nonatomic) CGSize smallSize;
Swift
var smallSize: CGSize { get set }
-
Markers can be three different sizes. These are the actual sizes associated
Declaration
Objective-C
@property (nonatomic) CGSize medSize;
Swift
var medSize: CGSize { get set }
-
Markers can be three different sizes. These are the actual sizes associated
Declaration
Objective-C
@property (nonatomic) CGSize largeSize;
Swift
var largeSize: CGSize { get set }
-
Normal scale from device (e.g. 2x for retina and so on)
Declaration
Objective-C
@property (nonatomic) CGFloat scale;
Swift
var scale: CGFloat { get set }
-
We normally put a stroke around generated icons This is the width (in pixels) of that stroek
Declaration
Objective-C
@property (nonatomic) CGFloat strokeWidthForIcons;
Swift
var strokeWidthForIcons: CGFloat { get set }
-
If set (default) we’ll center the marker. If off we’ll offset vertically
Declaration
Objective-C
@property (nonatomic) _Bool centerIcon;
Swift
var centerIcon: Bool { get set }
-
Mapbox defines a simple style spec that’s usually associated with GeoJSON data. Github is a prominent user.
Pass in a dictionary parsed from JSON (or just make it up yourself) and this will produce (an optional) icon and parse out the rest. This takes screen scale and such into account. It will also cache the same description when passed in multiple times.
Declaration
Objective-C
- (MaplySimpleStyle *_Nonnull)makeStyle:(NSDictionary *_Nonnull)dict;
Swift
func makeStyle(_ dict: [AnyHashable : Any]) -> MaplySimpleStyle
-
Takes a single vector object. It will parse out the simple style from the attributes (or provide a default if there is none) and then build the corresponding feature and return a MaplyComponentObject to represent it.
mode controls if this work is done on this thread or another.
Declaration
Objective-C
- (MaplyComponentObject *_Nullable)addFeature: (MaplyVectorObject *_Nonnull)vecObj mode:(MaplyThreadMode)mode;
Swift
func addFeature(_ vecObj: MaplyVectorObject, mode: MaplyThreadMode) -> MaplyComponentObject?
-
Takes an array of vector objects and calls addFeature: on each one.
mode controls if this work is done on this thread or another.
Declaration
Objective-C
- (NSArray<MaplyComponentObject *> *_Nonnull) addFeatures:(NSArray<MaplyVectorObject *> *_Nonnull)vecObjs mode:(MaplyThreadMode)mode;
Swift
func addFeatures(_ vecObjs: [MaplyVectorObject], mode: MaplyThreadMode) -> [MaplyComponentObject]
-
Delete any cached textures and such
Declaration
Objective-C
- (void)shutdown;
Swift
func shutdown()