diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-12-08 13:14:52 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-12-09 09:35:21 -0800 |
commit | 82856fd08b0b50902c72a56b5fe640447c94609e (patch) | |
tree | 8d1ecf2ae64db34cb295790fc122c8accb11d1ed /platform/darwin/src | |
parent | 3b2a4216a2e3929a557dbddd0d239758641c285f (diff) | |
download | qtlocation-mapboxgl-82856fd08b0b50902c72a56b5fe640447c94609e.tar.gz |
[darwin, android] SDK bindings for circle-stroke properties
Diffstat (limited to 'platform/darwin/src')
-rw-r--r-- | platform/darwin/src/MGLCircleStyleLayer.h | 32 | ||||
-rw-r--r-- | platform/darwin/src/MGLCircleStyleLayer.mm | 42 | ||||
-rw-r--r-- | platform/darwin/src/MGLStyleLayer.mm.ejs | 2 |
3 files changed, 75 insertions, 1 deletions
diff --git a/platform/darwin/src/MGLCircleStyleLayer.h b/platform/darwin/src/MGLCircleStyleLayer.h index 2d88a664ba..8c95b72123 100644 --- a/platform/darwin/src/MGLCircleStyleLayer.h +++ b/platform/darwin/src/MGLCircleStyleLayer.h @@ -94,6 +94,38 @@ typedef NS_ENUM(NSUInteger, MGLCircleTranslateAnchor) { */ @property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleRadius; +#if TARGET_OS_IPHONE +/** + The stroke color of the circle. + + The default value of this property is an `MGLStyleValue` object containing `UIColor.blackColor`. Set this property to `nil` to reset it to the default value. + */ +@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *circleStrokeColor; +#else +/** + The stroke color of the circle. + + The default value of this property is an `MGLStyleValue` object containing `NSColor.blackColor`. Set this property to `nil` to reset it to the default value. + */ +@property (nonatomic, null_resettable) MGLStyleValue<MGLColor *> *circleStrokeColor; +#endif + +/** + The opacity of the circle's stroke. + + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. + */ +@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleStrokeOpacity; + +/** + The width of the circle's stroke. Strokes are placed outside of the `circleRadius`. + + This property is measured in points. + + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. + */ +@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleStrokeWidth; + /** The geometry's offset. diff --git a/platform/darwin/src/MGLCircleStyleLayer.mm b/platform/darwin/src/MGLCircleStyleLayer.mm index 91f91a7bcd..781682d4d1 100644 --- a/platform/darwin/src/MGLCircleStyleLayer.mm +++ b/platform/darwin/src/MGLCircleStyleLayer.mm @@ -187,6 +187,48 @@ namespace mbgl { return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue); } +- (void)setCircleStrokeColor:(MGLStyleValue<MGLColor *> *)circleStrokeColor { + MGLAssertStyleLayerIsValid(); + + auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(circleStrokeColor); + _rawLayer->setCircleStrokeColor(mbglValue); +} + +- (MGLStyleValue<MGLColor *> *)circleStrokeColor { + MGLAssertStyleLayerIsValid(); + + auto propertyValue = _rawLayer->getCircleStrokeColor() ?: _rawLayer->getDefaultCircleStrokeColor(); + return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue); +} + +- (void)setCircleStrokeOpacity:(MGLStyleValue<NSNumber *> *)circleStrokeOpacity { + MGLAssertStyleLayerIsValid(); + + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(circleStrokeOpacity); + _rawLayer->setCircleStrokeOpacity(mbglValue); +} + +- (MGLStyleValue<NSNumber *> *)circleStrokeOpacity { + MGLAssertStyleLayerIsValid(); + + auto propertyValue = _rawLayer->getCircleStrokeOpacity() ?: _rawLayer->getDefaultCircleStrokeOpacity(); + return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue); +} + +- (void)setCircleStrokeWidth:(MGLStyleValue<NSNumber *> *)circleStrokeWidth { + MGLAssertStyleLayerIsValid(); + + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(circleStrokeWidth); + _rawLayer->setCircleStrokeWidth(mbglValue); +} + +- (MGLStyleValue<NSNumber *> *)circleStrokeWidth { + MGLAssertStyleLayerIsValid(); + + auto propertyValue = _rawLayer->getCircleStrokeWidth() ?: _rawLayer->getDefaultCircleStrokeWidth(); + return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue); +} + - (void)setCircleTranslate:(MGLStyleValue<NSValue *> *)circleTranslate { MGLAssertStyleLayerIsValid(); diff --git a/platform/darwin/src/MGLStyleLayer.mm.ejs b/platform/darwin/src/MGLStyleLayer.mm.ejs index c89912c1ff..82d8a2561c 100644 --- a/platform/darwin/src/MGLStyleLayer.mm.ejs +++ b/platform/darwin/src/MGLStyleLayer.mm.ejs @@ -14,7 +14,7 @@ #import "MGLStyleValue_Private.h" #import "MGL<%- camelize(type) %>StyleLayer.h" -#include <mbgl/style/layers/<%- type %>_layer.hpp> +#include <mbgl/style/layers/<%- type.replace('-', '_') %>_layer.hpp> <% if (containsEnumerationProperties) { -%> namespace mbgl { |