Merge branch 'release-ios-v3.5.0-android-v5.0.0'

This commit is contained in:
John Firebaugh
2017-03-21 11:55:02 -07:00
175 changed files with 4872 additions and 742 deletions

View File

@@ -120,9 +120,6 @@ public:
*
* If pause is called then no revalidation or network request activity
* will occur.
*
* Note: Calling pause and then calling getAPIBaseURL or getAccessToken
* will lock the thread that those calls are made on.
*/
void pause();

View File

@@ -25,16 +25,19 @@ public:
PropertyValue<Color> getBackgroundColor(const optional<std::string>& klass = {}) const;
void setBackgroundColor(PropertyValue<Color>, const optional<std::string>& klass = {});
void setBackgroundColorTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getBackgroundColorTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<std::string> getDefaultBackgroundPattern();
PropertyValue<std::string> getBackgroundPattern(const optional<std::string>& klass = {}) const;
void setBackgroundPattern(PropertyValue<std::string>, const optional<std::string>& klass = {});
void setBackgroundPatternTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getBackgroundPatternTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<float> getDefaultBackgroundOpacity();
PropertyValue<float> getBackgroundOpacity(const optional<std::string>& klass = {}) const;
void setBackgroundOpacity(PropertyValue<float>, const optional<std::string>& klass = {});
void setBackgroundOpacityTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getBackgroundOpacityTransition(const optional<std::string>& klass = {}) const;
// Private implementation

View File

