summaryrefslogtreecommitdiff
path: root/platform/darwin
diff options
context:
space:
mode:
authorFabian Guerra <fabian.guerra@mapbox.com>2018-12-03 14:21:15 -0800
committerFabian Guerra Soto <fabian.guerra@mapbox.com>2018-12-12 15:07:23 -0800
commit98984ef2926dbd1cc6876880ac99cfa737f74a1c (patch)
treeb7477090547ce4a7e4e3bbd9fd93ced4a894f555 /platform/darwin
parent3e413de1506e3c97f37741cd6eb987b684dd38b3 (diff)
downloadqtlocation-mapboxgl-98984ef2926dbd1cc6876880ac99cfa737f74a1c.tar.gz
[ios, macos] Fix MGLTransition struct creation.
Diffstat (limited to 'platform/darwin')
-rw-r--r--platform/darwin/src/MGLBackgroundStyleLayer.mm24
-rw-r--r--platform/darwin/src/MGLCircleStyleLayer.mm64
-rw-r--r--platform/darwin/src/MGLFillExtrusionStyleLayer.mm48
-rw-r--r--platform/darwin/src/MGLFillStyleLayer.mm40
-rw-r--r--platform/darwin/src/MGLHeatmapStyleLayer.mm24
-rw-r--r--platform/darwin/src/MGLHillshadeStyleLayer.mm32
-rw-r--r--platform/darwin/src/MGLLight.mm14
-rw-r--r--platform/darwin/src/MGLLight.mm.ejs14
-rw-r--r--platform/darwin/src/MGLLineStyleLayer.mm72
-rw-r--r--platform/darwin/src/MGLRasterStyleLayer.mm48
-rw-r--r--platform/darwin/src/MGLStyle.mm12
-rw-r--r--platform/darwin/src/MGLStyleLayer.mm.ejs8
-rw-r--r--platform/darwin/src/MGLStyleValue_Private.h15
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer.mm96
-rw-r--r--platform/darwin/src/MGLTypes.h2
15 files changed, 132 insertions, 381 deletions
diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.mm b/platform/darwin/src/MGLBackgroundStyleLayer.mm
index c754de43c2..00b10cf2be 100644
--- a/platform/darwin/src/MGLBackgroundStyleLayer.mm
+++ b/platform/darwin/src/MGLBackgroundStyleLayer.mm
@@ -58,19 +58,15 @@
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting backgroundColorTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setBackgroundColorTransition(options);
+ self.rawLayer->setBackgroundColorTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)backgroundColorTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getBackgroundColorTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setBackgroundOpacity:(NSExpression *)backgroundOpacity {
@@ -95,19 +91,15 @@
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting backgroundOpacityTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setBackgroundOpacityTransition(options);
+ self.rawLayer->setBackgroundOpacityTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)backgroundOpacityTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getBackgroundOpacityTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setBackgroundPattern:(NSExpression *)backgroundPattern {
@@ -132,19 +124,15 @@
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting backgroundPatternTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setBackgroundPatternTransition(options);
+ self.rawLayer->setBackgroundPatternTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)backgroundPatternTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getBackgroundPatternTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
@end
diff --git a/platform/darwin/src/MGLCircleStyleLayer.mm b/platform/darwin/src/MGLCircleStyleLayer.mm
index 83113d6027..6f82d85ce1 100644
--- a/platform/darwin/src/MGLCircleStyleLayer.mm
+++ b/platform/darwin/src/MGLCircleStyleLayer.mm
@@ -115,19 +115,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting circleBlurTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setCircleBlurTransition(options);
+ self.rawLayer->setCircleBlurTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)circleBlurTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleBlurTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setCircleColor:(NSExpression *)circleColor {
@@ -152,19 +148,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting circleColorTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setCircleColorTransition(options);
+ self.rawLayer->setCircleColorTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)circleColorTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleColorTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setCircleOpacity:(NSExpression *)circleOpacity {
@@ -189,19 +181,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting circleOpacityTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setCircleOpacityTransition(options);
+ self.rawLayer->setCircleOpacityTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)circleOpacityTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleOpacityTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setCirclePitchAlignment:(NSExpression *)circlePitchAlignment {
@@ -244,19 +232,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting circleRadiusTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setCircleRadiusTransition(options);
+ self.rawLayer->setCircleRadiusTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)circleRadiusTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleRadiusTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setCircleScaleAlignment:(NSExpression *)circleScaleAlignment {
@@ -306,19 +290,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting circleStrokeColorTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setCircleStrokeColorTransition(options);
+ self.rawLayer->setCircleStrokeColorTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)circleStrokeColorTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleStrokeColorTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setCircleStrokeOpacity:(NSExpression *)circleStrokeOpacity {
@@ -343,19 +323,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting circleStrokeOpacityTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setCircleStrokeOpacityTransition(options);
+ self.rawLayer->setCircleStrokeOpacityTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)circleStrokeOpacityTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleStrokeOpacityTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setCircleStrokeWidth:(NSExpression *)circleStrokeWidth {
@@ -380,19 +356,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting circleStrokeWidthTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setCircleStrokeWidthTransition(options);
+ self.rawLayer->setCircleStrokeWidthTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)circleStrokeWidthTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleStrokeWidthTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setCircleTranslation:(NSExpression *)circleTranslation {
@@ -417,19 +389,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting circleTranslationTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setCircleTranslateTransition(options);
+ self.rawLayer->setCircleTranslateTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)circleTranslationTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleTranslateTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setCircleTranslate:(NSExpression *)circleTranslate {
diff --git a/platform/darwin/src/MGLFillExtrusionStyleLayer.mm b/platform/darwin/src/MGLFillExtrusionStyleLayer.mm
index 8ec6000eae..1039a8facc 100644
--- a/platform/darwin/src/MGLFillExtrusionStyleLayer.mm
+++ b/platform/darwin/src/MGLFillExtrusionStyleLayer.mm
@@ -105,19 +105,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting fillExtrusionBaseTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setFillExtrusionBaseTransition(options);
+ self.rawLayer->setFillExtrusionBaseTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)fillExtrusionBaseTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillExtrusionBaseTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setFillExtrusionColor:(NSExpression *)fillExtrusionColor {
@@ -142,19 +138,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting fillExtrusionColorTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setFillExtrusionColorTransition(options);
+ self.rawLayer->setFillExtrusionColorTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)fillExtrusionColorTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillExtrusionColorTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setFillExtrusionHasVerticalGradient:(NSExpression *)fillExtrusionHasVerticalGradient {
@@ -204,19 +196,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting fillExtrusionHeightTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setFillExtrusionHeightTransition(options);
+ self.rawLayer->setFillExtrusionHeightTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)fillExtrusionHeightTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillExtrusionHeightTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setFillExtrusionOpacity:(NSExpression *)fillExtrusionOpacity {
@@ -241,19 +229,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting fillExtrusionOpacityTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setFillExtrusionOpacityTransition(options);
+ self.rawLayer->setFillExtrusionOpacityTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)fillExtrusionOpacityTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillExtrusionOpacityTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setFillExtrusionPattern:(NSExpression *)fillExtrusionPattern {
@@ -278,19 +262,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting fillExtrusionPatternTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setFillExtrusionPatternTransition(options);
+ self.rawLayer->setFillExtrusionPatternTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)fillExtrusionPatternTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillExtrusionPatternTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setFillExtrusionTranslation:(NSExpression *)fillExtrusionTranslation {
@@ -315,19 +295,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting fillExtrusionTranslationTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setFillExtrusionTranslateTransition(options);
+ self.rawLayer->setFillExtrusionTranslateTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)fillExtrusionTranslationTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillExtrusionTranslateTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setFillExtrusionTranslate:(NSExpression *)fillExtrusionTranslate {
diff --git a/platform/darwin/src/MGLFillStyleLayer.mm b/platform/darwin/src/MGLFillStyleLayer.mm
index 69de3e7d62..5a91320656 100644
--- a/platform/darwin/src/MGLFillStyleLayer.mm
+++ b/platform/darwin/src/MGLFillStyleLayer.mm
@@ -130,19 +130,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting fillColorTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setFillColorTransition(options);
+ self.rawLayer->setFillColorTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)fillColorTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillColorTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setFillOpacity:(NSExpression *)fillOpacity {
@@ -167,19 +163,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting fillOpacityTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setFillOpacityTransition(options);
+ self.rawLayer->setFillOpacityTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)fillOpacityTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillOpacityTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setFillOutlineColor:(NSExpression *)fillOutlineColor {
@@ -204,19 +196,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting fillOutlineColorTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setFillOutlineColorTransition(options);
+ self.rawLayer->setFillOutlineColorTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)fillOutlineColorTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillOutlineColorTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setFillPattern:(NSExpression *)fillPattern {
@@ -241,19 +229,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting fillPatternTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setFillPatternTransition(options);
+ self.rawLayer->setFillPatternTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)fillPatternTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillPatternTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setFillTranslation:(NSExpression *)fillTranslation {
@@ -278,19 +262,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting fillTranslationTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setFillTranslateTransition(options);
+ self.rawLayer->setFillTranslateTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)fillTranslationTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillTranslateTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setFillTranslate:(NSExpression *)fillTranslate {
diff --git a/platform/darwin/src/MGLHeatmapStyleLayer.mm b/platform/darwin/src/MGLHeatmapStyleLayer.mm
index ec6fdbde78..41d9597dd7 100644
--- a/platform/darwin/src/MGLHeatmapStyleLayer.mm
+++ b/platform/darwin/src/MGLHeatmapStyleLayer.mm
@@ -114,19 +114,15 @@
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting heatmapIntensityTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setHeatmapIntensityTransition(options);
+ self.rawLayer->setHeatmapIntensityTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)heatmapIntensityTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getHeatmapIntensityTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setHeatmapOpacity:(NSExpression *)heatmapOpacity {
@@ -151,19 +147,15 @@
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting heatmapOpacityTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setHeatmapOpacityTransition(options);
+ self.rawLayer->setHeatmapOpacityTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)heatmapOpacityTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getHeatmapOpacityTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setHeatmapRadius:(NSExpression *)heatmapRadius {
@@ -188,19 +180,15 @@
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting heatmapRadiusTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setHeatmapRadiusTransition(options);
+ self.rawLayer->setHeatmapRadiusTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)heatmapRadiusTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getHeatmapRadiusTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setHeatmapWeight:(NSExpression *)heatmapWeight {
diff --git a/platform/darwin/src/MGLHillshadeStyleLayer.mm b/platform/darwin/src/MGLHillshadeStyleLayer.mm
index 95620b139d..6bb167d43d 100644
--- a/platform/darwin/src/MGLHillshadeStyleLayer.mm
+++ b/platform/darwin/src/MGLHillshadeStyleLayer.mm
@@ -74,19 +74,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting hillshadeAccentColorTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setHillshadeAccentColorTransition(options);
+ self.rawLayer->setHillshadeAccentColorTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)hillshadeAccentColorTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getHillshadeAccentColorTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setHillshadeExaggeration:(NSExpression *)hillshadeExaggeration {
@@ -111,19 +107,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting hillshadeExaggerationTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setHillshadeExaggerationTransition(options);
+ self.rawLayer->setHillshadeExaggerationTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)hillshadeExaggerationTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getHillshadeExaggerationTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setHillshadeHighlightColor:(NSExpression *)hillshadeHighlightColor {
@@ -148,19 +140,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting hillshadeHighlightColorTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setHillshadeHighlightColorTransition(options);
+ self.rawLayer->setHillshadeHighlightColorTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)hillshadeHighlightColorTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getHillshadeHighlightColorTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setHillshadeIlluminationAnchor:(NSExpression *)hillshadeIlluminationAnchor {
@@ -221,19 +209,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting hillshadeShadowColorTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setHillshadeShadowColorTransition(options);
+ self.rawLayer->setHillshadeShadowColorTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)hillshadeShadowColorTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getHillshadeShadowColorTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
@end
diff --git a/platform/darwin/src/MGLLight.mm b/platform/darwin/src/MGLLight.mm
index 190391687e..b7566d57a4 100644
--- a/platform/darwin/src/MGLLight.mm
+++ b/platform/darwin/src/MGLLight.mm
@@ -5,7 +5,6 @@
#import "MGLLight.h"
#import "MGLTypes.h"
-#import "NSDate+MGLAdditions.h"
#import "MGLStyleValue_Private.h"
#import "NSValue+MGLAdditions.h"
#import "MGLLoggingConfiguration_Private.h"
@@ -22,19 +21,6 @@ namespace mbgl {
}
-NS_INLINE MGLTransition MGLTransitionFromOptions(const mbgl::style::TransitionOptions& options) {
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(options.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(options.delay.value_or(mbgl::Duration::zero()));
-
- return transition;
-}
-
-NS_INLINE mbgl::style::TransitionOptions MGLOptionsFromTransition(MGLTransition transition) {
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- return options;
-}
-
@interface MGLLight()
@end
diff --git a/platform/darwin/src/MGLLight.mm.ejs b/platform/darwin/src/MGLLight.mm.ejs
index df79f4c842..e4e455d354 100644
--- a/platform/darwin/src/MGLLight.mm.ejs
+++ b/platform/darwin/src/MGLLight.mm.ejs
@@ -8,7 +8,6 @@
#import "MGLLight.h"
#import "MGLTypes.h"
-#import "NSDate+MGLAdditions.h"
#import "MGLStyleValue_Private.h"
#import "NSValue+MGLAdditions.h"
#import "MGLLoggingConfiguration_Private.h"
@@ -30,19 +29,6 @@ namespace mbgl {
}
-NS_INLINE MGLTransition MGLTransitionFromOptions(const mbgl::style::TransitionOptions& options) {
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(options.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(options.delay.value_or(mbgl::Duration::zero()));
-
- return transition;
-}
-
-NS_INLINE mbgl::style::TransitionOptions MGLOptionsFromTransition(MGLTransition transition) {
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- return options;
-}
-
@interface MGLLight()
@end
diff --git a/platform/darwin/src/MGLLineStyleLayer.mm b/platform/darwin/src/MGLLineStyleLayer.mm
index f227ed0bb7..fe37be361c 100644
--- a/platform/darwin/src/MGLLineStyleLayer.mm
+++ b/platform/darwin/src/MGLLineStyleLayer.mm
@@ -191,19 +191,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting lineBlurTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setLineBlurTransition(options);
+ self.rawLayer->setLineBlurTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)lineBlurTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineBlurTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setLineColor:(NSExpression *)lineColor {
@@ -228,19 +224,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting lineColorTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setLineColorTransition(options);
+ self.rawLayer->setLineColorTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)lineColorTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineColorTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setLineDashPattern:(NSExpression *)lineDashPattern {
@@ -265,19 +257,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting lineDashPatternTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setLineDasharrayTransition(options);
+ self.rawLayer->setLineDasharrayTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)lineDashPatternTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineDasharrayTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setLineDasharray:(NSExpression *)lineDasharray {
@@ -309,19 +297,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting lineGapWidthTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setLineGapWidthTransition(options);
+ self.rawLayer->setLineGapWidthTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)lineGapWidthTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineGapWidthTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setLineGradient:(NSExpression *)lineGradient {
@@ -364,19 +348,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting lineOffsetTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setLineOffsetTransition(options);
+ self.rawLayer->setLineOffsetTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)lineOffsetTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineOffsetTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setLineOpacity:(NSExpression *)lineOpacity {
@@ -401,19 +381,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting lineOpacityTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setLineOpacityTransition(options);
+ self.rawLayer->setLineOpacityTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)lineOpacityTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineOpacityTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setLinePattern:(NSExpression *)linePattern {
@@ -438,19 +414,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting linePatternTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setLinePatternTransition(options);
+ self.rawLayer->setLinePatternTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)linePatternTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLinePatternTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setLineTranslation:(NSExpression *)lineTranslation {
@@ -475,19 +447,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting lineTranslationTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setLineTranslateTransition(options);
+ self.rawLayer->setLineTranslateTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)lineTranslationTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineTranslateTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setLineTranslate:(NSExpression *)lineTranslate {
@@ -544,19 +512,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting lineWidthTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setLineWidthTransition(options);
+ self.rawLayer->setLineWidthTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)lineWidthTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineWidthTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
@end
diff --git a/platform/darwin/src/MGLRasterStyleLayer.mm b/platform/darwin/src/MGLRasterStyleLayer.mm
index cf1b8da84e..2198d441d1 100644
--- a/platform/darwin/src/MGLRasterStyleLayer.mm
+++ b/platform/darwin/src/MGLRasterStyleLayer.mm
@@ -74,19 +74,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting maximumRasterBrightnessTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setRasterBrightnessMaxTransition(options);
+ self.rawLayer->setRasterBrightnessMaxTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)maximumRasterBrightnessTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterBrightnessMaxTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setRasterBrightnessMax:(NSExpression *)rasterBrightnessMax {
@@ -118,19 +114,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting minimumRasterBrightnessTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setRasterBrightnessMinTransition(options);
+ self.rawLayer->setRasterBrightnessMinTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)minimumRasterBrightnessTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterBrightnessMinTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setRasterBrightnessMin:(NSExpression *)rasterBrightnessMin {
@@ -162,19 +154,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting rasterContrastTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setRasterContrastTransition(options);
+ self.rawLayer->setRasterContrastTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)rasterContrastTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterContrastTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setRasterFadeDuration:(NSExpression *)rasterFadeDuration {
@@ -217,19 +205,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting rasterHueRotationTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setRasterHueRotateTransition(options);
+ self.rawLayer->setRasterHueRotateTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)rasterHueRotationTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterHueRotateTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setRasterHueRotate:(NSExpression *)rasterHueRotate {
@@ -261,19 +245,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting rasterOpacityTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setRasterOpacityTransition(options);
+ self.rawLayer->setRasterOpacityTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)rasterOpacityTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterOpacityTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setRasterResamplingMode:(NSExpression *)rasterResamplingMode {
@@ -323,19 +303,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting rasterSaturationTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setRasterSaturationTransition(options);
+ self.rawLayer->setRasterSaturationTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)rasterSaturationTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterSaturationTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
@end
diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm
index b9acb4a235..df5f51102a 100644
--- a/platform/darwin/src/MGLStyle.mm
+++ b/platform/darwin/src/MGLStyle.mm
@@ -524,22 +524,14 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles,
- (void)setTransition:(MGLTransition)transition
{
- auto transitionOptions = self.rawStyle->getTransitionOptions();
- transitionOptions.duration = MGLDurationFromTimeInterval(transition.duration);
- transitionOptions.delay = MGLDurationFromTimeInterval(transition.delay);
-
- self.rawStyle->setTransitionOptions(transitionOptions);
+ self.rawStyle->setTransitionOptions(MGLOptionsFromTransition(transition));
}
- (MGLTransition)transition
{
- MGLTransition transition;
const mbgl::style::TransitionOptions transitionOptions = self.rawStyle->getTransitionOptions();
-
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
#pragma mark Style light
diff --git a/platform/darwin/src/MGLStyleLayer.mm.ejs b/platform/darwin/src/MGLStyleLayer.mm.ejs
index c744db72ed..26cb3e26f6 100644
--- a/platform/darwin/src/MGLStyleLayer.mm.ejs
+++ b/platform/darwin/src/MGLStyleLayer.mm.ejs
@@ -210,19 +210,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting <%- objCName(property) %>Transition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->set<%- camelize(originalPropertyName(property)) %>Transition(options);
+ self.rawLayer->set<%- camelize(originalPropertyName(property)) %>Transition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)<%- objCGetter(property) %>Transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->get<%- camelize(originalPropertyName(property)) %>Transition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
<% } -%>
<% if (property.original) { -%>
diff --git a/platform/darwin/src/MGLStyleValue_Private.h b/platform/darwin/src/MGLStyleValue_Private.h
index cc1950bfb8..84d7ccccec 100644
--- a/platform/darwin/src/MGLStyleValue_Private.h
+++ b/platform/darwin/src/MGLStyleValue_Private.h
@@ -5,12 +5,14 @@
#import "NSValue+MGLStyleAttributeAdditions.h"
#import "NSValue+MGLAdditions.h"
#import "NSExpression+MGLPrivateAdditions.h"
+#import "NSDate+MGLAdditions.h"
#import "MGLTypes.h"
#import "MGLConversion.h"
#include <mbgl/style/conversion/color_ramp_property_value.hpp>
#include <mbgl/style/conversion/property_value.hpp>
#include <mbgl/style/conversion/position.hpp>
+#import <mbgl/style/transition_options.hpp>
#import <mbgl/style/types.hpp>
#import <mbgl/util/enum.hpp>
@@ -30,6 +32,19 @@ namespace mbgl {
}
}
+NS_INLINE MGLTransition MGLTransitionFromOptions(const mbgl::style::TransitionOptions& options) {
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(options.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(options.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
+NS_INLINE mbgl::style::TransitionOptions MGLOptionsFromTransition(MGLTransition transition) {
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ return options;
+}
+
id MGLJSONObjectFromMBGLExpression(const mbgl::style::expression::Expression &mbglExpression);
template <typename MBGLType, typename ObjCType, typename MBGLElement = MBGLType, typename ObjCEnum = ObjCType>
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.mm b/platform/darwin/src/MGLSymbolStyleLayer.mm
index 5da74d8fac..60fc4d6881 100644
--- a/platform/darwin/src/MGLSymbolStyleLayer.mm
+++ b/platform/darwin/src/MGLSymbolStyleLayer.mm
@@ -991,19 +991,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting iconColorTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setIconColorTransition(options);
+ self.rawLayer->setIconColorTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)iconColorTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconColorTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setIconHaloBlur:(NSExpression *)iconHaloBlur {
@@ -1028,19 +1024,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting iconHaloBlurTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setIconHaloBlurTransition(options);
+ self.rawLayer->setIconHaloBlurTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)iconHaloBlurTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconHaloBlurTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setIconHaloColor:(NSExpression *)iconHaloColor {
@@ -1065,19 +1057,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting iconHaloColorTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setIconHaloColorTransition(options);
+ self.rawLayer->setIconHaloColorTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)iconHaloColorTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconHaloColorTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setIconHaloWidth:(NSExpression *)iconHaloWidth {
@@ -1102,19 +1090,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting iconHaloWidthTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setIconHaloWidthTransition(options);
+ self.rawLayer->setIconHaloWidthTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)iconHaloWidthTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconHaloWidthTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setIconOpacity:(NSExpression *)iconOpacity {
@@ -1139,19 +1123,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting iconOpacityTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setIconOpacityTransition(options);
+ self.rawLayer->setIconOpacityTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)iconOpacityTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconOpacityTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setIconTranslation:(NSExpression *)iconTranslation {
@@ -1176,19 +1156,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting iconTranslationTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setIconTranslateTransition(options);
+ self.rawLayer->setIconTranslateTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)iconTranslationTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconTranslateTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setIconTranslate:(NSExpression *)iconTranslate {
@@ -1245,19 +1221,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting textColorTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setTextColorTransition(options);
+ self.rawLayer->setTextColorTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)textColorTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextColorTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setTextHaloBlur:(NSExpression *)textHaloBlur {
@@ -1282,19 +1254,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting textHaloBlurTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setTextHaloBlurTransition(options);
+ self.rawLayer->setTextHaloBlurTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)textHaloBlurTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextHaloBlurTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setTextHaloColor:(NSExpression *)textHaloColor {
@@ -1319,19 +1287,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting textHaloColorTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setTextHaloColorTransition(options);
+ self.rawLayer->setTextHaloColorTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)textHaloColorTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextHaloColorTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setTextHaloWidth:(NSExpression *)textHaloWidth {
@@ -1356,19 +1320,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting textHaloWidthTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setTextHaloWidthTransition(options);
+ self.rawLayer->setTextHaloWidthTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)textHaloWidthTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextHaloWidthTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setTextOpacity:(NSExpression *)textOpacity {
@@ -1393,19 +1353,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting textOpacityTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setTextOpacityTransition(options);
+ self.rawLayer->setTextOpacityTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)textOpacityTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextOpacityTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setTextTranslation:(NSExpression *)textTranslation {
@@ -1430,19 +1386,15 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
MGLLogDebug(@"Setting textTranslationTransition: %@", MGLStringFromMGLTransition(transition));
- mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
- self.rawLayer->setTextTranslateTransition(options);
+ self.rawLayer->setTextTranslateTransition(MGLOptionsFromTransition(transition));
}
- (MGLTransition)textTranslationTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextTranslateTransition();
- MGLTransition transition;
- transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
- transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
- return transition;
+ return MGLTransitionFromOptions(transitionOptions);
}
- (void)setTextTranslate:(NSExpression *)textTranslate {
diff --git a/platform/darwin/src/MGLTypes.h b/platform/darwin/src/MGLTypes.h
index 5aee79bd82..491e24310f 100644
--- a/platform/darwin/src/MGLTypes.h
+++ b/platform/darwin/src/MGLTypes.h
@@ -94,7 +94,7 @@ typedef struct __attribute__((objc_boxable)) MGLTransition {
/**
The amount of time in seconds to wait before beginning the animation.
*/
- NSTimeInterval delay;
+ NSTimeInterval delay;
} MGLTransition;
NS_INLINE NSString *MGLStringFromMGLTransition(MGLTransition transition) {