summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLLineStyleLayer.mm
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2018-08-08 15:09:27 +0300
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2018-08-23 19:01:40 +0300
commitfb5afd34b9b25e993a4b109385215eba0b83923f (patch)
tree61474b72e7d099808eb85ea60275e58da11bdd39 /platform/darwin/src/MGLLineStyleLayer.mm
parent52275f835a38897ebf1aeb2158ccfca2272e4770 (diff)
downloadqtlocation-mapboxgl-fb5afd34b9b25e993a4b109385215eba0b83923f.tar.gz
[core] Add `line-gradient` property
Porting of https://github.com/mapbox/mapbox-gl-js/pull/6303 See the link above for the description of the feature and its limitations). Based on patch from @lbud (Lauren Budorick).
Diffstat (limited to 'platform/darwin/src/MGLLineStyleLayer.mm')
-rw-r--r--platform/darwin/src/MGLLineStyleLayer.mm17
1 files changed, 17 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLLineStyleLayer.mm b/platform/darwin/src/MGLLineStyleLayer.mm
index 3bad2a8b98..5cf0762475 100644
--- a/platform/darwin/src/MGLLineStyleLayer.mm
+++ b/platform/darwin/src/MGLLineStyleLayer.mm
@@ -306,6 +306,23 @@ namespace mbgl {
return transition;
}
+- (void)setLineGradient:(NSExpression *)lineGradient {
+ MGLAssertStyleLayerIsValid();
+
+ auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue<mbgl::style::ColorRampPropertyValue>(lineGradient);
+ self.rawLayer->setLineGradient(mbglValue);
+}
+
+- (NSExpression *)lineGradient {
+ MGLAssertStyleLayerIsValid();
+
+ auto propertyValue = self.rawLayer->getLineGradient();
+ if (propertyValue.isUndefined()) {
+ propertyValue = self.rawLayer->getDefaultLineGradient();
+ }
+ return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toExpression(propertyValue);
+}
+
- (void)setLineOffset:(NSExpression *)lineOffset {
MGLAssertStyleLayerIsValid();