@@ -33,51 +33,61 @@ public:
DataDrivenPropertyValue<float> getCircleRadius(const optional<std::string>& klass = {}) const;
void setCircleRadius(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setCircleRadiusTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getCircleRadiusTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<Color> getDefaultCircleColor();
DataDrivenPropertyValue<Color> getCircleColor(const optional<std::string>& klass = {}) const;
void setCircleColor(DataDrivenPropertyValue<Color>, const optional<std::string>& klass = {});
void setCircleColorTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getCircleColorTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<float> getDefaultCircleBlur();
DataDrivenPropertyValue<float> getCircleBlur(const optional<std::string>& klass = {}) const;
void setCircleBlur(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setCircleBlurTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getCircleBlurTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<float> getDefaultCircleOpacity();
DataDrivenPropertyValue<float> getCircleOpacity(const optional<std::string>& klass = {}) const;
void setCircleOpacity(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setCircleOpacityTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getCircleOpacityTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<std::array<float, 2>> getDefaultCircleTranslate();
PropertyValue<std::array<float, 2>> getCircleTranslate(const optional<std::string>& klass = {}) const;
void setCircleTranslate(PropertyValue<std::array<float, 2>>, const optional<std::string>& klass = {});
void setCircleTranslateTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getCircleTranslateTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<TranslateAnchorType> getDefaultCircleTranslateAnchor();
PropertyValue<TranslateAnchorType> getCircleTranslateAnchor(const optional<std::string>& klass = {}) const;
void setCircleTranslateAnchor(PropertyValue<TranslateAnchorType>, const optional<std::string>& klass = {});
void setCircleTranslateAnchorTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getCircleTranslateAnchorTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<CirclePitchScaleType> getDefaultCirclePitchScale();
PropertyValue<CirclePitchScaleType> getCirclePitchScale(const optional<std::string>& klass = {}) const;
void setCirclePitchScale(PropertyValue<CirclePitchScaleType>, const optional<std::string>& klass = {});
void setCirclePitchScaleTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getCirclePitchScaleTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<float> getDefaultCircleStrokeWidth();
DataDrivenPropertyValue<float> getCircleStrokeWidth(const optional<std::string>& klass = {}) const;
void setCircleStrokeWidth(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setCircleStrokeWidthTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getCircleStrokeWidthTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<Color> getDefaultCircleStrokeColor();
DataDrivenPropertyValue<Color> getCircleStrokeColor(const optional<std::string>& klass = {}) const;
void setCircleStrokeColor(DataDrivenPropertyValue<Color>, const optional<std::string>& klass = {});
void setCircleStrokeColorTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getCircleStrokeColorTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<float> getDefaultCircleStrokeOpacity();
DataDrivenPropertyValue<float> getCircleStrokeOpacity(const optional<std::string>& klass = {}) const;
void setCircleStrokeOpacity(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setCircleStrokeOpacityTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getCircleStrokeOpacityTransition(const optional<std::string>& klass = {}) const;
// Private implementation

View File

@@ -33,36 +33,43 @@ public:
PropertyValue<float> getFillExtrusionOpacity(const optional<std::string>& klass = {}) const;
void setFillExtrusionOpacity(PropertyValue<float>, const optional<std::string>& klass = {});
void setFillExtrusionOpacityTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getFillExtrusionOpacityTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<Color> getDefaultFillExtrusionColor();
DataDrivenPropertyValue<Color> getFillExtrusionColor(const optional<std::string>& klass = {}) const;
void setFillExtrusionColor(DataDrivenPropertyValue<Color>, const optional<std::string>& klass = {});
void setFillExtrusionColorTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getFillExtrusionColorTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<std::array<float, 2>> getDefaultFillExtrusionTranslate();
PropertyValue<std::array<float, 2>> getFillExtrusionTranslate(const optional<std::string>& klass = {}) const;
void setFillExtrusionTranslate(PropertyValue<std::array<float, 2>>, const optional<std::string>& klass = {});
void setFillExtrusionTranslateTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getFillExtrusionTranslateTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<TranslateAnchorType> getDefaultFillExtrusionTranslateAnchor();
PropertyValue<TranslateAnchorType> getFillExtrusionTranslateAnchor(const optional<std::string>& klass = {}) const;
void setFillExtrusionTranslateAnchor(PropertyValue<TranslateAnchorType>, const optional<std::string>& klass = {});
void setFillExtrusionTranslateAnchorTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getFillExtrusionTranslateAnchorTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<std::string> getDefaultFillExtrusionPattern();
PropertyValue<std::string> getFillExtrusionPattern(const optional<std::string>& klass = {}) const;
void setFillExtrusionPattern(PropertyValue<std::string>, const optional<std::string>& klass = {});
void setFillExtrusionPatternTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getFillExtrusionPatternTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<float> getDefaultFillExtrusionHeight();
DataDrivenPropertyValue<float> getFillExtrusionHeight(const optional<std::string>& klass = {}) const;
void setFillExtrusionHeight(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setFillExtrusionHeightTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getFillExtrusionHeightTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<float> getDefaultFillExtrusionBase();
DataDrivenPropertyValue<float> getFillExtrusionBase(const optional<std::string>& klass = {}) const;
void setFillExtrusionBase(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setFillExtrusionBaseTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getFillExtrusionBaseTransition(const optional<std::string>& klass = {}) const;
// Private implementation

View File

@@ -33,36 +33,43 @@ public:
PropertyValue<bool> getFillAntialias(const optional<std::string>& klass = {}) const;
void setFillAntialias(PropertyValue<bool>, const optional<std::string>& klass = {});
void setFillAntialiasTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getFillAntialiasTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<float> getDefaultFillOpacity();
DataDrivenPropertyValue<float> getFillOpacity(const optional<std::string>& klass = {}) const;
void setFillOpacity(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setFillOpacityTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getFillOpacityTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<Color> getDefaultFillColor();
DataDrivenPropertyValue<Color> getFillColor(const optional<std::string>& klass = {}) const;
void setFillColor(DataDrivenPropertyValue<Color>, const optional<std::string>& klass = {});
void setFillColorTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getFillColorTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<Color> getDefaultFillOutlineColor();
DataDrivenPropertyValue<Color> getFillOutlineColor(const optional<std::string>& klass = {}) const;
void setFillOutlineColor(DataDrivenPropertyValue<Color>, const optional<std::string>& klass = {});
void setFillOutlineColorTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getFillOutlineColorTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<std::array<float, 2>> getDefaultFillTranslate();
PropertyValue<std::array<float, 2>> getFillTranslate(const optional<std::string>& klass = {}) const;
void setFillTranslate(PropertyValue<std::array<float, 2>>, const optional<std::string>& klass = {});
void setFillTranslateTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getFillTranslateTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<TranslateAnchorType> getDefaultFillTranslateAnchor();
PropertyValue<TranslateAnchorType> getFillTranslateAnchor(const optional<std::string>& klass = {}) const;
void setFillTranslateAnchor(PropertyValue<TranslateAnchorType>, const optional<std::string>& klass = {});
void setFillTranslateAnchorTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getFillTranslateAnchorTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<std::string> getDefaultFillPattern();
PropertyValue<std::string> getFillPattern(const optional<std::string>& klass = {}) const;
void setFillPattern(PropertyValue<std::string>, const optional<std::string>& klass = {});
void setFillPatternTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getFillPatternTransition(const optional<std::string>& klass = {}) const;
// Private implementation

View File

@@ -61,6 +61,7 @@ public:
<%- propertyValueType(property) %> get<%- camelize(property.name) %>(const optional<std::string>& klass = {}) const;
void set<%- camelize(property.name) %>(<%- propertyValueType(property) %>, const optional<std::string>& klass = {});
void set<%- camelize(property.name) %>Transition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions get<%- camelize(property.name) %>Transition(const optional<std::string>& klass = {}) const;
<% } -%>
// Private implementation

View File

@@ -53,51 +53,61 @@ public:
DataDrivenPropertyValue<float> getLineOpacity(const optional<std::string>& klass = {}) const;
void setLineOpacity(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setLineOpacityTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getLineOpacityTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<Color> getDefaultLineColor();
DataDrivenPropertyValue<Color> getLineColor(const optional<std::string>& klass = {}) const;
void setLineColor(DataDrivenPropertyValue<Color>, const optional<std::string>& klass = {});
void setLineColorTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getLineColorTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<std::array<float, 2>> getDefaultLineTranslate();
PropertyValue<std::array<float, 2>> getLineTranslate(const optional<std::string>& klass = {}) const;
void setLineTranslate(PropertyValue<std::array<float, 2>>, const optional<std::string>& klass = {});
void setLineTranslateTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getLineTranslateTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<TranslateAnchorType> getDefaultLineTranslateAnchor();
PropertyValue<TranslateAnchorType> getLineTranslateAnchor(const optional<std::string>& klass = {}) const;
void setLineTranslateAnchor(PropertyValue<TranslateAnchorType>, const optional<std::string>& klass = {});
void setLineTranslateAnchorTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getLineTranslateAnchorTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<float> getDefaultLineWidth();
PropertyValue<float> getLineWidth(const optional<std::string>& klass = {}) const;
void setLineWidth(PropertyValue<float>, const optional<std::string>& klass = {});
void setLineWidthTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getLineWidthTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<float> getDefaultLineGapWidth();
DataDrivenPropertyValue<float> getLineGapWidth(const optional<std::string>& klass = {}) const;
void setLineGapWidth(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setLineGapWidthTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getLineGapWidthTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<float> getDefaultLineOffset();
DataDrivenPropertyValue<float> getLineOffset(const optional<std::string>& klass = {}) const;
void setLineOffset(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setLineOffsetTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getLineOffsetTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<float> getDefaultLineBlur();
DataDrivenPropertyValue<float> getLineBlur(const optional<std::string>& klass = {}) const;
void setLineBlur(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setLineBlurTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getLineBlurTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<std::vector<float>> getDefaultLineDasharray();
PropertyValue<std::vector<float>> getLineDasharray(const optional<std::string>& klass = {}) const;
void setLineDasharray(PropertyValue<std::vector<float>>, const optional<std::string>& klass = {});
void setLineDasharrayTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getLineDasharrayTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<std::string> getDefaultLinePattern();
PropertyValue<std::string> getLinePattern(const optional<std::string>& klass = {}) const;
void setLinePattern(PropertyValue<std::string>, const optional<std::string>& klass = {});
void setLinePatternTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getLinePatternTransition(const optional<std::string>& klass = {}) const;
// Private implementation

View File

@@ -28,36 +28,43 @@ public:
PropertyValue<float> getRasterOpacity(const optional<std::string>& klass = {}) const;
void setRasterOpacity(PropertyValue<float>, const optional<std::string>& klass = {});
void setRasterOpacityTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getRasterOpacityTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<float> getDefaultRasterHueRotate();
PropertyValue<float> getRasterHueRotate(const optional<std::string>& klass = {}) const;
void setRasterHueRotate(PropertyValue<float>, const optional<std::string>& klass = {});
void setRasterHueRotateTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getRasterHueRotateTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<float> getDefaultRasterBrightnessMin();
PropertyValue<float> getRasterBrightnessMin(const optional<std::string>& klass = {}) const;
void setRasterBrightnessMin(PropertyValue<float>, const optional<std::string>& klass = {});
void setRasterBrightnessMinTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getRasterBrightnessMinTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<float> getDefaultRasterBrightnessMax();
PropertyValue<float> getRasterBrightnessMax(const optional<std::string>& klass = {}) const;
void setRasterBrightnessMax(PropertyValue<float>, const optional<std::string>& klass = {});
void setRasterBrightnessMaxTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getRasterBrightnessMaxTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<float> getDefaultRasterSaturation();
PropertyValue<float> getRasterSaturation(const optional<std::string>& klass = {}) const;
void setRasterSaturation(PropertyValue<float>, const optional<std::string>& klass = {});
void setRasterSaturationTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getRasterSaturationTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<float> getDefaultRasterContrast();
PropertyValue<float> getRasterContrast(const optional<std::string>& klass = {}) const;
void setRasterContrast(PropertyValue<float>, const optional<std::string>& klass = {});
void setRasterContrastTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getRasterContrastTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<float> getDefaultRasterFadeDuration();
PropertyValue<float> getRasterFadeDuration(const optional<std::string>& klass = {}) const;
void setRasterFadeDuration(PropertyValue<float>, const optional<std::string>& klass = {});
void setRasterFadeDurationTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getRasterFadeDurationTransition(const optional<std::string>& klass = {}) const;
// Private implementation

View File

@@ -173,71 +173,85 @@ public:
DataDrivenPropertyValue<float> getIconOpacity(const optional<std::string>& klass = {}) const;
void setIconOpacity(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setIconOpacityTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getIconOpacityTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<Color> getDefaultIconColor();
DataDrivenPropertyValue<Color> getIconColor(const optional<std::string>& klass = {}) const;
void setIconColor(DataDrivenPropertyValue<Color>, const optional<std::string>& klass = {});
void setIconColorTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getIconColorTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<Color> getDefaultIconHaloColor();
DataDrivenPropertyValue<Color> getIconHaloColor(const optional<std::string>& klass = {}) const;
void setIconHaloColor(DataDrivenPropertyValue<Color>, const optional<std::string>& klass = {});
void setIconHaloColorTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getIconHaloColorTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<float> getDefaultIconHaloWidth();
DataDrivenPropertyValue<float> getIconHaloWidth(const optional<std::string>& klass = {}) const;
void setIconHaloWidth(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setIconHaloWidthTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getIconHaloWidthTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<float> getDefaultIconHaloBlur();
DataDrivenPropertyValue<float> getIconHaloBlur(const optional<std::string>& klass = {}) const;
void setIconHaloBlur(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setIconHaloBlurTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getIconHaloBlurTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<std::array<float, 2>> getDefaultIconTranslate();
PropertyValue<std::array<float, 2>> getIconTranslate(const optional<std::string>& klass = {}) const;
void setIconTranslate(PropertyValue<std::array<float, 2>>, const optional<std::string>& klass = {});
void setIconTranslateTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getIconTranslateTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<TranslateAnchorType> getDefaultIconTranslateAnchor();
PropertyValue<TranslateAnchorType> getIconTranslateAnchor(const optional<std::string>& klass = {}) const;
void setIconTranslateAnchor(PropertyValue<TranslateAnchorType>, const optional<std::string>& klass = {});
void setIconTranslateAnchorTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getIconTranslateAnchorTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<float> getDefaultTextOpacity();
DataDrivenPropertyValue<float> getTextOpacity(const optional<std::string>& klass = {}) const;
void setTextOpacity(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setTextOpacityTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getTextOpacityTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<Color> getDefaultTextColor();
DataDrivenPropertyValue<Color> getTextColor(const optional<std::string>& klass = {}) const;
void setTextColor(DataDrivenPropertyValue<Color>, const optional<std::string>& klass = {});
void setTextColorTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getTextColorTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<Color> getDefaultTextHaloColor();
DataDrivenPropertyValue<Color> getTextHaloColor(const optional<std::string>& klass = {}) const;
void setTextHaloColor(DataDrivenPropertyValue<Color>, const optional<std::string>& klass = {});
void setTextHaloColorTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getTextHaloColorTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<float> getDefaultTextHaloWidth();
DataDrivenPropertyValue<float> getTextHaloWidth(const optional<std::string>& klass = {}) const;
void setTextHaloWidth(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setTextHaloWidthTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getTextHaloWidthTransition(const optional<std::string>& klass = {}) const;
static DataDrivenPropertyValue<float> getDefaultTextHaloBlur();
DataDrivenPropertyValue<float> getTextHaloBlur(const optional<std::string>& klass = {}) const;
void setTextHaloBlur(DataDrivenPropertyValue<float>, const optional<std::string>& klass = {});
void setTextHaloBlurTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getTextHaloBlurTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<std::array<float, 2>> getDefaultTextTranslate();
PropertyValue<std::array<float, 2>> getTextTranslate(const optional<std::string>& klass = {}) const;
void setTextTranslate(PropertyValue<std::array<float, 2>>, const optional<std::string>& klass = {});
void setTextTranslateTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getTextTranslateTransition(const optional<std::string>& klass = {}) const;
static PropertyValue<TranslateAnchorType> getDefaultTextTranslateAnchor();
PropertyValue<TranslateAnchorType> getTextTranslateAnchor(const optional<std::string>& klass = {}) const;
void setTextTranslateAnchor(PropertyValue<TranslateAnchorType>, const optional<std::string>& klass = {});
void setTextTranslateAnchorTransition(const TransitionOptions&, const optional<std::string>& klass = {});
TransitionOptions getTextTranslateAnchorTransition(const optional<std::string>& klass = {}) const;
// Private implementation

View File

@@ -2,6 +2,83 @@
Mapbox welcomes participation and contributions from everyone. If you'd like to do so please see the [`Contributing Guide`](https://github.com/mapbox/mapbox-gl-native/blob/master/CONTRIBUTING.md) first to get started.
## 5.0.0 - March 17th, 2017
5.0.0 final release contains:
* Support for data-driven styles [#7752](https://github.com/mapbox/mapbox-gl-native/pull/7752)
* Additional APIs to manage runtime styling layers [#8195](https://github.com/mapbox/mapbox-gl-native/pull/8195)
* Allow query all features in sources (`querySourceFeatures`) [#5792](https://github.com/mapbox/mapbox-gl-native/issues/5792)
* Improve accessibility TalkBack support by including content description in views [#8230](https://github.com/mapbox/mapbox-gl-native/pull/8230)
* Consistent double tap zoom acceleration [#7514](https://github.com/mapbox/mapbox-gl-native/issues/7514)
* Allow zooming/scaling to use `AnimationOptions` [#8181](https://github.com/mapbox/mapbox-gl-native/pull/8181)
* Cleanup inconsistencies `float` vs `double` [#4445](https://github.com/mapbox/mapbox-gl-native/issues/4445)
* Add `mapbox_` prefix to attributes [#6482](https://github.com/mapbox/mapbox-gl-native/issues/6482)
* Update LOST to 2.x [#6573](https://github.com/mapbox/mapbox-gl-native/issues/6537)
* MAS submodules (`geojson`, `telemetry`) are now smaller to reduce the overall method count [#7642](https://github.com/mapbox/mapbox-gl-native/pull/7642)
* Telemetry Service is now include automatically via Manifest merge to simplify set up [#8338](https://github.com/mapbox/mapbox-gl-native/pull/8338)
* Support for Android Nougat [#5910](5910-move-listener-logic-for-nougat)
- Move location listening logic to `onStart`/`onStop` activity lifecylce methods
* Removal of `accessToken` on `MapView` and `MapboxMap` [#5621](https://github.com/mapbox/mapbox-gl-native/issues/5621)
* Introduction of new make targets [#5940](https://github.com/mapbox/mapbox-gl-native/issues/5940)
- Targets for testing, running and using external tools directly from the command line
* Cleanup Gradle files [#6009](https://github.com/mapbox/mapbox-gl-native/issues/6009)
- Introducing single purpose `.gradle` files
* Checkstyle integration [#7442](https://github.com/mapbox/mapbox-gl-native/pull/7442)
* Transform refactor [#6532](https://github.com/mapbox/mapbox-gl-native/issues/6532)
- All camera related code is moved to a dedicated transform class cfr. core architecture
* Encapsulate gestures [#6557](https://github.com/mapbox/mapbox-gl-native/issues/6557)
- All gesture event code is encapsulated in `MapGestureDetector`
- All key event code is encapsulated in `MapKeyListener`
* Transparent background for `MyLocationView` [#7116](https://github.com/mapbox/mapbox-gl-native/issues/7116)
* Correctly scale accuracy circle for `MyLocationView` [#8255](https://github.com/mapbox/mapbox-gl-native/pull/8255)
* Update documentation on generate sanity tests [#7147](https://github.com/mapbox/mapbox-gl-native/issues/7147)
* Update documentation on style templates [#7157](https://github.com/mapbox/mapbox-gl-native/issues/7157)
* Fix `NullPointerException` during save instance state [#7157](https://github.com/mapbox/mapbox-gl-native/issues/7157)
* Move management style to core [#7275](https://github.com/mapbox/mapbox-gl-native/issues/7275)
* Fix `OnCameraChange` not called for the final position of animation bug [#7350](https://github.com/mapbox/mapbox-gl-native/issues/7350)
* `MapboxAccountManager` refactor [#6534](https://github.com/mapbox/mapbox-gl-native/issues/6534)
- Consolidating the location where tokens are set
- Rename to reflect the increased responsibilities introduced in prior releases
* AnnotationManager refactor [#6067](https://github.com/mapbox/mapbox-gl-native/issues/6067)
- Extracting all business logic related to annotations into a separate class cfr. to core and the iOS codebase
* Gesture handling improvements:
- Fix missing call to `onFling` when while pinch zooming [#7666](https://github.com/mapbox/mapbox-gl-native/issues/7666)
- Round tap-zoom gestures to nearest integer [#8027](https://github.com/mapbox/mapbox-gl-native/pull/8027)
* Support for style-wide transition animation duration and delay [#6779](https://github.com/mapbox/mapbox-gl-native/issues/6779)
* Allow callback parameter for style setting [#8262](https://github.com/mapbox/mapbox-gl-native/issues/8262)
* Support for all animated camera changes to configure dismissing tracking modes [#7854](https://github.com/mapbox/mapbox-gl-native/issues/7854)
* Avoid disabling location tracking on all gestures [#7878](https://github.com/mapbox/mapbox-gl-native/issues/7878)
* `LatLng` objects produced by the SDK are wrapped by default [#4522](https://github.com/mapbox/mapbox-gl-native/issues/4522)
* Proguard update for new SDK packages [#8437](https://github.com/mapbox/mapbox-gl-native/pull/8437)
* Javadoc cleanup [#8438](https://github.com/mapbox/mapbox-gl-native/pull/8438)
* MarkerViewClickListener and MapClickListener called simultaneously [#8447](https://github.com/mapbox/mapbox-gl-native/pull/8447)
* Fix LOST v2.0.0 integration [#8445](https://github.com/mapbox/mapbox-gl-native/pull/8445)
* Crash with OnMapChangeListener [#8380](https://github.com/mapbox/mapbox-gl-native/pull/8380)
* Feature query crash [#8374](https://github.com/mapbox/mapbox-gl-native/pull/8374)
* flyTo fix [#8302](https://github.com/mapbox/mapbox-gl-native/pull/8302)
* Don't dispatch MarkerView motion event up to MapView [#8447](https://github.com/mapbox/mapbox-gl-native/pull/8447)
## 5.0.0-beta.3 - March 10th, 2017
5.0.0-beta.3 focuses on addressing stability issues and bug fixes. It also includes:
* Allow query all features in sources (`querySourceFeatures`) [#5792](https://github.com/mapbox/mapbox-gl-native/issues/5792)
* Improve accessibility TalkBack support by including content description in views [#8230](https://github.com/mapbox/mapbox-gl-native/pull/8230)
* Allow zooming/scaling to use `AnimationOptions` [#8181](https://github.com/mapbox/mapbox-gl-native/pull/8181)
* Telemetry Service is now include automatically via Manifest merge to simplify set up [#8338](https://github.com/mapbox/mapbox-gl-native/pull/8338)
* Correctly scale accuracy circle for `MyLocationView` [#8255](https://github.com/mapbox/mapbox-gl-native/pull/8255)
* Round tap-zoom gestures to nearest integer [#8027](https://github.com/mapbox/mapbox-gl-native/pull/8027)
* Allow callback parameter for style setting [#8262](https://github.com/mapbox/mapbox-gl-native/issues/8262)
* Avoid disabling location tracking on all gestures [#7878](https://github.com/mapbox/mapbox-gl-native/issues/7878)
## 5.0.0-beta.2 - March 1st, 2017
5.0.0-beta.2 focuses on addressing stability issues and bug fixes. It also includes:
* Data-driven styling for `{text,icon}-{color,opacity,halo-color,halo-blur,halo-width}` [#7939](https://github.com/mapbox/mapbox-gl-native/pull/7939)
* Additional APIs to manage runtime styling layers [#8195](https://github.com/mapbox/mapbox-gl-native/pull/8195)
## 5.0.0-beta.1 - February 14th, 2017
* Support for data-driven styles [#7752](https://github.com/mapbox/mapbox-gl-native/pull/7752)

View File

@@ -27,6 +27,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
buildConfigField "String", "GIT_REVISION_SHORT", String.format("\"%s\"", getGitRevision())
buildConfigField "String", "MAPBOX_VERSION_STRING", String.format("\"Mapbox/%s\"", project.VERSION_NAME)
buildConfigField "String", "MAPBOX_EVENTS_USER_AGENT", String.format("\"MapboxEventsAndroid/%s\"", project.VERSION_NAME)
}
defaultPublishConfig project.hasProperty("mapbox.buildtype") ? project.getProperty("mapbox.buildtype") : "debug"

View File

@@ -1,5 +1,5 @@
GROUP=com.mapbox.mapboxsdk
VERSION_NAME=5.0.0-SNAPSHOT
VERSION_NAME=5.1.0-SNAPSHOT
POM_DESCRIPTION=Mapbox GL Android SDK
POM_URL=https://github.com/mapbox/mapbox-gl-native

View File

@@ -17,10 +17,10 @@
# Package camera
-keep class com.mapbox.mapboxsdk.camera.** { *; }
# Package: geometry
# Package geometry
-keep class com.mapbox.mapboxsdk.geometry.** { *; }
# Package: http
# Package http
-keep class com.mapbox.mapboxsdk.http.** { *; }
# Package maps
@@ -32,9 +32,13 @@
# Package offline
-keep class com.mapbox.mapboxsdk.offline.** { *; }
# Package storage
-keep class com.mapbox.mapboxsdk.storage.** { *; }
# Package style
-keep class com.mapbox.mapboxsdk.style.layers.** { *; }
-keep class com.mapbox.mapboxsdk.style.sources.** { *; }
-keep class com.mapbox.mapboxsdk.style.functions.** { *; }
# Package telemetry
-keep class com.mapbox.mapboxsdk.telemetry.** { *; }

View File

@@ -8,4 +8,9 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<application>
<!-- Include the telemetry service to simplify set up (https://www.mapbox.com/telemetry) -->
<service android:name="com.mapbox.services.android.telemetry.service.TelemetryService"/>
</application>
</manifest>

View File

@@ -37,7 +37,8 @@ public final class Mapbox {
INSTANCE = new Mapbox(appContext, accessToken);
LocationEngine locationEngine = new LocationSource(appContext);
locationEngine.setPriority(LocationEnginePriority.NO_POWER);
MapboxTelemetry.getInstance().initialize(appContext, accessToken, locationEngine);
MapboxTelemetry.getInstance().initialize(
appContext, accessToken, BuildConfig.MAPBOX_EVENTS_USER_AGENT, locationEngine);
ConnectivityReceiver.instance(appContext);
}
return INSTANCE;
@@ -106,4 +107,4 @@ public final class Mapbox {
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
return (activeNetwork != null && activeNetwork.isConnected());
}
}
}

View File

@@ -6,10 +6,12 @@ import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
/**
* Annotation is an overlay on top of a {@link MapView},
* from which {@link Polygon}, {@link Polyline} and {@link Marker} are derived.
* Annotation is an overlay on top of a Map.
* <p>
* it manages attachment to a map and identification, but does not require
* Known subclasses are {@link Polygon}, {@link Polyline} and {@link Marker}.
* </p>
* <p>
* This class manages attachment to a map and identification, but does not require
* content to be placed at a geographical point.
* </p>
*/
@@ -96,6 +98,12 @@ public abstract class Annotation implements Comparable<Annotation> {
return mapView;
}
/**
* Compares this Annotation object with another Annotation.
*
* @param annotation Another Annotation to compare with this object.
* @return returns 0 if id's match, 1 if id is lower, -1 if id is higher of another Annotation
*/
@Override
public int compareTo(@NonNull Annotation annotation) {
if (id < annotation.getId()) {
@@ -107,12 +115,10 @@ public abstract class Annotation implements Comparable<Annotation> {
}
/**
* Compares this {@link PolylineOptions} object with another {@link PolylineOptions} and
* determines if their color, alpha, width, and vertices match.
* Checks if this Annotation object is equal to another Annotation.
*
* @param object Another {@link PolylineOptions} to compare with this object.
* @return True if color, alpha, width, and vertices match this {@link PolylineOptions} object.
* Else, false.
* @param object Another Annotation to check equality with this object.
* @return returns true both id's match else returns false.
*/
@Override
public boolean equals(Object object) {

View File

@@ -8,12 +8,12 @@ import java.util.List;
/**
* Multipoint is an abstract annotation for combining geographical locations.
*/
public abstract class MultiPoint extends Annotation {
public abstract class BasePointCollection extends Annotation {
private List<LatLng> points;
private float alpha = 1.0f;
protected MultiPoint() {
protected BasePointCollection() {
super();
points = new ArrayList<>();
}
@@ -58,7 +58,7 @@ public abstract class MultiPoint extends Annotation {
}
/**
* Set this {@link MultiPoint}s alpha.
* Set this {@link BasePointCollection}s alpha.
*
* @param alpha float value between 0 and 1.
*/

View File

@@ -14,7 +14,7 @@ import com.mapbox.mapboxsdk.R;
/**
* Bubble View for Android with custom stroke width and color, arrow size, position and direction.
*/
class BubbleLayout extends LinearLayout {
public class BubbleLayout extends LinearLayout {
public static final float DEFAULT_STROKE_WIDTH = -1;
private ArrowDirection arrowDirection;

View File

@@ -0,0 +1,34 @@
package com.mapbox.mapboxsdk.annotations;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.ViewGroup;
import android.widget.FrameLayout;
/**
* ViewGroup that dispatches TouchEvents to the parent ViewGroup.
* <p>
* This allows to dispatch touch events that occur on MarkerView to MapView.
* https://github.com/mapbox/mapbox-gl-native/issues/5388
* </p>
*/
public class MarkerViewContainer extends FrameLayout {
public MarkerViewContainer(Context context, AttributeSet attrs) {
super(context, attrs);
setTag(false);
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
super.dispatchTouchEvent(ev);
boolean actionUp = (boolean) getTag();
if (!actionUp) {
((ViewGroup) getParent()).onTouchEvent(ev);
} else {
setTag(false);
}
return true;
}
}

View File

@@ -8,6 +8,7 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.util.LongSparseArray;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
@@ -503,6 +504,26 @@ public class MarkerViewManager implements MapView.OnMapChangedListener {
}
}
adaptedView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_UP) {
boolean clickHandled = false;
if (onMarkerViewClickListener != null) {
clickHandled = onMarkerViewClickListener.onMarkerClick(marker, v, adapter);
markerViewContainer.setTag(true);
}
if (!clickHandled) {
ensureInfoWindowOffset(marker);
select(marker, v, adapter);
}
}
return true;
}
});
marker.setMapboxMap(mapboxMap);
markerViewMap.put(marker, adaptedView);
if (convertView == null) {
@@ -530,34 +551,6 @@ public class MarkerViewManager implements MapView.OnMapChangedListener {
updateMarkerViewsPosition();
}
/**
* When the provided {@link MarkerView} is clicked on by a user, we check if a custom click
* event has been created and if not, display a {@link InfoWindow}.
*
* @param markerView that the click event occurred.
*/
public boolean onClickMarkerView(MarkerView markerView) {
boolean clickHandled = false;
MapboxMap.MarkerViewAdapter adapter = getViewAdapter(markerView);
View view = getView(markerView);
if (adapter == null || view == null) {
// not a valid state
return true;
}
if (onMarkerViewClickListener != null) {
clickHandled = onMarkerViewClickListener.onMarkerClick(markerView, view, adapter);
}
if (!clickHandled) {
ensureInfoWindowOffset(markerView);
select(markerView, view, adapter);
}
return clickHandled;
}
/**
* Handles the {@link MarkerView}'s info window offset.
*

View File

@@ -7,7 +7,7 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
/**
* Polygon is a geometry annotation that's a closed loop of coordinates.
*/
public final class Polygon extends MultiPoint {
public final class Polygon extends BasePointCollection {
private int fillColor = Color.BLACK; // default fillColor is black
private int strokeColor = Color.BLACK; // default strokeColor is black

View File

@@ -7,7 +7,7 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
/**
* Polyline is a geometry feature with an unclosed list of coordinates drawn as a line
*/
public final class Polyline extends MultiPoint {
public final class Polyline extends BasePointCollection {
private int color = Color.BLACK; // default color is black
private float width = 10; // As specified by Google API Docs (in pixels)

View File

@@ -1,22 +1,11 @@
package com.mapbox.mapboxsdk.exceptions;
/**
* Thrown on conversion errors
* A ConversionException is thrown when a conversion failed to execute.
*/
public class ConversionException extends RuntimeException {
public ConversionException() {
}
public ConversionException(String detailMessage) {
super(detailMessage);
}
public ConversionException(String detailMessage, Throwable throwable) {
super(detailMessage, throwable);
}
public ConversionException(Throwable throwable) {
super(throwable);
}
}

View File

@@ -1,5 +1,8 @@
package com.mapbox.mapboxsdk.exceptions;
/**
* A InvalidMarkerPositionException is thrown when a Marker object is created with an invalid LatLng position.
*/
public class InvalidMarkerPositionException extends RuntimeException {
public InvalidMarkerPositionException() {

View File

@@ -183,7 +183,7 @@ class HTTPRequest implements Callback {
return USER_AGENT_STRING = Util.toHumanReadableAscii(
String.format("%s %s (%s) Android/%s (%s)",
getApplicationIdentifier(),
com.mapbox.services.android.telemetry.BuildConfig.MAPBOX_VERSION_STRING,
BuildConfig.MAPBOX_VERSION_STRING,
BuildConfig.GIT_REVISION_SHORT,
Build.VERSION.SDK_INT,
Build.CPU_ABI)

View File

@@ -102,6 +102,7 @@ public class LocationSource extends LocationEngine implements
public void requestLocationUpdates() {
// Common params
LocationRequest request = LocationRequest.create()
.setInterval(1000)
.setFastestInterval(1000)
.setSmallestDisplacement(3.0f);

View File

@@ -10,6 +10,7 @@ import com.mapbox.mapboxsdk.annotations.Annotation;
import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions;
import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions;
import com.mapbox.mapboxsdk.annotations.Icon;
import com.mapbox.mapboxsdk.annotations.IconFactory;
import com.mapbox.mapboxsdk.annotations.Marker;
import com.mapbox.mapboxsdk.annotations.MarkerView;
import com.mapbox.mapboxsdk.annotations.MarkerViewManager;
@@ -256,7 +257,11 @@ class AnnotationManager {
private MarkerView prepareViewMarker(BaseMarkerViewOptions markerViewOptions) {
MarkerView marker = markerViewOptions.getMarker();
iconManager.loadIconForMarkerView(marker);
Icon icon = markerViewOptions.getIcon();
if (icon == null) {
icon = IconFactory.getInstance(mapView.getContext()).defaultMarkerView();
}
marker.setIcon(icon);
return marker;
}
@@ -660,24 +665,16 @@ class AnnotationManager {
if (annotation.getId() == newSelectedMarkerId) {
Marker marker = (Marker) annotation;
if (marker instanceof MarkerView) {
handledDefaultClick = markerViewManager.onClickMarkerView((MarkerView) marker);
} else {
if (!(marker instanceof MarkerView)) {
if (onMarkerClickListener != null) {
// end developer has provided a custom click listener
handledDefaultClick = onMarkerClickListener.onMarkerClick(marker);
}
}
if (annotation instanceof MarkerView) {
markerViewManager.onClickMarkerView((MarkerView) annotation);
} else {
if (!handledDefaultClick) {
// only select marker if user didn't handle the click event themselves
selectMarker(marker);
}
}
return true;
}
}

View File

@@ -71,27 +71,6 @@ class IconManager {
return icon;
}
Icon loadIconForMarkerView(MarkerView marker) {
Icon icon = marker.getIcon();
int iconSize = icons.size() + 1;
if (icon == null) {
icon = IconFactory.getInstance(nativeMapView.getContext()).defaultMarkerView();
marker.setIcon(icon);
}
Bitmap bitmap = icon.getBitmap();
averageIconHeight = averageIconHeight + (bitmap.getHeight() - averageIconHeight) / iconSize;
averageIconWidth = averageIconWidth + (bitmap.getWidth() - averageIconWidth) / iconSize;
if (!icons.contains(icon)) {
icons.add(icon);
} else {
Icon oldIcon = icons.get(icons.indexOf(icon));
if (!oldIcon.getBitmap().sameAs(icon.getBitmap())) {
throw new IconBitmapChangedException();
}
}
return icon;
}
int getTopOffsetPixelsForIcon(Icon icon) {
return (int) (nativeMapView.getTopOffsetPixelsForAnnotationSymbol(icon.getId()) * nativeMapView.getPixelRatio());
}

View File

@@ -4,13 +4,13 @@ import android.content.Context;
import android.graphics.PointF;
import android.location.Location;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.view.GestureDetectorCompat;
import android.support.v4.view.ScaleGestureDetectorCompat;
import android.view.InputDevice;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.ViewConfiguration;
import android.widget.ZoomButtonsController;
import com.almeros.android.multitouch.gesturedetectors.RotateGestureDetector;
import com.almeros.android.multitouch.gesturedetectors.ShoveGestureDetector;
@@ -92,6 +92,20 @@ final class MapGestureDetector {
this.focalPoint = focalPoint;
}
/**
* Get the current active gesture focal point.
* <p>
* This could be either the user provided focal point in {@link UiSettings#setFocalPoint(PointF)} or the focal point
* defined as a result of {@link TrackingSettings#setMyLocationEnabled(boolean)}.
* </p>
*
* @return the current active gesture focal point.
*/
@Nullable
PointF getFocalPoint() {
return focalPoint;
}
/**
* Given coordinates from a gesture, use the current projection to translate it into
* a Location object.
@@ -159,10 +173,10 @@ final class MapGestureDetector {
if (twoTap && isTap && !inProgress) {
if (focalPoint != null) {
transform.zoom(false, focalPoint.x, focalPoint.y);
transform.zoom(false, focalPoint);
} else {
PointF focalPoint = TwoFingerGestureDetector.determineFocalPoint(event);
transform.zoom(false, focalPoint.x, focalPoint.y);
transform.zoom(false, focalPoint);
}
twoTap = false;
return true;
@@ -262,10 +276,10 @@ final class MapGestureDetector {
// Single finger double tap
if (focalPoint != null) {
// User provided focal point
transform.zoom(true, focalPoint.x, focalPoint.y);
transform.zoom(true, focalPoint);
} else {
// Zoom in on gesture
transform.zoom(true, e.getX(), e.getY());
transform.zoom(true, new PointF(e.getX(), e.getY()));
}
break;
}
@@ -636,34 +650,6 @@ final class MapGestureDetector {
}
}
// This class handles input events from the zoom control buttons
// Zoom controls allow single touch only devices to zoom in and out
private static class OnZoomListener implements ZoomButtonsController.OnZoomListener {
private UiSettings uiSettings;
private Transform transform;
OnZoomListener(UiSettings uiSettings, Transform transform) {
this.uiSettings = uiSettings;
this.transform = transform;
}
// Not used
@Override
public void onVisibilityChanged(boolean visible) {
// Ignore
}
// Called when user pushes a zoom button
@Override
public void onZoom(boolean zoomIn) {
if (!uiSettings.isZoomGesturesEnabled()) {
return;
}
transform.zoom(zoomIn);
}
}
void setOnMapClickListener(MapboxMap.OnMapClickListener onMapClickListener) {
this.onMapClickListener = onMapClickListener;
}

View File

@@ -1,5 +1,6 @@
package com.mapbox.mapboxsdk.maps;
import android.graphics.PointF;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.view.KeyEvent;
@@ -125,7 +126,8 @@ final class MapKeyListener {
}
// Zoom out
transform.zoom(false, uiSettings.getWidth() / 2, uiSettings.getHeight() / 2);
PointF focalPoint = new PointF(uiSettings.getWidth() / 2, uiSettings.getHeight() / 2);
transform.zoom(false, focalPoint);
return true;
default:
@@ -160,7 +162,8 @@ final class MapKeyListener {
}
// Zoom in
transform.zoom(true, uiSettings.getWidth() / 2, uiSettings.getHeight() / 2);
PointF focalPoint = new PointF(uiSettings.getWidth() / 2, uiSettings.getHeight() / 2);
transform.zoom(true, focalPoint);
return true;
}
@@ -214,7 +217,8 @@ final class MapKeyListener {
// Only handle if we have not already long pressed
if (currentTrackballLongPressTimeOut != null) {
// Zoom in
transform.zoom(true, uiSettings.getWidth() / 2, uiSettings.getHeight() / 2);
PointF focalPoint = new PointF(uiSettings.getWidth() / 2, uiSettings.getHeight() / 2);
transform.zoom(true, focalPoint);
}
return true;
@@ -255,7 +259,8 @@ final class MapKeyListener {
// Check if the trackball is still pressed
if (!cancelled) {
// Zoom out
transform.zoom(false, uiSettings.getWidth() / 2, uiSettings.getHeight() / 2);
PointF pointF = new PointF(uiSettings.getWidth() / 2, uiSettings.getHeight() / 2);
transform.zoom(false, pointF);
// Ensure the up action is not run
currentTrackballLongPressTimeOut = null;

View File

@@ -31,6 +31,7 @@ import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ZoomButtonsController;
import com.mapbox.mapboxsdk.Mapbox;
import com.mapbox.mapboxsdk.R;
@@ -147,7 +148,9 @@ public class MapView extends FrameLayout {
// user input
mapGestureDetector = new MapGestureDetector(context, transform, proj, uiSettings, trackingSettings, annotations);
mapKeyListener = new MapKeyListener(transform, trackingSettings, uiSettings);
mapZoomButtonController = new MapZoomButtonController(this, uiSettings, transform);
MapZoomControllerListener zoomListener = new MapZoomControllerListener(mapGestureDetector, uiSettings, transform);
mapZoomButtonController = new MapZoomButtonController(this, uiSettings, zoomListener);
// inject widgets with MapboxMap
compassView.setMapboxMap(mapboxMap);
@@ -508,7 +511,7 @@ public class MapView extends FrameLayout {
if (destroyed) {
return;
}
mapboxMap.onUpdate();
mapboxMap.onUpdateRegionChange();
}
}
@@ -521,13 +524,15 @@ public class MapView extends FrameLayout {
@CallSuper
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
mapZoomButtonController.setVisible(false);
if (mapZoomButtonController != null) {
mapZoomButtonController.setVisible(false);
}
}
// Called when view is hidden and shown
@Override
protected void onVisibilityChanged(@NonNull View changedView, int visibility) {
if (isInEditMode()) {
if (isInEditMode() || mapZoomButtonController == null) {
return;
}
mapZoomButtonController.setVisible(visibility == View.VISIBLE);
@@ -801,7 +806,7 @@ public class MapView extends FrameLayout {
public static final int DID_FINISH_RENDERING_FRAME = 9;
/**
* This event is triggered when the map finished rendeirng the frame fully.
* This event is triggered when the map finished rendering the frame fully.
* <p>
* Register to {@link MapChange} events with {@link MapView#addOnMapChangedListener(OnMapChangedListener)}.
* </p>
@@ -937,12 +942,59 @@ public class MapView extends FrameLayout {
}
}
private class MapZoomControllerListener implements ZoomButtonsController.OnZoomListener {
private final MapGestureDetector mapGestureDetector;
private final UiSettings uiSettings;
private final Transform transform;
MapZoomControllerListener(MapGestureDetector detector, UiSettings uiSettings, Transform transform) {
this.mapGestureDetector = detector;
this.uiSettings = uiSettings;
this.transform = transform;
}
// Not used
@Override
public void onVisibilityChanged(boolean visible) {
// Ignore
}
// Called when user pushes a zoom button on the ZoomButtonController
@Override
public void onZoom(boolean zoomIn) {
if (uiSettings.isZoomGesturesEnabled()) {
onZoom(zoomIn, mapGestureDetector.getFocalPoint());
}
}
private void onZoom(boolean zoomIn, @Nullable PointF focalPoint) {
if (focalPoint != null) {
transform.zoom(zoomIn, focalPoint);
} else {
PointF centerPoint = new PointF(getMeasuredWidth() / 2, getMeasuredHeight() / 2);
transform.zoom(zoomIn, centerPoint);
}
}
}
private class CameraZoomInvalidator implements TrackingSettings.CameraZoomInvalidator {
@Override
public void zoomTo(double zoomLevel) {
double currentZoomLevel = mapboxMap.getCameraPosition().zoom;
Transform transform = mapboxMap.getTransform();
double currentZoomLevel = transform.getCameraPosition().zoom;
if (currentZoomLevel < zoomLevel) {
mapboxMap.getTransform().setZoom(zoomLevel);
setZoom(zoomLevel, mapGestureDetector.getFocalPoint(), transform);
}
}
private void setZoom(double zoomLevel, @Nullable PointF focalPoint, @NonNull Transform transform) {
if (focalPoint != null) {
transform.setZoom(zoomLevel, focalPoint);
} else {
PointF centerPoint = new PointF(getMeasuredWidth() / 2, getMeasuredHeight() / 2);
transform.setZoom(zoomLevel, centerPoint);
}
}
}
@@ -969,8 +1021,10 @@ public class MapView extends FrameLayout {
mapboxMap.onPostMapReady();
}
});
} else if (change == DID_FINISH_RENDERING_FRAME || change == DID_FINISH_RENDERING_FRAME_FULLY_RENDERED) {
mapboxMap.onUpdateFullyRendered();
} else if (change == REGION_IS_CHANGING || change == REGION_DID_CHANGE || change == DID_FINISH_LOADING_MAP) {
mapboxMap.onUpdate();
mapboxMap.onUpdateRegionChange();
}
}

View File

@@ -16,11 +16,11 @@ final class MapZoomButtonController extends ZoomButtonsController {
private UiSettings uiSettings;
MapZoomButtonController(@NonNull View ownerView, @NonNull UiSettings uiSettings, @NonNull Transform transform) {
MapZoomButtonController(@NonNull View ownerView, @NonNull UiSettings uiSettings, @NonNull OnZoomListener listener) {
super(ownerView);
this.uiSettings = uiSettings;
setZoomSpeed(MapboxConstants.ANIMATION_DURATION);
setOnZoomListener(new OnZoomListener(uiSettings, transform));
setOnZoomListener(listener);
}
@Override
@@ -29,31 +29,4 @@ final class MapZoomButtonController extends ZoomButtonsController {
super.setVisible(visible);
}
}
// Zoom controls allow single touch only devices to zoom in and out
private static class OnZoomListener implements ZoomButtonsController.OnZoomListener {
private final UiSettings uiSettings;
private final Transform transform;
OnZoomListener(UiSettings uiSettings, Transform transform) {
this.uiSettings = uiSettings;
this.transform = transform;
}
// Not used
@Override
public void onVisibilityChanged(boolean visible) {
// Ignore
}
// Called when user pushes a zoom button
@Override
public void onZoom(boolean zoomIn) {
if (!uiSettings.isZoomGesturesEnabled()) {
return;
}
transform.zoom(zoomIn);
}
}
}

View File

@@ -96,6 +96,9 @@ public final class MapboxMap {
setStyleUrl(options);
}
/**
* Called when the hosting Activity/Fragment onStart() method is called.
*/
void onStart() {
nativeMapView.update();
trackingSettings.onStart();
@@ -105,10 +108,18 @@ public final class MapboxMap {
}
}
/**
* Called when the hosting Activity/Fragment onStop() method is called.
*/
void onStop() {
trackingSettings.onStop();
}
/**
* Called when the hosting Activity/Fragment is going to be destroyed and map state needs to be saved.
*
* @param outState the bundle to save the state to.
*/
void onSaveInstanceState(Bundle outState) {
outState.putParcelable(MapboxConstants.STATE_CAMERA_POSITION, transform.getCameraPosition());
outState.putBoolean(MapboxConstants.STATE_DEBUG_ACTIVE, nativeMapView.getDebug());
@@ -117,6 +128,11 @@ public final class MapboxMap {
uiSettings.onSaveInstanceState(outState);
}
/**
* Called when the hosting Activity/Fragment is recreated and map state needs to be restored.
*
* @param savedInstanceState the bundle containing the saved state
*/
void onRestoreInstanceState(Bundle savedInstanceState) {
final CameraPosition cameraPosition = savedInstanceState.getParcelable(MapboxConstants.STATE_CAMERA_POSITION);
if (cameraPosition != null) {
@@ -153,16 +169,23 @@ public final class MapboxMap {
}
/**
* Called when the user
* Called when the region is changing or has changed.
*/
void onUpdate() {
CameraPosition cameraPosition = transform.invalidateCameraPosition();
uiSettings.update(cameraPosition);
// FIXME introduce update method with camera position
void onUpdateRegionChange() {
trackingSettings.update();
annotationManager.update();
}
/**
* Called when the map frame is fully rendered.
*/
void onUpdateFullyRendered() {
CameraPosition cameraPosition = transform.invalidateCameraPosition();
if (cameraPosition != null) {
uiSettings.update(cameraPosition);
}
}
// Style
/**
@@ -815,10 +838,20 @@ public final class MapboxMap {
transform.setBearing(bearing, focalX, focalY, duration);
}
/**
* Returns the measured height of the Map.
*
* @return the height of the map
*/
public float getHeight() {
return nativeMapView.getHeight();
}
/**
* Returns the measured width of the Map.
*
* @return the width of the map
*/
public float getWidth() {
return nativeMapView.getWidth();
}
@@ -881,35 +914,80 @@ public final class MapboxMap {
/**
* <p>
* Loads a new map style from the specified URL.
* Loads a new map style asynchronous from the specified URL.
* </p>
* {@code url} can take the following forms:
* <ul>
* <li>{@code Style.*}: load one of the bundled styles in {@link Style}.</li>
* <li>{@code mapbox://styles/<user>/<style>}:
* retrieves the style from a <a href="https://www.mapbox.com/account/">Mapbox account.</a>
* loads the style from a <a href="https://www.mapbox.com/account/">Mapbox account.</a>
* {@code user} is your username. {@code style} is the ID of your custom
* style created in <a href="https://www.mapbox.com/studio">Mapbox Studio</a>.</li>
* <li>{@code http://...} or {@code https://...}:
* retrieves the style over the Internet from any web server.</li>
* loads the style over the Internet from any web server.</li>
* <li>{@code asset://...}:
* reads the style from the APK {@code assets/} directory.
* loads the style from the APK {@code assets/} directory.
* This is used to load a style bundled with your app.</li>
* <li>{@code null}: loads the default {@link Style#MAPBOX_STREETS} style.</li>
* </ul>
* <p>
* This method is asynchronous and will return immediately before the style finishes loading.
* If you wish to wait for the map to finish loading listen for the {@link MapView#DID_FINISH_LOADING_MAP} event.
* This method is asynchronous and will return before the style finishes loading.
* If you wish to wait for the map to finish loading, listen for the {@link MapView#DID_FINISH_LOADING_MAP} event
* or use the {@link #setStyleUrl(String, OnStyleLoadedListener)} method instead.
* </p>
* If the style fails to load or an invalid style URL is set, the map view will become blank.
* An error message will be logged in the Android logcat and {@link MapView#DID_FAIL_LOADING_MAP} event will be
* sent.
* emitted.
*
* @param url The URL of the map style
* @see Style
*/
@UiThread
public void setStyleUrl(@NonNull String url) {
setStyleUrl(url, null);
}
/**
* <p>
* Loads a new map style asynchronous from the specified URL.
* </p>
* {@code url} can take the following forms:
* <ul>
* <li>{@code Style.*}: load one of the bundled styles in {@link Style}.</li>
* <li>{@code mapbox://styles/<user>/<style>}:
* loads the style from a <a href="https://www.mapbox.com/account/">Mapbox account.</a>
* {@code user} is your username. {@code style} is the ID of your custom
* style created in <a href="https://www.mapbox.com/studio">Mapbox Studio</a>.</li>
* <li>{@code http://...} or {@code https://...}:
* loads the style over the Internet from any web server.</li>
* <li>{@code asset://...}:
* loads the style from the APK {@code assets/} directory.
* This is used to load a style bundled with your app.</li>
* <li>{@code null}: loads the default {@link Style#MAPBOX_STREETS} style.</li>
* </ul>
* <p>
* If the style fails to load or an invalid style URL is set, the map view will become blank.
* An error message will be logged in the Android logcat and {@link MapView#DID_FAIL_LOADING_MAP} event will be
* emitted.
* <p>
*
* @param url The URL of the map style
* @param callback The callback that is invoked when the style has loaded.
* @see Style
*/
@UiThread
public void setStyleUrl(@NonNull final String url, @Nullable final OnStyleLoadedListener callback) {
if (callback != null) {
nativeMapView.addOnMapChangedListener(new MapView.OnMapChangedListener() {
@Override
public void onMapChanged(@MapView.MapChange int change) {
if (change == MapView.DID_FINISH_LOADING_STYLE) {
callback.onStyleLoaded(url);
nativeMapView.removeOnMapChangedListener(this);
}
}
});
}
nativeMapView.setStyleUrl(url);
}
@@ -918,8 +996,9 @@ public final class MapboxMap {
* Loads a new map style from the specified bundled style.
* </p>
* <p>
* This method is asynchronous and will return immediately before the style finishes loading.
* If you wish to wait for the map to finish loading listen for the {@link MapView#DID_FINISH_LOADING_MAP} event.
* This method is asynchronous and will return before the style finishes loading.
* If you wish to wait for the map to finish loading, listen for the {@link MapView#DID_FINISH_LOADING_MAP} event
* or use the {@link #setStyle(String, OnStyleLoadedListener)} method instead.
* </p>
* If the style fails to load or an invalid style URL is set, the map view will become blank.
* An error message will be logged in the Android logcat and {@link MapView#DID_FAIL_LOADING_MAP} event will be
@@ -927,13 +1006,28 @@ public final class MapboxMap {
*
* @param style The bundled style. Accepts one of the values from {@link Style}.
* @see Style
* @deprecated use {@link #setStyleUrl(String)} instead with versioned url methods from {@link Style}
*/
@UiThread
public void setStyle(@Style.StyleUrl String style) {
setStyleUrl(style);
}
/**
* <p>
* Loads a new map style from the specified bundled style.
* </p>
* If the style fails to load or an invalid style URL is set, the map view will become blank.
* An error message will be logged in the Android logcat and {@link MapView#DID_FAIL_LOADING_MAP} event will be
* sent.
*
* @param style The bundled style. Accepts one of the values from {@link Style}.
* @see Style
*/
@UiThread
public void setStyle(@Style.StyleUrl String style, @Nullable OnStyleLoadedListener callback) {
setStyleUrl(style, callback);
}
/**
* Loads a new map style from MapboxMapOptions if available.
*
@@ -942,20 +1036,17 @@ public final class MapboxMap {
private void setStyleUrl(@NonNull MapboxMapOptions options) {
String style = options.getStyle();
if (!TextUtils.isEmpty(style)) {
setStyleUrl(style);
setStyleUrl(style, null);
}
}
/**
* <p>
* Returns the map style currently displayed in the map view.
* </p>
* If the default style is currently displayed, a URL will be returned instead of null.
*
* @return The URL of the map style.
* @return The URL of the map style
*/
@UiThread
@NonNull
@Nullable
public String getStyleUrl() {
return nativeMapView.getStyleUrl();
}
@@ -971,8 +1062,8 @@ public final class MapboxMap {
* The marker's icon is rendered on the map at the location {@code Marker.position}.
* If {@code Marker.title} is defined, the map shows an info box with the marker's title and snippet.
*
* @param markerOptions A marker options object that defines how to render the marker.
* @return The {@code Marker} that was added to the map.
* @param markerOptions A marker options object that defines how to render the marker
* @return The {@code Marker} that was added to the map
*/
@UiThread
@NonNull
@@ -987,8 +1078,8 @@ public final class MapboxMap {
* The marker's icon is rendered on the map at the location {@code Marker.position}.
* If {@code Marker.title} is defined, the map shows an info box with the marker's title and snippet.
*
* @param markerOptions A marker options object that defines how to render the marker.
* @return The {@code Marker} that was added to the map.
* @param markerOptions A marker options object that defines how to render the marker
* @return The {@code Marker} that was added to the map
*/
@UiThread
@NonNull
@@ -1003,8 +1094,8 @@ public final class MapboxMap {
* The marker's icon is rendered on the map at the location {@code Marker.position}.
* If {@code Marker.title} is defined, the map shows an info box with the marker's title and snippet.
*
* @param markerOptions A marker options object that defines how to render the marker.
* @return The {@code Marker} that was added to the map.
* @param markerOptions A marker options object that defines how to render the marker
* @return The {@code Marker} that was added to the map
*/
@UiThread
@NonNull
@@ -1012,7 +1103,6 @@ public final class MapboxMap {
return annotationManager.addMarker(markerOptions, this, null);
}
/**
* <p>
* Adds a marker to this map.
@@ -1020,9 +1110,9 @@ public final class MapboxMap {
* The marker's icon is rendered on the map at the location {@code Marker.position}.
* If {@code Marker.title} is defined, the map shows an info box with the marker's title and snippet.
*
* @param markerOptions A marker options object that defines how to render the marker.
* @param onMarkerViewAddedListener Callback invoked when the View has been added to the map.
* @return The {@code Marker} that was added to the map.
* @param markerOptions A marker options object that defines how to render the marker
* @param onMarkerViewAddedListener Callback invoked when the View has been added to the map
* @return The {@code Marker} that was added to the map
*/
@UiThread
@NonNull
@@ -1032,7 +1122,14 @@ public final class MapboxMap {
}
/**
* FIXME javadoc
* Adds multiple markersViews to this map.
* <p>
* The marker's icon is rendered on the map at the location {@code Marker.position}.
* If {@code Marker.title} is defined, the map shows an info box with the marker's title and snippet.
* </p>
*
* @param markerViewOptions A list of markerView options objects that defines how to render the markers
* @return A list of the {@code MarkerView}s that were added to the map
*/
@UiThread
@NonNull
@@ -1042,7 +1139,10 @@ public final class MapboxMap {
}
/**
* FIXME javadoc
* Returns markerViews found inside of a rectangle on this map.
*
* @param rect the rectangular area on the map to query for markerViews
* @return A list of the markerViews that were found in the rectangle
*/
@UiThread
@NonNull
@@ -1057,8 +1157,8 @@ public final class MapboxMap {
* The marker's icon is rendered on the map at the location {@code Marker.position}.
* If {@code Marker.title} is defined, the map shows an info box with the marker's title and snippet.
*
* @param markerOptionsList A list of marker options objects that defines how to render the markers.
* @return A list of the {@code Marker}s that were added to the map.
* @param markerOptionsList A list of marker options objects that defines how to render the markers
* @return A list of the {@code Marker}s that were added to the map
*/
@UiThread
@NonNull
@@ -1072,7 +1172,7 @@ public final class MapboxMap {
* Updates a marker on this map. Does nothing if the marker isn't already added.
* </p>
*
* @param updatedMarker An updated marker object.
* @param updatedMarker An updated marker object
*/
@UiThread
public void updateMarker(@NonNull Marker updatedMarker) {
@@ -1082,8 +1182,8 @@ public final class MapboxMap {
/**
* Adds a polyline to this map.
*
* @param polylineOptions A polyline options object that defines how to render the polyline.
* @return The {@code Polyine} that was added to the map.
* @param polylineOptions A polyline options object that defines how to render the polyline
* @return The {@code Polyine} that was added to the map
*/
@UiThread
@NonNull
@@ -1128,8 +1228,8 @@ public final class MapboxMap {
/**
* Adds multiple polygons to this map.
*
* @param polygonOptionsList A list of polygon options objects that defines how to render the polygons.
* @return A list of the {@code Polygon}s that were added to the map.
* @param polygonOptionsList A list of polygon options objects that defines how to render the polygons
* @return A list of the {@code Polygon}s that were added to the map
*/
@UiThread
@NonNull
@@ -1137,11 +1237,10 @@ public final class MapboxMap {
return annotationManager.addPolygons(polygonOptionsList, this);
}
/**
* Update a polygon on this map.
*
* @param polygon An updated polygon object.
* @param polygon An updated polygon object
*/
@UiThread
public void updatePolygon(Polygon polygon) {
@@ -1152,7 +1251,7 @@ public final class MapboxMap {
* <p>
* Convenience method for removing a Marker from the map.
* </p>
* Calls removeAnnotation() internally
* Calls removeAnnotation() internally.
*
* @param marker Marker to remove
*/
@@ -1165,7 +1264,7 @@ public final class MapboxMap {
* <p>
* Convenience method for removing a Polyline from the map.
* </p>
* Calls removeAnnotation() internally
* Calls removeAnnotation() internally.
*
* @param polyline Polyline to remove
*/
@@ -1178,7 +1277,7 @@ public final class MapboxMap {
* <p>
* Convenience method for removing a Polygon from the map.
* </p>
* Calls removeAnnotation() internally
* Calls removeAnnotation() internally.
*
* @param polygon Polygon to remove
*/
@@ -1558,6 +1657,11 @@ public final class MapboxMap {
return annotationManager.getInfoWindowManager().getOnInfoWindowLongClickListener();
}
/**
* Set an callback to be invoked when an InfoWindow closes.
*
* @param listener callback invoked when an InfoWindow closes
*/
public void setOnInfoWindowCloseListener(@Nullable OnInfoWindowCloseListener listener) {
annotationManager.getInfoWindowManager().setOnInfoWindowCloseListener(listener);
}
@@ -1657,7 +1761,6 @@ public final class MapboxMap {
* Takes a snapshot of the map.
*
* @param callback Callback method invoked when the snapshot is taken.
* @param bitmap A pre-allocated bitmap.
*/
@UiThread
public void snapshot(@NonNull SnapshotReadyCallback callback) {
@@ -2104,6 +2207,16 @@ public final class MapboxMap {
void onSnapshotReady(Bitmap snapshot);
}
/**
* Interface definintion for a callback to be invoked when the style has finished loading.
*/
public interface OnStyleLoadedListener {
/**
* Invoked when the style has finished loading.
*/
void onStyleLoaded(String style);
}
//
// Used for instrumentation testing
//

View File

@@ -378,18 +378,11 @@ final class NativeMapView {
return nativeGetScale();
}
public void setZoom(double zoom) {
public void setZoom(double zoom, PointF focalPoint, long duration) {
if (isDestroyedOn("setZoom")) {
return;
}
setZoom(zoom, 0);
}
public void setZoom(double zoom, long duration) {
if (isDestroyedOn("setZoom")) {
return;
}
nativeSetZoom(zoom, duration);
nativeSetZoom(zoom, focalPoint.x / pixelRatio, focalPoint.y / pixelRatio, duration);
}
public double getZoom() {
@@ -1023,7 +1016,7 @@ final class NativeMapView {
private native double nativeGetScale();
private native void nativeSetZoom(double zoom, long duration);
private native void nativeSetZoom(double zoom, double cx, double cy, long duration);
private native double nativeGetZoom();

View File

@@ -281,7 +281,7 @@ public final class TrackingSettings {
*/
void resetTrackingModesIfRequired(CameraPosition cameraPosition) {
if (isDismissTrackingModesForCameraPositionChange()) {
resetTrackingModesIfRequired(cameraPosition.target != null, cameraPosition.bearing != -1);
resetTrackingModesIfRequired(cameraPosition.target != null, false);
}
}

View File

@@ -1,5 +1,6 @@
package com.mapbox.mapboxsdk.maps;
import android.graphics.PointF;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.UiThread;
@@ -174,23 +175,23 @@ final class Transform implements MapView.OnMapChangedListener {
return cameraPosition.zoom;
}
void zoom(boolean zoomIn) {
zoom(zoomIn, -1.0f, -1.0f);
}
void zoom(boolean zoomIn, float x, float y) {
void zoom(boolean zoomIn, @NonNull PointF focalPoint) {
// Cancel any animation
cancelTransitions();
if (zoomIn) {
mapView.scaleBy(2.0, x, y, MapboxConstants.ANIMATION_DURATION);
} else {
mapView.scaleBy(0.5, x, y, MapboxConstants.ANIMATION_DURATION);
CameraPosition cameraPosition = invalidateCameraPosition();
if (cameraPosition != null) {
int newZoom = (int) Math.round(cameraPosition.zoom + (zoomIn ? 1 : -1));
setZoom(newZoom, focalPoint, MapboxConstants.ANIMATION_DURATION);
}
}
void setZoom(double zoom) {
mapView.setZoom(zoom);
void setZoom(double zoom, @NonNull PointF focalPoint) {
setZoom(zoom, focalPoint, 0);
}
void setZoom(double zoom, @NonNull PointF focalPoint, long duration) {
mapView.setZoom(zoom, focalPoint, duration);
}
// Direction

View File

@@ -257,9 +257,7 @@ public class MyLocationView extends View {
final PointF pointF = screenLocation;
float metersPerPixel = (float) projection.getMetersPerPixelAtLatitude(location.getLatitude());
float accuracyPixels = (Float) accuracyAnimator.getAnimatedValue() / metersPerPixel / 2;
float maxRadius = getWidth() / 2;
accuracyPixels = accuracyPixels <= maxRadius ? accuracyPixels : maxRadius;
float accuracyPixels = (Float) accuracyAnimator.getAnimatedValue() / metersPerPixel;
// reset
matrix.reset();
@@ -435,10 +433,12 @@ public class MyLocationView extends View {
}
locationEngine.addLocationEngineListener(userLocationListener);
locationEngine.activate();
} else {
// Disable location and user dot
location = null;
locationEngine.removeLocationEngineListener(userLocationListener);
locationEngine.deactivate();
}
locationEngine.setPriority(LocationEnginePriority.HIGH_ACCURACY);
@@ -573,8 +573,10 @@ public class MyLocationView extends View {
public void onConnected() {
MyLocationView locationView = userLocationView.get();
if (locationView != null) {
Location location = LocationSource.getLocationEngine(locationView.getContext()).getLastLocation();
LocationEngine locationSource = LocationSource.getLocationEngine(locationView.getContext());
Location location = locationSource.getLastLocation();
locationView.setLocation(location);
locationSource.requestLocationUpdates();
}
}
@@ -730,7 +732,7 @@ public class MyLocationView extends View {
accuracyAnimator.end();
}
accuracyAnimator = ValueAnimator.ofFloat(accuracy * 10, location.getAccuracy() * 10);
accuracyAnimator = ValueAnimator.ofFloat(accuracy, location.getAccuracy());
accuracyAnimator.setDuration(750);
accuracyAnimator.start();
accuracy = location.getAccuracy();

View File

@@ -0,0 +1,4 @@
/**
* Contains the Mapbox Maps Android Storage API classes.
*/
package com.mapbox.mapboxsdk.storage;

View File

@@ -3,8 +3,9 @@ package com.mapbox.mapboxsdk.style.sources;
import java.util.HashMap;
/**
* Options for the {@link GeoJsonSource}
* Builder class for composing GeoJsonSource objects.
*
* @see GeoJsonSource
* @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-geojson">The online documentation</a>
*/
public class GeoJsonOptions extends HashMap<String, Object> {

View File

@@ -15,7 +15,7 @@ import java.util.HashMap;
import java.util.List;
/**
* A GeoJson source. Exposes a {@link FeatureCollection} from Json.
* GeoJson source, allows using FeatureCollections from Json.
*
* @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-geojson">the style specification</a>
*/

View File

@@ -3,7 +3,7 @@ package com.mapbox.mapboxsdk.style.sources;
import java.net.URL;
/**
* Raster Source enables the use of raster tiles.
* Raster source, allows using raster tiles as source.
*
* @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-raster">The style specification</a>
*/

View File

@@ -8,7 +8,7 @@ import java.util.HashMap;
import java.util.Map;
/**
* Tile set
* Tile set, allows using TileJson specification as source.
*
* @see <a href="https://github.com/mapbox/tilejson-spec/tree/master/2.1.0">The tileset specification</a>
*/

View File

@@ -14,7 +14,7 @@ import java.util.Arrays;
import java.util.List;
/**
* Vector source enables the use of vector tiles.
* Vector source, allows the use of vector tiles.
*
* @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-vector">the style specification</a>
*/

View File

@@ -8,7 +8,7 @@
android:contentDescription="@null"
android:visibility="gone"/>
<FrameLayout
<com.mapbox.mapboxsdk.annotations.MarkerViewContainer
android:id="@+id/markerViewContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"

View File

@@ -1,3 +1,3 @@
fabric-identifier=com.mapbox.mapboxsdk.mapbox-android-sdk
fabric-version=4.1.1
fabric-version=5.0.0
fabric-build-type=binary

View File

@@ -2,10 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mapbox.mapboxsdk.testapp">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
@@ -617,8 +614,6 @@
<!-- <meta-data -->
<!-- android:name="com.mapbox.SetStorageExternal" -->
<!-- android:value="true" /> -->
<service android:name="com.mapbox.services.android.telemetry.service.TelemetryService"/>
</application>
</manifest>

View File

@@ -196,6 +196,13 @@ public class MarkerViewActivity extends AppCompatActivity {
// open infowindow offscreen markers
mapboxMap.selectMarker(markerRightOffScreen);
mapboxMap.selectMarker(markerRightBottomOffScreen);
mapboxMap.setOnMapClickListener(new MapboxMap.OnMapClickListener() {
@Override
public void onMapClick(@NonNull LatLng point) {
Toast.makeText(MarkerViewActivity.this, point.toString(), Toast.LENGTH_SHORT).show();
}
});
}
});
}

View File

@@ -1,13 +1,18 @@
package com.mapbox.mapboxsdk.testapp.activity.camera;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import com.mapbox.mapboxsdk.constants.Style;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
import com.mapbox.mapboxsdk.testapp.R;
import timber.log.Timber;
public class MaxMinZoomActivity extends AppCompatActivity implements OnMapReadyCallback {
private MapView mapView;
@@ -25,10 +30,21 @@ public class MaxMinZoomActivity extends AppCompatActivity implements OnMapReadyC
}
@Override
public void onMapReady(MapboxMap map) {
public void onMapReady(final MapboxMap map) {
mapboxMap = map;
mapboxMap.setMinZoomPreference(3);
mapboxMap.setMaxZoomPreference(5);
mapboxMap.setOnMapClickListener(new MapboxMap.OnMapClickListener() {
@Override
public void onMapClick(@NonNull LatLng point) {
map.setStyle(Style.OUTDOORS, new MapboxMap.OnStyleLoadedListener() {
@Override
public void onStyleLoaded(String style) {
Timber.d("Style Loaded %s", style);
}
});
}
});
}
@Override

View File

@@ -5,7 +5,9 @@ import android.support.annotation.NonNull;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;
import com.mapbox.mapboxsdk.camera.CameraPosition;
import com.mapbox.mapboxsdk.constants.Style;
import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
@@ -47,9 +49,21 @@ public class DebugModeActivity extends AppCompatActivity {
@Override
public void onMapReady(@NonNull MapboxMap map) {
mapboxMap = map;
mapboxMap.getUiSettings().setZoomControlsEnabled(true);
// show current zoom level on screen
final TextView textView = (TextView) findViewById(R.id.textZoom);
mapboxMap.setOnCameraChangeListener(new MapboxMap.OnCameraChangeListener() {
@Override
public void onCameraChange(CameraPosition position) {
textView.setText(String.format(getString(R.string.debug_zoom), position.zoom));
}
});
}
});
FloatingActionButton fabDebug = (FloatingActionButton) findViewById(R.id.fabDebug);
fabDebug.setOnClickListener(new View.OnClickListener() {
@Override
@@ -70,7 +84,12 @@ public class DebugModeActivity extends AppCompatActivity {
if (currentStyleIndex == STYLES.length) {
currentStyleIndex = 0;
}
mapboxMap.setStyleUrl(STYLES[currentStyleIndex]);
mapboxMap.setStyleUrl(STYLES[currentStyleIndex], new MapboxMap.OnStyleLoadedListener() {
@Override
public void onStyleLoaded(String style) {
Timber.d("Style loaded %s", style);
}
});
}
}
});

View File

@@ -10,7 +10,18 @@
<com.mapbox.mapboxsdk.maps.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent"
app:mapbox_uiAttribution="false"
app:mapbox_uiCompass="false"
app:mapbox_uiLogo="false"/>
<TextView
android:id="@+id/textZoom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|start"
android:layout_margin="8dp"
android:textSize="14sp"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fabDebug"

View File

@@ -162,4 +162,5 @@
<string name="dynamic_marker_chelsea_snippet">Stamford Bridge</string>
<string name="dynamic_marker_arsenal_title">Arsenal</string>
<string name="dynamic_marker_arsenal_snippet">Emirates Stadium</string>
<string name="debug_zoom">Zoom: %s</string>
</resources>

View File

@@ -164,8 +164,7 @@ workflows:
mkdir -p "${ANDROID_HOME}/licenses"
echo "8933bad161af4178b1185d1a37fbf41ea5269c55" > "${ANDROID_HOME}/licenses/android-sdk-license"
echo "Compile libmapbox-gl.so for all supportd abi's:"
export BUILDTYPE=Release
make apackage
export BUILDTYPE=Release make apackage
- script:
title: Publish to maven
inputs:

View File

@@ -16,9 +16,9 @@ ext {
dep = [
// mapbox
mapboxJavaServices : 'com.mapbox.mapboxsdk:mapbox-java-services:2.0.0-beta.2@jar',
mapboxJavaGeoJSON : 'com.mapbox.mapboxsdk:mapbox-java-geojson:2.0.0-beta.2@jar',
mapboxAndroidTelemetry : 'com.mapbox.mapboxsdk:mapbox-android-telemetry:2.0.0-beta.2@aar',
mapboxJavaServices : 'com.mapbox.mapboxsdk:mapbox-java-services:2.0.0@jar',
mapboxJavaGeoJSON : 'com.mapbox.mapboxsdk:mapbox-java-geojson:2.0.0@jar',
mapboxAndroidTelemetry : 'com.mapbox.mapboxsdk:mapbox-android-telemetry:2.0.0@aar',
// mapzen lost
lost : 'com.mapzen.android:lost:2.1.2',

View File

@@ -459,8 +459,8 @@ jni::jdouble NativeMapView::getScale(jni::JNIEnv&) {
return map->getScale();
}
void NativeMapView::setZoom(jni::JNIEnv&, jni::jdouble zoom, jni::jlong duration) {
map->setZoom(zoom, mbgl::AnimationOptions{mbgl::Milliseconds(duration)});
void NativeMapView::setZoom(jni::JNIEnv&, jni::jdouble zoom, jni::jdouble x, jni::jdouble y, jni::jlong duration) {
map->setZoom(zoom, mbgl::ScreenCoordinate{x,y}, mbgl::AnimationOptions{mbgl::Milliseconds(duration)});
}
jni::jdouble NativeMapView::getZoom(jni::JNIEnv&) {

View File

@@ -133,7 +133,7 @@ public:
jni::jdouble getScale(jni::JNIEnv&);
void setZoom(jni::JNIEnv&, jni::jdouble, jni::jlong);
void setZoom(jni::JNIEnv&, jni::jdouble, jni::jdouble, jni::jdouble, jni::jlong);
jni::jdouble getZoom(jni::JNIEnv&);

View File

@@ -0,0 +1,160 @@
<%
const os = locals.os;
const iOS = os === 'iOS';
const macOS = os === 'macOS';
const cocoaPrefix = iOS ? 'UI' : 'NS';
-%>
<!--
This file is generated.
Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
-->
# Data-Driven Styling
Mapbox’s data-driven styling features allow you to use data properties to style your maps. You can style map features automatically based on their individual attributes.
Vary POI icons, transit route line colors, city polygon opacity, and more based on any attribute in your data. Need to visualize hotel data by price? You can have your map’s point radii and colors change automatically with your data.
![available bikes](img/data-driven-styling/citibikes.png) ![subway lines](img/data-driven-styling/polylineExample.png)
# How to use Data-Driven Styling
This guide uses earthquake data from the [U.S. Geological Survey](https://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php) to style a map based on attributes. For more information about how to work with GeoJSON data in our iOS SDK, please see our [working with GeoJSON data](working-with-geojson-data.html) guide.
`MGLStyleFunction`
There are three subclasses of `MGLStyleFunction`:
* `MGLCameraStyleFunction` - For a style value that changes with zoom level. For example, you can make the radius of a circle increase according to zoom level.
* `MGLSourceStyleFunction` - For a style value that changes with the attributes of a feature. For example, you can adjust the radius of a circle based on the magnitude of an earthquake.
* `MGLCompositeStyleFunction` - For a style value that changes with both zoom level and attribute values. For example, you can add a circle layer where each circle has a radius based on both zoom level and the magnitude of an earthquake.
The documentation for individual style properties will note which style functions are enabled for that property.
## Stops
Stops are key-value pairs that that determine a style value. With a `MGLCameraSourceFunction` stop, you can use a dictionary with a zoom level for a key and a `MGLStyleValue` for the value. For example, you can use a stops dictionary with zoom levels 0, 10, and 20 as keys, and yellow, orange, and red as the values. A `MGLSourceStyleFunction` uses the relevant attribute value as the key.
```swift
let stops = [0: MGLStyleValue(rawValue: UIColor.yellow),
2.5: MGLStyleValue(rawValue: UIColor.orange),
5: MGLStyleValue(rawValue: UIColor.red),
7.5: MGLStyleValue(rawValue: UIColor.blue),
10: MGLStyleValue(rawValue: UIColor.white)]
```
## Interpolation Mode
The effect a key has on the style value is determined by the interpolation mode. There are four interpolation modes that can be used with a source style function: exponential, interval, categorical, and identity. You can also use exponential and interval interpolation modes with a camera style function.
### Linear
`MGLInterpolationModelExponential` interpolates linearly or exponentially between style function stop values. By default, the `MGLStyleFunction` options parameter `MGLStyleFunctionOptionInterpolationBase` equals `1`, which represents linear interpolation, and doesn’t need to be included in the options dictionary.
The stops dictionary below, for example, shows colors that continuously shift from yellow to orange to red to blue to white based on the attribute value.
``` swift
let url = URL(string: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_week.geojson")
let symbolSource = MGLSource(identifier: "source")
let symbolLayer = MGLSymbolStyleLayer(identifier: "place-city-sm", source: symbolSource)
let source = MGLShapeSource(identifier: "earthquakes", url: url, options: nil)
style.addSource(source)
let stops = [0: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.yellow),
2.5: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.orange),
5: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.red),
7.5: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.blue),
10: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.white)]
let layer = MGLCircleStyleLayer(identifier: "circles", source: source)
layer.circleColor = MGLStyleValue(interpolationMode: .exponential,
sourceStops: stops,
attributeName: "mag",
options: [.defaultValue: MGLStyleValue<<%- cocoaPrefix %>Color>(rawValue: .green)])
layer.circleRadius = MGLStyleValue(rawValue: 10)
style.insertLayer(layer, below: symbolLayer)
```
![exponential mode](img/data-driven-styling/exponential.png)
### Exponential
`MGLInterpolationModelExponential` combined with any `MGLStyleFunctionOptionInterpolationBase` greater than `0`, you can interpolate between values exponentially, create an accelerated ramp effect.
Here’s a visualization from Mapbox Studio (see [Working with Mapbox Studio](working-with-mapbox-studio.html)) comparing interpolation base values of `1.5` and `0.5` based on zoom.
<img src="img/data-driven-styling/exponential-function.png" height=344/>
<img src="img/data-driven-styling/exponential-function-1.png" height=344/>
The example below increases a layer’s `circleRadius` exponentially based on a map’s zoom level. The `MGLStyleFunctionOptionInterpolationBase` is `1.5`.
```swift
let stops = [12: MGLStyleValue(rawValue: 0.5),
14: MGLStyleValue(rawValue: 2),
18: MGLStyleValue(rawValue: 18)]
layer.circleRadius = MGLStyleValue(interpolationMode: .exponential,
cameraStops: stops,
options: [.interpolationBase: 1.5])
```
### Interval
`MGLInterpolationModeInterval` creates a range using the keys from the stops dictionary. The range is from the given key to just less than the next key. The attribute values that fall into that range are then styled using the style value assigned to that key.
When we use the stops dictionary given above with an interval interpolation mode, we create ranges where earthquakes with a magnitude of 0 to just less than 2.5 would be yellow, 2.5 to just less than 5 would be orange, and so on.
``` swift
let stops = [0: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.yellow),
2.5: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.orange),
5: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.red),
7.5: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.blue),
10: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.white)]
layer.circleColor = MGLStyleValue(interpolationMode: .interval,
sourceStops: stops,
attributeName: "mag",
options: [.defaultValue: MGLStyleValue<<%- cocoaPrefix %>Color>(rawValue: .green)])
```
![interval mode](img/data-driven-styling/interval.png)
### Categorical
Returns the output value that is equal to the stop for the function input. We’re going to use a different stops dictionary than we did for the previous two modes.
There are three main types of events in the dataset: earthquakes, explosions, and quarry blasts. In this case, the color of the circle layer will be determined by the type of event, with a default value of green to catch any events that do not fall into any of those categories.
``` swift
let categoricalStops = ["earthquake": MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.orange),
"explosion": MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.red),
"quarry blast": MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.yellow)]
layer.circleColor = MGLStyleValue(interpolationMode: .categorical,
sourceStops: categoricalStops,
attributeName: "type",
options: [.defaultValue: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.blue)])
```
![categorical mode](img/data-driven-styling/categorical1.png) ![categorical mode](img/data-driven-styling/categorical2.png)
### Identity
`MGLInterpolationModeIdentity` uses the attribute’s value as the style value. For example, you can set the `circleRadius` to the earthquake’s magnitude. Since the attribute value itself will be used as the style value, `sourceStops` should be set to `nil`.
``` swift
layer.circleRadius = MGLStyleValue(interpolationMode: .identity,
sourceStops: nil,
attributeName: "mag",
options: [.defaultValue: MGLStyleValue<NSNumber>(rawValue: 0)])
```
![identity mode](img/data-driven-styling/identity.png)
##Resources
* [USGS](https://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php)
* [For Style Authors](for-style-authors.html)

View File

@@ -8,7 +8,7 @@
-%>
<!--
This file is generated.
Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
-->
# Information for Style Authors
@@ -41,7 +41,7 @@ underneath.
<% if (iOS) { -%>
The user location annotation view, the attribution button, any buttons in
callout views, and any items in the navigation bar are influenced by your
application’s tint color, so choose a tint color that constrasts well with your
application’s tint color, so choose a tint color that contrasts well with your
map style.
<% } -%>
If you intend your style to be used in the dark, consider the impact that Night
@@ -160,6 +160,7 @@ In the style specification | In the SDK
---------------------------|---------
class | style class
filter | predicate
function type | interpolation mode
id | identifier
image | style image
layer | style layer
@@ -239,6 +240,30 @@ whose names differ from the style specification are listed below:
<% for (const type in renamedProperties) { -%>
<% if (renamedProperties.hasOwnProperty(type)) { -%>
### <%- camelize(type) %> style functions
The runtime styling API introduces `MGLStyleFunction` to the <%- os %> SDK.
[Data-driven styling](data-driven-styling.html) expands `MGLStyleFunction`.
Individual style property documentation includes which subclasses of
`MGLStyleFunction` are enabled for that property. You can use `MGLStyleValue`
methods to create a `MGLStyleFunction`.
In style specification | In the SDK | [MGLStyleValue valueWithInterpolationMode:...]
-----------------------|-------------------------------|-------------
`zoom function` | `MGLCameraStyleFunction` | `cameraStops:options:`
`property function` | `MGLSourceStyleFunction` | `sourceStops:attributeName:options:`
`zoom-and-property functions`| `MGLCompositeStyleFunction` | `compositeStops:attributeName:options:`
Data-driven styling also introduces interpolation mode, which defines the
relationship between style values and attributes or zoom levels.
In style specification | In the SDK
-----------------------------|-----------
`exponential` | `MGLInterpolationModeExponential`
`interval` | `MGLInterpolationModeInterval`
`categorical` | `MGLInterpolationModeCategorical`
`identity` | `MGLInterpolationModeIdentity`
### <%- camelize(type) %> style layers
In style JSON | In Objective-C | In Swift
@@ -254,7 +279,7 @@ In style JSON | In Objective-C | In Swift
## Setting attribute values
Each property representing a layout or paint attribute is set to an
`MGLStyleValue` object, which is either an `MGLStyleConstantValue` object (for
`MGLStyleValue` object, which is either an `MGLConstantStyleValue` object (for
constant values) or an `MGLStyleFunction` object (for zoom level functions). The
style value object is a container for the raw value or function parameters that
you want the attribute to be set to.

View File

@@ -0,0 +1,291 @@
/* Clock position format, long: {hours} o’clock */
"CLOCK_FMT_LONG" = "%@ en punt";
/* Clock position format, medium: {hours} o’clock */
"CLOCK_FMT_MEDIUM" = "%@ en punt";
/* Clock position format, short: {hours}:00 */
"CLOCK_FMT_SHORT" = "%@:00";
/* East, long */
"COMPASS_E_LONG" = "est";
/* East, short */
"COMPASS_E_SHORT" = "E";
/* East by north, long */
"COMPASS_EbN_LONG" = "est per nord";
/* East by north, short */
"COMPASS_EbN_SHORT" = "EpN";
/* East by south, long */
"COMPASS_EbS_LONG" = "est per sud";
/* East by south, short */
"COMPASS_EbS_SHORT" = "EpS";
/* East-northeast, long */
"COMPASS_ENE_LONG" = "est-nord-est";
/* East-northeast, short */
"COMPASS_ENE_SHORT" = "ENE";
/* East-southeast, long */
"COMPASS_ESE_LONG" = "est-sud-est";
/* East-southeast, short */
"COMPASS_ESE_SHORT" = "ESE";
/* North, long */
"COMPASS_N_LONG" = "nord";
/* North, short */
"COMPASS_N_SHORT" = "N";
/* North by east, long */
"COMPASS_NbE_LONG" = "nord per est";
/* North by east, short */
"COMPASS_NbE_SHORT" = "NpE";
/* North by west, long */
"COMPASS_NbW_LONG" = "nord per oest";
/* North by west, short */
"COMPASS_NbW_SHORT" = "NpO";
/* Northeast, long */
"COMPASS_NE_LONG" = "nord-est";
/* Northeast, short */
"COMPASS_NE_SHORT" = "NE";
/* Northeast by east, long */
"COMPASS_NEbE_LONG" = "nord-est per est";
/* Northeast by east, short */
"COMPASS_NEbE_SHORT" = "NEpE";
/* Northeast by north, long */
"COMPASS_NEbN_LONG" = "nord-est per nord";
/* Northeast by north, short */
"COMPASS_NEbN_SHORT" = "NEpN";
/* North-northeast, long */
"COMPASS_NNE_LONG" = "nord-nord-est";
/* North-northeast, short */
"COMPASS_NNE_SHORT" = "NNE";
/* North-northwest, long */
"COMPASS_NNW_LONG" = "nord-nord-oest";
/* North-northwest, short */
"COMPASS_NNW_SHORT" = "NNO";
/* Northwest, long */
"COMPASS_NW_LONG" = "nord-oest";
/* Northwest, short */
"COMPASS_NW_SHORT" = "NO";
/* Northwest by north, long */
"COMPASS_NWbN_LONG" = "nord-oest per nord";
/* Northwest by north, short */
"COMPASS_NWbN_SHORT" = "NOpN";
/* Northwest by west, long */
"COMPASS_NWbW_LONG" = "nord-oest per oest";
/* Northwest by west, short */
"COMPASS_NWbW_SHORT" = "NOpO";
/* South, long */
"COMPASS_S_LONG" = "sud";
/* South, short */
"COMPASS_S_SHORT" = "S";
/* South by east, long */
"COMPASS_SbE_LONG" = "sud per est";
/* South by east, short */
"COMPASS_SbE_SHORT" = "SpE";
/* South by west, long */
"COMPASS_SbW_LONG" = "sud per oest";
/* South by west, short */
"COMPASS_SbW_SHORT" = "SpO";
/* Southeast, long */
"COMPASS_SE_LONG" = "sud-est";
/* Southeast, short */
"COMPASS_SE_SHORT" = "SE";
/* Southeast by east, long */
"COMPASS_SEbE_LONG" = "sud-est per est";
/* Southeast by east, short */
"COMPASS_SEbE_SHORT" = "SEpE";
/* Southeast by south, long */
"COMPASS_SEbS_LONG" = "sud-est per sud";
/* Southeast by south, short */
"COMPASS_SEbS_SHORT" = "SEpS";
/* South-southeast, long */
"COMPASS_SSE_LONG" = "sud-sud-est";
/* South-southeast, short */
"COMPASS_SSE_SHORT" = "SSE";
/* South-southwest, long */
"COMPASS_SSW_LONG" = "sud-sud-oest";
/* South-southwest, short */
"COMPASS_SSW_SHORT" = "SSO";
/* Southwest, long */
"COMPASS_SW_LONG" = "sud-oest";
/* Southwest, short */
"COMPASS_SW_SHORT" = "SO";
/* Southwest by south, long */
"COMPASS_SWbS_LONG" = "sud-oest per sud";
/* Southwest by south, short */
"COMPASS_SWbS_SHORT" = "SOpS";
/* Southwest by west, long */
"COMPASS_SWbW_LONG" = "sud-oest per oest";
/* Southwest by west, short */
"COMPASS_SWbW_SHORT" = "SOpO";
/* West, long */
"COMPASS_W_LONG" = "oest";
/* West, short */
"COMPASS_W_SHORT" = "O";
/* West by north, long */
"COMPASS_WbN_LONG" = "oest per nord";
/* West by north, short */
"COMPASS_WbN_SHORT" = "OpN";
/* West by south, long */
"COMPASS_WbS_LONG" = "oest per sud";
/* West by south, short */
"COMPASS_WbS_SHORT" = "OpS";
/* West-northwest, long */
"COMPASS_WNW_LONG" = "oest-nord-oest";
/* West-northwest, short */
"COMPASS_WNW_SHORT" = "ONO";
/* West-southwest, long */
"COMPASS_WSW_LONG" = "oest-sud-oest";
/* West-southwest, short */
"COMPASS_WSW_SHORT" = "OSO";
/* Degrees format, long */
"COORD_DEG_LONG" = "%d grau(s)";
/* Degrees format, medium: {degrees} */
"COORD_DEG_MEDIUM" = "%d°";
/* Degrees format, short: {degrees} */
"COORD_DEG_SHORT" = "%d°";
/* Coordinate format, long: {degrees}{minutes} */
"COORD_DM_LONG" = "%1$@ i %2$@";
/* Coordinate format, medium: {degrees}{minutes} */
"COORD_DM_MEDIUM" = "%1$@%2$@";
/* Coordinate format, short: {degrees}{minutes} */
"COORD_DM_SHORT" = "%1$@%2$@";
/* Coordinate format, long: {degrees}{minutes}{seconds} */
"COORD_DMS_LONG" = "%1$@, %2$@, i %3$@";
/* Coordinate format, medium: {degrees}{minutes}{seconds} */
"COORD_DMS_MEDIUM" = "%1$@%2$@%3$@";
/* Coordinate format, short: {degrees}{minutes}{seconds} */
"COORD_DMS_SHORT" = "%1$@%2$@%3$@";
/* East longitude format, long: {longitude} */
"COORD_E_LONG" = "%@ est";
/* East longitude format, medium: {longitude} */
"COORD_E_MEDIUM" = "%@ est";
/* East longitude format, short: {longitude} */
"COORD_E_SHORT" = "%@E";
/* Coordinate pair format, long: {latitude}, {longitude} */
"COORD_FMT_LONG" = "%1$@ per %2$@";
/* Coordinate pair format, medium: {latitude}, {longitude} */
"COORD_FMT_MEDIUM" = "%1$@, %2$@";
/* Coordinate pair format, short: {latitude}, {longitude} */
"COORD_FMT_SHORT" = "%1$@, %2$@";
/* Minutes format, long */
"COORD_MIN_LONG" = "%d minut(s)";
/* Minutes format, medium: {minutes} */
"COORD_MIN_MEDIUM" = "%d′";
/* Minutes format, short: {minutes} */
"COORD_MIN_SHORT" = "%d′";
/* North latitude format, long: {latitude} */
"COORD_N_LONG" = "%@ nord";
/* North latitude format, medium: {latitude} */
"COORD_N_MEDIUM" = "%@ nord";
/* North latitude format, short: {latitude} */
"COORD_N_SHORT" = "%@N";
/* South latitude format, long: {latitude} */
"COORD_S_LONG" = "%@ sud";
/* South latitude format, medium: {latitude} */
"COORD_S_MEDIUM" = "%@ sud";
/* South latitude format, short: {latitude} */
"COORD_S_SHORT" = "%@S";
/* Seconds format, long */
"COORD_SEC_LONG" = "%d segon(s)";
/* Seconds format, medium: {seconds} */
"COORD_SEC_MEDIUM" = "%d″";
/* Seconds format, short: {seconds} */
"COORD_SEC_SHORT" = "%d″";
/* West longitude format, long: {longitude} */
"COORD_W_LONG" = "%@ oest";
/* West longitude format, medium: {longitude} */
"COORD_W_MEDIUM" = "%@ oest";
/* West longitude format, short: {longitude} */
"COORD_W_SHORT" = "%@O";

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>COORD_DEG_LONG</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@degrees@</string>
<key>degrees</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>one</key>
<string>%d grau</string>
<key>other</key>
<string>%d graus</string>
</dict>
</dict>
<key>COORD_MIN_LONG</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@minutes@</string>
<key>minutes</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>one</key>
<string>%d minut</string>
<key>other</key>
<string>%d minuts</string>
</dict>
</dict>
<key>COORD_SEC_LONG</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@seconds@</string>
<key>seconds</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>one</key>
<string>%d segon</string>
<key>other</key>
<string>%d segons</string>
</dict>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,291 @@
/* Clock position format, long: {hours} o’clock */
"CLOCK_FMT_LONG" = "Laikas: %@";
/* Clock position format, medium: {hours} o’clock */
"CLOCK_FMT_MEDIUM" = "Laikas: %@";
/* Clock position format, short: {hours}:00 */
"CLOCK_FMT_SHORT" = "%@:00";
/* East, long */
"COMPASS_E_LONG" = "rytai";
/* East, short */
"COMPASS_E_SHORT" = "R";
/* East by north, long */
"COMPASS_EbN_LONG" = "rytai į šiaurę";
/* East by north, short */
"COMPASS_EbN_SHORT" = "RįŠ";
/* East by south, long */
"COMPASS_EbS_LONG" = "rytai į pietus";
/* East by south, short */
"COMPASS_EbS_SHORT" = "RįP";
/* East-northeast, long */
"COMPASS_ENE_LONG" = "rytai - šiaurės rytai";
/* East-northeast, short */
"COMPASS_ENE_SHORT" = "R-ŠR";
/* East-southeast, long */
"COMPASS_ESE_LONG" = "rytai - pietryčiai";
/* East-southeast, short */
"COMPASS_ESE_SHORT" = "R-PR";
/* North, long */
"COMPASS_N_LONG" = "šiaurė";
/* North, short */
"COMPASS_N_SHORT" = "Š";
/* North by east, long */
"COMPASS_NbE_LONG" = "šiaurė į rytus";
/* North by east, short */
"COMPASS_NbE_SHORT" = "ŠįR";
/* North by west, long */
"COMPASS_NbW_LONG" = "šiaurė į vakarus";
/* North by west, short */
"COMPASS_NbW_SHORT" = "ŠįV";
/* Northeast, long */
"COMPASS_NE_LONG" = "šiaurės rytai";
/* Northeast, short */
"COMPASS_NE_SHORT" = "ŠR";
/* Northeast by east, long */
"COMPASS_NEbE_LONG" = "šiaurės rytai į rytus";
/* Northeast by east, short */
"COMPASS_NEbE_SHORT" = "ŠRįR";
/* Northeast by north, long */
"COMPASS_NEbN_LONG" = "šiaurės rytai į šiaurę";
/* Northeast by north, short */
"COMPASS_NEbN_SHORT" = "ŠRįŠ";
/* North-northeast, long */
"COMPASS_NNE_LONG" = "šiaurė - šiaurės rytai";
/* North-northeast, short */
"COMPASS_NNE_SHORT" = "ŠŠR";
/* North-northwest, long */
"COMPASS_NNW_LONG" = "šiaurė - šiaurės vakarai";
/* North-northwest, short */
"COMPASS_NNW_SHORT" = "ŠŠV";
/* Northwest, long */
"COMPASS_NW_LONG" = "šiaurės vakarai";
/* Northwest, short */
"COMPASS_NW_SHORT" = "ŠV";
/* Northwest by north, long */
"COMPASS_NWbN_LONG" = "šiaurės vakarai į šiaurę";
/* Northwest by north, short */
"COMPASS_NWbN_SHORT" = "ŠVįŠ";
/* Northwest by west, long */
"COMPASS_NWbW_LONG" = "šiaurės vakarai į vakarus";
/* Northwest by west, short */
"COMPASS_NWbW_SHORT" = "ŠVįV";
/* South, long */
"COMPASS_S_LONG" = "pietūs";
/* South, short */
"COMPASS_S_SHORT" = "P";
/* South by east, long */
"COMPASS_SbE_LONG" = "pietūs į rytus";
/* South by east, short */
"COMPASS_SbE_SHORT" = "PįR";
/* South by west, long */
"COMPASS_SbW_LONG" = "pietūs į vakarus";
/* South by west, short */
"COMPASS_SbW_SHORT" = "PįV";
/* Southeast, long */
"COMPASS_SE_LONG" = "pietryčiai";
/* Southeast, short */
"COMPASS_SE_SHORT" = "PR";
/* Southeast by east, long */
"COMPASS_SEbE_LONG" = "pietryčiai į rytus";
/* Southeast by east, short */
"COMPASS_SEbE_SHORT" = "PRįR";
/* Southeast by south, long */
"COMPASS_SEbS_LONG" = "pietryčiai į pietus";
/* Southeast by south, short */
"COMPASS_SEbS_SHORT" = "PRįP";
/* South-southeast, long */
"COMPASS_SSE_LONG" = "pietūs - pietryčiai";
/* South-southeast, short */
"COMPASS_SSE_SHORT" = "PPR";
/* South-southwest, long */
"COMPASS_SSW_LONG" = "pietūs - pietvakariai";
/* South-southwest, short */
"COMPASS_SSW_SHORT" = "PPV";
/* Southwest, long */
"COMPASS_SW_LONG" = "pietvakariai";
/* Southwest, short */
"COMPASS_SW_SHORT" = "PV";
/* Southwest by south, long */
"COMPASS_SWbS_LONG" = "pietvakariai į pietus";
/* Southwest by south, short */
"COMPASS_SWbS_SHORT" = "PVįP";
/* Southwest by west, long */
"COMPASS_SWbW_LONG" = "pietvakariai į vakarus";
/* Southwest by west, short */
"COMPASS_SWbW_SHORT" = "PVįV";
/* West, long */
"COMPASS_W_LONG" = "vakarai";
/* West, short */
"COMPASS_W_SHORT" = "V";
/* West by north, long */
"COMPASS_WbN_LONG" = "vakarai į šiaurę";
/* West by north, short */
"COMPASS_WbN_SHORT" = "VįŠ";
/* West by south, long */
"COMPASS_WbS_LONG" = "vakarai į pietus";
/* West by south, short */
"COMPASS_WbS_SHORT" = "VįP";
/* West-northwest, long */
"COMPASS_WNW_LONG" = "vakarai - šiaurės vakarai";
/* West-northwest, short */
"COMPASS_WNW_SHORT" = "VŠV";
/* West-southwest, long */
"COMPASS_WSW_LONG" = "vakarai - pietvakariai";
/* West-southwest, short */
"COMPASS_WSW_SHORT" = "VPV";
/* Degrees format, long */
"COORD_DEG_LONG" = "%d laipsniai(-ių)";
/* Degrees format, medium: {degrees} */
"COORD_DEG_MEDIUM" = "%d°";
/* Degrees format, short: {degrees} */
"COORD_DEG_SHORT" = "%d°";
/* Coordinate format, long: {degrees}{minutes} */
"COORD_DM_LONG" = "%1$@ ir %2$@";
/* Coordinate format, medium: {degrees}{minutes} */
"COORD_DM_MEDIUM" = "%1$@%2$@";
/* Coordinate format, short: {degrees}{minutes} */
"COORD_DM_SHORT" = "%1$@%2$@";
/* Coordinate format, long: {degrees}{minutes}{seconds} */
"COORD_DMS_LONG" = "%1$@, %2$@ ir %3$@";
/* Coordinate format, medium: {degrees}{minutes}{seconds} */
"COORD_DMS_MEDIUM" = "%1$@%2$@%3$@";
/* Coordinate format, short: {degrees}{minutes}{seconds} */
"COORD_DMS_SHORT" = "%1$@%2$@%3$@";
/* East longitude format, long: {longitude} */
"COORD_E_LONG" = "%@ ritų ilgumos";
/* East longitude format, medium: {longitude} */
"COORD_E_MEDIUM" = "%@ į rytus";
/* East longitude format, short: {longitude} */
"COORD_E_SHORT" = "%@R";
/* Coordinate pair format, long: {latitude}, {longitude} */
"COORD_FMT_LONG" = "%1$@, %2$@";
/* Coordinate pair format, medium: {latitude}, {longitude} */
"COORD_FMT_MEDIUM" = "%1$@, %2$@";
/* Coordinate pair format, short: {latitude}, {longitude} */
"COORD_FMT_SHORT" = "%1$@, %2$@";
/* Minutes format, long */
"COORD_MIN_LONG" = "%d minutė(s)";
/* Minutes format, medium: {minutes} */
"COORD_MIN_MEDIUM" = "%d′";
/* Minutes format, short: {minutes} */
"COORD_MIN_SHORT" = "%d′";
/* North latitude format, long: {latitude} */
"COORD_N_LONG" = "%@ šiaurės platumos";
/* North latitude format, medium: {latitude} */
"COORD_N_MEDIUM" = "%@ į šiaurę";
/* North latitude format, short: {latitude} */
"COORD_N_SHORT" = "%@Š";
/* South latitude format, long: {latitude} */
"COORD_S_LONG" = "%@ pietų platumos";
/* South latitude format, medium: {latitude} */
"COORD_S_MEDIUM" = "%@ į pietus";
/* South latitude format, short: {latitude} */
"COORD_S_SHORT" = "%@P";
/* Seconds format, long */
"COORD_SEC_LONG" = "%d sekundės(-ių)";
/* Seconds format, medium: {seconds} */
"COORD_SEC_MEDIUM" = "%d″";
/* Seconds format, short: {seconds} */
"COORD_SEC_SHORT" = "%d″";
/* West longitude format, long: {longitude} */
"COORD_W_LONG" = "%@ vakarų ilgumos";
/* West longitude format, medium: {longitude} */
"COORD_W_MEDIUM" = "%@ į vakarus";
/* West longitude format, short: {longitude} */
"COORD_W_SHORT" = "%@V";

View File

@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>COORD_DEG_LONG</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@degrees@</string>
<key>degrees</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>one</key>
<string>%d laipsniai</string>
<key>few</key>
<string>%d laipsniai</string>
<key>many</key>
<string>%d laipsniai</string>
<key>other</key>
<string>%d laipsnių</string>
</dict>
</dict>
<key>COORD_MIN_LONG</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@minutes@</string>
<key>minutes</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>one</key>
<string>%d minutė</string>
<key>few</key>
<string>%d minutės</string>
<key>many</key>
<string>%d minutės</string>
<key>other</key>
<string>%d minučių</string>
</dict>
</dict>
<key>COORD_SEC_LONG</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@seconds@</string>
<key>seconds</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>one</key>
<string>%d sekundė</string>
<key>few</key>
<string>%d sekundės</string>
<key>many</key>
<string>%d sekundės</string>
<key>other</key>
<string>%d sekundžių</string>
</dict>
</dict>
</dict>
</plist>

View File

@@ -18,6 +18,8 @@
<string>%d stopnie</string>
<key>many</key>
<string>%d stopni</string>
<key>other</key>
<string>%d stopnia</string>
</dict>
</dict>
<key>COORD_MIN_LONG</key>
@@ -36,6 +38,8 @@
<string>%d minuty</string>
<key>many</key>
<string>%d minut</string>
<key>other</key>
<string>%d minuty</string>
</dict>
</dict>
<key>COORD_SEC_LONG</key>
@@ -54,6 +58,8 @@
<string>%d sekundy</string>
<key>many</key>
<string>%d sekund</string>
<key>other</key>
<string>%d sekundy</string>
</dict>
</dict>
</dict>

View File

@@ -18,6 +18,8 @@
<string>%d градуса</string>
<key>many</key>
<string>%d градусов</string>
<key>other</key>
<string>%d градуса</string>
</dict>
</dict>
<key>COORD_MIN_LONG</key>
@@ -36,6 +38,8 @@
<string>%d минуты</string>
<key>many</key>
<string>%d минут</string>
<key>other</key>
<string>%d минуты</string>
</dict>
</dict>
<key>COORD_SEC_LONG</key>
@@ -54,6 +58,8 @@
<string>%d секунды</string>
<key>many</key>
<string>%d секунд</string>
<key>other</key>
<string>%d секунды</string>
</dict>
</dict>
</dict>

View File

@@ -18,6 +18,8 @@
<string>%d градуси</string>
<key>many</key>
<string>%d градусів</string>
<key>other</key>
<string>%d градуса</string>
</dict>
</dict>
<key>COORD_MIN_LONG</key>
@@ -31,11 +33,13 @@
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>one</key>
<string>%d хвилина</string>
<string>%d мінута</string>
<key>few</key>
<string>%d хвилини</string>
<string>%d мінути</string>
<key>many</key>
<string>%d хвилин</string>
<string>%d мінут</string>
<key>other</key>
<string>%d мінути</string>
</dict>
</dict>
<key>COORD_SEC_LONG</key>
@@ -54,6 +58,8 @@
<string>%d секунди</string>
<key>many</key>
<string>%d секунд</string>
<key>other</key>
<string>%d секунди</string>
</dict>
</dict>
</dict>

View File

@@ -184,7 +184,7 @@ global.testGetterImplementation = function (property, layerType, isFunction) {
if (isFunction) {
return `XCTAssertEqualObjects(gLayer.${objCName(property)}, ${value});`;
}
return `XCTAssert([gLayer.${objCName(property)} isKindOfClass:[MGLStyleConstantValue class]]);
return `XCTAssert([gLayer.${objCName(property)} isKindOfClass:[MGLConstantStyleValue class]]);
XCTAssertEqualObjects(gLayer.${objCName(property)}, ${value});`;
}
return `XCTAssertEqualObjects(gLayer.${objCName(property)}, ${value});`;
@@ -281,7 +281,7 @@ global.propertyDoc = function (propertyName, property, layerType, kind) {
doc += `\n\nThis attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#${anchor}"><code>${property.original}</code></a> layout property in the Mapbox Style Specification.`;
}
doc += '\n\nYou can set this property to an instance of:\n\n' +
'* `MGLStyleConstantValue`\n';
'* `MGLConstantStyleValue`\n';
if (property["property-function"]) {
doc += '* `MGLCameraStyleFunction` with an interpolation mode of:\n' +
' * `MGLInterpolationModeExponential`\n' +
@@ -528,6 +528,7 @@ const layerH = ejs.compile(fs.readFileSync('platform/darwin/src/MGLStyleLayer.h.
const layerM = ejs.compile(fs.readFileSync('platform/darwin/src/MGLStyleLayer.mm.ejs', 'utf8'), { strict: true});
const testLayers = ejs.compile(fs.readFileSync('platform/darwin/test/MGLStyleLayerTests.mm.ejs', 'utf8'), { strict: true});
const guideMD = ejs.compile(fs.readFileSync('platform/darwin/docs/guides/For Style Authors.md.ejs', 'utf8'), { strict: true });
const ddsGuideMD = ejs.compile(fs.readFileSync('platform/darwin/docs/guides/Data-Driven Styling.md.ejs', 'utf8'), { strict: true });
const layers = _(spec.layer.type.values).map((value, layerType) => {
const layoutProperties = Object.keys(spec[`layout_${layerType}`]).reduce((memo, name) => {
@@ -614,3 +615,9 @@ fs.writeFileSync(`platform/macos/docs/guides/For Style Authors.md`, guideMD({
renamedProperties: renamedPropertiesByLayerType,
layers: layers,
}));
fs.writeFileSync(`platform/ios/docs/guides/Data-Driven Styling.md`, ddsGuideMD({
os: 'iOS',
}));
fs.writeFileSync(`platform/macos/docs/guides/Data-Driven Styling.md`, ddsGuideMD({
os: 'macOS',
}));

View File

@@ -30,7 +30,6 @@ NS_ASSUME_NONNULL_BEGIN
redundant to the given object is replaced by the given object.
@param info The info object to add to the receiver.
@return True if the given info object was added to the receiver.
*/
- (void)growArrayByAddingAttributionInfo:(MGLAttributionInfo *)info;

View File

@@ -1,5 +1,5 @@
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLFoundation.h"
#import "MGLStyleValue.h"
@@ -41,7 +41,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -60,7 +60,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -68,6 +68,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSColor *> *backgroundColor;
#endif
/**
The transition affecting any changes to this layer’s `backgroundColor` property.
This property corresponds to the `background-color-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition backgroundColorTransition;
/**
The opacity at which the background will be drawn.
@@ -77,13 +84,20 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *backgroundOpacity;
/**
The transition affecting any changes to this layer’s `backgroundOpacity` property.
This property corresponds to the `background-opacity-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition backgroundOpacityTransition;
/**
Name of image in style images to use for drawing an image background. For
seamless patterns, image width and height must be a factor of two (2, 4, 8,
@@ -91,12 +105,19 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSString *> *backgroundPattern;
/**
The transition affecting any changes to this layer’s `backgroundPattern` property.
This property corresponds to the `background-pattern-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition backgroundPatternTransition;
@end
NS_ASSUME_NONNULL_END

View File

@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLBackgroundStyleLayer.h"
@@ -101,6 +102,24 @@
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue);
}
- (void)setBackgroundColorTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setBackgroundColorTransition(options);
}
- (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;
}
- (void)setBackgroundOpacity:(MGLStyleValue<NSNumber *> *)backgroundOpacity {
MGLAssertStyleLayerIsValid();
@@ -118,6 +137,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setBackgroundOpacityTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setBackgroundOpacityTransition(options);
}
- (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;
}
- (void)setBackgroundPattern:(MGLStyleValue<NSString *> *)backgroundPattern {
MGLAssertStyleLayerIsValid();
@@ -135,5 +172,22 @@
return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
- (void)setBackgroundPatternTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setBackgroundPatternTransition(options);
}
- (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;
}
@end

View File

@@ -1,5 +1,5 @@
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLFoundation.h"
#import "MGLStyleValue.h"
@@ -91,7 +91,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -107,6 +107,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleBlur;
/**
The transition affecting any changes to this layer’s `circleBlur` property.
This property corresponds to the `circle-blur-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition circleBlurTransition;
#if TARGET_OS_IPHONE
/**
The fill color of the circle.
@@ -117,7 +124,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -142,7 +149,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -159,6 +166,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSColor *> *circleColor;
#endif
/**
The transition affecting any changes to this layer’s `circleColor` property.
This property corresponds to the `circle-color-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition circleColorTransition;
/**
The opacity at which the circle will be drawn.
@@ -168,7 +182,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -184,6 +198,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleOpacity;
/**
The transition affecting any changes to this layer’s `circleOpacity` property.
This property corresponds to the `circle-opacity-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition circleOpacityTransition;
/**
Circle radius.
@@ -195,7 +216,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -211,6 +232,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleRadius;
/**
The transition affecting any changes to this layer’s `circleRadius` property.
This property corresponds to the `circle-radius-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition circleRadiusTransition;
/**
Controls the scaling behavior of the circle when the map is pitched.
@@ -224,7 +252,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -242,7 +270,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -267,7 +295,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -284,6 +312,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSColor *> *circleStrokeColor;
#endif
/**
The transition affecting any changes to this layer’s `circleStrokeColor` property.
This property corresponds to the `circle-stroke-color-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition circleStrokeColorTransition;
/**
The opacity of the circle's stroke.
@@ -293,7 +328,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -309,6 +344,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleStrokeOpacity;
/**
The transition affecting any changes to this layer’s `circleStrokeOpacity` property.
This property corresponds to the `circle-stroke-opacity-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition circleStrokeOpacityTransition;
/**
The width of the circle's stroke. Strokes are placed outside of the
`circleRadius`.
@@ -321,7 +363,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -337,6 +379,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleStrokeWidth;
/**
The transition affecting any changes to this layer’s `circleStrokeWidth` property.
This property corresponds to the `circle-stroke-width-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition circleStrokeWidthTransition;
#if TARGET_OS_IPHONE
/**
The geometry's offset.
@@ -353,7 +402,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -375,7 +424,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -383,6 +432,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *circleTranslation;
#endif
/**
The transition affecting any changes to this layer’s `circleTranslation` property.
This property corresponds to the `circle-translate-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition circleTranslationTransition;
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *circleTranslate __attribute__((unavailable("Use circleTranslation instead.")));
/**
@@ -401,7 +457,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/

View File

@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLCircleStyleLayer.h"
@@ -151,6 +152,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setCircleBlurTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setCircleBlurTransition(options);
}
- (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;
}
- (void)setCircleColor:(MGLStyleValue<MGLColor *> *)circleColor {
MGLAssertStyleLayerIsValid();
@@ -168,6 +187,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setCircleColorTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setCircleColorTransition(options);
}
- (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;
}
- (void)setCircleOpacity:(MGLStyleValue<NSNumber *> *)circleOpacity {
MGLAssertStyleLayerIsValid();
@@ -185,6 +222,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setCircleOpacityTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setCircleOpacityTransition(options);
}
- (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;
}
- (void)setCircleRadius:(MGLStyleValue<NSNumber *> *)circleRadius {
MGLAssertStyleLayerIsValid();
@@ -202,6 +257,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setCircleRadiusTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setCircleRadiusTransition(options);
}
- (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;
}
- (void)setCircleScaleAlignment:(MGLStyleValue<NSValue *> *)circleScaleAlignment {
MGLAssertStyleLayerIsValid();
@@ -243,6 +316,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setCircleStrokeColorTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setCircleStrokeColorTransition(options);
}
- (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;
}
- (void)setCircleStrokeOpacity:(MGLStyleValue<NSNumber *> *)circleStrokeOpacity {
MGLAssertStyleLayerIsValid();
@@ -260,6 +351,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setCircleStrokeOpacityTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setCircleStrokeOpacityTransition(options);
}
- (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;
}
- (void)setCircleStrokeWidth:(MGLStyleValue<NSNumber *> *)circleStrokeWidth {
MGLAssertStyleLayerIsValid();
@@ -277,6 +386,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setCircleStrokeWidthTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setCircleStrokeWidthTransition(options);
}
- (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;
}
- (void)setCircleTranslation:(MGLStyleValue<NSValue *> *)circleTranslation {
MGLAssertStyleLayerIsValid();
@@ -294,6 +421,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
- (void)setCircleTranslationTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setCircleTranslateTransition(options);
}
- (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;
}
- (void)setCircleTranslate:(MGLStyleValue<NSValue *> *)circleTranslate {
}
@@ -325,7 +470,6 @@ namespace mbgl {
return self.circleTranslationAnchor;
}
@end
@implementation NSValue (MGLCircleStyleLayerAdditions)

View File

@@ -229,6 +229,12 @@ MGL_EXPORT
/**
An `MGLShapeCollectionFeature` object associates a shape collection with an
optional identifier and attributes.
`MGLShapeCollectionFeature` is most commonly used to add multiple shapes to a single
`MGLShapeSource`. Configure the appearance of an `MGLSource`’s shape collection
collectively using an `MGLSymbolStyleLayer` object, or use multiple instances of
`MGLCircleStyleLayer`, `MGLFillStyleLayer`, and `MGLLineStyleLayer` to
configure the appearance of each kind of shape inside the collection.
A shape collection feature is known as a
<a href="https://tools.ietf.org/html/rfc7946#section-3.3">feature collection</a>

View File

@@ -1,5 +1,5 @@
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLFoundation.h"
#import "MGLStyleValue.h"
@@ -67,7 +67,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -88,7 +88,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -116,7 +116,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -133,6 +133,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSColor *> *fillColor;
#endif
/**
The transition affecting any changes to this layer’s `fillColor` property.
This property corresponds to the `fill-color-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition fillColorTransition;
/**
The opacity of the entire fill layer. In contrast to the `fillColor`, this
value will also affect the 1pt stroke around the fill, if the stroke is used.
@@ -143,7 +150,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -159,6 +166,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *fillOpacity;
/**
The transition affecting any changes to this layer’s `fillOpacity` property.
This property corresponds to the `fill-opacity-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition fillOpacityTransition;
#if TARGET_OS_IPHONE
/**
The outline color of the fill. Matches the value of `fillColor` if unspecified.
@@ -169,7 +183,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -194,7 +208,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -211,18 +225,32 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSColor *> *fillOutlineColor;
#endif
/**
The transition affecting any changes to this layer’s `fillOutlineColor` property.
This property corresponds to the `fill-outline-color-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition fillOutlineColorTransition;
/**
Name of image in sprite to use for drawing image fills. For seamless patterns,
image width and height must be a factor of two (2, 4, 8, ..., 512).
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSString *> *fillPattern;
/**
The transition affecting any changes to this layer’s `fillPattern` property.
This property corresponds to the `fill-pattern-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition fillPatternTransition;
#if TARGET_OS_IPHONE
/**
The geometry's offset.
@@ -239,7 +267,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -261,7 +289,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -269,6 +297,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *fillTranslation;
#endif
/**
The transition affecting any changes to this layer’s `fillTranslation` property.
This property corresponds to the `fill-translate-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition fillTranslationTransition;
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *fillTranslate __attribute__((unavailable("Use fillTranslation instead.")));
/**
@@ -287,7 +322,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/

View File

@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLFillStyleLayer.h"
@@ -170,6 +171,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setFillColorTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setFillColorTransition(options);
}
- (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;
}
- (void)setFillOpacity:(MGLStyleValue<NSNumber *> *)fillOpacity {
MGLAssertStyleLayerIsValid();
@@ -187,6 +206,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setFillOpacityTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setFillOpacityTransition(options);
}
- (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;
}
- (void)setFillOutlineColor:(MGLStyleValue<MGLColor *> *)fillOutlineColor {
MGLAssertStyleLayerIsValid();
@@ -204,6 +241,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setFillOutlineColorTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setFillOutlineColorTransition(options);
}
- (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;
}
- (void)setFillPattern:(MGLStyleValue<NSString *> *)fillPattern {
MGLAssertStyleLayerIsValid();
@@ -221,6 +276,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
- (void)setFillPatternTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setFillPatternTransition(options);
}
- (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;
}
- (void)setFillTranslation:(MGLStyleValue<NSValue *> *)fillTranslation {
MGLAssertStyleLayerIsValid();
@@ -238,6 +311,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
- (void)setFillTranslationTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setFillTranslateTransition(options);
}
- (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;
}
- (void)setFillTranslate:(MGLStyleValue<NSValue *> *)fillTranslate {
}
@@ -269,7 +360,6 @@ namespace mbgl {
return self.fillTranslationAnchor;
}
@end
@implementation NSValue (MGLFillStyleLayerAdditions)

View File

@@ -1,5 +1,5 @@
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLFoundation.h"
#import "MGLStyleValue.h"
@@ -118,7 +118,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -133,7 +133,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -152,7 +152,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -172,7 +172,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -192,7 +192,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -208,6 +208,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineBlur;
/**
The transition affecting any changes to this layer’s `lineBlur` property.
This property corresponds to the `line-blur-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition lineBlurTransition;
#if TARGET_OS_IPHONE
/**
The color with which the line will be drawn.
@@ -221,7 +228,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -249,7 +256,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -266,6 +273,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSColor *> *lineColor;
#endif
/**
The transition affecting any changes to this layer’s `lineColor` property.
This property corresponds to the `line-color-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition lineColorTransition;
/**
Specifies the lengths of the alternating dashes and gaps that form the dash
pattern. The lengths are later scaled by the line width. To convert a dash
@@ -282,12 +296,19 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSArray<NSNumber *> *> *lineDashPattern;
/**
The transition affecting any changes to this layer’s `lineDashPattern` property.
This property corresponds to the `line-dasharray-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition lineDashPatternTransition;
@property (nonatomic, null_resettable) MGLStyleValue<NSArray<NSNumber *> *> *lineDasharray __attribute__((unavailable("Use lineDashPattern instead.")));
/**
@@ -302,7 +323,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -318,6 +339,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineGapWidth;
/**
The transition affecting any changes to this layer’s `lineGapWidth` property.
This property corresponds to the `line-gap-width-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition lineGapWidthTransition;
/**
The line's offset. For linear features, a positive value offsets the line to
the right, relative to the direction of the line, and a negative value to the
@@ -332,7 +360,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -348,6 +376,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineOffset;
/**
The transition affecting any changes to this layer’s `lineOffset` property.
This property corresponds to the `line-offset-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition lineOffsetTransition;
/**
The opacity at which the line will be drawn.
@@ -357,7 +392,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -373,18 +408,32 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineOpacity;
/**
The transition affecting any changes to this layer’s `lineOpacity` property.
This property corresponds to the `line-opacity-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition lineOpacityTransition;
/**
Name of image in style images to use for drawing image lines. For seamless
patterns, image width must be a factor of two (2, 4, 8, ..., 512).
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSString *> *linePattern;
/**
The transition affecting any changes to this layer’s `linePattern` property.
This property corresponds to the `line-pattern-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition linePatternTransition;
#if TARGET_OS_IPHONE
/**
The geometry's offset.
@@ -401,7 +450,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -423,7 +472,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -431,6 +480,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *lineTranslation;
#endif
/**
The transition affecting any changes to this layer’s `lineTranslation` property.
This property corresponds to the `line-translate-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition lineTranslationTransition;
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *lineTranslate __attribute__((unavailable("Use lineTranslation instead.")));
/**
@@ -449,7 +505,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -468,13 +524,20 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineWidth;
/**
The transition affecting any changes to this layer’s `lineWidth` property.
This property corresponds to the `line-width-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition lineWidthTransition;
@end
/**

View File

@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLLineStyleLayer.h"
@@ -228,6 +229,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setLineBlurTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setLineBlurTransition(options);
}
- (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;
}
- (void)setLineColor:(MGLStyleValue<MGLColor *> *)lineColor {
MGLAssertStyleLayerIsValid();
@@ -245,6 +264,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setLineColorTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setLineColorTransition(options);
}
- (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;
}
- (void)setLineDashPattern:(MGLStyleValue<NSArray<NSNumber *> *> *)lineDashPattern {
MGLAssertStyleLayerIsValid();
@@ -262,6 +299,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::vector<float>, NSArray<NSNumber *> *, float>().toStyleValue(propertyValue);
}
- (void)setLineDashPatternTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setLineDasharrayTransition(options);
}
- (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;
}
- (void)setLineDasharray:(MGLStyleValue<NSArray<NSNumber *> *> *)lineDasharray {
}
@@ -286,6 +341,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setLineGapWidthTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setLineGapWidthTransition(options);
}
- (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;
}
- (void)setLineOffset:(MGLStyleValue<NSNumber *> *)lineOffset {
MGLAssertStyleLayerIsValid();
@@ -303,6 +376,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setLineOffsetTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setLineOffsetTransition(options);
}
- (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;
}
- (void)setLineOpacity:(MGLStyleValue<NSNumber *> *)lineOpacity {
MGLAssertStyleLayerIsValid();
@@ -320,6 +411,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setLineOpacityTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setLineOpacityTransition(options);
}
- (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;
}
- (void)setLinePattern:(MGLStyleValue<NSString *> *)linePattern {
MGLAssertStyleLayerIsValid();
@@ -337,6 +446,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
- (void)setLinePatternTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setLinePatternTransition(options);
}
- (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;
}
- (void)setLineTranslation:(MGLStyleValue<NSValue *> *)lineTranslation {
MGLAssertStyleLayerIsValid();
@@ -354,6 +481,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
- (void)setLineTranslationTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setLineTranslateTransition(options);
}
- (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;
}
- (void)setLineTranslate:(MGLStyleValue<NSValue *> *)lineTranslate {
}
@@ -402,6 +547,23 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setLineWidthTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setLineWidthTransition(options);
}
- (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;
}
@end

View File

@@ -31,6 +31,7 @@ NSString * const MGLOfflinePackMaximumCountUserInfoKey = MGLOfflinePackUserInfoK
@property (nonatomic, strong, readwrite) NS_MUTABLE_ARRAY_OF(MGLOfflinePack *) *packs;
@property (nonatomic) mbgl::DefaultFileSource *mbglFileSource;
@property (nonatomic, getter=isPaused) BOOL paused;
@end
@@ -53,11 +54,19 @@ NSString * const MGLOfflinePackMaximumCountUserInfoKey = MGLOfflinePackUserInfoK
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
- (void)pauseFileSource:(__unused NSNotification *)notification {
if (self.isPaused) {
return;
}
_mbglFileSource->pause();
self.paused = YES;
}
- (void)unpauseFileSource:(__unused NSNotification *)notification {
if (!self.isPaused) {
return;
}
_mbglFileSource->resume();
self.paused = NO;
}
#endif

View File

@@ -48,6 +48,10 @@
@"coordinates": self.mgl_coordinates};
}
- (BOOL)isEqual:(id)other {
return self == other || ([other isKindOfClass:[MGLPolyline class]] && [super isEqual:other]);
}
@end
@interface MGLMultiPolyline ()

View File

@@ -1,5 +1,5 @@
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLFoundation.h"
#import "MGLStyleValue.h"
@@ -52,13 +52,20 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *maximumRasterBrightness;
/**
The transition affecting any changes to this layer’s `maximumRasterBrightness` property.
This property corresponds to the `raster-brightness-max-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition maximumRasterBrightnessTransition;
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterBrightnessMax __attribute__((unavailable("Use maximumRasterBrightness instead.")));
/**
@@ -75,13 +82,20 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *minimumRasterBrightness;
/**
The transition affecting any changes to this layer’s `minimumRasterBrightness` property.
This property corresponds to the `raster-brightness-min-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition minimumRasterBrightnessTransition;
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterBrightnessMin __attribute__((unavailable("Use minimumRasterBrightness instead.")));
/**
@@ -93,13 +107,20 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterContrast;
/**
The transition affecting any changes to this layer’s `rasterContrast` property.
This property corresponds to the `raster-contrast-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition rasterContrastTransition;
/**
Fade duration when a new tile is added.
@@ -111,13 +132,20 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterFadeDuration;
/**
The transition affecting any changes to this layer’s `rasterFadeDuration` property.
This property corresponds to the `raster-fade-duration-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition rasterFadeDurationTransition;
/**
Rotates hues around the color wheel.
@@ -133,13 +161,20 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterHueRotation;
/**
The transition affecting any changes to this layer’s `rasterHueRotation` property.
This property corresponds to the `raster-hue-rotate-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition rasterHueRotationTransition;
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterHueRotate __attribute__((unavailable("Use rasterHueRotation instead.")));
/**
@@ -151,13 +186,20 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterOpacity;
/**
The transition affecting any changes to this layer’s `rasterOpacity` property.
This property corresponds to the `raster-opacity-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition rasterOpacityTransition;
/**
Increase or reduce the saturation of the image.
@@ -167,13 +209,20 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterSaturation;
/**
The transition affecting any changes to this layer’s `rasterSaturation` property.
This property corresponds to the `raster-saturation-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition rasterSaturationTransition;
@end
NS_ASSUME_NONNULL_END

View File

@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLRasterStyleLayer.h"
@@ -108,6 +109,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setMaximumRasterBrightnessTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setRasterBrightnessMaxTransition(options);
}
- (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;
}
- (void)setRasterBrightnessMax:(MGLStyleValue<NSNumber *> *)rasterBrightnessMax {
}
@@ -132,6 +151,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setMinimumRasterBrightnessTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setRasterBrightnessMinTransition(options);
}
- (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;
}
- (void)setRasterBrightnessMin:(MGLStyleValue<NSNumber *> *)rasterBrightnessMin {
}
@@ -156,6 +193,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setRasterContrastTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setRasterContrastTransition(options);
}
- (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;
}
- (void)setRasterFadeDuration:(MGLStyleValue<NSNumber *> *)rasterFadeDuration {
MGLAssertStyleLayerIsValid();
@@ -173,6 +228,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setRasterFadeDurationTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setRasterFadeDurationTransition(options);
}
- (MGLTransition)rasterFadeDurationTransition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterFadeDurationTransition();
MGLTransition transition;
transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
return transition;
}
- (void)setRasterHueRotation:(MGLStyleValue<NSNumber *> *)rasterHueRotation {
MGLAssertStyleLayerIsValid();
@@ -190,6 +263,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setRasterHueRotationTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setRasterHueRotateTransition(options);
}
- (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;
}
- (void)setRasterHueRotate:(MGLStyleValue<NSNumber *> *)rasterHueRotate {
}
@@ -214,6 +305,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setRasterOpacityTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setRasterOpacityTransition(options);
}
- (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;
}
- (void)setRasterSaturation:(MGLStyleValue<NSNumber *> *)rasterSaturation {
MGLAssertStyleLayerIsValid();
@@ -231,5 +340,22 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setRasterSaturationTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setRasterSaturationTransition(options);
}
- (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;
}
@end

View File

@@ -211,18 +211,32 @@ MGL_EXPORT
@property (nonatomic, copy, nullable) NSURL *URL;
/**
Returns an array of map features for this source, filtered by the given predicate.
Returns an array of map features for this source, filtered by the given
predicate.
Each object in the returned array represents a feature for the current style
and provides access to attributes specified by the source
and provides access to attributes specified via the `shape` property.
Features come from tiled GeoJSON data that is converted to tiles internally,
so feature geometries are clipped at tile boundaries and features
may appear duplicated across tiles.
may appear duplicated across tiles. For example, suppose this source contains a
long polyline representing a road. The resulting array includes those parts of
the road that lie within the map tiles that the source has loaded, even if the
road extends into other tiles. The portion of the road within each map tile is
included individually.
Returned features may not necessarily be visible to the user at the time they
are loaded: the style may lack a layer that draws the features in question. To
obtain only _visible_ features, use the
`-[MGLMapView visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:predicate:]`
or
`-[MGLMapView visibleFeaturesInRect:inStyleLayersWithIdentifiers:predicate:]`
method.
@param predicate A predicate to filter the returned features.
@param predicate A predicate to filter the returned features. Use `nil` to
include all features in the source.
@return An array of objects conforming to the `MGLFeature` protocol that
represent features in the sources used by the current style.
represent features in the source that match the predicate.
*/
- (NS_ARRAY_OF(id <MGLFeature>) *)featuresMatchingPredicate:(nullable NSPredicate *)predicate;

View File

@@ -193,6 +193,12 @@ MGL_EXPORT
*/
@property (nonatomic, strong) NS_SET_OF(__kindof MGLSource *) *sources;
/**
Values describing animated transitions to changes on a style's individual
paint properties.
*/
@property (nonatomic) MGLTransition transition;
/**
Returns a source with the given identifier in the current style.
@@ -442,22 +448,6 @@ MGL_EXPORT
*/
- (void)removeImageForName:(NSString *)name;
#pragma mark Managing a Style’s Transition Options
/**
The duration in seconds to animate any changes to the style URL or to layout and paint attributes.
By default, this property is set to zero seconds, so any changes take effect without animation.
*/
@property (nonatomic) NSTimeInterval transitionDuration;
/**
The delay in seconds to before applying any changes to the style URL or to layout and paint attributes.
By default, this property is set to zero seconds, so any changes begin to animate immediately.
*/
@property (nonatomic) NSTimeInterval transitionDelay;
@end
NS_ASSUME_NONNULL_END

View File

@@ -341,10 +341,10 @@ static NSURL *MGLStyleURL_emerald;
styleLayer = [[MGLCircleStyleLayer alloc] initWithIdentifier:identifier source:source];
} else if (mbglLayer->is<mbgl::style::BackgroundLayer>()) {
styleLayer = [[MGLBackgroundStyleLayer alloc] initWithIdentifier:identifier];
} else if (auto customLayer = mbglLayer->as<mbgl::style::CustomLayer>()) {
} else if (mbglLayer->is<mbgl::style::CustomLayer>()) {
styleLayer = self.openGLLayers[identifier];
if (styleLayer) {
NSAssert(styleLayer.rawLayer == customLayer, @"%@ wraps a CustomLayer that differs from the one associated with the underlying style.", styleLayer);
NSAssert(styleLayer.rawLayer == mbglLayer->as<mbgl::style::CustomLayer>(), @"%@ wraps a CustomLayer that differs from the one associated with the underlying style.", styleLayer);
return styleLayer;
}
styleLayer = [[MGLOpenGLStyleLayer alloc] initWithIdentifier:identifier];
@@ -502,7 +502,7 @@ static NSURL *MGLStyleURL_emerald;
newAppliedClasses.push_back([appliedClass UTF8String]);
}
mbgl::style::TransitionOptions transition { { MGLDurationInSecondsFromTimeInterval(transitionDuration) } };
mbgl::style::TransitionOptions transition { { MGLDurationFromTimeInterval(transitionDuration) } };
self.mapView.mbglMap->setTransitionOptions(transition);
self.mapView.mbglMap->setClasses(newAppliedClasses);
}
@@ -572,30 +572,24 @@ static NSURL *MGLStyleURL_emerald;
#pragma mark Style transitions
- (void)setTransitionDuration:(NSTimeInterval)duration
- (void)setTransition:(MGLTransition)transition
{
auto transitionOptions = self.mapView.mbglMap->getTransitionOptions();
transitionOptions.duration = MGLDurationInSecondsFromTimeInterval(duration);
transitionOptions.duration = MGLDurationFromTimeInterval(transition.duration);
transitionOptions.delay = MGLDurationFromTimeInterval(transition.delay);
self.mapView.mbglMap->setTransitionOptions(transitionOptions);
}
- (NSTimeInterval)transitionDuration
- (MGLTransition)transition
{
MGLTransition transition;
const mbgl::style::TransitionOptions transitionOptions = self.mapView.mbglMap->getTransitionOptions();
return MGLTimeIntervalFromDurationInSeconds(transitionOptions.duration.value_or(mbgl::Duration::zero()));
}
- (void)setTransitionDelay:(NSTimeInterval)delay
{
auto transitionOptions = self.mapView.mbglMap->getTransitionOptions();
transitionOptions.delay = MGLDurationInSecondsFromTimeInterval(delay);
self.mapView.mbglMap->setTransitionOptions(transitionOptions);
}
- (NSTimeInterval)transitionDelay
{
const mbgl::style::TransitionOptions transitionOptions = self.mapView.mbglMap->getTransitionOptions();
return MGLTimeIntervalFromDurationInSeconds(transitionOptions.delay.value_or(mbgl::Duration::zero()));
transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
return transition;
}
- (NSString *)description

View File

@@ -18,6 +18,9 @@ NS_ASSUME_NONNULL_BEGIN
subclasses of this class. Instead, create instances of
`MGLBackgroundStyleLayer` and the concrete subclasses of
`MGLForegroundStyleLayer`.
Do not add `MGLStyleLayer` objects to the `style` property of a `MGLMapView` before
`-mapView:didFinishLoadingStyle:` is called.
*/
MGL_EXPORT
@interface MGLStyleLayer : NSObject

View File

@@ -6,7 +6,7 @@
const enumProperties = locals.enumProperties;
-%>
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLFoundation.h"
#import "MGLStyleValue.h"
@@ -111,6 +111,15 @@ MGL_EXPORT
*/
@property (nonatomic<% if (!property.required) { %>, null_resettable<% } if (property.getter) { %>, getter=<%- objCGetter(property) -%><% } %>) MGLStyleValue<<%- propertyType(property, true) %>> *<%- camelizeWithLeadingLowercase(property.name) %>;
<% if (property["transition"]) { -%>
/**
The transition affecting any changes to this layer’s `<%- camelizeWithLeadingLowercase(property.name) %>` property.
This property corresponds to the `<%- originalPropertyName(property) %>-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition <%- camelizeWithLeadingLowercase(property.name) %>Transition;
<% } -%>
<% if (property.original) { -%>
@property (nonatomic<% if (!property.required) { %>, null_resettable<% } %>) MGLStyleValue<<%- propertyType(property, true) %>> *<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %> __attribute__((unavailable("Use <%- camelizeWithLeadingLowercase(property.name) %> instead.")));

View File

@@ -10,6 +10,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGL<%- camelize(type) %>StyleLayer.h"
@@ -228,8 +229,8 @@ namespace mbgl {
<% } -%>
<% if (paintProperties.length) { -%>
#pragma mark - Accessing the Paint Attributes
<% for (const property of paintProperties) { -%>
- (void)set<%- camelize(property.name) %>:(MGLStyleValue<<%- propertyType(property, true) %>> *)<%- objCName(property) %> {
MGLAssertStyleLayerIsValid();
@@ -270,15 +271,34 @@ namespace mbgl {
<% } -%>
<% } -%>
}
<% if (property["transition"]) { -%>
- (void)set<%- camelize(property.name) %>Transition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->set<%- camelize(originalPropertyName(property)) %>Transition(options);
}
- (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;
}
<% } -%>
<% if (property.original) { -%>
- (void)set<%- camelize(originalPropertyName(property)) %>:(MGLStyleValue<<%- propertyType(property, true) %>> *)<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %> {
}
- (MGLStyleValue<<%- propertyType(property, true) %>> *)<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %> {
return self.<%- objCGetter(property) %>;
}
<% } -%>
<% } -%>
<% } -%>

View File

@@ -17,10 +17,10 @@ typedef NSString *MGLStyleFunctionOption NS_STRING_ENUM;
The exponential interpolation base controls the rate at which the function’s
output values increase. A value of 1 causes the function to increase linearly
by zoom level. A higher exponential interpolation base causes the function’s
output values to vary exponentially, increasing more rapidly towards the high
end of the function’s range. The default value of this property is 1, for a
linear curve.
based on zoom level or attribute value. A higher exponential interpolation base
causes the function’s output values to vary exponentially, increasing more rapidly
towards the high end of the function’s range. The default value of this property
is 1, for a linear curve.
This attribute corresponds to the
<a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#function-base"><code>base</code></a>
@@ -33,7 +33,7 @@ typedef NSString *MGLStyleFunctionOption NS_STRING_ENUM;
extern MGL_EXPORT const MGLStyleFunctionOption MGLStyleFunctionOptionInterpolationBase;
/**
An `MGLStyleConstantValue` object that specifies a default value that a style
An `MGLConstantStyleValue` object that specifies a default value that a style
function can use when it can't otherwise determine a value.
A default value can be used to set the value of a style layer property that
@@ -54,23 +54,30 @@ extern MGL_EXPORT const MGLStyleFunctionOption MGLStyleFunctionOptionDefaultValu
*/
typedef NS_ENUM(NSUInteger, MGLInterpolationMode) {
/**
Values between two stops are interpolated exponentially or linearly if the
`MGLStyleFunctionOptionInterpolationBase` is 1.
Values between two stops are interpolated linearly, or exponentially based on
the `MGLStyleFunctionOptionInterpolationBase`. A higher interpolation base
causes the function’s output values to vary exponentially, increasing more rapidly
towards the high end of the function’s range. The default interpolation base of 1
creates a linear interpolation. Use exponential interpolation mode to show values
relative to stop keys.
*/
MGLInterpolationModeExponential = 0,
/**
Values between two stops are not interpolated. Instead, properties are set
to the value of the stop just less than the function input.
to the value of the stop just less than the function input. Use interval
interpolation mode to show values that fall within a range.
*/
MGLInterpolationModeInterval,
/**
Values between two stops are not interpolated. Instead, properties are set
to the value of the stop equal to the function input's key value.
to the value of the stop equal to the function input's key value. Use
categorical interpolation mode to show values that fit into categories.
*/
MGLInterpolationModeCategorical,
/**
Values between two stops are not interpolated. Instead, values are set
to their input value.
Values between two stops are not interpolated. Instead, values are set to their
input value. Use identity interpolation mode to show attribute values that can be
used as style values.
*/
MGLInterpolationModeIdentity
};
@@ -81,7 +88,7 @@ typedef NS_ENUM(NSUInteger, MGLInterpolationMode) {
`MGLStyleValue` objects.
The `MGLStyleValue` class itself represents a class cluster. Under the hood, a
particular `MGLStyleValue` object may be either an `MGLStyleConstantValue` to
particular `MGLStyleValue` object may be either an `MGLConstantStyleValue` to
represent a constant value or one of the concrete subclasses of
`MGLStyleFunction` to represent a value function. Do not initialize an
`MGLStyleValue` object directly; instead, use one of the class factory methods
@@ -104,10 +111,10 @@ MGL_EXPORT
#pragma mark Creating a Style Value
/**
Creates and returns an `MGLStyleConstantValue` object containing a raw value.
Creates and returns an `MGLConstantStyleValue` object containing a raw value.
@param rawValue The constant value contained by the object.
@return An `MGLStyleConstantValue` object containing `rawValue`, which is
@return An `MGLConstantStyleValue` object containing `rawValue`, which is
treated as a constant value.
*/
+ (instancetype)valueWithRawValue:(T)rawValue;
@@ -168,7 +175,8 @@ MGL_EXPORT
@param interpolationMode The mode used to interpolate property values over a
range of feature attribute values for each outer zoom level.
@param sourceStops A dictionary associating feature attributes with style values.
@param compositeStops A dictionary associating feature attributes with style
values.
@param attributeName Specifies the feature attribute to take as the function
input.
@param options A dictionary containing `MGLStyleFunctionOption` values that
@@ -181,24 +189,24 @@ MGL_EXPORT
@end
/**
An `MGLStyleConstantValue` object is a generic container for a style attribute
An `MGLConstantStyleValue` object is a generic container for a style attribute
value that remains constant as the zoom level changes. The layout and paint
attribute properties of `MGLStyleLayer` objects can be set to
`MGLStyleConstantValue` objects.
`MGLConstantStyleValue` objects.
The `MGLStyleConstantValue` class takes a generic parameter `T` that indicates
The `MGLConstantStyleValue` class takes a generic parameter `T` that indicates
the Foundation class being wrapped by this class.
*/
MGL_EXPORT
@interface MGLStyleConstantValue<T> : MGLStyleValue<T>
@interface MGLConstantStyleValue<T> : MGLStyleValue<T>
#pragma mark Creating a Style Constant Value
/**
Creates and returns an `MGLStyleConstantValue` object containing a raw value.
Creates and returns an `MGLConstantStyleValue` object containing a raw value.
@param rawValue The constant value contained by the object.
@return An `MGLStyleConstantValue` object containing `rawValue`, which is
@return An `MGLConstantStyleValue` object containing `rawValue`, which is
treated as a constant value.
*/
+ (instancetype)valueWithRawValue:(T)rawValue;
@@ -208,10 +216,10 @@ MGL_EXPORT
- (instancetype)init NS_UNAVAILABLE;
/**
Returns an `MGLStyleConstantValue` object containing a raw value.
Returns an `MGLConstantStyleValue` object containing a raw value.
@param rawValue The value contained by the receiver.
@return An `MGLStyleConstantValue` object containing `rawValue`.
@return An `MGLConstantStyleValue` object containing `rawValue`.
*/
- (instancetype)initWithRawValue:(T)rawValue NS_DESIGNATED_INITIALIZER;
@@ -224,6 +232,8 @@ MGL_EXPORT
@end
@compatibility_alias MGLStyleConstantValue MGLConstantStyleValue;
/**
An `MGLStyleFunction` is a is an abstract superclass for functions that are
defined by an `MGLCameraStyleFunction`, `MGLSourceStyleFunction`, or
@@ -378,7 +388,7 @@ MGL_EXPORT
@param interpolationMode The mode used to interpolate property values over a
range of feature attribute values.
@param sourceStops A dictionary associating feature attributes with style values.
@param stops A dictionary associating feature attributes with style values.
@param attributeName Specifies the feature attribute to take as the function
input.
@param options A dictionary containing `MGLStyleFunctionOption` values that
@@ -438,7 +448,7 @@ MGL_EXPORT
@param interpolationMode The mode used to interpolate property values over a
range of feature attribute values for each outer zoom level.
@param sourceStops A dictionary associating feature attributes with style values.
@param stops A dictionary associating feature attributes with style values.
@param attributeName Specifies the feature attribute to take as the function
input.
@param options A dictionary containing `MGLStyleFunctionOption` values that

View File

@@ -6,7 +6,7 @@ const MGLStyleFunctionOption MGLStyleFunctionOptionDefaultValue = @"MGLStyleFunc
@implementation MGLStyleValue
+ (instancetype)valueWithRawValue:(id)rawValue {
return [MGLStyleConstantValue valueWithRawValue:rawValue];
return [MGLConstantStyleValue valueWithRawValue:rawValue];
}
+ (instancetype)valueWithInterpolationBase:(CGFloat)interpolationBase stops:(NSDictionary *)stops {
@@ -31,7 +31,7 @@ const MGLStyleFunctionOption MGLStyleFunctionOptionDefaultValue = @"MGLStyleFunc
@end
@implementation MGLStyleConstantValue
@implementation MGLConstantStyleValue
+ (instancetype)valueWithRawValue:(id)rawValue {
return [[self alloc] initWithRawValue:rawValue];
@@ -52,7 +52,7 @@ const MGLStyleFunctionOption MGLStyleFunctionOptionDefaultValue = @"MGLStyleFunc
return [self.rawValue debugDescription];
}
- (BOOL)isEqual:(MGLStyleConstantValue *)other {
- (BOOL)isEqual:(MGLConstantStyleValue *)other {
return [other isKindOfClass:[self class]] && [other.rawValue isEqual:self.rawValue];
}

View File

@@ -51,12 +51,12 @@ public:
mbgl::style::PropertyValue<MBGLType> toPropertyValue(MGLStyleValue<ObjCType> *value) {
if ([value isKindOfClass:[MGLSourceStyleFunction class]] || [value isKindOfClass:[MGLCompositeStyleFunction class]]) {
[NSException raise:NSInvalidArgumentException
format:@"This property can only be set to camera functions. Use +[MGLStyleValue cameraFunctionValueWithinterpolationMode:stops:options:] instead."];
format:@"This property can only be set to camera functions. Use +[MGLStyleValue valueWithInterpolationMode:cameraStops:options:] instead."];
return {};
}
if ([value isKindOfClass:[MGLStyleConstantValue class]]) {
return toMBGLConstantValue((MGLStyleConstantValue<ObjCType> *)value);
if ([value isKindOfClass:[MGLConstantStyleValue class]]) {
return toMBGLConstantValue((MGLConstantStyleValue<ObjCType> *)value);
} else if ([value isKindOfClass:[MGLCameraStyleFunction class]]) {
MGLCameraStyleFunction<ObjCType> *cameraStyleFunction = (MGLCameraStyleFunction<ObjCType> *)value;
// Intentionally ignore the stop type set by the developer becuase non interpolatable property values
@@ -82,12 +82,12 @@ public:
mbgl::style::PropertyValue<MBGLType> toInterpolatablePropertyValue(MGLStyleValue<ObjCType> *value) {
if ([value isKindOfClass:[MGLSourceStyleFunction class]] || [value isKindOfClass:[MGLCompositeStyleFunction class]]) {
[NSException raise:NSInvalidArgumentException
format:@"This property can only be set to camera functions. Use +[MGLStyleValue cameraFunctionValueWithinterpolationMode:stops:options:] instead."];
format:@"This property can only be set to camera functions. Use +[MGLStyleValue valueWithInterpolationMode:cameraStops:options:] instead."];
return {};
}
if ([value isKindOfClass:[MGLStyleConstantValue class]]) {
return toMBGLConstantValue((MGLStyleConstantValue<ObjCType> *)value);
if ([value isKindOfClass:[MGLConstantStyleValue class]]) {
return toMBGLConstantValue((MGLConstantStyleValue<ObjCType> *)value);
} else if ([value isMemberOfClass:[MGLStyleFunction class]]) {
MGLStyleFunction<ObjCType> *styleFunction = (MGLStyleFunction<ObjCType> *)value;
return toMBGLExponentialCameraFunction(styleFunction);
@@ -119,8 +119,8 @@ public:
// Convert an mgl style value into a mbgl data driven property value
mbgl::style::DataDrivenPropertyValue<MBGLType> toDataDrivenPropertyValue(MGLStyleValue<ObjCType> *value) {
if ([value isKindOfClass:[MGLStyleConstantValue class]]) {
return toMBGLConstantValue((MGLStyleConstantValue<ObjCType> *)value);
if ([value isKindOfClass:[MGLConstantStyleValue class]]) {
return toMBGLConstantValue((MGLConstantStyleValue<ObjCType> *)value);
} else if ([value isKindOfClass:[MGLStyleFunction class]]) {
auto rawValue = toRawStyleSpecValue((MGLStyleFunction<ObjCType> *) value);
auto result = mbgl::style::conversion::convert<mbgl::style::DataDrivenPropertyValue<MBGLType>>(rawValue);
@@ -139,13 +139,13 @@ public:
mbgl::style::PropertyValue<MBGLEnum> toEnumPropertyValue(MGLStyleValue<ObjCType> *value) {
if ([value isKindOfClass:[MGLSourceStyleFunction class]] || [value isKindOfClass:[MGLCompositeStyleFunction class]]) {
[NSException raise:NSInvalidArgumentException
format:@"This property can only be set to camera functions. Use +[MGLStyleValue cameraFunctionValueWithinterpolationMode:stops:options:] instead."];
format:@"This property can only be set to camera functions. Use +[MGLStyleValue valueWithInterpolationMode:cameraStops:options:] instead."];
return {};
}
if ([value isKindOfClass:[MGLStyleConstantValue class]]) {
if ([value isKindOfClass:[MGLConstantStyleValue class]]) {
MBGLEnum mbglValue;
getMBGLValue([(MGLStyleConstantValue<ObjCType> *)value rawValue], mbglValue);
getMBGLValue([(MGLConstantStyleValue<ObjCType> *)value rawValue], mbglValue);
return mbglValue;
} else if ([value isKindOfClass:[MGLCameraStyleFunction class]]) {
MGLCameraStyleFunction<NSValue *> *cameraStyleFunction = (MGLCameraStyleFunction<NSValue *> *)value;
@@ -175,7 +175,7 @@ public:
private: // Private utilities for converting from mgl to mbgl values
MBGLType toMBGLConstantValue(MGLStyleConstantValue<ObjCType> *value) {
MBGLType toMBGLConstantValue(MGLConstantStyleValue<ObjCType> *value) {
MBGLType mbglValue;
getMBGLValue(value.rawValue, mbglValue);
return mbglValue;
@@ -245,7 +245,7 @@ private: // Private utilities for converting from mgl to mbgl values
if ([styleFunction isKindOfClass:[MGLCameraStyleFunction class]]) {
// zoom-only function (no default value)
__block NSMutableArray *stops = [[NSMutableArray alloc] init];
[styleFunction.stops enumerateKeysAndObjectsUsingBlock:^(NSNumber * _Nonnull zoomKey, MGLStyleConstantValue<ObjCType> * _Nonnull outputValue, BOOL * _Nonnull stop) {
[styleFunction.stops enumerateKeysAndObjectsUsingBlock:^(NSNumber * _Nonnull zoomKey, MGLConstantStyleValue<ObjCType> * _Nonnull outputValue, BOOL * _Nonnull stop) {
MBGLType dummyMbglValue;
NSArray *rawStop = @[zoomKey, toRawStyleSpecValue([outputValue rawValue], dummyMbglValue)];
[stops addObject:rawStop];
@@ -257,7 +257,7 @@ private: // Private utilities for converting from mgl to mbgl values
rawFunction[@"property"] = sourceStyleFunction.attributeName;
// property-only function
__block NSMutableArray *stops = [[NSMutableArray alloc] init];
[styleFunction.stops enumerateKeysAndObjectsUsingBlock:^(NSObject * _Nonnull propertyKey, MGLStyleConstantValue<ObjCType> * _Nonnull outputValue, BOOL * _Nonnull stop) {
[styleFunction.stops enumerateKeysAndObjectsUsingBlock:^(NSObject * _Nonnull propertyKey, MGLConstantStyleValue<ObjCType> * _Nonnull outputValue, BOOL * _Nonnull stop) {
MBGLType dummyMbglValue;
NSArray *rawStop = @[propertyKey, toRawStyleSpecValue([outputValue rawValue], dummyMbglValue)];
[stops addObject:rawStop];
@@ -266,9 +266,9 @@ private: // Private utilities for converting from mgl to mbgl values
// defaultValue => default
if (sourceStyleFunction.defaultValue) {
NSCAssert([sourceStyleFunction.defaultValue isKindOfClass:[MGLStyleConstantValue class]], @"Default value must be constant");
NSCAssert([sourceStyleFunction.defaultValue isKindOfClass:[MGLConstantStyleValue class]], @"Default value must be constant");
MBGLType dummyMbglValue;
rawFunction[@"default"] = toRawStyleSpecValue([(MGLStyleConstantValue<ObjCType> *)sourceStyleFunction.defaultValue rawValue], dummyMbglValue);
rawFunction[@"default"] = toRawStyleSpecValue([(MGLConstantStyleValue<ObjCType> *)sourceStyleFunction.defaultValue rawValue], dummyMbglValue);
}
} else if ([styleFunction isKindOfClass:[MGLCompositeStyleFunction class]]) {
// zoom-and-property function
@@ -282,8 +282,8 @@ private: // Private utilities for converting from mgl to mbgl values
@"zoom": zoomKey,
@"value": valueKey
};
MGLStyleConstantValue<ObjCType> *outputValue = stopValue[valueKey];
NSCAssert([outputValue isKindOfClass:[MGLStyleConstantValue<ObjCType> class]], @"Stop outputs should be MGLStyleConstantValues");
MGLConstantStyleValue<ObjCType> *outputValue = stopValue[valueKey];
NSCAssert([outputValue isKindOfClass:[MGLConstantStyleValue<ObjCType> class]], @"Stop outputs should be MGLConstantStyleValues");
MBGLType dummyMbglValue;
NSArray *rawStop = @[stopKey, toRawStyleSpecValue([outputValue rawValue], dummyMbglValue)];
[stops addObject:rawStop];
@@ -293,9 +293,9 @@ private: // Private utilities for converting from mgl to mbgl values
// defaultValue => default
if (compositeStyleFunction.defaultValue) {
NSCAssert([compositeStyleFunction.defaultValue isKindOfClass:[MGLStyleConstantValue class]], @"Default value must be constant");
NSCAssert([compositeStyleFunction.defaultValue isKindOfClass:[MGLConstantStyleValue class]], @"Default value must be constant");
MBGLType dummyMbglValue;
rawFunction[@"default"] = toRawStyleSpecValue([(MGLStyleConstantValue<ObjCType> *)compositeStyleFunction.defaultValue rawValue], dummyMbglValue);
rawFunction[@"default"] = toRawStyleSpecValue([(MGLConstantStyleValue<ObjCType> *)compositeStyleFunction.defaultValue rawValue], dummyMbglValue);
}
}
@@ -367,9 +367,9 @@ private: // Private utilities for converting from mgl to mbgl values
void setDefaultMBGLValue(MGLSourceStyleFunction<ObjCType> *sourceStyleFunction, mbgl::style::SourceFunction<MBGLType> &sourceFunction) {
if (sourceStyleFunction.defaultValue) {
NSCAssert([sourceStyleFunction.defaultValue isKindOfClass:[MGLStyleConstantValue class]], @"Default value must be constant");
NSCAssert([sourceStyleFunction.defaultValue isKindOfClass:[MGLConstantStyleValue class]], @"Default value must be constant");
MBGLType mbglValue;
id mglValue = [(MGLStyleConstantValue<ObjCType> *)sourceStyleFunction.defaultValue rawValue];
id mglValue = [(MGLConstantStyleValue<ObjCType> *)sourceStyleFunction.defaultValue rawValue];
getMBGLValue(mglValue, mbglValue);
sourceFunction.defaultValue = mbglValue;
}
@@ -518,7 +518,7 @@ private: // Private utilities for converting from mbgl to mgl values
id operator()(const MBGLEnum &value) const {
auto str = mbgl::Enum<MBGLEnum>::toString(value);
MGLEnum mglType = *mbgl::Enum<MGLEnum>::toEnum(str);
return [MGLStyleConstantValue<ObjCType> valueWithRawValue:[NSValue value:&mglType withObjCType:@encode(MGLEnum)]];
return [MGLConstantStyleValue<ObjCType> valueWithRawValue:[NSValue value:&mglType withObjCType:@encode(MGLEnum)]];
}
id operator()(const mbgl::style::CameraFunction<MBGLEnum> &mbglValue) const {
@@ -671,7 +671,7 @@ private: // Private utilities for converting from mbgl to mgl values
id operator()(const MBGLType &value) const {
auto rawValue = toMGLRawStyleValue(value);
return [MGLStyleConstantValue<ObjCType> valueWithRawValue:rawValue];
return [MGLConstantStyleValue<ObjCType> valueWithRawValue:rawValue];
}
id operator()(const mbgl::style::CameraFunction<MBGLType> &mbglValue) const {

View File

@@ -1,5 +1,5 @@
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLFoundation.h"
#import "MGLStyleValue.h"
@@ -299,7 +299,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -324,7 +324,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -334,7 +334,8 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *iconIgnorePlacement __attribute__((unavailable("Use iconIgnoresPlacement instead.")));
/**
A string with {tokens} replaced, referencing the data property to pull from.
Name of image in sprite to use for drawing an image background. A string with
{tokens} replaced, referencing the data property to pull from.
This attribute corresponds to the <a
href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-icon-image"><code>icon-image</code></a>
@@ -342,7 +343,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -364,7 +365,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -392,7 +393,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -422,7 +423,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -443,7 +444,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -468,7 +469,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -500,7 +501,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -522,7 +523,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -544,7 +545,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -567,7 +568,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -590,7 +591,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -617,7 +618,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -646,7 +647,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -674,7 +675,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -702,7 +703,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -728,7 +729,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -746,7 +747,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -767,7 +768,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -788,7 +789,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -824,7 +825,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -845,7 +846,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -877,7 +878,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -904,7 +905,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -930,7 +931,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -955,7 +956,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -978,7 +979,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -999,7 +1000,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1021,7 +1022,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1042,7 +1043,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1063,7 +1064,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -1084,7 +1085,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1103,7 +1104,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -1127,7 +1128,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1150,7 +1151,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -1168,7 +1169,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1200,7 +1201,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1229,7 +1230,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1246,6 +1247,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSColor *> *iconColor;
#endif
/**
The transition affecting any changes to this layer’s `iconColor` property.
This property corresponds to the `icon-color-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition iconColorTransition;
/**
Fade out the halo towards the outside.
@@ -1260,7 +1268,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1276,6 +1284,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *iconHaloBlur;
/**
The transition affecting any changes to this layer’s `iconHaloBlur` property.
This property corresponds to the `icon-halo-blur-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition iconHaloBlurTransition;
#if TARGET_OS_IPHONE
/**
The color of the icon’s halo. The `iconImageName` property must be set to a
@@ -1290,7 +1305,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1319,7 +1334,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1336,6 +1351,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSColor *> *iconHaloColor;
#endif
/**
The transition affecting any changes to this layer’s `iconHaloColor` property.
This property corresponds to the `icon-halo-color-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition iconHaloColorTransition;
/**
Distance of halo to the icon outline.
@@ -1350,7 +1372,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1366,6 +1388,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *iconHaloWidth;
/**
The transition affecting any changes to this layer’s `iconHaloWidth` property.
This property corresponds to the `icon-halo-width-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition iconHaloWidthTransition;
/**
The opacity at which the icon will be drawn.
@@ -1378,7 +1407,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1394,6 +1423,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *iconOpacity;
/**
The transition affecting any changes to this layer’s `iconOpacity` property.
This property corresponds to the `icon-opacity-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition iconOpacityTransition;
#if TARGET_OS_IPHONE
/**
Distance that the icon's anchor is moved from its original placement.
@@ -1413,7 +1449,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1438,7 +1474,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1446,6 +1482,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *iconTranslation;
#endif
/**
The transition affecting any changes to this layer’s `iconTranslation` property.
This property corresponds to the `icon-translate-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition iconTranslationTransition;
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *iconTranslate __attribute__((unavailable("Use iconTranslation instead.")));
/**
@@ -1464,7 +1507,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -1485,7 +1528,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1513,7 +1556,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1530,6 +1573,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSColor *> *textColor;
#endif
/**
The transition affecting any changes to this layer’s `textColor` property.
This property corresponds to the `text-color-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition textColorTransition;
/**
The halo's fadeout distance towards the outside.
@@ -1544,7 +1594,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1560,6 +1610,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textHaloBlur;
/**
The transition affecting any changes to this layer’s `textHaloBlur` property.
This property corresponds to the `text-halo-blur-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition textHaloBlurTransition;
#if TARGET_OS_IPHONE
/**
The color of the text's halo, which helps it stand out from backgrounds.
@@ -1573,7 +1630,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1601,7 +1658,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1618,6 +1675,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSColor *> *textHaloColor;
#endif
/**
The transition affecting any changes to this layer’s `textHaloColor` property.
This property corresponds to the `text-halo-color-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition textHaloColorTransition;
/**
Distance of halo to the font outline. Max text halo width is 1/4 of the
font-size.
@@ -1633,7 +1697,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1649,6 +1713,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textHaloWidth;
/**
The transition affecting any changes to this layer’s `textHaloWidth` property.
This property corresponds to the `text-halo-width-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition textHaloWidthTransition;
/**
The opacity at which the text will be drawn.
@@ -1661,7 +1732,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1677,6 +1748,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textOpacity;
/**
The transition affecting any changes to this layer’s `textOpacity` property.
This property corresponds to the `text-opacity-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition textOpacityTransition;
#if TARGET_OS_IPHONE
/**
Distance that the text's anchor is moved from its original placement.
@@ -1696,7 +1774,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1721,7 +1799,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1729,6 +1807,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *textTranslation;
#endif
/**
The transition affecting any changes to this layer’s `textTranslation` property.
This property corresponds to the `text-translate-transition` property in the style JSON file format.
*/
@property (nonatomic) MGLTransition textTranslationTransition;
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *textTranslate __attribute__((unavailable("Use textTranslation instead.")));
/**
@@ -1747,7 +1832,7 @@ MGL_EXPORT
You can set this property to an instance of:
* `MGLStyleConstantValue`
* `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/

View File

@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLSymbolStyleLayer.h"
@@ -904,6 +905,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setIconColorTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setIconColorTransition(options);
}
- (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;
}
- (void)setIconHaloBlur:(MGLStyleValue<NSNumber *> *)iconHaloBlur {
MGLAssertStyleLayerIsValid();
@@ -921,6 +940,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setIconHaloBlurTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setIconHaloBlurTransition(options);
}
- (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;
}
- (void)setIconHaloColor:(MGLStyleValue<MGLColor *> *)iconHaloColor {
MGLAssertStyleLayerIsValid();
@@ -938,6 +975,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setIconHaloColorTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setIconHaloColorTransition(options);
}
- (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;
}
- (void)setIconHaloWidth:(MGLStyleValue<NSNumber *> *)iconHaloWidth {
MGLAssertStyleLayerIsValid();
@@ -955,6 +1010,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setIconHaloWidthTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setIconHaloWidthTransition(options);
}
- (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;
}
- (void)setIconOpacity:(MGLStyleValue<NSNumber *> *)iconOpacity {
MGLAssertStyleLayerIsValid();
@@ -972,6 +1045,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setIconOpacityTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setIconOpacityTransition(options);
}
- (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;
}
- (void)setIconTranslation:(MGLStyleValue<NSValue *> *)iconTranslation {
MGLAssertStyleLayerIsValid();
@@ -989,6 +1080,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
- (void)setIconTranslationTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setIconTranslateTransition(options);
}
- (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;
}
- (void)setIconTranslate:(MGLStyleValue<NSValue *> *)iconTranslate {
}
@@ -1037,6 +1146,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setTextColorTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setTextColorTransition(options);
}
- (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;
}
- (void)setTextHaloBlur:(MGLStyleValue<NSNumber *> *)textHaloBlur {
MGLAssertStyleLayerIsValid();
@@ -1054,6 +1181,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setTextHaloBlurTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setTextHaloBlurTransition(options);
}
- (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;
}
- (void)setTextHaloColor:(MGLStyleValue<MGLColor *> *)textHaloColor {
MGLAssertStyleLayerIsValid();
@@ -1071,6 +1216,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setTextHaloColorTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setTextHaloColorTransition(options);
}
- (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;
}
- (void)setTextHaloWidth:(MGLStyleValue<NSNumber *> *)textHaloWidth {
MGLAssertStyleLayerIsValid();
@@ -1088,6 +1251,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setTextHaloWidthTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setTextHaloWidthTransition(options);
}
- (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;
}
- (void)setTextOpacity:(MGLStyleValue<NSNumber *> *)textOpacity {
MGLAssertStyleLayerIsValid();
@@ -1105,6 +1286,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
- (void)setTextOpacityTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setTextOpacityTransition(options);
}
- (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;
}
- (void)setTextTranslation:(MGLStyleValue<NSValue *> *)textTranslation {
MGLAssertStyleLayerIsValid();
@@ -1122,6 +1321,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
- (void)setTextTranslationTransition:(MGLTransition )transition {
MGLAssertStyleLayerIsValid();
mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
self.rawLayer->setTextTranslateTransition(options);
}
- (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;
}
- (void)setTextTranslate:(MGLStyleValue<NSValue *> *)textTranslate {
}
@@ -1153,7 +1370,6 @@ namespace mbgl {
return self.textTranslationAnchor;
}
@end
@implementation NSValue (MGLSymbolStyleLayerAdditions)

View File

@@ -135,6 +135,10 @@ typedef NS_ENUM(NSUInteger, MGLTileCoordinateSystem) {
A tile source is added to an `MGLStyle` object along with one or more
`MGLRasterStyleLayer` or `MGLVectorStyleLayer` objects. Use a style layer to
control the appearance of content supplied by the tile source.
A tile source is also known as a tile set. To learn about the structure of a
Mapbox-hosted tile set, view it in
<a href="https://www.mapbox.com/studio/tilesets/">Mapbox Studio’s Tilesets editor</a>.
Do not create instances of this class directly, and do not create your own
subclasses of this class. Instead, create instances of `MGLRasterSource` and

View File

@@ -48,21 +48,6 @@ typedef NS_ENUM(NSInteger, MGLErrorCode) {
MGLErrorCodeLoadStyleFailed = 5,
};
/**
The mode used to track the user location on the map. Used with
`MGLMapView.userTrackingMode`.
*/
typedef NS_ENUM(NSUInteger, MGLUserTrackingMode) {
/** The map does not follow the user location. */
MGLUserTrackingModeNone = 0,
/** The map follows the user location. */
MGLUserTrackingModeFollow,
/** The map follows the user location and rotates when the heading changes. */
MGLUserTrackingModeFollowWithHeading,
/** The map follows the user location and rotates when the course changes. */
MGLUserTrackingModeFollowWithCourse,
};
/** Options for enabling debugging features in an `MGLMapView` instance. */
typedef NS_OPTIONS(NSUInteger, MGLMapDebugMaskOptions) {
/** Edges of tile boundaries are shown as thick, red lines to help diagnose
@@ -89,6 +74,39 @@ typedef NS_OPTIONS(NSUInteger, MGLMapDebugMaskOptions) {
#endif
};
/**
A structure containing information about a transition.
*/
typedef struct MGLTransition {
/**
The amount of time the animation should take, not including the delay.
*/
NSTimeInterval duration;
/**
The amount of time in seconds to wait before beginning the animation.
*/
NSTimeInterval delay;
} MGLTransition;
/**
Creates a new `MGLTransition` from the given duration and delay.
@param duration The amount of time the animation should take, not including
the delay.
@param delay The amount of time in seconds to wait before beginning the
animation.
@return Returns a `MGLTransition` struct containing the transition attributes.
*/
NS_INLINE MGLTransition MGLTransitionMake(NSTimeInterval duration, NSTimeInterval delay) {
MGLTransition transition;
transition.duration = duration;
transition.delay = delay;
return transition;
}
NS_ASSUME_NONNULL_END
#ifndef NS_ARRAY_OF

View File

@@ -26,6 +26,12 @@ NS_ASSUME_NONNULL_BEGIN
(<var>extent</var>&nbsp;×&nbsp;2)&nbsp;−&nbsp;1, inclusive. Any vector style
layer initialized with a vector source must have a non-`nil` value in its
`sourceLayerIdentifier` property.
Commonly used vector sources include
<a href="https://www.mapbox.com/vector-tiles/mapbox-streets/">Mapbox Streets</a>,
<a href="https://www.mapbox.com/vector-tiles/mapbox-terrain/">Mapbox Terrain</a>,
and
<a href="https://www.mapbox.com/vector-tiles/mapbox-traffic-v1/">Mapbox Traffic</a>.
### Example
@@ -52,23 +58,39 @@ MGL_EXPORT
#pragma mark Accessing a Source’s Content
/**
Returns an array of map features loaded by this source, restricted to the
given source layers and filtered by the given predicate.
Returns an array of map features loaded by this source, restricted to the given
source layers and filtered by the given predicate.
Each object in the returned array represents a feature for the
current style and provides access to attributes specified by the
<a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources">source</a>.
Each object in the returned array represents a feature loaded by the source and
provides access to attributes specified as part of the loaded feature. The
source loads a feature if the source is added to an `MGLMapView`’s style; that
style has a layer that uses the source; and the map view has recently scrolled
to the region containing the feature.
Features come from tiled vector data that is converted to tiles internally,
so feature geometries are clipped at tile boundaries and features
may appear duplicated across tiles.
Features come from tiled vector data that is converted to tiles internally, so
feature geometries are clipped at tile boundaries and features may appear
duplicated across tiles. For example, suppose part of a lengthy polyline
representing a road has recently scrolled into view. The resulting array
includes those parts of the road that lie within the map tiles that the source
has loaded, even if the road extends into other tiles. The portion of the road
within each map tile is included individually.
Returned features may not necessarily be visible to the user at the time they
are loaded: the style may contain a layer that forces the source’s tiles to
load but filters out the features in question, preventing them from being
drawn. To obtain only _visible_ features, use the
`-[MGLMapView visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:predicate:]`
or
`-[MGLMapView visibleFeaturesInRect:inStyleLayersWithIdentifiers:predicate:]`
method.
@param sourceLayerIdentifiers The source layers to include in the query. Only the
features contained in these source layers are included in the returned array. At
least one source layer is required.
@param predicate A predicate to filter the returned features.
@param sourceLayerIdentifiers The source layers to include in the query. Only
the features contained in these source layers are included in the returned
array. This array may not be empty.
@param predicate A predicate to filter the returned features. Use `nil` to
include all loaded features.
@return An array of objects conforming to the `MGLFeature` protocol that
represent features in the sources used by the current style.
represent features loaded by the source that match the predicate.
*/
- (NS_ARRAY_OF(id <MGLFeature>) *)featuresInSourceLayersWithIdentifiers:(NS_SET_OF(NSString *) *)sourceLayerIdentifiers predicate:(nullable NSPredicate *)predicate NS_SWIFT_NAME(features(sourceLayerIdentifiers:predicate:));

View File

@@ -1,13 +1,17 @@
#import <Foundation/Foundation.h>
#import "MGLFoundation.h"
#include <mbgl/util/chrono.hpp>
@interface NSDate (MGLAdditions)
NS_ASSUME_NONNULL_BEGIN
/// Converts from a duration in seconds to a duration object usable in mbgl.
mbgl::Duration MGLDurationInSecondsFromTimeInterval(NSTimeInterval duration);
MGL_EXPORT
mbgl::Duration MGLDurationFromTimeInterval(NSTimeInterval duration);
/// Converts from an mbgl duration object to a duration in seconds.
NSTimeInterval MGLTimeIntervalFromDurationInSeconds(mbgl::Duration duration);
MGL_EXPORT
NSTimeInterval MGLTimeIntervalFromDuration(mbgl::Duration duration);
@end
NS_ASSUME_NONNULL_END

View File

@@ -1,15 +1,11 @@
#import "NSDate+MGLAdditions.h"
@implementation NSDate (MGLAdditions)
mbgl::Duration MGLDurationInSecondsFromTimeInterval(NSTimeInterval duration)
mbgl::Duration MGLDurationFromTimeInterval(NSTimeInterval duration)
{
return std::chrono::duration_cast<mbgl::Duration>(std::chrono::duration<NSTimeInterval>(duration));
}
NSTimeInterval MGLTimeIntervalFromDurationInSeconds(mbgl::Duration duration)
NSTimeInterval MGLTimeIntervalFromDuration(mbgl::Duration duration)
{
return duration.count();
return std::chrono::duration<NSTimeInterval, std::ratio<1>>(duration).count();
}
@end

View File

@@ -14,8 +14,9 @@ NS_ASSUME_NONNULL_BEGIN
Returns a title-cased representation of the receiver using the specified
locale.
@param The locale. For strings presented to users, pass in the current locale
(`+[NSLocale currentLocale]`). To use the system locale, pass in `nil`.
@param locale The locale. For strings presented to users, pass in the current
locale (`+[NSLocale currentLocale]`). To use the system locale, pass in
`nil`.
*/
- (NSString *)mgl_titleCasedStringWithLocale:(NSLocale *)locale;

View File

@@ -2,6 +2,7 @@
#import "MGLGeometry.h"
#import "MGLOfflinePack.h"
#import "MGLTypes.h"
NS_ASSUME_NONNULL_BEGIN
@@ -70,6 +71,22 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (readonly) MGLOfflinePackProgress MGLOfflinePackProgressValue;
#pragma mark Working with Transition Values
/**
Creates a new value object containing the given `MGLTransition`
structure.
@param transition The value for the new object.
@return A new value object that contains the transition information.
*/
+ (NSValue *)valueWithMGLTransition:(MGLTransition)transition;
/**
The `MGLTransition` structure representation of the value.
*/
@property (readonly) MGLTransition MGLTransitionValue;
@end
NS_ASSUME_NONNULL_END

View File

@@ -46,4 +46,16 @@
return progress;
}
#pragma mark Working with Transition Values
+ (NSValue *)valueWithMGLTransition:(MGLTransition)transition; {
return [NSValue value:&transition withObjCType:@encode(MGLTransition)];
}
- (MGLTransition)MGLTransitionValue {
MGLTransition transition;
[self getValue:&transition];
return transition;
}
@end

View File

@@ -2,10 +2,12 @@
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLStyleLayerTests.h"
#import "../../darwin/src/NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/background_layer.hpp>
#include <mbgl/style/transition_options.hpp>
@interface MGLBackgroundLayerTests : MGLStyleLayerTests
@end
@@ -22,6 +24,9 @@
XCTAssertTrue(layer.rawLayer->is<mbgl::style::BackgroundLayer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::BackgroundLayer>();
MGLTransition transitionTest = MGLTransitionMake(5, 4);
// background-color
{
XCTAssertTrue(rawLayer->getBackgroundColor().isUndefined(),
@@ -59,6 +64,15 @@
XCTAssertThrowsSpecificNamed(layer.backgroundColor = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<MGLColor *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.backgroundColor = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
// Transition property test
layer.backgroundColorTransition = transitionTest;
auto toptions = rawLayer->getBackgroundColorTransition();
XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
MGLTransition backgroundColorTransition = layer.backgroundColorTransition;
XCTAssertEqual(backgroundColorTransition.delay, transitionTest.delay);
XCTAssertEqual(backgroundColorTransition.duration, transitionTest.duration);
}
// background-opacity
@@ -98,6 +112,15 @@
XCTAssertThrowsSpecificNamed(layer.backgroundOpacity = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSNumber *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.backgroundOpacity = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
// Transition property test
layer.backgroundOpacityTransition = transitionTest;
auto toptions = rawLayer->getBackgroundOpacityTransition();
XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
MGLTransition backgroundOpacityTransition = layer.backgroundOpacityTransition;
XCTAssertEqual(backgroundOpacityTransition.delay, transitionTest.delay);
XCTAssertEqual(backgroundOpacityTransition.duration, transitionTest.duration);
}
// background-pattern
@@ -137,6 +160,15 @@
XCTAssertThrowsSpecificNamed(layer.backgroundPattern = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSString *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.backgroundPattern = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
// Transition property test
layer.backgroundPatternTransition = transitionTest;
auto toptions = rawLayer->getBackgroundPatternTransition();
XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
MGLTransition backgroundPatternTransition = layer.backgroundPatternTransition;
XCTAssertEqual(backgroundPatternTransition.delay, transitionTest.delay);
XCTAssertEqual(backgroundPatternTransition.duration, transitionTest.duration);
}
}

View File

@@ -2,10 +2,12 @@
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLStyleLayerTests.h"
#import "../../darwin/src/NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/circle_layer.hpp>
#include <mbgl/style/transition_options.hpp>
@interface MGLCircleLayerTests : MGLStyleLayerTests
@end
@@ -43,6 +45,9 @@
XCTAssertTrue(layer.rawLayer->is<mbgl::style::CircleLayer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::CircleLayer>();
MGLTransition transitionTest = MGLTransitionMake(5, 4);
// circle-blur
{
XCTAssertTrue(rawLayer->getCircleBlur().isUndefined(),
@@ -98,6 +103,15 @@
@"Unsetting circleBlur should return circle-blur to the default value.");
XCTAssertEqualObjects(layer.circleBlur, defaultStyleValue,
@"circleBlur should return the default value after being unset.");
// Transition property test
layer.circleBlurTransition = transitionTest;
auto toptions = rawLayer->getCircleBlurTransition();
XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
MGLTransition circleBlurTransition = layer.circleBlurTransition;
XCTAssertEqual(circleBlurTransition.delay, transitionTest.delay);
XCTAssertEqual(circleBlurTransition.duration, transitionTest.duration);
}
// circle-color
@@ -155,6 +169,15 @@
@"Unsetting circleColor should return circle-color to the default value.");
XCTAssertEqualObjects(layer.circleColor, defaultStyleValue,
@"circleColor should return the default value after being unset.");
// Transition property test
layer.circleColorTransition = transitionTest;
auto toptions = rawLayer->getCircleColorTransition();
XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
MGLTransition circleColorTransition = layer.circleColorTransition;
XCTAssertEqual(circleColorTransition.delay, transitionTest.delay);
XCTAssertEqual(circleColorTransition.duration, transitionTest.duration);
}
// circle-opacity
@@ -212,6 +235,15 @@
@"Unsetting circleOpacity should return circle-opacity to the default value.");
XCTAssertEqualObjects(layer.circleOpacity, defaultStyleValue,
@"circleOpacity should return the default value after being unset.");
// Transition property test
layer.circleOpacityTransition = transitionTest;
auto toptions = rawLayer->getCircleOpacityTransition();
XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
MGLTransition circleOpacityTransition = layer.circleOpacityTransition;
XCTAssertEqual(circleOpacityTransition.delay, transitionTest.delay);
XCTAssertEqual(circleOpacityTransition.duration, transitionTest.duration);
}
// circle-radius
@@ -269,6 +301,15 @@
@"Unsetting circleRadius should return circle-radius to the default value.");
XCTAssertEqualObjects(layer.circleRadius, defaultStyleValue,
@"circleRadius should return the default value after being unset.");
// Transition property test
layer.circleRadiusTransition = transitionTest;
auto toptions = rawLayer->getCircleRadiusTransition();
XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
MGLTransition circleRadiusTransition = layer.circleRadiusTransition;
XCTAssertEqual(circleRadiusTransition.delay, transitionTest.delay);
XCTAssertEqual(circleRadiusTransition.duration, transitionTest.duration);
}
// circle-pitch-scale
@@ -365,6 +406,15 @@
@"Unsetting circleStrokeColor should return circle-stroke-color to the default value.");
XCTAssertEqualObjects(layer.circleStrokeColor, defaultStyleValue,
@"circleStrokeColor should return the default value after being unset.");
// Transition property test
layer.circleStrokeColorTransition = transitionTest;
auto toptions = rawLayer->getCircleStrokeColorTransition();
XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
MGLTransition circleStrokeColorTransition = layer.circleStrokeColorTransition;
XCTAssertEqual(circleStrokeColorTransition.delay, transitionTest.delay);
XCTAssertEqual(circleStrokeColorTransition.duration, transitionTest.duration);
}
// circle-stroke-opacity
@@ -422,6 +472,15 @@
@"Unsetting circleStrokeOpacity should return circle-stroke-opacity to the default value.");
XCTAssertEqualObjects(layer.circleStrokeOpacity, defaultStyleValue,
@"circleStrokeOpacity should return the default value after being unset.");
// Transition property test
layer.circleStrokeOpacityTransition = transitionTest;
auto toptions = rawLayer->getCircleStrokeOpacityTransition();
XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
MGLTransition circleStrokeOpacityTransition = layer.circleStrokeOpacityTransition;
XCTAssertEqual(circleStrokeOpacityTransition.delay, transitionTest.delay);
XCTAssertEqual(circleStrokeOpacityTransition.duration, transitionTest.duration);
}
// circle-stroke-width
@@ -479,6 +538,15 @@
@"Unsetting circleStrokeWidth should return circle-stroke-width to the default value.");
XCTAssertEqualObjects(layer.circleStrokeWidth, defaultStyleValue,
@"circleStrokeWidth should return the default value after being unset.");
// Transition property test
layer.circleStrokeWidthTransition = transitionTest;
auto toptions = rawLayer->getCircleStrokeWidthTransition();
XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
MGLTransition circleStrokeWidthTransition = layer.circleStrokeWidthTransition;
XCTAssertEqual(circleStrokeWidthTransition.delay, transitionTest.delay);
XCTAssertEqual(circleStrokeWidthTransition.duration, transitionTest.duration);
}
// circle-translate

Some files were not shown because too many files have changed in this diff Show More