From 91521fa106453a5095e2e7470056a3107fcf148e Mon Sep 17 00:00:00 2001 From: Fabian Guerra Date: Thu, 2 Nov 2017 19:22:14 -0400 Subject: [ios] Fix image property of MGLAnnotationImage does not update. --- platform/ios/src/MGLMapView.mm | 5 ----- 1 file changed, 5 deletions(-) diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 31eac056e5..1cbbc22871 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -4548,11 +4548,6 @@ public: NSString *fallbackReuseIdentifier = MGLDefaultStyleMarkerSymbolName; NSString *fallbackIconIdentifier = [MGLAnnotationSpritePrefix stringByAppendingString:fallbackReuseIdentifier]; - // Remove the old icon from the style. - if ( ! [iconIdentifier isEqualToString:fallbackIconIdentifier]) { - _mbglMap->removeAnnotationImage(iconIdentifier.UTF8String); - } - if (annotationImage.image) { // Add the new icon to the style. -- cgit v1.2.1 From b38618b450a8153d0b93f9a44b78039181f6c3f9 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Fri, 26 Jan 2018 18:15:27 +0100 Subject: [windows] - run AppVeyor for all branches --- appveyor.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 8013c669f6..d31160261f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,10 +7,6 @@ environment: shallow_clone: true -branches: - only: - - master - cache: - '%APPVEYOR_BUILD_FOLDER%\mason_packages' - '%APPVEYOR_BUILD_FOLDER%\LLVM-5.0.1-win64.exe' -- cgit v1.2.1 From 65bab30384577c9aac88fb7b34f8877a95d86704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Wed, 24 Jan 2018 00:28:06 -0800 Subject: [ios, macos] Documented ranges of style properties --- platform/darwin/scripts/generate-style-code.js | 26 ++++++++--- platform/darwin/src/MGLBackgroundStyleLayer.h | 4 +- platform/darwin/src/MGLCircleStyleLayer.h | 18 ++++---- platform/darwin/src/MGLFillExtrusionStyleLayer.h | 12 ++--- platform/darwin/src/MGLFillStyleLayer.h | 4 +- platform/darwin/src/MGLHillshadeStyleLayer.h | 8 ++-- platform/darwin/src/MGLLight.h | 4 +- platform/darwin/src/MGLLineStyleLayer.h | 24 +++++----- platform/darwin/src/MGLRasterStyleLayer.h | 26 +++++------ platform/darwin/src/MGLSymbolStyleLayer.h | 58 ++++++++++++------------ 10 files changed, 99 insertions(+), 85 deletions(-) diff --git a/platform/darwin/scripts/generate-style-code.js b/platform/darwin/scripts/generate-style-code.js index a7804ac948..f919a649cb 100755 --- a/platform/darwin/scripts/generate-style-code.js +++ b/platform/darwin/scripts/generate-style-code.js @@ -300,7 +300,17 @@ global.propertyDoc = function (propertyName, property, layerType, kind) { doc += `\n\nThis attribute corresponds to the ${property.original} layout property in the Mapbox Style Specification.`; } doc += '\n\nYou can set this property to an expression containing any of the following:\n\n'; - doc += `* Constant ${describeType(property)} values\n`; + doc += `* Constant ${describeType(property)} values`; + if ('minimum' in property) { + if ('maximum' in property) { + doc += ` between ${formatNumber(property.minimum)} and ${formatNumber(property.maximum)} inclusive`; + } else { + doc += ` no less than ${formatNumber(property.minimum)}`; + } + } else if ('maximum' in property) { + doc += ` no greater than ${formatNumber(property.maximum)}`; + } + doc += '\n'; if (property.type === 'enum') { doc += '* Any of the following constant string values:\n'; doc += Object.keys(property.values).map(value => ' * `' + value + '`: ' + property.values[value].doc).join('\n') + '\n'; @@ -392,7 +402,7 @@ global.describeValue = function (value, property, layerType) { case 'boolean': return value ? '`YES`' : '`NO`'; case 'number': - return 'the float `' + value + '`'; + return 'the float ' + formatNumber(value); case 'string': if (value === '') { return 'the empty string'; @@ -427,7 +437,7 @@ global.describeValue = function (value, property, layerType) { if (color.r === 1 && color.g === 1 && color.b === 1 && color.a === 1) { return '`UIColor.whiteColor`'; } - return 'a `UIColor`' + ` object whose RGB value is ${color.r}, ${color.g}, ${color.b} and whose alpha value is ${color.a}`; + return 'a `UIColor`' + ` object whose RGB value is ${formatNumber(color.r)}, ${formatNumber(color.g)}, ${formatNumber(color.b)} and whose alpha value is ${formatNumber(color.a)}`; case 'array': let units = property.units || ''; if (units) { @@ -438,12 +448,12 @@ global.describeValue = function (value, property, layerType) { if (value[0] === 0 && value[1] === 0 && value[2] === 0 && value[3] === 0) { return 'an `NSValue` object containing `UIEdgeInsetsZero`'; } - return 'an `NSValue` object containing a `UIEdgeInsets` struct set to' + ` ${value[0]}${units} on the top, ${value[3]}${units} on the left, ${value[2]}${units} on the bottom, and ${value[1]}${units} on the right`; + return 'an `NSValue` object containing a `UIEdgeInsets` struct set to' + ` ${formatNumber(value[0])}${units} on the top, ${formatNumber(value[3])}${units} on the left, ${formatNumber(value[2])}${units} on the bottom, and ${formatNumber(value[1])}${units} on the right`; case 'offset': case 'translate': - return 'an `NSValue` object containing a `CGVector` struct set to' + ` ${value[0]}${units} rightward and ${value[1]}${units} downward`; + return 'an `NSValue` object containing a `CGVector` struct set to' + ` ${formatNumber(value[0])}${units} rightward and ${formatNumber(value[1])}${units} downward`; case 'position': - return 'an `MGLSphericalPosition` struct set to' + ` ${value[0]} radial, ${value[1]} azimuthal and ${value[2]} polar`; + return 'an `MGLSphericalPosition` struct set to' + ` ${formatNumber(value[0])} radial, ${formatNumber(value[1])} azimuthal and ${formatNumber(value[2])} polar`; default: return 'the array `' + value.join('`, `') + '`'; } @@ -452,6 +462,10 @@ global.describeValue = function (value, property, layerType) { } }; +global.formatNumber = function (num) { + return num.toLocaleString().replace('-', '\u2212'); +} + global.propertyDefault = function (property, layerType) { if (property.name === 'heatmap-color') { return 'an expression that evaluates to a rainbow color scale from blue to red'; diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.h b/platform/darwin/src/MGLBackgroundStyleLayer.h index 9d2673c859..4bb8a36e04 100644 --- a/platform/darwin/src/MGLBackgroundStyleLayer.h +++ b/platform/darwin/src/MGLBackgroundStyleLayer.h @@ -71,11 +71,11 @@ which it is added. The opacity at which the background will be drawn. The default value of this property is an expression that evaluates to the float - `1`. Set this property to `nil` to reset it to the default value. + 1. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values between 0 and 1 inclusive * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables diff --git a/platform/darwin/src/MGLCircleStyleLayer.h b/platform/darwin/src/MGLCircleStyleLayer.h index caa6d2f6cb..2523637179 100644 --- a/platform/darwin/src/MGLCircleStyleLayer.h +++ b/platform/darwin/src/MGLCircleStyleLayer.h @@ -116,7 +116,7 @@ MGL_EXPORT full opacity. The default value of this property is an expression that evaluates to the float - `0`. Set this property to `nil` to reset it to the default value. + 0. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: @@ -165,11 +165,11 @@ MGL_EXPORT The opacity at which the circle will be drawn. The default value of this property is an expression that evaluates to the float - `1`. Set this property to `nil` to reset it to the default value. + 1. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values between 0 and 1 inclusive * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -214,11 +214,11 @@ MGL_EXPORT This property is measured in points. The default value of this property is an expression that evaluates to the float - `5`. Set this property to `nil` to reset it to the default value. + 5. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values no less than 0 * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -293,11 +293,11 @@ MGL_EXPORT The opacity of the circle's stroke. The default value of this property is an expression that evaluates to the float - `1`. Set this property to `nil` to reset it to the default value. + 1. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values between 0 and 1 inclusive * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -320,11 +320,11 @@ MGL_EXPORT This property is measured in points. The default value of this property is an expression that evaluates to the float - `0`. Set this property to `nil` to reset it to the default value. + 0. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values no less than 0 * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables diff --git a/platform/darwin/src/MGLFillExtrusionStyleLayer.h b/platform/darwin/src/MGLFillExtrusionStyleLayer.h index d1d5af6ba2..2eb3174675 100644 --- a/platform/darwin/src/MGLFillExtrusionStyleLayer.h +++ b/platform/darwin/src/MGLFillExtrusionStyleLayer.h @@ -77,14 +77,14 @@ MGL_EXPORT This property is measured in meters. The default value of this property is an expression that evaluates to the float - `0`. Set this property to `nil` to reset it to the default value. + 0. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `fillExtrusionHeight` is non-`nil`. Otherwise, it is ignored. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values no less than 0 * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -137,11 +137,11 @@ MGL_EXPORT This property is measured in meters. The default value of this property is an expression that evaluates to the float - `0`. Set this property to `nil` to reset it to the default value. + 0. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values no less than 0 * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -162,11 +162,11 @@ MGL_EXPORT per-layer, not per-feature, basis, and data-driven styling is not available. The default value of this property is an expression that evaluates to the float - `1`. Set this property to `nil` to reset it to the default value. + 1. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values between 0 and 1 inclusive * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables diff --git a/platform/darwin/src/MGLFillStyleLayer.h b/platform/darwin/src/MGLFillStyleLayer.h index 5caab91b45..421813bbca 100644 --- a/platform/darwin/src/MGLFillStyleLayer.h +++ b/platform/darwin/src/MGLFillStyleLayer.h @@ -127,11 +127,11 @@ MGL_EXPORT value will also affect the 1pt stroke around the fill, if the stroke is used. The default value of this property is an expression that evaluates to the float - `1`. Set this property to `nil` to reset it to the default value. + 1. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values between 0 and 1 inclusive * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables diff --git a/platform/darwin/src/MGLHillshadeStyleLayer.h b/platform/darwin/src/MGLHillshadeStyleLayer.h index b2eeb59aba..bc831c7f06 100644 --- a/platform/darwin/src/MGLHillshadeStyleLayer.h +++ b/platform/darwin/src/MGLHillshadeStyleLayer.h @@ -107,11 +107,11 @@ MGL_EXPORT Intensity of the hillshade The default value of this property is an expression that evaluates to the float - `0.5`. Set this property to `nil` to reset it to the default value. + 0.5. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values between 0 and 1 inclusive * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -187,11 +187,11 @@ MGL_EXPORT `hillshadeIlluminationAnchor` is set to `MGLHillshadeIlluminationAnchorMap`. The default value of this property is an expression that evaluates to the float - `335`. Set this property to `nil` to reset it to the default value. + 335. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values between 0 and 359 inclusive * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables diff --git a/platform/darwin/src/MGLLight.h b/platform/darwin/src/MGLLight.h index d7e64cbfad..2bdb874a37 100644 --- a/platform/darwin/src/MGLLight.h +++ b/platform/darwin/src/MGLLight.h @@ -163,11 +163,11 @@ MGL_EXPORT more extreme contrast. The default value of this property is an expression that evaluates to the float - `0.5`. + 0.5. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values between 0 and 1 inclusive * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h index 003f48ae43..bdb5464ebc 100644 --- a/platform/darwin/src/MGLLineStyleLayer.h +++ b/platform/darwin/src/MGLLineStyleLayer.h @@ -179,7 +179,7 @@ MGL_EXPORT Used to automatically convert miter joins to bevel joins for sharp angles. The default value of this property is an expression that evaluates to the float - `2`. Set this property to `nil` to reset it to the default value. + 2. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `lineJoin` is set to an expression that evaluates to `miter`. Otherwise, it is ignored. @@ -201,7 +201,7 @@ MGL_EXPORT Used to automatically convert round joins to miter joins for shallow angles. The default value of this property is an expression that evaluates to the float - `1.05`. Set this property to `nil` to reset it to the default value. + 1.05. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `lineJoin` is set to an expression that evaluates to `round`. Otherwise, it is ignored. @@ -227,11 +227,11 @@ MGL_EXPORT This property is measured in points. The default value of this property is an expression that evaluates to the float - `0`. Set this property to `nil` to reset it to the default value. + 0. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values no less than 0 * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -291,7 +291,7 @@ MGL_EXPORT You can set this property to an expression containing any of the following: - * Constant array values + * Constant array values no less than 0 * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -319,11 +319,11 @@ MGL_EXPORT This property is measured in points. The default value of this property is an expression that evaluates to the float - `0`. Set this property to `nil` to reset it to the default value. + 0. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values no less than 0 * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -348,7 +348,7 @@ MGL_EXPORT This property is measured in points. The default value of this property is an expression that evaluates to the float - `0`. Set this property to `nil` to reset it to the default value. + 0. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: @@ -372,11 +372,11 @@ MGL_EXPORT The opacity at which the line will be drawn. The default value of this property is an expression that evaluates to the float - `1`. Set this property to `nil` to reset it to the default value. + 1. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values between 0 and 1 inclusive * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -518,11 +518,11 @@ MGL_EXPORT This property is measured in points. The default value of this property is an expression that evaluates to the float - `1`. Set this property to `nil` to reset it to the default value. + 1. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values no less than 0 * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables diff --git a/platform/darwin/src/MGLRasterStyleLayer.h b/platform/darwin/src/MGLRasterStyleLayer.h index 7773246cad..fd41f271ed 100644 --- a/platform/darwin/src/MGLRasterStyleLayer.h +++ b/platform/darwin/src/MGLRasterStyleLayer.h @@ -64,7 +64,7 @@ MGL_EXPORT brightness. The default value of this property is an expression that evaluates to the float - `1`. Set this property to `nil` to reset it to the default value. + 1. Set this property to `nil` to reset it to the default value. This attribute corresponds to the raster-brightness-max @@ -72,7 +72,7 @@ MGL_EXPORT You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values between 0 and 1 inclusive * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -97,7 +97,7 @@ MGL_EXPORT brightness. The default value of this property is an expression that evaluates to the float - `0`. Set this property to `nil` to reset it to the default value. + 0. Set this property to `nil` to reset it to the default value. This attribute corresponds to the raster-brightness-min @@ -105,7 +105,7 @@ MGL_EXPORT You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values between 0 and 1 inclusive * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -129,11 +129,11 @@ MGL_EXPORT Increase or reduce the contrast of the image. The default value of this property is an expression that evaluates to the float - `0`. Set this property to `nil` to reset it to the default value. + 0. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values between −1 and 1 inclusive * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -157,11 +157,11 @@ MGL_EXPORT This property is measured in milliseconds. The default value of this property is an expression that evaluates to the float - `300`. Set this property to `nil` to reset it to the default value. + 300. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values no less than 0 * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -178,7 +178,7 @@ MGL_EXPORT This property is measured in degrees. The default value of this property is an expression that evaluates to the float - `0`. Set this property to `nil` to reset it to the default value. + 0. Set this property to `nil` to reset it to the default value. This attribute corresponds to the raster-hue-rotate @@ -210,11 +210,11 @@ MGL_EXPORT The opacity at which the image will be drawn. The default value of this property is an expression that evaluates to the float - `1`. Set this property to `nil` to reset it to the default value. + 1. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values between 0 and 1 inclusive * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -236,11 +236,11 @@ MGL_EXPORT Increase or reduce the saturation of the image. The default value of this property is an expression that evaluates to the float - `0`. Set this property to `nil` to reset it to the default value. + 0. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values between −1 and 1 inclusive * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables diff --git a/platform/darwin/src/MGLSymbolStyleLayer.h b/platform/darwin/src/MGLSymbolStyleLayer.h index 1017db5442..2fd5ef2479 100644 --- a/platform/darwin/src/MGLSymbolStyleLayer.h +++ b/platform/darwin/src/MGLSymbolStyleLayer.h @@ -559,14 +559,14 @@ MGL_EXPORT This property is measured in points. The default value of this property is an expression that evaluates to the float - `2`. Set this property to `nil` to reset it to the default value. + 2. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values no less than 0 * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -610,7 +610,7 @@ MGL_EXPORT This property is measured in degrees. The default value of this property is an expression that evaluates to the float - `0`. Set this property to `nil` to reset it to the default value. + 0. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. @@ -673,7 +673,7 @@ MGL_EXPORT This property is measured in factor of the original icon sizes. The default value of this property is an expression that evaluates to the float - `1`. Set this property to `nil` to reset it to the default value. + 1. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. @@ -684,7 +684,7 @@ MGL_EXPORT You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values no less than 0 * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -853,7 +853,7 @@ MGL_EXPORT This property is measured in degrees. The default value of this property is an expression that evaluates to the float - `45`. Set this property to `nil` to reset it to the default value. + 45. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `text` is non-`nil`, and `symbolPlacement` is set to an expression that evaluates to `line`. Otherwise, @@ -885,7 +885,7 @@ MGL_EXPORT This property is measured in ems. The default value of this property is an expression that evaluates to the float - `10`. Set this property to `nil` to reset it to the default value. + 10. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. @@ -896,7 +896,7 @@ MGL_EXPORT You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values no less than 0 * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -968,14 +968,14 @@ MGL_EXPORT This property is measured in points. The default value of this property is an expression that evaluates to the float - `250`. Set this property to `nil` to reset it to the default value. + 250. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `symbolPlacement` is set to an expression that evaluates to `line`. Otherwise, it is ignored. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values no less than 1 * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -1122,7 +1122,7 @@ MGL_EXPORT This property is measured in points. The default value of this property is an expression that evaluates to the float - `16`. Set this property to `nil` to reset it to the default value. + 16. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. @@ -1133,7 +1133,7 @@ MGL_EXPORT You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values no less than 0 * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -1212,7 +1212,7 @@ MGL_EXPORT This property is measured in ems. The default value of this property is an expression that evaluates to the float - `0`. Set this property to `nil` to reset it to the default value. + 0. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. @@ -1234,7 +1234,7 @@ MGL_EXPORT This property is measured in ems. The default value of this property is an expression that evaluates to the float - `1.2`. Set this property to `nil` to reset it to the default value. + 1.2. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. @@ -1331,14 +1331,14 @@ MGL_EXPORT This property is measured in points. The default value of this property is an expression that evaluates to the float - `2`. Set this property to `nil` to reset it to the default value. + 2. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values no less than 0 * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -1382,7 +1382,7 @@ MGL_EXPORT This property is measured in degrees. The default value of this property is an expression that evaluates to the float - `0`. Set this property to `nil` to reset it to the default value. + 0. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. @@ -1498,14 +1498,14 @@ MGL_EXPORT This property is measured in points. The default value of this property is an expression that evaluates to the float - `0`. Set this property to `nil` to reset it to the default value. + 0. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values no less than 0 * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -1556,14 +1556,14 @@ MGL_EXPORT This property is measured in points. The default value of this property is an expression that evaluates to the float - `0`. Set this property to `nil` to reset it to the default value. + 0. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values no less than 0 * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -1583,14 +1583,14 @@ MGL_EXPORT The opacity at which the icon will be drawn. The default value of this property is an expression that evaluates to the float - `1`. Set this property to `nil` to reset it to the default value. + 1. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values between 0 and 1 inclusive * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -1741,14 +1741,14 @@ MGL_EXPORT This property is measured in points. The default value of this property is an expression that evaluates to the float - `0`. Set this property to `nil` to reset it to the default value. + 0. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values no less than 0 * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -1799,14 +1799,14 @@ MGL_EXPORT This property is measured in points. The default value of this property is an expression that evaluates to the float - `0`. Set this property to `nil` to reset it to the default value. + 0. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values no less than 0 * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -1826,14 +1826,14 @@ MGL_EXPORT The opacity at which the text will be drawn. The default value of this property is an expression that evaluates to the float - `1`. Set this property to `nil` to reset it to the default value. + 1. Set this property to `nil` to reset it to the default value. This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values between 0 and 1 inclusive * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables -- cgit v1.2.1 From 045392938b95843808cb36999407d10f75917ea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Thu, 25 Jan 2018 23:02:07 -0800 Subject: [ios] Fixed syntax error in style author guide --- platform/darwin/docs/guides/For Style Authors.md.ejs | 2 +- platform/ios/docs/guides/For Style Authors.md | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/platform/darwin/docs/guides/For Style Authors.md.ejs b/platform/darwin/docs/guides/For Style Authors.md.ejs index 3f6c3fc2a4..fc259e4da3 100644 --- a/platform/darwin/docs/guides/For Style Authors.md.ejs +++ b/platform/darwin/docs/guides/For Style Authors.md.ejs @@ -359,7 +359,7 @@ In style specification | Method, function, or predicate type | Format string syn <% if (macOS) { -%> `rgb` | `+[NSColor colorWithCalibratedRed:green:blue:alpha:]` | `rgba` | `+[NSColor colorWithCalibratedRed:green:blue:alpha:]` | -<% } else { %> +<% } else { -%> `rgb` | `+[UIColor colorWithRed:green:blue:alpha:]` | `rgba` | `+[UIColor colorWithRed:green:blue:alpha:]` | <% } -%> diff --git a/platform/ios/docs/guides/For Style Authors.md b/platform/ios/docs/guides/For Style Authors.md index 51cd87a766..8db1bd3310 100644 --- a/platform/ios/docs/guides/For Style Authors.md +++ b/platform/ios/docs/guides/For Style Authors.md @@ -345,7 +345,6 @@ In style specification | Method, function, or predicate type | Format string syn `concat` | `stringByAppendingString:` | `downcase` | `lowercase:` | `lowercase('DOWNTOWN')` `upcase` | `uppercase:` | `uppercase('Elysian Fields')` - `rgb` | `+[UIColor colorWithRed:green:blue:alpha:]` | `rgba` | `+[UIColor colorWithRed:green:blue:alpha:]` | `to-rgba` | | -- cgit v1.2.1 From 306898d77bae63220b3a69191aaadef6da7e2fc5 Mon Sep 17 00:00:00 2001 From: Fabian Guerra Soto Date: Fri, 26 Jan 2018 15:56:03 -0500 Subject: [ios] Update changelog and bump pod spec to 4.0.0-beta.1 (#11069) * [ios] Update changelog and bump pod spec to 4.0.0-beta.1 * [ios, macos] Reorganized changelog entries * [ios] Add missing changelog entries. * [ios, macos] Rolled up core changes into changelogs --- platform/ios/CHANGELOG.md | 27 +++++++++++++++------- .../ios/Mapbox-iOS-SDK-nightly-dynamic.podspec | 2 +- platform/ios/Mapbox-iOS-SDK-symbols.podspec | 2 +- platform/ios/Mapbox-iOS-SDK.podspec | 2 +- platform/macos/CHANGELOG.md | 20 +++++++++++----- 5 files changed, 36 insertions(+), 17 deletions(-) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 75a77720ae..272270321b 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -2,37 +2,48 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started. -## master +## 4.0.0 ### Packaging * Removed support for 32-bit simulators. ([#10962](https://github.com/mapbox/mapbox-gl-native/pull/10962)) +* Added a Hebrew localization. ([#10967](https://github.com/mapbox/mapbox-gl-native/pull/10967)) ### Styles and rendering * The layout and paint properties on subclasses of `MGLStyleLayer` are now of type `NSExpression` instead of `MGLStyleValue`. A new “Predicates and Expressions” guide provides an overview of the supported operators. ([#10726](https://github.com/mapbox/mapbox-gl-native/pull/10726)) * Added an `MGLComputedShapeSource` class that allows applications to supply vector data to a style layer on a per-tile basis. ([#9983](https://github.com/mapbox/mapbox-gl-native/pull/9983)) * A style can now display smooth hillshading and customize its appearance at runtime using the `MGLHillshadeStyleLayer` class. Hillshading is based on a rasterized digital elevation model supplied by the `MGLRasterDEMSource` class. ([#10642](https://github.com/mapbox/mapbox-gl-native/pull/10642)) -* Properties such as `MGLSymbolStyleLayer.iconAllowsOverlap` and `MGLSymbolStyleLayer.iconIgnoresPlacement` now account for symbols in other sources. ([#10436](https://github.com/mapbox/mapbox-gl-native/pull/10436)) +* The `MGLSymbolStyleLayer.textFontNames` property can now depend on a feature’s attributes. ([#10850](https://github.com/mapbox/mapbox-gl-native/pull/10850)) + +### Map rendering + * Improved the reliability of collision detection between symbols near the edges of tiles, as well as between symbols when the map is tilted. It is no longer necessary to enable `MGLSymbolStyleLayer.symbolAvoidsEdges` to prevent symbols in adjacent tiles from overlapping with each other. ([#10436](https://github.com/mapbox/mapbox-gl-native/pull/10436)) * Symbols can fade in and out as the map pans, rotates, or tilts. ([#10436](https://github.com/mapbox/mapbox-gl-native/pull/10436)) +* Properties such as `MGLSymbolStyleLayer.iconAllowsOverlap` and `MGLSymbolStyleLayer.iconIgnoresPlacement` now account for symbols in other sources. ([#10436](https://github.com/mapbox/mapbox-gl-native/pull/10436)) * Fixed an issue preventing a dynamically-added `MGLRasterStyleLayer` from drawing until the map pans. ([#10270](https://github.com/mapbox/mapbox-gl-native/pull/10270)) * Fixed an issue preventing `MGLImageSource`s from drawing on the map when the map is zoomed in and tilted. ([#10677](https://github.com/mapbox/mapbox-gl-native/pull/10677)) - -### Snapshots - -* Fixed a memory leak that occurred when creating a map snapshot. ([#10585](https://github.com/mapbox/mapbox-gl-native/pull/10585)) +* Improved the sharpness of raster tiles on Retina displays. ([#10984](https://github.com/mapbox/mapbox-gl-native/pull/10984)) +* Fixed a crash parsing a malformed style. ([#11001](https://github.com/mapbox/mapbox-gl-native/pull/11001)) ### Annotations +* Fixed an issue preventing `MGLAnnotationImage.image` from being updated. ([#10372](https://github.com/mapbox/mapbox-gl-native/pull/10372)) * Improved performance of `MGLAnnotationView`-backed annotations that have `scalesWithViewingDistance` enabled. ([#10951](https://github.com/mapbox/mapbox-gl-native/pull/10951)) +### Map snapshots + +* Fixed a memory leak that occurred when creating a map snapshot. ([#10585](https://github.com/mapbox/mapbox-gl-native/pull/10585)) +* Fixed an issue that caused `MGLMapSnapshotter.pointForCoordinate` to return an incorrect value. ([#11035](https://github.com/mapbox/mapbox-gl-native/pull/11035)) + ### Other changes -* Added a Hebrew localization. ([#10967](https://github.com/mapbox/mapbox-gl-native/pull/10967)) +* Feature querying results now account for the `MGLSymbolStyleLayer.circleStrokeWidth` property. ([#10897](https://github.com/mapbox/mapbox-gl-native/pull/10897)) +* Fixed an issue preventing labels from being transliterated when VoiceOver was enabled on iOS 10._x_ and below. ([#10881](https://github.com/mapbox/mapbox-gl-native/pull/10881)) +* Labels are now transliterated from more languages when VoiceOver is enabled. ([#10881](https://github.com/mapbox/mapbox-gl-native/pull/10881)) * Long-pressing the attribution button causes the SDK’s version number to be displayed in the action sheet that appears. ([#10650](https://github.com/mapbox/mapbox-gl-native/pull/10650)) -## 3.7.3 +## 3.7.3 - January 10, 2018 * Fixed a crash while zooming while annotations are present on the map. ([#10791](https://github.com/mapbox/mapbox-gl-native/pull/10791)) * CJK characters can be displayed in a locally installed font or a custom font bundled with the application, reducing map download times. Specify the font name using the `MGLIdeographicFontFamilyName` key in the application’s Info.plist file. ([#10522](https://github.com/mapbox/mapbox-gl-native/pull/10522)) diff --git a/platform/ios/Mapbox-iOS-SDK-nightly-dynamic.podspec b/platform/ios/Mapbox-iOS-SDK-nightly-dynamic.podspec index fb9511e707..56714a5211 100644 --- a/platform/ios/Mapbox-iOS-SDK-nightly-dynamic.podspec +++ b/platform/ios/Mapbox-iOS-SDK-nightly-dynamic.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |m| - version = '3.7.3' + version = '4.0.0-beta.1' m.name = 'Mapbox-iOS-SDK-nightly-dynamic' m.version = "#{version}-nightly" diff --git a/platform/ios/Mapbox-iOS-SDK-symbols.podspec b/platform/ios/Mapbox-iOS-SDK-symbols.podspec index ea8ae667f6..fb7e55bbd3 100644 --- a/platform/ios/Mapbox-iOS-SDK-symbols.podspec +++ b/platform/ios/Mapbox-iOS-SDK-symbols.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |m| - version = '3.7.3' + version = '4.0.0-beta.1' m.name = 'Mapbox-iOS-SDK-symbols' m.version = "#{version}-symbols" diff --git a/platform/ios/Mapbox-iOS-SDK.podspec b/platform/ios/Mapbox-iOS-SDK.podspec index 1e81272d6d..ee35103700 100644 --- a/platform/ios/Mapbox-iOS-SDK.podspec +++ b/platform/ios/Mapbox-iOS-SDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |m| - version = '3.7.3' + version = '4.0.0-beta.1' m.name = 'Mapbox-iOS-SDK' m.version = version diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index c8373b2bf5..bcdbb9824d 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -1,25 +1,33 @@ # Changelog for Mapbox Maps SDK for macOS -## master +## 0.7.0 ### Styles and rendering * The layout and paint properties on subclasses of `MGLStyleLayer` are now of type `NSExpression` instead of `MGLStyleValue`. A new “Predicates and Expressions” guide provides an overview of the supported operators. ([#10726](https://github.com/mapbox/mapbox-gl-native/pull/10726)) * Added an `MGLComputedShapeSource` class that allows applications to supply vector data to a style layer on a per-tile basis. ([#9983](https://github.com/mapbox/mapbox-gl-native/pull/9983)) * A style can now display smooth hillshading and customize its appearance at runtime using the `MGLHillshadeStyleLayer` class. Hillshading is based on a rasterized digital elevation model supplied by the `MGLRasterDEMSource` class. ([#10642](https://github.com/mapbox/mapbox-gl-native/pull/10642)) -* Properties such as `MGLSymbolStyleLayer.iconAllowsOverlap` and `MGLSymbolStyleLayer.iconIgnoresPlacement` now account for symbols in other sources. ([#10436](https://github.com/mapbox/mapbox-gl-native/pull/10436)) +* The `MGLSymbolStyleLayer.textFontNames` property can now depend on a feature’s attributes. ([#10850](https://github.com/mapbox/mapbox-gl-native/pull/10850)) + +### Map rendering + * Improved the reliability of collision detection between symbols near the edges of tiles, as well as between symbols when the map is tilted. It is no longer necessary to enable `MGLSymbolStyleLayer.symbolAvoidsEdges` to prevent symbols in adjacent tiles from overlapping with each other. ([#10436](https://github.com/mapbox/mapbox-gl-native/pull/10436)) * Symbols can fade in and out as the map pans, rotates, or tilts. ([#10436](https://github.com/mapbox/mapbox-gl-native/pull/10436)) +* Properties such as `MGLSymbolStyleLayer.iconAllowsOverlap` and `MGLSymbolStyleLayer.iconIgnoresPlacement` now account for symbols in other sources. ([#10436](https://github.com/mapbox/mapbox-gl-native/pull/10436)) * Fixed an issue preventing a dynamically-added `MGLRasterStyleLayer` from drawing until the map pans. ([#10270](https://github.com/mapbox/mapbox-gl-native/pull/10270)) * Fixed an issue preventing `MGLImageSource`s from drawing on the map when the map is zoomed in and tilted. ([#10677](https://github.com/mapbox/mapbox-gl-native/pull/10677)) +* Improved the sharpness of raster tiles on Retina displays. ([#10984](https://github.com/mapbox/mapbox-gl-native/pull/10984)) +* Fixed a crash parsing a malformed style. ([#11001](https://github.com/mapbox/mapbox-gl-native/pull/11001)) -### Other changes +### Map snapshots -* Added a Hebrew localization. ([#10967](https://github.com/mapbox/mapbox-gl-native/pull/10967)) +* Fixed a memory leak that occurred when creating a map snapshot. ([#10585](https://github.com/mapbox/mapbox-gl-native/pull/10585)) +* Fixed an issue that caused `MGLMapSnapshotter.pointForCoordinate` to return an incorrect value. ([#11035](https://github.com/mapbox/mapbox-gl-native/pull/11035)) -### Snapshots +### Other changes -* Fixed a memory leak that occurred when creating a map snapshot. ([#10585](https://github.com/mapbox/mapbox-gl-native/pull/10585)) +* Added a Hebrew localization. ([#10967](https://github.com/mapbox/mapbox-gl-native/pull/10967)) +* Feature querying results now account for the `MGLSymbolStyleLayer.circleStrokeWidth` property. ([#10897](https://github.com/mapbox/mapbox-gl-native/pull/10897)) ## v0.6.1 - January 16, 2018 -- cgit v1.2.1 From ce429dcc1fce2a827e5c9462e3226c3bb04c6a39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Thu, 25 Jan 2018 15:24:29 -0800 Subject: [core] don't force downloading of Open Sans fonts When a SymbolLayer doesn't have a text-font defined, we automatically add Open Sans/Arial Unicode MS. However, when the SymbolLayer is only used for rendering icons, it doesn't have text-field defined either. In those cases, we still force downloading Open Sans/Arial Unicode MS during offline pack creation. If the user doesn't use this font, this change should save ~15MB and a few seconds in download time. --- src/mbgl/style/parser.cpp | 2 +- test/fixtures/style_parser/font_stacks.json | 3 +++ test/style/style_parser.test.cpp | 21 +++++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/mbgl/style/parser.cpp b/src/mbgl/style/parser.cpp index b177f2159c..8d14d7972c 100644 --- a/src/mbgl/style/parser.cpp +++ b/src/mbgl/style/parser.cpp @@ -277,7 +277,7 @@ std::vector Parser::fontStacks() const { std::set result; for (const auto& layer : layers) { - if (layer->is()) { + if (layer->is() && !layer->as()->getTextField().isUndefined()) { layer->as()->getTextFont().match( [&] (Undefined) { result.insert({"Open Sans Regular", "Arial Unicode MS Regular"}); diff --git a/test/fixtures/style_parser/font_stacks.json b/test/fixtures/style_parser/font_stacks.json index 07fe223d46..0ff3e936a8 100644 --- a/test/fixtures/style_parser/font_stacks.json +++ b/test/fixtures/style_parser/font_stacks.json @@ -12,6 +12,7 @@ "source": "source", "source-layer": "source-layer", "layout": { + "text-field": "a", "text-font": ["a"] } }, { @@ -20,6 +21,7 @@ "source": "source", "source-layer": "source-layer", "layout": { + "text-field": "a", "text-font": { "stops": [[0, ["a", "b"]]] } @@ -30,6 +32,7 @@ "source": "source", "source-layer": "source-layer", "layout": { + "text-field": "a", "text-font": { "stops": [[0, ["a", "b"]], [1, ["a", "b", "c"]]] } diff --git a/test/style/style_parser.test.cpp b/test/style/style_parser.test.cpp index 7f7c06f4c5..43b982c3b9 100644 --- a/test/style/style_parser.test.cpp +++ b/test/style/style_parser.test.cpp @@ -103,6 +103,23 @@ TEST(StyleParser, FontStacks) { ASSERT_EQ(FontStack({"a", "b", "c"}), result[2]); } +TEST(StyleParser, FontStacksNoTextField) { + style::Parser parser; + parser.parse(R"({ + "version": 8, + "layers": [{ + "id": "symbol", + "type": "symbol", + "source": "vector", + "layout": { + "text-font": ["a"] + } + }] + })"); + auto result = parser.fontStacks(); + ASSERT_EQ(0u, result.size()); +} + TEST(StyleParser, FontStacksCaseExpression) { style::Parser parser; parser.parse(R"({ @@ -112,6 +129,7 @@ TEST(StyleParser, FontStacksCaseExpression) { "type": "symbol", "source": "vector", "layout": { + "text-field": "a", "text-font": ["case", ["==", "a", ["string", ["get", "text-font"]]], ["literal", ["Arial"]], ["literal", ["Helvetica"]]] } }] @@ -131,6 +149,7 @@ TEST(StyleParser, FontStacksMatchExpression) { "type": "symbol", "source": "vector", "layout": { + "text-field": "a", "text-font": ["match", ["get", "text-font"], "a", ["literal", ["Arial"]], ["literal", ["Helvetica"]]] } }] @@ -150,6 +169,7 @@ TEST(StyleParser, FontStacksStepExpression) { "type": "symbol", "source": "vector", "layout": { + "text-field": "a", "text-font": ["array", "string", ["step", ["get", "text-font"], ["literal", ["Arial"]], 0, ["literal", ["Helvetica"]]]] } }] @@ -170,6 +190,7 @@ TEST(StyleParser, FontStacksGetExpression) { "type": "symbol", "source": "vector", "layout": { + "text-field": "a", "text-font": ["array", "string", ["get", "text-font"]] } }] -- cgit v1.2.1 From ff891054a2a2eb85e6d1e9908ad929caa0229033 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Fri, 26 Jan 2018 11:43:03 +0100 Subject: [android] - update changelog for v6.0.0-beta.1 --- platform/android/CHANGELOG.md | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/platform/android/CHANGELOG.md b/platform/android/CHANGELOG.md index 95cf3a21ff..fa212b86ad 100644 --- a/platform/android/CHANGELOG.md +++ b/platform/android/CHANGELOG.md @@ -2,9 +2,28 @@ 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. -## master +## 6.0.0-beta.1 - January 26, 2018 + - Binding integration for expressions [#10654](https://github.com/mapbox/mapbox-gl-native/pull/10654) + - CustomGeometrySource [#9983](https://github.com/mapbox/mapbox-gl-native/pull/9983) + - HillshadeLayer and RasterDemSource [#11031](https://github.com/mapbox/mapbox-gl-native/pull/11031) + - Revisit marker placement for snapshot [#11029](https://github.com/mapbox/mapbox-gl-native/pull/11029) + - SafeVarargs annotation for expressions [#11027](https://github.com/mapbox/mapbox-gl-native/pull/11027) + - Expression#toString [#11024](https://github.com/mapbox/mapbox-gl-native/pull/11024) + - Rename initRenderSurface to onSurfaceCreated [#11023](https://github.com/mapbox/mapbox-gl-native/pull/11023) + - Expose attribution manager as public API [#10942](https://github.com/mapbox/mapbox-gl-native/pull/10942) + - Replace Mapzen vector source example with Mapillary [#10931](https://github.com/mapbox/mapbox-gl-native/pull/10931) - Add Hebrew localization [#10967](https://github.com/mapbox/mapbox-gl-native/pull/10967) - + - Cleanup gradle configuration files [#10903](https://github.com/mapbox/mapbox-gl-native/pull/10903) + - Send double tap event only once [#10855](https://github.com/mapbox/mapbox-gl-native/pull/10855) + - Parameter validation for LatLngBounds#from [#10831](https://github.com/mapbox/mapbox-gl-native/pull/10831) + - Replace JSON parsing [#10815](https://github.com/mapbox/mapbox-gl-native/pull/10815) + - Orientation change regression test [#10814](https://github.com/mapbox/mapbox-gl-native/pull/10814) + - Max & min LatLng constants [#10780](https://github.com/mapbox/mapbox-gl-native/pull/10780) + - LatLng#wrap return new instance of LatLng [#10769](https://github.com/mapbox/mapbox-gl-native/pull/10769) + - Custom library loader [#10733](https://github.com/mapbox/mapbox-gl-native/pull/10733) + - Inconsistent parameters for LatLngBounds.union [#10728](https://github.com/mapbox/mapbox-gl-native/pull/10728) + - Gradle 4.1 / AS 3.0 [#10549](https://github.com/mapbox/mapbox-gl-native/pull/10549) + ## 5.3.2 - January 22, 2018 - Validate surface creation before destroying [#10890](https://github.com/mapbox/mapbox-gl-native/pull/10890) - Add filesource activation ot OfflineRegion [#10904](https://github.com/mapbox/mapbox-gl-native/pull/10904) -- cgit v1.2.1 From 828847101b2e2ca3351cc403588b3738794d923c Mon Sep 17 00:00:00 2001 From: Tobrun Date: Fri, 26 Jan 2018 11:49:26 +0100 Subject: [android] - release android v6.0.0-beta.1 --- circle.yml | 2 +- platform/android/MapboxGLAndroidSDKTestApp/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/circle.yml b/circle.yml index c7e1e519c7..1374a541e1 100644 --- a/circle.yml +++ b/circle.yml @@ -414,7 +414,7 @@ jobs: - deploy: name: Publish to Maven command: | - if [ "${CIRCLE_BRANCH}" == "master" ]; then make run-android-upload-archives ; fi + if [ "${CIRCLE_BRANCH}" == "release-boba" ]; then make run-android-upload-archives ; fi # ------------------------------------------------------------------------------ diff --git a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle index 3723ae2acf..3740341e94 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle +++ b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle @@ -8,7 +8,7 @@ android { applicationId "com.mapbox.mapboxsdk.testapp" minSdkVersion androidVersions.minSdkVersion targetSdkVersion androidVersions.targetSdkVersion - versionCode 12 + versionCode 13 versionName "6.0.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } -- cgit v1.2.1 From 02e6265c836358f71e7297ff6588d7c00e49b608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Fri, 26 Jan 2018 17:24:59 -0800 Subject: [ios] Made NSExpression+MGLAdditions.h public --- platform/ios/ios.xcodeproj/project.pbxproj | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index d44fee3430..10928e8e8d 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -55,7 +55,7 @@ 3510FFEC1D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3510FFE91D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.mm */; }; 3510FFED1D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3510FFE91D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.mm */; }; 3510FFF01D6D9D8C00F413B2 /* NSExpression+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 3510FFEE1D6D9D8C00F413B2 /* NSExpression+MGLAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 3510FFF11D6D9D8C00F413B2 /* NSExpression+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 3510FFEE1D6D9D8C00F413B2 /* NSExpression+MGLAdditions.h */; }; + 3510FFF11D6D9D8C00F413B2 /* NSExpression+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 3510FFEE1D6D9D8C00F413B2 /* NSExpression+MGLAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3510FFF21D6D9D8C00F413B2 /* NSExpression+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3510FFEF1D6D9D8C00F413B2 /* NSExpression+MGLAdditions.mm */; }; 3510FFF31D6D9D8C00F413B2 /* NSExpression+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3510FFEF1D6D9D8C00F413B2 /* NSExpression+MGLAdditions.mm */; }; 3510FFF91D6DCC4700F413B2 /* NSCompoundPredicate+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 3510FFF71D6DCC4700F413B2 /* NSCompoundPredicate+MGLAdditions.h */; }; @@ -444,6 +444,8 @@ DA8963381CC549A100684375 /* sprites in Resources */ = {isa = PBXBuildFile; fileRef = DA8963341CC549A100684375 /* sprites */; }; DA8963391CC549A100684375 /* styles in Resources */ = {isa = PBXBuildFile; fileRef = DA8963351CC549A100684375 /* styles */; }; DA89633A1CC549A100684375 /* tiles in Resources */ = {isa = PBXBuildFile; fileRef = DA8963361CC549A100684375 /* tiles */; }; + DA9EA82B201C0C0C00F9874D /* NSExpression+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DA9EA82A201C0C0B00F9874D /* NSExpression+MGLAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DA9EA82C201C0C0C00F9874D /* NSExpression+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DA9EA82A201C0C0B00F9874D /* NSExpression+MGLAdditions.h */; }; DAA32CC31E4C6B65006F8D24 /* MGLDistanceFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 3557F7AF1E1D27D300CCA5E6 /* MGLDistanceFormatter.m */; }; DAA4E4081CBB6C9500178DFB /* Mapbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA8847D21CBAF91600AB86E3 /* Mapbox.framework */; }; DAA4E4091CBB6C9500178DFB /* Mapbox.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DA8847D21CBAF91600AB86E3 /* Mapbox.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; @@ -1020,6 +1022,7 @@ DA9C012C1E4C7ADB00C4742A /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = "pt-BR"; path = "pt-BR.lproj/Foundation.stringsdict"; sourceTree = ""; }; DA9C012D1E4C7B1F00C4742A /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/Localizable.strings"; sourceTree = ""; }; DA9C012E1E4C7B6100C4742A /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/Root.strings"; sourceTree = ""; }; + DA9EA82A201C0C0B00F9874D /* NSExpression+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSExpression+MGLAdditions.h"; sourceTree = ""; }; DAA32CA11E4C44DB006F8D24 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = de; path = de.lproj/Foundation.stringsdict; sourceTree = ""; }; DAA32CA21E4C44DD006F8D24 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = de; path = de.lproj/Localizable.stringsdict; sourceTree = ""; }; DAA32CA31E4C44F1006F8D24 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Foundation.strings; sourceTree = ""; }; @@ -1789,6 +1792,7 @@ 408AA8561DAEDA0800022900 /* NSDictionary+MGLAdditions.mm */, DA8848141CBAFA6200AB86E3 /* NSException+MGLAdditions.h */, 3510FFEE1D6D9D8C00F413B2 /* NSExpression+MGLAdditions.h */, + DA9EA82A201C0C0B00F9874D /* NSExpression+MGLAdditions.h */, DAC25FCB200FD83E009BE98E /* NSExpression+MGLPrivateAdditions.h */, 3510FFEF1D6D9D8C00F413B2 /* NSExpression+MGLAdditions.mm */, 35B82BF61D6C5F8400B1B721 /* NSPredicate+MGLAdditions.h */, @@ -1982,6 +1986,7 @@ DA8848841CBB033F00AB86E3 /* FABAttributes.h in Headers */, DA8847FD1CBAFA5100AB86E3 /* MGLTilePyramidOfflineRegion.h in Headers */, DA88482F1CBAFA6200AB86E3 /* NSProcessInfo+MGLAdditions.h in Headers */, + DA9EA82B201C0C0C00F9874D /* NSExpression+MGLAdditions.h in Headers */, DA8848601CBAFC2E00AB86E3 /* Mapbox.h in Headers */, DAF0D8101DFE0EA000B28378 /* MGLRasterSource_Private.h in Headers */, 350098BB1D480108004B2AF0 /* MGLVectorSource.h in Headers */, @@ -2012,6 +2017,7 @@ DABFB8641CBE99E500D62B32 /* MGLOfflineStorage.h in Headers */, 96E516E32000552A00A02306 /* MGLAccountManager_Private.h in Headers */, 96E5170420005A6B00A02306 /* SMCalloutView.h in Headers */, + DA9EA82C201C0C0C00F9874D /* NSExpression+MGLAdditions.h in Headers */, 96036A02200565C700510F3D /* NSOrthography+MGLAdditions.h in Headers */, DAD165791CF4CDFF001FF4B9 /* MGLShapeCollection.h in Headers */, 4049C29E1DB6CD6C00B3F799 /* MGLPointCollection.h in Headers */, -- cgit v1.2.1 From 2d6fcd3178503df318d52f1fdf698648f968d1b1 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Tue, 30 Jan 2018 15:35:23 +0100 Subject: [android] - update javadoc with links to style specification --- .../mapboxsdk/style/expressions/Expression.java | 139 ++++++++++++++++++++- 1 file changed, 138 insertions(+), 1 deletion(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java index 7b841a2580..0f76f590c2 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java @@ -246,7 +246,7 @@ public class Expression { } /** - * Create a literal object expression + * Create a literal object expression. * * @param object the object * @return the expression @@ -280,6 +280,7 @@ public class Expression { * @param green green color expression * @param blue blue color expression * @return expression + * @see Style specification */ public static Expression rgb(@NonNull Expression red, @NonNull Expression green, @NonNull Expression blue) { @@ -297,6 +298,7 @@ public class Expression { * @param green green color value * @param blue blue color value * @return expression + * @see Style specification */ public static Expression rgb(@NonNull Number red, @NonNull Number green, @NonNull Number blue) { return rgb(literal(red), literal(green), literal(blue)); @@ -314,6 +316,7 @@ public class Expression { * @param blue blue color value * @param alpha alpha color value * @return expression + * @see Style specification */ public static Expression rgba(@NonNull Expression red, @NonNull Expression green, @NonNull Expression blue, @NonNull Expression alpha) { @@ -332,6 +335,7 @@ public class Expression { * @param blue blue color value * @param alpha alpha color value * @return expression + * @see Style specification */ public static Expression rgba(@NonNull Number red, @NonNull Number green, @NonNull Number blue, @NonNull Number alpha) { return rgba(literal(red), literal(green), literal(blue), literal(alpha)); @@ -342,6 +346,7 @@ public class Expression { * * @param expression an expression to convert to a color * @return expression + * @see Style specification */ public static Expression toRgba(@NonNull Expression expression) { return new Expression<>("to-rgba", expression); @@ -358,6 +363,7 @@ public class Expression { * @param compareOne the first expression * @param compareTwo the second expression * @return expression + * @see Style specification */ public static Expression eq(@NonNull Expression compareOne, @NonNull Expression compareTwo) { return new Expression<>("==", compareOne, compareTwo); @@ -369,6 +375,7 @@ public class Expression { * @param compareOne the first boolean * @param compareTwo the second boolean * @return expression + * @see Style specification */ public static Expression eq(boolean compareOne, boolean compareTwo) { return eq(literal(compareOne), literal(compareTwo)); @@ -380,6 +387,7 @@ public class Expression { * @param compareOne the first number * @param compareTwo the second number * @return expression + * @see Style specification */ public static Expression eq(@NonNull String compareOne, @NonNull String compareTwo) { return eq(literal(compareOne), literal(compareTwo)); @@ -391,6 +399,7 @@ public class Expression { * @param compareOne the first number * @param compareTwo the second number * @return expression + * @see Style specification */ public static Expression eq(@NonNull Number compareOne, @NonNull Number compareTwo) { return eq(literal(compareOne), literal(compareTwo)); @@ -403,6 +412,7 @@ public class Expression { * @param compareOne the first expression * @param compareTwo the second expression * @return expression + * @see Style specification */ public static Expression neq(@NonNull Expression compareOne, @NonNull Expression compareTwo) { return new Expression<>("!=", compareOne, compareTwo); @@ -414,6 +424,7 @@ public class Expression { * @param compareOne the first boolean * @param compareTwo the second boolean * @return expression + * @see Style specification */ public static Expression neq(boolean compareOne, boolean compareTwo) { return new Expression<>("!=", literal(compareOne), literal(compareTwo)); @@ -425,6 +436,7 @@ public class Expression { * @param compareOne the first string * @param compareTwo the second string * @return expression + * @see Style specification */ public static Expression neq(@NonNull String compareOne, @NonNull String compareTwo) { return new Expression<>("!=", literal(compareOne), literal(compareTwo)); @@ -436,6 +448,7 @@ public class Expression { * @param compareOne the first number * @param compareTwo the second number * @return expression + * @see Style specification */ public static Expression neq(@NonNull Number compareOne, @NonNull Number compareTwo) { return new Expression<>("!=", literal(compareOne), literal(compareTwo)); @@ -448,6 +461,7 @@ public class Expression { * @param compareOne the first expression * @param compareTwo the second expression * @return expression + * @see Style specification */ public static Expression gt(@NonNull Expression compareOne, @NonNull Expression compareTwo) { return new Expression<>(">", compareOne, compareTwo); @@ -459,6 +473,7 @@ public class Expression { * @param compareOne the first number * @param compareTwo the second number * @return expression + * @see Style specification */ public static Expression gt(@NonNull Number compareOne, @NonNull Number compareTwo) { return new Expression<>(">", literal(compareOne), literal(compareTwo)); @@ -470,6 +485,7 @@ public class Expression { * @param compareOne the first string * @param compareTwo the second string * @return expression + * @see Style specification */ public static Expression gt(@NonNull String compareOne, @NonNull String compareTwo) { return new Expression<>(">", literal(compareOne), literal(compareTwo)); @@ -482,6 +498,7 @@ public class Expression { * @param compareOne the first number * @param compareTwo the second number * @return expression + * @see Style specification */ public static Expression lt(@NonNull Expression compareOne, @NonNull Expression compareTwo) { return new Expression<>("<", compareOne, compareTwo); @@ -493,6 +510,7 @@ public class Expression { * @param compareOne the first number * @param compareTwo the second number * @return expression + * @see Style specification */ public static Expression lt(@NonNull Number compareOne, @NonNull Number compareTwo) { return new Expression<>("<", literal(compareOne), literal(compareTwo)); @@ -504,6 +522,7 @@ public class Expression { * @param compareOne the first string * @param compareTwo the second string * @return expression + * @see Style specification */ public static Expression lt(@NonNull String compareOne, @NonNull String compareTwo) { return new Expression<>("<", literal(compareOne), literal(compareTwo)); @@ -516,6 +535,7 @@ public class Expression { * @param compareOne the first expression * @param compareTwo the second expression * @return expression + * @see Style specification */ public static Expression gte(@NonNull Expression compareOne, @NonNull Expression compareTwo) { return new Expression<>(">=", compareOne, compareTwo); @@ -527,6 +547,7 @@ public class Expression { * @param compareOne the first number * @param compareTwo the second number * @return expression + * @see Style specification */ public static Expression gte(@NonNull Number compareOne, @NonNull Number compareTwo) { return new Expression<>(">=", literal(compareOne), literal(compareTwo)); @@ -538,6 +559,7 @@ public class Expression { * @param compareOne the first string * @param compareTwo the second string * @return expression + * @see Style specification */ public static Expression gte(@NonNull String compareOne, @NonNull String compareTwo) { return new Expression<>(">=", literal(compareOne), literal(compareTwo)); @@ -550,6 +572,7 @@ public class Expression { * @param compareOne the first expression * @param compareTwo the second expression * @return expression + * @see Style specification */ public static Expression lte(@NonNull Expression compareOne, @NonNull Expression compareTwo) { return new Expression<>("<=", compareOne, compareTwo); @@ -561,6 +584,7 @@ public class Expression { * @param compareOne the first number * @param compareTwo the second number * @return expression + * @see Style specification */ public static Expression lte(@NonNull Number compareOne, @NonNull Number compareTwo) { return new Expression<>("<=", literal(compareOne), literal(compareTwo)); @@ -572,6 +596,7 @@ public class Expression { * @param compareOne the first string * @param compareTwo the second string * @return expression + * @see Style specification */ public static Expression lte(@NonNull String compareOne, @NonNull String compareTwo) { return new Expression<>("<=", literal(compareOne), literal(compareTwo)); @@ -587,6 +612,7 @@ public class Expression { * * @param input expression input * @return expression + * @see Style specification */ @SafeVarargs public static Expression all(@NonNull Expression... input) { @@ -603,6 +629,7 @@ public class Expression { * * @param input expression input * @return expression + * @see Style specification */ @SafeVarargs public static Expression any(@NonNull Expression... input) { @@ -614,6 +641,7 @@ public class Expression { * * @param input expression input * @return expression + * @see Style specification */ public static Expression not(@NonNull Expression input) { return new Expression<>("!", input); @@ -624,6 +652,7 @@ public class Expression { * * @param input boolean input * @return expression + * @see Style specification */ public static Expression not(boolean input) { return not(literal(input)); @@ -631,9 +660,14 @@ public class Expression { /** * Selects the first output whose corresponding test condition evaluates to true. + *

+ * For each case a condition and an output should be provided. + * The last parameter should provide the default output. + *

* * @param input expression input * @return expression + * @see Style specification */ @SafeVarargs public static Expression switchCase(@NonNull @Size(min = 1) Expression... input) { @@ -647,6 +681,7 @@ public class Expression { * * @param input expression input * @return expression + * @see Style specification */ public static Expression match(@NonNull @Size(min = 2) Expression... input) { return new Expression("match", input); @@ -659,6 +694,7 @@ public class Expression { * * @param input expression input * @return expression + * @see Style specification */ public static Expression match(@NonNull Expression input, @NonNull Stop... stops) { Expression[] expressions = new Expression[stops.length * 2]; @@ -674,6 +710,7 @@ public class Expression { * * @param input expression input * @return expression + * @see Style specification */ public static Expression coalesce(@NonNull Expression... input) { return new Expression("coalesce", input); @@ -690,6 +727,7 @@ public class Expression { *

* * @return expression + * @see Style specification */ public static Expression properties() { return new Expression<>("properties"); @@ -699,6 +737,7 @@ public class Expression { * Gets the feature's geometry type: Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon. * * @return expression + * @see Style specification */ public static Expression geometryType() { return new Expression<>("geometry-type"); @@ -708,6 +747,7 @@ public class Expression { * Gets the feature's id, if it has one. * * @return expression + * @see Style specification */ public static Expression id() { return new Expression<>("id"); @@ -723,6 +763,7 @@ public class Expression { * Can only be used in the `heatmap-color` property. * * @return expression + * @see Style specification */ public static Expression heatmapDensity() { return new Expression<>("heatmap-density"); @@ -738,6 +779,7 @@ public class Expression { * @param number the index expression * @param expression the array expression * @return expression + * @see Style specification */ public static Expression at(@NonNull Expression number, @NonNull Expression expression) { return new Expression<>("at", number, expression); @@ -749,6 +791,7 @@ public class Expression { * @param number the index expression * @param expression the array expression * @return expression + * @see Style specification */ public static Expression at(@NonNull Number number, @NonNull Expression expression) { return at(literal(number), expression); @@ -761,6 +804,7 @@ public class Expression { * * @param input expression input * @return expression + * @see Style specification */ public static Expression get(@NonNull Expression input) { return new Expression<>("get", input); @@ -773,6 +817,7 @@ public class Expression { * * @param input string input * @return expression + * @see Style specification */ public static Expression get(@NonNull String input) { return get(literal(input)); @@ -785,6 +830,7 @@ public class Expression { * @param key a property value key * @param object an expression object * @return expression + * @see Style specification */ public static Expression get(@NonNull Expression key, @NonNull Expression object) { return new Expression<>("get", key, object); @@ -797,6 +843,7 @@ public class Expression { * @param key a property value key * @param object an expression object * @return expression + * @see Style specification */ public static Expression get(@NonNull String key, @NonNull Expression object) { return get(literal(key), object); @@ -807,6 +854,7 @@ public class Expression { * * @param key the expression property value key * @return expression + * @see Style specification */ public static Expression has(@NonNull Expression key) { return new Expression<>("has", key); @@ -817,6 +865,7 @@ public class Expression { * * @param key the property value key * @return expression + * @see Style specification */ public static Expression has(@NonNull String key) { return has(literal(key)); @@ -828,6 +877,7 @@ public class Expression { * @param key the expression property value key * @param object an expression object * @return expression + * @see Style specification */ public static Expression has(@NonNull Expression key, @NonNull Expression object) { return new Expression<>("has", key, object); @@ -839,6 +889,7 @@ public class Expression { * @param key the property value key * @param object an expression object * @return expression + * @see Style specification */ public static Expression has(@NonNull String key, @NonNull Expression object) { return has(literal(key), object); @@ -849,6 +900,7 @@ public class Expression { * * @param expression an expression object or expression string * @return expression + * @see Style specification */ public static Expression length(@NonNull Expression expression) { return new Expression<>("length", expression); @@ -859,6 +911,7 @@ public class Expression { * * @param input a string * @return expression + * @see Style specification */ public static Expression length(@NonNull String input) { return length(literal(input)); @@ -872,6 +925,7 @@ public class Expression { * Returns mathematical constant ln(2). * * @return expression + * @see Style specification */ public static Expression ln2() { return new Expression<>("ln2"); @@ -881,6 +935,7 @@ public class Expression { * Returns the mathematical constant pi. * * @return expression + * @see Style specification */ public static Expression pi() { return new Expression<>("pi"); @@ -890,6 +945,7 @@ public class Expression { * Returns the mathematical constant e. * * @return expression + * @see Style specification */ public static Expression e() { return new Expression<>("e"); @@ -900,6 +956,7 @@ public class Expression { * * @param numbers the numbers to calculate the sum for * @return expression + * @see Style specification */ @SafeVarargs public static Expression sum(@Size(min = 2) Expression... numbers) { @@ -911,6 +968,7 @@ public class Expression { * * @param numbers the numbers to calculate the sum for * @return expression + * @see Style specification */ @SuppressWarnings("unchecked") public static Expression sum(@Size(min = 2) Number... numbers) { @@ -926,6 +984,7 @@ public class Expression { * * @param numbers the numbers to calculate the product for * @return expression + * @see Style specification */ @SafeVarargs public static Expression product(@Size(min = 2) Expression... numbers) { @@ -937,6 +996,7 @@ public class Expression { * * @param numbers the numbers to calculate the product for * @return expression + * @see Style specification */ @SuppressWarnings("unchecked") public static Expression product(@Size(min = 2) Number... numbers) { @@ -952,6 +1012,7 @@ public class Expression { * * @param number the number subtract from 0 * @return expression + * @see Style specification */ public static Expression subtract(@NonNull Expression number) { return new Expression<>("-", number); @@ -962,6 +1023,7 @@ public class Expression { * * @param number the number subtract from 0 * @return expression + * @see Style specification */ public static Expression subtract(@NonNull Number number) { return subtract(literal(number)); @@ -973,6 +1035,7 @@ public class Expression { * @param first the first number * @param second the second number * @return expression + * @see Style specification */ public static Expression subtract(@NonNull Expression first, @NonNull Expression second) { return new Expression<>("-", first, second); @@ -984,6 +1047,7 @@ public class Expression { * @param first the first number * @param second the second number * @return expression + * @see Style specification */ public static Expression subtract(@NonNull Number first, @NonNull Number second) { return subtract(literal(first), literal(second)); @@ -995,6 +1059,7 @@ public class Expression { * @param first the first number * @param second the second number * @return expression + * @see Style specification */ @SuppressWarnings("unchecked") public static Expression division(@NonNull Expression first, @NonNull Expression second) { @@ -1007,6 +1072,7 @@ public class Expression { * @param first the first number * @param second the second number * @return expression + * @see Style specification */ @SuppressWarnings("unchecked") public static Expression division(@NonNull Number first, @NonNull Number second) { @@ -1019,6 +1085,7 @@ public class Expression { * @param first the first number * @param second the second number * @return expression + * @see Style specification */ public static Expression mod(@NonNull Expression first, @NonNull Expression second) { return new Expression<>("%", first, second); @@ -1030,6 +1097,7 @@ public class Expression { * @param first the first number * @param second the second number * @return expression + * @see Style specification */ public static Expression mod(@NonNull Number first, @NonNull Number second) { return mod(literal(first), literal(second)); @@ -1041,6 +1109,7 @@ public class Expression { * @param first the first number * @param second the second number * @return expression + * @see Style specification */ public static Expression pow(@NonNull Expression first, @NonNull Expression second) { return new Expression<>("^", first, second); @@ -1052,6 +1121,7 @@ public class Expression { * @param first the first number * @param second the second number * @return expression + * @see Style specification */ public static Expression pow(@NonNull Number first, @NonNull Number second) { return pow(literal(first), literal(second)); @@ -1062,6 +1132,7 @@ public class Expression { * * @param number the number to take the square root from * @return expression + * @see Style specification */ public static Expression sqrt(@NonNull Expression number) { return new Expression<>("sqrt", number); @@ -1072,6 +1143,7 @@ public class Expression { * * @param number the number to take the square root from * @return expression + * @see Style specification */ public static Expression sqrt(@NonNull Number number) { return sqrt(literal(number)); @@ -1082,6 +1154,7 @@ public class Expression { * * @param number the number to take base-ten logarithm from * @return expression + * @see Style specification */ public static Expression log10(@NonNull Expression number) { return new Expression<>("log10", number); @@ -1092,6 +1165,7 @@ public class Expression { * * @param number the number to take base-ten logarithm from * @return expression + * @see Style specification */ public static Expression log10(@NonNull Number number) { return log10(literal(number)); @@ -1102,6 +1176,7 @@ public class Expression { * * @param number the number to take natural logarithm from * @return expression + * @see Style specification */ public static Expression ln(Expression number) { return new Expression<>("ln", number); @@ -1112,6 +1187,7 @@ public class Expression { * * @param number the number to take natural logarithm from * @return expression + * @see Style specification */ public static Expression ln(Number number) { return ln(literal(number)); @@ -1122,6 +1198,7 @@ public class Expression { * * @param number the number to take base-two logarithm from * @return expression + * @see Style specification */ public static Expression log2(@NonNull Expression number) { return new Expression<>("log2", number); @@ -1132,6 +1209,7 @@ public class Expression { * * @param number the number to take base-two logarithm from * @return expression + * @see Style specification */ public static Expression log2(@NonNull Number number) { return log2(literal(number)); @@ -1142,6 +1220,7 @@ public class Expression { * * @param number the number to calculate the sine for * @return expression + * @see Style specification */ public static Expression sin(@NonNull Expression number) { return new Expression<>("sin", number); @@ -1152,6 +1231,7 @@ public class Expression { * * @param number the number to calculate the sine for * @return expression + * @see Style specification */ public static Expression sin(@NonNull Number number) { return sin(literal(number)); @@ -1162,6 +1242,7 @@ public class Expression { * * @param number the number to calculate the cosine for * @return expression + * @see Style specification */ public static Expression cos(@NonNull Expression number) { return new Expression<>("cos", number); @@ -1172,6 +1253,7 @@ public class Expression { * * @param number the number to calculate the cosine for * @return expression + * @see Style specification */ public static Expression cos(@NonNull Number number) { return new Expression<>("cos", literal(number)); @@ -1182,6 +1264,7 @@ public class Expression { * * @param number the number to calculate the tangent for * @return expression + * @see Style specification */ public static Expression tan(@NonNull Expression number) { return new Expression<>("tan", number); @@ -1192,6 +1275,7 @@ public class Expression { * * @param number the number to calculate the tangent for * @return expression + * @see Style specification */ public static Expression tan(@NonNull Number number) { return new Expression<>("tan", literal(number)); @@ -1202,6 +1286,7 @@ public class Expression { * * @param number the number to calculate the arcsine for * @return expression + * @see Style specification */ public static Expression asin(@NonNull Expression number) { return new Expression<>("asin", number); @@ -1212,6 +1297,7 @@ public class Expression { * * @param number the number to calculate the arcsine for * @return expression + * @see Style specification */ public static Expression asin(@NonNull Number number) { return asin(literal(number)); @@ -1222,6 +1308,7 @@ public class Expression { * * @param number the number to calculate the arccosine for * @return expression + * @see Style specification */ public static Expression acos(@NonNull Expression number) { return new Expression<>("acos", number); @@ -1232,6 +1319,7 @@ public class Expression { * * @param number the number to calculate the arccosine for * @return expression + * @see Style specification */ public static Expression acos(@NonNull Number number) { return acos(literal(number)); @@ -1242,6 +1330,7 @@ public class Expression { * * @param number the number to calculate the arctangent for * @return expression + * @see Style specification */ public static Expression atan(@NonNull Expression number) { return new Expression("atan", number); @@ -1252,6 +1341,7 @@ public class Expression { * * @param number the number to calculate the arctangent for * @return expression + * @see Style specification */ public static Expression atan(@NonNull Number number) { return atan(literal(number)); @@ -1262,6 +1352,7 @@ public class Expression { * * @param numbers varargs of numbers to get the minimum from * @return expression + * @see Style specification */ @SafeVarargs public static Expression min(@Size(min = 1) Expression... numbers) { @@ -1273,6 +1364,7 @@ public class Expression { * * @param numbers varargs of numbers to get the minimum from * @return expression + * @see Style specification */ @SuppressWarnings("unchecked") public static Expression min(@Size(min = 1) Number... numbers) { @@ -1288,6 +1380,7 @@ public class Expression { * * @param numbers varargs of numbers to get the maximum from * @return expression + * @see Style specification */ @SafeVarargs public static Expression max(@Size(min = 1) Expression... numbers) { @@ -1299,6 +1392,7 @@ public class Expression { * * @param numbers varargs of numbers to get the maximum from * @return expression + * @see Style specification */ @SuppressWarnings("unchecked") public static Expression max(@Size(min = 1) Number... numbers) { @@ -1322,6 +1416,7 @@ public class Expression { * * @param string the string to upcase * @return expression + * @see Style specification */ public static Expression upcase(@NonNull Expression string) { return new Expression<>("upcase", string); @@ -1336,6 +1431,7 @@ public class Expression { * * @param string string to upcase * @return expression + * @see Style specification */ public static Expression upcase(@NonNull String string) { return upcase(literal(string)); @@ -1350,6 +1446,7 @@ public class Expression { * * @param input expression input * @return expression + * @see Style specification */ public static Expression downcase(@NonNull Expression input) { return new Expression<>("downcase", input); @@ -1364,6 +1461,7 @@ public class Expression { * * @param input string to downcase * @return expression + * @see Style specification */ public static Expression downcase(@NonNull String input) { return downcase(literal(input)); @@ -1374,6 +1472,7 @@ public class Expression { * * @param input expression input * @return expression + * @see Style specification */ @SafeVarargs public static Expression concat(@NonNull Expression... input) { @@ -1385,6 +1484,7 @@ public class Expression { * * @param input expression input * @return expression + * @see Style specification */ @SuppressWarnings("unchecked") public static Expression concat(@NonNull String... input) { @@ -1406,6 +1506,7 @@ public class Expression { * * @param input expression input * @return expression + * @see Style specification */ public static Expression array(@NonNull Expression input) { return new Expression<>("array", input); @@ -1416,6 +1517,7 @@ public class Expression { * * @param input expression input * @return expression + * @see Style specification */ public static Expression typeOf(@NonNull Expression input) { return new Expression<>("typeof", input); @@ -1428,6 +1530,7 @@ public class Expression { * * @param input expression input * @return expression + * @see Style specification */ public static Expression string(@NonNull Expression input) { return new Expression<>("string", input); @@ -1440,6 +1543,7 @@ public class Expression { * * @param input expression input * @return expression + * @see Style specification */ public static Expression number(@NonNull Expression input) { return new Expression<>("number", input); @@ -1452,6 +1556,7 @@ public class Expression { * * @param input expression input * @return expression + * @see Style specification */ public static Expression bool(@NonNull Expression input) { return new Expression<>("boolean", input); @@ -1462,6 +1567,7 @@ public class Expression { * * @param input expression input * @return expression + * @see Style specification */ public static Expression object(@NonNull Expression input) { return new Expression<>("object", input); @@ -1479,6 +1585,7 @@ public class Expression { * * @param input expression input * @return expression + * @see Style specification */ public static Expression toString(@NonNull Expression input) { return new Expression<>("to-string", input); @@ -1494,6 +1601,7 @@ public class Expression { * * @param input expression input * @return expression + * @see Style specification */ public static Expression toNumber(@NonNull Expression input) { return new Expression<>("to-number", input); @@ -1505,6 +1613,7 @@ public class Expression { * * @param input expression input * @return expression + * @see Style specification */ public static Expression toBool(@NonNull Expression input) { return new Expression<>("to-boolean", input); @@ -1517,6 +1626,7 @@ public class Expression { * * @param input expression input * @return expression + * @see Style specification */ public static Expression toColor(@NonNull Expression input) { return new Expression<>("to-color", input); @@ -1532,6 +1642,7 @@ public class Expression { * * @param input expression input * @return expression + * @see Style specification */ @SafeVarargs public static Expression let(@Size(min = 1) Expression... input) { @@ -1543,6 +1654,7 @@ public class Expression { * * @param expression the variable naming expression that was bound with using let * @return expression + * @see Style specification */ public static Expression var(@NonNull Expression expression) { return new Expression<>("var", expression); @@ -1553,6 +1665,7 @@ public class Expression { * * @param variableName the variable naming that was bound with using let * @return expression + * @see Style specification */ public static Expression var(@NonNull String variableName) { return var(literal(variableName)); @@ -1570,6 +1683,7 @@ public class Expression { *

* * @return expression + * @see Style specification */ public static Expression zoom() { return new Expression<>("zoom"); @@ -1579,6 +1693,13 @@ public class Expression { // Ramps, scales, curves // + /** + * Produces a stop value to be used as part of the step expression. + * + * @param stop the stop input + * @param value the stop output + * @return the stop + */ public static Stop stop(@NonNull Object stop, @NonNull Object value) { return new Stop(stop, value); } @@ -1593,6 +1714,7 @@ public class Expression { * @param input the input value * @param stops pair of input and output values * @return expression + * @see Style specification */ @SafeVarargs public static Expression step(@NonNull Number input, @NonNull Expression expression, Expression... stops) { @@ -1609,6 +1731,7 @@ public class Expression { * @param expression the input expression * @param stops pair of input and output values * @return expression + * @see Style specification */ @SafeVarargs public static Expression step(@NonNull Expression input, @NonNull Expression expression, Expression... stops) { @@ -1625,6 +1748,7 @@ public class Expression { * @param input the input value * @param stops pair of input and output values * @return expression + * @see Style specification */ @SafeVarargs public static Expression step(@NonNull Number input, @NonNull Expression expression, Stop... stops) { @@ -1646,6 +1770,7 @@ public class Expression { * @param input the input value * @param stops pair of input and output values * @return expression + * @see Style specification */ @SafeVarargs public static Expression step(@NonNull Expression input, @NonNull Expression expression, Stop... stops) { @@ -1667,6 +1792,7 @@ public class Expression { * @param number the input expression * @param stops pair of input and output values * @return expression + * @see Style specification */ @SafeVarargs public static Expression interpolate(@NonNull Expression interpolation, @@ -1684,6 +1810,7 @@ public class Expression { * @param number the input expression * @param stops pair of input and output values * @return expression + * @see Style specification */ @SafeVarargs public static Expression interpolate(@NonNull Expression interpolation, @@ -1700,6 +1827,7 @@ public class Expression { * interpolates linearly between the pair of stops just less than and just greater than the input. * * @return expression + * @see Style specification */ public static Expression linear() { return new Expression<>("linear"); @@ -1713,6 +1841,7 @@ public class Expression { * * @param base value controlling the route at which the output increases * @return expression + * @see Style specification */ public static Expression exponential(@NonNull Number base) { return exponential(literal(base)); @@ -1726,6 +1855,7 @@ public class Expression { * * @param expression base number expression * @return expression + * @see Style specification */ public static Expression exponential(@NonNull Expression expression) { return new Expression<>("exponential", expression); @@ -1739,6 +1869,7 @@ public class Expression { * @param x2 x value of the second point of a cubic bezier, ranges from 0 to 1 * @param y2 y value fo the second point of a cubic bezier, ranges from 0 to 1 * @return expression + * @see Style specification */ public static Expression cubicBezier(@NonNull Expression x1, @NonNull Expression y1, @NonNull Expression x2, @NonNull Expression y2) { @@ -1753,6 +1884,7 @@ public class Expression { * @param x2 x value of the second point of a cubic bezier, ranges from 0 to 1 * @param y2 y value fo the second point of a cubic bezier, ranges from 0 to 1 * @return expression + * @see Style specification */ public static Expression cubicBezier(@NonNull Number x1, @NonNull Number y1, @NonNull Number x2, @NonNull Number y2) { @@ -1777,6 +1909,11 @@ public class Expression { } + /** + * Returns a string representation of the object that matches the definition set in the style specification. + * + * @return a string representation of the object. + */ @Override public String toString() { StringBuilder builder = new StringBuilder(); -- cgit v1.2.1 From 954c20b8c1832e0d94c4495a152b795df56ae967 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Thu, 25 Jan 2018 14:04:13 +0100 Subject: [android] - blacklist adreno 2xx for VAO support --- src/mbgl/gl/context.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp index 7444ac112c..b6244d58c7 100644 --- a/src/mbgl/gl/context.cpp +++ b/src/mbgl/gl/context.cpp @@ -258,9 +258,10 @@ UniqueTexture Context::createTexture() { bool Context::supportsVertexArrays() const { static bool blacklisted = []() { - // Blacklist Adreno 3xx as it crashes on glBuffer(Sub)Data + // Blacklist Adreno 2xx, 3xx as it crashes on glBuffer(Sub)Data const std::string renderer = reinterpret_cast(glGetString(GL_RENDERER)); - return renderer.find("Adreno (TM) 3") != std::string::npos; + return renderer.find("Adreno (TM) 2") != std::string::npos + || renderer.find("Adreno (TM) 3") != std::string::npos; }(); return !blacklisted && -- cgit v1.2.1 From 3714aa94e779b4a5a3d6d531b6a4273ae2275ba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Paczos?= Date: Mon, 29 Jan 2018 15:36:38 -0500 Subject: [android] - log lack of permissions only if enabling location --- .../src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java index 6eacbbaeaf..81fd091c90 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java @@ -374,7 +374,7 @@ public final class TrackingSettings { } private void setMyLocationEnabled(boolean locationEnabled, boolean isCustomLocationSource) { - if (!PermissionsManager.areLocationPermissionsGranted(myLocationView.getContext())) { + if (locationEnabled && !PermissionsManager.areLocationPermissionsGranted(myLocationView.getContext())) { Timber.e("Could not activate user location tracking: " + "user did not accept the permission or permissions were not requested."); return; -- cgit v1.2.1 From cdf65020c18812d492d94a64b9fc42853442de22 Mon Sep 17 00:00:00 2001 From: Martin Hellwig Date: Thu, 25 Jan 2018 17:04:53 +0100 Subject: Implement new bearingTrackingMode GPS_NORTH_FACING --- .../mapboxsdk/constants/MyBearingTracking.java | 7 ++++++- .../mapboxsdk/maps/widgets/MyLocationView.java | 23 +++++++++++++++++----- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyBearingTracking.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyBearingTracking.java index ceac862f39..c042b00577 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyBearingTracking.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyBearingTracking.java @@ -22,7 +22,7 @@ import java.lang.annotation.RetentionPolicy; */ public class MyBearingTracking { - @IntDef( {NONE, COMPASS, GPS}) + @IntDef( {NONE, COMPASS, GPS, GPS_NORTH_FACING}) @Retention(RetentionPolicy.SOURCE) public @interface Mode { } @@ -42,4 +42,9 @@ public class MyBearingTracking { */ public static final int GPS = 0x00000008; + /** + * Tracking the bearing of the user based on GPS data, but camera always faces north direction + */ + public static final int GPS_NORTH_FACING = 0x0000000B; + } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java index 4f27e0ada8..1cdd91028d 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java @@ -356,7 +356,9 @@ public class MyLocationView extends View { foregroundDrawable.draw(canvas); } } else if (foregroundBearingDrawable != null && foregroundBounds != null) { - if (myBearingTrackingMode == MyBearingTracking.GPS || compassListener.isSensorAvailable()) { + if (myBearingTrackingMode == MyBearingTracking.GPS + || myBearingTrackingMode == MyBearingTracking.GPS_NORTH_FACING + || compassListener.isSensorAvailable()) { foregroundBearingDrawable.draw(canvas); } else { // We are tracking MyBearingTracking.COMPASS, but sensor is not available. @@ -383,7 +385,8 @@ public class MyLocationView extends View { public void setBearing(double bearing) { this.bearing = bearing; if (myLocationTrackingMode == MyLocationTracking.TRACKING_NONE) { - if (myBearingTrackingMode == MyBearingTracking.GPS) { + if (myBearingTrackingMode == MyBearingTracking.GPS + || myBearingTrackingMode == MyBearingTracking.GPS_NORTH_FACING) { if (location != null) { setCompass(location.getBearing() - bearing); } @@ -519,7 +522,8 @@ public class MyLocationView extends View { } private void toggleGps(boolean enableGps) { - toggleGps(enableGps, mapboxMap != null && mapboxMap.getTrackingSettings().isCustomLocationSource()); + toggleGps(enableGps, mapboxMap != null + && mapboxMap.getTrackingSettings().isCustomLocationSource()); } /** @@ -580,7 +584,8 @@ public class MyLocationView extends View { this.location = location; myLocationBehavior.updateLatLng(location); - if (mapboxMap != null && myBearingTrackingMode == MyBearingTracking.GPS + if (mapboxMap != null && (myBearingTrackingMode == MyBearingTracking.GPS + || myBearingTrackingMode == MyBearingTracking.GPS_NORTH_FACING) && myLocationTrackingMode == MyLocationTracking.TRACKING_NONE) { setBearing(mapboxMap.getCameraPosition().bearing); } @@ -616,7 +621,8 @@ public class MyLocationView extends View { compassListener.onResume(); } else { compassListener.onPause(); - if (myLocationTrackingMode == MyLocationTracking.TRACKING_FOLLOW) { + if (myLocationTrackingMode == MyLocationTracking.TRACKING_FOLLOW + && myBearingTrackingMode == MyBearingTracking.GPS) { // always face north setCompass(0); } else { @@ -1017,6 +1023,13 @@ public class MyLocationView extends View { setCompass(0, COMPASS_UPDATE_RATE_MS); } + if (myBearingTrackingMode == MyBearingTracking.GPS_NORTH_FACING) { + builder.bearing(0); + if (location.hasBearing()) { + setCompass(location.getBearing(), COMPASS_UPDATE_RATE_MS); + } + } + // accuracy updateAccuracy(location); -- cgit v1.2.1 From c9ef84316ac3336f86de1473ed0b17fb33fc46d6 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Wed, 31 Jan 2018 13:18:49 +0100 Subject: [android] - update changelog for 5.4.0 --- platform/android/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/android/CHANGELOG.md b/platform/android/CHANGELOG.md index fa212b86ad..88ce0cf697 100644 --- a/platform/android/CHANGELOG.md +++ b/platform/android/CHANGELOG.md @@ -2,6 +2,12 @@ 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.4.0 - January 30, 2018 + - Blacklist Adreno 2xx GPU for VAO support [#11047](https://github.com/mapbox/mapbox-gl-native/pull/11047) + - Bearing tracking mode GPS_NORTH_FACING [#11095](https://github.com/mapbox/mapbox-gl-native/pull/11095) + - Disable logging missing location permissons [#11084](https://github.com/mapbox/mapbox-gl-native/pull/11084) + - Create offline handler using the main thread looper [#11021](https://github.com/mapbox/mapbox-gl-native/pull/11021) + ## 6.0.0-beta.1 - January 26, 2018 - Binding integration for expressions [#10654](https://github.com/mapbox/mapbox-gl-native/pull/10654) - CustomGeometrySource [#9983](https://github.com/mapbox/mapbox-gl-native/pull/9983) -- cgit v1.2.1 From afdb2916537f648f17122fa2c96f8b88759d28cc Mon Sep 17 00:00:00 2001 From: Tobrun Date: Wed, 31 Jan 2018 14:30:25 +0100 Subject: [android] - blacklist flaky instrumentation tests --- circle.yml | 15 ++------------- platform/android/scripts/exclude-activity-gen.json | 7 ++++++- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/circle.yml b/circle.yml index 1374a541e1..c40b6c9c11 100644 --- a/circle.yml +++ b/circle.yml @@ -339,21 +339,10 @@ jobs: shell: /bin/bash -euo pipefail command: | gcloud firebase test android models list - (gcloud firebase test android run --type instrumentation \ + gcloud firebase test android run --type instrumentation \ --app platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk/debug/MapboxGLAndroidSDKTestApp-debug.apk \ --test platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk/androidTest/debug/MapboxGLAndroidSDKTestApp-debug-androidTest.apk \ - --device-ids sailfish --os-version-ids 26 --locales en --orientations portrait --timeout 20m \ - 2>&1 | tee firebase.log) || EXIT_CODE=$? - - FIREBASE_TEST_BUCKET=$(sed -n 's|^.*\[https://console.developers.google.com/storage/browser/\([^]]*\).*|gs://\1|p' firebase.log) - echo "Downloading from: ${FIREBASE_TEST_BUCKET}" - gsutil -m cp -n -R -Z "$FIREBASE_TEST_BUCKET*" platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk/debug - - echo "Try running ndk-stack on downloaded logcat to symbolicate the stacktraces:" - find platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk/debug -type f -name "logcat" -print0 | \ - xargs -0 -I '{}' ${ANDROID_NDK_HOME}/ndk-stack -sym build/android-arm-v7/Debug -dump {} - - exit ${EXIT_CODE:-0} + --device-ids sailfish --os-version-ids 26 --locales en --orientations portrait --timeout 20m - store_artifacts: path: platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk/debug destination: . diff --git a/platform/android/scripts/exclude-activity-gen.json b/platform/android/scripts/exclude-activity-gen.json index f05001c6ae..c1a6b5bb48 100644 --- a/platform/android/scripts/exclude-activity-gen.json +++ b/platform/android/scripts/exclude-activity-gen.json @@ -27,5 +27,10 @@ "QueryRenderedFeaturesBoxHighlightActivity", "MultiMapActivity", "MapInDialogActivity", - "SimpleMapActivity" + "SimpleMapActivity", + "ManualZoomActivity", + "MaxMinZoomActivity", + "ScrollByActivity", + "ZoomFunctionSymbolLayerActivity", + "SymbolGeneratorActivity" ] \ No newline at end of file -- cgit v1.2.1 From 1d48a7d2ff33cfe239ffa6822062085b70397963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Tue, 6 Feb 2018 22:03:26 -0800 Subject: [ios] Removed byte order mark --- platform/ios/framework/Settings.bundle/ca.lproj/Root.strings | 2 +- platform/ios/framework/Settings.bundle/de.lproj/Root.strings | 2 +- platform/ios/framework/Settings.bundle/es.lproj/Root.strings | 2 +- platform/ios/framework/Settings.bundle/fi.lproj/Root.strings | 2 +- platform/ios/framework/Settings.bundle/fr.lproj/Root.strings | 2 +- platform/ios/framework/Settings.bundle/lt.lproj/Root.strings | 2 +- platform/ios/framework/Settings.bundle/nl.lproj/Root.strings | 2 +- platform/ios/framework/Settings.bundle/pl.lproj/Root.strings | 2 +- platform/ios/framework/Settings.bundle/pt-BR.lproj/Root.strings | 2 +- platform/ios/framework/Settings.bundle/sv.lproj/Root.strings | 2 +- platform/ios/framework/Settings.bundle/uk.lproj/Root.strings | 2 +- platform/ios/framework/Settings.bundle/vi.lproj/Root.strings | 2 +- platform/ios/framework/Settings.bundle/zh-Hans.lproj/Root.strings | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/platform/ios/framework/Settings.bundle/ca.lproj/Root.strings b/platform/ios/framework/Settings.bundle/ca.lproj/Root.strings index 94e8335582..3f6104a075 100644 --- a/platform/ios/framework/Settings.bundle/ca.lproj/Root.strings +++ b/platform/ios/framework/Settings.bundle/ca.lproj/Root.strings @@ -1,3 +1,3 @@ -"TELEMETRY_GROUP_TITLE" = "Configuració de privacitat"; +"TELEMETRY_GROUP_TITLE" = "Configuració de privacitat"; "TELEMETRY_SWITCH_TITLE" = "Telemetria Mapbox"; "TELEMETRY_GROUP_FOOTER" = "Aquest ajust permet que l’aplicació comparteixi dades anònimes de localització i ús amb Mapbox."; diff --git a/platform/ios/framework/Settings.bundle/de.lproj/Root.strings b/platform/ios/framework/Settings.bundle/de.lproj/Root.strings index c57189d4af..30bd2252ce 100644 --- a/platform/ios/framework/Settings.bundle/de.lproj/Root.strings +++ b/platform/ios/framework/Settings.bundle/de.lproj/Root.strings @@ -1,3 +1,3 @@ -"TELEMETRY_GROUP_TITLE" = "Privatsphäre-Einstellungen"; +"TELEMETRY_GROUP_TITLE" = "Privatsphäre-Einstellungen"; "TELEMETRY_SWITCH_TITLE" = "Mapbox-Telemetrie"; "TELEMETRY_GROUP_FOOTER" = "Diese Einstellung erlaubt der Applikation, anonymisierte Orts- und Nutzungsdaten an Mapbox zu senden."; diff --git a/platform/ios/framework/Settings.bundle/es.lproj/Root.strings b/platform/ios/framework/Settings.bundle/es.lproj/Root.strings index bb0c52dcde..48da358189 100644 --- a/platform/ios/framework/Settings.bundle/es.lproj/Root.strings +++ b/platform/ios/framework/Settings.bundle/es.lproj/Root.strings @@ -1,3 +1,3 @@ -"TELEMETRY_GROUP_TITLE" = "Ajustes de privacidad"; +"TELEMETRY_GROUP_TITLE" = "Ajustes de privacidad"; "TELEMETRY_SWITCH_TITLE" = "Telemetría Mapbox"; "TELEMETRY_GROUP_FOOTER" = "Esta configuración permite que la aplicación comparta datos anónimos de ubicación y uso con Mapbox."; diff --git a/platform/ios/framework/Settings.bundle/fi.lproj/Root.strings b/platform/ios/framework/Settings.bundle/fi.lproj/Root.strings index e0c2e50d09..b12a017e8a 100644 --- a/platform/ios/framework/Settings.bundle/fi.lproj/Root.strings +++ b/platform/ios/framework/Settings.bundle/fi.lproj/Root.strings @@ -1,3 +1,3 @@ -"TELEMETRY_GROUP_TITLE" = "Yksityisyysasetukset"; +"TELEMETRY_GROUP_TITLE" = "Yksityisyysasetukset"; "TELEMETRY_SWITCH_TITLE" = "Mapbox-telemetria"; "TELEMETRY_GROUP_FOOTER" = "Tämä asetus antaa sovellukselle luvan jakaa anonymisoituja sijainti- ja käyttötietoja Mapboxille."; diff --git a/platform/ios/framework/Settings.bundle/fr.lproj/Root.strings b/platform/ios/framework/Settings.bundle/fr.lproj/Root.strings index c386d9846d..f00e8e2fe8 100644 --- a/platform/ios/framework/Settings.bundle/fr.lproj/Root.strings +++ b/platform/ios/framework/Settings.bundle/fr.lproj/Root.strings @@ -1,3 +1,3 @@ -"TELEMETRY_GROUP_TITLE" = "Paramètres de confidentialité"; +"TELEMETRY_GROUP_TITLE" = "Paramètres de confidentialité"; "TELEMETRY_SWITCH_TITLE" = "Télémétrie Mapbox"; "TELEMETRY_GROUP_FOOTER" = "Cette option permet à l’application de partager des données de localisation et d’utilisation anonymes avec Mapbox."; diff --git a/platform/ios/framework/Settings.bundle/lt.lproj/Root.strings b/platform/ios/framework/Settings.bundle/lt.lproj/Root.strings index 832b16608b..5ae715439a 100644 --- a/platform/ios/framework/Settings.bundle/lt.lproj/Root.strings +++ b/platform/ios/framework/Settings.bundle/lt.lproj/Root.strings @@ -1,3 +1,3 @@ -"TELEMETRY_GROUP_TITLE" = "Privatumo nustatymai"; +"TELEMETRY_GROUP_TITLE" = "Privatumo nustatymai"; "TELEMETRY_SWITCH_TITLE" = "Mapbox Telemetrija"; "TELEMETRY_GROUP_FOOTER" = "Šis nustatymas leidžia programėlei dalintis su Mapbox anonimizuota lokacija bei naudojimosi duomenimis."; diff --git a/platform/ios/framework/Settings.bundle/nl.lproj/Root.strings b/platform/ios/framework/Settings.bundle/nl.lproj/Root.strings index ea73b0ba3c..9f09002349 100644 --- a/platform/ios/framework/Settings.bundle/nl.lproj/Root.strings +++ b/platform/ios/framework/Settings.bundle/nl.lproj/Root.strings @@ -1,3 +1,3 @@ -"TELEMETRY_GROUP_TITLE" = "Privacy Instellingen"; +"TELEMETRY_GROUP_TITLE" = "Privacy Instellingen"; "TELEMETRY_SWITCH_TITLE" = "Mapbox Telemetrie"; "TELEMETRY_GROUP_FOOTER" = "Deze instelling laat toe om anonieme locatie en gebruiksgegevens te delen met Mapbox."; diff --git a/platform/ios/framework/Settings.bundle/pl.lproj/Root.strings b/platform/ios/framework/Settings.bundle/pl.lproj/Root.strings index 4cf2c71381..f273a15293 100644 --- a/platform/ios/framework/Settings.bundle/pl.lproj/Root.strings +++ b/platform/ios/framework/Settings.bundle/pl.lproj/Root.strings @@ -1,3 +1,3 @@ -"TELEMETRY_GROUP_TITLE" = "Ustawienia prywatności"; +"TELEMETRY_GROUP_TITLE" = "Ustawienia prywatności"; "TELEMETRY_SWITCH_TITLE" = "Mapbox Telemetria"; "TELEMETRY_GROUP_FOOTER" = "Ta opcja pozwala aplikacji na anonimowe wysyłanie lokalizacji i danych do Mapbox."; diff --git a/platform/ios/framework/Settings.bundle/pt-BR.lproj/Root.strings b/platform/ios/framework/Settings.bundle/pt-BR.lproj/Root.strings index 5b81fb66eb..f96fadd205 100644 --- a/platform/ios/framework/Settings.bundle/pt-BR.lproj/Root.strings +++ b/platform/ios/framework/Settings.bundle/pt-BR.lproj/Root.strings @@ -1,3 +1,3 @@ -"TELEMETRY_GROUP_TITLE" = "Configurações de privacidade"; +"TELEMETRY_GROUP_TITLE" = "Configurações de privacidade"; "TELEMETRY_SWITCH_TITLE" = "Telemetria do Mapbox"; "TELEMETRY_GROUP_FOOTER" = "Essa configuração permite que o aplicativo compartilhe dados de localização e uso anônimos com o Mapbox."; diff --git a/platform/ios/framework/Settings.bundle/sv.lproj/Root.strings b/platform/ios/framework/Settings.bundle/sv.lproj/Root.strings index f8324c14c4..e771af505a 100644 --- a/platform/ios/framework/Settings.bundle/sv.lproj/Root.strings +++ b/platform/ios/framework/Settings.bundle/sv.lproj/Root.strings @@ -1,3 +1,3 @@ -"TELEMETRY_GROUP_TITLE" = "Sekretessinställningar"; +"TELEMETRY_GROUP_TITLE" = "Sekretessinställningar"; "TELEMETRY_SWITCH_TITLE" = "Mapbox Telemetri"; "TELEMETRY_GROUP_FOOTER" = "Denna inställning tillåter applikationen att dela anonymiserad plats och användningsdata med Mapbox."; diff --git a/platform/ios/framework/Settings.bundle/uk.lproj/Root.strings b/platform/ios/framework/Settings.bundle/uk.lproj/Root.strings index 5d2bfd648e..b1615849f6 100644 --- a/platform/ios/framework/Settings.bundle/uk.lproj/Root.strings +++ b/platform/ios/framework/Settings.bundle/uk.lproj/Root.strings @@ -1,3 +1,3 @@ -"TELEMETRY_GROUP_TITLE" = "Налаштування конфіденційності"; +"TELEMETRY_GROUP_TITLE" = "Налаштування конфіденційності"; "TELEMETRY_SWITCH_TITLE" = "Телеметрія Mapbox"; "TELEMETRY_GROUP_FOOTER" = "Ці налаштування дозволяють застосунку надсилати анонімізовані дані про місце знаходження та використання даних до Mapbox."; diff --git a/platform/ios/framework/Settings.bundle/vi.lproj/Root.strings b/platform/ios/framework/Settings.bundle/vi.lproj/Root.strings index e156d9937a..29060d00a4 100644 --- a/platform/ios/framework/Settings.bundle/vi.lproj/Root.strings +++ b/platform/ios/framework/Settings.bundle/vi.lproj/Root.strings @@ -1,3 +1,3 @@ -"TELEMETRY_GROUP_TITLE" = "Thiết lập Quyền riêng tư"; +"TELEMETRY_GROUP_TITLE" = "Thiết lập Quyền riêng tư"; "TELEMETRY_SWITCH_TITLE" = "Trình viễn trắc Mapbox"; "TELEMETRY_GROUP_FOOTER" = "Tùy chọn này cho phép ứng dụng gửi cho Mapbox các vị trí và dữ liệu sử dụng được vô danh hóa."; diff --git a/platform/ios/framework/Settings.bundle/zh-Hans.lproj/Root.strings b/platform/ios/framework/Settings.bundle/zh-Hans.lproj/Root.strings index 3cfb1a4bad..b9e1a98325 100644 --- a/platform/ios/framework/Settings.bundle/zh-Hans.lproj/Root.strings +++ b/platform/ios/framework/Settings.bundle/zh-Hans.lproj/Root.strings @@ -1,3 +1,3 @@ -"TELEMETRY_GROUP_TITLE" = "隐私设置"; +"TELEMETRY_GROUP_TITLE" = "隐私设置"; "TELEMETRY_SWITCH_TITLE" = "Mapbox传感数据"; "TELEMETRY_GROUP_FOOTER" = "此设置允许应用将用户位置和数据以匿名的方式分享给Mapbox。"; -- cgit v1.2.1 From 6757456e1604c69035246756a4ac28b5c8b0460f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Tue, 6 Feb 2018 22:00:17 -0800 Subject: [android, ios, macos] Updated Russian translations --- .../src/main/res/values-ru/strings.xml | 17 ++++--- .../Settings.bundle/ru.lproj/Root.strings | 6 +-- .../ios/resources/ru.lproj/Localizable.strings | 58 +++++++++++++++------- .../ios/resources/ru.lproj/Localizable.stringsdict | 50 ++++++++++++++----- platform/macos/sdk/ru.lproj/Localizable.strings | 6 +-- 5 files changed, 93 insertions(+), 44 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-ru/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-ru/strings.xml index 39880d56ba..a274125257 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values-ru/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values-ru/strings.xml @@ -1,15 +1,16 @@ - Компас. Активируйте, чтобы повернуть карту на Север. - Иконка атрибутов. Активируйте, чтобы показать диалог. - Местоположение. Отображает ваше местоположение на карте. - Отображает карту, созданную при помощи Mapbox. Протисните при помощи двух пальцев. Приблизьте, соединением пальцев. - Mapbox Android SDK + Компас. Активируйте, чтобы развернуть карту на север. + Значок атрибутов. Активируйте, чтобы показать диалог. + Местоположение. Отображает вашу позицию на карте. + Отображает карту, созданную при помощи Mapbox. Пролистывайте двумя пальцами. Меняйте масштаб сведением пальцев. + Mapbox Maps SDK для Android Сделать карты Mapbox лучше - Вы помогаете сделать карты OpenStreetMap и Mapbox лучше путем предоставления анонимных данных об использовании. + Вы помогаете улучшать карты OpenStreetMap и Mapbox, предоставляя обезличенные данные об использовании. Согласен Не согласен Дополнительная информация - Запрошенный OfflineRegionDefinition не входит в допустимые границы: %s - + На устройстве нет веб-браузера, нельзя показать веб-страницу. + Запрошенный OfflineRegionDefinition не входит в допустимые границы: %s + Настройки телеметрии diff --git a/platform/ios/framework/Settings.bundle/ru.lproj/Root.strings b/platform/ios/framework/Settings.bundle/ru.lproj/Root.strings index 2883ec4b87..3e37d64126 100644 --- a/platform/ios/framework/Settings.bundle/ru.lproj/Root.strings +++ b/platform/ios/framework/Settings.bundle/ru.lproj/Root.strings @@ -1,3 +1,3 @@ -"TELEMETRY_GROUP_TITLE" = "Настройки приватности"; -"TELEMETRY_SWITCH_TITLE" = "Mapbox Телеметрия"; -"TELEMETRY_GROUP_FOOTER" = "Эта настройка разрешает приложению отправлять анонимную позицию и данные об использовании в Mapbox"; +"TELEMETRY_GROUP_TITLE" = "Настройки приватности"; +"TELEMETRY_SWITCH_TITLE" = "Телеметрия Mapbox"; +"TELEMETRY_GROUP_FOOTER" = "Эта настройка разрешает приложению отправлять обезличенные данные об использовании и местоположении в Mapbox."; diff --git a/platform/ios/resources/ru.lproj/Localizable.strings b/platform/ios/resources/ru.lproj/Localizable.strings index 6d5ea9025e..b6ceffd520 100644 --- a/platform/ios/resources/ru.lproj/Localizable.strings +++ b/platform/ios/resources/ru.lproj/Localizable.strings @@ -1,44 +1,47 @@ /* Accessibility hint */ -"ANNOTATION_A11Y_HINT" = "Показать больше информации"; +"ANNOTATION_A11Y_HINT" = "Дополнительная информация"; /* No comment provided by engineer. */ -"API_CLIENT_400_DESC" = "The session data task failed. Original request was:%@"; +"API_CLIENT_400_DESC" = "Во время обмена данными произошла ошибка. Оригинал запроса: %@"; /* No comment provided by engineer. */ -"API_CLIENT_400_REASON" = "The status code was %ld"; +"API_CLIENT_400_REASON" = "Код ответа %ld"; /* No comment provided by engineer. */ "CANCEL" = "Отмена"; /* Accessibility hint for closing the selected annotation’s callout view and returning to the map */ -"CLOSE_CALLOUT_A11Y_HINT" = "Вернуться на карту"; +"CLOSE_CALLOUT_A11Y_HINT" = "Вернуться к карте"; /* Accessibility hint */ -"COMPASS_A11Y_HINT" = "Повернуть карту на север"; +"COMPASS_A11Y_HINT" = "Развернуть карту на север"; /* Accessibility label */ "COMPASS_A11Y_LABEL" = "Компас"; /* Compass abbreviation for north */ -"COMPASS_NORTH" = "N"; +"COMPASS_NORTH" = "С"; /* Instructions in Interface Builder designable; {key}, {plist file name} */ -"DESIGNABLE" = "Для отображения здесь карт Mapbox задайте %1$@ к вашему токену доступа в %2$@\n\nПодробные инструкции см.:"; +"DESIGNABLE" = "Для отображения здесь карт Mapbox, задайте %1$@ для вашего токена доступа в %2$@\n\nПодробные инструкции:"; /* Setup documentation URL display string; keep as short as possible */ "FIRST_STEPS_URL" = "mapbox.com/help/first-steps-ios-sdk"; /* Accessibility hint */ -"INFO_A11Y_HINT" = "Показать авторство, форму обратной связи и многое другое"; +"INFO_A11Y_HINT" = "Показать благодарности, форму отправки отзыва и другое"; /* Accessibility label */ "INFO_A11Y_LABEL" = "Об этой карте"; +/* List separator */ +"LIST_SEPARATOR" = ", "; + /* User-friendly error description */ "LOAD_MAP_FAILED_DESC" = "Не удалось загрузить карту из-за неизвестной ошибки."; /* User-friendly error description */ -"LOAD_STYLE_FAILED_DESC" = "Не удалось загрузить карту так как невозможно загрузить стиль."; +"LOAD_STYLE_FAILED_DESC" = "Не удалось загрузить карту из-за ошибки загрузки стиля."; /* Accessibility label */ "LOGO_A11Y_LABEL" = "Mapbox"; @@ -46,23 +49,44 @@ /* Accessibility label */ "MAP_A11Y_LABEL" = "Карта"; -/* Map accessibility value */ -"MAP_A11Y_VALUE" = "Масштаб %1$dx\n%2$ld аннотации(й) видны"; +/* Map accessibility value; {number of visible annotations} */ +"MAP_A11Y_VALUE_ANNOTATIONS" = "Показано %ld аннотаций."; + +/* Map accessibility value; {list of visible places} */ +"MAP_A11Y_VALUE_PLACES" = "Показано мест: %@."; + +/* Map accessibility value; {number of visible roads} */ +"MAP_A11Y_VALUE_ROADS" = "Показано %ld дорог."; + +/* Map accessibility value; {zoom level} */ +"MAP_A11Y_VALUE_ZOOM" = "Масштаб %dx."; /* User-friendly error description */ "PARSE_STYLE_FAILED_DESC" = "Не удалось загрузить карту из-за ошибки в стиле."; +/* String format for accessibility value for road feature; {starting compass direction}, {ending compass direction} */ +"ROAD_DIRECTION_A11Y_FMT" = "%1$@ на %2$@"; + +/* Accessibility value indicating that a road is a divided road (dual carriageway) */ +"ROAD_DIVIDED_A11Y_VALUE" = "Двусторонняя дорога"; + +/* Accessibility value indicating that a road is a one-way road */ +"ROAD_ONEWAY_A11Y_VALUE" = "Односторонняя дорога"; + +/* String format for accessibility value for road feature; {route number} */ +"ROAD_REF_A11Y_FMT" = "Трасса %@"; + /* Action sheet title */ -"SDK_NAME" = "Mapbox Maps SDK for iOS"; +"SDK_NAME" = "Mapbox Maps SDK для iOS"; /* Developer-only SDK update notification; {latest version, in format x.x.x} */ -"SDK_UPDATE_AVAILABLE" = "Mapbox Maps SDK for iOS версии %@теперь доступен."; +"SDK_UPDATE_AVAILABLE" = "Доступна версия Mapbox Maps SDK %@ для iOS:"; /* User-friendly error description */ -"STYLE_NOT_FOUND_DESC" = "Не удалось загрузить карту так как стиль не найден или несовместим."; +"STYLE_NOT_FOUND_DESC" = "Не удалось загрузить карту, так как стиль не найден или несовместим."; /* Telemetry prompt message */ -"TELEMETRY_DISABLED_MSG" = "Вы можете помочь сделать карты OpenStreetMap и Mapbox лучше путем предоставления анонимных данных об использовании."; +"TELEMETRY_DISABLED_MSG" = "Вы поможете улучшить карты OpenStreetMap и Mapbox, предоставляя обезличенные данные об использовании."; /* Telemetry prompt button */ "TELEMETRY_DISABLED_OFF" = "Не участвовать"; @@ -71,7 +95,7 @@ "TELEMETRY_DISABLED_ON" = "Участвовать"; /* Telemetry prompt message */ -"TELEMETRY_ENABLED_MSG" = "Вы помогаете сделать карты OpenStreetMap и Mapbox лучше путем предоставления анонимных данных об использовании."; +"TELEMETRY_ENABLED_MSG" = "Вы помогаете улучшать карты OpenStreetMap и Mapbox, предоставляя обезличенные данные об использовании."; /* Telemetry prompt button */ "TELEMETRY_ENABLED_OFF" = "Прекратить участие"; @@ -83,7 +107,7 @@ "TELEMETRY_MORE" = "Узнать больше"; /* Action in attribution sheet */ -"TELEMETRY_NAME" = "Mapbox телеметрия"; +"TELEMETRY_NAME" = "Телеметрия Mapbox"; /* Telemetry prompt title */ "TELEMETRY_TITLE" = "Сделать карты Mapbox лучше"; diff --git a/platform/ios/resources/ru.lproj/Localizable.stringsdict b/platform/ios/resources/ru.lproj/Localizable.stringsdict index 81877703b1..fabd557780 100644 --- a/platform/ios/resources/ru.lproj/Localizable.stringsdict +++ b/platform/ios/resources/ru.lproj/Localizable.stringsdict @@ -2,26 +2,30 @@ - MAP_A11Y_VALUE + MAP_A11Y_VALUE_ANNOTATIONS NSStringLocalizedFormatKey - %#@level@ -%#@count@ - level + %#@count@ + count NSStringFormatSpecTypeKey NSStringPluralRuleType NSStringFormatValueTypeKey - d + ld one - Масштаб %dx + Показана %d аннотация few - Масштаб %dx + Показано %d аннотации many - Масштаб %dx + Показано %d аннотаций other - Масштаб %dx + Показано %d аннотаций + + MAP_A11Y_VALUE_ROADS + + NSStringLocalizedFormatKey + %#@count@ count NSStringFormatSpecTypeKey @@ -29,13 +33,33 @@ NSStringFormatValueTypeKey ld one - %d аннотация видны + Показана %d дорога few - %d аннотации видны + Показано %d дороги many - %d аннотаций видны + Показано %d дорог other - %d аннотации видны + Показано %d дорог + + + MAP_A11Y_VALUE_ZOOM + + NSStringLocalizedFormatKey + %#@level@ + level + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + Масштаб %dx + few + Масштаб %dx + many + Масштаб %dx + other + Масштаб %dx diff --git a/platform/macos/sdk/ru.lproj/Localizable.strings b/platform/macos/sdk/ru.lproj/Localizable.strings index 067e05b14e..8554c9ebd1 100644 --- a/platform/macos/sdk/ru.lproj/Localizable.strings +++ b/platform/macos/sdk/ru.lproj/Localizable.strings @@ -1,8 +1,8 @@ -/* User-friendly error description */ -"LOAD_MAP_FAILED_DESC" = "Не удалось загрузит карту из-за неизвестной ошибки."; +/* User-friendly error description */ +"LOAD_MAP_FAILED_DESC" = "Не удалось загрузить карту из-за неизвестной ошибки."; /* User-friendly error description */ -"LOAD_STYLE_FAILED_DESC" = "Не удалось загрузить карту так как невозможно загрузить стиль."; +"LOAD_STYLE_FAILED_DESC" = "Не удалось загрузить карту из-за ошибки загрузки стиля."; /* Accessibility title */ "MAP_A11Y_TITLE" = "Mapbox"; -- cgit v1.2.1 From bffc834ff17748ebc6e7ad298a94a520bbd887cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Tue, 6 Feb 2018 22:03:58 -0800 Subject: [ios] Updated Swedish translations --- .../ios/resources/sv.lproj/Localizable.stringsdict | 38 +++++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/platform/ios/resources/sv.lproj/Localizable.stringsdict b/platform/ios/resources/sv.lproj/Localizable.stringsdict index 90115bd803..5f44d19b37 100644 --- a/platform/ios/resources/sv.lproj/Localizable.stringsdict +++ b/platform/ios/resources/sv.lproj/Localizable.stringsdict @@ -2,22 +2,26 @@ - MAP_A11Y_VALUE + MAP_A11Y_VALUE_ANNOTATIONS NSStringLocalizedFormatKey - %#@level@ -%#@count@ - level + %#@count@ + count NSStringFormatSpecTypeKey NSStringPluralRuleType NSStringFormatValueTypeKey - d + ld one - Zoom %dx + %d annotering synlig other - Zoom %dx + %d annoteringar synliga + + MAP_A11Y_VALUE_ROADS + + NSStringLocalizedFormatKey + %#@count@ count NSStringFormatSpecTypeKey @@ -25,9 +29,25 @@ NSStringFormatValueTypeKey ld one - %d annotering synlig + %d väg synlig other - %d annoteringar synliga + %d vägar synliga + + + MAP_A11Y_VALUE_ZOOM + + NSStringLocalizedFormatKey + %#@level@ + level + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + Zooma %dx + other + Zooma %dx -- cgit v1.2.1 From 6e7b839fe057da3a8478f9ff033ebc49c75a146e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Tue, 6 Feb 2018 22:04:30 -0800 Subject: [macos] Updated Hungarian translations --- platform/macos/sdk/hu.lproj/Localizable.strings | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/macos/sdk/hu.lproj/Localizable.strings b/platform/macos/sdk/hu.lproj/Localizable.strings index b3724190cb..062b1f5cea 100644 --- a/platform/macos/sdk/hu.lproj/Localizable.strings +++ b/platform/macos/sdk/hu.lproj/Localizable.strings @@ -1,8 +1,8 @@ -/* User-friendly error description */ +/* User-friendly error description */ "LOAD_MAP_FAILED_DESC" = "Egy ismeretlen hiba miatt nem sikerült betölteni a térképet."; /* User-friendly error description */ -"LOAD_STYLE_FAILED_DESC" = "Nem sikerült betölteni a térképet, mert a stílus nem tölthető be."; +"LOAD_STYLE_FAILED_DESC" = "Nem sikerült betölteni a térképet, mert a stílust nem lehetett betölteni."; /* Accessibility title */ "MAP_A11Y_TITLE" = "Mapbox"; -- cgit v1.2.1 From e6d6a231e861f3e1e1f8c193bb17196dec9d05eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Tue, 6 Feb 2018 22:07:12 -0800 Subject: [ios, macos] Added Danish localization --- .../darwin/resources/da.lproj/Foundation.strings | 297 +++++++++++++++++++++ .../resources/da.lproj/Foundation.stringsdict | 54 ++++ platform/ios/CHANGELOG.md | 2 +- platform/ios/app/da.lproj/Localizable.strings | 0 .../Settings.bundle/da.lproj/Root.strings | 3 + platform/ios/ios.xcodeproj/project.pbxproj | 13 + .../ios/resources/da.lproj/Localizable.strings | 117 ++++++++ .../ios/resources/da.lproj/Localizable.stringsdict | 54 ++++ platform/macos/CHANGELOG.md | 2 +- platform/macos/app/da.lproj/Localizable.strings | 0 platform/macos/macos.xcodeproj/project.pbxproj | 9 + platform/macos/sdk/da.lproj/Localizable.strings | 27 ++ 12 files changed, 576 insertions(+), 2 deletions(-) create mode 100644 platform/darwin/resources/da.lproj/Foundation.strings create mode 100644 platform/darwin/resources/da.lproj/Foundation.stringsdict create mode 100644 platform/ios/app/da.lproj/Localizable.strings create mode 100644 platform/ios/framework/Settings.bundle/da.lproj/Root.strings create mode 100644 platform/ios/resources/da.lproj/Localizable.strings create mode 100644 platform/ios/resources/da.lproj/Localizable.stringsdict create mode 100644 platform/macos/app/da.lproj/Localizable.strings create mode 100644 platform/macos/sdk/da.lproj/Localizable.strings diff --git a/platform/darwin/resources/da.lproj/Foundation.strings b/platform/darwin/resources/da.lproj/Foundation.strings new file mode 100644 index 0000000000..d8d18f453c --- /dev/null +++ b/platform/darwin/resources/da.lproj/Foundation.strings @@ -0,0 +1,297 @@ +/* Clock position format, long: {hours} o’clock */ +"CLOCK_FMT_LONG" = "%@ klokken"; + +/* Clock position format, medium: {hours} o’clock */ +"CLOCK_FMT_MEDIUM" = "%@ klokken"; + +/* Clock position format, short: {hours}:00 */ +"CLOCK_FMT_SHORT" = "%@:00"; + +/* East, long */ +"COMPASS_E_LONG" = "øst"; + +/* East, short */ +"COMPASS_E_SHORT" = "Ø"; + +/* East by north, long */ +"COMPASS_EbN_LONG" = "øst via nord"; + +/* East by north, short */ +"COMPASS_EbN_SHORT" = "ØvN"; + +/* East by south, long */ +"COMPASS_EbS_LONG" = "øst via syd"; + +/* East by south, short */ +"COMPASS_EbS_SHORT" = "ØvS"; + +/* East-northeast, long */ +"COMPASS_ENE_LONG" = "øst-nordøst"; + +/* East-northeast, short */ +"COMPASS_ENE_SHORT" = "ØNØ"; + +/* East-southeast, long */ +"COMPASS_ESE_LONG" = "øst-sydøst"; + +/* East-southeast, short */ +"COMPASS_ESE_SHORT" = "ØSØ"; + +/* North, long */ +"COMPASS_N_LONG" = "nord"; + +/* North, short */ +"COMPASS_N_SHORT" = "N"; + +/* North by east, long */ +"COMPASS_NbE_LONG" = "nord via øst"; + +/* North by east, short */ +"COMPASS_NbE_SHORT" = "NvØ"; + +/* North by west, long */ +"COMPASS_NbW_LONG" = "nord via vest"; + +/* North by west, short */ +"COMPASS_NbW_SHORT" = "NvV"; + +/* Northeast, long */ +"COMPASS_NE_LONG" = "nordøst"; + +/* Northeast, short */ +"COMPASS_NE_SHORT" = "NØ"; + +/* Northeast by east, long */ +"COMPASS_NEbE_LONG" = "nordøst via øst"; + +/* Northeast by east, short */ +"COMPASS_NEbE_SHORT" = "NØvØ"; + +/* Northeast by north, long */ +"COMPASS_NEbN_LONG" = "nordøst via nord"; + +/* Northeast by north, short */ +"COMPASS_NEbN_SHORT" = "NØvN"; + +/* North-northeast, long */ +"COMPASS_NNE_LONG" = "nord-nordøst"; + +/* North-northeast, short */ +"COMPASS_NNE_SHORT" = "NNØ"; + +/* North-northwest, long */ +"COMPASS_NNW_LONG" = "nord-nordvest"; + +/* North-northwest, short */ +"COMPASS_NNW_SHORT" = "NNV"; + +/* Northwest, long */ +"COMPASS_NW_LONG" = "nordvest"; + +/* Northwest, short */ +"COMPASS_NW_SHORT" = "NV"; + +/* Northwest by north, long */ +"COMPASS_NWbN_LONG" = "nordvest via nord"; + +/* Northwest by north, short */ +"COMPASS_NWbN_SHORT" = "NVvN"; + +/* Northwest by west, long */ +"COMPASS_NWbW_LONG" = "nordvest via vest"; + +/* Northwest by west, short */ +"COMPASS_NWbW_SHORT" = "NVvW"; + +/* South, long */ +"COMPASS_S_LONG" = "syd"; + +/* South, short */ +"COMPASS_S_SHORT" = "S"; + +/* South by east, long */ +"COMPASS_SbE_LONG" = "syd via øst"; + +/* South by east, short */ +"COMPASS_SbE_SHORT" = "SvØ"; + +/* South by west, long */ +"COMPASS_SbW_LONG" = "syd via vest"; + +/* South by west, short */ +"COMPASS_SbW_SHORT" = "SvV"; + +/* Southeast, long */ +"COMPASS_SE_LONG" = "sydøst"; + +/* Southeast, short */ +"COMPASS_SE_SHORT" = "SØ"; + +/* Southeast by east, long */ +"COMPASS_SEbE_LONG" = "sydøst via øst"; + +/* Southeast by east, short */ +"COMPASS_SEbE_SHORT" = "SØvØ"; + +/* Southeast by south, long */ +"COMPASS_SEbS_LONG" = "sydøst via syd"; + +/* Southeast by south, short */ +"COMPASS_SEbS_SHORT" = "SØvS"; + +/* South-southeast, long */ +"COMPASS_SSE_LONG" = "syd-sydøst"; + +/* South-southeast, short */ +"COMPASS_SSE_SHORT" = "SSØ"; + +/* South-southwest, long */ +"COMPASS_SSW_LONG" = "syd-sydvest"; + +/* South-southwest, short */ +"COMPASS_SSW_SHORT" = "SSV"; + +/* Southwest, long */ +"COMPASS_SW_LONG" = "sydvest"; + +/* Southwest, short */ +"COMPASS_SW_SHORT" = "SV"; + +/* Southwest by south, long */ +"COMPASS_SWbS_LONG" = "sydvest via syd"; + +/* Southwest by south, short */ +"COMPASS_SWbS_SHORT" = "SVvS"; + +/* Southwest by west, long */ +"COMPASS_SWbW_LONG" = "sydvest via vest"; + +/* Southwest by west, short */ +"COMPASS_SWbW_SHORT" = "SVvV"; + +/* West, long */ +"COMPASS_W_LONG" = "vest"; + +/* West, short */ +"COMPASS_W_SHORT" = "V"; + +/* West by north, long */ +"COMPASS_WbN_LONG" = "vest via nord"; + +/* West by north, short */ +"COMPASS_WbN_SHORT" = "VvN"; + +/* West by south, long */ +"COMPASS_WbS_LONG" = "vest via syd"; + +/* West by south, short */ +"COMPASS_WbS_SHORT" = "VvS"; + +/* West-northwest, long */ +"COMPASS_WNW_LONG" = "vest-nordvest"; + +/* West-northwest, short */ +"COMPASS_WNW_SHORT" = "VNV"; + +/* West-southwest, long */ +"COMPASS_WSW_LONG" = "vest-sydvest"; + +/* West-southwest, short */ +"COMPASS_WSW_SHORT" = "VSV"; + +/* Degrees format, long */ +"COORD_DEG_LONG" = "%d grad(er)"; + +/* 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$@ og %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$@, og %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" = "%@ øst"; + +/* East longitude format, medium: {longitude} */ +"COORD_E_MEDIUM" = "%@ øst"; + +/* East longitude format, short: {longitude} */ +"COORD_E_SHORT" = "%@Ø"; + +/* Coordinate pair format, long: {latitude}, {longitude} */ +"COORD_FMT_LONG" = "%1$@ via %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(ter)"; + +/* 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" = "%@ syd"; + +/* South latitude format, medium: {latitude} */ +"COORD_S_MEDIUM" = "%@ syd"; + +/* South latitude format, short: {latitude} */ +"COORD_S_SHORT" = "%@S"; + +/* Seconds format, long */ +"COORD_SEC_LONG" = "%d sekunde(r)"; + +/* Seconds format, medium: {seconds} */ +"COORD_SEC_MEDIUM" = "%d″"; + +/* Seconds format, short: {seconds} */ +"COORD_SEC_SHORT" = "%d″"; + +/* West longitude format, long: {longitude} */ +"COORD_W_LONG" = "%@ vest"; + +/* West longitude format, medium: {longitude} */ +"COORD_W_MEDIUM" = "%@ vest"; + +/* West longitude format, short: {longitude} */ +"COORD_W_SHORT" = "%@V"; + +/* OpenStreetMap full name attribution */ +"OSM_FULL_NAME" = "OpenStreetMap"; + +/* OpenStreetMap short name attribution */ +"OSM_SHORT_NAME" = "OSM"; + diff --git a/platform/darwin/resources/da.lproj/Foundation.stringsdict b/platform/darwin/resources/da.lproj/Foundation.stringsdict new file mode 100644 index 0000000000..17983b8aa8 --- /dev/null +++ b/platform/darwin/resources/da.lproj/Foundation.stringsdict @@ -0,0 +1,54 @@ + + + + + COORD_DEG_LONG + + NSStringLocalizedFormatKey + %#@degrees@ + degrees + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + %d grad + other + %d grader + + + COORD_MIN_LONG + + NSStringLocalizedFormatKey + %#@minutes@ + minutes + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + %d minut + other + %d minutter + + + COORD_SEC_LONG + + NSStringLocalizedFormatKey + %#@seconds@ + seconds + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + %d sekund + other + %d sekunder + + + + diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 272270321b..0cb39024a8 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -7,7 +7,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT ### Packaging * Removed support for 32-bit simulators. ([#10962](https://github.com/mapbox/mapbox-gl-native/pull/10962)) -* Added a Hebrew localization. ([#10967](https://github.com/mapbox/mapbox-gl-native/pull/10967)) +* Added Danish and Hebrew localizations. ([#10967](https://github.com/mapbox/mapbox-gl-native/pull/10967), [#11136](https://github.com/mapbox/mapbox-gl-native/pull/11134)) ### Styles and rendering diff --git a/platform/ios/app/da.lproj/Localizable.strings b/platform/ios/app/da.lproj/Localizable.strings new file mode 100644 index 0000000000..e69de29bb2 diff --git a/platform/ios/framework/Settings.bundle/da.lproj/Root.strings b/platform/ios/framework/Settings.bundle/da.lproj/Root.strings new file mode 100644 index 0000000000..b1129a865a --- /dev/null +++ b/platform/ios/framework/Settings.bundle/da.lproj/Root.strings @@ -0,0 +1,3 @@ +"TELEMETRY_GROUP_TITLE" = "Privatlivs indstillinger"; +"TELEMETRY_SWITCH_TITLE" = "Mapbox Telemetry"; +"TELEMETRY_GROUP_FOOTER" = "Denne indstilling giver app'en tilladelse til at dele anonyme bruger data og position med Mapbox."; diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index 10928e8e8d..68071123af 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -1071,6 +1071,12 @@ DAD1656B1CF41981001FF4B9 /* MGLFeature.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLFeature.mm; sourceTree = ""; }; DAD165761CF4CDFF001FF4B9 /* MGLShapeCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLShapeCollection.h; sourceTree = ""; }; DAD165771CF4CDFF001FF4B9 /* MGLShapeCollection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLShapeCollection.mm; sourceTree = ""; }; + DAD88E07202ACFE800AAA536 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Localizable.strings; sourceTree = ""; }; + DAD88E08202AD01300AAA536 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Foundation.strings; sourceTree = ""; }; + DAD88E09202AD01F00AAA536 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = da; path = da.lproj/Foundation.stringsdict; sourceTree = ""; }; + DAD88E0A202AD03C00AAA536 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Localizable.strings; sourceTree = ""; }; + DAD88E0B202AD04D00AAA536 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = da; path = da.lproj/Localizable.stringsdict; sourceTree = ""; }; + DAD88E0C202AD06500AAA536 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Root.strings; sourceTree = ""; }; DAE7DEC11E245455007505A6 /* MGLNSStringAdditionsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLNSStringAdditionsTests.m; path = ../../darwin/test/MGLNSStringAdditionsTests.m; sourceTree = ""; }; DAE8CCAD1E6E8C70009B5CB0 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Localizable.strings; sourceTree = ""; }; DAE8CCAE1E6E8C76009B5CB0 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Root.strings; sourceTree = ""; }; @@ -2369,6 +2375,7 @@ bg, ar, he, + da, ); mainGroup = DA1DC9411CB6C1C2006E619F; productRefGroup = DA1DC94B1CB6C1C2006E619F /* Products */; @@ -2843,6 +2850,7 @@ DA3389651FA3EE1B001EA329 /* bg */, DA80E9601FE84AD90065FC9B /* ar */, DACBC60B20118ABE00C4D7E2 /* he */, + DAD88E07202ACFE800AAA536 /* da */, ); name = Localizable.strings; sourceTree = ""; @@ -2869,6 +2877,7 @@ DACCD9C81F1F473700BB09A1 /* hu */, DA33896A1FA3EE58001EA329 /* bg */, DACBC60E20118AFE00C4D7E2 /* he */, + DAD88E0C202AD06500AAA536 /* da */, ); name = Root.strings; sourceTree = ""; @@ -2893,6 +2902,7 @@ DA5C09BB1EFC486C0056B178 /* hu */, DA3389681FA3EE48001EA329 /* bg */, DACBC60D20118ADE00C4D7E2 /* he */, + DAD88E0A202AD03C00AAA536 /* da */, ); name = Localizable.strings; sourceTree = ""; @@ -2915,6 +2925,7 @@ DA33895F1FA3EAB7001EA329 /* pt-BR */, DA3389661FA3EE28001EA329 /* bg */, DACBC60C20118AD000C4D7E2 /* he */, + DAD88E08202AD01300AAA536 /* da */, ); name = Foundation.strings; sourceTree = ""; @@ -2937,6 +2948,7 @@ DA3389671FA3EE2F001EA329 /* bg */, DA33896B1FA3EF4A001EA329 /* hu */, DA80E9611FE84AEF0065FC9B /* ar */, + DAD88E09202AD01F00AAA536 /* da */, ); name = Foundation.stringsdict; sourceTree = ""; @@ -2965,6 +2977,7 @@ DA704CBC1F637405004B3F28 /* uk */, DA704CBD1F63746E004B3F28 /* zh-Hant */, DA3389691FA3EE50001EA329 /* bg */, + DAD88E0B202AD04D00AAA536 /* da */, ); name = Localizable.stringsdict; sourceTree = ""; diff --git a/platform/ios/resources/da.lproj/Localizable.strings b/platform/ios/resources/da.lproj/Localizable.strings new file mode 100644 index 0000000000..dd384b21fc --- /dev/null +++ b/platform/ios/resources/da.lproj/Localizable.strings @@ -0,0 +1,117 @@ +/* Accessibility hint */ +"ANNOTATION_A11Y_HINT" = "Vis mere info"; + +/* No comment provided by engineer. */ +"API_CLIENT_400_DESC" = "Denne session kunne ikke gennemføres pga. data fejl. Den oprindelige forespørgsel var: %@"; + +/* No comment provided by engineer. */ +"API_CLIENT_400_REASON" = "Status koden var %ld"; + +/* No comment provided by engineer. */ +"CANCEL" = "Fortryd"; + +/* Accessibility hint for closing the selected annotation’s callout view and returning to the map */ +"CLOSE_CALLOUT_A11Y_HINT" = "Retur til kortet"; + +/* Accessibility hint */ +"COMPASS_A11Y_HINT" = "Fast nord"; + +/* Accessibility label */ +"COMPASS_A11Y_LABEL" = "Kompas"; + +/* Compass abbreviation for north */ +"COMPASS_NORTH" = "N"; + +/* Instructions in Interface Builder designable; {key}, {plist file name} */ +"DESIGNABLE" = "For at vise et Mapbox-hosted kort her, angiv %1$@ til din access token i %2$@\n\nFor yderligere instruktion se:"; + +/* Setup documentation URL display string; keep as short as possible */ +"FIRST_STEPS_URL" = "mapbox.com/help/first-steps-ios-sdk"; + +/* Accessibility hint */ +"INFO_A11Y_HINT" = "Vis credits, feedback formular med mere"; + +/* Accessibility label */ +"INFO_A11Y_LABEL" = "Om kortet"; + +/* List separator */ +"LIST_SEPARATOR" = ", "; + +/* User-friendly error description */ +"LOAD_MAP_FAILED_DESC" = "Kortet kunne ikke hentes på grund af en ukendt fejl"; + +/* User-friendly error description */ +"LOAD_STYLE_FAILED_DESC" = "Kortet kunne ikke hentes på grund af en fejl i kort formatteringen"; + +/* Accessibility label */ +"LOGO_A11Y_LABEL" = "Mapbox"; + +/* Accessibility label */ +"MAP_A11Y_LABEL" = "Kort"; + +/* Map accessibility value; {number of visible annotations} */ +"MAP_A11Y_VALUE_ANNOTATIONS" = "%ld synlige kommentarer."; + +/* Map accessibility value; {list of visible places} */ +"MAP_A11Y_VALUE_PLACES" = "Synlige steder: %@."; + +/* Map accessibility value; {number of visible roads} */ +"MAP_A11Y_VALUE_ROADS" = "%ld synlige veje."; + +/* Map accessibility value; {zoom level} */ +"MAP_A11Y_VALUE_ZOOM" = "Zoom %dx."; + +/* User-friendly error description */ +"PARSE_STYLE_FAILED_DESC" = "Kortet kunne ikke hentes på grund af en fejl"; + +/* String format for accessibility value for road feature; {starting compass direction}, {ending compass direction} */ +"ROAD_DIRECTION_A11Y_FMT" = "%1$@ til %2$@"; + +/* Accessibility value indicating that a road is a divided road (dual carriageway) */ +"ROAD_DIVIDED_A11Y_VALUE" = "Delt vej"; + +/* Accessibility value indicating that a road is a one-way road */ +"ROAD_ONEWAY_A11Y_VALUE" = "Ensrettet"; + +/* String format for accessibility value for road feature; {route number} */ +"ROAD_REF_A11Y_FMT" = "Rute %@"; + +/* Action sheet title */ +"SDK_NAME" = "Mapbox Maps SDK for iOS"; + +/* Developer-only SDK update notification; {latest version, in format x.x.x} */ +"SDK_UPDATE_AVAILABLE" = "Mapbox Maps SDK for iOS version %@ er nu tilgængelig:"; + +/* User-friendly error description */ +"STYLE_NOT_FOUND_DESC" = "Kortet kunne ikke hentes fordi det enten ikke findes, eller ikke er kompatibelt."; + +/* Telemetry prompt message */ +"TELEMETRY_DISABLED_MSG" = "Du kan hjælpe med at gøre OpenStreetMap og Mapbox kort bedre ved at bidrage med annonyme bruger data."; + +/* Telemetry prompt button */ +"TELEMETRY_DISABLED_OFF" = "Deltag ikke"; + +/* Telemetry prompt button */ +"TELEMETRY_DISABLED_ON" = "Deltag"; + +/* Telemetry prompt message */ +"TELEMETRY_ENABLED_MSG" = "Du hjælper med at gøre OpenStreetMap og Mapbox kort bedre ved at bidrage med annonyme bruger data."; + +/* Telemetry prompt button */ +"TELEMETRY_ENABLED_OFF" = "Stop deltagelse"; + +/* Telemetry prompt button */ +"TELEMETRY_ENABLED_ON" = "Fortsæt deltagelse"; + +/* Telemetry prompt button */ +"TELEMETRY_MORE" = "Fortæl mig mere"; + +/* Action in attribution sheet */ +"TELEMETRY_NAME" = "Mapbox Telemetry"; + +/* Telemetry prompt title */ +"TELEMETRY_TITLE" = "Gør Mapbox kort bedre"; + +/* Default user location annotation title */ +"USER_DOT_TITLE" = "Du er her"; + diff --git a/platform/ios/resources/da.lproj/Localizable.stringsdict b/platform/ios/resources/da.lproj/Localizable.stringsdict new file mode 100644 index 0000000000..296b8c88dd --- /dev/null +++ b/platform/ios/resources/da.lproj/Localizable.stringsdict @@ -0,0 +1,54 @@ + + + + + MAP_A11Y_VALUE_ANNOTATIONS + + NSStringLocalizedFormatKey + %#@count@ + count + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + ld + one + %ld synlig kommentar + other + %ld synlige kommentarer + + + MAP_A11Y_VALUE_ROADS + + NSStringLocalizedFormatKey + %#@count@ + count + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + ld + one + %ld synlig vej + other + %ld synlige veje + + + MAP_A11Y_VALUE_ZOOM + + NSStringLocalizedFormatKey + %#@level@ + level + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + Zoom %dx + other + Zoom %dx. + + + + diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index bcdbb9824d..d35f396a28 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -26,7 +26,7 @@ ### Other changes -* Added a Hebrew localization. ([#10967](https://github.com/mapbox/mapbox-gl-native/pull/10967)) +* Added Danish and Hebrew localizations. ([#10967](https://github.com/mapbox/mapbox-gl-native/pull/10967), [#11136](https://github.com/mapbox/mapbox-gl-native/pull/11134)) * Feature querying results now account for the `MGLSymbolStyleLayer.circleStrokeWidth` property. ([#10897](https://github.com/mapbox/mapbox-gl-native/pull/10897)) ## v0.6.1 - January 16, 2018 diff --git a/platform/macos/app/da.lproj/Localizable.strings b/platform/macos/app/da.lproj/Localizable.strings new file mode 100644 index 0000000000..e69de29bb2 diff --git a/platform/macos/macos.xcodeproj/project.pbxproj b/platform/macos/macos.xcodeproj/project.pbxproj index 090902fca4..e42885f879 100644 --- a/platform/macos/macos.xcodeproj/project.pbxproj +++ b/platform/macos/macos.xcodeproj/project.pbxproj @@ -526,6 +526,10 @@ DACFE7971F66EA0C00630DA8 /* vi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = vi; path = vi.lproj/Foundation.stringsdict; sourceTree = ""; }; DAD165721CF4CD7A001FF4B9 /* MGLShapeCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLShapeCollection.h; sourceTree = ""; }; DAD165731CF4CD7A001FF4B9 /* MGLShapeCollection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLShapeCollection.mm; sourceTree = ""; }; + DAD88E03202ACF5900AAA536 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Localizable.strings; sourceTree = ""; }; + DAD88E04202ACF7C00AAA536 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Foundation.strings; sourceTree = ""; }; + DAD88E05202ACF8200AAA536 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = da; path = da.lproj/Foundation.stringsdict; sourceTree = ""; }; + DAD88E06202ACF9200AAA536 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Localizable.strings; sourceTree = ""; }; DAE6C2E11CC304F900DB3429 /* Credits.rtf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.rtf; path = Credits.rtf; sourceTree = ""; }; DAE6C2E31CC3050F00DB3429 /* DroppedPinAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DroppedPinAnnotation.h; sourceTree = ""; }; DAE6C2E41CC3050F00DB3429 /* DroppedPinAnnotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DroppedPinAnnotation.m; sourceTree = ""; }; @@ -1399,6 +1403,7 @@ bg, ar, he, + da, ); mainGroup = DA839E891CC2E3400062CAFB; productRefGroup = DA839E931CC2E3400062CAFB /* Products */; @@ -1633,6 +1638,7 @@ DA3389611FA3EDCE001EA329 /* bg */, DA80E95D1FE84A300065FC9B /* ar */, DACBC6082011885800C4D7E2 /* he */, + DAD88E03202ACF5900AAA536 /* da */, ); name = Localizable.strings; sourceTree = ""; @@ -1684,6 +1690,7 @@ DA704CBF1F637548004B3F28 /* hu */, DA3389641FA3EE00001EA329 /* bg */, DACBC60A2011889E00C4D7E2 /* he */, + DAD88E06202ACF9200AAA536 /* da */, ); name = Localizable.strings; sourceTree = ""; @@ -1707,6 +1714,7 @@ DA3389601FA3EAC4001EA329 /* pt-BR */, DA3389621FA3EDEF001EA329 /* bg */, DACBC6092011888C00C4D7E2 /* he */, + DAD88E04202ACF7C00AAA536 /* da */, ); name = Foundation.strings; sourceTree = ""; @@ -1729,6 +1737,7 @@ DA3389631FA3EDF5001EA329 /* bg */, DA33896C1FA3EF51001EA329 /* hu */, DA80E95F1FE84A540065FC9B /* ar */, + DAD88E05202ACF8200AAA536 /* da */, ); name = Foundation.stringsdict; sourceTree = ""; diff --git a/platform/macos/sdk/da.lproj/Localizable.strings b/platform/macos/sdk/da.lproj/Localizable.strings new file mode 100644 index 0000000000..1c9dcaa68d --- /dev/null +++ b/platform/macos/sdk/da.lproj/Localizable.strings @@ -0,0 +1,27 @@ +/* User-friendly error description */ +"LOAD_MAP_FAILED_DESC" = "Kortet kunne ikke indlæses, fordi der opstod en ukendt fejl."; + +/* User-friendly error description */ +"LOAD_STYLE_FAILED_DESC" = "Kortet kunne ikke indlæses, fordi benævnelsen ikke kan indlæses."; + +/* Accessibility title */ +"MAP_A11Y_TITLE" = "Mapbox"; + +/* User-friendly error description */ +"PARSE_STYLE_FAILED_DESC" = "Kortet kunne ikke indlæses, fordi benævnelsen er beskadiget."; + +/* User-friendly error description */ +"STYLE_NOT_FOUND_DESC" = "Kortet kunne ikke indlæses, fordi benævnelsen ikke kan findes eller er uforenelig."; + +/* Label of Zoom In button */ +"ZOOM_IN_LABEL" = "+"; + +/* Tooltip of Zoom In button */ +"ZOOM_IN_TOOLTIP" = "Zoom Ind"; + +/* Label of Zoom Out button; U+2212 MINUS SIGN */ +"ZOOM_OUT_LABEL" = "−"; + +/* Tooltip of Zoom Out button */ +"ZOOM_OUT_TOOLTIP" = "Zoom Ud"; + -- cgit v1.2.1 From 97005ccdfa6641a3d33fbe046b5c7dc5fdb72999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Tue, 10 Oct 2017 15:35:00 +0200 Subject: [core] use the RunLoop's schedule call directly RunLoop already has a queue, and has the ability to schedule weak mailboxes, so we can remove the duplicate code. --- include/mbgl/util/thread.hpp | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/include/mbgl/util/thread.hpp b/include/mbgl/util/thread.hpp index 672eebf6db..e3bd18143d 100644 --- a/include/mbgl/util/thread.hpp +++ b/include/mbgl/util/thread.hpp @@ -128,26 +128,9 @@ private: MBGL_STORE_THREAD(tid); void schedule(std::weak_ptr mailbox) override { - { - std::lock_guard lock(mutex); - queue.push(mailbox); - } - - loop->invoke([this] { receive(); }); - } - - void receive() { - std::unique_lock lock(mutex); - - auto mailbox = queue.front(); - queue.pop(); - lock.unlock(); - - Mailbox::maybeReceive(mailbox); + loop->schedule(mailbox); } - std::mutex mutex; - std::queue> queue; std::thread thread; std::unique_ptr> object; -- cgit v1.2.1 From 9b961fb6f9d1bdc9a5a8afe01162858d3ce2c39c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Tue, 23 Jan 2018 14:30:01 -0800 Subject: [core] factor out RunLoop::wake() --- include/mbgl/util/run_loop.hpp | 12 ++++++++---- platform/android/src/run_loop.cpp | 7 ++----- platform/darwin/src/run_loop.cpp | 7 ++----- platform/default/run_loop.cpp | 7 ++----- platform/qt/src/run_loop.cpp | 7 ++----- 5 files changed, 16 insertions(+), 24 deletions(-) diff --git a/include/mbgl/util/run_loop.hpp b/include/mbgl/util/run_loop.hpp index acbea80273..ecb18c857b 100644 --- a/include/mbgl/util/run_loop.hpp +++ b/include/mbgl/util/run_loop.hpp @@ -76,16 +76,20 @@ private: using Queue = std::queue>; - void push(std::shared_ptr); + // Wakes up the RunLoop so that it starts processing items in the queue. + void wake(); - void withMutex(std::function&& fn) { + // Adds a WorkTask to the queue, and wakes it up. + void push(std::shared_ptr task) { std::lock_guard lock(mutex); - fn(); + queue.push(std::move(task)); + wake(); } void process() { + std::unique_lock lock(mutex); Queue queue_; - withMutex([&] { queue_.swap(queue); }); + lock.unlock(); while (!queue_.empty()) { (*(queue_.front()))(); diff --git a/platform/android/src/run_loop.cpp b/platform/android/src/run_loop.cpp index 1d284a9e72..34366d836a 100644 --- a/platform/android/src/run_loop.cpp +++ b/platform/android/src/run_loop.cpp @@ -216,11 +216,8 @@ LOOP_HANDLE RunLoop::getLoopHandle() { return Get()->impl.get(); } -void RunLoop::push(std::shared_ptr task) { - withMutex([&] { - queue.push(std::move(task)); - impl->wake(); - }); +void RunLoop::wake() { + impl->wake(); } void RunLoop::run() { diff --git a/platform/darwin/src/run_loop.cpp b/platform/darwin/src/run_loop.cpp index d60a88cf52..0778b004e5 100644 --- a/platform/darwin/src/run_loop.cpp +++ b/platform/darwin/src/run_loop.cpp @@ -29,11 +29,8 @@ RunLoop::~RunLoop() { Scheduler::SetCurrent(nullptr); } -void RunLoop::push(std::shared_ptr task) { - withMutex([&] { - queue.push(std::move(task)); - impl->async->send(); - }); +void RunLoop::wake() { + impl->async->send(); } void RunLoop::run() { diff --git a/platform/default/run_loop.cpp b/platform/default/run_loop.cpp index 5bccd21d56..868ee72114 100644 --- a/platform/default/run_loop.cpp +++ b/platform/default/run_loop.cpp @@ -129,11 +129,8 @@ LOOP_HANDLE RunLoop::getLoopHandle() { return Get()->impl->loop; } -void RunLoop::push(std::shared_ptr task) { - withMutex([&] { - queue.push(std::move(task)); - impl->async->send(); - }); +void RunLoop::wake() { + impl->async->send(); } void RunLoop::run() { diff --git a/platform/qt/src/run_loop.cpp b/platform/qt/src/run_loop.cpp index af0c50ebb9..c25243c8e7 100644 --- a/platform/qt/src/run_loop.cpp +++ b/platform/qt/src/run_loop.cpp @@ -52,11 +52,8 @@ LOOP_HANDLE RunLoop::getLoopHandle() { return nullptr; } -void RunLoop::push(std::shared_ptr task) { - withMutex([&] { - queue.push(std::move(task)); - impl->async->send(); - }); +void RunLoop::wake() { + impl->async->send(); } void RunLoop::run() { -- cgit v1.2.1 From 1eb628327d30031b3a2c6b9b8f9d14b6f5197b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Tue, 23 Jan 2018 14:43:37 -0800 Subject: [core] change RunLoop processing to check queue on every iteration --- include/mbgl/util/run_loop.hpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/mbgl/util/run_loop.hpp b/include/mbgl/util/run_loop.hpp index ecb18c857b..7167652687 100644 --- a/include/mbgl/util/run_loop.hpp +++ b/include/mbgl/util/run_loop.hpp @@ -88,12 +88,13 @@ private: void process() { std::unique_lock lock(mutex); - Queue queue_; - lock.unlock(); - - while (!queue_.empty()) { - (*(queue_.front()))(); - queue_.pop(); + std::shared_ptr task; + while (!queue.empty()) { + task = std::move(queue.front()); + queue.pop(); + lock.unlock(); + (*task)(); + lock.lock(); } } -- cgit v1.2.1 From 9cb4ffd24833550b8cdf8c2256e29fd92cd5d5f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Tue, 23 Jan 2018 16:59:59 -0800 Subject: [core] prioritize Thread::pause() calls --- include/mbgl/util/run_loop.hpp | 43 ++++++++++++++++++++++++++++++++---------- include/mbgl/util/thread.hpp | 2 +- test/util/run_loop.test.cpp | 14 ++++++++++++++ 3 files changed, 48 insertions(+), 11 deletions(-) diff --git a/include/mbgl/util/run_loop.hpp b/include/mbgl/util/run_loop.hpp index 7167652687..381e3ae213 100644 --- a/include/mbgl/util/run_loop.hpp +++ b/include/mbgl/util/run_loop.hpp @@ -26,6 +26,11 @@ public: New, }; + enum class Priority : bool { + Default = false, + High = true, + }; + enum class Event : uint8_t { None = 0, Read = 1, @@ -47,11 +52,16 @@ public: void addWatch(int fd, Event, std::function&& callback); void removeWatch(int fd); + // Invoke fn(args...) on this RunLoop. + template + void invoke(Priority priority, Fn&& fn, Args&&... args) { + push(priority, WorkTask::make(std::forward(fn), std::forward(args)...)); + } + // Invoke fn(args...) on this RunLoop. template void invoke(Fn&& fn, Args&&... args) { - std::shared_ptr task = WorkTask::make(std::forward(fn), std::forward(args)...); - push(task); + invoke(Priority::Default, std::forward(fn), std::forward(args)...); } // Post the cancellable work fn(args...) to this RunLoop. @@ -59,7 +69,7 @@ public: std::unique_ptr invokeCancellable(Fn&& fn, Args&&... args) { std::shared_ptr task = WorkTask::make(std::forward(fn), std::forward(args)...); - push(task); + push(Priority::Default, task); return std::make_unique(task); } @@ -80,25 +90,38 @@ private: void wake(); // Adds a WorkTask to the queue, and wakes it up. - void push(std::shared_ptr task) { + void push(Priority priority, std::shared_ptr task) { std::lock_guard lock(mutex); - queue.push(std::move(task)); + if (priority == Priority::High) { + highPriorityQueue.emplace(std::move(task)); + } else { + defaultQueue.emplace(std::move(task)); + } wake(); } void process() { - std::unique_lock lock(mutex); std::shared_ptr task; - while (!queue.empty()) { - task = std::move(queue.front()); - queue.pop(); + std::unique_lock lock(mutex); + while (true) { + if (!highPriorityQueue.empty()) { + task = std::move(highPriorityQueue.front()); + highPriorityQueue.pop(); + } else if (!defaultQueue.empty()) { + task = std::move(defaultQueue.front()); + defaultQueue.pop(); + } else { + break; + } lock.unlock(); (*task)(); + task.reset(); lock.lock(); } } - Queue queue; + Queue defaultQueue; + Queue highPriorityQueue; std::mutex mutex; std::unique_ptr impl; diff --git a/include/mbgl/util/thread.hpp b/include/mbgl/util/thread.hpp index e3bd18143d..74e722b02d 100644 --- a/include/mbgl/util/thread.hpp +++ b/include/mbgl/util/thread.hpp @@ -103,7 +103,7 @@ public: auto pausing = paused->get_future(); - loop->invoke([this] { + loop->invoke(RunLoop::Priority::High, [this] { auto resuming = resumed->get_future(); paused->set_value(); resuming.get(); diff --git a/test/util/run_loop.test.cpp b/test/util/run_loop.test.cpp index 57bc613f9e..4d2c704421 100644 --- a/test/util/run_loop.test.cpp +++ b/test/util/run_loop.test.cpp @@ -50,3 +50,17 @@ TEST(RunLoop, MultipleRun) { EXPECT_TRUE(secondTimeout); } + +TEST(RunLoop, Priorities) { + std::vector order; + + RunLoop loop(RunLoop::Type::New); + loop.invoke([&] { order.push_back(1); }); + loop.invoke(RunLoop::Priority::High, [&] { order.push_back(2); }); + loop.invoke([&] { order.push_back(3); }); + loop.invoke(RunLoop::Priority::High, [&] { order.push_back(4); }); + loop.invoke(RunLoop::Priority::Default, [&] { loop.stop(); }); + loop.run(); + + EXPECT_EQ((std::vector{ 2, 4, 1, 3 }), order); +} -- cgit v1.2.1 From 62ae0738e8a3d1b3e4b661fa7e8d8bb1d6339c51 Mon Sep 17 00:00:00 2001 From: Chris Loer Date: Wed, 31 Jan 2018 13:09:00 +0000 Subject: [core] Don't crash on line labels with 0 glyphs. Fixes issue #10956. --- src/mbgl/layout/symbol_projection.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mbgl/layout/symbol_projection.cpp b/src/mbgl/layout/symbol_projection.cpp index ee6385c93c..9e077e2532 100644 --- a/src/mbgl/layout/symbol_projection.cpp +++ b/src/mbgl/layout/symbol_projection.cpp @@ -318,7 +318,7 @@ namespace mbgl { placedGlyphs.push_back(*placedGlyph); } placedGlyphs.push_back(firstAndLastGlyph->second); - } else { + } else if (symbol.glyphOffsets.size() == 1) { // Only a single glyph to place // So, determine whether to flip based on projected angle of the line segment it's on if (keepUpright && !flip) { @@ -337,7 +337,6 @@ namespace mbgl { return *orientationChange; } } - assert(symbol.glyphOffsets.size() == 1); // We are relying on SymbolInstance.hasText filtering out symbols without any glyphs at all const float glyphOffsetX = symbol.glyphOffsets.front(); optional singleGlyph = placeGlyphAlongLine(fontScale * glyphOffsetX, lineOffsetX, lineOffsetY, flip, projectedAnchorPoint, symbol.anchorPoint, symbol.segment, symbol.line, symbol.tileDistances, labelPlaneMatrix, false); @@ -347,6 +346,8 @@ namespace mbgl { placedGlyphs.push_back(*singleGlyph); } + // The number of placedGlyphs must equal the number of glyphOffsets, which must correspond to the number of glyph vertices + // There may be 0 glyphs here, if a label consists entirely of glyphs that have 0x0 dimensions for (auto& placedGlyph : placedGlyphs) { addDynamicAttributes(placedGlyph.point, placedGlyph.angle, dynamicVertexArray); } -- cgit v1.2.1 From 7a0a4c44f469e180606afa250a47414441e8e675 Mon Sep 17 00:00:00 2001 From: Osana Babayan <32496536+osana@users.noreply.github.com> Date: Thu, 8 Feb 2018 10:33:12 -0500 Subject: migrated to use mapbox-java3.0 migrated to use mapbox-java3.0 old 2.2.9 telementry is still used though --- .../java/com/mapbox/mapboxsdk/maps/MapboxMap.java | 4 +- .../com/mapbox/mapboxsdk/maps/NativeMapView.java | 4 +- .../style/sources/CustomGeometrySource.java | 4 +- .../mapboxsdk/style/sources/GeoJsonSource.java | 6 +- .../style/sources/GeometryTileProvider.java | 2 +- .../mapboxsdk/style/sources/VectorSource.java | 2 +- .../android/MapboxGLAndroidSDKTestApp/build.gradle | 2 + .../testapp/style/GeoJsonSourceTests.java | 8 +- .../annotation/AnimatedMarkerActivity.java | 8 +- .../QueryRenderedFeaturesBoxCountActivity.java | 12 +- .../QueryRenderedFeaturesBoxHighlightActivity.java | 5 +- ...ueryRenderedFeaturesBoxSymbolCountActivity.java | 2 +- .../QueryRenderedFeaturesPropertiesActivity.java | 15 +-- .../feature/QuerySourceFeaturesActivity.java | 9 +- .../activity/style/CustomSpriteActivity.java | 18 ++- .../activity/style/FillExtrusionActivity.java | 4 +- .../testapp/activity/style/GridSourceActivity.java | 21 ++-- .../activity/style/RuntimeStyleActivity.java | 9 +- .../activity/style/SymbolGeneratorActivity.java | 20 +--- .../activity/style/SymbolLayerActivity.java | 11 +- .../style/ZoomFunctionSymbolLayerActivity.java | 18 ++- .../mapboxsdk/testapp/utils/GeoParseUtil.java | 16 +-- platform/android/config.cmake | 2 - platform/android/gradle/dependencies.gradle | 12 +- .../android/src/geojson/conversion/geometry.hpp | 130 +++++++++++---------- platform/android/src/geojson/feature.cpp | 18 +-- platform/android/src/geojson/feature.hpp | 8 +- .../android/src/geojson/feature_collection.cpp | 6 +- .../android/src/geojson/feature_collection.hpp | 4 +- platform/android/src/geojson/geometry.cpp | 2 +- platform/android/src/geojson/geometry.hpp | 2 +- platform/android/src/geojson/line_string.cpp | 28 ++--- platform/android/src/geojson/line_string.hpp | 6 +- platform/android/src/geojson/multi_line_string.cpp | 22 ++-- platform/android/src/geojson/multi_line_string.hpp | 6 +- platform/android/src/geojson/multi_point.cpp | 10 +- platform/android/src/geojson/multi_point.hpp | 4 +- platform/android/src/geojson/multi_polygon.cpp | 16 +-- platform/android/src/geojson/multi_polygon.hpp | 4 +- platform/android/src/geojson/point.cpp | 34 +++++- platform/android/src/geojson/point.hpp | 10 +- platform/android/src/geojson/polygon.cpp | 12 +- platform/android/src/geojson/polygon.hpp | 6 +- platform/android/src/geojson/position.cpp | 27 ----- platform/android/src/geojson/position.hpp | 27 ----- platform/android/src/jni.cpp | 2 - 46 files changed, 284 insertions(+), 314 deletions(-) delete mode 100644 platform/android/src/geojson/position.cpp delete mode 100644 platform/android/src/geojson/position.hpp diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java index 509e784e58..834317dd25 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java @@ -16,6 +16,8 @@ import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; +import com.mapbox.geojson.Feature; +import com.mapbox.geojson.Geometry; import com.mapbox.mapboxsdk.annotations.Annotation; import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions; import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions; @@ -42,8 +44,6 @@ import com.mapbox.mapboxsdk.style.layers.Layer; import com.mapbox.mapboxsdk.style.light.Light; import com.mapbox.mapboxsdk.style.sources.Source; import com.mapbox.services.android.telemetry.location.LocationEngine; -import com.mapbox.services.commons.geojson.Feature; -import com.mapbox.services.commons.geojson.Geometry; import java.lang.reflect.ParameterizedType; import java.util.HashMap; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java index f1635c898f..785b045779 100755 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java @@ -11,6 +11,8 @@ import android.support.annotation.Nullable; import android.text.TextUtils; import android.util.DisplayMetrics; +import com.mapbox.geojson.Feature; +import com.mapbox.geojson.Geometry; import com.mapbox.mapboxsdk.LibraryLoader; import com.mapbox.mapboxsdk.annotations.Icon; import com.mapbox.mapboxsdk.annotations.Marker; @@ -29,8 +31,6 @@ import com.mapbox.mapboxsdk.style.light.Light; import com.mapbox.mapboxsdk.style.sources.CannotAddSourceException; import com.mapbox.mapboxsdk.style.sources.Source; import com.mapbox.mapboxsdk.utils.BitmapUtils; -import com.mapbox.services.commons.geojson.Feature; -import com.mapbox.services.commons.geojson.Geometry; import java.nio.ByteBuffer; import java.util.ArrayList; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CustomGeometrySource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CustomGeometrySource.java index 62f1719ddf..3467ed7a7a 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CustomGeometrySource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CustomGeometrySource.java @@ -5,10 +5,10 @@ import android.support.annotation.Nullable; import android.support.annotation.UiThread; import android.support.annotation.WorkerThread; +import com.mapbox.geojson.Feature; +import com.mapbox.geojson.FeatureCollection; import com.mapbox.mapboxsdk.geometry.LatLngBounds; import com.mapbox.mapboxsdk.style.layers.Filter; -import com.mapbox.services.commons.geojson.Feature; -import com.mapbox.services.commons.geojson.FeatureCollection; import java.lang.ref.WeakReference; import java.util.ArrayList; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java index 10ecb945ad..5c740554cd 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java @@ -4,10 +4,10 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.UiThread; +import com.mapbox.geojson.Feature; +import com.mapbox.geojson.FeatureCollection; +import com.mapbox.geojson.Geometry; import com.mapbox.mapboxsdk.style.layers.Filter; -import com.mapbox.services.commons.geojson.Feature; -import com.mapbox.services.commons.geojson.FeatureCollection; -import com.mapbox.services.commons.geojson.Geometry; import java.net.URL; import java.util.ArrayList; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeometryTileProvider.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeometryTileProvider.java index 3f1eb315d3..17e7f0f5e4 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeometryTileProvider.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeometryTileProvider.java @@ -2,8 +2,8 @@ package com.mapbox.mapboxsdk.style.sources; import android.support.annotation.WorkerThread; +import com.mapbox.geojson.FeatureCollection; import com.mapbox.mapboxsdk.geometry.LatLngBounds; -import com.mapbox.services.commons.geojson.FeatureCollection; /** * Interface that defines methods for working with {@link CustomGeometrySource}. diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java index 9b59cf8967..62b08a90ed 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java @@ -5,8 +5,8 @@ import android.support.annotation.Nullable; import android.support.annotation.Size; import android.support.annotation.UiThread; +import com.mapbox.geojson.Feature; import com.mapbox.mapboxsdk.style.layers.Filter; -import com.mapbox.services.commons.geojson.Feature; import java.net.URL; import java.util.ArrayList; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle index 3740341e94..de4c0cc3be 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle +++ b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle @@ -57,6 +57,8 @@ dependencies { transitive = true } + api dependenciesList.mapboxJavaTurf + implementation dependenciesList.supportAppcompatV7 implementation dependenciesList.supportRecyclerView implementation dependenciesList.supportDesign diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java index 5d10cfa38a..2156c96973 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java @@ -13,9 +13,9 @@ import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity; import com.mapbox.mapboxsdk.testapp.utils.ResourceUtils; -import com.mapbox.services.commons.geojson.Feature; -import com.mapbox.services.commons.geojson.FeatureCollection; -import com.mapbox.services.commons.geojson.Point; +import com.mapbox.geojson.Feature; +import com.mapbox.geojson.FeatureCollection; +import com.mapbox.geojson.Point; import org.hamcrest.Matcher; import org.junit.Test; @@ -67,7 +67,7 @@ public class GeoJsonSourceTests extends BaseActivityTest { @Override public void perform(UiController uiController, View view) { - GeoJsonSource source = new GeoJsonSource("source", Point.fromCoordinates(new double[] {0d, 0d})); + GeoJsonSource source = new GeoJsonSource("source", Point.fromLngLat(0d, 0d)); mapboxMap.addSource(source); mapboxMap.addLayer(new CircleLayer("layer", source.getId())); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java index a557bb4ed4..e6db071141 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java @@ -12,6 +12,7 @@ import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.animation.AccelerateDecelerateInterpolator; +import com.mapbox.geojson.Point; import com.mapbox.mapboxsdk.annotations.Icon; import com.mapbox.mapboxsdk.annotations.IconFactory; import com.mapbox.mapboxsdk.annotations.Marker; @@ -25,8 +26,7 @@ import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.IconUtils; -import com.mapbox.services.api.utils.turf.TurfMeasurement; -import com.mapbox.services.commons.models.Position; +import com.mapbox.turf.TurfMeasurement; import java.util.ArrayList; import java.util.List; @@ -272,8 +272,8 @@ public class AnimatedMarkerActivity extends AppCompatActivity { private double getBearing(LatLng from, LatLng to) { return TurfMeasurement.bearing( - Position.fromCoordinates(from.getLongitude(), from.getLatitude()), - Position.fromCoordinates(to.getLongitude(), to.getLatitude()) + Point.fromLngLat(from.getLongitude(), from.getLatitude()), + Point.fromLngLat(to.getLongitude(), to.getLatitude()) ); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java index 70d5b53428..c4ea81263b 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java @@ -7,10 +7,10 @@ import android.view.View; import android.widget.Toast; import com.google.gson.JsonElement; +import com.mapbox.geojson.Feature; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.services.commons.geojson.Feature; import java.util.List; import java.util.Map; @@ -62,12 +62,12 @@ public class QueryRenderedFeaturesBoxCountActivity extends AppCompatActivity { for (Feature feature : features) { if (feature != null) { Timber.i("Got feature %s with %s properties and Geometry %s", - feature.getId(), - feature.getProperties() != null ? feature.getProperties().entrySet().size() : "", - feature.getGeometry() != null ? feature.getGeometry().getClass().getSimpleName() : "" + feature.id(), + feature.properties() != null ? feature.properties().entrySet().size() : "", + feature.geometry() != null ? feature.geometry().getClass().getSimpleName() : "" ); - if (feature.getProperties() != null) { - for (Map.Entry entry : feature.getProperties().entrySet()) { + if (feature.properties() != null) { + for (Map.Entry entry : feature.properties().entrySet()) { Timber.i("Prop %s - %s", entry.getKey(), entry.getValue()); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java index 8c9d056764..df608360ad 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java @@ -7,14 +7,15 @@ import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Toast; +import com.mapbox.geojson.Feature; +import com.mapbox.geojson.FeatureCollection; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.style.layers.FillLayer; import com.mapbox.mapboxsdk.style.layers.Filter; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.services.commons.geojson.Feature; -import com.mapbox.services.commons.geojson.FeatureCollection; + import java.util.List; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxSymbolCountActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxSymbolCountActivity.java index 9bad5f3e62..46409d1893 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxSymbolCountActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxSymbolCountActivity.java @@ -7,13 +7,13 @@ import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Toast; +import com.mapbox.geojson.Feature; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.style.layers.SymbolLayer; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ResourceUtils; -import com.mapbox.services.commons.geojson.Feature; import java.io.IOException; import java.util.List; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java index 150b081f7f..be32718dc3 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java @@ -12,12 +12,13 @@ import android.widget.LinearLayout; import android.widget.TextView; import com.google.gson.JsonElement; +import com.mapbox.geojson.Feature; import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions; import com.mapbox.mapboxsdk.annotations.Marker; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.services.commons.geojson.Feature; + import java.util.List; import java.util.Map; @@ -80,12 +81,12 @@ public class QueryRenderedFeaturesPropertiesActivity extends AppCompatActivity { for (Feature feature : features) { if (feature != null) { Timber.i("Got feature %s with %s properties and Geometry %s", - feature.getId(), - feature.getProperties() != null ? feature.getProperties().entrySet().size() : "", - feature.getGeometry() != null ? feature.getGeometry().getClass().getSimpleName() : "" + feature.id(), + feature.properties() != null ? feature.properties().entrySet().size() : "", + feature.geometry() != null ? feature.geometry().getClass().getSimpleName() : "" ); - if (feature.getProperties() != null) { - for (Map.Entry entry : feature.getProperties().entrySet()) { + if (feature.properties() != null) { + for (Map.Entry entry : feature.properties().entrySet()) { Timber.i("Prop %s - %s", entry.getKey(), entry.getValue()); } } @@ -114,7 +115,7 @@ public class QueryRenderedFeaturesPropertiesActivity extends AppCompatActivity { if (customMarker.features.size() > 0) { view.addView(row(String.format("Found %s features", customMarker.features.size()))); Feature feature = customMarker.features.get(0); - for (Map.Entry prop : feature.getProperties().entrySet()) { + for (Map.Entry prop : feature.properties().entrySet()) { view.addView(row(String.format("%s: %s", prop.getKey(), prop.getValue()))); } } else { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QuerySourceFeaturesActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QuerySourceFeaturesActivity.java index c8bef26856..14de81ab30 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QuerySourceFeaturesActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QuerySourceFeaturesActivity.java @@ -5,15 +5,16 @@ import android.support.v7.app.AppCompatActivity; import android.widget.Toast; import com.google.gson.JsonObject; +import com.mapbox.geojson.Feature; +import com.mapbox.geojson.FeatureCollection; +import com.mapbox.geojson.Point; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.style.layers.CircleLayer; import com.mapbox.mapboxsdk.style.layers.Filter; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.services.commons.geojson.Feature; -import com.mapbox.services.commons.geojson.FeatureCollection; -import com.mapbox.services.commons.geojson.Point; + import java.util.List; @@ -42,7 +43,7 @@ public class QuerySourceFeaturesActivity extends AppCompatActivity { properties.addProperty("key1", "value1"); final GeoJsonSource source = new GeoJsonSource("test-source", FeatureCollection.fromFeatures(new Feature[] { - Feature.fromGeometry(Point.fromCoordinates(new double[] {0, 0}), properties) + Feature.fromGeometry(Point.fromLngLat(0, 0), properties) })); mapboxMap.addSource(source); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java index 8d35e659d3..30cb0a8660 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java @@ -7,6 +7,9 @@ import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.view.View; +import com.mapbox.geojson.Feature; +import com.mapbox.geojson.FeatureCollection; +import com.mapbox.geojson.Point; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; @@ -15,10 +18,7 @@ import com.mapbox.mapboxsdk.style.layers.Layer; import com.mapbox.mapboxsdk.style.layers.SymbolLayer; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.services.commons.geojson.Feature; -import com.mapbox.services.commons.geojson.FeatureCollection; -import com.mapbox.services.commons.geojson.Point; -import com.mapbox.services.commons.models.Position; + import timber.log.Timber; @@ -58,7 +58,7 @@ public class CustomSpriteActivity extends AppCompatActivity { mapboxMap.addImage(CUSTOM_ICON, BitmapFactory.decodeResource(getResources(), R.drawable.ic_car_top)); // Add a source with a geojson point - point = Point.fromCoordinates(Position.fromCoordinates(13.400972d, 52.519003d)); + point = Point.fromLngLat(13.400972d, 52.519003d); source = new GeoJsonSource( "point", FeatureCollection.fromFeatures(new Feature[] {Feature.fromGeometry(point)}) @@ -78,15 +78,13 @@ public class CustomSpriteActivity extends AppCompatActivity { fab.setImageResource(R.drawable.ic_directions_car_black); } else { // Update point - point = Point.fromCoordinates( - Position.fromCoordinates(point.getCoordinates().getLongitude() + 0.001, - point.getCoordinates().getLatitude() + 0.001) - ); + point = Point.fromLngLat(point.longitude() + 0.001, + point.latitude() + 0.001); source.setGeoJson(FeatureCollection.fromFeatures(new Feature[] {Feature.fromGeometry(point)})); // Move the camera as well mapboxMap.moveCamera(CameraUpdateFactory.newLatLng(new LatLng( - point.getCoordinates().getLatitude(), point.getCoordinates().getLongitude()))); + point.latitude(), point.longitude()))); } } }); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionActivity.java index a88a489cb1..15d7024abf 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionActivity.java @@ -12,7 +12,7 @@ import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.style.layers.FillExtrusionLayer; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.services.commons.geojson.Polygon; +import com.mapbox.geojson.Polygon; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionColor; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionHeight; @@ -35,7 +35,7 @@ public class FillExtrusionActivity extends AppCompatActivity { mapView.onCreate(savedInstanceState); mapView.getMapAsync(map -> { mapboxMap = map; - Polygon domTower = Polygon.fromCoordinates(new double[][][] { + Polygon domTower = Polygon.fromLngLats(new double[][][] { new double[][] { new double[] { 5.12112557888031, diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GridSourceActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GridSourceActivity.java index 9dda0f8fa2..fdc3826fb1 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GridSourceActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GridSourceActivity.java @@ -5,6 +5,10 @@ import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; +import com.mapbox.geojson.Feature; +import com.mapbox.geojson.FeatureCollection; +import com.mapbox.geojson.MultiLineString; +import com.mapbox.geojson.Point; import com.mapbox.mapboxsdk.geometry.LatLngBounds; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; @@ -13,10 +17,7 @@ import com.mapbox.mapboxsdk.style.layers.LineLayer; import com.mapbox.mapboxsdk.style.sources.CustomGeometrySource; import com.mapbox.mapboxsdk.style.sources.GeometryTileProvider; import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.services.commons.geojson.Feature; -import com.mapbox.services.commons.geojson.FeatureCollection; -import com.mapbox.services.commons.geojson.MultiLineString; -import com.mapbox.services.commons.models.Position; + import java.util.ArrayList; import java.util.Arrays; @@ -68,18 +69,18 @@ public class GridSourceActivity extends AppCompatActivity implements OnMapReadyC List gridLines = new ArrayList(); for (double y = Math.ceil(bounds.getLatNorth() / gridSpacing) * gridSpacing; y >= Math.floor(bounds.getLatSouth() / gridSpacing) * gridSpacing; y -= gridSpacing) { - gridLines.add(Arrays.asList(Position.fromCoordinates(bounds.getLonWest(), y), - Position.fromCoordinates(bounds.getLonEast(), y))); + gridLines.add(Arrays.asList(Point.fromLngLat(bounds.getLonWest(), y), + Point.fromLngLat(bounds.getLonEast(), y))); } - features.add(Feature.fromGeometry(MultiLineString.fromCoordinates(gridLines))); + features.add(Feature.fromGeometry(MultiLineString.fromLngLats(gridLines))); gridLines = new ArrayList(); for (double x = Math.floor(bounds.getLonWest() / gridSpacing) * gridSpacing; x <= Math.ceil(bounds.getLonEast() / gridSpacing) * gridSpacing; x += gridSpacing) { - gridLines.add(Arrays.asList(Position.fromCoordinates(x, bounds.getLatSouth()), - Position.fromCoordinates(x, bounds.getLatNorth()))); + gridLines.add(Arrays.asList(Point.fromLngLat(x, bounds.getLatSouth()), + Point.fromLngLat(x, bounds.getLatNorth()))); } - features.add(Feature.fromGeometry(MultiLineString.fromCoordinates(gridLines))); + features.add(Feature.fromGeometry(MultiLineString.fromLngLats(gridLines))); return FeatureCollection.fromFeatures(features); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java index 942ce9aa3d..6eb4772b15 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java @@ -8,6 +8,8 @@ import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; +import com.mapbox.geojson.Feature; +import com.mapbox.geojson.FeatureCollection; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; @@ -28,8 +30,7 @@ import com.mapbox.mapboxsdk.style.sources.TileSet; import com.mapbox.mapboxsdk.style.sources.VectorSource; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ResourceUtils; -import com.mapbox.services.commons.geojson.Feature; -import com.mapbox.services.commons.geojson.FeatureCollection; + import java.io.IOException; import java.util.ArrayList; @@ -364,7 +365,7 @@ public class RuntimeStyleActivity extends AppCompatActivity { Timber.d("Updating parks source"); // change the source - int park = counter < parks.getFeatures().size() - 1 ? counter : 0; + int park = counter < parks.features().size() - 1 ? counter : 0; GeoJsonSource source = mapboxMap.getSourceAs("dynamic-park-source"); @@ -375,7 +376,7 @@ public class RuntimeStyleActivity extends AppCompatActivity { } List features = new ArrayList<>(); - features.add(parks.getFeatures().get(park)); + features.add(parks.features().get(park)); source.setGeoJson(FeatureCollection.fromFeatures(features)); // Re-post diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java index 1ef59db9b1..ca4176be6e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java @@ -15,7 +15,8 @@ import android.view.View; import android.widget.TextView; import android.widget.Toast; -import com.google.gson.GsonBuilder; +import com.mapbox.geojson.Feature; +import com.mapbox.geojson.FeatureCollection; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; @@ -25,12 +26,7 @@ import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; import com.mapbox.mapboxsdk.style.sources.Source; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.ResourceUtils; -import com.mapbox.services.commons.geojson.Feature; -import com.mapbox.services.commons.geojson.FeatureCollection; -import com.mapbox.services.commons.geojson.Geometry; -import com.mapbox.services.commons.geojson.custom.GeometryDeserializer; -import com.mapbox.services.commons.geojson.custom.PositionDeserializer; -import com.mapbox.services.commons.models.Position; + import java.io.IOException; import java.util.HashMap; @@ -211,14 +207,8 @@ public class SymbolGeneratorActivity extends AppCompatActivity implements OnMapR try { // read local geojson from raw folder String tinyCountriesJson = ResourceUtils.readRawResource(activity, R.raw.tiny_countries); + return FeatureCollection.fromJson(tinyCountriesJson); - // convert geojson to a model - FeatureCollection featureCollection = new GsonBuilder() - .registerTypeAdapter(Geometry.class, new GeometryDeserializer()) - .registerTypeAdapter(Position.class, new PositionDeserializer()) - .create().fromJson(tinyCountriesJson, FeatureCollection.class); - - return featureCollection; } catch (IOException exception) { return null; } @@ -288,7 +278,7 @@ public class SymbolGeneratorActivity extends AppCompatActivity implements OnMapR FeatureCollection featureCollection = params[0]; HashMap imagesMap = new HashMap<>(); - for (Feature feature : featureCollection.getFeatures()) { + for (Feature feature : featureCollection.features()) { String countryName = feature.getStringProperty(FEATURE_ID); TextView textView = new TextView(context); textView.setBackgroundColor(context.getResources().getColor(R.color.blueAccent)); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java index d89d71e604..e3a4f4be93 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java @@ -11,6 +11,9 @@ import android.view.MenuItem; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; +import com.mapbox.geojson.Feature; +import com.mapbox.geojson.FeatureCollection; +import com.mapbox.geojson.Point; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapView; @@ -18,9 +21,7 @@ import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.style.layers.SymbolLayer; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.services.commons.geojson.Feature; -import com.mapbox.services.commons.geojson.FeatureCollection; -import com.mapbox.services.commons.geojson.Point; + import java.util.Arrays; import java.util.List; @@ -62,8 +63,8 @@ public class SymbolLayerActivity extends AppCompatActivity implements MapboxMap. // Add a source FeatureCollection markers = FeatureCollection.fromFeatures(new Feature[] { - Feature.fromGeometry(Point.fromCoordinates(new double[] {4.91638, 52.35673}), featureProperties("Marker 1")), - Feature.fromGeometry(Point.fromCoordinates(new double[] {4.91638, 52.34673}), featureProperties("Marker 2")) + Feature.fromGeometry(Point.fromLngLat(4.91638, 52.35673), featureProperties("Marker 1")), + Feature.fromGeometry(Point.fromLngLat(4.91638, 52.34673), featureProperties("Marker 2")) }); mapboxMap.addSource(new GeoJsonSource(MARKER_SOURCE, markers)); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/ZoomFunctionSymbolLayerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/ZoomFunctionSymbolLayerActivity.java index 4a6e62ef7d..180e2e726a 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/ZoomFunctionSymbolLayerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/ZoomFunctionSymbolLayerActivity.java @@ -7,16 +7,16 @@ import android.view.Menu; import android.view.MenuItem; import com.google.gson.JsonObject; +import com.mapbox.geojson.Feature; +import com.mapbox.geojson.FeatureCollection; +import com.mapbox.geojson.Point; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.style.layers.Property; import com.mapbox.mapboxsdk.style.layers.SymbolLayer; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.services.commons.geojson.Feature; -import com.mapbox.services.commons.geojson.FeatureCollection; -import com.mapbox.services.commons.geojson.Point; -import com.mapbox.services.commons.models.Position; + import java.util.List; @@ -87,15 +87,13 @@ public class ZoomFunctionSymbolLayerActivity extends AppCompatActivity { } private FeatureCollection createFeatureCollection() { - Position position = isInitialPosition - ? Position.fromCoordinates(-74.01618140, 40.701745) - : Position.fromCoordinates(-73.988097, 40.749864); + Point point = isInitialPosition + ? Point.fromLngLat(-74.01618140, 40.701745) + : Point.fromLngLat(-73.988097, 40.749864); - Point point = Point.fromCoordinates(position); - Feature feature = Feature.fromGeometry(point); JsonObject properties = new JsonObject(); properties.addProperty(KEY_PROPERTY_SELECTED, isSelected); - feature.setProperties(properties); + Feature feature = Feature.fromGeometry(point, properties); return FeatureCollection.fromFeatures(new Feature[] {feature}); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/GeoParseUtil.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/GeoParseUtil.java index 97f70e33bb..c21e479659 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/GeoParseUtil.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/GeoParseUtil.java @@ -2,11 +2,11 @@ package com.mapbox.mapboxsdk.testapp.utils; import android.content.Context; import android.text.TextUtils; + +import com.mapbox.geojson.Feature; +import com.mapbox.geojson.FeatureCollection; +import com.mapbox.geojson.Point; import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.services.commons.geojson.Feature; -import com.mapbox.services.commons.geojson.FeatureCollection; -import com.mapbox.services.commons.geojson.Point; -import com.mapbox.services.commons.models.Position; import java.io.BufferedReader; import java.io.IOException; @@ -31,10 +31,10 @@ public class GeoParseUtil { public static List parseGeoJsonCoordinates(String geojsonStr) { List latLngs = new ArrayList<>(); FeatureCollection featureCollection = FeatureCollection.fromJson(geojsonStr); - for (Feature feature : featureCollection.getFeatures()) { - if (feature.getGeometry() instanceof Point) { - Position point = ((Point) feature.getGeometry()).getCoordinates(); - latLngs.add(new LatLng(point.getLatitude(), point.getLongitude())); + for (Feature feature : featureCollection.features()) { + if (feature.geometry() instanceof Point) { + Point point = (Point) feature.geometry(); + latLngs.add(new LatLng(point.latitude(), point.longitude())); } } return latLngs; diff --git a/platform/android/config.cmake b/platform/android/config.cmake index 4832f8b251..e1c36789f5 100644 --- a/platform/android/config.cmake +++ b/platform/android/config.cmake @@ -248,8 +248,6 @@ add_library(mbgl-android STATIC platform/android/src/geojson/point.hpp platform/android/src/geojson/polygon.cpp platform/android/src/geojson/polygon.hpp - platform/android/src/geojson/position.cpp - platform/android/src/geojson/position.hpp # Geometry platform/android/src/geometry/lat_lng.cpp diff --git a/platform/android/gradle/dependencies.gradle b/platform/android/gradle/dependencies.gradle index 0c72368d3d..7ce0cd6196 100644 --- a/platform/android/gradle/dependencies.gradle +++ b/platform/android/gradle/dependencies.gradle @@ -8,7 +8,8 @@ ext { ] versions = [ - mapboxServices: '2.2.9', + mapboxServices: '3.0.0-beta.2', + mapboxTelemetry: '2.2.9', supportLib : '25.4.0', espresso : '3.0.1', testRunner : '1.0.1', @@ -22,9 +23,12 @@ ext { ] dependenciesList = [ - mapboxJavaServices : "com.mapbox.mapboxsdk:mapbox-java-services:${versions.mapboxServices}@jar", - mapboxJavaGeoJSON : "com.mapbox.mapboxsdk:mapbox-java-geojson:${versions.mapboxServices}@jar", - mapboxAndroidTelemetry: "com.mapbox.mapboxsdk:mapbox-android-telemetry:${versions.mapboxServices}@aar", + mapboxJavaServices : "com.mapbox.mapboxsdk:mapbox-sdk-services:${versions.mapboxServices}@jar", + mapboxJavaGeoJSON : "com.mapbox.mapboxsdk:mapbox-sdk-geojson:${versions.mapboxServices}@jar", + mapboxAndroidTelemetry: "com.mapbox.mapboxsdk:mapbox-android-telemetry:${versions.mapboxTelemetry}@aar", + + // for testApp + mapboxJavaTurf : "com.mapbox.mapboxsdk:mapbox-sdk-turf:${versions.mapboxServices}@jar", junit : "junit:junit:${versions.junit}", mockito : "org.mockito:mockito-core:${versions.mockito}", diff --git a/platform/android/src/geojson/conversion/geometry.hpp b/platform/android/src/geojson/conversion/geometry.hpp index 2ca63e2c11..5d2aab4c2d 100644 --- a/platform/android/src/geojson/conversion/geometry.hpp +++ b/platform/android/src/geojson/conversion/geometry.hpp @@ -21,88 +21,91 @@ public: jni::JNIEnv& env; /** - * Point (double[]) + * static Point fromLngLat(double longitude,double latitude) */ jni::jobject* operator()(const mapbox::geometry::point &geometry) const { - static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/Point")).release(); - static jni::jmethodID* fromCoordinates = &jni::GetStaticMethodID(env, *javaClass, "fromCoordinates", "([D)Lcom/mapbox/services/commons/geojson/Point;"); + static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/geojson/Point")).release(); + static jni::jmethodID* fromLngLat = &jni::GetStaticMethodID(env, *javaClass, "fromLngLat", "(DD)Lcom/mapbox/geojson/Point;"); - // Create Point - jni::LocalObject> position = jni::NewLocalObject(env, toGeoJsonPosition(env, geometry.x, geometry.y)); - return reinterpret_cast(jni::CallStaticMethod(env, *javaClass, *fromCoordinates, position.get())); + return reinterpret_cast(jni::CallStaticMethod(env, *javaClass, *fromLngLat, geometry.x, geometry.y)); } /** - * LineString (double[][]) + * static LineString fromLngLats(List points) */ jni::jobject* operator()(const mapbox::geometry::line_string &geometry) const { - static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/LineString")).release(); - static jni::jmethodID* fromCoordinates = &jni::GetStaticMethodID(env, *javaClass, "fromCoordinates", "([[D)Lcom/mapbox/services/commons/geojson/LineString;"); + static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/geojson/LineString")).release(); + static jni::jmethodID* fromLngLats = &jni::GetStaticMethodID(env, *javaClass, "fromLngLats", "(Ljava/util/List;)Lcom/mapbox/geojson/LineString;"); // Create - jni::LocalObject> coordinates = jni::NewLocalObject(env, toGeoJsonCoordinates(env, geometry)); - return reinterpret_cast(jni::CallStaticMethod(env, *javaClass, *fromCoordinates, coordinates.get())); + jni::LocalObject listOfPoints = jni::NewLocalObject(env, toGeoJsonListOfPoints(env, geometry)); + return reinterpret_cast(jni::CallStaticMethod(env, *javaClass, *fromLngLats, listOfPoints.get())); } /** - * MultiPoint (double[][]) + * static MultiPoint fromLngLats(List points) */ jni::jobject* operator()(const mapbox::geometry::multi_point &geometry) const { - static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/MultiPoint")).release(); - static jni::jmethodID* fromCoordinates = &jni::GetStaticMethodID(env, *javaClass, "fromCoordinates", "([[D)Lcom/mapbox/services/commons/geojson/MultiPoint;"); + static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/geojson/MultiPoint")).release(); + static jni::jmethodID* fromLngLats = &jni::GetStaticMethodID(env, *javaClass, "fromLngLats", "(Ljava/util/List;)Lcom/mapbox/geojson/MultiPoint;"); // Create - jni::LocalObject> coordinates = jni::NewLocalObject(env, toGeoJsonCoordinates(env, geometry)); - return reinterpret_cast(jni::CallStaticMethod(env, *javaClass, *fromCoordinates, coordinates.get())); + jni::LocalObject coordinates = jni::NewLocalObject(env, toGeoJsonListOfPoints(env, geometry)); + return reinterpret_cast(jni::CallStaticMethod(env, *javaClass, *fromLngLats, coordinates.get())); } /** - * Polygon (double[][][]) + * static Polygon fromLngLats(List> coordinates) */ jni::jobject* operator()(const mapbox::geometry::polygon &geometry) const { - static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/Polygon")).release(); - static jni::jmethodID* fromCoordinates = &jni::GetStaticMethodID(env, *javaClass, "fromCoordinates", "([[[D)Lcom/mapbox/services/commons/geojson/Polygon;"); + static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/geojson/Polygon")).release(); + static jni::jmethodID* fromLngLats = &jni::GetStaticMethodID(env, *javaClass, "fromLngLats", "(Ljava/util/List;)Lcom/mapbox/geojson/Polygon;"); // Create - jni::LocalObject> shape = jni::NewLocalObject(env, toShape<>(env, geometry)); - return reinterpret_cast(jni::CallStaticMethod(env, *javaClass, *fromCoordinates, shape.get())); + jni::LocalObject shape = jni::NewLocalObject(env, toShape<>(env, geometry)); + return reinterpret_cast(jni::CallStaticMethod(env, *javaClass, *fromLngLats, shape.get())); } /** - * MultiLineString (double[][][]) + * static MultiLineString fromLngLats(List> points) */ jni::jobject* operator()(const mapbox::geometry::multi_line_string &geometry) const { - static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/MultiLineString")).release(); - static jni::jmethodID* fromCoordinates = &jni::GetStaticMethodID(env, *javaClass, "fromCoordinates", "([[[D)Lcom/mapbox/services/commons/geojson/MultiLineString;"); + static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/geojson/MultiLineString")).release(); + static jni::jmethodID* fromLngLats = &jni::GetStaticMethodID(env, *javaClass, "fromLngLats", "(Ljava/util/List;)Lcom/mapbox/geojson/MultiLineString;"); // Create - jni::LocalObject> shape = jni::NewLocalObject(env, toShape<>(env, geometry)); - return reinterpret_cast(jni::CallStaticMethod(env, *javaClass, *fromCoordinates, shape.get())); + jni::LocalObject shape = jni::NewLocalObject(env, toShape<>(env, geometry)); + return reinterpret_cast(jni::CallStaticMethod(env, *javaClass, *fromLngLats, shape.get())); } /** * MultiPolygon (double[][][][]) -> [[[D + Object array == [[[[D + * + * static MultiPolygon fromLngLats(List>> points) */ jni::jobject* operator()(const mapbox::geometry::multi_polygon &geometry) const { - static jni::jclass* listClass = jni::NewGlobalRef(env, &jni::FindClass(env, "[[[D")).release(); - jni::LocalObject> jarray = jni::NewLocalObject(env, &jni::NewObjectArray(env, geometry.size(), *listClass)); + // ArrayList + static jni::jclass* arrayListClass = jni::NewGlobalRef(env, &jni::FindClass(env, "java/util/ArrayList")).release(); + static jni::jmethodID* constructor = &jni::GetMethodID(env, *arrayListClass, "", "(I)V"); + static jni::jmethodID* add = &jni::GetMethodID(env, *arrayListClass, "add", "(ILjava/lang/Object;)V"); + jni::jobject* arrayList = &jni::NewObject(env, *arrayListClass, *constructor, geometry.size()); for(size_t i = 0; i < geometry.size(); i = i + 1) { - jni::LocalObject> shape = jni::NewLocalObject(env, toShape<>(env, geometry.at(i))); - jni::SetObjectArrayElement(env, *jarray, i, shape.get()); + jni::LocalObject shape = jni::NewLocalObject(env, toShape<>(env, geometry.at(i))); + jni::CallMethod(env, arrayList, *add, i, shape.get()); } // Create the MultiPolygon - static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/MultiPolygon")).release(); - static jni::jmethodID* fromGeometries = &jni::GetStaticMethodID(env, *javaClass, "fromCoordinates", "([[[[D)Lcom/mapbox/services/commons/geojson/MultiPolygon;"); - return reinterpret_cast(jni::CallStaticMethod(env, *javaClass, *fromGeometries, jarray.get())); + static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/geojson/MultiPolygon")).release(); + static jni::jmethodID* fromGeometries = &jni::GetStaticMethodID(env, *javaClass, "fromLngLats", "(Ljava/util/List;)Lcom/mapbox/geojson/MultiPolygon;"); + return reinterpret_cast(jni::CallStaticMethod(env, *javaClass, *fromGeometries, arrayList)); } /** * GeometryCollection */ jni::jobject* operator()(const mapbox::geometry::geometry_collection &collection) const { - static jni::jclass* geometryClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/Geometry")).release(); + static jni::jclass* geometryClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/geojson/Geometry")).release(); jni::LocalObject> jarray = jni::NewLocalObject(env, &jni::NewObjectArray(env, collection.size(), *geometryClass)); for(size_t i = 0; i < collection.size(); i = i + 1) { @@ -112,8 +115,8 @@ public: } // Turn into array list and create the GeometryCollection - static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/GeometryCollection")).release(); - static jni::jmethodID* fromGeometries = &jni::GetStaticMethodID(env, *javaClass, "fromGeometries", "(Ljava/util/List;)Lcom/mapbox/services/commons/geojson/GeometryCollection;"); + static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/geojson/GeometryCollection")).release(); + static jni::jmethodID* fromGeometries = &jni::GetStaticMethodID(env, *javaClass, "fromGeometries", "(Ljava/util/List;)Lcom/mapbox/geojson/GeometryCollection;"); jni::LocalObject list = jni::NewLocalObject(env, toArrayList<>(env, *jarray)); return reinterpret_cast(jni::CallStaticMethod(env, *javaClass, *fromGeometries, list.get())); @@ -122,47 +125,50 @@ public: private: /** - * x, y -> jarray ([x,y]) - */ - static jni::jarray* toGeoJsonPosition(JNIEnv& env, double x, double y) { - jni::jarray& jarray = jni::NewArray(env, 2); - jni::jdouble array[] = {x, y}; - jni::SetArrayRegion(env, jarray, 0, 2, array); - return &jarray; - } + * vector> -> List + */ + static jni::jobject* toGeoJsonListOfPoints(JNIEnv& env, std::vector> points) { - /** - * vector> -> jarray (double[][]) -> [D + Object array == [[D - */ - static jni::jarray* toGeoJsonCoordinates(JNIEnv& env, std::vector> points) { - static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "[D")).release(); - jni::jarray& jarray = jni::NewObjectArray(env, points.size(), *javaClass); + // ArrayList + static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "java/util/ArrayList")).release(); + static jni::jmethodID* constructor = &jni::GetMethodID(env, *javaClass, "", "(I)V"); + static jni::jmethodID* add = &jni::GetMethodID(env, *javaClass, "add", "(ILjava/lang/Object;)V"); + jni::jobject* arrayList = &jni::NewObject(env, *javaClass, *constructor, points.size()); + + + // Point + static jni::jclass* pointJavaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/geojson/Point")).release(); + static jni::jmethodID* fromLngLat = &jni::GetStaticMethodID(env, *pointJavaClass, "fromLngLat", "(DD)Lcom/mapbox/geojson/Point;"); for(size_t i = 0; i < points.size(); i = i + 1) { mapbox::geometry::point point = points.at(i); - jni::LocalObject> position = jni::NewLocalObject(env, toGeoJsonPosition(env, point.x, point.y)); - jni::SetObjectArrayElement(env, jarray, i, position.get()); + jni::LocalObject pointObject = + jni::NewLocalObject(env, jni::CallStaticMethod(env, *pointJavaClass, *fromLngLat, point.x, point.y)); + jni::CallMethod(env, arrayList, *add, i, pointObject.get()); } - return &jarray; + return arrayList; } /** - * polygon - * multi_line_string - * -> jarray (double[][][]) -> [[D + Object array == [[[D + * geometry -> List> */ template - static jni::jarray* toShape(JNIEnv& env, SHAPE value) { - static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "[[D")).release(); - jni::jarray& jarray = jni::NewObjectArray(env, value.size(), *javaClass); + static jni::jobject* toShape(JNIEnv& env, SHAPE value) { + + // ArrayList + static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "java/util/ArrayList")).release(); + static jni::jmethodID* constructor = &jni::GetMethodID(env, *javaClass, "", "(I)V"); + static jni::jmethodID* add = &jni::GetMethodID(env, *javaClass, "add", "(ILjava/lang/Object;)V"); + jni::jobject* arrayList = &jni::NewObject(env, *javaClass, *constructor, value.size()); + for(size_t i = 0; i < value.size(); i = i + 1) { - jni::LocalObject> coordinates = jni::NewLocalObject(env, toGeoJsonCoordinates(env, value.at(i))); - jni::SetObjectArrayElement(env, jarray, i, coordinates.get()); + jni::LocalObject listOfPoints = jni::NewLocalObject(env, toGeoJsonListOfPoints(env, value.at(i))); + jni::CallMethod(env, arrayList, *add, i, listOfPoints.get()); } - return &jarray; + return arrayList; } }; diff --git a/platform/android/src/geojson/feature.cpp b/platform/android/src/geojson/feature.cpp index a6b387cd15..d8a4e829e2 100644 --- a/platform/android/src/geojson/feature.cpp +++ b/platform/android/src/geojson/feature.cpp @@ -8,11 +8,11 @@ namespace geojson { mbgl::Feature Feature::convert(jni::JNIEnv& env, jni::Object jFeature) { // Convert - auto jGeometry = getGeometry(env, jFeature); - auto jProperties = Feature::getProperties(env, jFeature); + auto jGeometry = geometry(env, jFeature); + auto jProperties = Feature::properties(env, jFeature); std::experimental::optional id; - auto jId = Feature::getId(env, jFeature); + auto jId = Feature::id(env, jFeature); if (jId) { id = { jni::Make(env, jId) }; } @@ -31,18 +31,18 @@ mbgl::Feature Feature::convert(jni::JNIEnv& env, jni::Object jFeature) return feature; } -jni::Object Feature::getGeometry(jni::JNIEnv& env, jni::Object jFeature) { - static auto method = Feature::javaClass.GetMethod ()>(env, "getGeometry"); +jni::Object Feature::geometry(jni::JNIEnv& env, jni::Object jFeature) { + static auto method = Feature::javaClass.GetMethod ()>(env, "geometry"); return jFeature.Call(env, method); } -jni::Object Feature::getProperties(jni::JNIEnv& env, jni::Object jFeature) { - static auto method = Feature::javaClass.GetMethod ()>(env, "getProperties"); +jni::Object Feature::properties(jni::JNIEnv& env, jni::Object jFeature) { + static auto method = Feature::javaClass.GetMethod ()>(env, "properties"); return jFeature.Call(env, method); } -jni::String Feature::getId(jni::JNIEnv& env, jni::Object jFeature) { - static auto method = Feature::javaClass.GetMethod(env, "getId"); +jni::String Feature::id(jni::JNIEnv& env, jni::Object jFeature) { + static auto method = Feature::javaClass.GetMethod(env, "id"); return jFeature.Call(env, method); } diff --git a/platform/android/src/geojson/feature.hpp b/platform/android/src/geojson/feature.hpp index b5d856cc42..ab59d783e5 100644 --- a/platform/android/src/geojson/feature.hpp +++ b/platform/android/src/geojson/feature.hpp @@ -16,17 +16,17 @@ namespace geojson { class Feature : private mbgl::util::noncopyable { public: - static constexpr auto Name() { return "com/mapbox/services/commons/geojson/Feature"; }; + static constexpr auto Name() { return "com/mapbox/geojson/Feature"; }; static jni::Object fromGeometry(jni::JNIEnv&, jni::Object, jni::Object, jni::String); static mbgl::Feature convert(jni::JNIEnv&, jni::Object); - static jni::Object getGeometry(jni::JNIEnv&, jni::Object); + static jni::Object geometry(jni::JNIEnv&, jni::Object); - static jni::String getId(jni::JNIEnv&, jni::Object); + static jni::String id(jni::JNIEnv&, jni::Object); - static jni::Object getProperties(jni::JNIEnv&, jni::Object); + static jni::Object properties(jni::JNIEnv&, jni::Object); static jni::Class javaClass; diff --git a/platform/android/src/geojson/feature_collection.cpp b/platform/android/src/geojson/feature_collection.cpp index 2f156532ae..59f1e317e6 100644 --- a/platform/android/src/geojson/feature_collection.cpp +++ b/platform/android/src/geojson/feature_collection.cpp @@ -7,7 +7,7 @@ namespace android { namespace geojson { mbgl::FeatureCollection FeatureCollection::convert(jni::JNIEnv& env, jni::Object jCollection) { - auto jFeatureList = FeatureCollection::getFeatures(env, jCollection); + auto jFeatureList = FeatureCollection::features(env, jCollection); auto jFeatures = java::util::List::toArray(env, jFeatureList); auto size = size_t(jFeatures.Length(env)); @@ -23,8 +23,8 @@ mbgl::FeatureCollection FeatureCollection::convert(jni::JNIEnv& env, jni::Object return collection; } -jni::Object FeatureCollection::getFeatures(jni::JNIEnv& env, jni::Object jCollection) { - static auto method = FeatureCollection::javaClass.GetMethod ()>(env, "getFeatures"); +jni::Object FeatureCollection::features(jni::JNIEnv& env, jni::Object jCollection) { + static auto method = FeatureCollection::javaClass.GetMethod ()>(env, "features"); return jCollection.Call(env, method); } diff --git a/platform/android/src/geojson/feature_collection.hpp b/platform/android/src/geojson/feature_collection.hpp index 8e9717e82b..259ffab370 100644 --- a/platform/android/src/geojson/feature_collection.hpp +++ b/platform/android/src/geojson/feature_collection.hpp @@ -13,11 +13,11 @@ namespace geojson { class FeatureCollection : private mbgl::util::noncopyable { public: - static constexpr auto Name() { return "com/mapbox/services/commons/geojson/FeatureCollection"; }; + static constexpr auto Name() { return "com/mapbox/geojson/FeatureCollection"; }; static mbgl::FeatureCollection convert(jni::JNIEnv&, jni::Object); - static jni::Object getFeatures(jni::JNIEnv&, jni::Object); + static jni::Object features(jni::JNIEnv&, jni::Object); static jni::Class javaClass; diff --git a/platform/android/src/geojson/geometry.cpp b/platform/android/src/geojson/geometry.cpp index 33bb4ee3db..ca19d8fb03 100644 --- a/platform/android/src/geojson/geometry.cpp +++ b/platform/android/src/geojson/geometry.cpp @@ -33,7 +33,7 @@ mapbox::geojson::geometry Geometry::convert(jni::JNIEnv &env, jni::Object jGeometry) { - static auto method = Geometry::javaClass.GetMethod(env, "getType"); + static auto method = Geometry::javaClass.GetMethod(env, "type"); auto jType = jGeometry.Call(env, method); auto type = jni::Make(env, jType); jni::DeleteLocalRef(env, jType); diff --git a/platform/android/src/geojson/geometry.hpp b/platform/android/src/geojson/geometry.hpp index bdcff6bb3e..b7f8909f6f 100644 --- a/platform/android/src/geojson/geometry.hpp +++ b/platform/android/src/geojson/geometry.hpp @@ -11,7 +11,7 @@ namespace geojson { class Geometry : private mbgl::util::noncopyable { public: - static constexpr auto Name() { return "com/mapbox/services/commons/geojson/Geometry"; }; + static constexpr auto Name() { return "com/mapbox/geojson/Geometry"; }; static mapbox::geojson::geometry convert(jni::JNIEnv&, jni::Object); diff --git a/platform/android/src/geojson/line_string.cpp b/platform/android/src/geojson/line_string.cpp index d0719f2538..9e99c72c4c 100644 --- a/platform/android/src/geojson/line_string.cpp +++ b/platform/android/src/geojson/line_string.cpp @@ -1,6 +1,6 @@ #include "line_string.hpp" -#include "position.hpp" +#include "point.hpp" namespace mbgl { namespace android { @@ -10,35 +10,35 @@ mapbox::geojson::line_string LineString::convert(jni::JNIEnv &env, jni::Object*/> jPositionList) { +mapbox::geojson::line_string LineString::convert(jni::JNIEnv &env, jni::Object*/> jPointList) { mapbox::geojson::line_string lineString; - if (jPositionList) { - auto jPositionArray = java::util::List::toArray(env, jPositionList); + if (jPointList) { + auto jPointArray = java::util::List::toArray(env, jPointList); - auto size = jPositionArray.Length(env); + auto size = jPointArray.Length(env); for (std::size_t i = 0; i < size; i++) { - auto jPosition = jPositionArray.Get(env, i); - lineString.push_back(Position::convert(env, jPosition)); - jni::DeleteLocalRef(env, jPosition); + auto jPoint = jPointArray.Get(env, i); + lineString.push_back(Point::convert(env, jPoint)); + jni::DeleteLocalRef(env, jPoint); } - jni::DeleteLocalRef(env, jPositionArray); + jni::DeleteLocalRef(env, jPointArray); } return lineString; } -jni::Object LineString::getCoordinates(jni::JNIEnv &env, jni::Object jLineString) { - static auto method = LineString::javaClass.GetMethod ()>(env, "getCoordinates"); +jni::Object LineString::coordinates(jni::JNIEnv &env, jni::Object jLineString) { + static auto method = LineString::javaClass.GetMethod ()>(env, "coordinates"); return jLineString.Call(env, method); } diff --git a/platform/android/src/geojson/line_string.hpp b/platform/android/src/geojson/line_string.hpp index d3be68d0a5..86033c2e6a 100644 --- a/platform/android/src/geojson/line_string.hpp +++ b/platform/android/src/geojson/line_string.hpp @@ -14,15 +14,15 @@ namespace geojson { class LineString : private mbgl::util::noncopyable { public: - static constexpr auto Name() { return "com/mapbox/services/commons/geojson/LineString"; }; + static constexpr auto Name() { return "com/mapbox/geojson/LineString"; }; static constexpr auto Type() { return "LineString"; }; static mapbox::geojson::line_string convert(jni::JNIEnv&, jni::Object); - static mapbox::geojson::line_string convert(jni::JNIEnv&, jni::Object*/>); + static mapbox::geojson::line_string convert(jni::JNIEnv&, jni::Object*/>); - static jni::Object getCoordinates(jni::JNIEnv&, jni::Object); + static jni::Object coordinates(jni::JNIEnv&, jni::Object); static jni::Class javaClass; diff --git a/platform/android/src/geojson/multi_line_string.cpp b/platform/android/src/geojson/multi_line_string.cpp index b676144bf5..c748d4786f 100644 --- a/platform/android/src/geojson/multi_line_string.cpp +++ b/platform/android/src/geojson/multi_line_string.cpp @@ -10,27 +10,27 @@ mapbox::geojson::multi_line_string MultiLineString::convert(jni::JNIEnv &env, jn mapbox::geojson::multi_line_string multiLineString; if (jMultiLineString) { - auto jPositionListsList = MultiLineString::getCoordinates(env, jMultiLineString); - multiLineString = MultiLineString::convert(env, jPositionListsList); - jni::DeleteLocalRef(env, jPositionListsList); + auto jPointListsList = MultiLineString::coordinates(env, jMultiLineString); + multiLineString = MultiLineString::convert(env, jPointListsList); + jni::DeleteLocalRef(env, jPointListsList); } return multiLineString; } -mapbox::geojson::multi_line_string MultiLineString::convert(jni::JNIEnv &env, jni::Object>*/> jPositionListsList) { +mapbox::geojson::multi_line_string MultiLineString::convert(jni::JNIEnv &env, jni::Object>*/> jPointListsList) { mapbox::geojson::multi_line_string multiLineString; - if (jPositionListsList) { - auto jPositionListsArray = java::util::List::toArray(env, jPositionListsList); + if (jPointListsList) { + auto jPositionListsArray = java::util::List::toArray(env, jPointListsList); auto size = jPositionListsArray.Length(env); multiLineString.reserve(size); for (std::size_t i = 0; i < size; i++) { - auto jPositionList = jPositionListsArray.Get(env, i); - multiLineString.push_back(LineString::convert(env, jPositionList)); - jni::DeleteLocalRef(env, jPositionList); + auto jPointsList = jPositionListsArray.Get(env, i); + multiLineString.push_back(LineString::convert(env, jPointsList)); + jni::DeleteLocalRef(env, jPointsList); } jni::DeleteLocalRef(env, jPositionListsArray); @@ -39,8 +39,8 @@ mapbox::geojson::multi_line_string MultiLineString::convert(jni::JNIEnv &env, jn return multiLineString; } -jni::Object MultiLineString::getCoordinates(jni::JNIEnv &env, jni::Object jLineString) { - static auto method = MultiLineString::javaClass.GetMethod ()>(env, "getCoordinates"); +jni::Object MultiLineString::coordinates(jni::JNIEnv &env, jni::Object jLineString) { + static auto method = MultiLineString::javaClass.GetMethod ()>(env, "coordinates"); return jLineString.Call(env, method); } diff --git a/platform/android/src/geojson/multi_line_string.hpp b/platform/android/src/geojson/multi_line_string.hpp index af33fe72d6..358a6b5dda 100644 --- a/platform/android/src/geojson/multi_line_string.hpp +++ b/platform/android/src/geojson/multi_line_string.hpp @@ -13,15 +13,15 @@ namespace geojson { class MultiLineString : private mbgl::util::noncopyable { public: - static constexpr auto Name() { return "com/mapbox/services/commons/geojson/MultiLineString"; }; + static constexpr auto Name() { return "com/mapbox/geojson/MultiLineString"; }; static constexpr auto Type() { return "MultiLineString"; }; static mapbox::geojson::multi_line_string convert(jni::JNIEnv&, jni::Object); - static mapbox::geojson::multi_line_string convert(jni::JNIEnv&, jni::Object>*/>); + static mapbox::geojson::multi_line_string convert(jni::JNIEnv&, jni::Object>*/>); - static jni::Object getCoordinates(jni::JNIEnv&, jni::Object); + static jni::Object coordinates(jni::JNIEnv&, jni::Object); static jni::Class javaClass; diff --git a/platform/android/src/geojson/multi_point.cpp b/platform/android/src/geojson/multi_point.cpp index f3acdb1ea6..4f9ff596b2 100644 --- a/platform/android/src/geojson/multi_point.cpp +++ b/platform/android/src/geojson/multi_point.cpp @@ -12,16 +12,16 @@ mapbox::geojson::multi_point MultiPoint::convert(jni::JNIEnv &env, jni::Object(LineString::convert(env, jPositionListsList)); - jni::DeleteLocalRef(env, jPositionListsList); + auto jPointListsList = MultiPoint::coordinates(env, jMultiPoint); + multiPoint = convertExplicit(LineString::convert(env, jPointListsList)); + jni::DeleteLocalRef(env, jPointListsList); } return multiPoint; } -jni::Object MultiPoint::getCoordinates(jni::JNIEnv &env, jni::Object jMultiPoint) { - static auto method = MultiPoint::javaClass.GetMethod ()>(env, "getCoordinates"); +jni::Object MultiPoint::coordinates(jni::JNIEnv &env, jni::Object jMultiPoint) { + static auto method = MultiPoint::javaClass.GetMethod ()>(env, "coordinates"); return jMultiPoint.Call(env, method); } diff --git a/platform/android/src/geojson/multi_point.hpp b/platform/android/src/geojson/multi_point.hpp index 7a698287eb..e893e879af 100644 --- a/platform/android/src/geojson/multi_point.hpp +++ b/platform/android/src/geojson/multi_point.hpp @@ -13,13 +13,13 @@ namespace geojson { class MultiPoint : private mbgl::util::noncopyable { public: - static constexpr auto Name() { return "com/mapbox/services/commons/geojson/MultiPoint"; }; + static constexpr auto Name() { return "com/mapbox/geojson/MultiPoint"; }; static constexpr auto Type() { return "MultiPoint"; }; static mapbox::geojson::multi_point convert(jni::JNIEnv&, jni::Object); - static jni::Object getCoordinates(jni::JNIEnv&, jni::Object); + static jni::Object coordinates(jni::JNIEnv&, jni::Object); static jni::Class javaClass; diff --git a/platform/android/src/geojson/multi_polygon.cpp b/platform/android/src/geojson/multi_polygon.cpp index a55884a110..f4eb0f6b2a 100644 --- a/platform/android/src/geojson/multi_polygon.cpp +++ b/platform/android/src/geojson/multi_polygon.cpp @@ -10,27 +10,27 @@ mapbox::geojson::multi_polygon MultiPolygon::convert(jni::JNIEnv &env, jni::Obje mapbox::geojson::multi_polygon multiPolygon; if (jMultiPolygon) { - auto jPositionListsListList = MultiPolygon::getCoordinates(env, jMultiPolygon); - auto jPositionListsListArray = java::util::List::toArray(env, jPositionListsListList); + auto jPointListsListList = MultiPolygon::coordinates(env, jMultiPolygon); + auto jPointListsListArray = java::util::List::toArray(env, jPointListsListList); - auto size = jPositionListsListArray.Length(env); + auto size = jPointListsListArray.Length(env); multiPolygon.reserve(size); for (size_t i = 0; i < size; i++) { - auto jPositionListsList = jPositionListsListArray.Get(env, i); + auto jPositionListsList = jPointListsListArray.Get(env, i); multiPolygon.push_back(Polygon::convert(env, jPositionListsList)); jni::DeleteLocalRef(env, jPositionListsList); } - jni::DeleteLocalRef(env, jPositionListsListList); - jni::DeleteLocalRef(env, jPositionListsListArray); + jni::DeleteLocalRef(env, jPointListsListList); + jni::DeleteLocalRef(env, jPointListsListArray); } return multiPolygon; } -jni::Object MultiPolygon::getCoordinates(jni::JNIEnv &env, jni::Object jPolygon) { - static auto method = MultiPolygon::javaClass.GetMethod ()>(env, "getCoordinates"); +jni::Object MultiPolygon::coordinates(jni::JNIEnv &env, jni::Object jPolygon) { + static auto method = MultiPolygon::javaClass.GetMethod ()>(env, "coordinates"); return jPolygon.Call(env, method); } diff --git a/platform/android/src/geojson/multi_polygon.hpp b/platform/android/src/geojson/multi_polygon.hpp index 1f144cffd2..6e1dfacfc8 100644 --- a/platform/android/src/geojson/multi_polygon.hpp +++ b/platform/android/src/geojson/multi_polygon.hpp @@ -13,13 +13,13 @@ namespace geojson { class MultiPolygon : private mbgl::util::noncopyable { public: - static constexpr auto Name() { return "com/mapbox/services/commons/geojson/MultiPolygon"; }; + static constexpr auto Name() { return "com/mapbox/geojson/MultiPolygon"; }; static constexpr auto Type() { return "MultiPolygon"; }; static mapbox::geojson::multi_polygon convert(jni::JNIEnv&, jni::Object); - static jni::Object getCoordinates(jni::JNIEnv&, jni::Object); + static jni::Object coordinates(jni::JNIEnv&, jni::Object); static jni::Class javaClass; diff --git a/platform/android/src/geojson/point.cpp b/platform/android/src/geojson/point.cpp index 3d19a119d7..5feb1b8521 100644 --- a/platform/android/src/geojson/point.cpp +++ b/platform/android/src/geojson/point.cpp @@ -1,19 +1,41 @@ #include "point.hpp" +#include "../java/util.hpp" +#include "../java_types.hpp" namespace mbgl { namespace android { namespace geojson { mapbox::geojson::point Point::convert(jni::JNIEnv &env, jni::Object jPoint) { - auto jPosition = Point::getPosition(env, jPoint); - auto point = Position::convert(env, jPosition); - jni::DeleteLocalRef(env, jPosition); + mapbox::geojson::point point; + + if (jPoint) { + auto jDoubleList = Point::coordinates(env, jPoint); + point = Point::convert(env, jDoubleList); + jni::DeleteLocalRef(env, jDoubleList); + } + + return point; +} + +mapbox::geojson::point Point::convert(jni::JNIEnv &env, jni::Object*/> jDoubleList) { + auto jDoubleArray = java::util::List::toArray(env, jDoubleList); + + jni::jdouble lon = jni::CallMethod(env, + jDoubleArray.Get(env, 0), + *java::Number::doubleValueMethodId); + jni::jdouble lat = jni::CallMethod(env, + jDoubleArray.Get(env, 1), + *java::Number::doubleValueMethodId); + mapbox::geojson::point point(lon, lat); + jni::DeleteLocalRef(env, jDoubleArray); + return point; } -jni::Object Point::getPosition(JNIEnv& env, jni::Object jPoint) { - static auto method = Point::javaClass.GetMethod ()>(env, "getCoordinates"); - return jPoint.Call(env, method); +jni::Object Point::coordinates(jni::JNIEnv &env, jni::Object jPoint) { + static auto method = Point::javaClass.GetMethod ()>(env, "coordinates"); + return jPoint.Call(env, method); } void Point::registerNative(jni::JNIEnv &env) { diff --git a/platform/android/src/geojson/point.hpp b/platform/android/src/geojson/point.hpp index 64ac0af9cc..c6412299bf 100644 --- a/platform/android/src/geojson/point.hpp +++ b/platform/android/src/geojson/point.hpp @@ -3,23 +3,25 @@ #include #include -#include "position.hpp" - #include +#include "../java/util.hpp" + namespace mbgl { namespace android { namespace geojson { class Point : private mbgl::util::noncopyable { public: - static constexpr auto Name() { return "com/mapbox/services/commons/geojson/Point"; }; + static constexpr auto Name() { return "com/mapbox/geojson/Point"; }; static constexpr auto Type() { return "Point"; }; static mapbox::geojson::point convert(jni::JNIEnv&, jni::Object); - static jni::Object getPosition(JNIEnv&, jni::Object); + static mapbox::geojson::point convert(jni::JNIEnv&, jni::Object*/>); + + static jni::Object coordinates(JNIEnv&, jni::Object); static jni::Class javaClass; diff --git a/platform/android/src/geojson/polygon.cpp b/platform/android/src/geojson/polygon.cpp index ef00f9df3f..30ba996640 100644 --- a/platform/android/src/geojson/polygon.cpp +++ b/platform/android/src/geojson/polygon.cpp @@ -12,7 +12,7 @@ mapbox::geojson::polygon Polygon::convert(jni::JNIEnv &env, jni::Object mapbox::geojson::polygon polygon; if (jPolygon) { - auto jPositionListsList = Polygon::getCoordinates(env, jPolygon); + auto jPositionListsList = Polygon::coordinates(env, jPolygon); polygon = Polygon::convert(env, jPositionListsList); jni::DeleteLocalRef(env, jPositionListsList); } @@ -20,11 +20,11 @@ mapbox::geojson::polygon Polygon::convert(jni::JNIEnv &env, jni::Object return polygon; } -mapbox::geojson::polygon Polygon::convert(jni::JNIEnv &env, jni::Object>*/> jPositionListsList) { +mapbox::geojson::polygon Polygon::convert(jni::JNIEnv &env, jni::Object>*/> jPointListsList) { mapbox::geojson::polygon polygon; - if (jPositionListsList) { - auto multiLine = MultiLineString::convert(env, jPositionListsList); + if (jPointListsList) { + auto multiLine = MultiLineString::convert(env, jPointListsList); polygon.reserve(multiLine.size()); for (auto&& line : multiLine) { polygon.emplace_back(convertExplicit(std::move(line))); @@ -35,8 +35,8 @@ mapbox::geojson::polygon Polygon::convert(jni::JNIEnv &env, jni::Object Polygon::getCoordinates(jni::JNIEnv &env, jni::Object jPolygon) { - static auto method = Polygon::javaClass.GetMethod ()>(env, "getCoordinates"); +jni::Object Polygon::coordinates(jni::JNIEnv &env, jni::Object jPolygon) { + static auto method = Polygon::javaClass.GetMethod ()>(env, "coordinates"); return jPolygon.Call(env, method); } diff --git a/platform/android/src/geojson/polygon.hpp b/platform/android/src/geojson/polygon.hpp index e5362cedf1..a8b2b93827 100644 --- a/platform/android/src/geojson/polygon.hpp +++ b/platform/android/src/geojson/polygon.hpp @@ -13,15 +13,15 @@ namespace geojson { class Polygon : private mbgl::util::noncopyable { public: - static constexpr auto Name() { return "com/mapbox/services/commons/geojson/Polygon"; }; + static constexpr auto Name() { return "com/mapbox/geojson/Polygon"; }; static constexpr auto Type() { return "Polygon"; }; static mapbox::geojson::polygon convert(jni::JNIEnv &, jni::Object); - static mapbox::geojson::polygon convert(jni::JNIEnv&, jni::Object>*/>); + static mapbox::geojson::polygon convert(jni::JNIEnv&, jni::Object>*/>); - static jni::Object getCoordinates(jni::JNIEnv&, jni::Object); + static jni::Object coordinates(jni::JNIEnv&, jni::Object); static jni::Class javaClass; diff --git a/platform/android/src/geojson/position.cpp b/platform/android/src/geojson/position.cpp deleted file mode 100644 index c0e6da3887..0000000000 --- a/platform/android/src/geojson/position.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "position.hpp" - -namespace mbgl { -namespace android { -namespace geojson { - -mapbox::geojson::point Position::convert(jni::JNIEnv &env, jni::Object jPosition) { - static auto method = Position::javaClass.GetMethod ()>(env, "getCoordinates"); - // Array with 0: longitude, 1: latitude (and optionally 2: altitude) - auto coordinates = jPosition.Call(env, method); - jdouble lngLat[2]; - coordinates.GetRegion(env, 0, lngLat); - mapbox::geojson::point point(lngLat[0], lngLat[1]); - jni::DeleteLocalRef(env, coordinates); - return point; -} - -void Position::registerNative(jni::JNIEnv &env) { - // Lookup the class - javaClass = *jni::Class::Find(env).NewGlobalRef(env).release(); -} - -jni::Class Position::javaClass; - -} // namespace geojson -} // namespace android -} // namespace mbgl \ No newline at end of file diff --git a/platform/android/src/geojson/position.hpp b/platform/android/src/geojson/position.hpp deleted file mode 100644 index 7017a8172a..0000000000 --- a/platform/android/src/geojson/position.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include -#include - -#include - -namespace mbgl { -namespace android { -namespace geojson { - -class Position : private mbgl::util::noncopyable { -public: - static constexpr auto Name() { return "com/mapbox/services/commons/models/Position"; }; - - static constexpr auto Type() { return "Position"; }; - - static mapbox::geojson::point convert(jni::JNIEnv&, jni::Object); - - static jni::Class javaClass; - - static void registerNative(jni::JNIEnv&); -}; - -} // namespace geojson -} // namespace android -} // namespace mbgl \ No newline at end of file diff --git a/platform/android/src/jni.cpp b/platform/android/src/jni.cpp index 88ad0edb9e..c2fd1c95ad 100755 --- a/platform/android/src/jni.cpp +++ b/platform/android/src/jni.cpp @@ -20,7 +20,6 @@ #include "geojson/multi_polygon.hpp" #include "geojson/point.hpp" #include "geojson/polygon.hpp" -#include "geojson/position.hpp" #include "geometry/lat_lng.hpp" #include "geometry/lat_lng_bounds.hpp" #include "geometry/lat_lng_quad.hpp" @@ -128,7 +127,6 @@ void registerNatives(JavaVM *vm) { geojson::MultiPolygon::registerNative(env); geojson::Point::registerNative(env); geojson::Polygon::registerNative(env); - geojson::Position::registerNative(env); // Geometry LatLng::registerNative(env); -- cgit v1.2.1 From 6afff00ed41e0a143b5eacc2a71a9bd70878da5c Mon Sep 17 00:00:00 2001 From: Pablo Guardiola Date: Fri, 9 Feb 2018 16:46:41 +0100 Subject: [android] remove unnecessary @jar and @aar dependencies suffixes (#11161) * [android] remove unnecessary @jar and @aar dependencies suffixes * [android] remove lint baseline file from mapbox gl android sdk module and fix lint errors --- platform/android/MapboxGLAndroidSDK/.gitignore | 2 - platform/android/MapboxGLAndroidSDK/build.gradle | 2 - .../MapboxGLAndroidSDK/lint-baseline-local.xml | 37 ------------------ .../MapboxGLAndroidSDK/lint/lint-baseline-ci.xml | 44 ---------------------- .../mapbox/mapboxsdk/maps/widgets/CompassView.java | 4 +- .../src/main/res/values-he/strings.xml | 16 -------- .../src/main/res/values-iw/strings.xml | 16 ++++++++ platform/android/gradle/dependencies.gradle | 8 ++-- 8 files changed, 22 insertions(+), 107 deletions(-) delete mode 100644 platform/android/MapboxGLAndroidSDK/.gitignore delete mode 100644 platform/android/MapboxGLAndroidSDK/lint-baseline-local.xml delete mode 100644 platform/android/MapboxGLAndroidSDK/lint/lint-baseline-ci.xml delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/res/values-he/strings.xml create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/res/values-iw/strings.xml diff --git a/platform/android/MapboxGLAndroidSDK/.gitignore b/platform/android/MapboxGLAndroidSDK/.gitignore deleted file mode 100644 index cec211fe81..0000000000 --- a/platform/android/MapboxGLAndroidSDK/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -lint-baseline.xml -lint/lint-baseline-local.xml \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/build.gradle b/platform/android/MapboxGLAndroidSDK/build.gradle index 0900f700c8..12c7cc1e58 100644 --- a/platform/android/MapboxGLAndroidSDK/build.gradle +++ b/platform/android/MapboxGLAndroidSDK/build.gradle @@ -114,7 +114,6 @@ android { lintOptions { disable 'MissingTranslation', 'TypographyQuotes', 'ObsoleteLintCustomCheck', 'MissingPermission' - baseline file("lint-baseline-local.xml") checkAllWarnings true warningsAsErrors false } @@ -148,4 +147,3 @@ apply from: "${rootDir}/gradle/gradle-javadoc.gradle" apply from: "${rootDir}/gradle/gradle-publish.gradle" apply from: "${rootDir}/gradle/gradle-checkstyle.gradle" apply from: "${rootDir}/gradle/gradle-tests-staticblockremover.gradle" -apply from: "${rootDir}/gradle/gradle-lint.gradle" diff --git a/platform/android/MapboxGLAndroidSDK/lint-baseline-local.xml b/platform/android/MapboxGLAndroidSDK/lint-baseline-local.xml deleted file mode 100644 index 0a76f53505..0000000000 --- a/platform/android/MapboxGLAndroidSDK/lint-baseline-local.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/platform/android/MapboxGLAndroidSDK/lint/lint-baseline-ci.xml b/platform/android/MapboxGLAndroidSDK/lint/lint-baseline-ci.xml deleted file mode 100644 index fd65c9f627..0000000000 --- a/platform/android/MapboxGLAndroidSDK/lint/lint-baseline-ci.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java index 1e604c9bef..45f72af1c5 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java @@ -6,10 +6,10 @@ import android.support.annotation.NonNull; import android.support.v4.view.ViewCompat; import android.support.v4.view.ViewPropertyAnimatorCompat; import android.support.v4.view.ViewPropertyAnimatorListenerAdapter; +import android.support.v7.widget.AppCompatImageView; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; -import android.widget.ImageView; import com.mapbox.mapboxsdk.maps.MapboxMap; @@ -22,7 +22,7 @@ import com.mapbox.mapboxsdk.maps.MapboxMap; * use {@link com.mapbox.mapboxsdk.maps.UiSettings}. *

*/ -public final class CompassView extends ImageView implements Runnable { +public final class CompassView extends AppCompatImageView implements Runnable { public static final long TIME_WAIT_IDLE = 500; public static final long TIME_MAP_NORTH_ANIMATION = 150; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-he/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-he/strings.xml deleted file mode 100644 index 11b20f5dc5..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values-he/strings.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - מצפן. הפעל בכדי לקבע את כיוון המפה צפונה. - סמל שיוך. הפעל כדי להציג תיבת דו-שיח של שיוך. - סמן מיקום. מציג את המיקום הנוכחי שלך על המפה. - מציג מפה שנוצרה עם Mapbox. גלול באמצעות גרירה עם שתי אצבעות, זום באמצעות צביטה עם שתי אצבעות. - Mapbox Maps SDK for Android - שפר את המפות של Mapbox  - אתם מסייעים לשפר את המפות של OpenStreetMap ו Mapbox באמצעות שיתוף אנונימי של נתוני השימוש. - מסכים/מה - לא מסכים/מה - מידע נוסף - לא מותקן דפדפן אינטרנט במכשיר, לא ניתן לפתוח את דף האינטרנט. - בתנאי ש- OfflineRegionDefinition אינו מתאים לגבולות העולם: %s - הגדרות טלמטריות - diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-iw/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-iw/strings.xml new file mode 100644 index 0000000000..11b20f5dc5 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values-iw/strings.xml @@ -0,0 +1,16 @@ + + + מצפן. הפעל בכדי לקבע את כיוון המפה צפונה. + סמל שיוך. הפעל כדי להציג תיבת דו-שיח של שיוך. + סמן מיקום. מציג את המיקום הנוכחי שלך על המפה. + מציג מפה שנוצרה עם Mapbox. גלול באמצעות גרירה עם שתי אצבעות, זום באמצעות צביטה עם שתי אצבעות. + Mapbox Maps SDK for Android + שפר את המפות של Mapbox  + אתם מסייעים לשפר את המפות של OpenStreetMap ו Mapbox באמצעות שיתוף אנונימי של נתוני השימוש. + מסכים/מה + לא מסכים/מה + מידע נוסף + לא מותקן דפדפן אינטרנט במכשיר, לא ניתן לפתוח את דף האינטרנט. + בתנאי ש- OfflineRegionDefinition אינו מתאים לגבולות העולם: %s + הגדרות טלמטריות + diff --git a/platform/android/gradle/dependencies.gradle b/platform/android/gradle/dependencies.gradle index 7ce0cd6196..99fa3f3508 100644 --- a/platform/android/gradle/dependencies.gradle +++ b/platform/android/gradle/dependencies.gradle @@ -23,12 +23,12 @@ ext { ] dependenciesList = [ - mapboxJavaServices : "com.mapbox.mapboxsdk:mapbox-sdk-services:${versions.mapboxServices}@jar", - mapboxJavaGeoJSON : "com.mapbox.mapboxsdk:mapbox-sdk-geojson:${versions.mapboxServices}@jar", - mapboxAndroidTelemetry: "com.mapbox.mapboxsdk:mapbox-android-telemetry:${versions.mapboxTelemetry}@aar", + mapboxJavaServices : "com.mapbox.mapboxsdk:mapbox-sdk-services:${versions.mapboxServices}", + mapboxJavaGeoJSON : "com.mapbox.mapboxsdk:mapbox-sdk-geojson:${versions.mapboxServices}", + mapboxAndroidTelemetry: "com.mapbox.mapboxsdk:mapbox-android-telemetry:${versions.mapboxTelemetry}", // for testApp - mapboxJavaTurf : "com.mapbox.mapboxsdk:mapbox-sdk-turf:${versions.mapboxServices}@jar", + mapboxJavaTurf : "com.mapbox.mapboxsdk:mapbox-sdk-turf:${versions.mapboxServices}", junit : "junit:junit:${versions.junit}", mockito : "org.mockito:mockito-core:${versions.mockito}", -- cgit v1.2.1 From f581adde168ad20c124dcd6db8194dee9f0afff9 Mon Sep 17 00:00:00 2001 From: tobrun Date: Thu, 8 Feb 2018 13:37:37 +0100 Subject: [android] - don't recreate surface as part of view resize --- .../maps/renderer/textureview/TextureViewRenderThread.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java index c34833e9ce..1e76ffe3fb 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java @@ -4,7 +4,6 @@ import android.graphics.SurfaceTexture; import android.support.annotation.NonNull; import android.support.annotation.UiThread; import android.view.TextureView; - import com.mapbox.mapboxsdk.maps.renderer.egl.EGLConfigChooser; import java.lang.ref.WeakReference; @@ -219,13 +218,6 @@ class TextureViewRenderThread extends Thread implements TextureView.SurfaceTextu break; } - // Check if the size has changed - if (sizeChanged) { - recreateSurface = true; - sizeChanged = false; - break; - } - // Reset the request render flag now, so we can catch new requests // while rendering requestRender = false; @@ -273,6 +265,12 @@ class TextureViewRenderThread extends Thread implements TextureView.SurfaceTextu continue; } + if (sizeChanged) { + mapRenderer.onSurfaceChanged(gl, w, h); + sizeChanged = false; + continue; + } + // Don't continue without a surface if (eglHolder.eglSurface == EGL10.EGL_NO_SURFACE) { continue; -- cgit v1.2.1 From ff8d1e4b50e59421bc187874cef213933ad5b311 Mon Sep 17 00:00:00 2001 From: tobrun Date: Tue, 6 Feb 2018 13:41:16 +0100 Subject: [android] - programmatically create GlSurfaceView --- .../src/main/java/com/mapbox/mapboxsdk/maps/MapView.java | 4 ++-- .../src/main/res/layout/mapbox_mapview_internal.xml | 7 ------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java index 2e7d4c4270..401d4716fd 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java @@ -304,7 +304,7 @@ public class MapView extends FrameLayout { addView(textureView, 0); } else { - GLSurfaceView glSurfaceView = (GLSurfaceView) findViewById(R.id.surfaceView); + GLSurfaceView glSurfaceView = new GLSurfaceView(getContext()); glSurfaceView.setZOrderMediaOverlay(mapboxMapOptions.getRenderSurfaceOnTop()); mapRenderer = new GLSurfaceViewMapRenderer(getContext(), glSurfaceView, options.getLocalIdeographFontFamily()) { @Override @@ -314,7 +314,7 @@ public class MapView extends FrameLayout { } }; - glSurfaceView.setVisibility(View.VISIBLE); + addView(glSurfaceView, 0); } nativeMapView = new NativeMapView(this, mapRenderer); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_internal.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_internal.xml index df7ccaaca9..29ff49f47e 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_internal.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_internal.xml @@ -1,13 +1,6 @@ - - Date: Tue, 6 Feb 2018 14:42:25 +0100 Subject: [android] - add optional location provider lost to proguard configuration --- platform/android/MapboxGLAndroidSDK/proguard-rules.pro | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/platform/android/MapboxGLAndroidSDK/proguard-rules.pro b/platform/android/MapboxGLAndroidSDK/proguard-rules.pro index b5a1d82c81..3b8adac5a8 100644 --- a/platform/android/MapboxGLAndroidSDK/proguard-rules.pro +++ b/platform/android/MapboxGLAndroidSDK/proguard-rules.pro @@ -12,4 +12,7 @@ # config for okhttp 3.8.0, https://github.com/square/okhttp/pull/3354 -dontwarn okio.** -dontwarn javax.annotation.Nullable --dontwarn javax.annotation.ParametersAreNonnullByDefault \ No newline at end of file +-dontwarn javax.annotation.ParametersAreNonnullByDefault + +# config for optional location provider https://github.com/mapbox/mapbox-gl-native/issues/10960 +-dontwarn com.mapzen.android.lost.api** \ No newline at end of file -- cgit v1.2.1 From 0eb62576cecbb5ee6b22d64ae263ceb63dcfca1d Mon Sep 17 00:00:00 2001 From: tobrun Date: Tue, 6 Feb 2018 14:57:45 +0100 Subject: [android] - introduce mapview weak reference in global layout listener --- .../java/com/mapbox/mapboxsdk/maps/MapView.java | 46 ++++++++++++++-------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java index 401d4716fd..ccc48ce782 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java @@ -22,7 +22,6 @@ import android.view.ViewTreeObserver; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.ZoomButtonsController; - import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.annotations.Annotation; import com.mapbox.mapboxsdk.annotations.MarkerViewManager; @@ -37,19 +36,18 @@ import com.mapbox.mapboxsdk.maps.widgets.MyLocationViewSettings; import com.mapbox.mapboxsdk.net.ConnectivityReceiver; import com.mapbox.mapboxsdk.storage.FileSource; import com.mapbox.services.android.telemetry.MapboxTelemetry; +import timber.log.Timber; +import javax.microedition.khronos.egl.EGLConfig; +import javax.microedition.khronos.opengles.GL10; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; -import javax.microedition.khronos.egl.EGLConfig; -import javax.microedition.khronos.opengles.GL10; - -import timber.log.Timber; - import static com.mapbox.mapboxsdk.maps.widgets.CompassView.TIME_MAP_NORTH_ANIMATION; import static com.mapbox.mapboxsdk.maps.widgets.CompassView.TIME_WAIT_IDLE; @@ -133,17 +131,7 @@ public class MapView extends FrameLayout { setContentDescription(context.getString(R.string.mapbox_mapActionDescription)); setWillNotDraw(false); - getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { - @Override - public void onGlobalLayout() { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { - getViewTreeObserver().removeOnGlobalLayoutListener(this); - } else { - getViewTreeObserver().removeGlobalOnLayoutListener(this); - } - initialiseDrawingSurface(options); - } - }); + getViewTreeObserver().addOnGlobalLayoutListener(new MapViewLayoutListener(this, options)); } private void initialiseMap() { @@ -879,6 +867,30 @@ public class MapView extends FrameLayout { void onMapChanged(@MapChange int change); } + private static class MapViewLayoutListener implements ViewTreeObserver.OnGlobalLayoutListener { + + private WeakReference mapViewWeakReference; + private MapboxMapOptions options; + + MapViewLayoutListener(MapView mapView, MapboxMapOptions options) { + this.mapViewWeakReference = new WeakReference<>(mapView); + this.options = options; + } + + @Override + public void onGlobalLayout() { + MapView mapView = mapViewWeakReference.get(); + if (mapView != null) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + mapView.getViewTreeObserver().removeOnGlobalLayoutListener(this); + } else { + mapView.getViewTreeObserver().removeGlobalOnLayoutListener(this); + } + mapView.initialiseDrawingSurface(options); + } + } + } + private class FocalPointInvalidator implements FocalPointChangeListener { private final List focalPointChangeListeners = new ArrayList<>(); -- cgit v1.2.1 From 22cbca41e58b135377734b4434efa5e6439a68fd Mon Sep 17 00:00:00 2001 From: Tobrun Date: Fri, 2 Feb 2018 10:30:05 +0100 Subject: [android] - don't invoke onLowMemory on map when the map isn't fully created yet --- .../src/main/java/com/mapbox/mapboxsdk/maps/MapView.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java index ccc48ce782..9f591ddcab 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java @@ -474,7 +474,9 @@ public class MapView extends FrameLayout { */ @UiThread public void onLowMemory() { - nativeMapView.onLowMemory(); + if (nativeMapView != null) { + nativeMapView.onLowMemory(); + } } /** -- cgit v1.2.1 From f3b32599061402316b0d1ab698301a8941c51ff5 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Fri, 9 Feb 2018 14:48:14 +0100 Subject: [android] - update changelog for 5.4.1 --- platform/android/CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/platform/android/CHANGELOG.md b/platform/android/CHANGELOG.md index 88ce0cf697..2721d0caff 100644 --- a/platform/android/CHANGELOG.md +++ b/platform/android/CHANGELOG.md @@ -2,6 +2,13 @@ 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.4.1 - February 9, 2018 + - Don't recreate TextureView surface as part of view resizing, solves OOM crashes [#11148](https://github.com/mapbox/mapbox-gl-native/pull/11148) + - Don't invoke OnLowMemory before map is ready, solves startup crash on low memory devices [#11109](https://github.com/mapbox/mapbox-gl-native/pull/11109) + - Programmatically create GLSurfaceView, solves fragment bug [#11124](https://github.com/mapbox/mapbox-gl-native/pull/11124) + - Proguard config for optional location provider, solves obfuscation warnings [#11127](https://github.com/mapbox/mapbox-gl-native/pull/11127) + - MapView weak reference in global layout listener, solves memory leak [#11128](https://github.com/mapbox/mapbox-gl-native/pull/11128) + ## 5.4.0 - January 30, 2018 - Blacklist Adreno 2xx GPU for VAO support [#11047](https://github.com/mapbox/mapbox-gl-native/pull/11047) - Bearing tracking mode GPS_NORTH_FACING [#11095](https://github.com/mapbox/mapbox-gl-native/pull/11095) -- cgit v1.2.1 From 0b27909b8b9959a14f9075d3b61c33c93ddd8c31 Mon Sep 17 00:00:00 2001 From: Benjamin Jaeger Date: Tue, 23 Jan 2018 15:33:29 -0500 Subject: NativeMapView.addImage without copying into Java --- .../main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java | 14 ++------------ platform/android/src/native_map_view.cpp | 13 +++---------- platform/android/src/native_map_view.hpp | 2 +- 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java index 785b045779..c1e9053dfc 100755 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java @@ -758,20 +758,11 @@ final class NativeMapView { return; } - // Check/correct config - if (image.getConfig() != Bitmap.Config.ARGB_8888) { - image = image.copy(Bitmap.Config.ARGB_8888, false); - } - - // Get pixels - ByteBuffer buffer = ByteBuffer.allocate(image.getByteCount()); - image.copyPixelsToBuffer(buffer); - // Determine pixel ratio float density = image.getDensity() == Bitmap.DENSITY_NONE ? Bitmap.DENSITY_NONE : image.getDensity(); float pixelRatio = density / DisplayMetrics.DENSITY_DEFAULT; - nativeAddImage(name, image.getWidth(), image.getHeight(), pixelRatio, buffer.array()); + nativeAddImage(name, image, pixelRatio); } public void addImages(@NonNull HashMap bitmapHashMap) { @@ -1032,8 +1023,7 @@ final class NativeMapView { private native void nativeRemoveSource(Source source, long sourcePtr); - private native void nativeAddImage(String name, int width, int height, float pixelRatio, - byte[] array); + private native void nativeAddImage(String name, Bitmap bitmap, float pixelRatio); private native void nativeAddImages(Image[] images); diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp index 36a73fee35..eefb578f39 100755 --- a/platform/android/src/native_map_view.cpp +++ b/platform/android/src/native_map_view.cpp @@ -893,16 +893,9 @@ void NativeMapView::removeSource(JNIEnv& env, jni::Object obj, jlong sou source->removeFromMap(env, obj, *map); } -void NativeMapView::addImage(JNIEnv& env, jni::String name, jni::jint w, jni::jint h, jni::jfloat scale, jni::Array pixels) { - jni::NullCheck(env, &pixels); - std::size_t size = pixels.Length(env); - - mbgl::PremultipliedImage premultipliedImage({ static_cast(w), static_cast(h) }); - if (premultipliedImage.bytes() != uint32_t(size)) { - throw mbgl::util::SpriteImageException("Sprite image pixel count mismatch"); - } - - jni::GetArrayRegion(env, *pixels, 0, size, reinterpret_cast(premultipliedImage.data.get())); +void NativeMapView::addImage(JNIEnv& env, jni::String name, jni::Object bitmap, jni::jfloat scale) { + jni::NullCheck(env, &bitmap); + mbgl::PremultipliedImage premultipliedImage = Bitmap::GetImage(env, bitmap); map->getStyle().addImage(std::make_unique( jni::Make(env, name), diff --git a/platform/android/src/native_map_view.hpp b/platform/android/src/native_map_view.hpp index 507d77ac5f..9ed333d2d5 100755 --- a/platform/android/src/native_map_view.hpp +++ b/platform/android/src/native_map_view.hpp @@ -236,7 +236,7 @@ public: void removeSource(JNIEnv&, jni::Object, jlong nativePtr); - void addImage(JNIEnv&, jni::String, jni::jint, jni::jint, jni::jfloat, jni::Array); + void addImage(JNIEnv&, jni::String, jni::Object bitmap, jni::jfloat); void addImages(JNIEnv&, jni::Array>); -- cgit v1.2.1 From ff747a8c53805a270451cd6052d02073e45546a7 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Fri, 2 Feb 2018 11:16:01 +0100 Subject: [android] - add conversion of non ARGB_8888 images to c++, expose Bitmap#copy on the c++ side --- .../src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java | 5 +---- platform/android/src/bitmap.cpp | 10 ++++++++-- platform/android/src/bitmap.hpp | 1 + 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java index c1e9053dfc..06802180f5 100755 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java @@ -759,10 +759,7 @@ final class NativeMapView { } // Determine pixel ratio - float density = image.getDensity() == Bitmap.DENSITY_NONE ? Bitmap.DENSITY_NONE : image.getDensity(); - float pixelRatio = density / DisplayMetrics.DENSITY_DEFAULT; - - nativeAddImage(name, image, pixelRatio); + nativeAddImage(name, image, image.getDensity() / DisplayMetrics.DENSITY_DEFAULT); } public void addImages(@NonNull HashMap bitmapHashMap) { diff --git a/platform/android/src/bitmap.cpp b/platform/android/src/bitmap.cpp index 50088116f4..46e7253050 100644 --- a/platform/android/src/bitmap.cpp +++ b/platform/android/src/bitmap.cpp @@ -110,8 +110,7 @@ PremultipliedImage Bitmap::GetImage(jni::JNIEnv& env, jni::Object bitmap } if (info.format != ANDROID_BITMAP_FORMAT_RGBA_8888) { - // TODO: convert - throw std::runtime_error("bitmap decoding: bitmap format invalid"); + bitmap = Bitmap::Copy(env, bitmap); } const PixelGuard guard(env, bitmap); @@ -128,5 +127,12 @@ PremultipliedImage Bitmap::GetImage(jni::JNIEnv& env, jni::Object bitmap return { Size{ info.width, info.height }, std::move(pixels) }; } +jni::Object Bitmap::Copy(jni::JNIEnv& env, jni::Object bitmap) { + using Signature = jni::Object(jni::Object, jni::jboolean); + auto static method = _class.GetMethod(env, "copy"); + auto config = Bitmap::Config::Create(env, Bitmap::Config::Value::ARGB_8888); + return bitmap.Call(env, method, config, (jni::jboolean) false); +} + } // namespace android } // namespace mbgl diff --git a/platform/android/src/bitmap.hpp b/platform/android/src/bitmap.hpp index f64f42ae87..c4e41db1e0 100644 --- a/platform/android/src/bitmap.hpp +++ b/platform/android/src/bitmap.hpp @@ -43,6 +43,7 @@ public: static PremultipliedImage GetImage(jni::JNIEnv&, jni::Object); static jni::Object CreateBitmap(jni::JNIEnv&, const PremultipliedImage&); + static jni::Object Copy(jni::JNIEnv&, jni::Object); private: static jni::Class _class; -- cgit v1.2.1 From b8240f725cbfdb4b5369b050c933acdd4e42b705 Mon Sep 17 00:00:00 2001 From: Pablo Guardiola Date: Tue, 13 Feb 2018 12:23:17 +0100 Subject: [android] Integration of the new events library (#10999) (#11183) * [android] integration of the new events library * JNI Bug - current build with JNI bug * fix #10999 comments * Clean-up - clean-up timbers and test code * [android] fix sdk identifier and sdk version * [android] merge from master (MAS 3.0) * [android] bump events lib version to 3.0.0-beta.1 and remove never used methods from math utils class --- platform/android/MapboxGLAndroidSDK/build.gradle | 2 + .../com/mapbox/mapboxsdk/EmptyLocationSource.java | 107 ----------- .../src/main/java/com/mapbox/mapboxsdk/Mapbox.java | 31 +--- .../mapbox/mapboxsdk/camera/CameraPosition.java | 2 +- .../mapbox/mapboxsdk/location/LocationSource.java | 199 --------------------- .../mapbox/mapboxsdk/location/package-info.java | 4 - .../mapboxsdk/maps/AttributionDialogManager.java | 5 +- .../java/com/mapbox/mapboxsdk/maps/Events.java | 36 ++++ .../mapbox/mapboxsdk/maps/MapGestureDetector.java | 111 +++++++----- .../java/com/mapbox/mapboxsdk/maps/MapView.java | 22 ++- .../mapbox/mapboxsdk/maps/MapboxEventWrapper.java | 57 ------ .../java/com/mapbox/mapboxsdk/maps/MapboxMap.java | 2 +- .../mapbox/mapboxsdk/maps/TrackingSettings.java | 6 +- .../mapboxsdk/maps/widgets/MyLocationView.java | 6 +- .../mapboxsdk/style/sources/GeoJsonOptions.java | 2 +- .../java/com/mapbox/mapboxsdk/utils/MathUtils.java | 49 +++++ .../test/java/com/mapbox/mapboxsdk/MapboxTest.java | 2 +- .../android/MapboxGLAndroidSDKTestApp/build.gradle | 11 +- .../src/main/AndroidManifest.xml | 2 +- .../testapp/activity/FeatureOverviewActivity.java | 4 +- .../userlocation/BaseLocationActivity.java | 4 +- .../activity/userlocation/MockLocationEngine.java | 4 +- .../userlocation/MyLocationDrawableActivity.java | 2 +- .../userlocation/MyLocationTintActivity.java | 2 +- .../MyLocationTrackingModeActivity.java | 2 +- platform/android/build.gradle | 1 + platform/android/gradle/dependencies.gradle | 3 +- 27 files changed, 209 insertions(+), 469 deletions(-) delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/EmptyLocationSource.java delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationSource.java delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/package-info.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Events.java delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxEventWrapper.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/MathUtils.java diff --git a/platform/android/MapboxGLAndroidSDK/build.gradle b/platform/android/MapboxGLAndroidSDK/build.gradle index 12c7cc1e58..e2e0881857 100644 --- a/platform/android/MapboxGLAndroidSDK/build.gradle +++ b/platform/android/MapboxGLAndroidSDK/build.gradle @@ -25,6 +25,8 @@ android { minSdkVersion androidVersions.minSdkVersion targetSdkVersion androidVersions.targetSdkVersion buildConfigField "String", "GIT_REVISION_SHORT", String.format("\"%s\"", getGitRevision()) + buildConfigField "String", "MAPBOX_SDK_IDENTIFIER", String.format("\"%s\"", "mapbox-maps-android") + buildConfigField "String", "MAPBOX_SDK_VERSION", String.format("\"%s\"", project.VERSION_NAME) 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) } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/EmptyLocationSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/EmptyLocationSource.java deleted file mode 100644 index 8ea7e61eee..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/EmptyLocationSource.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.mapbox.mapboxsdk; - - -import android.location.Location; -import android.support.annotation.Nullable; - -import com.mapbox.mapboxsdk.location.LocationSource; -import com.mapbox.services.android.telemetry.location.LocationEngine; -import com.mapbox.services.android.telemetry.location.LocationEngineListener; - -class EmptyLocationSource extends LocationSource { - - /** - * Activate the location engine which will connect whichever location provider you are using. You'll need to call - * this before requesting user location updates using {@link LocationEngine#requestLocationUpdates()}. - */ - @Override - public void activate() { - // Intentionally left empty - } - - /** - * Disconnect the location engine which is useful when you no longer need location updates or requesting the users - * {@link LocationEngine#getLastLocation()}. Before deactivating, you'll need to stop request user location updates - * using {@link LocationEngine#removeLocationUpdates()}. - */ - @Override - public void deactivate() { - // Intentionally left empty - } - - /** - * Check if your location provider has been activated/connected. This is mainly used internally but is also useful in - * the rare case when you'd like to know if your location engine is connected or not. - * - * @return boolean true if the location engine has been activated/connected, else false. - */ - @Override - public boolean isConnected() { - return false; - } - - /** - * Returns the Last known location is the location provider is connected and location permissions are granted. - * - * @return the last known location - */ - @Override - @Nullable - public Location getLastLocation() { - return null; - } - - /** - * Request location updates to the location provider. - */ - @Override - public void requestLocationUpdates() { - // Intentionally left empty - } - - /** - * Dismiss ongoing location update to the location provider. - */ - @Override - public void removeLocationUpdates() { - // Intentionally left empty - } - - /** - * Invoked when the Location has changed. - * - * @param location the new location - */ - @Override - public void onLocationChanged(Location location) { - // Intentionally left empty - } - - /** - * Useful when you'd like to add a location listener to handle location connections and update events. It is important - * to note, that the callback will continue getting called even when your application isn't in the foreground. - * Therefore, it is a good idea to use {@link LocationEngine#removeLocationEngineListener(LocationEngineListener)} - * inside your activities {@code onStop()} method. - * - * @param listener A {@link LocationEngineListener} which you'd like to add to your location engine. - * @since 2.0.0 - */ - @Override - public void addLocationEngineListener(LocationEngineListener listener) { - // Intentionally left empty - } - - /** - * If you no longer need your {@link LocationEngineListener} to be invoked with every location update, use this - * method to remove it. It's also important to remove your listeners before the activity is destroyed to prevent any - * potential memory leaks. - * - * @param listener the {@link LocationEngineListener} you'd like to remove from this {@link LocationEngine}. - * @return true. - * @since 2.0.0 - */ - @Override - public boolean removeLocationEngineListener(LocationEngineListener listener) { - return true; - } -} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java index b67b6e96f2..853ea1c11b 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java @@ -8,16 +8,12 @@ import android.support.annotation.NonNull; import android.support.annotation.UiThread; import android.text.TextUtils; +import com.mapbox.android.core.location.LocationEngine; +import com.mapbox.android.core.location.LocationEnginePriority; +import com.mapbox.android.core.location.LocationEngineProvider; import com.mapbox.mapboxsdk.constants.MapboxConstants; import com.mapbox.mapboxsdk.exceptions.MapboxConfigurationException; -import com.mapbox.mapboxsdk.location.LocationSource; import com.mapbox.mapboxsdk.net.ConnectivityReceiver; -import com.mapbox.services.android.telemetry.MapboxTelemetry; -import com.mapbox.services.android.telemetry.location.LocationEngine; -import com.mapbox.services.android.telemetry.location.LocationEnginePriority; -import com.mapbox.services.android.telemetry.location.LocationEngineProvider; - -import timber.log.Timber; /** * The entry point to initialize the Mapbox Android SDK. @@ -56,15 +52,9 @@ public final class Mapbox { INSTANCE = new Mapbox(appContext, accessToken, locationEngine); locationEngine.setPriority(LocationEnginePriority.NO_POWER); - try { - MapboxTelemetry.getInstance().initialize( - appContext, accessToken, BuildConfig.MAPBOX_EVENTS_USER_AGENT, locationEngine); - } catch (Exception exception) { - Timber.e(exception, "Unable to instantiate Mapbox telemetry"); - } - ConnectivityReceiver.instance(appContext); } + return INSTANCE; } @@ -145,23 +135,12 @@ public final class Mapbox { return (activeNetwork != null && activeNetwork.isConnected()); } - /** - * Returns a location source instance with empty methods. - * - * @return an empty location source implementation - * @deprecated Replaced by {@link Mapbox#getLocationEngine()} - */ - @Deprecated - public static LocationSource getLocationSource() { - return new EmptyLocationSource(); - } - - /** * Returns the location engine used by the SDK. * * @return the location engine configured */ + // TODO Do we need to expose this? public static LocationEngine getLocationEngine() { return INSTANCE.locationEngine; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java index c2f19072db..e732b2525f 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java @@ -8,7 +8,7 @@ import android.support.annotation.FloatRange; import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.constants.MapboxConstants; import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.services.android.telemetry.utils.MathUtils; +import com.mapbox.mapboxsdk.utils.MathUtils; /** * Resembles the position, angle, zoom and tilt of the user's viewpoint. diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationSource.java deleted file mode 100644 index 1313587158..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationSource.java +++ /dev/null @@ -1,199 +0,0 @@ -package com.mapbox.mapboxsdk.location; - -import android.content.Context; -import android.location.Location; -import android.support.annotation.Nullable; - -import com.mapbox.mapboxsdk.Mapbox; -import com.mapbox.services.android.telemetry.location.LocationEngine; -import com.mapbox.services.android.telemetry.location.LocationEngineListener; -import com.mapbox.services.android.telemetry.location.LocationEnginePriority; -import com.mapzen.android.lost.api.LocationListener; -import com.mapzen.android.lost.api.LocationRequest; -import com.mapzen.android.lost.api.LocationServices; -import com.mapzen.android.lost.api.LostApiClient; - -/** - * LocationEngine using the Open Source Lost library - * Manages locational updates. Contains methods to register and unregister location listeners. - *
    - *
  • You can register a LocationEngineListener with LocationSource#addLocationEngineListener(LocationEngineListener) - * to receive location updates.
  • - *
  • You can unregister a LocationEngineListener with - * LocationEngine#removeLocationEngineListener(LocationEngineListener)} to stop receiving location updates.
  • - *
- *

- * Note: If registering a listener in your Activity.onStart() implementation, you should unregister it in - * Activity.onStop(). (You won't receive location updates when paused, and this will cut down on unnecessary system - * overhead). Do not unregister in Activity.onSaveInstanceState(), because this won't be called if the user moves back - * in the history stack. - *

- * - * @deprecated Use a {@link Mapbox#getLocationEngine()} instead. - */ -@Deprecated -public class LocationSource extends LocationEngine implements LostApiClient.ConnectionCallbacks, LocationListener { - - private Context context; - private LostApiClient lostApiClient; - - /** - * Constructs a location source instance. - * - * @param context the context from which the Application context will be derived. - */ - public LocationSource(Context context) { - super(); - this.context = context.getApplicationContext(); - lostApiClient = new LostApiClient.Builder(this.context) - .addConnectionCallbacks(this) - .build(); - } - - /** - * Constructs a location source instance. - * Needed to create empty location source implementations. - */ - public LocationSource() { - } - - /** - * Activate the location engine which will connect whichever location provider you are using. You'll need to call - * this before requesting user location updates using {@link LocationEngine#requestLocationUpdates()}. - */ - @Override - public void activate() { - connect(); - } - - /** - * Disconnect the location engine which is useful when you no longer need location updates or requesting the users - * {@link LocationEngine#getLastLocation()}. Before deactivating, you'll need to stop request user location updates - * using {@link LocationEngine#removeLocationUpdates()}. - */ - @Override - public void deactivate() { - if (lostApiClient != null && lostApiClient.isConnected()) { - lostApiClient.disconnect(); - } - } - - /** - * Check if your location provider has been activated/connected. This is mainly used internally but is also useful in - * the rare case when you'd like to know if your location engine is connected or not. - * - * @return boolean true if the location engine has been activated/connected, else false. - */ - @Override - public boolean isConnected() { - return lostApiClient.isConnected(); - } - - /** - * Invoked when the location provider has connected. - */ - @Override - public void onConnected() { - for (LocationEngineListener listener : locationListeners) { - listener.onConnected(); - } - } - - /** - * Invoked when the location provider connection has been suspended. - */ - @Override - public void onConnectionSuspended() { - // Empty - } - - /** - * Returns the Last known location is the location provider is connected and location permissions are granted. - * - * @return the last known location - */ - @Override - @Nullable - public Location getLastLocation() { - if (lostApiClient.isConnected()) { - //noinspection MissingPermission - return LocationServices.FusedLocationApi.getLastLocation(lostApiClient); - } - return null; - } - - /** - * Request location updates to the location provider. - */ - @Override - public void requestLocationUpdates() { - LocationRequest request = LocationRequest.create(); - - if (interval != null) { - request.setInterval(interval); - } - if (fastestInterval != null) { - request.setFastestInterval(fastestInterval); - } - if (smallestDisplacement != null) { - request.setSmallestDisplacement(smallestDisplacement); - } - - if (priority == LocationEnginePriority.NO_POWER) { - request.setPriority(LocationRequest.PRIORITY_NO_POWER); - } else if (priority == LocationEnginePriority.LOW_POWER) { - request.setPriority(LocationRequest.PRIORITY_LOW_POWER); - } else if (priority == LocationEnginePriority.BALANCED_POWER_ACCURACY) { - request.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY); - } else if (priority == LocationEnginePriority.HIGH_ACCURACY) { - request.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); - } - - if (lostApiClient.isConnected()) { - //noinspection MissingPermission - LocationServices.FusedLocationApi.requestLocationUpdates(lostApiClient, request, this); - } - } - - /** - * Dismiss ongoing location update to the location provider. - */ - @Override - public void removeLocationUpdates() { - if (lostApiClient.isConnected()) { - LocationServices.FusedLocationApi.removeLocationUpdates(lostApiClient, this); - } - } - - /** - * Returns the location engine type. - * - * @return Lost type - */ - @Override - public Type obtainType() { - return Type.LOST; - } - - /** - * Invoked when the Location has changed. - * - * @param location the new location - */ - @Override - public void onLocationChanged(Location location) { - for (LocationEngineListener listener : locationListeners) { - listener.onLocationChanged(location); - } - } - - private void connect() { - if (lostApiClient != null) { - if (lostApiClient.isConnected()) { - onConnected(); - } else { - lostApiClient.connect(); - } - } - } -} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/package-info.java deleted file mode 100644 index b27559e95e..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Contains the Mapbox Maps Android Location API classes. - */ -package com.mapbox.mapboxsdk.location; \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java index b12757c81e..2bcbd5ce40 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java @@ -16,7 +16,6 @@ import com.mapbox.mapboxsdk.attribution.Attribution; import com.mapbox.mapboxsdk.attribution.AttributionParser; import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.style.sources.Source; -import com.mapbox.services.android.telemetry.MapboxTelemetry; import java.util.ArrayList; import java.util.List; @@ -88,7 +87,7 @@ public class AttributionDialogManager implements View.OnClickListener, DialogInt builder.setPositiveButton(R.string.mapbox_attributionTelemetryPositive, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - MapboxTelemetry.getInstance().setTelemetryEnabled(true); + Events.obtainTelemetry().enable(); dialog.cancel(); } }); @@ -102,7 +101,7 @@ public class AttributionDialogManager implements View.OnClickListener, DialogInt builder.setNegativeButton(R.string.mapbox_attributionTelemetryNegative, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - MapboxTelemetry.getInstance().setTelemetryEnabled(false); + Events.obtainTelemetry().disable(); dialog.cancel(); } }); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Events.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Events.java new file mode 100644 index 0000000000..a68d4763ac --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Events.java @@ -0,0 +1,36 @@ +package com.mapbox.mapboxsdk.maps; + + +import com.mapbox.android.telemetry.MapboxTelemetry; +import com.mapbox.android.telemetry.TelemetryEnabler; +import com.mapbox.mapboxsdk.BuildConfig; +import com.mapbox.mapboxsdk.Mapbox; + +class Events { + static final String TWO_FINGER_TAP = "TwoFingerTap"; + static final String DOUBLE_TAP = "DoubleTap"; + static final String SINGLE_TAP = "SingleTap"; + static final String PAN = "Pan"; + static final String PINCH = "Pinch"; + static final String ROTATION = "Rotation"; + static final String PITCH = "Pitch"; + private MapboxTelemetry telemetry; + + private Events() { + telemetry = new MapboxTelemetry(Mapbox.getApplicationContext(), Mapbox.getAccessToken(), + BuildConfig.MAPBOX_EVENTS_USER_AGENT); + TelemetryEnabler.State telemetryState = TelemetryEnabler.retrieveTelemetryStateFromPreferences(); + if (TelemetryEnabler.State.NOT_INITIALIZED.equals(telemetryState) + || TelemetryEnabler.State.ENABLED.equals(telemetryState)) { + telemetry.enable(); + } + } + + private static class EventsHolder { + private static final Events INSTANCE = new Events(); + } + + static MapboxTelemetry obtainTelemetry() { + return EventsHolder.INSTANCE.telemetry; + } +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java index 1788cb4428..8047e19809 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java @@ -5,7 +5,6 @@ import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.PointF; -import android.location.Location; import android.support.annotation.Nullable; import android.support.v4.view.GestureDetectorCompat; import android.support.v4.view.ScaleGestureDetectorCompat; @@ -19,12 +18,12 @@ import android.view.ViewConfiguration; import com.almeros.android.multitouch.gesturedetectors.RotateGestureDetector; import com.almeros.android.multitouch.gesturedetectors.ShoveGestureDetector; import com.almeros.android.multitouch.gesturedetectors.TwoFingerGestureDetector; +import com.mapbox.android.telemetry.Event; +import com.mapbox.android.telemetry.MapEventFactory; +import com.mapbox.android.telemetry.MapState; import com.mapbox.mapboxsdk.constants.MapboxConstants; import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.services.android.telemetry.MapboxEvent; -import com.mapbox.services.android.telemetry.MapboxTelemetry; -import com.mapbox.services.android.telemetry.utils.MathUtils; -import com.mapbox.services.android.telemetry.utils.TelemetryUtils; +import com.mapbox.mapboxsdk.utils.MathUtils; import java.util.concurrent.CopyOnWriteArrayList; @@ -144,19 +143,6 @@ final class MapGestureDetector { return focalPoint; } - /** - * Given coordinates from a gesture, use the current projection to translate it into - * a Location object. - * - * @param x coordinate - * @param y coordinate - * @return location - */ - private Location getLocationFromGesture(float x, float y) { - LatLng latLng = projection.fromScreenLocation(new PointF(x, y)); - return TelemetryUtils.buildLocation(latLng.getLongitude(), latLng.getLatitude()); - } - /** * Called when user touches the screen, all positions are absolute. *

@@ -202,9 +188,13 @@ final class MapGestureDetector { && uiSettings.isZoomGesturesEnabled(); if (twoTap) { // Confirmed 2nd Finger Down - MapboxTelemetry.getInstance().pushEvent(MapboxEventWrapper.buildMapClickEvent( - getLocationFromGesture(event.getX(), event.getY()), - MapboxEvent.GESTURE_TWO_FINGER_SINGLETAP, transform)); + if (isZoomValid(transform)) { + MapEventFactory mapEventFactory = new MapEventFactory(); + LatLng latLng = projection.fromScreenLocation(new PointF(event.getX(), event.getY())); + MapState twoFingerTap = new MapState(latLng.getLatitude(), latLng.getLongitude(), transform.getZoom()); + twoFingerTap.setGesture(Events.TWO_FINGER_TAP); + Events.obtainTelemetry().push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_CLICK, twoFingerTap)); + } } break; @@ -233,8 +223,12 @@ final class MapGestureDetector { // Scroll / Pan Has Stopped if (scrollGestureOccurred) { - MapboxTelemetry.getInstance().pushEvent(MapboxEventWrapper.buildMapDragEndEvent( - getLocationFromGesture(event.getX(), event.getY()), transform)); + if (isZoomValid(transform)) { + MapEventFactory mapEventFactory = new MapEventFactory(); + LatLng latLng = projection.fromScreenLocation(new PointF(event.getX(), event.getY())); + MapState dragend = new MapState(latLng.getLatitude(), latLng.getLongitude(), transform.getZoom()); + Events.obtainTelemetry().push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_DRAGEND, dragend)); + } scrollGestureOccurred = false; if (!scaleAnimating && !rotateAnimating) { @@ -350,9 +344,13 @@ final class MapGestureDetector { // Zoom in on gesture transform.zoom(true, new PointF(e.getX(), e.getY())); } - MapboxTelemetry.getInstance().pushEvent(MapboxEventWrapper.buildMapClickEvent( - getLocationFromGesture(e.getX(), e.getY()), - MapboxEvent.GESTURE_DOUBLETAP, transform)); + if (isZoomValid(transform)) { + MapEventFactory mapEventFactory = new MapEventFactory(); + LatLng latLng = projection.fromScreenLocation(new PointF(e.getX(), e.getY())); + MapState doubleTap = new MapState(latLng.getLatitude(), latLng.getLongitude(), transform.getZoom()); + doubleTap.setGesture(Events.DOUBLE_TAP); + Events.obtainTelemetry().push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_CLICK, doubleTap)); + } break; } @@ -380,9 +378,13 @@ final class MapGestureDetector { notifyOnMapClickListeners(tapPoint); } - MapboxTelemetry.getInstance().pushEvent(MapboxEventWrapper.buildMapClickEvent( - getLocationFromGesture(motionEvent.getX(), motionEvent.getY()), - MapboxEvent.GESTURE_SINGLETAP, transform)); + if (isZoomValid(transform)) { + MapEventFactory mapEventFactory = new MapEventFactory(); + LatLng latLng = projection.fromScreenLocation(new PointF(motionEvent.getX(), motionEvent.getY())); + MapState singleTap = new MapState(latLng.getLatitude(), latLng.getLongitude(), transform.getZoom()); + singleTap.setGesture(Events.SINGLE_TAP); + Events.obtainTelemetry().push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_CLICK, singleTap)); + } return true; } @@ -456,9 +458,13 @@ final class MapGestureDetector { cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE); } - MapboxTelemetry.getInstance().pushEvent(MapboxEventWrapper.buildMapClickEvent( - getLocationFromGesture(e1.getX(), e1.getY()), - MapboxEvent.GESTURE_PAN_START, transform)); + if (isZoomValid(transform)) { + MapEventFactory mapEventFactory = new MapEventFactory(); + LatLng latLng = projection.fromScreenLocation(new PointF(e1.getX(), e1.getY())); + MapState pan = new MapState(latLng.getLatitude(), latLng.getLongitude(), transform.getZoom()); + pan.setGesture(Events.PAN); + Events.obtainTelemetry().push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_CLICK, pan)); + } } // reset tracking if needed @@ -541,9 +547,13 @@ final class MapGestureDetector { recentScaleGestureOccurred = true; scalePointBegin = new PointF(detector.getFocusX(), detector.getFocusY()); scaleBeginTime = detector.getEventTime(); - MapboxTelemetry.getInstance().pushEvent(MapboxEventWrapper.buildMapClickEvent( - getLocationFromGesture(detector.getFocusX(), detector.getFocusY()), - MapboxEvent.GESTURE_PINCH_START, transform)); + if (isZoomValid(transform)) { + MapEventFactory mapEventFactory = new MapEventFactory(); + LatLng latLng = projection.fromScreenLocation(new PointF(detector.getFocusX(), detector.getFocusY())); + MapState pinch = new MapState(latLng.getLatitude(), latLng.getLongitude(), transform.getZoom()); + pinch.setGesture(Events.PINCH); + Events.obtainTelemetry().push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_CLICK, pinch)); + } return true; } @@ -724,9 +734,13 @@ final class MapGestureDetector { // Also is zoom already started, don't rotate float angle = detector.getRotationDegreesDelta(); if (Math.abs(angle) >= ROTATE_INVOKE_ANGLE) { - MapboxTelemetry.getInstance().pushEvent(MapboxEventWrapper.buildMapClickEvent( - getLocationFromGesture(detector.getFocusX(), detector.getFocusY()), - MapboxEvent.GESTURE_ROTATION_START, transform)); + if (isZoomValid(transform)) { + MapEventFactory mapEventFactory = new MapEventFactory(); + LatLng latLng = projection.fromScreenLocation(new PointF(detector.getFocusX(), detector.getFocusY())); + MapState rotation = new MapState(latLng.getLatitude(), latLng.getLongitude(), transform.getZoom()); + rotation.setGesture(Events.ROTATION); + Events.obtainTelemetry().push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_CLICK, rotation)); + } started = true; } @@ -895,9 +909,13 @@ final class MapGestureDetector { if (!tiltGestureOccurred && ((totalDelta > 10.0f) || (totalDelta < -10.0f))) { tiltGestureOccurred = true; beginTime = detector.getEventTime(); - MapboxTelemetry.getInstance().pushEvent(MapboxEventWrapper.buildMapClickEvent( - getLocationFromGesture(detector.getFocusX(), detector.getFocusY()), - MapboxEvent.GESTURE_PITCH_START, transform)); + if (isZoomValid(transform)) { + MapEventFactory mapEventFactory = new MapEventFactory(); + LatLng latLng = projection.fromScreenLocation(new PointF(detector.getFocusX(), detector.getFocusY())); + MapState pitch = new MapState(latLng.getLatitude(), latLng.getLongitude(), transform.getZoom()); + pitch.setGesture(Events.PITCH); + Events.obtainTelemetry().push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_CLICK, pitch)); + } } if (!tiltGestureOccurred) { @@ -962,4 +980,15 @@ final class MapGestureDetector { void removeOnScrollListener(MapboxMap.OnScrollListener onScrollListener) { onScrollListenerList.remove(onScrollListener); } + + private boolean isZoomValid(Transform transform) { + if (transform == null) { + return false; + } + double mapZoom = transform.getZoom(); + if (mapZoom < MapboxConstants.MINIMUM_ZOOM || mapZoom > MapboxConstants.MAXIMUM_ZOOM) { + return false; + } + return true; + } } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java index 9f591ddcab..49aaae0523 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java @@ -22,6 +22,12 @@ import android.view.ViewTreeObserver; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.ZoomButtonsController; + +import com.mapbox.android.telemetry.AppUserTurnstile; +import com.mapbox.android.telemetry.Event; +import com.mapbox.android.telemetry.MapEventFactory; +import com.mapbox.android.telemetry.MapboxTelemetry; +import com.mapbox.mapboxsdk.BuildConfig; import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.annotations.Annotation; import com.mapbox.mapboxsdk.annotations.MarkerViewManager; @@ -35,11 +41,7 @@ import com.mapbox.mapboxsdk.maps.widgets.MyLocationView; import com.mapbox.mapboxsdk.maps.widgets.MyLocationViewSettings; import com.mapbox.mapboxsdk.net.ConnectivityReceiver; import com.mapbox.mapboxsdk.storage.FileSource; -import com.mapbox.services.android.telemetry.MapboxTelemetry; -import timber.log.Timber; -import javax.microedition.khronos.egl.EGLConfig; -import javax.microedition.khronos.opengles.GL10; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.ref.WeakReference; @@ -48,6 +50,11 @@ import java.util.Iterator; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; +import javax.microedition.khronos.egl.EGLConfig; +import javax.microedition.khronos.opengles.GL10; + +import timber.log.Timber; + import static com.mapbox.mapboxsdk.maps.widgets.CompassView.TIME_MAP_NORTH_ANIMATION; import static com.mapbox.mapboxsdk.maps.widgets.CompassView.TIME_WAIT_IDLE; @@ -273,7 +280,12 @@ public class MapView extends FrameLayout { @UiThread public void onCreate(@Nullable Bundle savedInstanceState) { if (savedInstanceState == null) { - MapboxTelemetry.getInstance().pushEvent(MapboxEventWrapper.buildMapLoadEvent()); + MapboxTelemetry telemetry = Events.obtainTelemetry(); + AppUserTurnstile turnstileEvent = new AppUserTurnstile(BuildConfig.MAPBOX_SDK_IDENTIFIER, + BuildConfig.MAPBOX_SDK_VERSION); + telemetry.push(turnstileEvent); + MapEventFactory mapEventFactory = new MapEventFactory(); + telemetry.push(mapEventFactory.createMapLoadEvent(Event.Type.MAP_LOAD)); } else if (savedInstanceState.getBoolean(MapboxConstants.STATE_HAS_SAVED_STATE)) { this.savedInstanceState = savedInstanceState; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxEventWrapper.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxEventWrapper.java deleted file mode 100644 index 6730278d79..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxEventWrapper.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.mapbox.mapboxsdk.maps; - -import android.location.Location; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; - -import com.mapbox.mapboxsdk.constants.MapboxConstants; -import com.mapbox.services.android.telemetry.MapboxEvent; - -import java.util.Hashtable; - -/** - * Wrapper class for MapboxEvent - *

- * Provides facility methods to use Transform and handle the case that the zoom, required for a telemetry event, - * isn't available yet. - *

- */ -class MapboxEventWrapper { - - @Nullable - static Hashtable buildMapClickEvent( - @NonNull Location location, @NonNull String gestureId, Transform transform) { - try { - double mapZoom = transform.getZoom(); - if (mapZoom >= MapboxConstants.MINIMUM_ZOOM && mapZoom <= MapboxConstants.MAXIMUM_ZOOM) { - // validate zoom #8057 - return MapboxEvent.buildMapClickEvent(location, gestureId, transform.getZoom()); - } - } catch (NullPointerException exception) { - // Map/Transform is not ready yet #8650 - // returning null is valid, event is ignored. - } - return null; - } - - @Nullable - static Hashtable buildMapDragEndEvent( - @NonNull Location location, Transform transform) { - try { - double mapZoom = transform.getZoom(); - if (mapZoom >= MapboxConstants.MINIMUM_ZOOM && mapZoom <= MapboxConstants.MAXIMUM_ZOOM) { - // validate zoom #8057 - return MapboxEvent.buildMapDragEndEvent(location, transform.getZoom()); - } - } catch (NullPointerException exception) { - // Map/Transform is not ready yet #8650 - // returning null is valid, event is ignored. - } - return null; - } - - @Nullable - static Hashtable buildMapLoadEvent() { - return MapboxEvent.buildMapLoadEvent(); - } -} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java index 834317dd25..2fd9a9010c 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java @@ -43,7 +43,7 @@ import com.mapbox.mapboxsdk.style.layers.Filter; import com.mapbox.mapboxsdk.style.layers.Layer; import com.mapbox.mapboxsdk.style.light.Light; import com.mapbox.mapboxsdk.style.sources.Source; -import com.mapbox.services.android.telemetry.location.LocationEngine; +import com.mapbox.android.core.location.LocationEngine; import java.lang.reflect.ParameterizedType; import java.util.HashMap; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java index 81fd091c90..3743096824 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java @@ -12,9 +12,9 @@ import com.mapbox.mapboxsdk.constants.MapboxConstants; import com.mapbox.mapboxsdk.constants.MyBearingTracking; import com.mapbox.mapboxsdk.constants.MyLocationTracking; import com.mapbox.mapboxsdk.maps.widgets.MyLocationView; -import com.mapbox.services.android.telemetry.location.LocationEngine; -import com.mapbox.services.android.telemetry.location.LocationEngineListener; -import com.mapbox.services.android.telemetry.permissions.PermissionsManager; +import com.mapbox.android.core.location.LocationEngine; +import com.mapbox.android.core.location.LocationEngineListener; +import com.mapbox.android.core.permissions.PermissionsManager; import timber.log.Timber; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java index 1cdd91028d..3f37da99d5 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java @@ -35,9 +35,9 @@ import com.mapbox.mapboxsdk.constants.MyLocationTracking; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.Projection; -import com.mapbox.services.android.telemetry.location.LocationEngine; -import com.mapbox.services.android.telemetry.location.LocationEngineListener; -import com.mapbox.services.android.telemetry.location.LocationEnginePriority; +import com.mapbox.android.core.location.LocationEngine; +import com.mapbox.android.core.location.LocationEngineListener; +import com.mapbox.android.core.location.LocationEnginePriority; import java.lang.ref.WeakReference; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonOptions.java index 81f7255b86..79cde7429c 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonOptions.java @@ -13,7 +13,7 @@ public class GeoJsonOptions extends HashMap { /** * Maximum zoom level at which to create vector tiles (higher means greater detail at high zoom levels). * - * @param maxZoom the maximum zoom - Defaults to 18. + * @param minZoom the maximum zoom - Defaults to 18. * @return the current instance for chaining */ public GeoJsonOptions withMinZoom(int minZoom) { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/MathUtils.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/MathUtils.java new file mode 100644 index 0000000000..0c90e4b244 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/MathUtils.java @@ -0,0 +1,49 @@ +package com.mapbox.mapboxsdk.utils; + +// TODO Remove this class if we finally include it within MAS 3.x (GeoJSON) +public class MathUtils { + + /** + * Test a value in specified range, returning minimum if it's below, and maximum if it's above + * + * @param value Value to test + * @param min Minimum value of range + * @param max Maximum value of range + * @return value if it's between min and max, min if it's below, max if it's above + */ + public static double clamp(double value, double min, double max) { + return Math.max(min, Math.min(max, value)); + } + + /** + * Test a value in specified range, returning minimum if it's below, and maximum if it's above + * + * @param value Value to test + * @param min Minimum value of range + * @param max Maximum value of range + * @return value if it's between min and max, min if it's below, max if it's above + */ + public static float clamp(float value, float min, float max) { + return Math.max(min, Math.min(max, value)); + } + + /** + * Constrains value to the given range (including min, excluding max) via modular arithmetic. + *

+ * Same formula as used in Core GL (wrap.hpp) + * std::fmod((std::fmod((value - min), d) + d), d) + min; + * + * @param value Value to wrap + * @param min Minimum value + * @param max Maximum value + * @return Wrapped value + */ + public static double wrap(double value, double min, double max) { + double delta = max - min; + + double firstMod = (value - min) % delta; + double secondMod = (firstMod + delta) % delta; + + return secondMod + min; + } +} diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/MapboxTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/MapboxTest.java index 7a28d846ea..d9e3ae427d 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/MapboxTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/MapboxTest.java @@ -5,7 +5,7 @@ import android.net.ConnectivityManager; import android.net.NetworkInfo; import com.mapbox.mapboxsdk.exceptions.MapboxConfigurationException; -import com.mapbox.services.android.telemetry.location.LocationEngine; +import com.mapbox.android.core.location.LocationEngine; import org.junit.Before; import org.junit.Test; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle index de4c0cc3be..135b46e0fe 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle +++ b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle @@ -52,18 +52,17 @@ android { } dependencies { - implementation(project(':MapboxGLAndroidSDK')) - implementation(dependenciesList.mapboxJavaServices) { - transitive = true - } + api(project(':MapboxGLAndroidSDK')) + implementation dependenciesList.mapboxJavaServices - api dependenciesList.mapboxJavaTurf + implementation dependenciesList.mapboxJavaTurf implementation dependenciesList.supportAppcompatV7 implementation dependenciesList.supportRecyclerView implementation dependenciesList.supportDesign - implementation dependenciesList.lost + // implementation dependenciesList.lost + implementation dependenciesList.gmsLocation implementation dependenciesList.timber debugImplementation dependenciesList.leakCanaryDebug releaseImplementation dependenciesList.leakCanaryRelease diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml index 89f922fb9e..2d6efc0d84 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml @@ -806,7 +806,7 @@ + android:value="api-events-staging.tilestream.net"/> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java index 95cc9687f2..0ee1f78e0e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java @@ -22,8 +22,8 @@ import com.mapbox.mapboxsdk.testapp.adapter.FeatureAdapter; import com.mapbox.mapboxsdk.testapp.adapter.FeatureSectionAdapter; import com.mapbox.mapboxsdk.testapp.model.activity.Feature; import com.mapbox.mapboxsdk.testapp.utils.ItemClickSupport; -import com.mapbox.services.android.telemetry.permissions.PermissionsListener; -import com.mapbox.services.android.telemetry.permissions.PermissionsManager; +import com.mapbox.android.core.permissions.PermissionsListener; +import com.mapbox.android.core.permissions.PermissionsManager; import java.util.ArrayList; import java.util.Collections; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/BaseLocationActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/BaseLocationActivity.java index 71b8115d2e..eec26cc9a7 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/BaseLocationActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/BaseLocationActivity.java @@ -9,8 +9,8 @@ import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.text.TextUtils; -import com.mapbox.services.android.telemetry.permissions.PermissionsListener; -import com.mapbox.services.android.telemetry.permissions.PermissionsManager; +import com.mapbox.android.core.permissions.PermissionsListener; +import com.mapbox.android.core.permissions.PermissionsManager; import java.util.List; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MockLocationEngine.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MockLocationEngine.java index f4b54551bf..f4fe710de1 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MockLocationEngine.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MockLocationEngine.java @@ -5,8 +5,8 @@ import android.animation.TypeEvaluator; import android.animation.ValueAnimator; import android.location.Location; -import com.mapbox.services.android.telemetry.location.LocationEngine; -import com.mapbox.services.android.telemetry.location.LocationEngineListener; +import com.mapbox.android.core.location.LocationEngine; +import com.mapbox.android.core.location.LocationEngineListener; import timber.log.Timber; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java index 000042306f..f603050030 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java @@ -15,7 +15,7 @@ import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.MapboxMapOptions; import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.services.android.telemetry.location.LocationEngineListener; +import com.mapbox.android.core.location.LocationEngineListener; /** * Test activity showcasing how to change the MyLocationView drawable. diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTintActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTintActivity.java index 89774dc507..ff3c4dfbc0 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTintActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTintActivity.java @@ -18,7 +18,7 @@ import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.TrackingSettings; import com.mapbox.mapboxsdk.maps.widgets.MyLocationViewSettings; import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.services.android.telemetry.location.LocationEngineListener; +import com.mapbox.android.core.location.LocationEngineListener; /** * Test activity showcasing how to tint the MyLocationView. diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java index 5ebe43e68c..ffbb2c1a90 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java @@ -25,7 +25,7 @@ import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.maps.TrackingSettings; import com.mapbox.mapboxsdk.maps.UiSettings; import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.services.android.telemetry.location.LocationEngineListener; +import com.mapbox.android.core.location.LocationEngineListener; import timber.log.Timber; diff --git a/platform/android/build.gradle b/platform/android/build.gradle index 0368558e92..6cd9505447 100644 --- a/platform/android/build.gradle +++ b/platform/android/build.gradle @@ -11,6 +11,7 @@ buildscript { allprojects { repositories { + mavenCentral() jcenter() google() maven { url "http://oss.sonatype.org/content/repositories/snapshots/" } diff --git a/platform/android/gradle/dependencies.gradle b/platform/android/gradle/dependencies.gradle index 99fa3f3508..4ef4ae2f7d 100644 --- a/platform/android/gradle/dependencies.gradle +++ b/platform/android/gradle/dependencies.gradle @@ -9,7 +9,7 @@ ext { versions = [ mapboxServices: '3.0.0-beta.2', - mapboxTelemetry: '2.2.9', + mapboxTelemetry: '3.0.0-beta.1', supportLib : '25.4.0', espresso : '3.0.1', testRunner : '1.0.1', @@ -46,6 +46,7 @@ ext { supportRecyclerView : "com.android.support:recyclerview-v7:${versions.supportLib}", lost : "com.mapzen.android:lost:${versions.lost}", + gmsLocation : 'com.google.android.gms:play-services-location:11.0.4', timber : "com.jakewharton.timber:timber:${versions.timber}", okhttp3 : "com.squareup.okhttp3:okhttp:${versions.okhttp}", leakCanaryDebug : "com.squareup.leakcanary:leakcanary-android:${versions.leakCanary}", -- cgit v1.2.1 From 734b420649392fd7e35e808e9a5053b9c38b5adc Mon Sep 17 00:00:00 2001 From: Tobrun Date: Tue, 13 Feb 2018 12:25:45 +0100 Subject: [android] - add constrained latlng documentation, add MapboxMap#LatLngZoom --- .../java/com/mapbox/mapboxsdk/maps/MapboxMap.java | 24 ++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java index 2fd9a9010c..4f2c940ea3 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java @@ -621,6 +621,9 @@ public final class MapboxMap { /** * Moves the center of the screen to a latitude and longitude specified by a LatLng object. This centers the * camera on the LatLng object. + *

+ * Note that at low zoom levels, setLatLng is constrained so that the entire viewport shows map data. + *

* * @param latLng Target location to change to */ @@ -640,6 +643,21 @@ public final class MapboxMap { nativeMapView.setZoom(zoom, focalPoint, 0); } + /** + * Moves the center and the zoom of the camera specified by a LatLng object and double zoom. + *

+ * Note that at low zoom levels, setLatLng is constrained so that the entire viewport shows map data. + *

+ * + * @param latLng Target location to change to + */ + public void setLatLngZoom(@NonNull LatLng latLng, + @FloatRange(from = MapboxConstants.MINIMUM_ZOOM, + to = MapboxConstants.MAXIMUM_ZOOM) double zoom) { + setZoom(zoom); + setLatLng(latLng); + } + /** * Moves the camera viewpoint angle to a particular angle in degrees. * @@ -1882,7 +1900,6 @@ public final class MapboxMap { * * @param listener The callback that's invoked when the map is scrolled. * To unset the callback, use null. - * * @deprecated Use {@link #addOnScrollListener(OnScrollListener)} instead. */ @Deprecated @@ -1895,7 +1912,6 @@ public final class MapboxMap { * * @param listener The callback that's invoked when the map is scrolled. * To unset the callback, use null. - * */ public void addOnScrollListener(@Nullable OnScrollListener listener) { onRegisterTouchListener.onAddScrollListener(listener); @@ -1906,7 +1922,6 @@ public final class MapboxMap { * * @param listener The callback that's invoked when the map is scrolled. * To unset the callback, use null. - * */ public void removeOnScrollListener(@Nullable OnScrollListener listener) { onRegisterTouchListener.onRemoveScrollListener(listener); @@ -1917,7 +1932,6 @@ public final class MapboxMap { * * @param listener The callback that's invoked when the map is flinged. * To unset the callback, use null. - * * @deprecated Use {@link #addOnFlingListener(OnFlingListener)} instead. */ @Deprecated @@ -1950,7 +1964,6 @@ public final class MapboxMap { * * @param listener The callback that's invoked when the user clicks on the map view. * To unset the callback, use null. - * * @deprecated Use {@link #addOnMapClickListener(OnMapClickListener)} instead. */ @Deprecated @@ -1983,7 +1996,6 @@ public final class MapboxMap { * * @param listener The callback that's invoked when the user long clicks on the map view. * To unset the callback, use null. - * * @deprecated Use {@link #addOnMapLongClickListener(OnMapLongClickListener)} instead. */ @Deprecated -- cgit v1.2.1 From 143c346d9d809a93d802dc087cffe517659e1077 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Fri, 26 Jan 2018 15:32:16 +0100 Subject: [android] - translucent surface on TextureView --- .../java/com/mapbox/mapboxsdk/maps/MapView.java | 4 +- .../mapbox/mapboxsdk/maps/MapboxMapOptions.java | 15 ++++ .../maps/renderer/egl/EGLConfigChooser.java | 13 ++- .../textureview/TextureViewMapRenderer.java | 15 +++- .../textureview/TextureViewRenderThread.java | 9 +- .../src/main/res-public/values/public.xml | 1 + .../src/main/res/values/attrs.xml | 1 + .../src/main/AndroidManifest.xml | 11 +++ .../textureview/TextureViewResizeActivity.java | 2 +- .../TextureViewTransparentBackgroundActivity.java | 94 +++++++++++++++++++++ .../src/main/res/drawable-xxxhdpi/water.jpg | Bin 0 -> 165806 bytes .../res/layout/activity_textureview_resize.xml | 2 +- .../layout/activity_textureview_transparent.xml | 28 ++++++ .../src/main/res/raw/no_bg_style.json | 43 ++++++++++ .../src/main/res/values/descriptions.xml | 1 + .../src/main/res/values/titles.xml | 1 + platform/android/scripts/exclude-activity-gen.json | 5 +- 17 files changed, 233 insertions(+), 12 deletions(-) create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/textureview/TextureViewTransparentBackgroundActivity.java create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxxhdpi/water.jpg create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_textureview_transparent.xml create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/main/res/raw/no_bg_style.json diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java index 49aaae0523..a921d14038 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java @@ -294,7 +294,9 @@ public class MapView extends FrameLayout { private void initialiseDrawingSurface(MapboxMapOptions options) { if (options.getTextureMode()) { TextureView textureView = new TextureView(getContext()); - mapRenderer = new TextureViewMapRenderer(getContext(), textureView, options.getLocalIdeographFontFamily()) { + String localFontFamily = options.getLocalIdeographFontFamily(); + boolean translucentSurface = options.getTranslucentTextureSurface(); + mapRenderer = new TextureViewMapRenderer(getContext(), textureView, localFontFamily, translucentSurface) { @Override protected void onSurfaceCreated(GL10 gl, EGLConfig config) { MapView.this.onSurfaceCreated(); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java index 46dba28b98..49188a5a98 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java @@ -87,6 +87,7 @@ public class MapboxMapOptions implements Parcelable { private String apiBaseUrl; private boolean textureMode; + private boolean translucentTextureSurface; private String style; @@ -156,6 +157,7 @@ public class MapboxMapOptions implements Parcelable { style = in.readString(); apiBaseUrl = in.readString(); textureMode = in.readByte() != 0; + translucentTextureSurface = in.readByte() != 0; prefetchesTiles = in.readByte() != 0; zMediaOverlay = in.readByte() != 0; localIdeographFontFamily = in.readString(); @@ -289,6 +291,8 @@ public class MapboxMapOptions implements Parcelable { typedArray.getFloat(R.styleable.mapbox_MapView_mapbox_myLocationAccuracyThreshold, 0)); mapboxMapOptions.textureMode( typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_renderTextureMode, false)); + mapboxMapOptions.translucentTextureSurface( + typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_renderTextureTranslucentSurface, false)); mapboxMapOptions.setPrefetchesTiles( typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_enableTilePrefetch, true)); mapboxMapOptions.renderSurfaceOnTop( @@ -711,6 +715,11 @@ public class MapboxMapOptions implements Parcelable { return this; } + public MapboxMapOptions translucentTextureSurface(boolean translucentTextureSurface) { + this.translucentTextureSurface = translucentTextureSurface; + return this; + } + /** * Enable tile pre-fetching. Loads tiles at a lower zoom-level to pre-render * a low resolution preview while more detailed tiles are loaded. @@ -1085,6 +1094,10 @@ public class MapboxMapOptions implements Parcelable { return textureMode; } + public boolean getTranslucentTextureSurface() { + return translucentTextureSurface; + } + /** * Returns the font-family for locally overriding generation of glyphs in the * ‘CJK Unified Ideographs’ and ‘Hangul Syllables’ ranges. @@ -1159,6 +1172,7 @@ public class MapboxMapOptions implements Parcelable { dest.writeString(style); dest.writeString(apiBaseUrl); dest.writeByte((byte) (textureMode ? 1 : 0)); + dest.writeByte((byte) (translucentTextureSurface ? 1 : 0)); dest.writeByte((byte) (prefetchesTiles ? 1 : 0)); dest.writeByte((byte) (zMediaOverlay ? 1 : 0)); dest.writeString(localIdeographFontFamily); @@ -1340,6 +1354,7 @@ public class MapboxMapOptions implements Parcelable { ? Float.floatToIntBits(myLocationAccuracyThreshold) : 0); result = 31 * result + (apiBaseUrl != null ? apiBaseUrl.hashCode() : 0); result = 31 * result + (textureMode ? 1 : 0); + result = 31 * result + (translucentTextureSurface ? 1 : 0); result = 31 * result + (style != null ? style.hashCode() : 0); result = 31 * result + (prefetchesTiles ? 1 : 0); result = 31 * result + (zMediaOverlay ? 1 : 0); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/egl/EGLConfigChooser.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/egl/EGLConfigChooser.java index 247ffea906..46238ee789 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/egl/EGLConfigChooser.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/egl/EGLConfigChooser.java @@ -54,6 +54,17 @@ public class EGLConfigChooser implements GLSurfaceView.EGLConfigChooser { @SuppressWarnings("JavadocReference") private static final int EGL_OPENGL_ES2_BIT = 0x0004; + private boolean translucentSurface; + + public EGLConfigChooser() { + this(false); + } + + public EGLConfigChooser(boolean translucentSurface) { + super(); + this.translucentSurface = translucentSurface; + } + @Override public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) { int[] configAttribs = getConfigAttributes(); @@ -274,7 +285,7 @@ public class EGLConfigChooser implements GLSurfaceView.EGLConfigChooser { EGL_RED_SIZE, 5, EGL_GREEN_SIZE, 6, EGL_BLUE_SIZE, 5, - EGL_ALPHA_SIZE, 0, + EGL_ALPHA_SIZE, translucentSurface ? 8 : 0, EGL_DEPTH_SIZE, 16, EGL_STENCIL_SIZE, 8, (emulator ? EGL_NONE : EGL_CONFORMANT), EGL_OPENGL_ES2_BIT, diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewMapRenderer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewMapRenderer.java index dcc95217ff..ad25dea0d3 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewMapRenderer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewMapRenderer.java @@ -17,17 +17,22 @@ import javax.microedition.khronos.opengles.GL10; */ public class TextureViewMapRenderer extends MapRenderer { private TextureViewRenderThread renderThread; + private boolean translucentSurface; /** * Create a {@link MapRenderer} for the given {@link TextureView} * - * @param context the current Context - * @param textureView the TextureView + * @param context the current Context + * @param textureView the TextureView + * @param localIdeographFontFamily the local font family + * @param translucentSurface the translucency flag */ public TextureViewMapRenderer(@NonNull Context context, @NonNull TextureView textureView, - String localIdeographFontFamily) { + String localIdeographFontFamily, + boolean translucentSurface) { super(context, localIdeographFontFamily); + this.translucentSurface = translucentSurface; renderThread = new TextureViewRenderThread(textureView, this); renderThread.start(); } @@ -95,4 +100,8 @@ public class TextureViewMapRenderer extends MapRenderer { public void onDestroy() { renderThread.onDestroy(); } + + public boolean isTranslucentSurface() { + return translucentSurface; + } } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java index 1e76ffe3fb..4bba160993 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java @@ -53,9 +53,10 @@ class TextureViewRenderThread extends Thread implements TextureView.SurfaceTextu */ @UiThread TextureViewRenderThread(@NonNull TextureView textureView, @NonNull TextureViewMapRenderer mapRenderer) { + textureView.setOpaque(!mapRenderer.isTranslucentSurface()); textureView.setSurfaceTextureListener(this); this.mapRenderer = mapRenderer; - this.eglHolder = new EGLHolder(new WeakReference<>(textureView)); + this.eglHolder = new EGLHolder(new WeakReference<>(textureView), mapRenderer.isTranslucentSurface()); } // SurfaceTextureListener methods @@ -324,6 +325,7 @@ class TextureViewRenderThread extends Thread implements TextureView.SurfaceTextu private static class EGLHolder { private static final int EGL_CONTEXT_CLIENT_VERSION = 0x3098; private final WeakReference textureViewWeakRef; + private boolean translucentSurface; private EGL10 egl; private EGLConfig eglConfig; @@ -331,8 +333,9 @@ class TextureViewRenderThread extends Thread implements TextureView.SurfaceTextu private EGLContext eglContext = EGL10.EGL_NO_CONTEXT; private EGLSurface eglSurface = EGL10.EGL_NO_SURFACE; - EGLHolder(WeakReference textureViewWeakRef) { + EGLHolder(WeakReference textureViewWeakRef, boolean translucentSurface) { this.textureViewWeakRef = textureViewWeakRef; + this.translucentSurface = translucentSurface; } void prepare() { @@ -357,7 +360,7 @@ class TextureViewRenderThread extends Thread implements TextureView.SurfaceTextu eglConfig = null; eglContext = EGL10.EGL_NO_CONTEXT; } else if (eglContext == EGL10.EGL_NO_CONTEXT) { - eglConfig = new EGLConfigChooser().chooseConfig(egl, eglDisplay); + eglConfig = new EGLConfigChooser(translucentSurface).chooseConfig(egl, eglDisplay); int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE}; eglContext = egl.eglCreateContext(eglDisplay, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list); } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml b/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml index 412d8c5d9b..fda37dc2df 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml @@ -75,6 +75,7 @@ + diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values/attrs.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values/attrs.xml index 97adce8a4e..f0b80e46e1 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values/attrs.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values/attrs.xml @@ -117,6 +117,7 @@ + diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml index 2d6efc0d84..9e64e03e11 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml @@ -759,6 +759,17 @@ android:name="@string/category" android:value="@string/category_textureview"/> + + + + { + mapboxMap = map; + + try { + map.setStyleJson(ResourceUtils.readRawResource(getApplicationContext(), R.raw.no_bg_style)); + } catch (IOException exception) { + Timber.e(exception); + } + }); + } + + @Override + protected void onStart() { + super.onStart(); + mapView.onStart(); + } + + @Override + protected void onResume() { + super.onResume(); + mapView.onResume(); + } + + @Override + protected void onPause() { + super.onPause(); + mapView.onPause(); + } + + @Override + protected void onStop() { + super.onStop(); + mapView.onStop(); + } + + @Override + protected void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + mapView.onSaveInstanceState(outState); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + mapView.onDestroy(); + } + + @Override + public void onLowMemory() { + super.onLowMemory(); + mapView.onLowMemory(); + } + +} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxxhdpi/water.jpg b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxxhdpi/water.jpg new file mode 100644 index 0000000000..71b758b490 Binary files /dev/null and b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxxhdpi/water.jpg differ diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_textureview_resize.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_textureview_resize.xml index 2baa3d39dd..b00076e779 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_textureview_resize.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_textureview_resize.xml @@ -7,7 +7,7 @@ android:layout_height="match_parent" android:orientation="vertical"> - + + + + + + + + + diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/raw/no_bg_style.json b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/raw/no_bg_style.json new file mode 100644 index 0000000000..964eefc319 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/raw/no_bg_style.json @@ -0,0 +1,43 @@ +{ + "version": 8, + "name": "Land", + "metadata": { + "mapbox:autocomposite": true, + }, + "sources": { + "composite": { + "url": "mapbox://mapbox.mapbox-terrain-v2", + "type": "vector" + } + }, + "sprite": "mapbox://sprites/mapbox/mapbox-terrain-v2", + "glyphs": "mapbox://fonts/mapbox/{fontstack}/{range}.pbf", + "layers": [ + { + "layout": { + "visibility": "visible" + }, + "type": "fill", + "source": "composite", + "id": "admin", + "paint": { + "fill-color": "hsl(359, 100%, 50%)", + "fill-opacity": 1 + }, + "source-layer": "landcover" + }, + { + "layout": { + "visibility": "visible" + }, + "type": "fill", + "source": "composite", + "id": "layer-0", + "paint": { + "fill-opacity": 1, + "fill-color": "hsl(359, 100%, 50%)" + }, + "source-layer": "Layer_0" + } + ] +} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/descriptions.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/descriptions.xml index e867046c80..51182f958c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/descriptions.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/descriptions.xml @@ -67,6 +67,7 @@ Use TextureView to render the map Resize a map rendered on a TextureView Animate a map rendered on a TextureView + Enable a transparent surface on TextureView Example Custom Geometry Source Suzhou using Droid Sans for Chinese glyphs Example raster-dem source and hillshade layer diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/titles.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/titles.xml index 47fee31c0a..078ccb64a9 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/titles.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/titles.xml @@ -67,6 +67,7 @@ TextureView debug TextureView resize TextureView animation + TextureView transparent background Grid Source Local CJK glyph generation Hillshade diff --git a/platform/android/scripts/exclude-activity-gen.json b/platform/android/scripts/exclude-activity-gen.json index c1a6b5bb48..2170c4d9f8 100644 --- a/platform/android/scripts/exclude-activity-gen.json +++ b/platform/android/scripts/exclude-activity-gen.json @@ -27,10 +27,11 @@ "QueryRenderedFeaturesBoxHighlightActivity", "MultiMapActivity", "MapInDialogActivity", - "SimpleMapActivity", "ManualZoomActivity", "MaxMinZoomActivity", "ScrollByActivity", "ZoomFunctionSymbolLayerActivity", - "SymbolGeneratorActivity" + "SymbolGeneratorActivity", + "TextureViewTransparentBackgroundActivity", + "SimpleMapActivity" ] \ No newline at end of file -- cgit v1.2.1 From 35930614ae796f165974b6c6f5c70b7e5667942b Mon Sep 17 00:00:00 2001 From: Tobrun Date: Tue, 13 Feb 2018 13:01:36 +0100 Subject: [android] - remove lost dependency from the sdk --- platform/android/MapboxGLAndroidSDK/build.gradle | 5 ----- platform/android/MapboxGLAndroidSDK/proguard-rules.pro | 5 +---- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/build.gradle b/platform/android/MapboxGLAndroidSDK/build.gradle index e2e0881857..173b4fa7f8 100644 --- a/platform/android/MapboxGLAndroidSDK/build.gradle +++ b/platform/android/MapboxGLAndroidSDK/build.gradle @@ -7,11 +7,6 @@ dependencies { implementation dependenciesList.supportFragmentV4 implementation dependenciesList.timber implementation dependenciesList.okhttp3 - compileOnly(dependenciesList.lost) { - exclude group: 'com.google.guava' - exclude group: 'com.android.support' - } - testImplementation dependenciesList.lost testImplementation dependenciesList.junit testImplementation dependenciesList.mockito testImplementation dependenciesList.robolectric diff --git a/platform/android/MapboxGLAndroidSDK/proguard-rules.pro b/platform/android/MapboxGLAndroidSDK/proguard-rules.pro index 3b8adac5a8..b5a1d82c81 100644 --- a/platform/android/MapboxGLAndroidSDK/proguard-rules.pro +++ b/platform/android/MapboxGLAndroidSDK/proguard-rules.pro @@ -12,7 +12,4 @@ # config for okhttp 3.8.0, https://github.com/square/okhttp/pull/3354 -dontwarn okio.** -dontwarn javax.annotation.Nullable --dontwarn javax.annotation.ParametersAreNonnullByDefault - -# config for optional location provider https://github.com/mapbox/mapbox-gl-native/issues/10960 --dontwarn com.mapzen.android.lost.api** \ No newline at end of file +-dontwarn javax.annotation.ParametersAreNonnullByDefault \ No newline at end of file -- cgit v1.2.1 From 44c00ee63e49be05fba253c4bc44cfbaed36dc6b Mon Sep 17 00:00:00 2001 From: Tobrun Date: Tue, 13 Feb 2018 13:08:43 +0100 Subject: [android] - use ImageView instead of AppCompatImageView --- .../main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java index 45f72af1c5..fb2c70cb73 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java @@ -1,15 +1,16 @@ package com.mapbox.mapboxsdk.maps.widgets; +import android.annotation.SuppressLint; import android.content.Context; import android.graphics.drawable.Drawable; import android.support.annotation.NonNull; import android.support.v4.view.ViewCompat; import android.support.v4.view.ViewPropertyAnimatorCompat; import android.support.v4.view.ViewPropertyAnimatorListenerAdapter; -import android.support.v7.widget.AppCompatImageView; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; +import android.widget.ImageView; import com.mapbox.mapboxsdk.maps.MapboxMap; @@ -22,7 +23,8 @@ import com.mapbox.mapboxsdk.maps.MapboxMap; * use {@link com.mapbox.mapboxsdk.maps.UiSettings}. *

*/ -public final class CompassView extends AppCompatImageView implements Runnable { +@SuppressLint("AppCompatCustomView") +public final class CompassView extends ImageView implements Runnable { public static final long TIME_WAIT_IDLE = 500; public static final long TIME_MAP_NORTH_ANIMATION = 150; -- cgit v1.2.1 From 7742992692a26d30ea5c45fd6472704feac23be5 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Tue, 13 Feb 2018 12:56:43 +0100 Subject: [android] - deprecate locationengine --- .../MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java index 853ea1c11b..536f5d02ab 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java @@ -139,8 +139,10 @@ public final class Mapbox { * Returns the location engine used by the SDK. * * @return the location engine configured + * @deprecated use location layer plugin from + * https://github.com/mapbox/mapbox-plugins-android/tree/master/plugins/locationlayer instead. */ - // TODO Do we need to expose this? + @Deprecated public static LocationEngine getLocationEngine() { return INSTANCE.locationEngine; } -- cgit v1.2.1 From c83dc310aa656132638a66e65ba8aa274b5e969f Mon Sep 17 00:00:00 2001 From: Tobrun Date: Tue, 13 Feb 2018 14:10:48 +0100 Subject: [android] - update changelog for 6.0.0-beta.2 --- platform/android/CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/platform/android/CHANGELOG.md b/platform/android/CHANGELOG.md index 2721d0caff..7b77582dd0 100644 --- a/platform/android/CHANGELOG.md +++ b/platform/android/CHANGELOG.md @@ -2,6 +2,16 @@ 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. +## 6.0.0-beta.2 - February 13, 2018 + - Deprecate LocationEngine [#11185](https://github.com/mapbox/mapbox-gl-native/pull/11185) + - Remove LOST from SDK [11186](https://github.com/mapbox/mapbox-gl-native/pull/11186) + - Transparent surface configuration on TextureView [#11065](https://github.com/mapbox/mapbox-gl-native/pull/11065) + - Constrained setLatLng documentation, expose setLatLngZoom method [#11184](https://github.com/mapbox/mapbox-gl-native/pull/11184) + - Integration of new events library [#10999](https://github.com/mapbox/mapbox-gl-native/pull/10999) + - AddImage performance improvement [#11111](https://github.com/mapbox/mapbox-gl-native/pull/11111) + - Migrate MAS to 3.0.0, refactor GeoJson integration [#11149](https://github.com/mapbox/mapbox-gl-native/pull/11149) + - Remove @jar and @aar dependency suffixes [#11161](https://github.com/mapbox/mapbox-gl-native/pull/11161) + ## 5.4.1 - February 9, 2018 - Don't recreate TextureView surface as part of view resizing, solves OOM crashes [#11148](https://github.com/mapbox/mapbox-gl-native/pull/11148) - Don't invoke OnLowMemory before map is ready, solves startup crash on low memory devices [#11109](https://github.com/mapbox/mapbox-gl-native/pull/11109) -- cgit v1.2.1 From c2fe88815595808d40263e40d7999609ed642e79 Mon Sep 17 00:00:00 2001 From: Fabian Guerra Date: Thu, 15 Feb 2018 12:50:35 -0500 Subject: [ios, macos] Added missing files --- platform/darwin/src/MGLHeatmapStyleLayer.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/platform/darwin/src/MGLHeatmapStyleLayer.h b/platform/darwin/src/MGLHeatmapStyleLayer.h index 35095fd52e..ff2b92f226 100644 --- a/platform/darwin/src/MGLHeatmapStyleLayer.h +++ b/platform/darwin/src/MGLHeatmapStyleLayer.h @@ -90,11 +90,11 @@ MGL_EXPORT Primarily used for adjusting the heatmap based on zoom level. The default value of this property is an expression that evaluates to the float - `1`. Set this property to `nil` to reset it to the default value. + 1. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values no less than 0 * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -116,11 +116,11 @@ MGL_EXPORT The global opacity at which the heatmap layer will be drawn. The default value of this property is an expression that evaluates to the float - `1`. Set this property to `nil` to reset it to the default value. + 1. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values between 0 and 1 inclusive * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -145,11 +145,11 @@ MGL_EXPORT This property is measured in points. The default value of this property is an expression that evaluates to the float - `30`. Set this property to `nil` to reset it to the default value. + 30. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values no less than 1 * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables @@ -171,11 +171,11 @@ MGL_EXPORT Especially useful when combined with clustering. The default value of this property is an expression that evaluates to the float - `1`. Set this property to `nil` to reset it to the default value. + 1. Set this property to `nil` to reset it to the default value. You can set this property to an expression containing any of the following: - * Constant numeric values + * Constant numeric values no less than 0 * Predefined functions, including mathematical and string operators * Conditional expressions * Variable assignments and references to assigned variables -- cgit v1.2.1 From b630dbc35755e4ac71ec8d82749d311893522457 Mon Sep 17 00:00:00 2001 From: Fabian Guerra Date: Fri, 16 Feb 2018 12:42:01 -0500 Subject: [android] Reverted master changes that doesn't apply to boba. --- platform/android/MapboxGLAndroidSDK/gradle.properties | 2 +- .../src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java | 4 ++-- platform/android/scripts/exclude-activity-gen.json | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/gradle.properties b/platform/android/MapboxGLAndroidSDK/gradle.properties index 3796173fd9..f00eb1d77f 100644 --- a/platform/android/MapboxGLAndroidSDK/gradle.properties +++ b/platform/android/MapboxGLAndroidSDK/gradle.properties @@ -1,5 +1,5 @@ GROUP=com.mapbox.mapboxsdk -VERSION_NAME=7.0.0-SNAPSHOT +VERSION_NAME=6.0.0-SNAPSHOT POM_DESCRIPTION=Mapbox GL Android SDK POM_URL=https://github.com/mapbox/mapbox-gl-native diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java index 67ecf072e3..fb2c70cb73 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/CompassView.java @@ -7,10 +7,10 @@ import android.support.annotation.NonNull; import android.support.v4.view.ViewCompat; import android.support.v4.view.ViewPropertyAnimatorCompat; import android.support.v4.view.ViewPropertyAnimatorListenerAdapter; -import android.support.v7.widget.AppCompatImageView; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; +import android.widget.ImageView; import com.mapbox.mapboxsdk.maps.MapboxMap; @@ -24,7 +24,7 @@ import com.mapbox.mapboxsdk.maps.MapboxMap; *

*/ @SuppressLint("AppCompatCustomView") -public final class CompassView extends AppCompatImageView implements Runnable { +public final class CompassView extends ImageView implements Runnable { public static final long TIME_WAIT_IDLE = 500; public static final long TIME_MAP_NORTH_ANIMATION = 150; diff --git a/platform/android/scripts/exclude-activity-gen.json b/platform/android/scripts/exclude-activity-gen.json index 1d61d93943..eff7fb9cbf 100644 --- a/platform/android/scripts/exclude-activity-gen.json +++ b/platform/android/scripts/exclude-activity-gen.json @@ -27,7 +27,6 @@ "QueryRenderedFeaturesBoxHighlightActivity", "MultiMapActivity", "MapInDialogActivity", - "SimpleMapActivity", "ManualZoomActivity", "MaxMinZoomActivity", "ScrollByActivity", -- cgit v1.2.1 From 12103c95c03c8111995dd2ef4b9c7fb8ab671252 Mon Sep 17 00:00:00 2001 From: Fabian Guerra Date: Fri, 16 Feb 2018 13:25:28 -0500 Subject: [ios, macos] Remove the duplicated entries in changelogs. --- platform/ios/CHANGELOG.md | 2 +- platform/macos/CHANGELOG.md | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 75a7321170..cadbe9dd39 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -36,7 +36,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * Fixed a memory leak that occurred when creating a map snapshot. ([#10585](https://github.com/mapbox/mapbox-gl-native/pull/10585)) -## Other changes +### Other changes * Feature querying results now account for the `MGLSymbolStyleLayer.circleStrokeWidth` property. ([#10897](https://github.com/mapbox/mapbox-gl-native/pull/10897)) * Fixed an issue preventing labels from being transliterated when VoiceOver was enabled on iOS 10._x_ and below. ([#10881](https://github.com/mapbox/mapbox-gl-native/pull/10881)) diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index 0df8e9a80f..316e09b5ae 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -21,7 +21,6 @@ * Fixed an issue preventing `MGLImageSource`s from drawing on the map when the map is zoomed in and tilted. ([#10677](https://github.com/mapbox/mapbox-gl-native/pull/10677)) * Improved the sharpness of raster tiles on Retina displays. ([#10984](https://github.com/mapbox/mapbox-gl-native/pull/10984)) * Fixed a crash parsing a malformed style. ([#11001](https://github.com/mapbox/mapbox-gl-native/pull/11001)) -* Added the `MGLTileSourceOptionTileCoordinateBounds` option to create an `MGLTileSource` that only supplies tiles within a specific geographic bounding box. ([#11141](https://github.com/mapbox/mapbox-gl-native/pull/11141)) ### Map snapshots @@ -32,7 +31,6 @@ * Added Danish and Hebrew localizations. ([#10967](https://github.com/mapbox/mapbox-gl-native/pull/10967), [#11136](https://github.com/mapbox/mapbox-gl-native/pull/11134)) * Feature querying results now account for the `MGLSymbolStyleLayer.circleStrokeWidth` property. ([#10897](https://github.com/mapbox/mapbox-gl-native/pull/10897)) -* Added a Hebrew localization. ([#10967](https://github.com/mapbox/mapbox-gl-native/pull/10967)) ## v0.6.1 - January 16, 2018 -- cgit v1.2.1 From 604931247e8c78570058981ea17c034947c4430f Mon Sep 17 00:00:00 2001 From: Pablo Guardiola Date: Fri, 16 Feb 2018 22:12:45 +0100 Subject: [android] initialize events when creating mapbox instance (#11211) --- .../src/main/java/com/mapbox/mapboxsdk/Mapbox.java | 2 ++ .../src/main/java/com/mapbox/mapboxsdk/maps/Events.java | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java index 536f5d02ab..e963993ae3 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java @@ -13,6 +13,7 @@ import com.mapbox.android.core.location.LocationEnginePriority; import com.mapbox.android.core.location.LocationEngineProvider; import com.mapbox.mapboxsdk.constants.MapboxConstants; import com.mapbox.mapboxsdk.exceptions.MapboxConfigurationException; +import com.mapbox.mapboxsdk.maps.Events; import com.mapbox.mapboxsdk.net.ConnectivityReceiver; /** @@ -52,6 +53,7 @@ public final class Mapbox { INSTANCE = new Mapbox(appContext, accessToken, locationEngine); locationEngine.setPriority(LocationEnginePriority.NO_POWER); + Events.initiliaze(); ConnectivityReceiver.instance(appContext); } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Events.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Events.java index a68d4763ac..a4f6b233cf 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Events.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Events.java @@ -6,7 +6,7 @@ import com.mapbox.android.telemetry.TelemetryEnabler; import com.mapbox.mapboxsdk.BuildConfig; import com.mapbox.mapboxsdk.Mapbox; -class Events { +public class Events { static final String TWO_FINGER_TAP = "TwoFingerTap"; static final String DOUBLE_TAP = "DoubleTap"; static final String SINGLE_TAP = "SingleTap"; @@ -26,6 +26,10 @@ class Events { } } + public static void initiliaze() { + obtainTelemetry(); + } + private static class EventsHolder { private static final Events INSTANCE = new Events(); } -- cgit v1.2.1 From 9459cf6a91f98266f77960a8cf328cb9c0ec3034 Mon Sep 17 00:00:00 2001 From: Jordan Kiley Date: Fri, 16 Feb 2018 16:20:08 -0800 Subject: [ios, macos] Mark deprecated methods as unavailable (#11205) Fixes #10735 --- platform/darwin/src/MGLAccountManager.h | 2 +- platform/darwin/src/MGLAccountManager.m | 5 -- platform/darwin/src/MGLOfflineStorage.h | 8 +-- platform/darwin/src/MGLOfflineStorage.mm | 4 -- platform/darwin/src/MGLStyle.h | 59 ++++--------------- platform/darwin/src/MGLStyle.mm | 83 +-------------------------- platform/darwin/test/MGLStyleTests.mm | 30 +--------- platform/default/mbgl/util/default_styles.hpp | 3 - platform/ios/CHANGELOG.md | 1 + platform/ios/app/MBXViewController.m | 6 +- platform/ios/src/MGLMapView.h | 26 +++------ platform/ios/src/MGLMapView.mm | 45 --------------- platform/macos/CHANGELOG.md | 1 + platform/macos/app/Base.lproj/MainMenu.xib | 10 ---- platform/macos/app/Base.lproj/MapDocument.xib | 17 ++---- platform/macos/app/MapDocument.m | 14 ----- 16 files changed, 36 insertions(+), 278 deletions(-) diff --git a/platform/darwin/src/MGLAccountManager.h b/platform/darwin/src/MGLAccountManager.h index 741cc323cb..b691c4c906 100644 --- a/platform/darwin/src/MGLAccountManager.h +++ b/platform/darwin/src/MGLAccountManager.h @@ -44,7 +44,7 @@ MGL_EXPORT */ + (nullable NSString *)accessToken; -+ (BOOL)mapboxMetricsEnabledSettingShownInApp __attribute__((deprecated("Telemetry settings are now always shown in the ℹ️ menu."))); ++ (BOOL)mapboxMetricsEnabledSettingShownInApp __attribute__((unavailable("Telemetry settings are now always shown in the ℹ️ menu."))); @end diff --git a/platform/darwin/src/MGLAccountManager.m b/platform/darwin/src/MGLAccountManager.m index 729caeaa31..5bd96ce337 100644 --- a/platform/darwin/src/MGLAccountManager.m +++ b/platform/darwin/src/MGLAccountManager.m @@ -54,11 +54,6 @@ return _sharedManager; } -+ (BOOL)mapboxMetricsEnabledSettingShownInApp { - NSLog(@"mapboxMetricsEnabledSettingShownInApp is no longer necessary; the Mapbox Maps SDK for iOS has changed to always provide a telemetry setting in-app."); - return YES; -} - + (void)setAccessToken:(NSString *)accessToken { accessToken = [accessToken stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]]; diff --git a/platform/darwin/src/MGLOfflineStorage.h b/platform/darwin/src/MGLOfflineStorage.h index b009f893b3..b3c9a0ede0 100644 --- a/platform/darwin/src/MGLOfflineStorage.h +++ b/platform/darwin/src/MGLOfflineStorage.h @@ -70,7 +70,7 @@ typedef NSString *MGLOfflinePackUserInfoKey NS_EXTENSIBLE_STRING_ENUM; */ extern MGL_EXPORT const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyState; -extern MGL_EXPORT NSString * const MGLOfflinePackStateUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyState"))); +extern MGL_EXPORT NSString * const MGLOfflinePackStateUserInfoKey __attribute__((unavailable("Use MGLOfflinePackUserInfoKeyState"))); /** The key for an `NSValue` object that indicates an offline pack’s current @@ -81,7 +81,7 @@ extern MGL_EXPORT NSString * const MGLOfflinePackStateUserInfoKey __attribute__( */ extern MGL_EXPORT const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyProgress; -extern MGL_EXPORT NSString * const MGLOfflinePackProgressUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyProgress"))); +extern MGL_EXPORT NSString * const MGLOfflinePackProgressUserInfoKey __attribute__((unavailable("Use MGLOfflinePackUserInfoKeyProgress"))); /** The key for an `NSError` object that is encountered in the course of @@ -91,7 +91,7 @@ extern MGL_EXPORT NSString * const MGLOfflinePackProgressUserInfoKey __attribute */ extern MGL_EXPORT const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyError; -extern MGL_EXPORT NSString * const MGLOfflinePackErrorUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyError"))); +extern MGL_EXPORT NSString * const MGLOfflinePackErrorUserInfoKey __attribute__((unavailable("Use MGLOfflinePackUserInfoKeyError"))); /** The key for an `NSNumber` object that indicates the maximum number of @@ -103,7 +103,7 @@ extern MGL_EXPORT NSString * const MGLOfflinePackErrorUserInfoKey __attribute__( */ extern MGL_EXPORT const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyMaximumCount; -extern MGL_EXPORT NSString * const MGLOfflinePackMaximumCountUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyMaximumCount"))); +extern MGL_EXPORT NSString * const MGLOfflinePackMaximumCountUserInfoKey __attribute__((unavailable("Use MGLOfflinePackUserInfoKeyMaximumCount"))); /** A block to be called once an offline pack has been completely created and diff --git a/platform/darwin/src/MGLOfflineStorage.mm b/platform/darwin/src/MGLOfflineStorage.mm index 7085aa58e5..4d999144e8 100644 --- a/platform/darwin/src/MGLOfflineStorage.mm +++ b/platform/darwin/src/MGLOfflineStorage.mm @@ -26,13 +26,9 @@ const NSNotificationName MGLOfflinePackErrorNotification = @"MGLOfflinePackError const NSNotificationName MGLOfflinePackMaximumMapboxTilesReachedNotification = @"MGLOfflinePackMaximumMapboxTilesReached"; const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyState = @"State"; -NSString * const MGLOfflinePackStateUserInfoKey = MGLOfflinePackUserInfoKeyState; const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyProgress = @"Progress"; -NSString * const MGLOfflinePackProgressUserInfoKey = MGLOfflinePackUserInfoKeyProgress; const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyError = @"Error"; -NSString * const MGLOfflinePackErrorUserInfoKey = MGLOfflinePackUserInfoKeyError; const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyMaximumCount = @"MaximumCount"; -NSString * const MGLOfflinePackMaximumCountUserInfoKey = MGLOfflinePackUserInfoKeyMaximumCount; @interface MGLOfflineStorage () diff --git a/platform/darwin/src/MGLStyle.h b/platform/darwin/src/MGLStyle.h index 0b360de8fc..eb7554534f 100644 --- a/platform/darwin/src/MGLStyle.h +++ b/platform/darwin/src/MGLStyle.h @@ -83,13 +83,7 @@ MGL_EXPORT */ + (NSURL *)streetsStyleURLWithVersion:(NSInteger)version; -/** - Returns the URL to version 8 of the - Mapbox Emerald style. - - Emerald is a tactile style with subtle textures and dramatic hillshading. - */ -+ (NSURL *)emeraldStyleURL __attribute__((deprecated("Create an NSURL object with the string “mapbox://styles/mapbox/emerald-v8”."))); ++ (NSURL *)emeraldStyleURL __attribute__((unavailable("Create an NSURL object with the string “mapbox://styles/mapbox/emerald-v8”."))); /** Returns the URL to the current version of the @@ -191,16 +185,8 @@ MGL_EXPORT */ + (NSURL *)satelliteStyleURLWithVersion:(NSInteger)version; -/** - Returns the URL to version 8 of the - Mapbox Satellite Streets - style. - Satellite Streets combines the high-resolution satellite and aerial imagery of - Mapbox Satellite with unobtrusive labels and translucent roads from Mapbox - Streets. - */ -+ (NSURL *)hybridStyleURL __attribute__((deprecated("Use -satelliteStreetsStyleURL."))); ++ (NSURL *)hybridStyleURL __attribute__((unavailable("Use -satelliteStreetsStyleURL."))); /** Returns the URL to the current version of the @@ -232,39 +218,14 @@ MGL_EXPORT */ + (NSURL *)satelliteStreetsStyleURLWithVersion:(NSInteger)version; -/** - Returns the URL to version 2 of the - Mapbox Traffic Day - style. - - */ -+ (NSURL *)trafficDayStyleURL __attribute__((deprecated("Create an NSURL object with the string “mapbox://styles/mapbox/traffic-day-v2”."))); -/** - Returns the URL to the given version of the - Mapbox Traffic Day - style as of publication. - - @param version A specific version of the style. - */ -+ (NSURL *)trafficDayStyleURLWithVersion:(NSInteger)version __attribute__((deprecated("Create an NSURL object with the string “mapbox://styles/mapbox/traffic-day-v2”.")));; ++ (NSURL *)trafficDayStyleURL __attribute__((unavailable("Create an NSURL object with the string “mapbox://styles/mapbox/traffic-day-v2”."))); -/** - Returns the URL to the version 2 of the - Mapbox Traffic Night - style. ++ (NSURL *)trafficDayStyleURLWithVersion:(NSInteger)version __attribute__((unavailable("Create an NSURL object with the string “mapbox://styles/mapbox/traffic-day-v2”.")));; - */ -+ (NSURL *)trafficNightStyleURL __attribute__((deprecated("Create an NSURL object with the string “mapbox://styles/mapbox/traffic-night-v2”."))); ++ (NSURL *)trafficNightStyleURL __attribute__((unavailable("Create an NSURL object with the string “mapbox://styles/mapbox/traffic-night-v2”."))); -/** - Returns the URL to to the version 2 of the - Mapbox Traffic Night - style as of publication. - - @param version A specific version of the style. - */ -+ (NSURL *)trafficNightStyleURLWithVersion:(NSInteger)version __attribute__((deprecated("Create an NSURL object with the string “mapbox://styles/mapbox/traffic-night-v2”."))); ++ (NSURL *)trafficNightStyleURLWithVersion:(NSInteger)version __attribute__((unavailable("Create an NSURL object with the string “mapbox://styles/mapbox/traffic-night-v2”."))); #pragma mark Accessing Metadata About the Style @@ -458,22 +419,22 @@ MGL_EXPORT /** Support for style classes has been removed. This property always returns an empty array. */ -@property (nonatomic) NS_ARRAY_OF(NSString *) *styleClasses __attribute__((deprecated("This property is non-functional."))); +@property (nonatomic) NS_ARRAY_OF(NSString *) *styleClasses __attribute__((unavailable("This property is non-functional."))); /** Support for style classes has been removed. This method always returns NO. */ -- (BOOL)hasStyleClass:(NSString *)styleClass __attribute__((deprecated("This method is non-functional."))); +- (BOOL)hasStyleClass:(NSString *)styleClass __attribute__((unavailable("This method is non-functional."))); /** Support for style classes has been removed. This method is a no-op. */ -- (void)addStyleClass:(NSString *)styleClass __attribute__((deprecated("This method is non-functional."))); +- (void)addStyleClass:(NSString *)styleClass __attribute__((unavailable("This method is non-functional."))); /** Support for style classes has been removed. This method is a no-op. */ -- (void)removeStyleClass:(NSString *)styleClass __attribute__((deprecated("This method is non-functional."))); +- (void)removeStyleClass:(NSString *)styleClass __attribute__((unavailable("This method is non-functional."))); #pragma mark Managing a Style’s Images diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm index f6fc5533be..199f6c2e02 100644 --- a/platform/darwin/src/MGLStyle.mm +++ b/platform/darwin/src/MGLStyle.mm @@ -116,58 +116,9 @@ MGL_DEFINE_STYLE(satelliteStreets, satellite-streets) // Make sure all the styles listed in mbgl::util::default_styles::orderedStyles // are defined above and also declared in MGLStyle.h. -static_assert(8 == mbgl::util::default_styles::numOrderedStyles, +static_assert(6 == mbgl::util::default_styles::numOrderedStyles, "mbgl::util::default_styles::orderedStyles and MGLStyle have different numbers of styles."); -// Hybrid has been renamed Satellite Streets, so the last Hybrid version is hard-coded here. -static NSURL *MGLStyleURL_hybrid; -+ (NSURL *)hybridStyleURL { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - MGLStyleURL_hybrid = [NSURL URLWithString:@"mapbox://styles/mapbox/satellite-hybrid-v8"]; - }); - return MGLStyleURL_hybrid; -} - -// Emerald is no longer getting new versions as a default style, so the current version is hard-coded here. -static NSURL *MGLStyleURL_emerald; -+ (NSURL *)emeraldStyleURL { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - MGLStyleURL_emerald = [NSURL URLWithString:@"mapbox://styles/mapbox/emerald-v8"]; - }); - return MGLStyleURL_emerald; -} - -// Traffic Day is no longer getting new versions as a default style, so the current version is hard-coded here. -static NSURL *MGLStyleURL_trafficDay; -+ (NSURL *)trafficDayStyleURL { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - MGLStyleURL_trafficDay = [NSURL URLWithString:@"mapbox://styles/mapbox/traffic-day-v2"]; - }); - return MGLStyleURL_trafficDay; -} - -+ (NSURL *)trafficDayStyleURLWithVersion:(NSInteger)version { - return [NSURL URLWithString:[@"mapbox://styles/mapbox/traffic-day-v" stringByAppendingFormat:@"%li", (long)version]]; -} - -// Traffic Night is no longer getting new versions as a default style, so the current version is hard-coded here. -static NSURL *MGLStyleURL_trafficNight; -+ (NSURL *)trafficNightStyleURL { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - MGLStyleURL_trafficNight = [NSURL URLWithString:@"mapbox://styles/mapbox/traffic-night-v2"]; - }); - return MGLStyleURL_trafficNight; -} - -+ (NSURL *)trafficNightStyleURLWithVersion:(NSInteger)version { - return [NSURL URLWithString:[@"mapbox://styles/mapbox/traffic-night-v" stringByAppendingFormat:@"%li", (long)version]]; -} - - #pragma mark - - (instancetype)initWithRawStyle:(mbgl::style::Style *)rawStyle mapView:(MGLMapView *)mapView { @@ -534,38 +485,6 @@ static NSURL *MGLStyleURL_trafficNight; [self didChangeValueForKey:@"layers"]; } -#pragma mark Style classes - -- (NS_ARRAY_OF(NSString *) *)styleClasses -{ - return @[]; -} - -- (void)setStyleClasses:(NS_ARRAY_OF(NSString *) *)appliedClasses -{ -} - -- (void)setStyleClasses:(NS_ARRAY_OF(NSString *) *)appliedClasses transitionDuration:(NSTimeInterval)transitionDuration -{ -} - -- (NSUInteger)countOfStyleClasses { - return 0; -} - -- (BOOL)hasStyleClass:(NSString *)styleClass -{ - return NO; -} - -- (void)addStyleClass:(NSString *)styleClass -{ -} - -- (void)removeStyleClass:(NSString *)styleClass -{ -} - #pragma mark Style images - (void)setImage:(MGLImage *)image forName:(NSString *)name diff --git a/platform/darwin/test/MGLStyleTests.mm b/platform/darwin/test/MGLStyleTests.mm index 8f610e338c..95051cfae0 100644 --- a/platform/darwin/test/MGLStyleTests.mm +++ b/platform/darwin/test/MGLStyleTests.mm @@ -64,12 +64,6 @@ XCTAssertEqualObjects([MGLStyle darkStyleURL].absoluteString, @(mbgl::util::default_styles::dark.url)); XCTAssertEqualObjects([MGLStyle satelliteStyleURL].absoluteString, @(mbgl::util::default_styles::satellite.url)); XCTAssertEqualObjects([MGLStyle satelliteStreetsStyleURL].absoluteString, @(mbgl::util::default_styles::satelliteStreets.url)); - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - XCTAssertEqualObjects([MGLStyle emeraldStyleURL].absoluteString, @"mapbox://styles/mapbox/emerald-v8"); - XCTAssertEqualObjects([MGLStyle hybridStyleURL].absoluteString, @"mapbox://styles/mapbox/satellite-hybrid-v8"); -#pragma clang diagnostic pop } - (void)testVersionedStyleURLs { @@ -99,19 +93,8 @@ @(mbgl::util::default_styles::satelliteStreets.url)); XCTAssertEqualObjects([MGLStyle satelliteStreetsStyleURLWithVersion:99].absoluteString, @"mapbox://styles/mapbox/satellite-streets-v99"); -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - XCTAssertEqualObjects([MGLStyle trafficDayStyleURLWithVersion:mbgl::util::default_styles::trafficDay.currentVersion].absoluteString, - @(mbgl::util::default_styles::trafficDay.url)); - XCTAssertEqualObjects([MGLStyle trafficDayStyleURLWithVersion:99].absoluteString, - @"mapbox://styles/mapbox/traffic-day-v99"); - XCTAssertEqualObjects([MGLStyle trafficNightStyleURLWithVersion:mbgl::util::default_styles::trafficNight.currentVersion].absoluteString, - @(mbgl::util::default_styles::trafficNight.url)); - XCTAssertEqualObjects([MGLStyle trafficNightStyleURLWithVersion:99].absoluteString, - @"mapbox://styles/mapbox/traffic-night-v99"); -#pragma clang diagnostic pop - - static_assert(8 == mbgl::util::default_styles::numOrderedStyles, + + static_assert(6 == mbgl::util::default_styles::numOrderedStyles, "MGLStyleTests isn’t testing all the styles in mbgl::util::default_styles."); } @@ -143,7 +126,7 @@ NSString *styleHeader = self.stringWithContentsOfStyleHeader; NSError *versionedMethodError; - NSString *versionedMethodExpressionString = @(R"RE(^\+\s*\(NSURL\s*\*\s*\)\s*\w+StyleURLWithVersion\s*:\s*\(\s*NSInteger\s*\)\s*version\s*\b)RE"); + NSString *versionedMethodExpressionString = @(R"RE(^\+\s*\(NSURL\s*\*\s*\)\s*(?!traffic)\w+StyleURLWithVersion\s*:\s*\(\s*NSInteger\s*\)\s*version\s*\b)RE"); NSRegularExpression *versionedMethodExpression = [NSRegularExpression regularExpressionWithPattern:versionedMethodExpressionString options:NSRegularExpressionAnchorsMatchLines error:&versionedMethodError]; XCTAssertNil(versionedMethodError, @"Error compiling regular expression to search for versioned methods."); NSUInteger numVersionedMethodDeclarations = [versionedMethodExpression numberOfMatchesInString:styleHeader options:0 range:NSMakeRange(0, styleHeader.length)]; @@ -383,13 +366,6 @@ return styleHeader; } -- (void)testClasses { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - XCTAssertEqual(self.style.styleClasses.count, 0); -#pragma clang diagnostic pop -} - - (void)testImages { NSString *imageName = @"TrackingLocationMask"; #if TARGET_OS_IPHONE diff --git a/platform/default/mbgl/util/default_styles.hpp b/platform/default/mbgl/util/default_styles.hpp index 43dafb8083..13f08252a7 100644 --- a/platform/default/mbgl/util/default_styles.hpp +++ b/platform/default/mbgl/util/default_styles.hpp @@ -19,12 +19,9 @@ constexpr const DefaultStyle light = { "mapbox://styles/mapbox/light- constexpr const DefaultStyle dark = { "mapbox://styles/mapbox/dark-v9", "Dark", 9 }; constexpr const DefaultStyle satellite = { "mapbox://styles/mapbox/satellite-v9", "Satellite", 9 }; constexpr const DefaultStyle satelliteStreets = { "mapbox://styles/mapbox/satellite-streets-v10", "Satellite Streets", 10 }; -constexpr const DefaultStyle trafficDay = { "mapbox://styles/mapbox/traffic-day-v2", "Traffic Day", 2 }; -constexpr const DefaultStyle trafficNight = { "mapbox://styles/mapbox/traffic-night-v2", "Traffic Night", 2 }; const DefaultStyle orderedStyles[] = { streets, outdoors, light, dark, satellite, satelliteStreets, - trafficDay, trafficNight, }; const size_t numOrderedStyles = sizeof(orderedStyles) / sizeof(DefaultStyle); diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index cadbe9dd39..c11fc63ebd 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -8,6 +8,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * Removed support for 32-bit simulators. ([#10962](https://github.com/mapbox/mapbox-gl-native/pull/10962)) * Added Danish and Hebrew localizations. ([#10967](https://github.com/mapbox/mapbox-gl-native/pull/10967), [#11136](https://github.com/mapbox/mapbox-gl-native/pull/11134)) +* Removed methods, properties, and constants that had been deprecated as of v3.7.4. ([#11205](https://github.com/mapbox/mapbox-gl-native/pull/11205)) ### Styles and rendering diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index 282dc901d6..7c8e9fe570 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -1600,8 +1600,6 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { @"Dark", @"Satellite", @"Satellite Streets", - @"Traffic Day", - @"Traffic Night", ]; styleURLs = @[ [MGLStyle streetsStyleURL], @@ -1609,9 +1607,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { [MGLStyle lightStyleURL], [MGLStyle darkStyleURL], [MGLStyle satelliteStyleURL], - [MGLStyle satelliteStreetsStyleURL], - [NSURL URLWithString:@"mapbox://styles/mapbox/traffic-day-v2"], - [NSURL URLWithString:@"mapbox://styles/mapbox/traffic-night-v2"], + [MGLStyle satelliteStreetsStyleURL] ]; NSAssert(styleNames.count == styleURLs.count, @"Style names and URLs don’t match."); diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h index 3c5aa2c122..a4dcc4cdbf 100644 --- a/platform/ios/src/MGLMapView.h +++ b/platform/ios/src/MGLMapView.h @@ -189,13 +189,7 @@ MGL_EXPORT IB_DESIGNABLE */ @property (nonatomic, readonly, nullable) MGLStyle *style; -/** - URLs of the styles bundled with the library. - - @deprecated Call the relevant class method of `MGLStyle` for the URL of a - particular default style. - */ -@property (nonatomic, readonly) NS_ARRAY_OF(NSURL *) *bundledStyleURLs __attribute__((deprecated("Call the relevant class method of MGLStyle for the URL of a particular default style."))); +@property (nonatomic, readonly) NS_ARRAY_OF(NSURL *) *bundledStyleURLs __attribute__((unavailable("Call the relevant class method of MGLStyle for the URL of a particular default style."))); /** URL of the style currently displayed in the receiver. @@ -283,17 +277,13 @@ MGL_EXPORT IB_DESIGNABLE */ - (IBAction)showAttribution:(id)sender; -/// :nodoc: Support for style classes has been removed. This property always returns an empty array. -@property (nonatomic) NS_ARRAY_OF(NSString *) *styleClasses __attribute__((deprecated("This property is non-functional."))); +@property (nonatomic) NS_ARRAY_OF(NSString *) *styleClasses __attribute__((unavailable("This property is non-functional."))); -/// :nodoc: Support for style classes has been removed. This property always returns NO. -- (BOOL)hasStyleClass:(NSString *)styleClass __attribute__((deprecated("This method is non-functional."))); +- (BOOL)hasStyleClass:(NSString *)styleClass __attribute__((unavailable("This method is non-functional."))); -/// :nodoc: Support for style classes has been removed. This property is a no-op. -- (void)addStyleClass:(NSString *)styleClass __attribute__((deprecated("This method is non-functional."))); +- (void)addStyleClass:(NSString *)styleClass __attribute__((unavailable("This method is non-functional."))); -/// :nodoc: Support for style classes has been removed. This property is a no-op. -- (void)removeStyleClass:(NSString *)styleClass __attribute__((deprecated("This method is non-functional."))); +- (void)removeStyleClass:(NSString *)styleClass __attribute__((unavailable("This method is non-functional."))); #pragma mark Displaying the User’s Location @@ -1462,11 +1452,11 @@ MGL_EXPORT IB_DESIGNABLE */ @property (nonatomic) MGLMapDebugMaskOptions debugMask; -@property (nonatomic, getter=isDebugActive) BOOL debugActive __attribute__((deprecated("Use -debugMask and -setDebugMask:."))); +@property (nonatomic, getter=isDebugActive) BOOL debugActive __attribute__((unavailable("Use -debugMask and -setDebugMask:."))); -- (void)toggleDebug __attribute__((deprecated("Use -setDebugMask:."))); +- (void)toggleDebug __attribute__((unavailable("Use -setDebugMask:."))); -- (void)emptyMemoryCache __attribute__((deprecated)); +- (void)emptyMemoryCache __attribute__((unavailable)); @end diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 79b02bef31..72fa4613fc 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -2288,16 +2288,6 @@ public: MGLMapDebugCollisionBoxesMask) : 0; } -- (BOOL)isDebugActive -{ - return self.debugMask; -} - -- (void)toggleDebug -{ - self.debugActive = !self.debugActive; -} - - (void)resetNorth { [self resetNorthAnimated:YES]; @@ -2320,11 +2310,6 @@ public: heading:heading]; } -- (void)emptyMemoryCache -{ - _rendererFrontend->reduceMemoryUse(); -} - - (void)setZoomEnabled:(BOOL)zoomEnabled { _zoomEnabled = zoomEnabled; @@ -3519,36 +3504,6 @@ public: __PRETTY_FUNCTION__, styleID]; } -- (NS_ARRAY_OF(NSString *) *)styleClasses -{ - return [self.style styleClasses]; -} - -- (void)setStyleClasses:(NS_ARRAY_OF(NSString *) *)appliedClasses -{ - [self setStyleClasses:appliedClasses transitionDuration:0]; -} - -- (void)setStyleClasses:(NS_ARRAY_OF(NSString *) *)appliedClasses transitionDuration:(NSTimeInterval)transitionDuration -{ - [self.style setStyleClasses:appliedClasses transitionDuration:transitionDuration]; -} - -- (BOOL)hasStyleClass:(NSString *)styleClass -{ - return [self.style hasStyleClass:styleClass]; -} - -- (void)addStyleClass:(NSString *)styleClass -{ - [self.style addStyleClass:styleClass]; -} - -- (void)removeStyleClass:(NSString *)styleClass -{ - [self.style removeStyleClass:styleClass]; -} - #pragma mark - Annotations - - (nullable NS_ARRAY_OF(id ) *)annotations diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index 316e09b5ae..06fedf7cc7 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -31,6 +31,7 @@ * Added Danish and Hebrew localizations. ([#10967](https://github.com/mapbox/mapbox-gl-native/pull/10967), [#11136](https://github.com/mapbox/mapbox-gl-native/pull/11134)) * Feature querying results now account for the `MGLSymbolStyleLayer.circleStrokeWidth` property. ([#10897](https://github.com/mapbox/mapbox-gl-native/pull/10897)) +* Removed methods, properties, and constants that had been deprecated as of v0.6.1. ([#11205](https://github.com/mapbox/mapbox-gl-native/pull/11205)) ## v0.6.1 - January 16, 2018 diff --git a/platform/macos/app/Base.lproj/MainMenu.xib b/platform/macos/app/Base.lproj/MainMenu.xib index 72e9c5a189..4cf8d87653 100644 --- a/platform/macos/app/Base.lproj/MainMenu.xib +++ b/platform/macos/app/Base.lproj/MainMenu.xib @@ -402,16 +402,6 @@ - - - - - - - - - - diff --git a/platform/macos/app/Base.lproj/MapDocument.xib b/platform/macos/app/Base.lproj/MapDocument.xib index 0394f38533..5d0525a29d 100644 --- a/platform/macos/app/Base.lproj/MapDocument.xib +++ b/platform/macos/app/Base.lproj/MapDocument.xib @@ -1,7 +1,8 @@ - + - + + @@ -48,7 +49,7 @@ - + @@ -70,7 +71,7 @@ - + @@ -87,7 +88,7 @@ - + @@ -204,12 +205,6 @@ - - - - - - diff --git a/platform/macos/app/MapDocument.m b/platform/macos/app/MapDocument.m index 7d39f93347..03557caca2 100644 --- a/platform/macos/app/MapDocument.m +++ b/platform/macos/app/MapDocument.m @@ -265,12 +265,6 @@ NS_ARRAY_OF(id ) *MBXFlattenedShapes(NS_ARRAY_OF(id ) *MBXFlattenedShapes(NS_ARRAY_OF(id ) *MBXFlattenedShapes(NS_ARRAY_OF(id Date: Mon, 19 Feb 2018 10:25:11 -0500 Subject: [android] incorrect latlngBounds in the VisibleRegion with map is rotated smallest bounding box for 4 points cannot (#11226) be created using LatLngBounds.fromLatLngs() as the order matters in that method and that does not work for rotated map --- .../src/main/java/com/mapbox/mapboxsdk/maps/Projection.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java index 16c73b1ca5..ae559189ad 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java @@ -104,11 +104,12 @@ public class Projection { LatLng bottomLeft = fromScreenLocation(new PointF(left, bottom)); return new VisibleRegion(topLeft, topRight, bottomLeft, bottomRight, - LatLngBounds.from( - topRight.getLatitude(), - topRight.getLongitude(), - bottomLeft.getLatitude(), - bottomLeft.getLongitude()) + new LatLngBounds.Builder() + .include(topRight) + .include(bottomLeft) + .include(bottomRight) + .include(topLeft) + .build() ); } -- cgit v1.2.1 From dd822e8fde1cc18a0cac999d4e5f879129383981 Mon Sep 17 00:00:00 2001 From: Osana Babayan <32496536+osana@users.noreply.github.com> Date: Tue, 20 Feb 2018 09:23:24 -0500 Subject: [android] missing DeleteLocalRef --- .../android/src/geojson/feature_collection.cpp | 24 ++++++++++++--------- platform/android/src/geojson/line_string.cpp | 3 ++- platform/android/src/geojson/multi_polygon.cpp | 2 +- platform/android/src/geojson/point.cpp | 25 ++++++++++++++-------- 4 files changed, 33 insertions(+), 21 deletions(-) diff --git a/platform/android/src/geojson/feature_collection.cpp b/platform/android/src/geojson/feature_collection.cpp index 59f1e317e6..18a41d48fa 100644 --- a/platform/android/src/geojson/feature_collection.cpp +++ b/platform/android/src/geojson/feature_collection.cpp @@ -7,19 +7,23 @@ namespace android { namespace geojson { mbgl::FeatureCollection FeatureCollection::convert(jni::JNIEnv& env, jni::Object jCollection) { - auto jFeatureList = FeatureCollection::features(env, jCollection); - auto jFeatures = java::util::List::toArray(env, jFeatureList); - auto size = size_t(jFeatures.Length(env)); - auto collection = mbgl::FeatureCollection(); - collection.reserve(size); - for (size_t i = 0; i < size; i++) { - auto jFeature = jFeatures.Get(env, i); - collection.push_back(Feature::convert(env, jFeature)); - jni::DeleteLocalRef(env, jFeature); - } + if (jCollection) { + auto jFeatureList = FeatureCollection::features(env, jCollection); + auto jFeatures = java::util::List::toArray(env, jFeatureList); + auto size = size_t(jFeatures.Length(env)); + collection.reserve(size); + for (size_t i = 0; i < size; i++) { + auto jFeature = jFeatures.Get(env, i); + collection.push_back(Feature::convert(env, jFeature)); + jni::DeleteLocalRef(env, jFeature); + } + + jni::DeleteLocalRef(env, jFeatures); + jni::DeleteLocalRef(env, jFeatureList); + } return collection; } diff --git a/platform/android/src/geojson/line_string.cpp b/platform/android/src/geojson/line_string.cpp index 9e99c72c4c..8eebd53550 100644 --- a/platform/android/src/geojson/line_string.cpp +++ b/platform/android/src/geojson/line_string.cpp @@ -23,8 +23,9 @@ mapbox::geojson::line_string LineString::convert(jni::JNIEnv &env, jni::Object(env, jPointList); - auto size = jPointArray.Length(env); + lineString.reserve(size); + for (std::size_t i = 0; i < size; i++) { auto jPoint = jPointArray.Get(env, i); lineString.push_back(Point::convert(env, jPoint)); diff --git a/platform/android/src/geojson/multi_polygon.cpp b/platform/android/src/geojson/multi_polygon.cpp index f4eb0f6b2a..aadba8c8a6 100644 --- a/platform/android/src/geojson/multi_polygon.cpp +++ b/platform/android/src/geojson/multi_polygon.cpp @@ -22,8 +22,8 @@ mapbox::geojson::multi_polygon MultiPolygon::convert(jni::JNIEnv &env, jni::Obje jni::DeleteLocalRef(env, jPositionListsList); } - jni::DeleteLocalRef(env, jPointListsListList); jni::DeleteLocalRef(env, jPointListsListArray); + jni::DeleteLocalRef(env, jPointListsListList); } return multiPolygon; diff --git a/platform/android/src/geojson/point.cpp b/platform/android/src/geojson/point.cpp index 5feb1b8521..e95376cd2e 100644 --- a/platform/android/src/geojson/point.cpp +++ b/platform/android/src/geojson/point.cpp @@ -1,6 +1,7 @@ #include "point.hpp" #include "../java/util.hpp" #include "../java_types.hpp" +#include "../style/value.hpp" namespace mbgl { namespace android { @@ -19,17 +20,23 @@ mapbox::geojson::point Point::convert(jni::JNIEnv &env, jni::Object jPoin } mapbox::geojson::point Point::convert(jni::JNIEnv &env, jni::Object*/> jDoubleList) { - auto jDoubleArray = java::util::List::toArray(env, jDoubleList); + mapbox::geojson::point point; + + if (jDoubleList) { + auto jDoubleArray = java::util::List::toArray(env, jDoubleList); - jni::jdouble lon = jni::CallMethod(env, - jDoubleArray.Get(env, 0), - *java::Number::doubleValueMethodId); - jni::jdouble lat = jni::CallMethod(env, - jDoubleArray.Get(env, 1), - *java::Number::doubleValueMethodId); - mapbox::geojson::point point(lon, lat); - jni::DeleteLocalRef(env, jDoubleArray); + auto lonObject = jDoubleArray.Get(env, 0); + auto latObject = jDoubleArray.Get(env, 1); + point.x = jni::CallMethod(env, lonObject, + *java::Number::doubleValueMethodId); + point.y = jni::CallMethod(env, latObject, + *java::Number::doubleValueMethodId); + + jni::DeleteLocalRef(env, lonObject); + jni::DeleteLocalRef(env, latObject); + jni::DeleteLocalRef(env, jDoubleArray); + } return point; } -- cgit v1.2.1 From 2e0377b02eb5f590fcd76b4b791850d2f3c25ac1 Mon Sep 17 00:00:00 2001 From: Langston Smith Date: Tue, 20 Feb 2018 08:28:56 -0600 Subject: method name typo fix (#11245) --- .../MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java | 2 +- .../src/main/java/com/mapbox/mapboxsdk/maps/Events.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java index e963993ae3..db89f5efbb 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java @@ -53,7 +53,7 @@ public final class Mapbox { INSTANCE = new Mapbox(appContext, accessToken, locationEngine); locationEngine.setPriority(LocationEnginePriority.NO_POWER); - Events.initiliaze(); + Events.initialize(); ConnectivityReceiver.instance(appContext); } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Events.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Events.java index a4f6b233cf..7ba592f121 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Events.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Events.java @@ -26,7 +26,7 @@ public class Events { } } - public static void initiliaze() { + public static void initialize() { obtainTelemetry(); } -- cgit v1.2.1 From 2e3145db475e296552db9d1c65c483b3f51b5237 Mon Sep 17 00:00:00 2001 From: Jesse Bounds Date: Tue, 20 Feb 2018 06:54:11 -0800 Subject: Replace embedded telem implementation with mapbox-mobile-events library (#10698) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [ios] Introduce mobile events dependency This adds the mobile events dependency including the events library's namespaced header file so that the related compiled symbols are prefixed to make them specific to the maps SDK. A pre-compiled header file is added so that the namespaced header file is added in all places where it is needed (most importantly every events library file). * [ios] Use new events library for telemetry events This makes the following significant changes: Refactors the MGLMapboxEvents singleton to delegate internally to an instance of MMEEventsManager that it keeps for itself. The MGLMapboxEvents public API is refactored to reflect this. Note: MGLMapboxEvents continues to handle checking for opt out Uses that new events API in MGLMapboxEvents to send all telem events (and turnstile) All embedded certs are removed since the new telem library uses public key info pinning Legacy telemetry utility classes for location and networking are removed since those are implemented in the telem library * [ios] Update submodules initialized by cmake We no longer bring in SMCalloutView as a submodule so it is removed. We now vendor the telemetry events library as a submodule so it is added. * Update mapbox-mobile-events * Update mobile events lib * Set events options with MGL user defaults values For options that historically could be set with user defaults in the Maps SDK, collect them and set the appropriate property values in the new events library. Also, check the existence of two new optional configuration values MGLTelemetryAccessToken and MGLTelemetryBaseURL so that the events endpoint and access token can be configured and the access token can easily be set dynamically and apart from the access token for the maps API. MGLTelemetryBaseURL replaces the legacy MGLTelemetryTestServerURL. This is ok because this value was never intended to be used by client applications. The new name better reflects the fact that the URL can be changed to any backend stack, not just a test server. Because it is possible for the configuration values to be read from user defaults before the events manager is fully set up, this also adds a local cache for the baseURL and accessToken values so that they can be stored and applied once it is time to setup the the events manager. * Update mapbox-mobile-events mapbox-mobile-events was forced pushed to include https://github.com/mapbox/mapbox-events-ios/pull/28 * Rename MGLMapboxEvents singleton access method Manager is not in the name of the class. Just call it an instance. * Update mapbox-mobile-events * Add comments about config value loading * Guard against creating events for IB * Refactor user defaults update handler This updates the handling logic for user defaults to break apart config changes that require a check for pausing or resuming the events lib’s telemetry collection from config changes that can happen with no update to the pause/resume state. It also ports the optimization from https://github.com/mapbox/mapbox-gl-native/pull/10803 so that the call to pause and resume is not performed unless the user defaults store has new values that have not yet been applied to the events library. * Update mapbox-mobile-events * Rename events submodule folder * Fix incorrect events library refs * Update mapbox-mobile-events * Update user user agent id value This value aligns with our schme of {source-sdk-platform} and will be used by the events library in the user agent and vendorid. * Update mapbox-mobile-events Pin to v3.0.0 (d522b18) * Improve code comments * [ios] Fixed a broken file reference to MGLTelemetryConfig. --- .gitmodules | 4 + cmake/mbgl.cmake | 2 +- platform/darwin/src/MGLAccountManager.m | 4 +- platform/ios/ios.xcodeproj/project.pbxproj | 413 ++++++++-- .../ios/resources/api_mapbox_com-digicert_2016.der | Bin 1913 -> 0 bytes .../ios/resources/api_mapbox_com-digicert_2017.der | Bin 2030 -> 0 bytes .../ios/resources/api_mapbox_com-geotrust_2016.der | Bin 1757 -> 0 bytes .../ios/resources/api_mapbox_com-geotrust_2017.der | Bin 1758 -> 0 bytes platform/ios/resources/api_mapbox_staging.der | Bin 1334 -> 0 bytes platform/ios/src/MGLAPIClient.h | 15 - platform/ios/src/MGLAPIClient.m | 202 ----- platform/ios/src/MGLLocationManager.h | 25 - platform/ios/src/MGLLocationManager.m | 175 ----- platform/ios/src/MGLMapView.mm | 41 +- platform/ios/src/MGLMapboxEvents.h | 39 +- platform/ios/src/MGLMapboxEvents.m | 831 +++------------------ platform/ios/src/Mapbox-Prefix.pch | 1 + platform/ios/vendor/mapbox-events-ios | 1 + 18 files changed, 491 insertions(+), 1262 deletions(-) delete mode 100644 platform/ios/resources/api_mapbox_com-digicert_2016.der delete mode 100644 platform/ios/resources/api_mapbox_com-digicert_2017.der delete mode 100644 platform/ios/resources/api_mapbox_com-geotrust_2016.der delete mode 100644 platform/ios/resources/api_mapbox_com-geotrust_2017.der delete mode 100644 platform/ios/resources/api_mapbox_staging.der delete mode 100644 platform/ios/src/MGLAPIClient.h delete mode 100644 platform/ios/src/MGLAPIClient.m delete mode 100644 platform/ios/src/MGLLocationManager.h delete mode 100644 platform/ios/src/MGLLocationManager.m create mode 100644 platform/ios/src/Mapbox-Prefix.pch create mode 160000 platform/ios/vendor/mapbox-events-ios diff --git a/.gitmodules b/.gitmodules index 422fc3930e..e5be61a921 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,7 @@ [submodule "mapbox-gl-js"] path = mapbox-gl-js url = https://github.com/mapbox/mapbox-gl-js.git +[submodule "platform/ios/vendor/mapbox-events-ios"] + path = platform/ios/vendor/mapbox-events-ios + url = https://github.com/mapbox/mapbox-events-ios.git + branch = boundsj-add-namespace-header diff --git a/cmake/mbgl.cmake b/cmake/mbgl.cmake index 3d82899538..f087c32511 100644 --- a/cmake/mbgl.cmake +++ b/cmake/mbgl.cmake @@ -110,7 +110,7 @@ endfunction() if(MBGL_PLATFORM STREQUAL "ios") execute_process( - COMMAND git submodule update --init platform/ios/vendor/SMCalloutView platform/ios/uitest/KIF platform/ios/uitest/OHHTTPStubs + COMMAND git submodule update --init platform/ios/vendor/mapbox-events-ios platform/ios/uitest/KIF platform/ios/uitest/OHHTTPStubs WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") endif() diff --git a/platform/darwin/src/MGLAccountManager.m b/platform/darwin/src/MGLAccountManager.m index 5bd96ce337..73da8ddd63 100644 --- a/platform/darwin/src/MGLAccountManager.m +++ b/platform/darwin/src/MGLAccountManager.m @@ -64,9 +64,7 @@ [MGLAccountManager sharedManager].accessToken = accessToken; #if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - // Update MGLMapboxEvents - // NOTE: This is (likely) the initial setup of MGLMapboxEvents - [MGLMapboxEvents sharedManager]; + [MGLMapboxEvents setupWithAccessToken:accessToken]; #endif } diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index f66aa74965..f19047cdc9 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -187,13 +187,77 @@ 404C26E51D89B877000AA13D /* MGLTileSource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 404C26E11D89B877000AA13D /* MGLTileSource.mm */; }; 404C26E71D89C55D000AA13D /* MGLTileSource_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 404C26E61D89C515000AA13D /* MGLTileSource_Private.h */; }; 404C26E81D89C55D000AA13D /* MGLTileSource_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 404C26E61D89C515000AA13D /* MGLTileSource_Private.h */; }; - 40599F0C1DEE1B7600182B5D /* api_mapbox_staging.der in Resources */ = {isa = PBXBuildFile; fileRef = 40599F001DEE1B2400182B5D /* api_mapbox_staging.der */; }; - 40599F0D1DEE1B7A00182B5D /* api_mapbox_com-digicert_2016.der in Resources */ = {isa = PBXBuildFile; fileRef = 40599F011DEE1B2400182B5D /* api_mapbox_com-digicert_2016.der */; }; - 40599F0E1DEE1B7E00182B5D /* api_mapbox_com-geotrust_2016.der in Resources */ = {isa = PBXBuildFile; fileRef = 40599F021DEE1B2400182B5D /* api_mapbox_com-geotrust_2016.der */; }; + 406E99B91FFEFF1B00D9FFCC /* MMEEventLogReportViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 406E99B11FFEFED500D9FFCC /* MMEEventLogReportViewController.m */; }; + 406E99BA1FFEFF1B00D9FFCC /* MMEEventLogReportViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 406E99B11FFEFED500D9FFCC /* MMEEventLogReportViewController.m */; }; + 406E99BB1FFF006C00D9FFCC /* MMEUINavigation.m in Sources */ = {isa = PBXBuildFile; fileRef = 406E99B21FFEFED500D9FFCC /* MMEUINavigation.m */; }; + 406E99BC1FFF006D00D9FFCC /* MMEUINavigation.m in Sources */ = {isa = PBXBuildFile; fileRef = 406E99B21FFEFED500D9FFCC /* MMEUINavigation.m */; }; + 40834BE61FE05E1800C1BD0D /* CLLocation+MMEMobileEvents.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BC31FE05D6F00C1BD0D /* CLLocation+MMEMobileEvents.m */; }; + 40834BE71FE05E1800C1BD0D /* MMEAPIClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BA51FE05D6B00C1BD0D /* MMEAPIClient.m */; }; + 40834BE81FE05E1800C1BD0D /* MMECategoryLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BC41FE05D6F00C1BD0D /* MMECategoryLoader.m */; }; + 40834BE91FE05E1800C1BD0D /* MMECommonEventData.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BCE1FE05D7100C1BD0D /* MMECommonEventData.m */; }; + 40834BEA1FE05E1800C1BD0D /* MMEConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BC01FE05D6E00C1BD0D /* MMEConstants.m */; }; + 40834BEB1FE05E1800C1BD0D /* MMEDependencyManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BB41FE05D6D00C1BD0D /* MMEDependencyManager.m */; }; + 40834BEC1FE05E1800C1BD0D /* MMEEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BC71FE05D7000C1BD0D /* MMEEvent.m */; }; + 40834BED1FE05E1800C1BD0D /* MMEEventLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BB71FE05D6D00C1BD0D /* MMEEventLogger.m */; }; + 40834BEE1FE05E1800C1BD0D /* MMEEventsConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BB21FE05D6D00C1BD0D /* MMEEventsConfiguration.m */; }; + 40834BEF1FE05E1800C1BD0D /* MMEEventsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BA41FE05D6B00C1BD0D /* MMEEventsManager.m */; }; + 40834BF01FE05E1800C1BD0D /* MMELocationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BB81FE05D6D00C1BD0D /* MMELocationManager.m */; }; + 40834BF11FE05E1800C1BD0D /* MMENSDateWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BBC1FE05D6E00C1BD0D /* MMENSDateWrapper.m */; }; + 40834BF21FE05E1800C1BD0D /* MMENSURLSessionWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BC61FE05D7000C1BD0D /* MMENSURLSessionWrapper.m */; }; + 40834BF31FE05E1800C1BD0D /* MMETimerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BB91FE05D6E00C1BD0D /* MMETimerManager.m */; }; + 40834BF41FE05E1800C1BD0D /* MMETrustKitWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BC11FE05D6F00C1BD0D /* MMETrustKitWrapper.m */; }; + 40834BF51FE05E1800C1BD0D /* MMETypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BBD1FE05D6E00C1BD0D /* MMETypes.m */; }; + 40834BF61FE05E1800C1BD0D /* MMEUIApplicationWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BCA1FE05D7000C1BD0D /* MMEUIApplicationWrapper.m */; }; + 40834BF71FE05E1800C1BD0D /* MMEUniqueIdentifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BAD1FE05D6C00C1BD0D /* MMEUniqueIdentifier.m */; }; + 40834BF81FE05E1800C1BD0D /* NSData+MMEGZIP.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BAF1FE05D6C00C1BD0D /* NSData+MMEGZIP.m */; }; + 40834BF91FE05E1800C1BD0D /* MMEReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BCD1FE05D7100C1BD0D /* MMEReachability.m */; }; + 40834BFA1FE05E1800C1BD0D /* CLLocation+MMEMobileEvents.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BC31FE05D6F00C1BD0D /* CLLocation+MMEMobileEvents.m */; }; + 40834BFB1FE05E1800C1BD0D /* MMEAPIClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BA51FE05D6B00C1BD0D /* MMEAPIClient.m */; }; + 40834BFC1FE05E1800C1BD0D /* MMECategoryLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BC41FE05D6F00C1BD0D /* MMECategoryLoader.m */; }; + 40834BFD1FE05E1800C1BD0D /* MMECommonEventData.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BCE1FE05D7100C1BD0D /* MMECommonEventData.m */; }; + 40834BFE1FE05E1800C1BD0D /* MMEConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BC01FE05D6E00C1BD0D /* MMEConstants.m */; }; + 40834BFF1FE05E1800C1BD0D /* MMEDependencyManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BB41FE05D6D00C1BD0D /* MMEDependencyManager.m */; }; + 40834C001FE05E1800C1BD0D /* MMEEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BC71FE05D7000C1BD0D /* MMEEvent.m */; }; + 40834C011FE05E1800C1BD0D /* MMEEventLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BB71FE05D6D00C1BD0D /* MMEEventLogger.m */; }; + 40834C021FE05E1800C1BD0D /* MMEEventsConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BB21FE05D6D00C1BD0D /* MMEEventsConfiguration.m */; }; + 40834C031FE05E1800C1BD0D /* MMEEventsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BA41FE05D6B00C1BD0D /* MMEEventsManager.m */; }; + 40834C041FE05E1800C1BD0D /* MMELocationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BB81FE05D6D00C1BD0D /* MMELocationManager.m */; }; + 40834C051FE05E1800C1BD0D /* MMENSDateWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BBC1FE05D6E00C1BD0D /* MMENSDateWrapper.m */; }; + 40834C061FE05E1800C1BD0D /* MMENSURLSessionWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BC61FE05D7000C1BD0D /* MMENSURLSessionWrapper.m */; }; + 40834C071FE05E1800C1BD0D /* MMETimerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BB91FE05D6E00C1BD0D /* MMETimerManager.m */; }; + 40834C081FE05E1800C1BD0D /* MMETrustKitWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BC11FE05D6F00C1BD0D /* MMETrustKitWrapper.m */; }; + 40834C091FE05E1800C1BD0D /* MMETypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BBD1FE05D6E00C1BD0D /* MMETypes.m */; }; + 40834C0A1FE05E1800C1BD0D /* MMEUIApplicationWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BCA1FE05D7000C1BD0D /* MMEUIApplicationWrapper.m */; }; + 40834C0B1FE05E1800C1BD0D /* MMEUniqueIdentifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BAD1FE05D6C00C1BD0D /* MMEUniqueIdentifier.m */; }; + 40834C0C1FE05E1800C1BD0D /* NSData+MMEGZIP.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BAF1FE05D6C00C1BD0D /* NSData+MMEGZIP.m */; }; + 40834C0D1FE05E1800C1BD0D /* MMEReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BCD1FE05D7100C1BD0D /* MMEReachability.m */; }; + 40834C401FE05F7500C1BD0D /* configuration_utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C101FE05F3600C1BD0D /* configuration_utils.m */; }; + 40834C411FE05F7500C1BD0D /* parse_configuration.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C141FE05F3600C1BD0D /* parse_configuration.m */; }; + 40834C421FE05F7500C1BD0D /* ssl_pin_verifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C171FE05F3600C1BD0D /* ssl_pin_verifier.m */; }; + 40834C431FE05F7500C1BD0D /* TSKSPKIHashCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C1A1FE05F3600C1BD0D /* TSKSPKIHashCache.m */; }; + 40834C441FE05F7500C1BD0D /* reporting_utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C1D1FE05F3600C1BD0D /* reporting_utils.m */; }; + 40834C451FE05F7500C1BD0D /* TSKBackgroundReporter.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C1F1FE05F3600C1BD0D /* TSKBackgroundReporter.m */; }; + 40834C461FE05F7500C1BD0D /* TSKPinFailureReport.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C211FE05F3600C1BD0D /* TSKPinFailureReport.m */; }; + 40834C471FE05F7500C1BD0D /* TSKReportsRateLimiter.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C231FE05F3600C1BD0D /* TSKReportsRateLimiter.m */; }; + 40834C481FE05F7500C1BD0D /* vendor_identifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C251FE05F3600C1BD0D /* vendor_identifier.m */; }; + 40834C491FE05F7500C1BD0D /* TrustKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C271FE05F3600C1BD0D /* TrustKit.m */; }; + 40834C4A1FE05F7500C1BD0D /* TSKPinningValidator.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C2A1FE05F3600C1BD0D /* TSKPinningValidator.m */; }; + 40834C4B1FE05F7500C1BD0D /* TSKPinningValidatorResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C2E1FE05F3600C1BD0D /* TSKPinningValidatorResult.m */; }; + 40834C4C1FE05F7500C1BD0D /* TSKTrustKitConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C311FE05F3600C1BD0D /* TSKTrustKitConfig.m */; }; + 40834C4D1FE05F7600C1BD0D /* configuration_utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C101FE05F3600C1BD0D /* configuration_utils.m */; }; + 40834C4E1FE05F7600C1BD0D /* parse_configuration.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C141FE05F3600C1BD0D /* parse_configuration.m */; }; + 40834C4F1FE05F7600C1BD0D /* ssl_pin_verifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C171FE05F3600C1BD0D /* ssl_pin_verifier.m */; }; + 40834C501FE05F7600C1BD0D /* TSKSPKIHashCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C1A1FE05F3600C1BD0D /* TSKSPKIHashCache.m */; }; + 40834C511FE05F7600C1BD0D /* reporting_utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C1D1FE05F3600C1BD0D /* reporting_utils.m */; }; + 40834C521FE05F7600C1BD0D /* TSKBackgroundReporter.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C1F1FE05F3600C1BD0D /* TSKBackgroundReporter.m */; }; + 40834C531FE05F7600C1BD0D /* TSKPinFailureReport.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C211FE05F3600C1BD0D /* TSKPinFailureReport.m */; }; + 40834C541FE05F7600C1BD0D /* TSKReportsRateLimiter.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C231FE05F3600C1BD0D /* TSKReportsRateLimiter.m */; }; + 40834C551FE05F7600C1BD0D /* vendor_identifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C251FE05F3600C1BD0D /* vendor_identifier.m */; }; + 40834C561FE05F7600C1BD0D /* TrustKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C271FE05F3600C1BD0D /* TrustKit.m */; }; + 40834C571FE05F7600C1BD0D /* TSKPinningValidator.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C2A1FE05F3600C1BD0D /* TSKPinningValidator.m */; }; + 40834C581FE05F7600C1BD0D /* TSKPinningValidatorResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C2E1FE05F3600C1BD0D /* TSKPinningValidatorResult.m */; }; + 40834C591FE05F7600C1BD0D /* TSKTrustKitConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834C311FE05F3600C1BD0D /* TSKTrustKitConfig.m */; }; 4085AF091D933DEA00F11B22 /* MGLTileSetTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4085AF081D933DEA00F11B22 /* MGLTileSetTests.mm */; }; - 408982E91DEE208200754016 /* api_mapbox_staging.der in Resources */ = {isa = PBXBuildFile; fileRef = 40599F001DEE1B2400182B5D /* api_mapbox_staging.der */; }; - 408982EA1DEE208B00754016 /* api_mapbox_com-digicert_2016.der in Resources */ = {isa = PBXBuildFile; fileRef = 40599F011DEE1B2400182B5D /* api_mapbox_com-digicert_2016.der */; }; - 408982EB1DEE209100754016 /* api_mapbox_com-geotrust_2016.der in Resources */ = {isa = PBXBuildFile; fileRef = 40599F021DEE1B2400182B5D /* api_mapbox_com-geotrust_2016.der */; }; 408AA8571DAEDA1700022900 /* NSDictionary+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 408AA8551DAEDA0800022900 /* NSDictionary+MGLAdditions.h */; }; 408AA8581DAEDA1E00022900 /* NSDictionary+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 408AA8561DAEDA0800022900 /* NSDictionary+MGLAdditions.mm */; }; 408AA8591DAEDA1E00022900 /* NSDictionary+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 408AA8561DAEDA0800022900 /* NSDictionary+MGLAdditions.mm */; }; @@ -201,10 +265,6 @@ 409F43FD1E9E781C0048729D /* MGLMapViewDelegateIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 409F43FC1E9E781C0048729D /* MGLMapViewDelegateIntegrationTests.swift */; }; 40CF6DBB1DAC3C6600A4D18B /* MGLShape_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 40CF6DBA1DAC3C1800A4D18B /* MGLShape_Private.h */; }; 40CFA6511D7875BB008103BD /* MGLShapeSourceTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 40CFA6501D787579008103BD /* MGLShapeSourceTests.mm */; }; - 40EA6BC11EF4599600FCCDA2 /* api_mapbox_com-digicert_2017.der in Resources */ = {isa = PBXBuildFile; fileRef = 40EA6BBD1EF4598900FCCDA2 /* api_mapbox_com-digicert_2017.der */; }; - 40EA6BC21EF4599700FCCDA2 /* api_mapbox_com-digicert_2017.der in Resources */ = {isa = PBXBuildFile; fileRef = 40EA6BBD1EF4598900FCCDA2 /* api_mapbox_com-digicert_2017.der */; }; - 40EA6BC31EF4599D00FCCDA2 /* api_mapbox_com-geotrust_2017.der in Resources */ = {isa = PBXBuildFile; fileRef = 40EA6BBE1EF4598900FCCDA2 /* api_mapbox_com-geotrust_2017.der */; }; - 40EA6BC41EF4599D00FCCDA2 /* api_mapbox_com-geotrust_2017.der in Resources */ = {isa = PBXBuildFile; fileRef = 40EA6BBE1EF4598900FCCDA2 /* api_mapbox_com-geotrust_2017.der */; }; 40EDA1C01CFE0E0200D9EA68 /* MGLAnnotationContainerView.h in Headers */ = {isa = PBXBuildFile; fileRef = 40EDA1BD1CFE0D4A00D9EA68 /* MGLAnnotationContainerView.h */; }; 40EDA1C11CFE0E0500D9EA68 /* MGLAnnotationContainerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 40EDA1BE1CFE0D4A00D9EA68 /* MGLAnnotationContainerView.m */; }; 40EDA1C21CFE0E0500D9EA68 /* MGLAnnotationContainerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 40EDA1BE1CFE0D4A00D9EA68 /* MGLAnnotationContainerView.m */; }; @@ -294,8 +354,6 @@ 96E516FA20005A3D00A02306 /* MGLUserLocationHeadingArrowLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 966FCF501F3C321000F2B6DE /* MGLUserLocationHeadingArrowLayer.h */; }; 96E516FB20005A4000A02306 /* MGLUserLocationHeadingBeamLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 966FCF4A1F3A5C9200F2B6DE /* MGLUserLocationHeadingBeamLayer.h */; }; 96E516FC20005A4400A02306 /* MGLUserLocationHeadingIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 96F3F73B1F5711F1003E2D2C /* MGLUserLocationHeadingIndicator.h */; }; - 96E516FD20005A4700A02306 /* MGLAPIClient.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8848421CBAFB9800AB86E3 /* MGLAPIClient.h */; }; - 96E516FE20005A4C00A02306 /* MGLLocationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8848461CBAFB9800AB86E3 /* MGLLocationManager.h */; }; 96E516FF20005A4F00A02306 /* MGLMapboxEvents.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8848481CBAFB9800AB86E3 /* MGLMapboxEvents.h */; }; 96E5170020005A6100A02306 /* Fabric.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8848831CBB033F00AB86E3 /* Fabric.h */; }; 96E5170120005A6400A02306 /* Fabric+FABKits.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8848821CBB033F00AB86E3 /* Fabric+FABKits.h */; }; @@ -425,12 +483,8 @@ DA88483F1CBAFB8500AB86E3 /* MGLUserLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8848391CBAFB8500AB86E3 /* MGLUserLocation.h */; settings = {ATTRIBUTES = (Public, ); }; }; DA88484F1CBAFB9800AB86E3 /* MGLAnnotationImage_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8848401CBAFB9800AB86E3 /* MGLAnnotationImage_Private.h */; }; DA8848501CBAFB9800AB86E3 /* MGLAnnotationImage.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8848411CBAFB9800AB86E3 /* MGLAnnotationImage.m */; }; - DA8848511CBAFB9800AB86E3 /* MGLAPIClient.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8848421CBAFB9800AB86E3 /* MGLAPIClient.h */; }; - DA8848521CBAFB9800AB86E3 /* MGLAPIClient.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8848431CBAFB9800AB86E3 /* MGLAPIClient.m */; }; DA8848531CBAFB9800AB86E3 /* MGLCompactCalloutView.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8848441CBAFB9800AB86E3 /* MGLCompactCalloutView.h */; }; DA8848541CBAFB9800AB86E3 /* MGLCompactCalloutView.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8848451CBAFB9800AB86E3 /* MGLCompactCalloutView.m */; }; - DA8848551CBAFB9800AB86E3 /* MGLLocationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8848461CBAFB9800AB86E3 /* MGLLocationManager.h */; }; - DA8848561CBAFB9800AB86E3 /* MGLLocationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8848471CBAFB9800AB86E3 /* MGLLocationManager.m */; }; DA8848571CBAFB9800AB86E3 /* MGLMapboxEvents.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8848481CBAFB9800AB86E3 /* MGLMapboxEvents.h */; }; DA8848581CBAFB9800AB86E3 /* MGLMapboxEvents.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8848491CBAFB9800AB86E3 /* MGLMapboxEvents.m */; }; DA8848591CBAFB9800AB86E3 /* MGLMapView.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA88484A1CBAFB9800AB86E3 /* MGLMapView.mm */; }; @@ -478,9 +532,7 @@ DAA4E42A1CBB730400178DFB /* NSProcessInfo+MGLAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8848161CBAFA6200AB86E3 /* NSProcessInfo+MGLAdditions.m */; }; DAA4E42B1CBB730400178DFB /* NSString+MGLAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8848181CBAFA6200AB86E3 /* NSString+MGLAdditions.m */; }; DAA4E42D1CBB730400178DFB /* MGLAnnotationImage.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8848411CBAFB9800AB86E3 /* MGLAnnotationImage.m */; }; - DAA4E42E1CBB730400178DFB /* MGLAPIClient.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8848431CBAFB9800AB86E3 /* MGLAPIClient.m */; }; DAA4E42F1CBB730400178DFB /* MGLCompactCalloutView.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8848451CBAFB9800AB86E3 /* MGLCompactCalloutView.m */; }; - DAA4E4301CBB730400178DFB /* MGLLocationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8848471CBAFB9800AB86E3 /* MGLLocationManager.m */; }; DAA4E4311CBB730400178DFB /* MGLMapboxEvents.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8848491CBAFB9800AB86E3 /* MGLMapboxEvents.m */; }; DAA4E4321CBB730400178DFB /* MGLMapView.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA88484A1CBAFB9800AB86E3 /* MGLMapView.mm */; }; DAA4E4331CBB730400178DFB /* MGLUserLocation.m in Sources */ = {isa = PBXBuildFile; fileRef = DA88484C1CBAFB9800AB86E3 /* MGLUserLocation.m */; }; @@ -778,9 +830,84 @@ 404C26E01D89B877000AA13D /* MGLTileSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLTileSource.h; sourceTree = ""; }; 404C26E11D89B877000AA13D /* MGLTileSource.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLTileSource.mm; sourceTree = ""; }; 404C26E61D89C515000AA13D /* MGLTileSource_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLTileSource_Private.h; sourceTree = ""; }; - 40599F001DEE1B2400182B5D /* api_mapbox_staging.der */ = {isa = PBXFileReference; lastKnownFileType = file; path = api_mapbox_staging.der; sourceTree = ""; }; - 40599F011DEE1B2400182B5D /* api_mapbox_com-digicert_2016.der */ = {isa = PBXFileReference; lastKnownFileType = file; path = "api_mapbox_com-digicert_2016.der"; sourceTree = ""; }; - 40599F021DEE1B2400182B5D /* api_mapbox_com-geotrust_2016.der */ = {isa = PBXFileReference; lastKnownFileType = file; path = "api_mapbox_com-geotrust_2016.der"; sourceTree = ""; }; + 406E99B11FFEFED500D9FFCC /* MMEEventLogReportViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMEEventLogReportViewController.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEEventLogReportViewController.m"; sourceTree = SOURCE_ROOT; }; + 406E99B21FFEFED500D9FFCC /* MMEUINavigation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMEUINavigation.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEUINavigation.m"; sourceTree = SOURCE_ROOT; }; + 406E99B31FFEFED600D9FFCC /* MMEUINavigation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMEUINavigation.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEUINavigation.h"; sourceTree = SOURCE_ROOT; }; + 406E99B51FFEFED600D9FFCC /* MMEEventLogReportViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMEEventLogReportViewController.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEEventLogReportViewController.h"; sourceTree = SOURCE_ROOT; }; + 40834AEF1FDF4F0100C1BD0D /* Mapbox-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "Mapbox-Prefix.pch"; path = "src/Mapbox-Prefix.pch"; sourceTree = SOURCE_ROOT; }; + 40834BA31FE05D6B00C1BD0D /* MMEEventsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMEEventsManager.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEEventsManager.h"; sourceTree = SOURCE_ROOT; }; + 40834BA41FE05D6B00C1BD0D /* MMEEventsManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMEEventsManager.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEEventsManager.m"; sourceTree = SOURCE_ROOT; }; + 40834BA51FE05D6B00C1BD0D /* MMEAPIClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMEAPIClient.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEAPIClient.m"; sourceTree = SOURCE_ROOT; }; + 40834BA61FE05D6B00C1BD0D /* MMEEventLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMEEventLogger.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEEventLogger.h"; sourceTree = SOURCE_ROOT; }; + 40834BA71FE05D6B00C1BD0D /* MMETrustKitWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMETrustKitWrapper.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMETrustKitWrapper.h"; sourceTree = SOURCE_ROOT; }; + 40834BAA1FE05D6C00C1BD0D /* MMENSURLSessionWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMENSURLSessionWrapper.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMENSURLSessionWrapper.h"; sourceTree = SOURCE_ROOT; }; + 40834BAB1FE05D6C00C1BD0D /* MMEAPIClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMEAPIClient.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEAPIClient.h"; sourceTree = SOURCE_ROOT; }; + 40834BAC1FE05D6C00C1BD0D /* MapboxMobileEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MapboxMobileEvents.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MapboxMobileEvents.h"; sourceTree = SOURCE_ROOT; }; + 40834BAD1FE05D6C00C1BD0D /* MMEUniqueIdentifier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMEUniqueIdentifier.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEUniqueIdentifier.m"; sourceTree = SOURCE_ROOT; }; + 40834BAE1FE05D6C00C1BD0D /* MMECommonEventData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMECommonEventData.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMECommonEventData.h"; sourceTree = SOURCE_ROOT; }; + 40834BAF1FE05D6C00C1BD0D /* NSData+MMEGZIP.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSData+MMEGZIP.m"; path = "vendor/mapbox-events-ios/MapboxMobileEvents/NSData+MMEGZIP.m"; sourceTree = SOURCE_ROOT; }; + 40834BB01FE05D6C00C1BD0D /* MMEConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMEConstants.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEConstants.h"; sourceTree = SOURCE_ROOT; }; + 40834BB11FE05D6D00C1BD0D /* MMEDependencyManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMEDependencyManager.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEDependencyManager.h"; sourceTree = SOURCE_ROOT; }; + 40834BB21FE05D6D00C1BD0D /* MMEEventsConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMEEventsConfiguration.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEEventsConfiguration.m"; sourceTree = SOURCE_ROOT; }; + 40834BB31FE05D6D00C1BD0D /* MMELocationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMELocationManager.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMELocationManager.h"; sourceTree = SOURCE_ROOT; }; + 40834BB41FE05D6D00C1BD0D /* MMEDependencyManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMEDependencyManager.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEDependencyManager.m"; sourceTree = SOURCE_ROOT; }; + 40834BB51FE05D6D00C1BD0D /* MMECategoryLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMECategoryLoader.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMECategoryLoader.h"; sourceTree = SOURCE_ROOT; }; + 40834BB61FE05D6D00C1BD0D /* MMETypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMETypes.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMETypes.h"; sourceTree = SOURCE_ROOT; }; + 40834BB71FE05D6D00C1BD0D /* MMEEventLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMEEventLogger.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEEventLogger.m"; sourceTree = SOURCE_ROOT; }; + 40834BB81FE05D6D00C1BD0D /* MMELocationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMELocationManager.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMELocationManager.m"; sourceTree = SOURCE_ROOT; }; + 40834BB91FE05D6E00C1BD0D /* MMETimerManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMETimerManager.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMETimerManager.m"; sourceTree = SOURCE_ROOT; }; + 40834BBA1FE05D6E00C1BD0D /* MMEEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMEEvent.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEEvent.h"; sourceTree = SOURCE_ROOT; }; + 40834BBB1FE05D6E00C1BD0D /* MMEEventsConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMEEventsConfiguration.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEEventsConfiguration.h"; sourceTree = SOURCE_ROOT; }; + 40834BBC1FE05D6E00C1BD0D /* MMENSDateWrapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMENSDateWrapper.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMENSDateWrapper.m"; sourceTree = SOURCE_ROOT; }; + 40834BBD1FE05D6E00C1BD0D /* MMETypes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMETypes.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMETypes.m"; sourceTree = SOURCE_ROOT; }; + 40834BBE1FE05D6E00C1BD0D /* MMEUIApplicationWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMEUIApplicationWrapper.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEUIApplicationWrapper.h"; sourceTree = SOURCE_ROOT; }; + 40834BBF1FE05D6E00C1BD0D /* MMEUniqueIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMEUniqueIdentifier.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEUniqueIdentifier.h"; sourceTree = SOURCE_ROOT; }; + 40834BC01FE05D6E00C1BD0D /* MMEConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMEConstants.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEConstants.m"; sourceTree = SOURCE_ROOT; }; + 40834BC11FE05D6F00C1BD0D /* MMETrustKitWrapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMETrustKitWrapper.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMETrustKitWrapper.m"; sourceTree = SOURCE_ROOT; }; + 40834BC21FE05D6F00C1BD0D /* CLLocation+MMEMobileEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "CLLocation+MMEMobileEvents.h"; path = "vendor/mapbox-events-ios/MapboxMobileEvents/CLLocation+MMEMobileEvents.h"; sourceTree = SOURCE_ROOT; }; + 40834BC31FE05D6F00C1BD0D /* CLLocation+MMEMobileEvents.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "CLLocation+MMEMobileEvents.m"; path = "vendor/mapbox-events-ios/MapboxMobileEvents/CLLocation+MMEMobileEvents.m"; sourceTree = SOURCE_ROOT; }; + 40834BC41FE05D6F00C1BD0D /* MMECategoryLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMECategoryLoader.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMECategoryLoader.m"; sourceTree = SOURCE_ROOT; }; + 40834BC51FE05D6F00C1BD0D /* MMENSDateWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMENSDateWrapper.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMENSDateWrapper.h"; sourceTree = SOURCE_ROOT; }; + 40834BC61FE05D7000C1BD0D /* MMENSURLSessionWrapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMENSURLSessionWrapper.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMENSURLSessionWrapper.m"; sourceTree = SOURCE_ROOT; }; + 40834BC71FE05D7000C1BD0D /* MMEEvent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMEEvent.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEEvent.m"; sourceTree = SOURCE_ROOT; }; + 40834BC81FE05D7000C1BD0D /* MMENamespacedDependencies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMENamespacedDependencies.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMENamespacedDependencies.h"; sourceTree = SOURCE_ROOT; }; + 40834BC91FE05D7000C1BD0D /* MMETimerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMETimerManager.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMETimerManager.h"; sourceTree = SOURCE_ROOT; }; + 40834BCA1FE05D7000C1BD0D /* MMEUIApplicationWrapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMEUIApplicationWrapper.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEUIApplicationWrapper.m"; sourceTree = SOURCE_ROOT; }; + 40834BCC1FE05D7100C1BD0D /* MMEReachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMEReachability.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/Reachability/MMEReachability.h"; sourceTree = SOURCE_ROOT; }; + 40834BCD1FE05D7100C1BD0D /* MMEReachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMEReachability.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/Reachability/MMEReachability.m"; sourceTree = SOURCE_ROOT; }; + 40834BCE1FE05D7100C1BD0D /* MMECommonEventData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMECommonEventData.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMECommonEventData.m"; sourceTree = SOURCE_ROOT; }; + 40834BCF1FE05D7100C1BD0D /* NSData+MMEGZIP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSData+MMEGZIP.h"; path = "vendor/mapbox-events-ios/MapboxMobileEvents/NSData+MMEGZIP.h"; sourceTree = SOURCE_ROOT; }; + 40834C0F1FE05F3600C1BD0D /* configuration_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = configuration_utils.h; path = "vendor/mapbox-events-ios/vendor/TrustKit/configuration_utils.h"; sourceTree = SOURCE_ROOT; }; + 40834C101FE05F3600C1BD0D /* configuration_utils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = configuration_utils.m; path = "vendor/mapbox-events-ios/vendor/TrustKit/configuration_utils.m"; sourceTree = SOURCE_ROOT; }; + 40834C131FE05F3600C1BD0D /* parse_configuration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = parse_configuration.h; path = "vendor/mapbox-events-ios/vendor/TrustKit/parse_configuration.h"; sourceTree = SOURCE_ROOT; }; + 40834C141FE05F3600C1BD0D /* parse_configuration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = parse_configuration.m; path = "vendor/mapbox-events-ios/vendor/TrustKit/parse_configuration.m"; sourceTree = SOURCE_ROOT; }; + 40834C161FE05F3600C1BD0D /* ssl_pin_verifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ssl_pin_verifier.h; path = "vendor/mapbox-events-ios/vendor/TrustKit/Pinning/ssl_pin_verifier.h"; sourceTree = SOURCE_ROOT; }; + 40834C171FE05F3600C1BD0D /* ssl_pin_verifier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ssl_pin_verifier.m; path = "vendor/mapbox-events-ios/vendor/TrustKit/Pinning/ssl_pin_verifier.m"; sourceTree = SOURCE_ROOT; }; + 40834C181FE05F3600C1BD0D /* TSKPublicKeyAlgorithm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TSKPublicKeyAlgorithm.h; path = "vendor/mapbox-events-ios/vendor/TrustKit/Pinning/TSKPublicKeyAlgorithm.h"; sourceTree = SOURCE_ROOT; }; + 40834C191FE05F3600C1BD0D /* TSKSPKIHashCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TSKSPKIHashCache.h; path = "vendor/mapbox-events-ios/vendor/TrustKit/Pinning/TSKSPKIHashCache.h"; sourceTree = SOURCE_ROOT; }; + 40834C1A1FE05F3600C1BD0D /* TSKSPKIHashCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TSKSPKIHashCache.m; path = "vendor/mapbox-events-ios/vendor/TrustKit/Pinning/TSKSPKIHashCache.m"; sourceTree = SOURCE_ROOT; }; + 40834C1C1FE05F3600C1BD0D /* reporting_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = reporting_utils.h; path = "vendor/mapbox-events-ios/vendor/TrustKit/Reporting/reporting_utils.h"; sourceTree = SOURCE_ROOT; }; + 40834C1D1FE05F3600C1BD0D /* reporting_utils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = reporting_utils.m; path = "vendor/mapbox-events-ios/vendor/TrustKit/Reporting/reporting_utils.m"; sourceTree = SOURCE_ROOT; }; + 40834C1E1FE05F3600C1BD0D /* TSKBackgroundReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TSKBackgroundReporter.h; path = "vendor/mapbox-events-ios/vendor/TrustKit/Reporting/TSKBackgroundReporter.h"; sourceTree = SOURCE_ROOT; }; + 40834C1F1FE05F3600C1BD0D /* TSKBackgroundReporter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TSKBackgroundReporter.m; path = "vendor/mapbox-events-ios/vendor/TrustKit/Reporting/TSKBackgroundReporter.m"; sourceTree = SOURCE_ROOT; }; + 40834C201FE05F3600C1BD0D /* TSKPinFailureReport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TSKPinFailureReport.h; path = "vendor/mapbox-events-ios/vendor/TrustKit/Reporting/TSKPinFailureReport.h"; sourceTree = SOURCE_ROOT; }; + 40834C211FE05F3600C1BD0D /* TSKPinFailureReport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TSKPinFailureReport.m; path = "vendor/mapbox-events-ios/vendor/TrustKit/Reporting/TSKPinFailureReport.m"; sourceTree = SOURCE_ROOT; }; + 40834C221FE05F3600C1BD0D /* TSKReportsRateLimiter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TSKReportsRateLimiter.h; path = "vendor/mapbox-events-ios/vendor/TrustKit/Reporting/TSKReportsRateLimiter.h"; sourceTree = SOURCE_ROOT; }; + 40834C231FE05F3600C1BD0D /* TSKReportsRateLimiter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TSKReportsRateLimiter.m; path = "vendor/mapbox-events-ios/vendor/TrustKit/Reporting/TSKReportsRateLimiter.m"; sourceTree = SOURCE_ROOT; }; + 40834C241FE05F3600C1BD0D /* vendor_identifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = vendor_identifier.h; path = "vendor/mapbox-events-ios/vendor/TrustKit/Reporting/vendor_identifier.h"; sourceTree = SOURCE_ROOT; }; + 40834C251FE05F3600C1BD0D /* vendor_identifier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = vendor_identifier.m; path = "vendor/mapbox-events-ios/vendor/TrustKit/Reporting/vendor_identifier.m"; sourceTree = SOURCE_ROOT; }; + 40834C261FE05F3600C1BD0D /* TrustKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TrustKit.h; path = "vendor/mapbox-events-ios/vendor/TrustKit/TrustKit.h"; sourceTree = SOURCE_ROOT; }; + 40834C271FE05F3600C1BD0D /* TrustKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TrustKit.m; path = "vendor/mapbox-events-ios/vendor/TrustKit/TrustKit.m"; sourceTree = SOURCE_ROOT; }; + 40834C281FE05F3600C1BD0D /* TSKLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TSKLog.h; path = "vendor/mapbox-events-ios/vendor/TrustKit/TSKLog.h"; sourceTree = SOURCE_ROOT; }; + 40834C291FE05F3600C1BD0D /* TSKPinningValidator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TSKPinningValidator.h; path = "vendor/mapbox-events-ios/vendor/TrustKit/TSKPinningValidator.h"; sourceTree = SOURCE_ROOT; }; + 40834C2A1FE05F3600C1BD0D /* TSKPinningValidator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TSKPinningValidator.m; path = "vendor/mapbox-events-ios/vendor/TrustKit/TSKPinningValidator.m"; sourceTree = SOURCE_ROOT; }; + 40834C2B1FE05F3600C1BD0D /* TSKPinningValidator_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TSKPinningValidator_Private.h; path = "vendor/mapbox-events-ios/vendor/TrustKit/TSKPinningValidator_Private.h"; sourceTree = SOURCE_ROOT; }; + 40834C2C1FE05F3600C1BD0D /* TSKPinningValidatorCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TSKPinningValidatorCallback.h; path = "vendor/mapbox-events-ios/vendor/TrustKit/TSKPinningValidatorCallback.h"; sourceTree = SOURCE_ROOT; }; + 40834C2D1FE05F3600C1BD0D /* TSKPinningValidatorResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TSKPinningValidatorResult.h; path = "vendor/mapbox-events-ios/vendor/TrustKit/TSKPinningValidatorResult.h"; sourceTree = SOURCE_ROOT; }; + 40834C2E1FE05F3600C1BD0D /* TSKPinningValidatorResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TSKPinningValidatorResult.m; path = "vendor/mapbox-events-ios/vendor/TrustKit/TSKPinningValidatorResult.m"; sourceTree = SOURCE_ROOT; }; + 40834C2F1FE05F3600C1BD0D /* TSKTrustDecision.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TSKTrustDecision.h; path = "vendor/mapbox-events-ios/vendor/TrustKit/TSKTrustDecision.h"; sourceTree = SOURCE_ROOT; }; + 40834C301FE05F3600C1BD0D /* TSKTrustKitConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TSKTrustKitConfig.h; path = "vendor/mapbox-events-ios/vendor/TrustKit/TSKTrustKitConfig.h"; sourceTree = SOURCE_ROOT; }; + 40834C311FE05F3600C1BD0D /* TSKTrustKitConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TSKTrustKitConfig.m; path = "vendor/mapbox-events-ios/vendor/TrustKit/TSKTrustKitConfig.m"; sourceTree = SOURCE_ROOT; }; 4085AF081D933DEA00F11B22 /* MGLTileSetTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLTileSetTests.mm; path = ../../darwin/test/MGLTileSetTests.mm; sourceTree = ""; }; 408AA8551DAEDA0800022900 /* NSDictionary+MGLAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+MGLAdditions.h"; sourceTree = ""; }; 408AA8561DAEDA0800022900 /* NSDictionary+MGLAdditions.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSDictionary+MGLAdditions.mm"; sourceTree = ""; }; @@ -788,8 +915,6 @@ 409F43FC1E9E781C0048729D /* MGLMapViewDelegateIntegrationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MGLMapViewDelegateIntegrationTests.swift; sourceTree = ""; }; 40CF6DBA1DAC3C1800A4D18B /* MGLShape_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLShape_Private.h; sourceTree = ""; }; 40CFA6501D787579008103BD /* MGLShapeSourceTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLShapeSourceTests.mm; path = ../../darwin/test/MGLShapeSourceTests.mm; sourceTree = ""; }; - 40EA6BBD1EF4598900FCCDA2 /* api_mapbox_com-digicert_2017.der */ = {isa = PBXFileReference; lastKnownFileType = file; path = "api_mapbox_com-digicert_2017.der"; sourceTree = ""; }; - 40EA6BBE1EF4598900FCCDA2 /* api_mapbox_com-geotrust_2017.der */ = {isa = PBXFileReference; lastKnownFileType = file; path = "api_mapbox_com-geotrust_2017.der"; sourceTree = ""; }; 40EDA1BD1CFE0D4A00D9EA68 /* MGLAnnotationContainerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAnnotationContainerView.h; sourceTree = ""; }; 40EDA1BE1CFE0D4A00D9EA68 /* MGLAnnotationContainerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLAnnotationContainerView.m; sourceTree = ""; }; 40F8876F1D7A1DB8008ECB67 /* MGLShapeSource_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLShapeSource_Private.h; sourceTree = ""; }; @@ -1004,12 +1129,8 @@ DA8848391CBAFB8500AB86E3 /* MGLUserLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLUserLocation.h; sourceTree = ""; }; DA8848401CBAFB9800AB86E3 /* MGLAnnotationImage_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAnnotationImage_Private.h; sourceTree = ""; }; DA8848411CBAFB9800AB86E3 /* MGLAnnotationImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLAnnotationImage.m; sourceTree = ""; }; - DA8848421CBAFB9800AB86E3 /* MGLAPIClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAPIClient.h; sourceTree = ""; }; - DA8848431CBAFB9800AB86E3 /* MGLAPIClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLAPIClient.m; sourceTree = ""; }; DA8848441CBAFB9800AB86E3 /* MGLCompactCalloutView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLCompactCalloutView.h; sourceTree = ""; }; DA8848451CBAFB9800AB86E3 /* MGLCompactCalloutView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLCompactCalloutView.m; sourceTree = ""; }; - DA8848461CBAFB9800AB86E3 /* MGLLocationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLLocationManager.h; sourceTree = ""; }; - DA8848471CBAFB9800AB86E3 /* MGLLocationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLLocationManager.m; sourceTree = ""; }; DA8848481CBAFB9800AB86E3 /* MGLMapboxEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLMapboxEvents.h; sourceTree = ""; }; DA8848491CBAFB9800AB86E3 /* MGLMapboxEvents.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLMapboxEvents.m; sourceTree = ""; }; DA88484A1CBAFB9800AB86E3 /* MGLMapView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLMapView.mm; sourceTree = ""; }; @@ -1377,6 +1498,137 @@ name = "Test Helpers"; sourceTree = ""; }; + 40834BA11FE05CFD00C1BD0D /* Development */ = { + isa = PBXGroup; + children = ( + 9620BB361E69FE1700705A1D /* MGLSDKUpdateChecker.h */, + 9620BB371E69FE1700705A1D /* MGLSDKUpdateChecker.mm */, + ); + name = Development; + sourceTree = ""; + }; + 40834BA21FE05D3100C1BD0D /* Runtime */ = { + isa = PBXGroup; + children = ( + 40834BC81FE05D7000C1BD0D /* MMENamespacedDependencies.h */, + 40834BAC1FE05D6C00C1BD0D /* MapboxMobileEvents.h */, + DA8848481CBAFB9800AB86E3 /* MGLMapboxEvents.h */, + DA8848491CBAFB9800AB86E3 /* MGLMapboxEvents.m */, + 40834BC21FE05D6F00C1BD0D /* CLLocation+MMEMobileEvents.h */, + 40834BC31FE05D6F00C1BD0D /* CLLocation+MMEMobileEvents.m */, + 40834BAB1FE05D6C00C1BD0D /* MMEAPIClient.h */, + 40834BA51FE05D6B00C1BD0D /* MMEAPIClient.m */, + 40834BB51FE05D6D00C1BD0D /* MMECategoryLoader.h */, + 40834BC41FE05D6F00C1BD0D /* MMECategoryLoader.m */, + 40834BAE1FE05D6C00C1BD0D /* MMECommonEventData.h */, + 40834BCE1FE05D7100C1BD0D /* MMECommonEventData.m */, + 40834BB01FE05D6C00C1BD0D /* MMEConstants.h */, + 40834BC01FE05D6E00C1BD0D /* MMEConstants.m */, + 40834BB11FE05D6D00C1BD0D /* MMEDependencyManager.h */, + 40834BB41FE05D6D00C1BD0D /* MMEDependencyManager.m */, + 40834BBA1FE05D6E00C1BD0D /* MMEEvent.h */, + 40834BC71FE05D7000C1BD0D /* MMEEvent.m */, + 40834BA61FE05D6B00C1BD0D /* MMEEventLogger.h */, + 40834BB71FE05D6D00C1BD0D /* MMEEventLogger.m */, + 406E99B51FFEFED600D9FFCC /* MMEEventLogReportViewController.h */, + 406E99B11FFEFED500D9FFCC /* MMEEventLogReportViewController.m */, + 40834BBB1FE05D6E00C1BD0D /* MMEEventsConfiguration.h */, + 40834BB21FE05D6D00C1BD0D /* MMEEventsConfiguration.m */, + 40834BA31FE05D6B00C1BD0D /* MMEEventsManager.h */, + 40834BA41FE05D6B00C1BD0D /* MMEEventsManager.m */, + 40834BB31FE05D6D00C1BD0D /* MMELocationManager.h */, + 40834BB81FE05D6D00C1BD0D /* MMELocationManager.m */, + 40834BC51FE05D6F00C1BD0D /* MMENSDateWrapper.h */, + 40834BBC1FE05D6E00C1BD0D /* MMENSDateWrapper.m */, + 40834BAA1FE05D6C00C1BD0D /* MMENSURLSessionWrapper.h */, + 40834BC61FE05D7000C1BD0D /* MMENSURLSessionWrapper.m */, + 40834BC91FE05D7000C1BD0D /* MMETimerManager.h */, + 40834BB91FE05D6E00C1BD0D /* MMETimerManager.m */, + 40834BA71FE05D6B00C1BD0D /* MMETrustKitWrapper.h */, + 40834BC11FE05D6F00C1BD0D /* MMETrustKitWrapper.m */, + 40834BB61FE05D6D00C1BD0D /* MMETypes.h */, + 40834BBD1FE05D6E00C1BD0D /* MMETypes.m */, + 40834BBE1FE05D6E00C1BD0D /* MMEUIApplicationWrapper.h */, + 40834BCA1FE05D7000C1BD0D /* MMEUIApplicationWrapper.m */, + 406E99B31FFEFED600D9FFCC /* MMEUINavigation.h */, + 406E99B21FFEFED500D9FFCC /* MMEUINavigation.m */, + 40834BBF1FE05D6E00C1BD0D /* MMEUniqueIdentifier.h */, + 40834BAD1FE05D6C00C1BD0D /* MMEUniqueIdentifier.m */, + 40834BCF1FE05D7100C1BD0D /* NSData+MMEGZIP.h */, + 40834BAF1FE05D6C00C1BD0D /* NSData+MMEGZIP.m */, + 40834BCB1FE05D7100C1BD0D /* Reachability */, + 40834C0E1FE05F3600C1BD0D /* TrustKit */, + ); + name = Runtime; + sourceTree = ""; + }; + 40834BCB1FE05D7100C1BD0D /* Reachability */ = { + isa = PBXGroup; + children = ( + 40834BCC1FE05D7100C1BD0D /* MMEReachability.h */, + 40834BCD1FE05D7100C1BD0D /* MMEReachability.m */, + ); + name = Reachability; + path = "vendor/mapbox-events-ios/MapboxMobileEvents/Reachability"; + sourceTree = SOURCE_ROOT; + }; + 40834C0E1FE05F3600C1BD0D /* TrustKit */ = { + isa = PBXGroup; + children = ( + 40834C0F1FE05F3600C1BD0D /* configuration_utils.h */, + 40834C101FE05F3600C1BD0D /* configuration_utils.m */, + 40834C131FE05F3600C1BD0D /* parse_configuration.h */, + 40834C141FE05F3600C1BD0D /* parse_configuration.m */, + 40834C151FE05F3600C1BD0D /* Pinning */, + 40834C1B1FE05F3600C1BD0D /* Reporting */, + 40834C261FE05F3600C1BD0D /* TrustKit.h */, + 40834C271FE05F3600C1BD0D /* TrustKit.m */, + 40834C281FE05F3600C1BD0D /* TSKLog.h */, + 40834C291FE05F3600C1BD0D /* TSKPinningValidator.h */, + 40834C2A1FE05F3600C1BD0D /* TSKPinningValidator.m */, + 40834C2B1FE05F3600C1BD0D /* TSKPinningValidator_Private.h */, + 40834C2C1FE05F3600C1BD0D /* TSKPinningValidatorCallback.h */, + 40834C2D1FE05F3600C1BD0D /* TSKPinningValidatorResult.h */, + 40834C2E1FE05F3600C1BD0D /* TSKPinningValidatorResult.m */, + 40834C2F1FE05F3600C1BD0D /* TSKTrustDecision.h */, + 40834C301FE05F3600C1BD0D /* TSKTrustKitConfig.h */, + 40834C311FE05F3600C1BD0D /* TSKTrustKitConfig.m */, + ); + name = TrustKit; + path = "vendor/mapbox-events-ios/vendor/TrustKit"; + sourceTree = SOURCE_ROOT; + }; + 40834C151FE05F3600C1BD0D /* Pinning */ = { + isa = PBXGroup; + children = ( + 40834C161FE05F3600C1BD0D /* ssl_pin_verifier.h */, + 40834C171FE05F3600C1BD0D /* ssl_pin_verifier.m */, + 40834C181FE05F3600C1BD0D /* TSKPublicKeyAlgorithm.h */, + 40834C191FE05F3600C1BD0D /* TSKSPKIHashCache.h */, + 40834C1A1FE05F3600C1BD0D /* TSKSPKIHashCache.m */, + ); + name = Pinning; + path = "vendor/mapbox-events-ios/vendor/TrustKit/Pinning"; + sourceTree = SOURCE_ROOT; + }; + 40834C1B1FE05F3600C1BD0D /* Reporting */ = { + isa = PBXGroup; + children = ( + 40834C1C1FE05F3600C1BD0D /* reporting_utils.h */, + 40834C1D1FE05F3600C1BD0D /* reporting_utils.m */, + 40834C1E1FE05F3600C1BD0D /* TSKBackgroundReporter.h */, + 40834C1F1FE05F3600C1BD0D /* TSKBackgroundReporter.m */, + 40834C201FE05F3600C1BD0D /* TSKPinFailureReport.h */, + 40834C211FE05F3600C1BD0D /* TSKPinFailureReport.m */, + 40834C221FE05F3600C1BD0D /* TSKReportsRateLimiter.h */, + 40834C231FE05F3600C1BD0D /* TSKReportsRateLimiter.m */, + 40834C241FE05F3600C1BD0D /* vendor_identifier.h */, + 40834C251FE05F3600C1BD0D /* vendor_identifier.m */, + ); + name = Reporting; + path = "vendor/mapbox-events-ios/vendor/TrustKit/Reporting"; + sourceTree = SOURCE_ROOT; + }; 409F43FB1E9E77D10048729D /* Swift Integration */ = { isa = PBXGroup; children = ( @@ -1557,6 +1809,7 @@ isa = PBXGroup; children = ( DA88485E1CBAFC2E00AB86E3 /* Mapbox.h */, + 40834AEF1FDF4F0100C1BD0D /* Mapbox-Prefix.pch */, DA8847DE1CBAFA3E00AB86E3 /* Foundation */, DA8F25BC1D51D2570010E6B5 /* Foundation Templates */, DA8933B91CCD2C6700E68420 /* Foundation Resources */, @@ -1636,11 +1889,6 @@ DA89339F1CCC951200E68420 /* Localizable.strings */, DAC49C5F1CD02BC9009E1AA3 /* Localizable.stringsdict */, DA8933EF1CCD387900E68420 /* strip-frameworks.sh */, - 40599F001DEE1B2400182B5D /* api_mapbox_staging.der */, - 40599F011DEE1B2400182B5D /* api_mapbox_com-digicert_2016.der */, - 40599F021DEE1B2400182B5D /* api_mapbox_com-geotrust_2016.der */, - 40EA6BBD1EF4598900FCCDA2 /* api_mapbox_com-digicert_2017.der */, - 40EA6BBE1EF4598900FCCDA2 /* api_mapbox_com-geotrust_2017.der */, ); name = "Kit Resources"; path = resources; @@ -1874,16 +2122,10 @@ DAD165851CF4D08B001FF4B9 /* Telemetry */ = { isa = PBXGroup; children = ( - DA8848421CBAFB9800AB86E3 /* MGLAPIClient.h */, - DA8848431CBAFB9800AB86E3 /* MGLAPIClient.m */, - DA8848461CBAFB9800AB86E3 /* MGLLocationManager.h */, - DA8848471CBAFB9800AB86E3 /* MGLLocationManager.m */, - DA8848481CBAFB9800AB86E3 /* MGLMapboxEvents.h */, - DA8848491CBAFB9800AB86E3 /* MGLMapboxEvents.m */, - 9620BB361E69FE1700705A1D /* MGLSDKUpdateChecker.h */, - 9620BB371E69FE1700705A1D /* MGLSDKUpdateChecker.mm */, AC518DFD201BB55A00EBC820 /* MGLTelemetryConfig.h */, AC518DFE201BB55A00EBC820 /* MGLTelemetryConfig.m */, + 40834BA21FE05D3100C1BD0D /* Runtime */, + 40834BA11FE05CFD00C1BD0D /* Development */, ); name = Telemetry; sourceTree = ""; @@ -1918,7 +2160,6 @@ DA8848231CBAFA6200AB86E3 /* MGLOfflineStorage_Private.h in Headers */, 404326891D5B9B27007111BD /* MGLAnnotationContainerView_Private.h in Headers */, CA55CD41202C16AA00CE7095 /* MGLCameraChangeReason.h in Headers */, - 1FB7DAAF1F2A4DBD00410606 /* MGLVectorSource+MGLAdditions.h in Headers */, DA88483B1CBAFB8500AB86E3 /* MGLCalloutView.h in Headers */, 35E0CFE61D3E501500188327 /* MGLStyle_Private.h in Headers */, 3510FFF01D6D9D8C00F413B2 /* NSExpression+MGLAdditions.h in Headers */, @@ -1945,7 +2186,6 @@ FA68F14A1E9D656600F9F6C2 /* MGLFillExtrusionStyleLayer.h in Headers */, 353933FB1D3FB7C0003F57D7 /* MGLRasterStyleLayer.h in Headers */, DA8847EF1CBAFA5100AB86E3 /* MGLAccountManager.h in Headers */, - DA8848511CBAFB9800AB86E3 /* MGLAPIClient.h in Headers */, DA35A2C91CCAAAD200E826B2 /* NSValue+MGLAdditions.h in Headers */, 3510FFEA1D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.h in Headers */, DA6408DB1DA4E7D300908C90 /* MGLVectorStyleLayer.h in Headers */, @@ -1962,7 +2202,6 @@ 071BBB031EE76146001FB02A /* MGLImageSource.h in Headers */, DA8847F41CBAFA5100AB86E3 /* MGLOfflinePack.h in Headers */, DA88482E1CBAFA6200AB86E3 /* NSException+MGLAdditions.h in Headers */, - DA8848551CBAFB9800AB86E3 /* MGLLocationManager.h in Headers */, 96F3F73C1F57124B003E2D2C /* MGLUserLocationHeadingIndicator.h in Headers */, 408AA8571DAEDA1700022900 /* NSDictionary+MGLAdditions.h in Headers */, DA88483F1CBAFB8500AB86E3 /* MGLUserLocation.h in Headers */, @@ -2037,7 +2276,6 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 96E516FE20005A4C00A02306 /* MGLLocationManager.h in Headers */, 556660CA1E1BF3A900E2C41B /* MGLFoundation.h in Headers */, 96E516ED200058A200A02306 /* MGLComputedShapeSource.h in Headers */, 35B82BF91D6C5F8400B1B721 /* NSPredicate+MGLAdditions.h in Headers */, @@ -2165,7 +2403,6 @@ DAF0D8191DFE6B2800B28378 /* MGLAttributionInfo_Private.h in Headers */, DABFB86A1CBE99E500D62B32 /* MGLStyle.h in Headers */, DA00FC8F1D5EEB0D009AABC8 /* MGLAttributionInfo.h in Headers */, - 96E516FD20005A4700A02306 /* MGLAPIClient.h in Headers */, 96E5170320005A6800A02306 /* FABKitProtocol.h in Headers */, 96E516E12000551100A02306 /* MGLMultiPoint_Private.h in Headers */, 3EA934623AD0000B7D99C3FB /* MGLRendererConfiguration.h in Headers */, @@ -2494,11 +2731,6 @@ DA8933F01CCD387900E68420 /* strip-frameworks.sh in Resources */, DAC49C5C1CD02BC9009E1AA3 /* Localizable.stringsdict in Resources */, DA8933BF1CCD2CAD00E68420 /* Foundation.stringsdict in Resources */, - 40EA6BC11EF4599600FCCDA2 /* api_mapbox_com-digicert_2017.der in Resources */, - 408982E91DEE208200754016 /* api_mapbox_staging.der in Resources */, - 408982EA1DEE208B00754016 /* api_mapbox_com-digicert_2016.der in Resources */, - 40EA6BC31EF4599D00FCCDA2 /* api_mapbox_com-geotrust_2017.der in Resources */, - 408982EB1DEE209100754016 /* api_mapbox_com-geotrust_2016.der in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2510,12 +2742,7 @@ DA8933DB1CCD31D400E68420 /* Foundation.strings in Resources */, 960D0C371ECF5AAF008E151F /* Images.xcassets in Resources */, DA8933DC1CCD31D400E68420 /* Foundation.stringsdict in Resources */, - 40EA6BC41EF4599D00FCCDA2 /* api_mapbox_com-geotrust_2017.der in Resources */, DAC49C5D1CD02BC9009E1AA3 /* Localizable.stringsdict in Resources */, - 40599F0C1DEE1B7600182B5D /* api_mapbox_staging.der in Resources */, - 40599F0D1DEE1B7A00182B5D /* api_mapbox_com-digicert_2016.der in Resources */, - 40599F0E1DEE1B7E00182B5D /* api_mapbox_com-geotrust_2016.der in Resources */, - 40EA6BC21EF4599700FCCDA2 /* api_mapbox_com-digicert_2017.der in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2625,28 +2852,44 @@ files = ( 35136D391D42271A00C20EFD /* MGLBackgroundStyleLayer.mm in Sources */, 3510FFEC1D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.mm in Sources */, + 40834C431FE05F7500C1BD0D /* TSKSPKIHashCache.m in Sources */, DAED38651D62D0FC00D7640F /* NSURL+MGLAdditions.m in Sources */, + 40834BEC1FE05E1800C1BD0D /* MMEEvent.m in Sources */, 9620BB3A1E69FE1700705A1D /* MGLSDKUpdateChecker.mm in Sources */, 354B83981D2E873E005D9406 /* MGLUserLocationAnnotationView.m in Sources */, + 40834BEE1FE05E1800C1BD0D /* MMEEventsConfiguration.m in Sources */, DA88485D1CBAFB9800AB86E3 /* MGLFaux3DUserLocationAnnotationView.m in Sources */, DAD165701CF41981001FF4B9 /* MGLFeature.mm in Sources */, 30E578191DAA855E0050F07E /* UIImage+MGLAdditions.mm in Sources */, 40EDA1C11CFE0E0500D9EA68 /* MGLAnnotationContainerView.m in Sources */, + 40834C481FE05F7500C1BD0D /* vendor_identifier.m in Sources */, DA8848541CBAFB9800AB86E3 /* MGLCompactCalloutView.m in Sources */, + 40834BEB1FE05E1800C1BD0D /* MMEDependencyManager.m in Sources */, + 40834C411FE05F7500C1BD0D /* parse_configuration.m in Sources */, DA8848251CBAFA6200AB86E3 /* MGLPointAnnotation.mm in Sources */, + 40834BEA1FE05E1800C1BD0D /* MMEConstants.m in Sources */, 929EFFAB1F56DCD4003A77D5 /* MGLAnnotationView.mm in Sources */, 35136D3C1D42272500C20EFD /* MGLCircleStyleLayer.mm in Sources */, DD9BE4F81EB263C50079A3AF /* UIViewController+MGLAdditions.m in Sources */, 350098DE1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.mm in Sources */, DA6408DD1DA4E7D300908C90 /* MGLVectorStyleLayer.m in Sources */, + 40834BF71FE05E1800C1BD0D /* MMEUniqueIdentifier.m in Sources */, 3566C7681D4A77BA008152BC /* MGLShapeSource.mm in Sources */, + 40834C4A1FE05F7500C1BD0D /* TSKPinningValidator.m in Sources */, 400533021DB0862B0069F638 /* NSArray+MGLAdditions.mm in Sources */, 96036A03200565C700510F3D /* NSOrthography+MGLAdditions.m in Sources */, + 40834BF31FE05E1800C1BD0D /* MMETimerManager.m in Sources */, 35136D421D42274500C20EFD /* MGLRasterStyleLayer.mm in Sources */, 3538AA1F1D542239008EC33D /* MGLForegroundStyleLayer.mm in Sources */, + 40834BF11FE05E1800C1BD0D /* MMENSDateWrapper.m in Sources */, + 40834C461FE05F7500C1BD0D /* TSKPinFailureReport.m in Sources */, + 406E99B91FFEFF1B00D9FFCC /* MMEEventLogReportViewController.m in Sources */, + 40834BE61FE05E1800C1BD0D /* CLLocation+MMEMobileEvents.m in Sources */, DA00FC901D5EEB0D009AABC8 /* MGLAttributionInfo.mm in Sources */, DA88482D1CBAFA6200AB86E3 /* NSBundle+MGLAdditions.m in Sources */, + 406E99BB1FFF006C00D9FFCC /* MMEUINavigation.m in Sources */, 966FCF541F3C323300F2B6DE /* MGLUserLocationHeadingArrowLayer.m in Sources */, + 40834BE81FE05E1800C1BD0D /* MMECategoryLoader.m in Sources */, DA88485B1CBAFB9800AB86E3 /* MGLUserLocation.m in Sources */, 927FBD011F4DB05500F8BF1F /* MGLMapSnapshotter.mm in Sources */, 350098BD1D480108004B2AF0 /* MGLVectorSource.mm in Sources */, @@ -2657,27 +2900,37 @@ DA35A2B81CCA9A5D00E826B2 /* MGLClockDirectionFormatter.m in Sources */, DAD1657A1CF4CDFF001FF4B9 /* MGLShapeCollection.mm in Sources */, DAF25719201901E200367EF5 /* MGLHillshadeStyleLayer.mm in Sources */, + 40834BF51FE05E1800C1BD0D /* MMETypes.m in Sources */, 35136D451D42275100C20EFD /* MGLSymbolStyleLayer.mm in Sources */, + 40834C491FE05F7500C1BD0D /* TrustKit.m in Sources */, 35599DED1D46F14E0048254D /* MGLStyleValue.mm in Sources */, DA8848211CBAFA6200AB86E3 /* MGLOfflinePack.mm in Sources */, 0778DD441F67556C00A73B34 /* MGLComputedShapeSource.mm in Sources */, 3557F7B21E1D27D300CCA5E6 /* MGLDistanceFormatter.m in Sources */, + 40834C4B1FE05F7500C1BD0D /* TSKPinningValidatorResult.m in Sources */, + 40834BE71FE05E1800C1BD0D /* MMEAPIClient.m in Sources */, DA8848591CBAFB9800AB86E3 /* MGLMapView.mm in Sources */, DA8848501CBAFB9800AB86E3 /* MGLAnnotationImage.m in Sources */, + 40834BF01FE05E1800C1BD0D /* MMELocationManager.m in Sources */, DA8848281CBAFA6200AB86E3 /* MGLShape.mm in Sources */, DA35A2B31CCA141D00E826B2 /* MGLCompassDirectionFormatter.m in Sources */, DD0902A91DB1929D00C5BDCE /* MGLNetworkConfiguration.m in Sources */, 35D13AB91D3D15E300AFB4E0 /* MGLStyleLayer.mm in Sources */, + 40834C4C1FE05F7500C1BD0D /* TSKTrustKitConfig.m in Sources */, DA35A2CB1CCAAAD200E826B2 /* NSValue+MGLAdditions.m in Sources */, 071BBB001EE7613F001FB02A /* MGLImageSource.mm in Sources */, DA8848321CBAFA6200AB86E3 /* NSString+MGLAdditions.m in Sources */, + 40834C441FE05F7500C1BD0D /* reporting_utils.m in Sources */, 408AA8581DAEDA1E00022900 /* NSDictionary+MGLAdditions.mm in Sources */, DA35A2A11CC9E95F00E826B2 /* MGLCoordinateFormatter.m in Sources */, 35305D481D22AA680007D005 /* NSData+MGLAdditions.mm in Sources */, + 40834BF61FE05E1800C1BD0D /* MMEUIApplicationWrapper.m in Sources */, DA8848291CBAFA6200AB86E3 /* MGLStyle.mm in Sources */, 357FE2DF1E02D2B20068B753 /* NSCoder+MGLAdditions.mm in Sources */, + 40834BF81FE05E1800C1BD0D /* NSData+MMEGZIP.m in Sources */, DA88481C1CBAFA6200AB86E3 /* MGLGeometry.mm in Sources */, 558DE7A21E5615E400C7916D /* MGLFoundation.mm in Sources */, + 40834BE91FE05E1800C1BD0D /* MMECommonEventData.m in Sources */, 3510FFF21D6D9D8C00F413B2 /* NSExpression+MGLAdditions.mm in Sources */, DA88481F1CBAFA6200AB86E3 /* MGLMultiPoint.mm in Sources */, DA88482B1CBAFA6200AB86E3 /* MGLTypes.m in Sources */, @@ -2685,21 +2938,29 @@ 404C26E41D89B877000AA13D /* MGLTileSource.mm in Sources */, 07D947541F67489200E37934 /* MGLAbstractShapeSource.mm in Sources */, 355AE0011E9281DA00F3939D /* MGLScaleBar.mm in Sources */, + 40834C451FE05F7500C1BD0D /* TSKBackgroundReporter.m in Sources */, DA88481D1CBAFA6200AB86E3 /* MGLMapCamera.mm in Sources */, DACA86282019218600E9693A /* MGLRasterDEMSource.mm in Sources */, DA8848261CBAFA6200AB86E3 /* MGLPolygon.mm in Sources */, 35B82BFA1D6C5F8400B1B721 /* NSPredicate+MGLAdditions.mm in Sources */, - DA8848521CBAFB9800AB86E3 /* MGLAPIClient.m in Sources */, + 40834C401FE05F7500C1BD0D /* configuration_utils.m in Sources */, + 40834BF91FE05E1800C1BD0D /* MMEReachability.m in Sources */, + 40834BF21FE05E1800C1BD0D /* MMENSURLSessionWrapper.m in Sources */, + 40834C471FE05F7500C1BD0D /* TSKReportsRateLimiter.m in Sources */, 966FCF4E1F3A5C9200F2B6DE /* MGLUserLocationHeadingBeamLayer.m in Sources */, 8989B17E201A48EB0081CF59 /* MGLHeatmapStyleLayer.mm in Sources */, DA8848301CBAFA6200AB86E3 /* NSProcessInfo+MGLAdditions.m in Sources */, + 40834BED1FE05E1800C1BD0D /* MMEEventLogger.m in Sources */, 353AFA161D65AB17005A69F4 /* NSDate+MGLAdditions.mm in Sources */, + 40834BF41FE05E1800C1BD0D /* MMETrustKitWrapper.m in Sources */, + 40834BEF1FE05E1800C1BD0D /* MMEEventsManager.m in Sources */, 35D13AC51D3D19DD00AFB4E0 /* MGLFillStyleLayer.mm in Sources */, DA8848241CBAFA6200AB86E3 /* MGLOfflineStorage.mm in Sources */, DA88482A1CBAFA6200AB86E3 /* MGLTilePyramidOfflineRegion.mm in Sources */, 4049C29F1DB6CD6C00B3F799 /* MGLPointCollection.mm in Sources */, 35136D3F1D42273000C20EFD /* MGLLineStyleLayer.mm in Sources */, DA704CC41F65A475004B3F28 /* MGLMapAccessibilityElement.mm in Sources */, + 40834C421FE05F7500C1BD0D /* ssl_pin_verifier.m in Sources */, DA72620D1DEEE3480043BB89 /* MGLOpenGLStyleLayer.mm in Sources */, DA88481A1CBAFA6200AB86E3 /* MGLAccountManager.m in Sources */, 3510FFFB1D6DCC4700F413B2 /* NSCompoundPredicate+MGLAdditions.mm in Sources */, @@ -2707,7 +2968,6 @@ DA8848271CBAFA6200AB86E3 /* MGLPolyline.mm in Sources */, DA8848581CBAFB9800AB86E3 /* MGLMapboxEvents.m in Sources */, 35CE61841D4165D9004F2359 /* UIColor+MGLAdditions.mm in Sources */, - DA8848561CBAFB9800AB86E3 /* MGLLocationManager.m in Sources */, 3EA93369F61CF70AFA50465D /* MGLRendererConfiguration.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -2718,28 +2978,43 @@ files = ( 35136D3A1D42271A00C20EFD /* MGLBackgroundStyleLayer.mm in Sources */, 3510FFED1D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.mm in Sources */, + 40834C501FE05F7600C1BD0D /* TSKSPKIHashCache.m in Sources */, 354B83991D2E873E005D9406 /* MGLUserLocationAnnotationView.m in Sources */, + 40834C001FE05E1800C1BD0D /* MMEEvent.m in Sources */, 9620BB3B1E69FE1700705A1D /* MGLSDKUpdateChecker.mm in Sources */, DAA4E4221CBB730400178DFB /* MGLPointAnnotation.mm in Sources */, + 40834C021FE05E1800C1BD0D /* MMEEventsConfiguration.m in Sources */, DAED38661D62D0FC00D7640F /* NSURL+MGLAdditions.m in Sources */, DAD165711CF41981001FF4B9 /* MGLFeature.mm in Sources */, 30E5781A1DAA855E0050F07E /* UIImage+MGLAdditions.mm in Sources */, 40EDA1C21CFE0E0500D9EA68 /* MGLAnnotationContainerView.m in Sources */, + 40834C551FE05F7600C1BD0D /* vendor_identifier.m in Sources */, DAA4E4291CBB730400178DFB /* NSBundle+MGLAdditions.m in Sources */, - DAA4E42E1CBB730400178DFB /* MGLAPIClient.m in Sources */, + 40834BFF1FE05E1800C1BD0D /* MMEDependencyManager.m in Sources */, + 40834C4E1FE05F7600C1BD0D /* parse_configuration.m in Sources */, + 40834BFE1FE05E1800C1BD0D /* MMEConstants.m in Sources */, 35136D3D1D42272500C20EFD /* MGLCircleStyleLayer.mm in Sources */, DD9BE4FA1EB263F40079A3AF /* UIViewController+MGLAdditions.m in Sources */, 350098DF1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.mm in Sources */, DA6408DE1DA4E7D300908C90 /* MGLVectorStyleLayer.m in Sources */, 3566C7691D4A77BA008152BC /* MGLShapeSource.mm in Sources */, + 40834C0B1FE05E1800C1BD0D /* MMEUniqueIdentifier.m in Sources */, 400533031DB086490069F638 /* NSArray+MGLAdditions.mm in Sources */, + 40834C571FE05F7600C1BD0D /* TSKPinningValidator.m in Sources */, 35136D431D42274500C20EFD /* MGLRasterStyleLayer.mm in Sources */, 96036A04200565C700510F3D /* NSOrthography+MGLAdditions.m in Sources */, + 40834C071FE05E1800C1BD0D /* MMETimerManager.m in Sources */, 3538AA201D542239008EC33D /* MGLForegroundStyleLayer.mm in Sources */, DA00FC911D5EEB0D009AABC8 /* MGLAttributionInfo.mm in Sources */, + 40834C051FE05E1800C1BD0D /* MMENSDateWrapper.m in Sources */, + 40834C531FE05F7600C1BD0D /* TSKPinFailureReport.m in Sources */, + 40834BFA1FE05E1800C1BD0D /* CLLocation+MMEMobileEvents.m in Sources */, + 406E99BA1FFEFF1B00D9FFCC /* MMEEventLogReportViewController.m in Sources */, DAA4E4201CBB730400178DFB /* MGLOfflinePack.mm in Sources */, 966FCF551F3C323500F2B6DE /* MGLUserLocationHeadingArrowLayer.m in Sources */, DAA4E4331CBB730400178DFB /* MGLUserLocation.m in Sources */, + 406E99BC1FFF006D00D9FFCC /* MMEUINavigation.m in Sources */, + 40834BFC1FE05E1800C1BD0D /* MMECategoryLoader.m in Sources */, 927FBD021F4DB05500F8BF1F /* MGLMapSnapshotter.mm in Sources */, 350098BE1D480108004B2AF0 /* MGLVectorSource.mm in Sources */, 3566C76F1D4A8DFA008152BC /* MGLRasterSource.mm in Sources */, @@ -2750,27 +3025,36 @@ DAA4E4251CBB730400178DFB /* MGLShape.mm in Sources */, 35136D461D42275100C20EFD /* MGLSymbolStyleLayer.mm in Sources */, DAF2571A201901E200367EF5 /* MGLHillshadeStyleLayer.mm in Sources */, + 40834C091FE05E1800C1BD0D /* MMETypes.m in Sources */, 35599DEE1D46F14E0048254D /* MGLStyleValue.mm in Sources */, + 40834C561FE05F7600C1BD0D /* TrustKit.m in Sources */, DAA4E42B1CBB730400178DFB /* NSString+MGLAdditions.m in Sources */, DAA4E4261CBB730400178DFB /* MGLStyle.mm in Sources */, DAA32CC31E4C6B65006F8D24 /* MGLDistanceFormatter.m in Sources */, DAA4E41D1CBB730400178DFB /* MGLGeometry.mm in Sources */, + 40834C581FE05F7600C1BD0D /* TSKPinningValidatorResult.m in Sources */, + 40834BFB1FE05E1800C1BD0D /* MMEAPIClient.m in Sources */, DAA4E41F1CBB730400178DFB /* MGLMultiPoint.mm in Sources */, DD0902AA1DB1929D00C5BDCE /* MGLNetworkConfiguration.m in Sources */, + 40834C041FE05E1800C1BD0D /* MMELocationManager.m in Sources */, DA35A2B41CCA141D00E826B2 /* MGLCompassDirectionFormatter.m in Sources */, 35D13ABA1D3D15E300AFB4E0 /* MGLStyleLayer.mm in Sources */, 071BBAFF1EE7613E001FB02A /* MGLImageSource.mm in Sources */, DA35A2CC1CCAAAD200E826B2 /* NSValue+MGLAdditions.m in Sources */, + 40834C591FE05F7600C1BD0D /* TSKTrustKitConfig.m in Sources */, 408AA8591DAEDA1E00022900 /* NSDictionary+MGLAdditions.mm in Sources */, DAA4E4281CBB730400178DFB /* MGLTypes.m in Sources */, DA35A2A21CC9E95F00E826B2 /* MGLCoordinateFormatter.m in Sources */, + 40834C511FE05F7600C1BD0D /* reporting_utils.m in Sources */, 35305D491D22AA680007D005 /* NSData+MGLAdditions.mm in Sources */, 357FE2E01E02D2B20068B753 /* NSCoder+MGLAdditions.mm in Sources */, DAA4E42D1CBB730400178DFB /* MGLAnnotationImage.m in Sources */, + 40834C0A1FE05E1800C1BD0D /* MMEUIApplicationWrapper.m in Sources */, 558DE7A31E5615E400C7916D /* MGLFoundation.mm in Sources */, 3510FFF31D6D9D8C00F413B2 /* NSExpression+MGLAdditions.mm in Sources */, - DAA4E4301CBB730400178DFB /* MGLLocationManager.m in Sources */, + 40834C0C1FE05E1800C1BD0D /* NSData+MMEGZIP.m in Sources */, DAA4E4321CBB730400178DFB /* MGLMapView.mm in Sources */, + 40834BFD1FE05E1800C1BD0D /* MMECommonEventData.m in Sources */, DAA4E41E1CBB730400178DFB /* MGLMapCamera.mm in Sources */, FA68F14E1E9D656600F9F6C2 /* MGLFillExtrusionStyleLayer.mm in Sources */, 1F7454921ECBB42C00021D39 /* MGLLight.mm in Sources */, @@ -2778,21 +3062,30 @@ 355AE0021E9281DA00F3939D /* MGLScaleBar.mm in Sources */, 4018B1C81CDC287F00F666AF /* MGLAnnotationView.mm in Sources */, 07D8C6FB1F67560100381808 /* MGLComputedShapeSource.mm in Sources */, + 40834C521FE05F7600C1BD0D /* TSKBackgroundReporter.m in Sources */, DAA4E4341CBB730400178DFB /* MGLFaux3DUserLocationAnnotationView.m in Sources */, DACA86292019218600E9693A /* MGLRasterDEMSource.mm in Sources */, 35B82BFB1D6C5F8400B1B721 /* NSPredicate+MGLAdditions.mm in Sources */, + 40834C4D1FE05F7600C1BD0D /* configuration_utils.m in Sources */, + 40834C0D1FE05E1800C1BD0D /* MMEReachability.m in Sources */, + 40834C061FE05E1800C1BD0D /* MMENSURLSessionWrapper.m in Sources */, + 40834C541FE05F7600C1BD0D /* TSKReportsRateLimiter.m in Sources */, DAA4E4311CBB730400178DFB /* MGLMapboxEvents.m in Sources */, 966FCF4F1F3A5C9200F2B6DE /* MGLUserLocationHeadingBeamLayer.m in Sources */, DAA4E4231CBB730400178DFB /* MGLPolygon.mm in Sources */, 8989B17F201A48EB0081CF59 /* MGLHeatmapStyleLayer.mm in Sources */, 353AFA171D65AB17005A69F4 /* NSDate+MGLAdditions.mm in Sources */, + 40834C011FE05E1800C1BD0D /* MMEEventLogger.m in Sources */, 35D13AC61D3D19DD00AFB4E0 /* MGLFillStyleLayer.mm in Sources */, + 40834C081FE05E1800C1BD0D /* MMETrustKitWrapper.m in Sources */, + 40834C031FE05E1800C1BD0D /* MMEEventsManager.m in Sources */, DAA4E42A1CBB730400178DFB /* NSProcessInfo+MGLAdditions.m in Sources */, DAA4E4211CBB730400178DFB /* MGLOfflineStorage.mm in Sources */, 4049C2A01DB6CD6C00B3F799 /* MGLPointCollection.mm in Sources */, 07D8C6FC1F67560400381808 /* MGLAbstractShapeSource.mm in Sources */, 35136D401D42273000C20EFD /* MGLLineStyleLayer.mm in Sources */, DA704CC51F65A475004B3F28 /* MGLMapAccessibilityElement.mm in Sources */, + 40834C4F1FE05F7600C1BD0D /* ssl_pin_verifier.m in Sources */, DA72620E1DEEE3480043BB89 /* MGLOpenGLStyleLayer.mm in Sources */, DAA4E42F1CBB730400178DFB /* MGLCompactCalloutView.m in Sources */, 3510FFFC1D6DCC4700F413B2 /* NSCompoundPredicate+MGLAdditions.mm in Sources */, @@ -3347,6 +3640,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "$SRCROOT/src/Mapbox-Prefix.pch"; HEADER_SEARCH_PATHS = ( "$(mbgl_core_INCLUDE_DIRECTORIES)", "$(mbgl_filesource_INCLUDE_DIRECTORIES)", @@ -3389,6 +3683,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "$SRCROOT/src/Mapbox-Prefix.pch"; HEADER_SEARCH_PATHS = ( "$(mbgl_core_INCLUDE_DIRECTORIES)", "$(mbgl_filesource_INCLUDE_DIRECTORIES)", diff --git a/platform/ios/resources/api_mapbox_com-digicert_2016.der b/platform/ios/resources/api_mapbox_com-digicert_2016.der deleted file mode 100644 index e8ef427f33..0000000000 Binary files a/platform/ios/resources/api_mapbox_com-digicert_2016.der and /dev/null differ diff --git a/platform/ios/resources/api_mapbox_com-digicert_2017.der b/platform/ios/resources/api_mapbox_com-digicert_2017.der deleted file mode 100644 index 4a190085ab..0000000000 Binary files a/platform/ios/resources/api_mapbox_com-digicert_2017.der and /dev/null differ diff --git a/platform/ios/resources/api_mapbox_com-geotrust_2016.der b/platform/ios/resources/api_mapbox_com-geotrust_2016.der deleted file mode 100644 index 1c7331dedc..0000000000 Binary files a/platform/ios/resources/api_mapbox_com-geotrust_2016.der and /dev/null differ diff --git a/platform/ios/resources/api_mapbox_com-geotrust_2017.der b/platform/ios/resources/api_mapbox_com-geotrust_2017.der deleted file mode 100644 index 7bb9befbbf..0000000000 Binary files a/platform/ios/resources/api_mapbox_com-geotrust_2017.der and /dev/null differ diff --git a/platform/ios/resources/api_mapbox_staging.der b/platform/ios/resources/api_mapbox_staging.der deleted file mode 100644 index 45f7df7c49..0000000000 Binary files a/platform/ios/resources/api_mapbox_staging.der and /dev/null differ diff --git a/platform/ios/src/MGLAPIClient.h b/platform/ios/src/MGLAPIClient.h deleted file mode 100644 index 4e5ea3b5e0..0000000000 --- a/platform/ios/src/MGLAPIClient.h +++ /dev/null @@ -1,15 +0,0 @@ -#import - -#import "MGLMapboxEvents.h" -#import "MGLTypes.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface MGLAPIClient : NSObject - -- (void)postEvents:(NS_ARRAY_OF(MGLMapboxEventAttributes *) *)events completionHandler:(nullable void (^)(NSError * _Nullable error))completionHandler; -- (void)postEvent:(MGLMapboxEventAttributes *)event completionHandler:(nullable void (^)(NSError * _Nullable error))completionHandler; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/ios/src/MGLAPIClient.m b/platform/ios/src/MGLAPIClient.m deleted file mode 100644 index 8a987d76d8..0000000000 --- a/platform/ios/src/MGLAPIClient.m +++ /dev/null @@ -1,202 +0,0 @@ -#import "MGLAPIClient.h" -#import "NSBundle+MGLAdditions.h" -#import "NSData+MGLAdditions.h" -#import "MGLAccountManager.h" - -static NSString * const MGLAPIClientUserAgentBase = @"MapboxEventsiOS"; -static NSString * const MGLAPIClientBaseURL = @"https://events.mapbox.com"; -static NSString * const MGLAPIClientEventsPath = @"events/v2"; - -static NSString * const MGLAPIClientHeaderFieldUserAgentKey = @"User-Agent"; -static NSString * const MGLAPIClientHeaderFieldContentTypeKey = @"Content-Type"; -static NSString * const MGLAPIClientHeaderFieldContentTypeValue = @"application/json"; -static NSString * const MGLAPIClientHeaderFieldContentEncodingKey = @"Content-Encoding"; -static NSString * const MGLAPIClientHTTPMethodPost = @"POST"; - -@interface MGLAPIClient () - -@property (nonatomic, copy) NSURLSession *session; -@property (nonatomic, copy) NSURL *baseURL; -@property (nonatomic, copy) NSData *digicertCert_2016; -@property (nonatomic, copy) NSData *geoTrustCert_2016; -@property (nonatomic, copy) NSData *digicertCert_2017; -@property (nonatomic, copy) NSData *geoTrustCert_2017; -@property (nonatomic, copy) NSData *testServerCert; -@property (nonatomic, copy) NSString *userAgent; -@property (nonatomic) BOOL usesTestServer; - -@end - -@implementation MGLAPIClient - -- (instancetype)init { - self = [super init]; - if (self) { - _session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration] - delegate:self delegateQueue:nil]; - [self loadCertificates]; - [self setupBaseURL]; - [self setupUserAgent]; - } - return self; -} - -#pragma mark Public API - -- (void)postEvents:(nonnull NS_ARRAY_OF(MGLMapboxEventAttributes *) *)events completionHandler:(nullable void (^)(NSError * _Nullable error))completionHandler { - __block NSURLSessionDataTask *dataTask = [self.session dataTaskWithRequest:[self requestForEvents:events] - completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { - NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; - NSError *statusError = nil; - if (httpResponse.statusCode >= 400) { - NSString *description = [NSString stringWithFormat:NSLocalizedStringWithDefaultValue(@"API_CLIENT_400_DESC", nil, nil, @"The session data task failed. Original request was: %@", nil), dataTask.originalRequest]; - NSString *reason = [NSString stringWithFormat:NSLocalizedStringWithDefaultValue(@"API_CLIENT_400_REASON", nil, nil, @"The status code was %ld", nil), (long)httpResponse.statusCode]; - NSDictionary *userInfo = @{NSLocalizedDescriptionKey: description, - NSLocalizedFailureReasonErrorKey: reason}; - statusError = [NSError errorWithDomain:MGLErrorDomain code:1 userInfo:userInfo]; - } - if (completionHandler) { - error = error ?: statusError; - completionHandler(error); - } - dataTask = nil; - }]; - [dataTask resume]; -} - -- (void)postEvent:(nonnull MGLMapboxEventAttributes *)event completionHandler:(nullable void (^)(NSError * _Nullable error))completionHandler { - [self postEvents:@[event] completionHandler:completionHandler]; -} - -#pragma mark Utilities - -- (NSURLRequest *)requestForEvents:(NS_ARRAY_OF(MGLMapboxEventAttributes *) *)events { - NSString *path = [NSString stringWithFormat:@"%@?access_token=%@", MGLAPIClientEventsPath, [MGLAccountManager accessToken]]; - NSURL *url = [NSURL URLWithString:path relativeToURL:self.baseURL]; - NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url]; - [request setValue:self.userAgent forHTTPHeaderField:MGLAPIClientHeaderFieldUserAgentKey]; - [request setValue:MGLAPIClientHeaderFieldContentTypeValue forHTTPHeaderField:MGLAPIClientHeaderFieldContentTypeKey]; - [request setHTTPMethod:MGLAPIClientHTTPMethodPost]; - - NSData *jsonData = [self serializedDataForEvents:events]; - - // Compressing less than 3 events can have a negative impact on the size. - if (events.count > 2) { - NSData *compressedData = [jsonData mgl_compressedData]; - [request setValue:@"deflate" forHTTPHeaderField:MGLAPIClientHeaderFieldContentEncodingKey]; - [request setHTTPBody:compressedData]; - } - - // Set JSON data if events.count were less than 3 or something went wrong with compressing HTTP body data. - if (!request.HTTPBody) { - [request setValue:nil forHTTPHeaderField:MGLAPIClientHeaderFieldContentEncodingKey]; - [request setHTTPBody:jsonData]; - } - - return [request copy]; -} - -- (void)setupBaseURL { - NSString *testServerURLString = [[NSUserDefaults standardUserDefaults] stringForKey:@"MGLTelemetryTestServerURL"]; - NSURL *testServerURL = [NSURL URLWithString:testServerURLString]; - if (testServerURL && [testServerURL.scheme isEqualToString:@"https"]) { - self.baseURL = testServerURL; - self.usesTestServer = YES; - } else { - self.baseURL = [NSURL URLWithString:MGLAPIClientBaseURL]; - } -} - -- (void)loadCertificates { - NSData *certificate; - [self loadCertificate:&certificate withResource:@"api_mapbox_com-geotrust_2016"]; - self.geoTrustCert_2016 = certificate; - [self loadCertificate:&certificate withResource:@"api_mapbox_com-digicert_2016"]; - self.digicertCert_2016 = certificate; - [self loadCertificate:&certificate withResource:@"api_mapbox_com-geotrust_2017"]; - self.geoTrustCert_2017 = certificate; - [self loadCertificate:&certificate withResource:@"api_mapbox_com-digicert_2017"]; - self.digicertCert_2017 = certificate; - [self loadCertificate:&certificate withResource:@"api_mapbox_staging"]; - self.testServerCert = certificate; -} - -- (void)loadCertificate:(NSData **)certificate withResource:(NSString *)resource { - NSBundle *frameworkBundle = [NSBundle mgl_frameworkBundle]; - NSString *cerPath = [frameworkBundle pathForResource:resource ofType:@"der"]; - if (cerPath != nil) { - *certificate = [NSData dataWithContentsOfFile:cerPath]; - } -} - -- (void)setupUserAgent { - NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"]; - NSString *appVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; - NSString *appBuildNumber = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]; - NSString *semanticVersion = [NSBundle mgl_frameworkInfoDictionary][@"MGLSemanticVersionString"]; - NSString *shortVersion = [NSBundle mgl_frameworkInfoDictionary][@"CFBundleShortVersionString"]; - NSString *sdkVersion = semanticVersion ?: shortVersion; - _userAgent = [NSString stringWithFormat:@"%@/%@/%@ %@/%@", appName, appVersion, appBuildNumber, MGLAPIClientUserAgentBase, sdkVersion]; -} - -#pragma mark - JSON Serialization - -- (NSData *)serializedDataForEvents:(NS_ARRAY_OF(MGLMapboxEventAttributes *) *)events { - return [NSJSONSerialization dataWithJSONObject:events options:0 error:nil]; -} - -#pragma mark NSURLSessionDelegate - -- (BOOL)evaluateCertificateWithCertificateData:(NSData *)certificateData keyCount:(CFIndex)keyCount serverTrust:(SecTrustRef)serverTrust challenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^) (NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler { - for (int lc = 0; lc < keyCount; lc++) { - SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, lc); - NSData *remoteCertificateData = CFBridgingRelease(SecCertificateCopyData(certificate)); - if ([remoteCertificateData isEqualToData:certificateData]) { - completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]); - return YES; - } - } - return NO; -} - -- (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^) (NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler { - - if([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { - SecTrustRef serverTrust = [[challenge protectionSpace] serverTrust]; - SecTrustResultType trustResult; - - // Validate the certificate chain with the device's trust store anyway this *might* use revocation checking - SecTrustEvaluate(serverTrust, &trustResult); - - BOOL found = NO; // For clarity; we start in a state where the challange has not been completed and no certificate has been found - - if (trustResult == kSecTrustResultUnspecified) { - // Look for a pinned certificate in the server's certificate chain - CFIndex numKeys = SecTrustGetCertificateCount(serverTrust); - - // Check certs in the following order: digicert 2016, digicert 2017, geotrust 2016, geotrust 2017 - found = [self evaluateCertificateWithCertificateData:self.digicertCert_2016 keyCount:numKeys serverTrust:serverTrust challenge:challenge completionHandler:completionHandler]; - if (!found) { - found = [self evaluateCertificateWithCertificateData:self.digicertCert_2017 keyCount:numKeys serverTrust:serverTrust challenge:challenge completionHandler:completionHandler]; - } - if (!found) { - found = [self evaluateCertificateWithCertificateData:self.geoTrustCert_2016 keyCount:numKeys serverTrust:serverTrust challenge:challenge completionHandler:completionHandler]; - } - if (!found) { - found = [self evaluateCertificateWithCertificateData:self.geoTrustCert_2017 keyCount:numKeys serverTrust:serverTrust challenge:challenge completionHandler:completionHandler]; - } - - // If challenge can't be completed with any of the above certs, then try the test server if the app is configured to use the test server - if (!found && _usesTestServer) { - found = [self evaluateCertificateWithCertificateData:self.testServerCert keyCount:numKeys serverTrust:serverTrust challenge:challenge completionHandler:completionHandler]; - } - } - - if (!found) { - // No certificate was found so cancel the connection. - completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]); - } - } -} - -@end diff --git a/platform/ios/src/MGLLocationManager.h b/platform/ios/src/MGLLocationManager.h deleted file mode 100644 index ea23801813..0000000000 --- a/platform/ios/src/MGLLocationManager.h +++ /dev/null @@ -1,25 +0,0 @@ -#import -#import - -@protocol MGLLocationManagerDelegate; - -@interface MGLLocationManager : NSObject - -@property (nonatomic, weak) id delegate; - -- (void)startUpdatingLocation; -- (void)stopUpdatingLocation; - -@end - -@protocol MGLLocationManagerDelegate - -@optional - -- (void)locationManager:(MGLLocationManager *)locationManager didUpdateLocations:(NSArray *)locations; -- (void)locationManagerDidStartLocationUpdates:(MGLLocationManager *)locationManager; -- (void)locationManagerBackgroundLocationUpdatesDidTimeout:(MGLLocationManager *)locationManager; -- (void)locationManagerBackgroundLocationUpdatesDidAutomaticallyPause:(MGLLocationManager *)locationManager; -- (void)locationManagerDidStopLocationUpdates:(MGLLocationManager *)locationManager; - -@end diff --git a/platform/ios/src/MGLLocationManager.m b/platform/ios/src/MGLLocationManager.m deleted file mode 100644 index 85ef4ca489..0000000000 --- a/platform/ios/src/MGLLocationManager.m +++ /dev/null @@ -1,175 +0,0 @@ -#import "MGLLocationManager.h" -#import "MGLTelemetryConfig.h" -#import - -static const NSTimeInterval MGLLocationManagerHibernationTimeout = 300.0; -static const NSTimeInterval MGLLocationManagerHibernationPollInterval = 5.0; -static const CLLocationDistance MGLLocationManagerDistanceFilter = 5.0; -static NSString * const MGLLocationManagerRegionIdentifier = @"MGLLocationManagerRegionIdentifier.fence.center"; - -@interface MGLLocationManager () - -@property (nonatomic) CLLocationManager *standardLocationManager; -@property (nonatomic) BOOL hostAppHasBackgroundCapability; -@property (nonatomic, getter=isUpdatingLocation) BOOL updatingLocation; -@property (nonatomic) NSDate *backgroundLocationServiceTimeoutAllowedDate; -@property (nonatomic) NSTimer *backgroundLocationServiceTimeoutTimer; - -@end - -@implementation MGLLocationManager - -- (instancetype)init { - self = [super init]; - if (self) { - NSArray *backgroundModes = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIBackgroundModes"]; - _hostAppHasBackgroundCapability = [backgroundModes containsObject:@"location"]; - } - return self; -} - -- (void)startUpdatingLocation { - if ([self isUpdatingLocation]) { - return; - } - - [self configurePassiveStandardLocationManager]; - [self startLocationServices]; -} - -- (void)stopUpdatingLocation { - if ([self isUpdatingLocation]) { - [self.standardLocationManager stopUpdatingLocation]; - [self.standardLocationManager stopMonitoringSignificantLocationChanges]; - self.updatingLocation = NO; - if ([self.delegate respondsToSelector:@selector(locationManagerDidStopLocationUpdates:)]) { - [self.delegate locationManagerDidStopLocationUpdates:self]; - } - } - if(self.standardLocationManager.monitoredRegions.count > 0) { - for(CLRegion *region in self.standardLocationManager.monitoredRegions) { - if([region.identifier isEqualToString:MGLLocationManagerRegionIdentifier]) { - [self.standardLocationManager stopMonitoringForRegion:region]; - } - } - } -} - -#pragma mark - Utilities - -- (void)configurePassiveStandardLocationManager { - if (!self.standardLocationManager) { - CLLocationManager *standardLocationManager = [[CLLocationManager alloc] init]; - standardLocationManager.delegate = self; - standardLocationManager.desiredAccuracy = kCLLocationAccuracyThreeKilometers; - standardLocationManager.distanceFilter = MGLLocationManagerDistanceFilter; - self.standardLocationManager = standardLocationManager; - } -} - -- (void)startLocationServices { - CLAuthorizationStatus authorizationStatus = [CLLocationManager authorizationStatus]; -#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000 - BOOL authorizedAlways = authorizationStatus == kCLAuthorizationStatusAuthorizedAlways; -#else - BOOL authorizedAlways = authorizationStatus == kCLAuthorizationStatusAuthorized; -#endif - if (authorizedAlways || authorizationStatus == kCLAuthorizationStatusAuthorizedWhenInUse) { - // If the host app can run in the background with `always` location permissions then allow background - // updates and start the significant location change service and background timeout timer - if (self.hostAppHasBackgroundCapability && authorizedAlways) { - [self.standardLocationManager startMonitoringSignificantLocationChanges]; - [self startBackgroundTimeoutTimer]; - // On iOS 9 and above also allow background location updates - if ([self.standardLocationManager respondsToSelector:@selector(allowsBackgroundLocationUpdates)]) { - self.standardLocationManager.allowsBackgroundLocationUpdates = YES; - } - } - - [self.standardLocationManager startUpdatingLocation]; - self.updatingLocation = YES; - if ([self.delegate respondsToSelector:@selector(locationManagerDidStartLocationUpdates:)]) { - [self.delegate locationManagerDidStartLocationUpdates:self]; - } - } -} - -- (void)timeoutAllowedCheck { - if (self.backgroundLocationServiceTimeoutAllowedDate == nil) { - return; - } - - if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive || - [UIApplication sharedApplication].applicationState == UIApplicationStateInactive ) { - [self startBackgroundTimeoutTimer]; - return; - } - - NSTimeInterval timeIntervalSinceTimeoutAllowed = [[NSDate date] timeIntervalSinceDate:self.backgroundLocationServiceTimeoutAllowedDate]; - if (timeIntervalSinceTimeoutAllowed > 0) { - [self.standardLocationManager stopUpdatingLocation]; - self.backgroundLocationServiceTimeoutAllowedDate = nil; - if ([self.delegate respondsToSelector:@selector(locationManagerBackgroundLocationUpdatesDidTimeout:)]) { - [self.delegate locationManagerBackgroundLocationUpdatesDidTimeout:self]; - } - } -} - -- (void)startBackgroundTimeoutTimer { - [self.backgroundLocationServiceTimeoutTimer invalidate]; - self.backgroundLocationServiceTimeoutAllowedDate = [[NSDate date] dateByAddingTimeInterval:MGLLocationManagerHibernationTimeout]; - self.backgroundLocationServiceTimeoutTimer = [NSTimer scheduledTimerWithTimeInterval:MGLLocationManagerHibernationPollInterval target:self selector:@selector(timeoutAllowedCheck) userInfo:nil repeats:YES]; -} - -- (void)establishRegionMonitoringForLocation:(CLLocation *)location { - CLCircularRegion *region = [[CLCircularRegion alloc] initWithCenter:location.coordinate radius:MGLTelemetryConfig.sharedConfig.MGLLocationManagerHibernationRadius identifier:MGLLocationManagerRegionIdentifier]; - region.notifyOnEntry = NO; - region.notifyOnExit = YES; - [self.standardLocationManager startMonitoringForRegion:region]; -} - -#pragma mark - CLLocationManagerDelegate - -- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status { - switch (status) { -#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000 - case kCLAuthorizationStatusAuthorizedAlways: -#else - case kCLAuthorizationStatusAuthorized: -#endif - case kCLAuthorizationStatusAuthorizedWhenInUse: - [self startUpdatingLocation]; - break; - default: - [self stopUpdatingLocation]; - break; - } -} - -- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations { - CLLocation *location = locations.lastObject; - if (location.speed > 0.0) { - [self startBackgroundTimeoutTimer]; - } - if (self.standardLocationManager.monitoredRegions.count == 0 || location.horizontalAccuracy < MGLTelemetryConfig.sharedConfig.MGLLocationManagerHibernationRadius) { - [self establishRegionMonitoringForLocation:location]; - } - if ([self.delegate respondsToSelector:@selector(locationManager:didUpdateLocations:)]) { - [self.delegate locationManager:self didUpdateLocations:locations]; - } -} - -- (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region { - [self startBackgroundTimeoutTimer]; - [self.standardLocationManager startUpdatingLocation]; -} - -- (void)locationManagerDidPauseLocationUpdates:(CLLocationManager *)manager { - if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) { - if ([self.delegate respondsToSelector:@selector(locationManagerBackgroundLocationUpdatesDidAutomaticallyPause:)]) { - [self.delegate locationManagerBackgroundLocationUpdatesDidAutomaticallyPause:self]; - } - } -} - -@end diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 72fa4613fc..927450b511 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -66,6 +66,7 @@ #import "MGLStyle_Private.h" #import "MGLStyleLayer_Private.h" #import "MGLMapboxEvents.h" +#import "MMEConstants.h" #import "MGLSDKUpdateChecker.h" #import "MGLCompactCalloutView.h" #import "MGLAnnotationContainerView.h" @@ -567,7 +568,8 @@ public: _targetCoordinate = kCLLocationCoordinate2DInvalid; if ([UIApplication sharedApplication].applicationState != UIApplicationStateBackground) { - [MGLMapboxEvents pushEvent:MGLEventTypeMapLoad withAttributes:@{}]; + [MGLMapboxEvents pushTurnstileEvent]; + [MGLMapboxEvents pushEvent:MMEEventTypeMapLoad withAttributes:@{}]; } } @@ -1219,7 +1221,8 @@ public: [self validateLocationServices]; - [MGLMapboxEvents pushEvent:MGLEventTypeMapLoad withAttributes:@{}]; + [MGLMapboxEvents pushTurnstileEvent]; + [MGLMapboxEvents pushEvent:MMEEventTypeMapLoad withAttributes:@{}]; } } @@ -1331,7 +1334,7 @@ public: if (pan.state == UIGestureRecognizerStateBegan) { - [self trackGestureEvent:MGLEventGesturePanStart forRecognizer:pan]; + [self trackGestureEvent:MMEEventGesturePanStart forRecognizer:pan]; self.userTrackingMode = MGLUserTrackingModeNone; @@ -1379,10 +1382,10 @@ public: CLLocationCoordinate2D panCoordinate = [self convertPoint:pointInView toCoordinateFromView:pan.view]; int zoom = round([self zoomLevel]); - [MGLMapboxEvents pushEvent:MGLEventTypeMapDragEnd withAttributes:@{ - MGLEventKeyLatitude: @(panCoordinate.latitude), - MGLEventKeyLongitude: @(panCoordinate.longitude), - MGLEventKeyZoomLevel: @(zoom) + [MGLMapboxEvents pushEvent:MMEEventTypeMapDragEnd withAttributes:@{ + MMEEventKeyLatitude: @(panCoordinate.latitude), + MMEEventKeyLongitude: @(panCoordinate.longitude), + MMEEventKeyZoomLevel: @(zoom) }]; } @@ -1401,7 +1404,7 @@ public: if (pinch.state == UIGestureRecognizerStateBegan) { - [self trackGestureEvent:MGLEventGesturePinchStart forRecognizer:pinch]; + [self trackGestureEvent:MMEEventGesturePinchStart forRecognizer:pinch]; self.scale = powf(2, _mbglMap->getZoom()); @@ -1500,7 +1503,7 @@ public: if (rotate.state == UIGestureRecognizerStateBegan) { - [self trackGestureEvent:MGLEventGestureRotateStart forRecognizer:rotate]; + [self trackGestureEvent:MMEEventGestureRotateStart forRecognizer:rotate]; self.angle = MGLRadiansFromDegrees(_mbglMap->getBearing()) * -1; @@ -1572,7 +1575,7 @@ public: { return; } - [self trackGestureEvent:MGLEventGestureSingleTap forRecognizer:singleTap]; + [self trackGestureEvent:MMEEventGestureSingleTap forRecognizer:singleTap]; if (self.mapViewProxyAccessibilityElement.accessibilityElementIsFocused) { @@ -1694,7 +1697,7 @@ public: if ([self _shouldChangeFromCamera:oldCamera toCamera:toCamera]) { - [self trackGestureEvent:MGLEventGestureDoubleTap forRecognizer:doubleTap]; + [self trackGestureEvent:MMEEventGestureDoubleTap forRecognizer:doubleTap]; mbgl::ScreenCoordinate center(gesturePoint.x, gesturePoint.y); _mbglMap->setZoom(newZoom, center, MGLDurationFromTimeInterval(MGLAnimationDuration)); @@ -1723,7 +1726,7 @@ public: if (twoFingerTap.state == UIGestureRecognizerStateBegan) { - [self trackGestureEvent:MGLEventGestureTwoFingerSingleTap forRecognizer:twoFingerTap]; + [self trackGestureEvent:MMEEventGestureTwoFingerSingleTap forRecognizer:twoFingerTap]; [self notifyGestureDidBegin]; } @@ -1762,7 +1765,7 @@ public: if (quickZoom.state == UIGestureRecognizerStateBegan) { - [self trackGestureEvent:MGLEventGestureQuickZoom forRecognizer:quickZoom]; + [self trackGestureEvent:MMEEventGestureQuickZoom forRecognizer:quickZoom]; self.scale = powf(2, _mbglMap->getZoom()); @@ -1807,7 +1810,7 @@ public: if (twoFingerDrag.state == UIGestureRecognizerStateBegan) { - [self trackGestureEvent:MGLEventGesturePitchStart forRecognizer:twoFingerDrag]; + [self trackGestureEvent:MMEEventGesturePitchStart forRecognizer:twoFingerDrag]; [self notifyGestureDidBegin]; } @@ -2012,11 +2015,11 @@ public: CLLocationCoordinate2D gestureCoordinate = [self convertPoint:pointInView toCoordinateFromView:recognizer.view]; int zoom = round([self zoomLevel]); - [MGLMapboxEvents pushEvent:MGLEventTypeMapTap withAttributes:@{ - MGLEventKeyLatitude: @(gestureCoordinate.latitude), - MGLEventKeyLongitude: @(gestureCoordinate.longitude), - MGLEventKeyZoomLevel: @(zoom), - MGLEventKeyGestureID: gestureID + [MGLMapboxEvents pushEvent:MMEEventTypeMapTap withAttributes:@{ + MMEEventKeyLatitude: @(gestureCoordinate.latitude), + MMEEventKeyLongitude: @(gestureCoordinate.longitude), + MMEEventKeyZoomLevel: @(zoom), + MMEEventKeyGestureID: gestureID }]; } diff --git a/platform/ios/src/MGLMapboxEvents.h b/platform/ios/src/MGLMapboxEvents.h index 98f59ffd3f..cbac578798 100644 --- a/platform/ios/src/MGLMapboxEvents.h +++ b/platform/ios/src/MGLMapboxEvents.h @@ -1,44 +1,17 @@ #import - -#import "MGLTypes.h" +#import "MMEEventsManager.h" NS_ASSUME_NONNULL_BEGIN -// Event types -extern NSString *const MGLEventTypeAppUserTurnstile; -extern NSString *const MGLEventTypeMapLoad; -extern NSString *const MGLEventTypeMapTap; -extern NSString *const MGLEventTypeMapDragEnd; -extern NSString *const MGLEventTypeLocation; - -// Event keys -extern NSString *const MGLEventKeyLatitude; -extern NSString *const MGLEventKeyLongitude; -extern NSString *const MGLEventKeyZoomLevel; -extern NSString *const MGLEventKeyGestureID; - -// Gestures -extern NSString *const MGLEventGestureSingleTap; -extern NSString *const MGLEventGestureDoubleTap; -extern NSString *const MGLEventGestureTwoFingerSingleTap; -extern NSString *const MGLEventGestureQuickZoom; -extern NSString *const MGLEventGesturePanStart; -extern NSString *const MGLEventGesturePinchStart; -extern NSString *const MGLEventGestureRotateStart; -extern NSString *const MGLEventGesturePitchStart; - -typedef NS_DICTIONARY_OF(NSString *, id) MGLMapboxEventAttributes; -typedef NS_MUTABLE_DICTIONARY_OF(NSString *, id) MGLMutableMapboxEventAttributes; - @interface MGLMapboxEvents : NSObject -+ (nullable instancetype)sharedManager; ++ (nullable instancetype)sharedInstance; -// You must call these methods from the main thread. -// -+ (void)pushEvent:(NSString *)event withAttributes:(MGLMapboxEventAttributes *)attributeDictionary; -+ (void)ensureMetricsOptoutExists; ++ (void)setupWithAccessToken:(NSString *)accessToken; ++ (void)pushTurnstileEvent; ++ (void)pushEvent:(NSString *)event withAttributes:(MMEMapboxEventAttributes *)attributeDictionary; + (void)flush; ++ (void)ensureMetricsOptoutExists; @end diff --git a/platform/ios/src/MGLMapboxEvents.m b/platform/ios/src/MGLMapboxEvents.m index 273af5b3bc..05f291d8a0 100644 --- a/platform/ios/src/MGLMapboxEvents.m +++ b/platform/ios/src/MGLMapboxEvents.m @@ -1,646 +1,166 @@ #import "MGLMapboxEvents.h" -#import -#import -#import "MGLAccountManager.h" +#import "NSBundle+MGLAdditions.h" #import "NSProcessInfo+MGLAdditions.h" -#import "NSException+MGLAdditions.h" -#import "MGLAPIClient.h" -#import "MGLLocationManager.h" -#import "MGLTelemetryConfig.h" -#include -#include +static NSString * const MGLAPIClientUserAgentBase = @"mapbox-maps-ios"; +static NSString * const MGLMapboxAccountType = @"MGLMapboxAccountType"; +static NSString * const MGLMapboxMetricsEnabled = @"MGLMapboxMetricsEnabled"; +static NSString * const MGLMapboxMetricsDebugLoggingEnabled = @"MGLMapboxMetricsDebugLoggingEnabled"; +static NSString * const MGLTelemetryAccessToken = @"MGLTelemetryAccessToken"; +static NSString * const MGLTelemetryBaseURL = @"MGLTelemetryBaseURL"; -// Event types -NSString *const MGLEventTypeAppUserTurnstile = @"appUserTurnstile"; -NSString *const MGLEventTypeMapLoad = @"map.load"; -NSString *const MGLEventTypeMapTap = @"map.click"; -NSString *const MGLEventTypeMapDragEnd = @"map.dragend"; -NSString *const MGLEventTypeLocation = @"location"; -NSString *const MGLEventTypeLocalDebug = @"debug"; +@interface MGLMapboxEvents () -// Gestures -NSString *const MGLEventGestureSingleTap = @"SingleTap"; -NSString *const MGLEventGestureDoubleTap = @"DoubleTap"; -NSString *const MGLEventGestureTwoFingerSingleTap = @"TwoFingerTap"; -NSString *const MGLEventGestureQuickZoom = @"QuickZoom"; -NSString *const MGLEventGesturePanStart = @"Pan"; -NSString *const MGLEventGesturePinchStart = @"Pinch"; -NSString *const MGLEventGestureRotateStart = @"Rotation"; -NSString *const MGLEventGesturePitchStart = @"Pitch"; - -// Event keys -NSString *const MGLEventKeyLatitude = @"lat"; -NSString *const MGLEventKeyLongitude = @"lng"; -NSString *const MGLEventKeyZoomLevel = @"zoom"; -NSString *const MGLEventKeySpeed = @"speed"; -NSString *const MGLEventKeyCourse = @"course"; -NSString *const MGLEventKeyGestureID = @"gesture"; -NSString *const MGLEventHorizontalAccuracy = @"horizontalAccuracy"; -NSString *const MGLEventKeyLocalDebugDescription = @"debug.description"; - -static NSString *const MGLEventKeyEvent = @"event"; -static NSString *const MGLEventKeyCreated = @"created"; -static NSString *const MGLEventKeyVendorID = @"userId"; -static NSString *const MGLEventKeyModel = @"model"; -static NSString *const MGLEventKeyEnabledTelemetry = @"enabled.telemetry"; -static NSString *const MGLEventKeyOperatingSystem = @"operatingSystem"; -static NSString *const MGLEventKeyResolution = @"resolution"; -static NSString *const MGLEventKeyAccessibilityFontScale = @"accessibilityFontScale"; -static NSString *const MGLEventKeyOrientation = @"orientation"; -static NSString *const MGLEventKeyPluggedIn = @"pluggedIn"; -static NSString *const MGLEventKeyWifi = @"wifi"; -static NSString *const MGLEventKeySource = @"source"; -static NSString *const MGLEventKeySessionId = @"sessionId"; -static NSString *const MGLEventKeyApplicationState = @"applicationState"; -static NSString *const MGLEventKeyAltitude = @"altitude"; - -static NSString *const MGLMapboxAccountType = @"MGLMapboxAccountType"; -static NSString *const MGLMapboxMetricsEnabled = @"MGLMapboxMetricsEnabled"; - -// SDK event source -static NSString *const MGLEventSource = @"mapbox"; - -// Event application state -static NSString *const MGLApplicationStateForeground = @"Foreground"; -static NSString *const MGLApplicationStateBackground = @"Background"; -static NSString *const MGLApplicationStateInactive = @"Inactive"; -static NSString *const MGLApplicationStateUnknown = @"Unknown"; - -const NSUInteger MGLMaximumEventsPerFlush = 180; -const NSTimeInterval MGLFlushInterval = 180; - -@interface MGLMapboxEventsData : NSObject - -@property (nonatomic) NSString *vendorId; -@property (nonatomic) NSString *model; -@property (nonatomic) NSString *iOSVersion; -@property (nonatomic) CGFloat scale; - -@end - -@implementation MGLMapboxEventsData - -- (instancetype)init { - if (self = [super init]) { - _vendorId = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; - _model = [self sysInfoByName:"hw.machine"]; - _iOSVersion = [NSString stringWithFormat:@"%@ %@", [UIDevice currentDevice].systemName, [UIDevice currentDevice].systemVersion]; - if ([UIScreen instancesRespondToSelector:@selector(nativeScale)]) { - _scale = [UIScreen mainScreen].nativeScale; - } else { - _scale = [UIScreen mainScreen].scale; - } - } - return self; -} - -- (NSString *)sysInfoByName:(char *)typeSpecifier { - size_t size; - sysctlbyname(typeSpecifier, NULL, &size, NULL, 0); - - char *answer = malloc(size); - sysctlbyname(typeSpecifier, answer, &size, NULL, 0); - - NSString *results = [NSString stringWithCString:answer encoding: NSUTF8StringEncoding]; - - free(answer); - return results; -} +@property (nonatomic) MMEEventsManager *eventsManager; +@property (nonatomic) NSURL *baseURL; +@property (nonatomic, copy) NSString *accessToken; @end +@implementation MGLMapboxEvents -@interface MGLMapboxEvents () - -@property (nonatomic) MGLMapboxEventsData *data; -@property (nonatomic, copy) NSString *appBundleId; -@property (nonatomic, readonly) NSString *instanceID; -@property (nonatomic, copy) NSString *dateForDebugLogFile; -@property (nonatomic) NSDateFormatter *rfc3339DateFormatter; -@property (nonatomic) MGLAPIClient *apiClient; -@property (nonatomic) BOOL usesTestServer; -@property (nonatomic) BOOL canEnableDebugLogging; -@property (nonatomic, getter=isPaused) BOOL paused; -@property (nonatomic) NS_MUTABLE_ARRAY_OF(MGLMapboxEventAttributes *) *eventQueue; -@property (nonatomic) dispatch_queue_t serialQueue; -@property (nonatomic) dispatch_queue_t debugLogSerialQueue; -@property (nonatomic) MGLLocationManager *locationManager; -@property (nonatomic) NSTimer *timer; -@property (nonatomic) NSDate *instanceIDRotationDate; -@property (nonatomic) NSDate *nextTurnstileSendDate; -@property (nonatomic) NSNumber *currentAccountTypeValue; -@property (nonatomic) BOOL currentMetricsEnabledValue; - -@end - -@implementation MGLMapboxEvents { - NSString *_instanceID; - UIBackgroundTaskIdentifier _backgroundTaskIdentifier; -} + (void)initialize { if (self == [MGLMapboxEvents class]) { NSBundle *bundle = [NSBundle mainBundle]; NSNumber *accountTypeNumber = [bundle objectForInfoDictionaryKey:MGLMapboxAccountType]; - [[NSUserDefaults standardUserDefaults] registerDefaults:@{ - MGLMapboxAccountType: accountTypeNumber ?: @0, - MGLMapboxMetricsEnabled: @YES, - @"MGLMapboxMetricsDebugLoggingEnabled": @NO, - }]; + [[NSUserDefaults standardUserDefaults] registerDefaults:@{MGLMapboxAccountType: accountTypeNumber ?: @0, + MGLMapboxMetricsEnabled: @YES, + MGLMapboxMetricsDebugLoggingEnabled: @NO}]; } } -+ (BOOL)isEnabled { -#if TARGET_OS_SIMULATOR - return NO; -#else - BOOL isLowPowerModeEnabled = NO; - if ([NSProcessInfo instancesRespondToSelector:@selector(isLowPowerModeEnabled)]) { - isLowPowerModeEnabled = [[NSProcessInfo processInfo] isLowPowerModeEnabled]; ++ (nullable instancetype)sharedInstance { + if (NSProcessInfo.processInfo.mgl_isInterfaceBuilderDesignablesAgent) { + return nil; } - return ([[NSUserDefaults standardUserDefaults] boolForKey:MGLMapboxMetricsEnabled] && - [[NSUserDefaults standardUserDefaults] integerForKey:MGLMapboxAccountType] == 0 && - !isLowPowerModeEnabled); -#endif -} - - -- (BOOL)debugLoggingEnabled { - return (self.canEnableDebugLogging && - [[NSUserDefaults standardUserDefaults] boolForKey:@"MGLMapboxMetricsDebugLoggingEnabled"]); + + static dispatch_once_t onceToken; + static MGLMapboxEvents *_sharedInstance; + dispatch_once(&onceToken, ^{ + _sharedInstance = [[self alloc] init]; + }); + return _sharedInstance; } -- (instancetype) init { +- (instancetype)init { self = [super init]; if (self) { - [MGLTelemetryConfig.sharedConfig configurationFromKey:[[NSUserDefaults standardUserDefaults] objectForKey:MGLMapboxMetricsProfile]]; + _eventsManager = [[MMEEventsManager alloc] init]; + _eventsManager.debugLoggingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:MGLMapboxMetricsDebugLoggingEnabled]; + _eventsManager.accountType = [[NSUserDefaults standardUserDefaults] integerForKey:MGLMapboxAccountType]; + _eventsManager.metricsEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:MGLMapboxMetricsEnabled]; - _currentAccountTypeValue = @0; - _currentMetricsEnabledValue = YES; - - _appBundleId = [[NSBundle mainBundle] bundleIdentifier]; - _apiClient = [[MGLAPIClient alloc] init]; - - NSString *uniqueID = [[NSProcessInfo processInfo] globallyUniqueString]; - _serialQueue = dispatch_queue_create([[NSString stringWithFormat:@"%@.%@.events.serial", _appBundleId, uniqueID] UTF8String], DISPATCH_QUEUE_SERIAL); - - _locationManager = [[MGLLocationManager alloc] init]; - _locationManager.delegate = self; - _paused = YES; - [self resumeMetricsCollection]; - - // Events Control - _eventQueue = [[NSMutableArray alloc] init]; - - // Setup Date Format - _rfc3339DateFormatter = [[NSDateFormatter alloc] init]; - NSLocale *enUSPOSIXLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]; - - [_rfc3339DateFormatter setLocale:enUSPOSIXLocale]; - [_rfc3339DateFormatter setDateFormat:@"yyyy'-'MM'-'dd'T'HH':'mm':'ssZ"]; - // Clear Any System TimeZone Cache - [NSTimeZone resetSystemTimeZone]; - [_rfc3339DateFormatter setTimeZone:[NSTimeZone systemTimeZone]]; - - // Configure logging - if ([self isProbablyAppStoreBuild]) { - self.canEnableDebugLogging = NO; - - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"MGLMapboxMetricsDebugLoggingEnabled"]) { - NSLog(@"Telemetry logging is only enabled in non-app store builds."); - } - } else { - self.canEnableDebugLogging = YES; + // It is possible for the shared instance of this class to be created because of a call to + // +[MGLAccountManager load] early on in the app lifecycle of the host application. + // If user default values for access token and base URL are available, they are stored here + // on local properties so that they can be applied later once MMEEventsManager is fully initialized + // (once -[MMEEventsManager initializeWithAccessToken:userAgentBase:hostSDKVersion:] is called. + // Normally, the telem access token and base URL are not set this way. However, overriding these values + // with user defaults can be useful for testing with an alternative (test) backend system. + if ([[[[NSUserDefaults standardUserDefaults] dictionaryRepresentation] allKeys] containsObject:MGLTelemetryAccessToken]) { + self.accessToken = [[NSUserDefaults standardUserDefaults] objectForKey:MGLTelemetryAccessToken]; } - - // Watch for changes to telemetry settings by the user - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userDefaultsDidChange:) name:NSUserDefaultsDidChangeNotification object:nil]; - - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pauseOrResumeMetricsCollectionIfRequired) name:UIApplicationDidEnterBackgroundNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pauseOrResumeMetricsCollectionIfRequired) name:UIApplicationDidBecomeActiveNotification object:nil]; - - // Watch for Low Power Mode change events - if (&NSProcessInfoPowerStateDidChangeNotification != NULL) { - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pauseOrResumeMetricsCollectionIfRequired) name:NSProcessInfoPowerStateDidChangeNotification object:nil]; + if ([[[[NSUserDefaults standardUserDefaults] dictionaryRepresentation] allKeys] containsObject:MGLTelemetryBaseURL]) { + self.baseURL = [NSURL URLWithString:[[NSUserDefaults standardUserDefaults] objectForKey:MGLTelemetryBaseURL]]; } + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userDefaultsDidChange:) name:NSUserDefaultsDidChangeNotification object:nil]; } return self; } -// Called implicitly from any public class convenience methods. -// May return nil if this feature is disabled. -// -+ (nullable instancetype)sharedManager { - if (NSProcessInfo.processInfo.mgl_isInterfaceBuilderDesignablesAgent) { - return nil; - } - static dispatch_once_t onceToken; - static MGLMapboxEvents *_sharedManager; - dispatch_once(&onceToken, ^{ - _sharedManager = [[self alloc] init]; - }); - return _sharedManager; -} - - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; - [self pauseMetricsCollection]; } -- (NSString *)instanceID { - if (self.instanceIDRotationDate && [[NSDate date] timeIntervalSinceDate:self.instanceIDRotationDate] >= 0) { - _instanceID = nil; +- (void)userDefaultsDidChange:(NSNotification *)notification { + dispatch_async(dispatch_get_main_queue(), ^{ + [self updateNonDisablingConfigurationValues]; + [self updateDisablingConfigurationValuesWithNotification:notification]; + }); +} + +- (void)updateNonDisablingConfigurationValues { + self.eventsManager.debugLoggingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:@"MGLMapboxMetricsDebugLoggingEnabled"]; + + // It is possible for `MGLTelemetryAccessToken` to have been set yet `userDefaultsDidChange:` + // is called before `setupWithAccessToken:` is called. + // In that case, setting the access token here will have no effect. In practice, that's fine + // because the access token value will be resolved when `setupWithAccessToken:` is called eventually + if ([[[[NSUserDefaults standardUserDefaults] dictionaryRepresentation] allKeys] containsObject:MGLTelemetryAccessToken]) { + self.eventsManager.accessToken = [[NSUserDefaults standardUserDefaults] objectForKey:MGLTelemetryAccessToken]; } - if (!_instanceID) { - _instanceID = [[NSUUID UUID] UUIDString]; - NSTimeInterval twentyFourHourTimeInterval = 24 * 3600; - self.instanceIDRotationDate = [[NSDate date] dateByAddingTimeInterval:twentyFourHourTimeInterval]; + + // It is possible for `MGLTelemetryBaseURL` to have been set yet `userDefaultsDidChange:` + // is called before setupWithAccessToken: is called. + // In that case, setting the base URL here will have no effect. In practice, that's fine + // because the base URL value will be resolved when `setupWithAccessToken:` is called eventually + if ([[[[NSUserDefaults standardUserDefaults] dictionaryRepresentation] allKeys] containsObject:MGLTelemetryBaseURL]) { + NSURL *baseURL = [NSURL URLWithString:[[NSUserDefaults standardUserDefaults] objectForKey:MGLTelemetryBaseURL]]; + self.eventsManager.baseURL = baseURL; } - return _instanceID; } -- (void)userDefaultsDidChange:(NSNotification *)notification { - +- (void)updateDisablingConfigurationValuesWithNotification:(NSNotification *)notification { // Guard against over calling pause / resume if the values this implementation actually - // cares about have not changed - + // cares about have not changed. We guard because the pause and resume method checks CoreLocation's + // authorization status and that can drag on the main thread if done too many times (e.g. if the host + // app heavily uses the user defaults API and this method is called very frequently) if ([[notification object] respondsToSelector:@selector(objectForKey:)]) { NSUserDefaults *userDefaults = [notification object]; - NSNumber *accountType = [userDefaults objectForKey:MGLMapboxAccountType]; - BOOL metricsEnabled = [[userDefaults objectForKey:MGLMapboxMetricsEnabled] boolValue]; - - if (![accountType isEqualToNumber:self.currentAccountTypeValue] || metricsEnabled != self.currentMetricsEnabledValue) { - [self pauseOrResumeMetricsCollectionIfRequired]; - self.currentAccountTypeValue = accountType; - self.currentMetricsEnabledValue = metricsEnabled; - } - } - -} - -- (void)pauseOrResumeMetricsCollectionIfRequired { - - // [CLLocationManager authorizationStatus] has been found to block in some cases so - // dispatch the call to a non-UI thread - dispatch_async(self.serialQueue, ^{ - CLAuthorizationStatus status = [CLLocationManager authorizationStatus]; + NSInteger accountType = [userDefaults integerForKey:MGLMapboxAccountType]; + BOOL metricsEnabled = [userDefaults boolForKey:MGLMapboxMetricsEnabled]; - // Checking application state must be done on the main thread for safety and - // to avoid a thread sanitizer error - dispatch_async(dispatch_get_main_queue(), ^{ - UIApplication *application = [UIApplication sharedApplication]; - UIApplicationState state = application.applicationState; - - // Prevent blue status bar when host app has `when in use` permission only and it is not in foreground - if (status == kCLAuthorizationStatusAuthorizedWhenInUse && state == UIApplicationStateBackground) { - if (_backgroundTaskIdentifier == UIBackgroundTaskInvalid) { - _backgroundTaskIdentifier = [application beginBackgroundTaskWithExpirationHandler:^{ - [application endBackgroundTask:_backgroundTaskIdentifier]; - _backgroundTaskIdentifier = UIBackgroundTaskInvalid; - }]; - [self flush]; - } - [self pauseMetricsCollection]; - return; - } + if (accountType != self.eventsManager.accountType || metricsEnabled != self.eventsManager.metricsEnabled) { + self.eventsManager.accountType = accountType; + self.eventsManager.metricsEnabled = metricsEnabled; - // Toggle pause based on current pause state, user opt-out state, and low-power state. - BOOL enabled = [[self class] isEnabled]; - if (self.paused && enabled) { - [self resumeMetricsCollection]; - } else if (!self.paused && !enabled) { - [self flush]; - [self pauseMetricsCollection]; - } - }); - }); -} - -- (void)pauseMetricsCollection { - if (self.paused) { - return; - } - - self.paused = YES; - [self.timer invalidate]; - self.timer = nil; - [self.eventQueue removeAllObjects]; - self.data = nil; - - [self.locationManager stopUpdatingLocation]; -} - -- (void)resumeMetricsCollection { - if (!self.paused || ![[self class] isEnabled]) { - return; - } - - self.paused = NO; - self.data = [[MGLMapboxEventsData alloc] init]; - - [self.locationManager startUpdatingLocation]; -} - -+ (void)flush { - [[MGLMapboxEvents sharedManager] flush]; -} - -- (void)flush { - if ([MGLAccountManager accessToken] == nil) { - return; - } - - NSArray *events = [NSArray arrayWithArray:self.eventQueue]; - [self.eventQueue removeAllObjects]; - - [self postEvents:events]; - - if (self.timer) { - [self.timer invalidate]; - self.timer = nil; - } - - [self pushDebugEvent:MGLEventTypeLocalDebug withAttributes:@{MGLEventKeyLocalDebugDescription:@"flush"}]; -} - -- (void)pushTurnstileEvent { - if (self.nextTurnstileSendDate && [[NSDate date] timeIntervalSinceDate:self.nextTurnstileSendDate] < 0) { - return; - } - - NSString *vendorID = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; - if (!vendorID) { - return; - } - - NSDictionary *turnstileEventAttributes = @{MGLEventKeyEvent: MGLEventTypeAppUserTurnstile, - MGLEventKeyCreated: [self.rfc3339DateFormatter stringFromDate:[NSDate date]], - MGLEventKeyVendorID: vendorID, - MGLEventKeyEnabledTelemetry: @([[self class] isEnabled])}; - - if ([MGLAccountManager accessToken] == nil) { - return; - } - - __weak __typeof__(self) weakSelf = self; - [self.apiClient postEvent:turnstileEventAttributes completionHandler:^(NSError * _Nullable error) { - __strong __typeof__(weakSelf) strongSelf = weakSelf; - if (error) { - [strongSelf pushDebugEvent:MGLEventTypeLocalDebug withAttributes:@{MGLEventKeyLocalDebugDescription: @"Network error", - @"error": error}]; - return; + [self.eventsManager pauseOrResumeMetricsCollectionIfRequired]; } - [strongSelf writeEventToLocalDebugLog:turnstileEventAttributes]; - [strongSelf updateNextTurnstileSendDate]; - }]; -} - -- (void)updateNextTurnstileSendDate { - // Find the time a day from now (sometime tomorrow) - NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; - NSDateComponents *dayComponent = [[NSDateComponents alloc] init]; - dayComponent.day = 1; - NSDate *sometimeTomorrow = [calendar dateByAddingComponents:dayComponent toDate:[NSDate date] options:0]; - - // Find the start of tomorrow and use that as the next turnstile send date. The effect of this is that - // turnstile events can be sent as much as once per calendar day and always at the start of a session - // when a map load happens. - NSDate *startOfTomorrow = nil; - [calendar rangeOfUnit:NSCalendarUnitDay startDate:&startOfTomorrow interval:nil forDate:sometimeTomorrow]; - self.nextTurnstileSendDate = startOfTomorrow; -} - -+ (void)pushEvent:(NSString *)event withAttributes:(MGLMapboxEventAttributes *)attributeDictionary { - [[MGLMapboxEvents sharedManager] pushEvent:event withAttributes:attributeDictionary]; -} - -- (void)pushEvent:(NSString *)event withAttributes:(MGLMapboxEventAttributes *)attributeDictionary { - if (!event) { - return; - } - - if ([event isEqualToString:MGLEventTypeMapLoad]) { - [self pushTurnstileEvent]; - } - - if (self.paused) { - return; - } - - MGLMapboxEventAttributes *fullyFormedEvent = [self fullyFormedEventForEvent:event withAttributes:attributeDictionary]; - if (fullyFormedEvent) { - [self.eventQueue addObject:fullyFormedEvent]; - [self writeEventToLocalDebugLog:fullyFormedEvent]; - // Has Flush Limit Been Reached? - if (self.eventQueue.count >= MGLMaximumEventsPerFlush) { - [self flush]; - } else if (self.eventQueue.count == 1) { - // If this is first new event on queue start timer, - [self startTimer]; - } - } else { - [self pushDebugEvent:MGLEventTypeLocalDebug withAttributes:@{MGLEventKeyLocalDebugDescription: @"Unknown event", - @"eventName": event, - @"event.attributes": attributeDictionary}]; - } -} - -#pragma mark Events - -- (MGLMapboxEventAttributes *)fullyFormedEventForEvent:(NSString *)event withAttributes:(MGLMapboxEventAttributes *)attributeDictionary { - if ([event isEqualToString:MGLEventTypeMapLoad]) { - return [self mapLoadEventWithAttributes:attributeDictionary]; - } else if ([event isEqualToString:MGLEventTypeMapTap]) { - return [self mapClickEventWithAttributes:attributeDictionary]; - } else if ([event isEqualToString:MGLEventTypeMapDragEnd]) { - return [self mapDragEndEventWithAttributes:attributeDictionary]; - } else if ([event isEqualToString:MGLEventTypeLocation]) { - return [self locationEventWithAttributes:attributeDictionary]; } - return nil; -} - -- (MGLMapboxEventAttributes *)locationEventWithAttributes:(MGLMapboxEventAttributes *)attributeDictionary { - MGLMutableMapboxEventAttributes *attributes = [NSMutableDictionary dictionary]; - attributes[MGLEventKeyEvent] = MGLEventTypeLocation; - attributes[MGLEventKeySource] = MGLEventSource; - attributes[MGLEventKeySessionId] = self.instanceID; - attributes[MGLEventKeyOperatingSystem] = self.data.iOSVersion; - NSString *currentApplicationState = [self applicationState]; - if (![currentApplicationState isEqualToString:MGLApplicationStateUnknown]) { - attributes[MGLEventKeyApplicationState] = currentApplicationState; - } - - return [self eventForAttributes:attributes attributeDictionary:attributeDictionary]; -} - -- (MGLMapboxEventAttributes *)mapLoadEventWithAttributes:(MGLMapboxEventAttributes *)attributeDictionary { - MGLMutableMapboxEventAttributes *attributes = [NSMutableDictionary dictionary]; - attributes[MGLEventKeyEvent] = MGLEventTypeMapLoad; - attributes[MGLEventKeyCreated] = [self.rfc3339DateFormatter stringFromDate:[NSDate date]]; - attributes[MGLEventKeyVendorID] = self.data.vendorId; - attributes[MGLEventKeyModel] = self.data.model; - attributes[MGLEventKeyOperatingSystem] = self.data.iOSVersion; - attributes[MGLEventKeyResolution] = @(self.data.scale); - attributes[MGLEventKeyAccessibilityFontScale] = @([self contentSizeScale]); - attributes[MGLEventKeyOrientation] = [self deviceOrientation]; - attributes[MGLEventKeyWifi] = @([[MGLReachability reachabilityForLocalWiFi] isReachableViaWiFi]); - - return [self eventForAttributes:attributes attributeDictionary:attributeDictionary]; -} - -- (MGLMapboxEventAttributes *)mapClickEventWithAttributes:(MGLMapboxEventAttributes *)attributeDictionary { - MGLMutableMapboxEventAttributes *attributes = [self interactionEvent]; - attributes[MGLEventKeyEvent] = MGLEventTypeMapTap; - return [self eventForAttributes:attributes attributeDictionary:attributeDictionary]; -} - -- (MGLMapboxEventAttributes *)mapDragEndEventWithAttributes:(MGLMapboxEventAttributes *)attributeDictionary { - MGLMutableMapboxEventAttributes *attributes = [self interactionEvent]; - attributes[MGLEventKeyEvent] = MGLEventTypeMapDragEnd; - - return [self eventForAttributes:attributes attributeDictionary:attributeDictionary]; } -- (MGLMutableMapboxEventAttributes *)interactionEvent { - MGLMutableMapboxEventAttributes *attributes = [NSMutableDictionary dictionary]; - attributes[MGLEventKeyCreated] = [self.rfc3339DateFormatter stringFromDate:[NSDate date]]; - attributes[MGLEventKeyOrientation] = [self deviceOrientation]; - attributes[MGLEventKeyWifi] = @([[MGLReachability reachabilityForLocalWiFi] isReachableViaWiFi]); - - return attributes; -} - -- (MGLMapboxEventAttributes *)eventForAttributes:(MGLMutableMapboxEventAttributes *)attributes attributeDictionary:(MGLMapboxEventAttributes *)attributeDictionary { - [attributes addEntriesFromDictionary:attributeDictionary]; - - return [attributes copy]; -} - -// Called implicitly from public use of +flush. -// -- (void)postEvents:(NS_ARRAY_OF(MGLMapboxEventAttributes *) *)events { - if (self.paused) { - return; ++ (void)setupWithAccessToken:(NSString *)accessToken { + NSString *semanticVersion = [NSBundle mgl_frameworkInfoDictionary][@"MGLSemanticVersionString"]; + NSString *shortVersion = [NSBundle mgl_frameworkInfoDictionary][@"CFBundleShortVersionString"]; + NSString *sdkVersion = semanticVersion ?: shortVersion; + + // It is possible that an alternative access token was already set on this instance when the class was loaded + // Use it if it exists + NSString *resolvedAccessToken = [MGLMapboxEvents sharedInstance].accessToken ?: accessToken; + + [[[self sharedInstance] eventsManager] initializeWithAccessToken:resolvedAccessToken userAgentBase:MGLAPIClientUserAgentBase hostSDKVersion:sdkVersion]; + + // It is possible that an alternative base URL was set on this instance when the class was loaded + // Use it if it exists + if ([MGLMapboxEvents sharedInstance].baseURL) { + [[MGLMapboxEvents sharedInstance] eventsManager].baseURL = [MGLMapboxEvents sharedInstance].baseURL; } - - __weak __typeof__(self) weakSelf = self; - dispatch_async(self.serialQueue, ^{ - __strong __typeof__(weakSelf) strongSelf = weakSelf; - [self.apiClient postEvents:events completionHandler:^(NSError * _Nullable error) { - if (error) { - [strongSelf pushDebugEvent:MGLEventTypeLocalDebug withAttributes:@{MGLEventKeyLocalDebugDescription: @"Network error", - @"error": error}]; - } else { - [strongSelf pushDebugEvent:MGLEventTypeLocalDebug withAttributes:@{MGLEventKeyLocalDebugDescription: @"post", - @"debug.eventsCount": @(events.count)}]; - } - [[UIApplication sharedApplication] endBackgroundTask:_backgroundTaskIdentifier]; - _backgroundTaskIdentifier = UIBackgroundTaskInvalid; - }]; - }); -} - -- (void)startTimer { - [self.timer invalidate]; - self.timer = [NSTimer scheduledTimerWithTimeInterval:MGLFlushInterval - target:self - selector:@selector(flush) - userInfo:nil - repeats:YES]; } -- (NSString *)deviceOrientation { - NSString *result; - - switch ([UIDevice currentDevice].orientation) { - case UIDeviceOrientationUnknown: - result = @"Unknown"; - break; - case UIDeviceOrientationPortrait: - result = @"Portrait"; - break; - case UIDeviceOrientationPortraitUpsideDown: - result = @"PortraitUpsideDown"; - break; - case UIDeviceOrientationLandscapeLeft: - result = @"LandscapeLeft"; - break; - case UIDeviceOrientationLandscapeRight: - result = @"LandscapeRight"; - break; - case UIDeviceOrientationFaceUp: - result = @"FaceUp"; - break; - case UIDeviceOrientationFaceDown: - result = @"FaceDown"; - break; - default: - result = @"Default - Unknown"; - break; - } - - return result; ++ (void)pushTurnstileEvent { + [[[self sharedInstance] eventsManager] sendTurnstileEvent]; } -- (NSString *)applicationState { - switch ([UIApplication sharedApplication].applicationState) { - case UIApplicationStateActive: - return MGLApplicationStateForeground; - case UIApplicationStateInactive: - return MGLApplicationStateInactive; - case UIApplicationStateBackground: - return MGLApplicationStateBackground; - default: - return MGLApplicationStateUnknown; - } ++ (void)pushEvent:(NSString *)event withAttributes:(MMEMapboxEventAttributes *)attributeDictionary { + [[[self sharedInstance] eventsManager] enqueueEventWithName:event attributes:attributeDictionary]; } -- (NSInteger)contentSizeScale { - NSInteger result = -9999; - - NSString *sc = [UIApplication sharedApplication].preferredContentSizeCategory; - - if ([sc isEqualToString:UIContentSizeCategoryExtraSmall]) { - result = -3; - } else if ([sc isEqualToString:UIContentSizeCategorySmall]) { - result = -2; - } else if ([sc isEqualToString:UIContentSizeCategoryMedium]) { - result = -1; - } else if ([sc isEqualToString:UIContentSizeCategoryLarge]) { - result = 0; - } else if ([sc isEqualToString:UIContentSizeCategoryExtraLarge]) { - result = 1; - } else if ([sc isEqualToString:UIContentSizeCategoryExtraExtraLarge]) { - result = 2; - } else if ([sc isEqualToString:UIContentSizeCategoryExtraExtraExtraLarge]) { - result = 3; - } else if ([sc isEqualToString:UIContentSizeCategoryAccessibilityMedium]) { - result = -11; - } else if ([sc isEqualToString:UIContentSizeCategoryAccessibilityLarge]) { - result = 10; - } else if ([sc isEqualToString:UIContentSizeCategoryAccessibilityExtraLarge]) { - result = 11; - } else if ([sc isEqualToString:UIContentSizeCategoryAccessibilityExtraExtraLarge]) { - result = 12; - } else if ([sc isEqualToString:UIContentSizeCategoryAccessibilityExtraExtraExtraLarge]) { - result = 13; - } - - return result; ++ (void)flush { + [[[self sharedInstance] eventsManager] flush]; } + (void)ensureMetricsOptoutExists { NSNumber *shownInAppNumber = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"MGLMapboxMetricsEnabledSettingShownInApp"]; BOOL metricsEnabledSettingShownInAppFlag = [shownInAppNumber boolValue]; - + if (!metricsEnabledSettingShownInAppFlag && [[NSUserDefaults standardUserDefaults] integerForKey:MGLMapboxAccountType] == 0) { // Opt-out is not configured in UI, so check for Settings.bundle id defaultEnabledValue; NSString *appSettingsBundle = [[NSBundle mainBundle] pathForResource:@"Settings" ofType:@"bundle"]; - + if (appSettingsBundle) { // Dynamic Settings.bundle loading based on http://stackoverflow.com/a/510329/2094275 NSDictionary *settings = [NSDictionary dictionaryWithContentsOfFile:[appSettingsBundle stringByAppendingPathComponent:@"Root.plist"]]; @@ -651,7 +171,7 @@ const NSTimeInterval MGLFlushInterval = 180; } } } - + if (!defaultEnabledValue) { [NSException raise:@"Telemetry opt-out missing" format: @"End users must be able to opt out of Mapbox Telemetry in your app, either inside Settings (via Settings.bundle) or inside this app. " @@ -663,153 +183,4 @@ const NSTimeInterval MGLFlushInterval = 180; } } -#pragma mark CLLocationManagerUtilityDelegate - -- (void)locationManager:(MGLLocationManager *)locationManager didUpdateLocations:(NSArray *)locations { - for (CLLocation *loc in locations) { - double accuracy = 10000000; - double lat = floor(loc.coordinate.latitude * accuracy) / accuracy; - double lng = floor(loc.coordinate.longitude * accuracy) / accuracy; - double horizontalAccuracy = round(loc.horizontalAccuracy); - NSString *formattedDate = [self.rfc3339DateFormatter stringFromDate:loc.timestamp]; - [MGLMapboxEvents pushEvent:MGLEventTypeLocation withAttributes:@{MGLEventKeyCreated: formattedDate, - MGLEventKeyLatitude: @(lat), - MGLEventKeyLongitude: @(lng), - MGLEventKeyAltitude: @(round(loc.altitude)), - MGLEventHorizontalAccuracy: @(horizontalAccuracy)}]; - } -} - -- (void)locationManagerBackgroundLocationUpdatesDidAutomaticallyPause:(MGLLocationManager *)locationManager { - [self pushDebugEvent:MGLEventTypeLocalDebug withAttributes:@{MGLEventKeyLocalDebugDescription:@"locationManager.locationManagerAutoPause"}]; -} - -- (void)locationManagerBackgroundLocationUpdatesDidTimeout:(MGLLocationManager *)locationManager { - [self pushDebugEvent:MGLEventTypeLocalDebug withAttributes:@{MGLEventKeyLocalDebugDescription:@"locationManager.locationManagerTimeout"}]; -} - -- (void)locationManagerDidStartLocationUpdates:(MGLLocationManager *)locationManager { - [self pushDebugEvent:MGLEventTypeLocalDebug withAttributes:@{MGLEventKeyLocalDebugDescription:@"locationManager.locationManagerStartUpdates"}]; -} - -- (void)locationManagerDidStopLocationUpdates:(MGLLocationManager *)locationManager { - [self pushDebugEvent:MGLEventTypeLocalDebug withAttributes:@{MGLEventKeyLocalDebugDescription: @"locationManager.locationManagerStopUpdates"}]; -} - -#pragma mark MGLMapboxEvents Debug - -- (void)pushDebugEvent:(NSString *)event withAttributes:(MGLMapboxEventAttributes *)attributeDictionary { - if (![self debugLoggingEnabled]) { - return; - } - - if (!event) { - return; - } - - MGLMutableMapboxEventAttributes *evt = [MGLMutableMapboxEventAttributes dictionaryWithDictionary:attributeDictionary]; - [evt setObject:event forKey:@"event"]; - [evt setObject:[self.rfc3339DateFormatter stringFromDate:[NSDate date]] forKey:@"created"]; - [evt setValue:[self applicationState] forKey:@"applicationState"]; - [evt setValue:@([[self class] isEnabled]) forKey:@"telemetryEnabled"]; - [evt setObject:self.instanceID forKey:@"instance"]; - - MGLMapboxEventAttributes *finalEvent = [NSDictionary dictionaryWithDictionary:evt]; - [self writeEventToLocalDebugLog:finalEvent]; -} - -- (void)writeEventToLocalDebugLog:(MGLMapboxEventAttributes *)event { - if (![self debugLoggingEnabled]) { - return; - } - - NSLog(@"%@", [self stringForDebugEvent:event]); - - if (!self.dateForDebugLogFile) { - NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; - [dateFormatter setDateFormat:@"yyyy'-'MM'-'dd"]; - [dateFormatter setTimeZone:[NSTimeZone systemTimeZone]]; - self.dateForDebugLogFile = [dateFormatter stringFromDate:[NSDate date]]; - } - - if (!self.debugLogSerialQueue) { - NSString *uniqueID = [[NSProcessInfo processInfo] globallyUniqueString]; - self.debugLogSerialQueue = dispatch_queue_create([[NSString stringWithFormat:@"%@.%@.events.debugLog", _appBundleId, uniqueID] UTF8String], DISPATCH_QUEUE_SERIAL); - } - - dispatch_async(self.debugLogSerialQueue, ^{ - if ([NSJSONSerialization isValidJSONObject:event]) { - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:event options:NSJSONWritingPrettyPrinted error:nil]; - - NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; - jsonString = [jsonString stringByAppendingString:@",\n"]; - - NSString *logFilePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:[NSString stringWithFormat:@"telemetry_log-%@.json", self.dateForDebugLogFile]]; - - NSFileManager *fileManager = [[NSFileManager alloc] init]; - if ([fileManager fileExistsAtPath:logFilePath]) { - NSFileHandle *fileHandle = [NSFileHandle fileHandleForWritingAtPath:logFilePath]; - [fileHandle seekToEndOfFile]; - [fileHandle writeData:[jsonString dataUsingEncoding:NSUTF8StringEncoding]]; - } else { - [fileManager createFileAtPath:logFilePath contents:[jsonString dataUsingEncoding:NSUTF8StringEncoding] attributes:@{ NSFileProtectionKey: NSFileProtectionCompleteUntilFirstUserAuthentication }]; - } - } - }); -} - -- (NSString *)stringForDebugEvent:(MGLMapboxEventAttributes *)event { - // redact potentially sensitive location details from system console log - if ([event[@"event"] isEqualToString:MGLEventTypeLocation]) { - MGLMutableMapboxEventAttributes *evt = [MGLMutableMapboxEventAttributes dictionaryWithDictionary:event]; - [evt setObject:@"" forKey:@"lat"]; - [evt setObject:@"" forKey:@"lng"]; - event = evt; - } - - return [NSString stringWithFormat:@"Mapbox Telemetry event %@", event]; -} - -- (BOOL)isProbablyAppStoreBuild { -#if TARGET_IPHONE_SIMULATOR - return NO; -#else - // BugshotKit by Marco Arment https://github.com/marcoarment/BugshotKit/ - // Adapted from https://github.com/blindsightcorp/BSMobileProvision - - NSString *binaryMobileProvision = [NSString stringWithContentsOfFile:[NSBundle.mainBundle pathForResource:@"embedded" ofType:@"mobileprovision"] encoding:NSISOLatin1StringEncoding error:NULL]; - if (!binaryMobileProvision) { - return YES; // no provision - } - - NSScanner *scanner = [NSScanner scannerWithString:binaryMobileProvision]; - NSString *plistString; - if (![scanner scanUpToString:@"" intoString:&plistString]) { - return YES; // no XML plist found in provision - } - plistString = [plistString stringByAppendingString:@"
"]; - - NSData *plistdata_latin1 = [plistString dataUsingEncoding:NSISOLatin1StringEncoding]; - NSError *error = nil; - NSDictionary *mobileProvision = [NSPropertyListSerialization propertyListWithData:plistdata_latin1 options:NSPropertyListImmutable format:NULL error:&error]; - if (error) { - return YES; // unknown plist format - } - - if (!mobileProvision || ! mobileProvision.count) { - return YES; // no entitlements - } - - if (mobileProvision[@"ProvisionsAllDevices"]) { - return NO; // enterprise provisioning - } - - if (mobileProvision[@"ProvisionedDevices"] && [mobileProvision[@"ProvisionedDevices"] count]) { - return NO; // development or ad-hoc - } - - return YES; // expected development/enterprise/ad-hoc entitlements not found -#endif -} - @end diff --git a/platform/ios/src/Mapbox-Prefix.pch b/platform/ios/src/Mapbox-Prefix.pch new file mode 100644 index 0000000000..6754020861 --- /dev/null +++ b/platform/ios/src/Mapbox-Prefix.pch @@ -0,0 +1 @@ +#import "MMENamespacedDependencies.h" diff --git a/platform/ios/vendor/mapbox-events-ios b/platform/ios/vendor/mapbox-events-ios new file mode 160000 index 0000000000..d522b18d84 --- /dev/null +++ b/platform/ios/vendor/mapbox-events-ios @@ -0,0 +1 @@ +Subproject commit d522b18d8439de9073eafaad7d85e9f6a0d8d827 -- cgit v1.2.1 From d9e4c61923813b61ffccb6439d0fd3e9993a1a05 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Wed, 14 Feb 2018 12:36:23 +0100 Subject: [android] - remove camera api from MapboxMap, refactor test app code to CameraUpdateFactory api --- .../mapboxsdk/camera/CameraUpdateFactory.java | 20 +++ .../java/com/mapbox/mapboxsdk/maps/MapboxMap.java | 63 +-------- .../com/mapbox/mapboxsdk/maps/MapViewUtils.java | 33 ----- .../testapp/camera/CameraInternalApiTest.java | 157 --------------------- .../activity/camera/CameraAnimatorActivity.java | 20 ++- 5 files changed, 37 insertions(+), 256 deletions(-) delete mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapViewUtils.java delete mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraInternalApiTest.java diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java index 50e33f4f9f..8ef0d5b523 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java @@ -148,6 +148,26 @@ public final class CameraUpdateFactory { return new ZoomUpdate(ZoomUpdate.ZOOM_TO, zoom); } + /** + * Returns a CameraUpdate that moves the camera viewpoint to a particular bearing. + * + * @param bearing Bearing to change to + * @return CameraUpdate Final Camera Position + */ + public static CameraUpdate bearingTo(double bearing) { + return new CameraPositionUpdate(bearing, null, -1, -1); + } + + /** + * Returns a CameraUpdate that moves the camera viewpoint to a particular tilt. + * + * @param tilt Tilt to change to + * @return CameraUpdate Final Camera Position + */ + public static CameraUpdate tiltTo(double tilt) { + return new CameraPositionUpdate(-1, null, tilt, -1); + } + // // CameraUpdate types // diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java index 4f2c940ea3..6085e2c2d8 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java @@ -16,6 +16,7 @@ import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; +import com.mapbox.android.core.location.LocationEngine; import com.mapbox.geojson.Feature; import com.mapbox.geojson.Geometry; import com.mapbox.mapboxsdk.annotations.Annotation; @@ -43,7 +44,6 @@ import com.mapbox.mapboxsdk.style.layers.Filter; import com.mapbox.mapboxsdk.style.layers.Layer; import com.mapbox.mapboxsdk.style.light.Light; import com.mapbox.mapboxsdk.style.sources.Source; -import com.mapbox.android.core.location.LocationEngine; import java.lang.reflect.ParameterizedType; import java.util.HashMap; @@ -601,7 +601,7 @@ public final class MapboxMap { } // - // + // Light // /** @@ -618,65 +618,6 @@ public final class MapboxMap { // Camera API // - /** - * Moves the center of the screen to a latitude and longitude specified by a LatLng object. This centers the - * camera on the LatLng object. - *

- * Note that at low zoom levels, setLatLng is constrained so that the entire viewport shows map data. - *

- * - * @param latLng Target location to change to - */ - public void setLatLng(@NonNull LatLng latLng) { - nativeMapView.setLatLng(latLng); - } - - /** - * Moves the camera viewpoint to a particular zoom level. - * - * @param zoom Zoom level to change to - */ - public void setZoom(@FloatRange(from = MapboxConstants.MINIMUM_ZOOM, to = MapboxConstants.MAXIMUM_ZOOM) double zoom) { - if (focalPoint == null) { - focalPoint = new PointF(nativeMapView.getWidth() / 2, nativeMapView.getHeight() / 2); - } - nativeMapView.setZoom(zoom, focalPoint, 0); - } - - /** - * Moves the center and the zoom of the camera specified by a LatLng object and double zoom. - *

- * Note that at low zoom levels, setLatLng is constrained so that the entire viewport shows map data. - *

- * - * @param latLng Target location to change to - */ - public void setLatLngZoom(@NonNull LatLng latLng, - @FloatRange(from = MapboxConstants.MINIMUM_ZOOM, - to = MapboxConstants.MAXIMUM_ZOOM) double zoom) { - setZoom(zoom); - setLatLng(latLng); - } - - /** - * Moves the camera viewpoint angle to a particular angle in degrees. - * - * @param tilt Tilt angle to change to - */ - public void setTilt(@FloatRange(from = MapboxConstants.MINIMUM_TILT, to = MapboxConstants.MAXIMUM_TILT) double tilt) { - nativeMapView.setPitch(tilt, 0); - } - - /** - * Moves the camera viewpoint direction to a particular angle in degrees. - * - * @param bearing Direction angle to change to - */ - public void setBearing(@FloatRange(from = MapboxConstants.MINIMUM_DIRECTION, to = MapboxConstants.MAXIMUM_DIRECTION) - double bearing) { - nativeMapView.setBearing(bearing); - } - /** * Cancels ongoing animations. *

diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapViewUtils.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapViewUtils.java deleted file mode 100644 index 38d5297291..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapViewUtils.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.mapbox.mapboxsdk.maps; - -import com.mapbox.mapboxsdk.geometry.LatLng; - -/** - * Utility class to bypass package visibility - */ -public class MapViewUtils { - - public static void setDirection(MapboxMap mapboxMap, float direction) { - mapboxMap.getTransform().setBearing(direction); - } - - public static float getDirection(MapboxMap mapboxMap) { - return (float) mapboxMap.getTransform().getBearing(); - } - - public static void setTilt(MapboxMap mapboxMap, float tilt) { - mapboxMap.getTransform().setTilt((double) tilt); - } - - public static float getTilt(MapboxMap mapboxMap) { - return (float) mapboxMap.getTransform().getTilt(); - } - - public static void setLatLng(MapboxMap mapboxMap, LatLng latLng) { - mapboxMap.getTransform().setCenterCoordinate(latLng); - } - - public static LatLng getLatLng(MapboxMap mapboxMap) { - return mapboxMap.getTransform().getCenterCoordinate(); - } -} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraInternalApiTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraInternalApiTest.java deleted file mode 100644 index 883e76653d..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraInternalApiTest.java +++ /dev/null @@ -1,157 +0,0 @@ -package com.mapbox.mapboxsdk.testapp.camera; - -import android.support.test.espresso.Espresso; -import android.support.test.espresso.UiController; -import android.support.test.espresso.ViewAction; -import android.view.View; - -import com.mapbox.mapboxsdk.camera.CameraPosition; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.MapViewUtils; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; -import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; -import com.mapbox.mapboxsdk.testapp.utils.TestConstants; - -import org.hamcrest.Matcher; -import org.junit.After; -import org.junit.Ignore; -import org.junit.Test; - -import static android.support.test.espresso.Espresso.onView; -import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; -import static android.support.test.espresso.matcher.ViewMatchers.withId; -import static org.junit.Assert.assertEquals; - -/** - * Tests camera transformations that aren't part of our public API - */ -public class CameraInternalApiTest extends BaseActivityTest { - - @Override - protected Class getActivityClass() { - return EspressoTestActivity.class; - } - - @Test - @Ignore - public void testBearing() { - validateTestSetup(); - - CameraPosition initialPosition = new - CameraPosition.Builder().target(new LatLng()).zoom(1).bearing(0).tilt(0).build(); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Default camera position should match default", cameraPosition, initialPosition); - - onView(withId(R.id.mapView)).perform(new BearingAction(mapboxMap)); - assertEquals("Bearing should match", 45.1f, MapViewUtils.getDirection(mapboxMap), TestConstants.BEARING_DELTA); - } - - @Test - @Ignore - public void testTilt() { - validateTestSetup(); - - CameraPosition initialPosition = new CameraPosition.Builder().target( - new LatLng()).zoom(1).bearing(0).tilt(0).build(); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Default camera position should match default", cameraPosition, initialPosition); - - onView(withId(R.id.mapView)).perform(new TiltAction(mapboxMap)); - assertEquals("Tilt should match", 40.0f, MapViewUtils.getTilt(mapboxMap), TestConstants.TILT_DELTA); - } - - @Test - @Ignore - public void testLatLng() { - validateTestSetup(); - - CameraPosition initialPosition = new CameraPosition.Builder().target( - new LatLng()).zoom(1).bearing(0).tilt(0).build(); - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); - assertEquals("Default camera position should match default", cameraPosition, initialPosition); - - onView(withId(R.id.mapView)).perform(new LatLngAction(mapboxMap)); - LatLng centerCoordinate = MapViewUtils.getLatLng(mapboxMap); - assertEquals("Latitude should match", 1.1f, centerCoordinate.getLatitude(), TestConstants.LAT_LNG_DELTA); - assertEquals("Longitude should match", 2.2f, centerCoordinate.getLongitude(), TestConstants.LAT_LNG_DELTA); - } - - @After - public void unregisterIdlingResource() { - Espresso.unregisterIdlingResources(idlingResource); - } - - private class BearingAction implements ViewAction { - - private MapboxMap mapboxMap; - - BearingAction(MapboxMap mapboxMap) { - this.mapboxMap = mapboxMap; - } - - @Override - public Matcher getConstraints() { - return isDisplayed(); - } - - @Override - public String getDescription() { - return getClass().getSimpleName(); - } - - @Override - public void perform(UiController uiController, View view) { - MapViewUtils.setDirection(mapboxMap, -45.1f); - } - } - - private class TiltAction implements ViewAction { - - private MapboxMap mapboxMap; - - TiltAction(MapboxMap mapboxMap) { - this.mapboxMap = mapboxMap; - } - - @Override - public Matcher getConstraints() { - return isDisplayed(); - } - - @Override - public String getDescription() { - return getClass().getSimpleName(); - } - - @Override - public void perform(UiController uiController, View view) { - MapViewUtils.setTilt(mapboxMap, 40.0f); - } - } - - private class LatLngAction implements ViewAction { - - private MapboxMap mapboxMap; - - LatLngAction(MapboxMap mapboxMap) { - this.mapboxMap = mapboxMap; - } - - @Override - public Matcher getConstraints() { - return isDisplayed(); - } - - @Override - public String getDescription() { - return getClass().getSimpleName(); - } - - @Override - public void perform(UiController uiController, View view) { - MapViewUtils.setLatLng(mapboxMap, new LatLng(1.1, 2.2)); - } - } -} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimatorActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimatorActivity.java index f25fd6ab27..6277dffe91 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimatorActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraAnimatorActivity.java @@ -115,7 +115,9 @@ public class CameraAnimatorActivity extends AppCompatActivity implements OnMapRe ValueAnimator latLngAnimator = ValueAnimator.ofObject(new LatLngEvaluator(), currentPosition, targetPosition); latLngAnimator.setDuration((long) (1000 * ANIMATION_DELAY_FACTOR)); latLngAnimator.setInterpolator(new FastOutSlowInInterpolator()); - latLngAnimator.addUpdateListener(animation -> mapboxMap.setLatLng((LatLng) animation.getAnimatedValue())); + latLngAnimator.addUpdateListener(animation -> mapboxMap.moveCamera( + CameraUpdateFactory.newLatLng((LatLng) animation.getAnimatedValue())) + ); return latLngAnimator; } @@ -124,7 +126,9 @@ public class CameraAnimatorActivity extends AppCompatActivity implements OnMapRe zoomAnimator.setDuration((long) (2200 * ANIMATION_DELAY_FACTOR)); zoomAnimator.setStartDelay((long) (600 * ANIMATION_DELAY_FACTOR)); zoomAnimator.setInterpolator(new AnticipateOvershootInterpolator()); - zoomAnimator.addUpdateListener(animation -> mapboxMap.setZoom((Float) animation.getAnimatedValue())); + zoomAnimator.addUpdateListener(animation -> mapboxMap.moveCamera( + CameraUpdateFactory.zoomTo((Float) animation.getAnimatedValue())) + ); return zoomAnimator; } @@ -133,7 +137,9 @@ public class CameraAnimatorActivity extends AppCompatActivity implements OnMapRe bearingAnimator.setDuration((long) (1000 * ANIMATION_DELAY_FACTOR)); bearingAnimator.setStartDelay((long) (1000 * ANIMATION_DELAY_FACTOR)); bearingAnimator.setInterpolator(new FastOutLinearInInterpolator()); - bearingAnimator.addUpdateListener(animation -> mapboxMap.setBearing((Float) animation.getAnimatedValue())); + bearingAnimator.addUpdateListener(animation -> mapboxMap.moveCamera( + CameraUpdateFactory.bearingTo((Float) animation.getAnimatedValue())) + ); return bearingAnimator; } @@ -141,7 +147,9 @@ public class CameraAnimatorActivity extends AppCompatActivity implements OnMapRe ValueAnimator tiltAnimator = ValueAnimator.ofFloat((float) currentTilt, (float) targetTilt); tiltAnimator.setDuration((long) (1000 * ANIMATION_DELAY_FACTOR)); tiltAnimator.setStartDelay((long) (1500 * ANIMATION_DELAY_FACTOR)); - tiltAnimator.addUpdateListener(animation -> mapboxMap.setTilt((Float) animation.getAnimatedValue())); + tiltAnimator.addUpdateListener(animation -> mapboxMap.moveCamera( + CameraUpdateFactory.tiltTo((Float) animation.getAnimatedValue())) + ); return tiltAnimator; } @@ -192,7 +200,9 @@ public class CameraAnimatorActivity extends AppCompatActivity implements OnMapRe ValueAnimator zoomAnimator = ValueAnimator.ofFloat(11.0f, 16.0f); zoomAnimator.setDuration((long) (duration * ANIMATION_DELAY_FACTOR)); zoomAnimator.setInterpolator(interpolator); - zoomAnimator.addUpdateListener(animation -> mapboxMap.setZoom((Float) animation.getAnimatedValue())); + zoomAnimator.addUpdateListener(animation -> mapboxMap.moveCamera( + CameraUpdateFactory.zoomTo((Float) animation.getAnimatedValue())) + ); return zoomAnimator; } -- cgit v1.2.1 From f6d652ddddd1181604b41d38459e085314080575 Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Tue, 13 Feb 2018 15:14:44 -0500 Subject: [ios] Fix safeAreaInsets availability warning in MGLMapViewLayoutTests Fixes: 'safeAreaInsets' is only available on iOS 11.0 or newer [-Wunguarded-availability-new] --- platform/ios/test/MGLMapViewLayoutTests.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/ios/test/MGLMapViewLayoutTests.m b/platform/ios/test/MGLMapViewLayoutTests.m index a41e7695f9..e707cfdb41 100644 --- a/platform/ios/test/MGLMapViewLayoutTests.m +++ b/platform/ios/test/MGLMapViewLayoutTests.m @@ -67,7 +67,7 @@ CGFloat bottomSafeAreaInset = 0.0; double accuracy = 0.01; - if ( [self.mapView respondsToSelector:@selector(safeAreaInsets)] ) { + if (@available(iOS 11.0, *)) { bottomSafeAreaInset = self.mapView.safeAreaInsets.bottom; } -- cgit v1.2.1 From aa6e06392923b49963f59a06ccc9a80de1c729b1 Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Tue, 13 Feb 2018 15:39:12 -0500 Subject: [ios] Fix type conversion warnings in MGLFeatureTests Fixes: object of type 'MGLPointAnnotation/MGLPolyline *' is not compatible with array element type 'MGLShape *' [-Wobjc-literal-conversion] --- platform/darwin/test/MGLFeatureTests.mm | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/platform/darwin/test/MGLFeatureTests.mm b/platform/darwin/test/MGLFeatureTests.mm index 818ad8200e..14b64be854 100644 --- a/platform/darwin/test/MGLFeatureTests.mm +++ b/platform/darwin/test/MGLFeatureTests.mm @@ -298,29 +298,36 @@ } - (void)testShapeCollectionFeatureGeoJSONDictionary { - MGLPointAnnotation *pointFeature = [[MGLPointAnnotation alloc] init]; + MGLPointFeature *pointFeature = [[MGLPointFeature alloc] init]; CLLocationCoordinate2D pointCoordinate = { 10, 10 }; pointFeature.coordinate = pointCoordinate; CLLocationCoordinate2D coord1 = { 0, 0 }; CLLocationCoordinate2D coord2 = { 10, 10 }; CLLocationCoordinate2D coords[] = { coord1, coord2 }; - MGLPolyline *polyline = [MGLPolyline polylineWithCoordinates:coords count:2]; + MGLPolylineFeature *polylineFeature = [MGLPolylineFeature polylineWithCoordinates:coords count:2]; + + MGLShapeCollectionFeature *shapeCollectionFeature = [MGLShapeCollectionFeature shapeCollectionWithShapes:@[pointFeature, polylineFeature]]; - MGLShapeCollectionFeature *shapeCollectionFeature = [MGLShapeCollectionFeature shapeCollectionWithShapes:@[pointFeature, - polyline]]; // A GeoJSON feature NSDictionary *geoJSONFeature = [shapeCollectionFeature geoJSONDictionary]; // it has the correct geometry NSDictionary *expectedGeometry = @{@"type": @"GeometryCollection", @"geometries": @[ - @{@"type": @"Point", - @"coordinates": @[@(pointCoordinate.longitude), @(pointCoordinate.latitude)]}, - @{@"type": @"LineString", - @"coordinates": @[@[@(coord1.longitude), @(coord1.latitude)], - @[@(coord2.longitude), @(coord2.latitude)]]} - ]}; + @{ @"geometry": @{@"type": @"Point", + @"coordinates": @[@(pointCoordinate.longitude), @(pointCoordinate.latitude)]}, + @"properties": [NSNull null], + @"type": @"Feature", + }, + @{ @"geometry": @{@"type": @"LineString", + @"coordinates": @[@[@(coord1.longitude), @(coord1.latitude)], + @[@(coord2.longitude), @(coord2.latitude)]]}, + @"properties": [NSNull null], + @"type": @"Feature", + } + ] + }; XCTAssertEqualObjects(geoJSONFeature[@"geometry"], expectedGeometry); // When the shape collection is created with an empty array of shapes -- cgit v1.2.1 From 7e51e52f0cabd909557b763f10e90ac0444e90a1 Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Tue, 13 Feb 2018 16:14:29 -0500 Subject: [ios] Fix iOS 8's broken pluralization in MGLCoordinateFormatterTests --- platform/darwin/test/MGLCoordinateFormatterTests.m | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/platform/darwin/test/MGLCoordinateFormatterTests.m b/platform/darwin/test/MGLCoordinateFormatterTests.m index ac083fa103..d693f739ec 100644 --- a/platform/darwin/test/MGLCoordinateFormatterTests.m +++ b/platform/darwin/test/MGLCoordinateFormatterTests.m @@ -24,7 +24,12 @@ coordinate = CLLocationCoordinate2DMake(38.9131982, -77.0325453144239); XCTAssertEqualObjects([shortFormatter stringFromCoordinate:coordinate], @"38°54′48″N, 77°1′57″W"); XCTAssertEqualObjects([mediumFormatter stringFromCoordinate:coordinate], @"38°54′48″ north, 77°1′57″ west"); - XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"38 degrees, 54 minutes, and 48 seconds north by 77 degrees, 1 minute, and 57 seconds west"); + if (@available(iOS 9.0, *)) { + XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"38 degrees, 54 minutes, and 48 seconds north by 77 degrees, 1 minute, and 57 seconds west"); + } else { + // Foundation in iOS 8 does not know how to pluralize coordinates. + XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"38 degree(s), 54 minute(s), and 48 second(s) north by 77 degree(s), 1 minute(s), and 57 second(s) west"); + } shortFormatter.allowsSeconds = NO; mediumFormatter.allowsSeconds = NO; @@ -33,7 +38,12 @@ coordinate = CLLocationCoordinate2DMake(38.9131982, -77.0325453144239); XCTAssertEqualObjects([shortFormatter stringFromCoordinate:coordinate], @"38°55′N, 77°2′W"); XCTAssertEqualObjects([mediumFormatter stringFromCoordinate:coordinate], @"38°55′ north, 77°2′ west"); - XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"38 degrees and 55 minutes north by 77 degrees and 2 minutes west"); + if (@available(iOS 9.0, *)) { + XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"38 degrees and 55 minutes north by 77 degrees and 2 minutes west"); + } else { + // Foundation in iOS 8 does not know how to pluralize coordinates. + XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"38 degree(s) and 55 minute(s) north by 77 degree(s) and 2 minute(s) west"); + } shortFormatter.allowsMinutes = NO; mediumFormatter.allowsMinutes = NO; @@ -42,7 +52,12 @@ coordinate = CLLocationCoordinate2DMake(38.9131982, -77.0325453144239); XCTAssertEqualObjects([shortFormatter stringFromCoordinate:coordinate], @"39°N, 77°W"); XCTAssertEqualObjects([mediumFormatter stringFromCoordinate:coordinate], @"39° north, 77° west"); - XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"39 degrees north by 77 degrees west"); + if (@available(iOS 9.0, *)) { + XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"39 degrees north by 77 degrees west"); + } else { + // Foundation in iOS 8 does not know how to pluralize coordinates. + XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"39 degree(s) north by 77 degree(s) west"); + } } @end -- cgit v1.2.1 From b981713f3a265786f4c8fcbe934260a09cc09da3 Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Tue, 13 Feb 2018 19:11:22 -0500 Subject: [ios] Bump testMGLMapSnapshotter timeout to 5s Timing based tests are inherently flakey and prone to failure on slow CI: > Test case 'MGLDocumentationExampleTests.testMGLMapSnapshotter()' failed on 'iPhone X' (3.375 seconds) > Test case 'MGLDocumentationExampleTests.testMGLMapSnapshotter()' failed on 'iPhone 8' (3.413 seconds) > Test case 'MGLDocumentationExampleTests.testMGLMapSnapshotter()' failed on 'iPhone 7' (2.944 seconds) --- platform/darwin/test/MGLDocumentationExampleTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/darwin/test/MGLDocumentationExampleTests.swift b/platform/darwin/test/MGLDocumentationExampleTests.swift index 5a6e00bc4e..a216d9ad1c 100644 --- a/platform/darwin/test/MGLDocumentationExampleTests.swift +++ b/platform/darwin/test/MGLDocumentationExampleTests.swift @@ -391,7 +391,7 @@ class MGLDocumentationExampleTests: XCTestCase, MGLMapViewDelegate { } //#-end-example-code - wait(for: [expectation], timeout: 1) + wait(for: [expectation], timeout: 5) } // For testMGLMapView(). -- cgit v1.2.1 From 91cd7f5aa9962c9d5a65e1b37abb85d5fe02753e Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Thu, 15 Feb 2018 12:18:08 -0500 Subject: [ios] Disable -[MGLExpressionTests testConditionalExpressionObject] on iOS 8 Temporarily disable this test until iOS 8 compatibility is added. --- platform/darwin/test/MGLExpressionTests.mm | 38 +++++++++++++++++------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/platform/darwin/test/MGLExpressionTests.mm b/platform/darwin/test/MGLExpressionTests.mm index 821c5dbdb4..a5ed2f7bf5 100644 --- a/platform/darwin/test/MGLExpressionTests.mm +++ b/platform/darwin/test/MGLExpressionTests.mm @@ -573,23 +573,27 @@ using namespace std::string_literals; } - (void)testConditionalExpressionObject { - { - NSPredicate *conditional = [NSPredicate predicateWithFormat:@"1 = 2"]; - NSExpression *trueExpression = [NSExpression expressionForConstantValue:@YES]; - NSExpression *falseExpression = [NSExpression expressionForConstantValue:@NO]; - NSExpression *expression = [NSExpression expressionForConditional:conditional trueExpression:trueExpression falseExpression:falseExpression]; - NSArray *jsonExpression = @[@"case", @[@"==", @1, @2], @YES, @NO]; - XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression); - XCTAssertEqualObjects([NSExpression expressionWithFormat:@"TERNARY(1 = 2, TRUE, FALSE)"].mgl_jsonExpressionObject, jsonExpression); - XCTAssertEqualObjects([expression expressionValueWithObject:nil context:nil], @NO); - XCTAssertEqualObjects([NSExpression mgl_expressionWithJSONObject:jsonExpression], expression); - } - { - NSExpression *expression = [NSExpression expressionWithFormat:@"TERNARY(0 = 1, TRUE, TERNARY(1 = 2, TRUE, FALSE))"]; - NSArray *jsonExpression = @[@"case", @[@"==", @0, @1], @YES, @[@"==", @1, @2], @YES, @NO]; - XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression); - XCTAssertEqualObjects([expression expressionValueWithObject:nil context:nil], @NO); - XCTAssertEqualObjects([NSExpression mgl_expressionWithJSONObject:jsonExpression], expression); + // FIXME: This test crashes because iOS 8 doesn't have `+[NSExpression expressionForConditional:trueExpression:falseExpression:]`. + // https://github.com/mapbox/mapbox-gl-native/issues/11007 + if (@available(iOS 9.0, *)) { + { + NSPredicate *conditional = [NSPredicate predicateWithFormat:@"1 = 2"]; + NSExpression *trueExpression = [NSExpression expressionForConstantValue:@YES]; + NSExpression *falseExpression = [NSExpression expressionForConstantValue:@NO]; + NSExpression *expression = [NSExpression expressionForConditional:conditional trueExpression:trueExpression falseExpression:falseExpression]; + NSArray *jsonExpression = @[@"case", @[@"==", @1, @2], @YES, @NO]; + XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression); + XCTAssertEqualObjects([NSExpression expressionWithFormat:@"TERNARY(1 = 2, TRUE, FALSE)"].mgl_jsonExpressionObject, jsonExpression); + XCTAssertEqualObjects([expression expressionValueWithObject:nil context:nil], @NO); + XCTAssertEqualObjects([NSExpression mgl_expressionWithJSONObject:jsonExpression], expression); + } + { + NSExpression *expression = [NSExpression expressionWithFormat:@"TERNARY(0 = 1, TRUE, TERNARY(1 = 2, TRUE, FALSE))"]; + NSArray *jsonExpression = @[@"case", @[@"==", @0, @1], @YES, @[@"==", @1, @2], @YES, @NO]; + XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression); + XCTAssertEqualObjects([expression expressionValueWithObject:nil context:nil], @NO); + XCTAssertEqualObjects([NSExpression mgl_expressionWithJSONObject:jsonExpression], expression); + } } } -- cgit v1.2.1 From 00abd2eaa6dc06cb11a0d24a7128934aea0b9c7d Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Fri, 16 Feb 2018 20:01:03 -0500 Subject: [ios] Fix loop when first asking for location permission (#11229) --- platform/ios/CHANGELOG.md | 4 ++++ platform/ios/src/MGLMapView.mm | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index c11fc63ebd..ab37526573 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -44,6 +44,10 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * Labels are now transliterated from more languages when VoiceOver is enabled. ([#10881](https://github.com/mapbox/mapbox-gl-native/pull/10881)) * Long-pressing the attribution button causes the SDK’s version number to be displayed in the action sheet that appears. ([#10650](https://github.com/mapbox/mapbox-gl-native/pull/10650)) +## 3.7.5 + +* Fixed an issue where requesting location services permission would trigger an unrecoverable loop. ([#11229](https://github.com/mapbox/mapbox-gl-native/pull/11229)) + ## 3.7.4 - February 12, 2018 * Added the `MGLTileSourceOptionTileCoordinateBounds` option to create an `MGLTileSource` that only supplies tiles within a specific geographic bounding box. ([#11141](https://github.com/mapbox/mapbox-gl-native/pull/11141)) diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 927450b511..c8e084795e 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -544,8 +544,9 @@ public: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willTerminate) name:UIApplicationWillTerminateNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sleepGL:) name:UIApplicationDidEnterBackgroundNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(wakeGL:) name:UIApplicationWillEnterForegroundNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sleepGL:) name:UIApplicationWillResignActiveNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(wakeGL:) name:UIApplicationDidBecomeActiveNotification object:nil]; + // As of 3.7.5, we intentionally do not listen for `UIApplicationWillResignActiveNotification` or call `sleepGL:` in response to it, as doing + // so causes a loop when asking for location permission. See: https://github.com/mapbox/mapbox-gl-native/issues/11225 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceOrientationDidChange:) name:UIDeviceOrientationDidChangeNotification object:nil]; -- cgit v1.2.1 From c2be33fa4135f3c132f31437cfc0cd759c273790 Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Fri, 16 Feb 2018 20:06:32 -0500 Subject: [ios] Bump podspecs for 3.7.5 --- platform/ios/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index ab37526573..094634980e 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -44,7 +44,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * Labels are now transliterated from more languages when VoiceOver is enabled. ([#10881](https://github.com/mapbox/mapbox-gl-native/pull/10881)) * Long-pressing the attribution button causes the SDK’s version number to be displayed in the action sheet that appears. ([#10650](https://github.com/mapbox/mapbox-gl-native/pull/10650)) -## 3.7.5 +## 3.7.5 - February 16, 2018 * Fixed an issue where requesting location services permission would trigger an unrecoverable loop. ([#11229](https://github.com/mapbox/mapbox-gl-native/pull/11229)) -- cgit v1.2.1 From 054d4d5ad676ce1ca9a740bc99ccd7ff2f9fecec Mon Sep 17 00:00:00 2001 From: Asheem Mamoowala Date: Fri, 16 Feb 2018 12:38:23 -0800 Subject: [core] Support a range of zooms in TileRange. Accounts for TilePyramid requesting parent tiles of ideal zoom tiles. --- src/mbgl/renderer/tile_pyramid.cpp | 7 +++-- src/mbgl/util/tile_range.hpp | 60 +++++++++++++++++++++++++------------- test/util/tile_range.test.cpp | 13 ++++++++- 3 files changed, 57 insertions(+), 23 deletions(-) diff --git a/src/mbgl/renderer/tile_pyramid.cpp b/src/mbgl/renderer/tile_pyramid.cpp index c4372e7112..8f83a0f982 100644 --- a/src/mbgl/renderer/tile_pyramid.cpp +++ b/src/mbgl/renderer/tile_pyramid.cpp @@ -143,10 +143,13 @@ void TilePyramid::update(const std::vector>& layer auto it = tiles.find(tileID); return it == tiles.end() ? nullptr : it->second.get(); }; - + + // The min and max zoom for TileRange are based on the updateRenderables algorithm. + // Tiles are created at the ideal tile zoom or at lower zoom levels. Child + // tiles are used from the cache, but not created. optional tileRange = {}; if (bounds) { - tileRange = util::TileRange::fromLatLngBounds(*bounds, std::min(tileZoom, (int32_t)zoomRange.max)); + tileRange = util::TileRange::fromLatLngBounds(*bounds, zoomRange.min, std::min(tileZoom, (int32_t)zoomRange.max)); } auto createTileFn = [&](const OverscaledTileID& tileID) -> Tile* { if (tileRange && !tileRange->contains(tileID.canonical)) { diff --git a/src/mbgl/util/tile_range.hpp b/src/mbgl/util/tile_range.hpp index f630a49078..8554cfb65e 100644 --- a/src/mbgl/util/tile_range.hpp +++ b/src/mbgl/util/tile_range.hpp @@ -6,41 +6,61 @@ #include namespace mbgl { - namespace util { class TileRange { public: - Range> range; - uint8_t z; + Range> range; + Range zoomRange; + + // Compute the range of tiles covered by the bounds at maxZoom. + static TileRange fromLatLngBounds(const LatLngBounds& bounds, uint8_t minZoom, uint8_t maxZoom) { + if (minZoom > maxZoom) { + std::swap(minZoom, maxZoom); + } + + auto swProj = Projection::project(bounds.southwest().wrapped(), maxZoom); + auto ne = bounds.northeast(); + auto neProj = Projection::project(ne.longitude() > util::LONGITUDE_MAX ? ne.wrapped() : ne , maxZoom); + + const auto maxTile = std::pow(2.0, maxZoom); + const auto minX = static_cast(std::floor(swProj.x)); + const auto maxX = static_cast(std::floor(neProj.x)); + const auto minY = static_cast(util::clamp(std::floor(neProj.y), 0.0 , maxTile)); + const auto maxY = static_cast(util::clamp(std::floor(swProj.y), 0.0, maxTile)); + + return TileRange({ {minX, minY}, {maxX, maxY} }, {minZoom, maxZoom}); + } // Compute the range of tiles covered by the bounds. static TileRange fromLatLngBounds(const LatLngBounds& bounds, uint8_t z) { - auto swProj = Projection::project(bounds.southwest().wrapped(), z); - auto ne = bounds.northeast(); - auto neProj = Projection::project(ne.longitude() > util::LONGITUDE_MAX ? ne.wrapped() : ne , z); - const auto minX = std::floor(swProj.x); - const auto maxX = std::ceil(neProj.x); - const auto minY = std::floor(neProj.y); - const auto maxY = std::ceil(swProj.y); - return TileRange({ {minX, minY}, {maxX, maxY} }, z); + return fromLatLngBounds(bounds, z, z); } bool contains(const CanonicalTileID& tileID) { - return z == tileID.z && - (range.min.x >= range.max.x ? //For wrapped bounds - tileID.x >= range.min.x || tileID.x < range.max.x : - tileID.x < range.max.x && tileID.x >= range.min.x) && - tileID.y < range.max.y && - tileID.y >= range.min.y; + if (tileID.z <= zoomRange.max && tileID.z >= zoomRange.min) { + if (tileID.z == 0) { + return true; + } + uint8_t dz = (zoomRange.max - tileID.z); + auto x0 = range.min.x >> dz; + auto x1 = range.max.x >> dz; + auto y0 = range.min.y >> dz; + auto y1 = range.max.y >> dz; + return (range.min.x > range.max.x ? //For wrapped bounds + tileID.x >= x0 || tileID.x <= x1 : + tileID.x <= x1 && tileID.x >= x0) && + tileID.y <= y1 && + tileID.y >= y0; + } + return false; } private: - TileRange(Range> range_, uint8_t z_) + TileRange(Range> range_, Range z_) : range(range_), - z(z_) { + zoomRange(z_) { } - }; } // namespace util diff --git a/test/util/tile_range.test.cpp b/test/util/tile_range.test.cpp index dc8ae28705..c4c37c74d7 100644 --- a/test/util/tile_range.test.cpp +++ b/test/util/tile_range.test.cpp @@ -1,4 +1,3 @@ - #include #include #include @@ -25,6 +24,18 @@ TEST(TileRange, ContainsBoundsFromTile) { EXPECT_TRUE(range.contains(CanonicalTileID(10, 162, 395))); } } + +TEST(TileRange, ContainsMultiZoom) { + auto wrappedBounds = LatLngBounds::hull({ 37.6609, -122.5744 }, { 37.8271, -122.3204 }); + auto range = util::TileRange::fromLatLngBounds(wrappedBounds, 5, 13); + EXPECT_FALSE(range.contains(CanonicalTileID(0, 0, 0))); + EXPECT_FALSE(range.contains(CanonicalTileID(5, 3, 11))); + EXPECT_FALSE(range.contains(CanonicalTileID(6, 9, 22))); + EXPECT_TRUE(range.contains(CanonicalTileID(5, 5, 12))); + EXPECT_TRUE(range.contains(CanonicalTileID(6, 10, 24))); + EXPECT_TRUE(range.contains(CanonicalTileID(13, 1310, 3166))); +} + TEST(TileRange, ContainsIntersectingTiles) { auto bounds = LatLngBounds::hull({ 37.6609, -122.5744 }, { 37.8271, -122.3204 }); auto range = util::TileRange::fromLatLngBounds(bounds, 13); -- cgit v1.2.1 From 25629c81a691c65572a69b30ec0a5866cdcdb819 Mon Sep 17 00:00:00 2001 From: Julian Rex Date: Tue, 20 Feb 2018 15:46:35 -0500 Subject: [ios] Podspec bump 4.0.0-beta.2 (#11263) * [ios] Podspec bump 4.0.0-beta.2 * [ios] Improved change log messaging. --- platform/ios/CHANGELOG.md | 3 +++ platform/ios/Mapbox-iOS-SDK-nightly-dynamic.podspec | 2 +- platform/ios/Mapbox-iOS-SDK-symbols.podspec | 2 +- platform/ios/Mapbox-iOS-SDK.podspec | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 094634980e..67a18d4711 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -17,6 +17,8 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * Added an `MGLComputedShapeSource` class that allows applications to supply vector data to a style layer on a per-tile basis. ([#9983](https://github.com/mapbox/mapbox-gl-native/pull/9983)) * A style can now display smooth hillshading and customize its appearance at runtime using the `MGLHillshadeStyleLayer` class. Hillshading is based on a rasterized digital elevation model supplied by the `MGLRasterDEMSource` class. ([#10642](https://github.com/mapbox/mapbox-gl-native/pull/10642)) * The `MGLSymbolStyleLayer.textFontNames` property can now depend on a feature’s attributes. ([#10850](https://github.com/mapbox/mapbox-gl-native/pull/10850)) +* Added `MGLShapeSourceOptionWrapsCoordinates`, to specify whether the shape of an `MGLComputedShapeSource` should be wrapped to accommodate coordinates with longitudes beyond −180 and 180; and `MGLShapeSourceOptionClipsCoordinates`, to specify whether the shape of an `MGLComputedShapeSource` should be clipped at the edge of each tile. ([#11041](https://github.com/mapbox/mapbox-gl-native/pull/11041)) +* Added support for Mapzen Terrarium DEM encoding. ([#11154](https://github.com/mapbox/mapbox-gl-native/pull/11154)) ### Map rendering @@ -43,6 +45,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * Fixed an issue preventing labels from being transliterated when VoiceOver was enabled on iOS 10._x_ and below. ([#10881](https://github.com/mapbox/mapbox-gl-native/pull/10881)) * Labels are now transliterated from more languages when VoiceOver is enabled. ([#10881](https://github.com/mapbox/mapbox-gl-native/pull/10881)) * Long-pressing the attribution button causes the SDK’s version number to be displayed in the action sheet that appears. ([#10650](https://github.com/mapbox/mapbox-gl-native/pull/10650)) +* Reduced offline download size for styles with symbol layers that render only icons, and no text. ([#11055](https://github.com/mapbox/mapbox-gl-native/pull/11055)) ## 3.7.5 - February 16, 2018 diff --git a/platform/ios/Mapbox-iOS-SDK-nightly-dynamic.podspec b/platform/ios/Mapbox-iOS-SDK-nightly-dynamic.podspec index 56714a5211..56f0682073 100644 --- a/platform/ios/Mapbox-iOS-SDK-nightly-dynamic.podspec +++ b/platform/ios/Mapbox-iOS-SDK-nightly-dynamic.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |m| - version = '4.0.0-beta.1' + version = '4.0.0-beta.2' m.name = 'Mapbox-iOS-SDK-nightly-dynamic' m.version = "#{version}-nightly" diff --git a/platform/ios/Mapbox-iOS-SDK-symbols.podspec b/platform/ios/Mapbox-iOS-SDK-symbols.podspec index fb7e55bbd3..6c9bc3b564 100644 --- a/platform/ios/Mapbox-iOS-SDK-symbols.podspec +++ b/platform/ios/Mapbox-iOS-SDK-symbols.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |m| - version = '4.0.0-beta.1' + version = '4.0.0-beta.2' m.name = 'Mapbox-iOS-SDK-symbols' m.version = "#{version}-symbols" diff --git a/platform/ios/Mapbox-iOS-SDK.podspec b/platform/ios/Mapbox-iOS-SDK.podspec index ee35103700..657417da19 100644 --- a/platform/ios/Mapbox-iOS-SDK.podspec +++ b/platform/ios/Mapbox-iOS-SDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |m| - version = '4.0.0-beta.1' + version = '4.0.0-beta.2' m.name = 'Mapbox-iOS-SDK' m.version = version -- cgit v1.2.1 From 0525fd1e4a207040b6268ee0b2a9634d8fa37753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Tue, 20 Feb 2018 12:57:59 -0800 Subject: [ios, macos] Unwrap coordinate bounds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated coordinate bounds conversion methods to use the beyond-±180 method to indicate that the bounds extends beyond the antimeridian. Also copyedited conversion documentation. --- platform/ios/CHANGELOG.md | 1 + platform/ios/src/MGLMapView.h | 36 +++++++++++++++++++++--------- platform/ios/src/MGLMapView.mm | 48 +++++++++++++++------------------------- platform/macos/CHANGELOG.md | 1 + platform/macos/src/MGLMapView.h | 21 +++++++++--------- platform/macos/src/MGLMapView.mm | 44 +++++++++++++++--------------------- 6 files changed, 75 insertions(+), 76 deletions(-) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 67a18d4711..7e82bf7dc7 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -41,6 +41,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT ### Other changes +* The `-[MGLMapView convertRect:toCoordinateBoundsFromView:]` method and the `MGLMapView.visibleCoordinateBounds` property’s getter now indicate that the coordinate bounds straddles the antimeridian by extending one side beyond ±180 degrees longitude. ([#11265](https://github.com/mapbox/mapbox-gl-native/pull/11265)) * Feature querying results now account for the `MGLSymbolStyleLayer.circleStrokeWidth` property. ([#10897](https://github.com/mapbox/mapbox-gl-native/pull/10897)) * Fixed an issue preventing labels from being transliterated when VoiceOver was enabled on iOS 10._x_ and below. ([#10881](https://github.com/mapbox/mapbox-gl-native/pull/10881)) * Labels are now transliterated from more languages when VoiceOver is enabled. ([#10881](https://github.com/mapbox/mapbox-gl-native/pull/10881)) diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h index a4dcc4cdbf..9c18965b09 100644 --- a/platform/ios/src/MGLMapView.h +++ b/platform/ios/src/MGLMapView.h @@ -659,11 +659,10 @@ MGL_EXPORT IB_DESIGNABLE want to animate the change, call `-setVisibleCoordinateBounds:animated:` instead. - If a longitude is less than −180 degrees or greater than 180 degrees, the visible - bounds straddles the antimeridian or international date line. - - For example, a visible bounds that stretches from Tokyo to San Francisco would have - coordinates of (35.68476, -220.24257) and (37.78428, -122.41310). + If a longitude is less than −180 degrees or greater than 180 degrees, the + visible bounds straddles the antimeridian or international date line. For + example, if both Tokyo and San Francisco are visible, the visible bounds might + extend from (35.68476, −220.24257) to (37.78428, −122.41310). */ @property (nonatomic) MGLCoordinateBounds visibleCoordinateBounds; @@ -671,11 +670,10 @@ MGL_EXPORT IB_DESIGNABLE Changes the receiver’s viewport to fit the given coordinate bounds, optionally animating the change. - To make the visible bounds go across the antimeridian or international date line, - specify some longitudes less than −180 degrees or greater than 180 degrees. - - For example, a visible bounds that stretches from Tokyo to San Francisco would have - coordinates of (35.68476, -220.24257) and (37.78428, -122.41310). + To bring both sides of the antimeridian or international date line into view, + specify some longitudes less than −180 degrees or greater than 180 degrees. For + example, to show both Tokyo and San Francisco simultaneously, you could set the + visible bounds to extend from (35.68476, −220.24257) to (37.78428, −122.41310). @param bounds The bounds that the viewport will show in its entirety. @param animated Specify `YES` to animate the change by smoothly scrolling @@ -686,6 +684,11 @@ MGL_EXPORT IB_DESIGNABLE /** Changes the receiver’s viewport to fit the given coordinate bounds and optionally some additional padding on each side. + + To bring both sides of the antimeridian or international date line into view, + specify some longitudes less than −180 degrees or greater than 180 degrees. For + example, to show both Tokyo and San Francisco simultaneously, you could set the + visible bounds to extend from (35.68476, −220.24257) to (37.78428, −122.41310). @param bounds The bounds that the viewport will show in its entirety. @param insets The minimum padding (in screen points) that will be visible @@ -698,6 +701,11 @@ MGL_EXPORT IB_DESIGNABLE /** Changes the receiver’s viewport to fit all of the given coordinates and optionally some additional padding on each side. + + To bring both sides of the antimeridian or international date line into view, + specify some longitudes less than −180 degrees or greater than 180 degrees. For + example, to show both Tokyo and San Francisco simultaneously, you could set the + visible coordinates to (35.68476, −220.24257) and (37.78428, −122.41310). @param coordinates The coordinates that the viewport will show. @param count The number of coordinates. This number must not be greater than @@ -712,6 +720,11 @@ MGL_EXPORT IB_DESIGNABLE /** Changes the receiver’s viewport to fit all of the given coordinates and optionally some additional padding on each side. + + To bring both sides of the antimeridian or international date line into view, + specify some longitudes less than −180 degrees or greater than 180 degrees. For + example, to show both Tokyo and San Francisco simultaneously, you could set the + visible coordinates to (35.68476, −220.24257) and (37.78428, −122.41310). @param coordinates The coordinates that the viewport will show. @param count The number of coordinates. This number must not be greater than @@ -994,6 +1007,9 @@ MGL_EXPORT IB_DESIGNABLE /** Converts a rectangle in the given view’s coordinate system to a geographic bounding box. + + If a longitude is less than −180 degrees or greater than 180 degrees, the + bounding box straddles the antimeridian or international date line. @param rect The rectangle to convert. @param view The view in whose coordinate system the rectangle is expressed. diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index c8e084795e..1cb4779555 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -3423,36 +3423,24 @@ public: /// bounding box. - (mbgl::LatLngBounds)convertRect:(CGRect)rect toLatLngBoundsFromView:(nullable UIView *)view { - mbgl::LatLngBounds bounds = mbgl::LatLngBounds::empty(); - bounds.extend([self convertPoint:rect.origin toLatLngFromView:view]); - bounds.extend([self convertPoint:{ CGRectGetMaxX(rect), CGRectGetMinY(rect) } toLatLngFromView:view]); - bounds.extend([self convertPoint:{ CGRectGetMaxX(rect), CGRectGetMaxY(rect) } toLatLngFromView:view]); - bounds.extend([self convertPoint:{ CGRectGetMinX(rect), CGRectGetMaxY(rect) } toLatLngFromView:view]); - - // The world is wrapping if a point just outside the bounds is also within - // the rect. - mbgl::LatLng outsideLatLng; - if (bounds.west() > -180) - { - outsideLatLng = { - (bounds.south() + bounds.north()) / 2, - bounds.west() - 1, - }; - } - else if (bounds.east() < 180) - { - outsideLatLng = { - (bounds.south() + bounds.north()) / 2, - bounds.east() + 1, - }; - } - - // If the world is wrapping, extend the bounds to cover all longitudes. - if (CGRectContainsPoint(rect, [self convertLatLng:outsideLatLng toPointToView:view])) - { - bounds.extend(mbgl::LatLng(bounds.south(), -180)); - bounds.extend(mbgl::LatLng(bounds.south(), 180)); - } + auto bounds = mbgl::LatLngBounds::empty(); + auto topLeft = [self convertPoint:{ CGRectGetMinX(rect), CGRectGetMinY(rect) } toLatLngFromView:view]; + auto topRight = [self convertPoint:{ CGRectGetMaxX(rect), CGRectGetMinY(rect) } toLatLngFromView:view]; + auto bottomRight = [self convertPoint:{ CGRectGetMaxX(rect), CGRectGetMaxY(rect) } toLatLngFromView:view]; + auto bottomLeft = [self convertPoint:{ CGRectGetMinX(rect), CGRectGetMaxY(rect) } toLatLngFromView:view]; + + // If the bounds straddles the antimeridian, unwrap it so that one side + // extends beyond ±180° longitude. + auto center = [self convertPoint:{ CGRectGetMidX(rect), CGRectGetMidY(rect) } toLatLngFromView:view]; + topLeft.unwrapForShortestPath(center); + topRight.unwrapForShortestPath(center); + bottomRight.unwrapForShortestPath(center); + bottomLeft.unwrapForShortestPath(center); + + bounds.extend(topLeft); + bounds.extend(topRight); + bounds.extend(bottomRight); + bounds.extend(bottomLeft); return bounds; } diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index 06fedf7cc7..342262c1db 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -30,6 +30,7 @@ ### Other changes * Added Danish and Hebrew localizations. ([#10967](https://github.com/mapbox/mapbox-gl-native/pull/10967), [#11136](https://github.com/mapbox/mapbox-gl-native/pull/11134)) +* The `-[MGLMapView convertRect:toCoordinateBoundsFromView:]` method and the `MGLMapView.visibleCoordinateBounds` property’s getter now indicate that the coordinate bounds straddles the antimeridian by extending one side beyond ±180 degrees longitude. ([#11265](https://github.com/mapbox/mapbox-gl-native/pull/11265)) * Feature querying results now account for the `MGLSymbolStyleLayer.circleStrokeWidth` property. ([#10897](https://github.com/mapbox/mapbox-gl-native/pull/10897)) * Removed methods, properties, and constants that had been deprecated as of v0.6.1. ([#11205](https://github.com/mapbox/mapbox-gl-native/pull/11205)) diff --git a/platform/macos/src/MGLMapView.h b/platform/macos/src/MGLMapView.h index 96b0932c14..050145b80b 100644 --- a/platform/macos/src/MGLMapView.h +++ b/platform/macos/src/MGLMapView.h @@ -397,11 +397,10 @@ MGL_EXPORT IB_DESIGNABLE want to animate the change, use the `-setVisibleCoordinateBounds:animated:` method instead. - If a longitude is less than −180 degrees or greater than 180 degrees, the visible - bounds straddles the antimeridian or international date line. - - For example, a visible bounds that stretches from Tokyo to San Francisco would have - coordinates of (35.68476, -220.24257) and (37.78428, -122.41310). + If a longitude is less than −180 degrees or greater than 180 degrees, the + visible bounds straddles the antimeridian or international date line. For + example, if both Tokyo and San Francisco are visible, the visible bounds might + extend from (35.68476, −220.24257) to (37.78428, −122.41310). */ @property (nonatomic) MGLCoordinateBounds visibleCoordinateBounds; @@ -409,11 +408,10 @@ MGL_EXPORT IB_DESIGNABLE Changes the receiver’s viewport to fit the given coordinate bounds, optionally animating the change. - To make the visible bounds go across the antimeridian or international date line, - specify some longitudes less than −180 degrees or greater than 180 degrees. - - For example, a visible bounds that stretches from Tokyo to San Francisco would have - coordinates of (35.68476, -220.24257) and (37.78428, -122.41310). + To bring both sides of the antimeridian or international date line into view, + specify some longitudes less than −180 degrees or greater than 180 degrees. For + example, to show both Tokyo and San Francisco simultaneously, you could set the + visible bounds to extend from (35.68476, −220.24257) to (37.78428, −122.41310). @param bounds The bounds that the viewport will show in its entirety. @param animated Specify `YES` to animate the change by smoothly scrolling and @@ -1060,6 +1058,9 @@ MGL_EXPORT IB_DESIGNABLE /** Converts a rectangle in the given view’s coordinate system to a geographic bounding box. + + If a longitude is less than −180 degrees or greater than 180 degrees, the + bounding box straddles the antimeridian or international date line. @param rect The rectangle to convert. @param view The view in whose coordinate system the rectangle is expressed. diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index 9ec9012198..7902fb5b64 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -2717,32 +2717,24 @@ public: /// Converts a rectangle in the given view’s coordinate system to a geographic /// bounding box. - (mbgl::LatLngBounds)convertRect:(NSRect)rect toLatLngBoundsFromView:(nullable NSView *)view { - mbgl::LatLngBounds bounds = mbgl::LatLngBounds::empty(); - bounds.extend([self convertPoint:rect.origin toLatLngFromView:view]); - bounds.extend([self convertPoint:{ NSMaxX(rect), NSMinY(rect) } toLatLngFromView:view]); - bounds.extend([self convertPoint:{ NSMaxX(rect), NSMaxY(rect) } toLatLngFromView:view]); - bounds.extend([self convertPoint:{ NSMinX(rect), NSMaxY(rect) } toLatLngFromView:view]); - - // The world is wrapping if a point just outside the bounds is also within - // the rect. - mbgl::LatLng outsideLatLng; - if (bounds.west() > -180) { - outsideLatLng = { - (bounds.south() + bounds.north()) / 2, - bounds.west() - 1, - }; - } else if (bounds.northeast().longitude() < 180) { - outsideLatLng = { - (bounds.south() + bounds.north()) / 2, - bounds.east() + 1, - }; - } - - // If the world is wrapping, extend the bounds to cover all longitudes. - if (NSPointInRect([self convertLatLng:outsideLatLng toPointToView:view], rect)) { - bounds.extend(mbgl::LatLng(bounds.south(), -180)); - bounds.extend(mbgl::LatLng(bounds.south(), 180)); - } + auto bounds = mbgl::LatLngBounds::empty(); + auto bottomLeft = [self convertPoint:{ NSMinX(rect), NSMinY(rect) } toLatLngFromView:view]; + auto bottomRight = [self convertPoint:{ NSMaxX(rect), NSMinY(rect) } toLatLngFromView:view]; + auto topRight = [self convertPoint:{ NSMaxX(rect), NSMaxY(rect) } toLatLngFromView:view]; + auto topLeft = [self convertPoint:{ NSMinX(rect), NSMaxY(rect) } toLatLngFromView:view]; + + // If the bounds straddles the antimeridian, unwrap it so that one side + // extends beyond ±180° longitude. + auto center = [self convertPoint:{ NSMidX(rect), NSMidY(rect) } toLatLngFromView:view]; + bottomLeft.unwrapForShortestPath(center); + bottomRight.unwrapForShortestPath(center); + topRight.unwrapForShortestPath(center); + topLeft.unwrapForShortestPath(center); + + bounds.extend(bottomLeft); + bounds.extend(bottomRight); + bounds.extend(topRight); + bounds.extend(topLeft); return bounds; } -- cgit v1.2.1 From b16893f903b3f81803d59cdfa3253a3fb09cfd3e Mon Sep 17 00:00:00 2001 From: Anand Thakker Date: Wed, 21 Feb 2018 21:39:33 -0500 Subject: Correctly parse constant expressions in dds style properties (#11282) * Correctly parse constant expressions in dds style properties Closes #10849 * Clarify --- .../style/conversion/data_driven_property_value.hpp | 21 ++++++++++++++++++--- include/mbgl/style/expression/literal.hpp | 4 ++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/include/mbgl/style/conversion/data_driven_property_value.hpp b/include/mbgl/style/conversion/data_driven_property_value.hpp index 8880d28fb1..5f4395f35a 100644 --- a/include/mbgl/style/conversion/data_driven_property_value.hpp +++ b/include/mbgl/style/conversion/data_driven_property_value.hpp @@ -8,6 +8,8 @@ #include #include #include +#include +#include #include @@ -32,12 +34,25 @@ struct Converter> { return {}; } - if (isFeatureConstant(**expression)) { + bool featureConstant = isFeatureConstant(**expression); + bool zoomConstant = isZoomConstant(**expression); + + if (featureConstant && !zoomConstant) { return DataDrivenPropertyValue(CameraFunction(std::move(*expression))); - } else if (isZoomConstant(**expression)) { + } else if (!featureConstant && zoomConstant) { return DataDrivenPropertyValue(SourceFunction(std::move(*expression))); - } else { + } else if (!featureConstant && !zoomConstant) { return DataDrivenPropertyValue(CompositeFunction(std::move(*expression))); + } else { + // If an expression is neither zoom- nor feature-dependent, it + // should have been reduced to a Literal when it was parsed. + auto literal = dynamic_cast(expression->get()); + assert(literal); + optional constant = fromExpressionValue(literal->getValue()); + if (!constant) { + return {}; + } + return DataDrivenPropertyValue(*constant); } } else if (!isObject(value)) { optional constant = convert(value, error); diff --git a/include/mbgl/style/expression/literal.hpp b/include/mbgl/style/expression/literal.hpp index 82983d78af..a5c5fa109d 100644 --- a/include/mbgl/style/expression/literal.hpp +++ b/include/mbgl/style/expression/literal.hpp @@ -32,6 +32,10 @@ public: std::vector> possibleOutputs() const override { return {{ value }}; } + + Value getValue() const { + return value; + } private: Value value; -- cgit v1.2.1 From 1862760faf84b2d5548d18aec677cbbdcca749e6 Mon Sep 17 00:00:00 2001 From: osana Date: Mon, 19 Feb 2018 22:55:43 -0500 Subject: [android] jni clean up - missing a couple DeleteLocalRef --- platform/android/src/conversion/collection.hpp | 1 + platform/android/src/file_source.cpp | 5 ++++- platform/android/src/map/camera_position.cpp | 4 +++- platform/android/src/map/image.cpp | 4 +++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/platform/android/src/conversion/collection.hpp b/platform/android/src/conversion/collection.hpp index 549121c7ef..2b953e73f4 100644 --- a/platform/android/src/conversion/collection.hpp +++ b/platform/android/src/conversion/collection.hpp @@ -28,6 +28,7 @@ inline jni::jobject* toArrayList(JNIEnv& env, jni::jarray& array) { inline std::vector toVector(JNIEnv& env, jni::jarray& array) { std::vector vector; std::size_t len = jni::GetArrayLength(env, array); + vector.reserve(len); for (std::size_t i = 0; i < len; i++) { jni::jstring* jstr = reinterpret_cast(jni::GetObjectArrayElement(env, array, i)); diff --git a/platform/android/src/file_source.cpp b/platform/android/src/file_source.cpp index 6a9d7badb0..612619a30b 100644 --- a/platform/android/src/file_source.cpp +++ b/platform/android/src/file_source.cpp @@ -124,8 +124,11 @@ jni::Class FileSource::ResourceTransformC std::string FileSource::ResourceTransformCallback::onURL(jni::JNIEnv& env, jni::Object callback, int kind, std::string url_) { static auto method = FileSource::ResourceTransformCallback::javaClass.GetMethod(env, "onURL"); auto url = jni::Make(env, url_); + url = callback.Call(env, method, kind, url); - return jni::Make(env, url); + auto urlStr = jni::Make(env, url); + jni::DeleteLocalRef(env, url); + return urlStr; } } // namespace android diff --git a/platform/android/src/map/camera_position.cpp b/platform/android/src/map/camera_position.cpp index 1fc5f9789f..01ffc6530b 100644 --- a/platform/android/src/map/camera_position.cpp +++ b/platform/android/src/map/camera_position.cpp @@ -33,7 +33,9 @@ mbgl::CameraOptions CameraPosition::getCameraOptions(jni::JNIEnv& env, jni::Obje static auto tilt = CameraPosition::javaClass.GetField(env, "tilt"); static auto zoom = CameraPosition::javaClass.GetField(env, "zoom"); - auto center = LatLng::getLatLng(env, position.Get(env, target)); + auto jtarget = position.Get(env, target); + auto center = LatLng::getLatLng(env, jtarget); + jni::DeleteLocalRef(env, jtarget); return mbgl::CameraOptions { center, diff --git a/platform/android/src/map/image.cpp b/platform/android/src/map/image.cpp index 5f5c90eddd..52e0e0d255 100644 --- a/platform/android/src/map/image.cpp +++ b/platform/android/src/map/image.cpp @@ -16,7 +16,9 @@ mbgl::style::Image Image::getImage(jni::JNIEnv& env, jni::Object image) { auto width = image.Get(env, widthField); auto pixelRatio = image.Get(env, pixelRatioField); auto pixels = image.Get(env, bufferField); - auto name = jni::Make(env, image.Get(env, nameField)); + auto jName = image.Get(env, nameField); + auto name = jni::Make(env, jName); + jni::DeleteLocalRef(env, jName); jni::NullCheck(env, &pixels); std::size_t size = pixels.Length(env); -- cgit v1.2.1 From 278cd580fc963ef8604de4e280501fd85564c274 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Tue, 20 Feb 2018 18:04:49 +0100 Subject: [android] - fix javadoc utf8 encoding issues, add missing package-info.java items --- .../main/java/com/mapbox/mapboxsdk/attribution/package-info.java | 4 ++++ .../src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java | 8 ++++---- .../src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java | 8 ++++---- .../java/com/mapbox/mapboxsdk/maps/renderer/egl/package-info.java | 4 ++++ .../mapboxsdk/maps/renderer/glsurfaceview/package-info.java | 4 ++++ .../java/com/mapbox/mapboxsdk/maps/renderer/package-info.java | 4 ++++ .../mapbox/mapboxsdk/maps/renderer/textureview/package-info.java | 4 ++++ .../mapboxsdk/offline/OfflineTilePyramidRegionDefinition.java | 6 +++--- .../main/java/com/mapbox/mapboxsdk/snapshotter/package-info.java | 4 ++++ .../java/com/mapbox/mapboxsdk/style/expressions/package-info.java | 4 ++++ .../java/com/mapbox/mapboxsdk/style/functions/CameraFunction.java | 2 +- .../main/java/com/mapbox/mapboxsdk/style/functions/Function.java | 4 ++-- .../src/main/java/com/mapbox/mapboxsdk/style/light/Light.java | 4 ++-- .../src/main/java/com/mapbox/mapboxsdk/style/light/Position.java | 8 ++++---- .../src/main/java/com/mapbox/mapboxsdk/text/package-info.java | 4 ++++ platform/android/scripts/generate-style-code.js | 1 + 16 files changed, 53 insertions(+), 20 deletions(-) create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/attribution/package-info.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/egl/package-info.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/glsurfaceview/package-info.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/package-info.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/package-info.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/package-info.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/package-info.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/text/package-info.java diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/attribution/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/attribution/package-info.java new file mode 100644 index 0000000000..57d840af52 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/attribution/package-info.java @@ -0,0 +1,4 @@ +/** + * Contains the Mapbox Maps Android Attribution API classes. + */ +package com.mapbox.mapboxsdk.attribution; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java index 6085e2c2d8..5573e2d243 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java @@ -1651,13 +1651,13 @@ public final class MapboxMap { /** *

- * Sets the distance from the edges of the map view’s frame to the edges of the map - * view’s logical viewport. + * Sets the distance from the edges of the map view's frame to the edges of the map + * view's logical viewport. *

*

* When the value of this property is equal to {0,0,0,0}, viewport - * properties such as `centerCoordinate` assume a viewport that matches the map - * view’s frame. Otherwise, those properties are inset, excluding part of the + * properties such as 'centerCoordinate' assume a viewport that matches the map + * view's frame. Otherwise, those properties are inset, excluding part of the * frame from the viewport. For instance, if the only the top edge is inset, the * map center is effectively shifted downward. *

diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java index 49188a5a98..759a0a0f2d 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java @@ -734,11 +734,11 @@ public class MapboxMapOptions implements Parcelable { } /** - * Set the font family for generating glyphs locally for ideographs in the ‘CJK Unified Ideographs’ - * and ‘Hangul Syllables’ ranges. + * Set the font family for generating glyphs locally for ideographs in the 'CJK Unified Ideographs' + * and 'Hangul Syllables' ranges. * * The font family argument is passed to {@link android.graphics.Typeface#create(String, int)}. - * Default system fonts are defined in '/system/etc/fonts.xml' + * Default system fonts are defined in '/system/etc/fonts.xml' * * @param fontFamily font family for local ideograph generation. * @return This @@ -1100,7 +1100,7 @@ public class MapboxMapOptions implements Parcelable { /** * Returns the font-family for locally overriding generation of glyphs in the - * ‘CJK Unified Ideographs’ and ‘Hangul Syllables’ ranges. + * 'CJK Unified Ideographs' and 'Hangul Syllables' ranges. * * @return Local ideograph font family name. */ diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/egl/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/egl/package-info.java new file mode 100644 index 0000000000..b14b302652 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/egl/package-info.java @@ -0,0 +1,4 @@ +/** + * Contains the Mapbox Maps Android EGL API classes. + */ +package com.mapbox.mapboxsdk.maps.renderer.egl; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/glsurfaceview/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/glsurfaceview/package-info.java new file mode 100644 index 0000000000..aefcffef42 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/glsurfaceview/package-info.java @@ -0,0 +1,4 @@ +/** + * Contains the Mapbox Maps Android GLSurfaceView API classes. + */ +package com.mapbox.mapboxsdk.maps.renderer.glsurfaceview; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/package-info.java new file mode 100644 index 0000000000..f5d8021ea1 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/package-info.java @@ -0,0 +1,4 @@ +/** + * Contains the Mapbox Maps Android Renderer API classes. + */ +package com.mapbox.mapboxsdk.maps.renderer; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/package-info.java new file mode 100644 index 0000000000..d3585d41f9 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/package-info.java @@ -0,0 +1,4 @@ +/** + * Contains the Mapbox Maps Android TextureView API classes. + */ +package com.mapbox.mapboxsdk.maps.renderer.textureview; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineTilePyramidRegionDefinition.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineTilePyramidRegionDefinition.java index 2a32f0bdd6..ea9a066df7 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineTilePyramidRegionDefinition.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineTilePyramidRegionDefinition.java @@ -10,12 +10,12 @@ import com.mapbox.mapboxsdk.geometry.LatLngBounds; * An offline region defined by a style URL, geographic bounding box, zoom range, and * device pixel ratio. *

- * Both minZoom and maxZoom must be ≥ 0, and maxZoom must be ≥ minZoom. + * Both minZoom and maxZoom must be ≥ 0, and maxZoom must be ≥ minZoom. *

- * maxZoom may be ∞, in which case for each tile source, the region will include + * maxZoom may be ∞, in which case for each tile source, the region will include * tiles from minZoom up to the maximum zoom level provided by that source. *

- * pixelRatio must be ≥ 0 and should typically be 1.0 or 2.0. + * pixelRatio must be ≥ 0 and should typically be 1.0 or 2.0. */ public class OfflineTilePyramidRegionDefinition implements OfflineRegionDefinition, Parcelable { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/package-info.java new file mode 100644 index 0000000000..f1ce247ba8 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/package-info.java @@ -0,0 +1,4 @@ +/** + * Contains the Mapbox Maps Android Snapshotter API classes. + */ +package com.mapbox.mapboxsdk.snapshotter; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/package-info.java new file mode 100644 index 0000000000..ee2b96fa61 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/package-info.java @@ -0,0 +1,4 @@ +/** + * Contains the Mapbox Maps Android Expression API classes. + */ +package com.mapbox.mapboxsdk.style.expressions; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/CameraFunction.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/CameraFunction.java index bb87fe8a39..74c68cf574 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/CameraFunction.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/CameraFunction.java @@ -11,7 +11,7 @@ import com.mapbox.mapboxsdk.style.functions.stops.Stops; /** * Camera function. Functions that take camera properties as input (zoom for now) *

- * Zoom functions allow the appearance of a map feature to change with map’s zoom level. + * Zoom functions allow the appearance of a map feature to change with map's zoom level. * Zoom functions can be used to create the illusion of depth and control data density. * Each stop is an array with two elements: the first is a zoom level and the second is * a function output value. diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/Function.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/Function.java index e7bb52ebb3..80ff4198fc 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/Function.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/Function.java @@ -32,7 +32,7 @@ public class Function { /** * Create an exponential {@link CameraFunction} *

- * Zoom functions allow the appearance of a map feature to change with map’s zoom. + * Zoom functions allow the appearance of a map feature to change with map's zoom. * Zoom functions can be used to create the illusion of depth and control data density. * Each stop is an array with two elements, the first is a zoom and the second is a function output value. * @@ -53,7 +53,7 @@ public class Function { /** * Create an interval {@link CameraFunction} *

- * Zoom functions allow the appearance of a map feature to change with map’s zoom. + * Zoom functions allow the appearance of a map feature to change with map’s zoom. * Zoom functions can be used to create the illusion of depth and control data density. * Each stop is an array with two elements, the first is a zoom and the second is a function output value. * diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Light.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Light.java index 8f23e7d01e..7df48001cc 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Light.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Light.java @@ -48,7 +48,7 @@ public class Light { } /** - * Set the Position property. Position of the light source relative to lit (extruded) geometries, in [r radial coordinate, a azimuthal angle, p polar angle] where r indicates the distance from the center of the base of an object to its light, a indicates the position of the light relative to 0° (0° when `light.anchor` is set to `viewport` corresponds to the top of the viewport, or 0° when `light.anchor` is set to `map` corresponds to due north, and degrees proceed clockwise), and p indicates the height of the light (from 0°, directly above, to 180°, directly below). + * Set the Position property. Position of the light source relative to lit (extruded) geometries, in [r radial coordinate, a azimuthal angle, p polar angle] where r indicates the distance from the center of the base of an object to its light, a indicates the position of the light relative to 0° (0° when `light.anchor` is set to `viewport` corresponds to the top of the viewport, or 0° when `light.anchor` is set to `map` corresponds to due north, and degrees proceed clockwise), and p indicates the height of the light (from 0°, directly above, to 180°, directly below). * * @param position of the light */ @@ -57,7 +57,7 @@ public class Light { } /** - * Get the Position property. Position of the light source relative to lit (extruded) geometries, in [r radial coordinate, a azimuthal angle, p polar angle] where r indicates the distance from the center of the base of an object to its light, a indicates the position of the light relative to 0° (0° when `light.anchor` is set to `viewport` corresponds to the top of the viewport, or 0° when `light.anchor` is set to `map` corresponds to due north, and degrees proceed clockwise), and p indicates the height of the light (from 0°, directly above, to 180°, directly below). + * Get the Position property. Position of the light source relative to lit (extruded) geometries, in [r radial coordinate, a azimuthal angle, p polar angle] where r indicates the distance from the center of the base of an object to its light, a indicates the position of the light relative to 0° (0° when `light.anchor` is set to `viewport` corresponds to the top of the viewport, or 0° when `light.anchor` is set to `map` corresponds to due north, and degrees proceed clockwise), and p indicates the height of the light (from 0°, directly above, to 180°, directly below). * * @return position as Position */ diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Position.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Position.java index cd6218d3e2..00f8486a1c 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Position.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Position.java @@ -5,11 +5,11 @@ package com.mapbox.mapboxsdk.style.light; *

* The position is constructed out of a radial coordinate, an azimuthal angle and a polar angle. * where the radial coordinate indicates the distance from the center of the base of an object to its light, the - * azimuthal angle indicates the position of the light relative to 0° (0° when + * azimuthal angle indicates the position of the light relative to 0° (0° when * {@link com.mapbox.mapboxsdk.style.layers.Property.ANCHOR} is set to viewport corresponds to the top of the - * viewport, or 0° when {@link com.mapbox.mapboxsdk.style.layers.Property.ANCHOR} is set to map corresponds to due + * viewport, or 0° when {@link com.mapbox.mapboxsdk.style.layers.Property.ANCHOR} is set to map corresponds to due * north, and degrees proceed clockwise), and polar indicates the height of the light - * (from 0°, directly above, to 180°, directly below). + * (from 0°, directly above, to 180°, directly below). */ public class Position { @@ -21,7 +21,7 @@ public class Position { * Creates a Position from a radial coordinate, an azimuthal angle and a polar angle. * * @param radialCoordinate the distance from the center of the base of an object to its light - * @param azimuthalAngle the position of the light relative to 0° + * @param azimuthalAngle the position of the light relative to 0° * @param polarAngle the height of the light */ public Position(float radialCoordinate, float azimuthalAngle, float polarAngle) { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/text/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/text/package-info.java new file mode 100644 index 0000000000..52c7014bce --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/text/package-info.java @@ -0,0 +1,4 @@ +/** + * Contains the Mapbox Maps Android Text API classes. + */ +package com.mapbox.mapboxsdk.text; diff --git a/platform/android/scripts/generate-style-code.js b/platform/android/scripts/generate-style-code.js index 6e6d3cfa67..8a6648cc79 100755 --- a/platform/android/scripts/generate-style-code.js +++ b/platform/android/scripts/generate-style-code.js @@ -13,6 +13,7 @@ const lightProperties = Object.keys(spec[`light`]).reduce((memo, name) => { var property = spec[`light`][name]; property.name = name; property['light-property'] = true; + property.doc = property.doc.replace(/°/g,'°'); memo.push(property); return memo; }, []); -- cgit v1.2.1 From b79a1cc82e21bb8249d871691d6a4d250cd6a97c Mon Sep 17 00:00:00 2001 From: Chris Loer Date: Wed, 21 Feb 2018 15:48:51 -0800 Subject: [core] Don't reuse heatmap render texture on viewport resize. Fixes issue #11228. --- src/mbgl/renderer/layers/render_heatmap_layer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mbgl/renderer/layers/render_heatmap_layer.cpp b/src/mbgl/renderer/layers/render_heatmap_layer.cpp index 0f9e3239ef..4f2e899220 100644 --- a/src/mbgl/renderer/layers/render_heatmap_layer.cpp +++ b/src/mbgl/renderer/layers/render_heatmap_layer.cpp @@ -67,7 +67,7 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) { } } - if (!renderTexture) { + if (!parameters.context.supportsHalfFloatTextures || !renderTexture) { renderTexture = OffscreenTexture(parameters.context, size, gl::TextureType::UnsignedByte); renderTexture->bind(); } -- cgit v1.2.1 From dfeb5b25d3b78b238253ff2866aaab207fd5daa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Wed, 21 Feb 2018 12:35:44 +0100 Subject: [core] continue loading style even if we mutate it When we load a stale style from cache, and the user immediately starts mutating it, we should continue loading the style so that we'll get a fresh copy of the data into our cache and avoid perpetually showing the stale style. --- src/mbgl/style/style_impl.cpp | 5 ----- test/map/map.test.cpp | 21 ++++++++++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/mbgl/style/style_impl.cpp b/src/mbgl/style/style_impl.cpp index d330b3120a..0c7f924917 100644 --- a/src/mbgl/style/style_impl.cpp +++ b/src/mbgl/style/style_impl.cpp @@ -55,11 +55,6 @@ void Style::Impl::loadURL(const std::string& url_) { url = url_; styleRequest = fileSource.request(Resource::style(url), [this](Response res) { - // Once we get a fresh style, or the style is mutated, stop revalidating. - if (res.isFresh() || mutated) { - styleRequest.reset(); - } - // Don't allow a loaded, mutated style to be overwritten with a new version. if (mutated && loaded) { return; diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp index 9b34ea89b0..30c076ad89 100644 --- a/test/map/map.test.cpp +++ b/test/map/map.test.cpp @@ -252,7 +252,7 @@ TEST(Map, DoubleStyleLoad) { } TEST(Map, StyleFresh) { - // The map should not revalidate fresh styles. + // The map should continue to revalidate fresh styles. MapTest test; @@ -264,11 +264,11 @@ TEST(Map, StyleFresh) { response.expires = Timestamp::max(); test.fileSource.respond(Resource::Style, response); - EXPECT_EQ(0u, test.fileSource.requests.size()); + EXPECT_EQ(1u, test.fileSource.requests.size()); } TEST(Map, StyleExpired) { - // The map should allow expired styles to be revalidated, so long as no mutations are made. + // The map should allow expired styles to be revalidated until we get a fresh style. using namespace std::chrono_literals; @@ -284,11 +284,22 @@ TEST(Map, StyleExpired) { test.fileSource.respond(Resource::Style, response); EXPECT_EQ(1u, test.fileSource.requests.size()); + // Mutate layer. From now on, sending a response to the style won't overwrite it anymore, but + // we should continue to wait for a fresh response. test.map.getStyle().addLayer(std::make_unique("bg")); EXPECT_EQ(1u, test.fileSource.requests.size()); + // Send another expired response, and confirm that we didn't overwrite the style, but continue + // to wait for a fresh response. + test.fileSource.respond(Resource::Style, response); + EXPECT_EQ(1u, test.fileSource.requests.size()); + EXPECT_NE(nullptr, test.map.getStyle().getLayer("bg")); + + // Send a fresh response, and confirm that we didn't overwrite the style, but continue to wait + // for a fresh response. + response.expires = util::now() + 1h; test.fileSource.respond(Resource::Style, response); - EXPECT_EQ(0u, test.fileSource.requests.size()); + EXPECT_EQ(1u, test.fileSource.requests.size()); EXPECT_NE(nullptr, test.map.getStyle().getLayer("bg")); } @@ -352,7 +363,7 @@ TEST(Map, StyleEarlyMutation) { response.data = std::make_shared(util::read_file("test/fixtures/api/water.json")); test.fileSource.respond(Resource::Style, response); - EXPECT_EQ(0u, test.fileSource.requests.size()); + EXPECT_EQ(1u, test.fileSource.requests.size()); EXPECT_NE(nullptr, test.map.getStyle().getLayer("water")); } -- cgit v1.2.1 From 8e1fc8ff384cc7dd19707ba5168603c171d14571 Mon Sep 17 00:00:00 2001 From: Chris Loer Date: Fri, 23 Feb 2018 16:24:29 -0800 Subject: [core, node] Hold on to map handle during NodeMap::request. Avoids a potential crash if garbage collection happens in the middle of a call to NodeMap::request from a map that's eligible for GC. Fixes issue #11281 --- platform/node/src/node_map.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp index ac14df0228..0fe69e8ac9 100644 --- a/platform/node/src/node_map.cpp +++ b/platform/node/src/node_map.cpp @@ -1154,6 +1154,10 @@ NodeMap::~NodeMap() { std::unique_ptr NodeMap::request(const mbgl::Resource& resource, mbgl::FileSource::Callback callback_) { Nan::HandleScope scope; + // Because this method may be called while this NodeMap is already eligible for garbage collection, + // we need to explicitly hold onto our own handle here so that GC during a v8 call doesn't destroy + // *this while we're still executing code. + handle(); v8::Local argv[] = { Nan::New(this), -- cgit v1.2.1 From db0f6377fc58b08e8cf9d965aabe5c52d243778c Mon Sep 17 00:00:00 2001 From: Jordan Kiley Date: Fri, 23 Feb 2018 22:19:51 -0800 Subject: Fixed DDS polygon example (#11286) * [ios] Updated expression * [ios] Removed centering code --- platform/ios/app/MBXViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index 7c8e9fe570..3d0abf0a24 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -1429,7 +1429,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { // source, categorical function that sets any feature with a "fill" attribute value of true to red color and anything without to green MGLFillStyleLayer *fillStyleLayer = [[MGLFillStyleLayer alloc] initWithIdentifier:@"fill-layer" source:shapeSource]; - fillStyleLayer.fillColor = [NSExpression expressionWithFormat:@"TERNARY(fill, %@, %@)", [UIColor greenColor], [UIColor redColor]]; + fillStyleLayer.fillColor = [NSExpression expressionWithFormat:@"TERNARY(fill == YES, %@, %@)", [UIColor greenColor], [UIColor redColor]]; // source, identity function that sets any feature with an "opacity" attribute to use that value and anything without to 1.0 fillStyleLayer.fillOpacity = [NSExpression expressionWithFormat:@"TERNARY(opacity != nil, opacity, 1.0)"]; -- cgit v1.2.1 From 727afc4afc3a5ca26a5eca953293fcba7e2f4cbb Mon Sep 17 00:00:00 2001 From: Tobrun Date: Thu, 15 Feb 2018 10:40:23 +0100 Subject: [android] - remove generics from expression api --- .../mapboxsdk/style/expressions/Expression.java | 837 ++++++++++----------- 1 file changed, 416 insertions(+), 421 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java index 0f76f590c2..f336f7330d 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java @@ -46,10 +46,8 @@ import java.util.List; * Such composite expressions allows a layer's appearance to be determined by * a combination of the zoom level and individual feature properties. *

- * - * @param the type of the expression */ -public class Expression { +public class Expression { private final String operator; private final Expression[] arguments; @@ -68,161 +66,19 @@ public class Expression { * @param operator the expression operator * @param arguments expressions input */ - @SafeVarargs public Expression(@NonNull String operator, @Nullable Expression... arguments) { this.operator = operator; this.arguments = arguments; } - /** - * Converts the expression to Object array representation. - *

- * The output will later be converted to a JSON Object array. - *

- * - * @return the converted object array expression - */ - @NonNull - public Object[] toArray() { - List array = new ArrayList<>(); - array.add(operator); - if (arguments != null) { - for (Expression argument : arguments) { - if (argument instanceof Expression.ExpressionLiteral) { - array.add(toValue((ExpressionLiteral) argument)); - } else { - array.add(argument.toArray()); - } - } - } - return array.toArray(); - } - - /** - * Converts the expression value to an Object. - * - * @param expressionValue the expression value to convert - * @return the converted object expression - */ - private Object toValue(ExpressionLiteral expressionValue) { - Object value = expressionValue.toValue(); - if (value instanceof Expression.Color) { - return ((Expression.Color) value).convertColor(); - } else if (value instanceof Expression.ExpressionLiteral) { - return toValue((ExpressionLiteral) value); - } else if (value instanceof Expression) { - return ((Expression) value).toArray(); - } - return value; - } - - /** - * ExpressionLiteral wraps an object to be used as a literal in an expression. - *

- * ExpressionLiteral is created with {@link #literal(Number)}, {@link #literal(boolean)}, - * {@link #literal(String)} and {@link #literal(Object)}. - *

- * - * @param - */ - private static class ExpressionLiteral extends Expression { - - protected T object; - - /** - * Create an ExpressionValue wrapper. - * - * @param object the object to be wrapped - */ - ExpressionLiteral(@NonNull T object) { - this.object = object; - } - - /** - * Get the wrapped object. - * - * @return the wrapped object - */ - Object toValue() { - return object; - } - } - - // - // Types - // - - /** - * Expression interpolator type. - *

- * Is used for first parameter of {@link #interpolate(Expression, Expression, Stop...)}. - *

- */ - public static class Interpolator { - } - - /** - * Expression color type. - */ - public static class Color { - - private int color; - - /** - * Creates a color color type from a color int. - * - * @param color the int color - */ - public Color(@ColorInt int color) { - this.color = color; - } - - /** - * Converts the int color to rgba(d, d, d, d) string representation - * - * @return - */ - public String convertColor() { - return PropertyFactory.colorToRgbaString(color); - } - } - - /** - * Expression array type. - */ - public static class Array { - } - - /** - * Expression stop type. - *

- * Can be used for {@link #stop(Object, Object)} as part of varargs parameter in - * {@link #step(Number, Expression, Stop...)} or {@link #interpolate(Expression, Expression, Stop...)}. - *

- */ - public static class Stop { - - private Object value; - private Object output; - - public Stop(Object value, Object output) { - this.value = value; - this.output = output; - } - } - - // - // Literals - // - /** * Create a literal number expression. * * @param number the number * @return the expression */ - public static Expression literal(@NonNull Number number) { - return new ExpressionLiteral<>(number); + public static Expression literal(@NonNull Number number) { + return new ExpressionLiteral(number); } /** @@ -231,8 +87,8 @@ public class Expression { * @param string the string * @return the expression */ - public static Expression literal(@NonNull String string) { - return new ExpressionLiteral<>(string); + public static Expression literal(@NonNull String string) { + return new ExpressionLiteral(string); } /** @@ -241,32 +97,32 @@ public class Expression { * @param bool the boolean * @return the expression */ - public static Expression literal(boolean bool) { - return new ExpressionLiteral<>(bool); + public static Expression literal(boolean bool) { + return new ExpressionLiteral(bool); } + // + // Types + // + /** * Create a literal object expression. * * @param object the object * @return the expression */ - public static Expression literal(@NonNull Object object) { - return new ExpressionLiteral<>(object); + public static Expression literal(@NonNull Object object) { + return new ExpressionLiteral(object); } - // - // Color - // - /** * Expression literal utility method to convert a color int to an color expression * * @param color the int color * @return the color expression */ - public static Expression color(@ColorInt int color) { - return new ExpressionLiteral<>(new Color(color)); + public static Expression color(@ColorInt int color) { + return new ExpressionLiteral(new Color(color)); } /** @@ -282,9 +138,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression rgb(@NonNull Expression red, @NonNull Expression green, - @NonNull Expression blue) { - return new Expression<>("rgb", red, green, blue); + public static Expression rgb(@NonNull Expression red, @NonNull Expression green, @NonNull Expression blue) { + return new Expression("rgb", red, green, blue); } /** @@ -300,10 +155,14 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression rgb(@NonNull Number red, @NonNull Number green, @NonNull Number blue) { + public static Expression rgb(@NonNull Number red, @NonNull Number green, @NonNull Number blue) { return rgb(literal(red), literal(green), literal(blue)); } + // + // Literals + // + /** * Creates a color value from red, green, blue components, which must range between 0 and 255, * and an alpha component which must range between 0 and 1. @@ -318,9 +177,9 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression rgba(@NonNull Expression red, @NonNull Expression green, - @NonNull Expression blue, @NonNull Expression alpha) { - return new Expression<>("rgba", red, green, blue, alpha); + public static Expression rgba(@NonNull Expression red, @NonNull Expression green, + @NonNull Expression blue, @NonNull Expression alpha) { + return new Expression("rgba", red, green, blue, alpha); } /** @@ -337,7 +196,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression rgba(@NonNull Number red, @NonNull Number green, @NonNull Number blue, @NonNull Number alpha) { + public static Expression rgba(@NonNull Number red, @NonNull Number green, @NonNull Number blue, @NonNull Number alpha) { return rgba(literal(red), literal(green), literal(blue), literal(alpha)); } @@ -348,14 +207,10 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression toRgba(@NonNull Expression expression) { - return new Expression<>("to-rgba", expression); + public static Expression toRgba(@NonNull Expression expression) { + return new Expression("to-rgba", expression); } - // - // Decision - // - /** * Returns true if the input values are equal, false otherwise. * The inputs must be numbers, strings, or booleans, and both of the same type. @@ -365,10 +220,14 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression eq(@NonNull Expression compareOne, @NonNull Expression compareTwo) { - return new Expression<>("==", compareOne, compareTwo); + public static Expression eq(@NonNull Expression compareOne, @NonNull Expression compareTwo) { + return new Expression("==", compareOne, compareTwo); } + // + // Color + // + /** * Returns true if the input values are equal, false otherwise. * @@ -377,7 +236,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression eq(boolean compareOne, boolean compareTwo) { + public static Expression eq(boolean compareOne, boolean compareTwo) { return eq(literal(compareOne), literal(compareTwo)); } @@ -389,7 +248,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression eq(@NonNull String compareOne, @NonNull String compareTwo) { + public static Expression eq(@NonNull String compareOne, @NonNull String compareTwo) { return eq(literal(compareOne), literal(compareTwo)); } @@ -401,7 +260,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression eq(@NonNull Number compareOne, @NonNull Number compareTwo) { + public static Expression eq(@NonNull Number compareOne, @NonNull Number compareTwo) { return eq(literal(compareOne), literal(compareTwo)); } @@ -414,8 +273,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression neq(@NonNull Expression compareOne, @NonNull Expression compareTwo) { - return new Expression<>("!=", compareOne, compareTwo); + public static Expression neq(@NonNull Expression compareOne, @NonNull Expression compareTwo) { + return new Expression("!=", compareOne, compareTwo); } /** @@ -426,8 +285,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression neq(boolean compareOne, boolean compareTwo) { - return new Expression<>("!=", literal(compareOne), literal(compareTwo)); + public static Expression neq(boolean compareOne, boolean compareTwo) { + return new Expression("!=", literal(compareOne), literal(compareTwo)); } /** @@ -438,10 +297,14 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression neq(@NonNull String compareOne, @NonNull String compareTwo) { - return new Expression<>("!=", literal(compareOne), literal(compareTwo)); + public static Expression neq(@NonNull String compareOne, @NonNull String compareTwo) { + return new Expression("!=", literal(compareOne), literal(compareTwo)); } + // + // Decision + // + /** * Returns `true` if the input values are not equal, `false` otherwise. * @@ -450,8 +313,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression neq(@NonNull Number compareOne, @NonNull Number compareTwo) { - return new Expression<>("!=", literal(compareOne), literal(compareTwo)); + public static Expression neq(@NonNull Number compareOne, @NonNull Number compareTwo) { + return new Expression("!=", literal(compareOne), literal(compareTwo)); } /** @@ -463,8 +326,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression gt(@NonNull Expression compareOne, @NonNull Expression compareTwo) { - return new Expression<>(">", compareOne, compareTwo); + public static Expression gt(@NonNull Expression compareOne, @NonNull Expression compareTwo) { + return new Expression(">", compareOne, compareTwo); } /** @@ -475,8 +338,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression gt(@NonNull Number compareOne, @NonNull Number compareTwo) { - return new Expression<>(">", literal(compareOne), literal(compareTwo)); + public static Expression gt(@NonNull Number compareOne, @NonNull Number compareTwo) { + return new Expression(">", literal(compareOne), literal(compareTwo)); } /** @@ -487,8 +350,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression gt(@NonNull String compareOne, @NonNull String compareTwo) { - return new Expression<>(">", literal(compareOne), literal(compareTwo)); + public static Expression gt(@NonNull String compareOne, @NonNull String compareTwo) { + return new Expression(">", literal(compareOne), literal(compareTwo)); } /** @@ -500,8 +363,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression lt(@NonNull Expression compareOne, @NonNull Expression compareTwo) { - return new Expression<>("<", compareOne, compareTwo); + public static Expression lt(@NonNull Expression compareOne, @NonNull Expression compareTwo) { + return new Expression("<", compareOne, compareTwo); } /** @@ -512,8 +375,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression lt(@NonNull Number compareOne, @NonNull Number compareTwo) { - return new Expression<>("<", literal(compareOne), literal(compareTwo)); + public static Expression lt(@NonNull Number compareOne, @NonNull Number compareTwo) { + return new Expression("<", literal(compareOne), literal(compareTwo)); } /** @@ -524,8 +387,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression lt(@NonNull String compareOne, @NonNull String compareTwo) { - return new Expression<>("<", literal(compareOne), literal(compareTwo)); + public static Expression lt(@NonNull String compareOne, @NonNull String compareTwo) { + return new Expression("<", literal(compareOne), literal(compareTwo)); } /** @@ -537,8 +400,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression gte(@NonNull Expression compareOne, @NonNull Expression compareTwo) { - return new Expression<>(">=", compareOne, compareTwo); + public static Expression gte(@NonNull Expression compareOne, @NonNull Expression compareTwo) { + return new Expression(">=", compareOne, compareTwo); } /** @@ -549,8 +412,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression gte(@NonNull Number compareOne, @NonNull Number compareTwo) { - return new Expression<>(">=", literal(compareOne), literal(compareTwo)); + public static Expression gte(@NonNull Number compareOne, @NonNull Number compareTwo) { + return new Expression(">=", literal(compareOne), literal(compareTwo)); } /** @@ -561,8 +424,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression gte(@NonNull String compareOne, @NonNull String compareTwo) { - return new Expression<>(">=", literal(compareOne), literal(compareTwo)); + public static Expression gte(@NonNull String compareOne, @NonNull String compareTwo) { + return new Expression(">=", literal(compareOne), literal(compareTwo)); } /** @@ -574,8 +437,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression lte(@NonNull Expression compareOne, @NonNull Expression compareTwo) { - return new Expression<>("<=", compareOne, compareTwo); + public static Expression lte(@NonNull Expression compareOne, @NonNull Expression compareTwo) { + return new Expression("<=", compareOne, compareTwo); } /** @@ -586,8 +449,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression lte(@NonNull Number compareOne, @NonNull Number compareTwo) { - return new Expression<>("<=", literal(compareOne), literal(compareTwo)); + public static Expression lte(@NonNull Number compareOne, @NonNull Number compareTwo) { + return new Expression("<=", literal(compareOne), literal(compareTwo)); } /** @@ -598,8 +461,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression lte(@NonNull String compareOne, @NonNull String compareTwo) { - return new Expression<>("<=", literal(compareOne), literal(compareTwo)); + public static Expression lte(@NonNull String compareOne, @NonNull String compareTwo) { + return new Expression("<=", literal(compareOne), literal(compareTwo)); } /** @@ -614,9 +477,9 @@ public class Expression { * @return expression * @see Style specification */ - @SafeVarargs - public static Expression all(@NonNull Expression... input) { - return new Expression<>("all", input); + + public static Expression all(@NonNull Expression... input) { + return new Expression("all", input); } /** @@ -631,9 +494,9 @@ public class Expression { * @return expression * @see Style specification */ - @SafeVarargs - public static Expression any(@NonNull Expression... input) { - return new Expression<>("any", input); + + public static Expression any(@NonNull Expression... input) { + return new Expression("any", input); } /** @@ -643,8 +506,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression not(@NonNull Expression input) { - return new Expression<>("!", input); + public static Expression not(@NonNull Expression input) { + return new Expression("!", input); } /** @@ -654,7 +517,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression not(boolean input) { + public static Expression not(boolean input) { return not(literal(input)); } @@ -669,7 +532,7 @@ public class Expression { * @return expression * @see Style specification */ - @SafeVarargs + public static Expression switchCase(@NonNull @Size(min = 1) Expression... input) { return new Expression("case", input); } @@ -716,10 +579,6 @@ public class Expression { return new Expression("coalesce", input); } - // - // FeatureData - // - /** * Gets the feature properties object. *

@@ -729,8 +588,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression properties() { - return new Expression<>("properties"); + public static Expression properties() { + return new Expression("properties"); } /** @@ -739,8 +598,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression geometryType() { - return new Expression<>("geometry-type"); + public static Expression geometryType() { + return new Expression("geometry-type"); } /** @@ -749,14 +608,10 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression id() { - return new Expression<>("id"); + public static Expression id() { + return new Expression("id"); } - // - // Heatmap - // - /** * Gets the kernel density estimation of a pixel in a heatmap layer, * which is a relative measure of how many data points are crowded around a particular pixel. @@ -765,14 +620,10 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression heatmapDensity() { - return new Expression<>("heatmap-density"); + public static Expression heatmapDensity() { + return new Expression("heatmap-density"); } - // - // Lookup - // - /** * Retrieves an item from an array. * @@ -781,8 +632,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression at(@NonNull Expression number, @NonNull Expression expression) { - return new Expression<>("at", number, expression); + public static Expression at(@NonNull Expression number, @NonNull Expression expression) { + return new Expression("at", number, expression); } /** @@ -793,7 +644,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression at(@NonNull Number number, @NonNull Expression expression) { + public static Expression at(@NonNull Number number, @NonNull Expression expression) { return at(literal(number), expression); } @@ -806,10 +657,14 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression get(@NonNull Expression input) { - return new Expression<>("get", input); + public static Expression get(@NonNull Expression input) { + return new Expression("get", input); } + // + // FeatureData + // + /** * Retrieves a property value from the current feature's properties, * or from another object if a second argument is provided. @@ -832,8 +687,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression get(@NonNull Expression key, @NonNull Expression object) { - return new Expression<>("get", key, object); + public static Expression get(@NonNull Expression key, @NonNull Expression object) { + return new Expression("get", key, object); } /** @@ -845,10 +700,14 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression get(@NonNull String key, @NonNull Expression object) { + public static Expression get(@NonNull String key, @NonNull Expression object) { return get(literal(key), object); } + // + // Heatmap + // + /** * Tests for the presence of an property value in the current feature's properties. * @@ -856,10 +715,14 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression has(@NonNull Expression key) { - return new Expression<>("has", key); + public static Expression has(@NonNull Expression key) { + return new Expression("has", key); } + // + // Lookup + // + /** * Tests for the presence of an property value in the current feature's properties. * @@ -867,7 +730,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression has(@NonNull String key) { + public static Expression has(@NonNull String key) { return has(literal(key)); } @@ -879,8 +742,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression has(@NonNull Expression key, @NonNull Expression object) { - return new Expression<>("has", key, object); + public static Expression has(@NonNull Expression key, @NonNull Expression object) { + return new Expression("has", key, object); } /** @@ -891,7 +754,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression has(@NonNull String key, @NonNull Expression object) { + public static Expression has(@NonNull String key, @NonNull Expression object) { return has(literal(key), object); } @@ -902,8 +765,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression length(@NonNull Expression expression) { - return new Expression<>("length", expression); + public static Expression length(@NonNull Expression expression) { + return new Expression("length", expression); } /** @@ -913,22 +776,18 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression length(@NonNull String input) { + public static Expression length(@NonNull String input) { return length(literal(input)); } - // - // Math - // - /** * Returns mathematical constant ln(2). * * @return expression * @see Style specification */ - public static Expression ln2() { - return new Expression<>("ln2"); + public static Expression ln2() { + return new Expression("ln2"); } /** @@ -937,8 +796,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression pi() { - return new Expression<>("pi"); + public static Expression pi() { + return new Expression("pi"); } /** @@ -947,8 +806,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression e() { - return new Expression<>("e"); + public static Expression e() { + return new Expression("e"); } /** @@ -958,9 +817,9 @@ public class Expression { * @return expression * @see Style specification */ - @SafeVarargs - public static Expression sum(@Size(min = 2) Expression... numbers) { - return new Expression<>("+", numbers); + + public static Expression sum(@Size(min = 2) Expression... numbers) { + return new Expression("+", numbers); } /** @@ -970,9 +829,9 @@ public class Expression { * @return expression * @see Style specification */ - @SuppressWarnings("unchecked") - public static Expression sum(@Size(min = 2) Number... numbers) { - Expression[] numberExpression = (Expression[]) new Expression[numbers.length]; + + public static Expression sum(@Size(min = 2) Number... numbers) { + Expression[] numberExpression = new Expression[numbers.length]; for (int i = 0; i < numbers.length; i++) { numberExpression[i] = literal(numbers[i]); } @@ -986,9 +845,9 @@ public class Expression { * @return expression * @see Style specification */ - @SafeVarargs - public static Expression product(@Size(min = 2) Expression... numbers) { - return new Expression<>("*", numbers); + + public static Expression product(@Size(min = 2) Expression... numbers) { + return new Expression("*", numbers); } /** @@ -998,15 +857,19 @@ public class Expression { * @return expression * @see Style specification */ - @SuppressWarnings("unchecked") - public static Expression product(@Size(min = 2) Number... numbers) { - Expression[] numberExpression = (Expression[]) new Expression[numbers.length]; + + public static Expression product(@Size(min = 2) Number... numbers) { + Expression[] numberExpression = new Expression[numbers.length]; for (int i = 0; i < numbers.length; i++) { numberExpression[i] = literal(numbers[i]); } return product(numberExpression); } + // + // Math + // + /** * Returns the result of subtracting a number from 0. * @@ -1014,8 +877,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression subtract(@NonNull Expression number) { - return new Expression<>("-", number); + public static Expression subtract(@NonNull Expression number) { + return new Expression("-", number); } /** @@ -1025,7 +888,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression subtract(@NonNull Number number) { + public static Expression subtract(@NonNull Number number) { return subtract(literal(number)); } @@ -1037,8 +900,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression subtract(@NonNull Expression first, @NonNull Expression second) { - return new Expression<>("-", first, second); + public static Expression subtract(@NonNull Expression first, @NonNull Expression second) { + return new Expression("-", first, second); } /** @@ -1049,7 +912,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression subtract(@NonNull Number first, @NonNull Number second) { + public static Expression subtract(@NonNull Number first, @NonNull Number second) { return subtract(literal(first), literal(second)); } @@ -1061,9 +924,8 @@ public class Expression { * @return expression * @see Style specification */ - @SuppressWarnings("unchecked") - public static Expression division(@NonNull Expression first, @NonNull Expression second) { - return new Expression<>("/", first, second); + public static Expression division(@NonNull Expression first, @NonNull Expression second) { + return new Expression("/", first, second); } /** @@ -1074,8 +936,7 @@ public class Expression { * @return expression * @see Style specification */ - @SuppressWarnings("unchecked") - public static Expression division(@NonNull Number first, @NonNull Number second) { + public static Expression division(@NonNull Number first, @NonNull Number second) { return division(literal(first), literal(second)); } @@ -1087,8 +948,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression mod(@NonNull Expression first, @NonNull Expression second) { - return new Expression<>("%", first, second); + public static Expression mod(@NonNull Expression first, @NonNull Expression second) { + return new Expression("%", first, second); } /** @@ -1099,7 +960,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression mod(@NonNull Number first, @NonNull Number second) { + public static Expression mod(@NonNull Number first, @NonNull Number second) { return mod(literal(first), literal(second)); } @@ -1111,8 +972,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression pow(@NonNull Expression first, @NonNull Expression second) { - return new Expression<>("^", first, second); + public static Expression pow(@NonNull Expression first, @NonNull Expression second) { + return new Expression("^", first, second); } /** @@ -1123,7 +984,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression pow(@NonNull Number first, @NonNull Number second) { + public static Expression pow(@NonNull Number first, @NonNull Number second) { return pow(literal(first), literal(second)); } @@ -1134,8 +995,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression sqrt(@NonNull Expression number) { - return new Expression<>("sqrt", number); + public static Expression sqrt(@NonNull Expression number) { + return new Expression("sqrt", number); } /** @@ -1145,7 +1006,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression sqrt(@NonNull Number number) { + public static Expression sqrt(@NonNull Number number) { return sqrt(literal(number)); } @@ -1156,8 +1017,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression log10(@NonNull Expression number) { - return new Expression<>("log10", number); + public static Expression log10(@NonNull Expression number) { + return new Expression("log10", number); } /** @@ -1167,7 +1028,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression log10(@NonNull Number number) { + public static Expression log10(@NonNull Number number) { return log10(literal(number)); } @@ -1178,8 +1039,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression ln(Expression number) { - return new Expression<>("ln", number); + public static Expression ln(Expression number) { + return new Expression("ln", number); } /** @@ -1189,7 +1050,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression ln(Number number) { + public static Expression ln(Number number) { return ln(literal(number)); } @@ -1200,8 +1061,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression log2(@NonNull Expression number) { - return new Expression<>("log2", number); + public static Expression log2(@NonNull Expression number) { + return new Expression("log2", number); } /** @@ -1211,7 +1072,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression log2(@NonNull Number number) { + public static Expression log2(@NonNull Number number) { return log2(literal(number)); } @@ -1222,8 +1083,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression sin(@NonNull Expression number) { - return new Expression<>("sin", number); + public static Expression sin(@NonNull Expression number) { + return new Expression("sin", number); } /** @@ -1233,7 +1094,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression sin(@NonNull Number number) { + public static Expression sin(@NonNull Number number) { return sin(literal(number)); } @@ -1244,8 +1105,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression cos(@NonNull Expression number) { - return new Expression<>("cos", number); + public static Expression cos(@NonNull Expression number) { + return new Expression("cos", number); } /** @@ -1255,8 +1116,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression cos(@NonNull Number number) { - return new Expression<>("cos", literal(number)); + public static Expression cos(@NonNull Number number) { + return new Expression("cos", literal(number)); } /** @@ -1266,8 +1127,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression tan(@NonNull Expression number) { - return new Expression<>("tan", number); + public static Expression tan(@NonNull Expression number) { + return new Expression("tan", number); } /** @@ -1277,8 +1138,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression tan(@NonNull Number number) { - return new Expression<>("tan", literal(number)); + public static Expression tan(@NonNull Number number) { + return new Expression("tan", literal(number)); } /** @@ -1288,8 +1149,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression asin(@NonNull Expression number) { - return new Expression<>("asin", number); + public static Expression asin(@NonNull Expression number) { + return new Expression("asin", number); } /** @@ -1299,7 +1160,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression asin(@NonNull Number number) { + public static Expression asin(@NonNull Number number) { return asin(literal(number)); } @@ -1310,8 +1171,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression acos(@NonNull Expression number) { - return new Expression<>("acos", number); + public static Expression acos(@NonNull Expression number) { + return new Expression("acos", number); } /** @@ -1321,7 +1182,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression acos(@NonNull Number number) { + public static Expression acos(@NonNull Number number) { return acos(literal(number)); } @@ -1332,7 +1193,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression atan(@NonNull Expression number) { + public static Expression atan(@NonNull Expression number) { return new Expression("atan", number); } @@ -1343,7 +1204,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression atan(@NonNull Number number) { + public static Expression atan(@NonNull Number number) { return atan(literal(number)); } @@ -1354,9 +1215,9 @@ public class Expression { * @return expression * @see Style specification */ - @SafeVarargs - public static Expression min(@Size(min = 1) Expression... numbers) { - return new Expression<>("min", numbers); + + public static Expression min(@Size(min = 1) Expression... numbers) { + return new Expression("min", numbers); } /** @@ -1366,9 +1227,9 @@ public class Expression { * @return expression * @see Style specification */ - @SuppressWarnings("unchecked") - public static Expression min(@Size(min = 1) Number... numbers) { - Expression[] numberExpression = (Expression[]) new Expression[numbers.length]; + + public static Expression min(@Size(min = 1) Number... numbers) { + Expression[] numberExpression = new Expression[numbers.length]; for (int i = 0; i < numbers.length; i++) { numberExpression[i] = literal(numbers[i]); } @@ -1382,9 +1243,9 @@ public class Expression { * @return expression * @see Style specification */ - @SafeVarargs - public static Expression max(@Size(min = 1) Expression... numbers) { - return new Expression<>("max", numbers); + + public static Expression max(@Size(min = 1) Expression... numbers) { + return new Expression("max", numbers); } /** @@ -1394,19 +1255,15 @@ public class Expression { * @return expression * @see Style specification */ - @SuppressWarnings("unchecked") - public static Expression max(@Size(min = 1) Number... numbers) { - Expression[] numberExpression = (Expression[]) new Expression[numbers.length]; + + public static Expression max(@Size(min = 1) Number... numbers) { + Expression[] numberExpression = new Expression[numbers.length]; for (int i = 0; i < numbers.length; i++) { numberExpression[i] = literal(numbers[i]); } return max(numberExpression); } - // - // String - // - /** * Returns the input string converted to uppercase. *

@@ -1418,8 +1275,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression upcase(@NonNull Expression string) { - return new Expression<>("upcase", string); + public static Expression upcase(@NonNull Expression string) { + return new Expression("upcase", string); } /** @@ -1433,7 +1290,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression upcase(@NonNull String string) { + public static Expression upcase(@NonNull String string) { return upcase(literal(string)); } @@ -1448,8 +1305,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression downcase(@NonNull Expression input) { - return new Expression<>("downcase", input); + public static Expression downcase(@NonNull Expression input) { + return new Expression("downcase", input); } /** @@ -1463,7 +1320,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression downcase(@NonNull String input) { + public static Expression downcase(@NonNull String input) { return downcase(literal(input)); } @@ -1474,9 +1331,9 @@ public class Expression { * @return expression * @see Style specification */ - @SafeVarargs - public static Expression concat(@NonNull Expression... input) { - return new Expression<>("concat", input); + + public static Expression concat(@NonNull Expression... input) { + return new Expression("concat", input); } /** @@ -1486,19 +1343,15 @@ public class Expression { * @return expression * @see Style specification */ - @SuppressWarnings("unchecked") - public static Expression concat(@NonNull String... input) { - Expression[] stringExpression = (Expression[]) new Expression[input.length]; + + public static Expression concat(@NonNull String... input) { + Expression[] stringExpression = new Expression[input.length]; for (int i = 0; i < input.length; i++) { stringExpression[i] = literal(input[i]); } return concat(stringExpression); } - // - // Types - // - /** * Asserts that the input is an array (optionally with a specific item type and length). * If, when the input expression is evaluated, it is not of the asserted type, @@ -1508,10 +1361,14 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression array(@NonNull Expression input) { - return new Expression<>("array", input); + public static Expression array(@NonNull Expression input) { + return new Expression("array", input); } + // + // String + // + /** * Returns a string describing the type of the given value. * @@ -1519,8 +1376,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression typeOf(@NonNull Expression input) { - return new Expression<>("typeof", input); + public static Expression typeOf(@NonNull Expression input) { + return new Expression("typeof", input); } /** @@ -1532,8 +1389,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression string(@NonNull Expression input) { - return new Expression<>("string", input); + public static Expression string(@NonNull Expression input) { + return new Expression("string", input); } /** @@ -1545,8 +1402,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression number(@NonNull Expression input) { - return new Expression<>("number", input); + public static Expression number(@NonNull Expression input) { + return new Expression("number", input); } /** @@ -1558,8 +1415,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression bool(@NonNull Expression input) { - return new Expression<>("boolean", input); + public static Expression bool(@NonNull Expression input) { + return new Expression("boolean", input); } /** @@ -1569,8 +1426,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression object(@NonNull Expression input) { - return new Expression<>("object", input); + public static Expression object(@NonNull Expression input) { + return new Expression("object", input); } /** @@ -1587,10 +1444,14 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression toString(@NonNull Expression input) { - return new Expression<>("to-string", input); + public static Expression toString(@NonNull Expression input) { + return new Expression("to-string", input); } + // + // Types + // + /** * Converts the input value to a number, if possible. * If the input is null or false, the result is 0. @@ -1603,8 +1464,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression toNumber(@NonNull Expression input) { - return new Expression<>("to-number", input); + public static Expression toNumber(@NonNull Expression input) { + return new Expression("to-number", input); } /** @@ -1615,8 +1476,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression toBool(@NonNull Expression input) { - return new Expression<>("to-boolean", input); + public static Expression toBool(@NonNull Expression input) { + return new Expression("to-boolean", input); } /** @@ -1628,14 +1489,10 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression toColor(@NonNull Expression input) { - return new Expression<>("to-color", input); + public static Expression toColor(@NonNull Expression input) { + return new Expression("to-color", input); } - // - // Variable binding - // - /** * Binds input to named variables, * which can then be referenced in the result expression using {@link #var(String)} or {@link #var(Expression)}. @@ -1644,9 +1501,9 @@ public class Expression { * @return expression * @see Style specification */ - @SafeVarargs + public static Expression let(@Size(min = 1) Expression... input) { - return new Expression<>("let", input); + return new Expression("let", input); } /** @@ -1656,8 +1513,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression var(@NonNull Expression expression) { - return new Expression<>("var", expression); + public static Expression var(@NonNull Expression expression) { + return new Expression("var", expression); } /** @@ -1671,10 +1528,6 @@ public class Expression { return var(literal(variableName)); } - // - // Zoom - // - /** * Gets the current zoom level. *

@@ -1685,18 +1538,14 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression zoom() { - return new Expression<>("zoom"); + public static Expression zoom() { + return new Expression("zoom"); } - // - // Ramps, scales, curves - // - /** * Produces a stop value to be used as part of the step expression. * - * @param stop the stop input + * @param stop the stop input * @param value the stop output * @return the stop */ @@ -1716,7 +1565,7 @@ public class Expression { * @return expression * @see Style specification */ - @SafeVarargs + public static Expression step(@NonNull Number input, @NonNull Expression expression, Expression... stops) { return step(literal(input), expression, stops); } @@ -1733,11 +1582,15 @@ public class Expression { * @return expression * @see Style specification */ - @SafeVarargs - public static Expression step(@NonNull Expression input, @NonNull Expression expression, Expression... stops) { + + public static Expression step(@NonNull Expression input, @NonNull Expression expression, Expression... stops) { return new Expression("step", join(new Expression[] {input, expression}, stops)); } + // + // Variable binding + // + /** * Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs of * input and output values (\"stops\"). The `input` may be any numeric expression (e.g., `[\"get\", \"population\"]`). @@ -1750,7 +1603,7 @@ public class Expression { * @return expression * @see Style specification */ - @SafeVarargs + public static Expression step(@NonNull Number input, @NonNull Expression expression, Stop... stops) { Expression[] expressions = new Expression[stops.length * 2]; for (int i = 0; i < stops.length; i++) { @@ -1772,8 +1625,8 @@ public class Expression { * @return expression * @see Style specification */ - @SafeVarargs - public static Expression step(@NonNull Expression input, @NonNull Expression expression, Stop... stops) { + + public static Expression step(@NonNull Expression input, @NonNull Expression expression, Stop... stops) { Expression[] expressions = new Expression[stops.length * 2]; for (int i = 0; i < stops.length; i++) { expressions[i * 2] = literal(stops[i].value); @@ -1794,12 +1647,16 @@ public class Expression { * @return expression * @see Style specification */ - @SafeVarargs - public static Expression interpolate(@NonNull Expression interpolation, - @NonNull Expression number, Expression... stops) { + + public static Expression interpolate(@NonNull Interpolator interpolation, + @NonNull Expression number, Expression... stops) { return new Expression("interpolate", join(new Expression[] {interpolation, number}, stops)); } + // + // Zoom + // + /** * Produces continuous, smooth results by interpolating between pairs of input and output values (\"stops\"). * The `input` may be any numeric expression (e.g., `[\"get\", \"population\"]`). @@ -1812,9 +1669,9 @@ public class Expression { * @return expression * @see Style specification */ - @SafeVarargs - public static Expression interpolate(@NonNull Expression interpolation, - @NonNull Expression number, Stop... stops) { + + public static Expression interpolate(@NonNull Interpolator interpolation, + @NonNull Expression number, Stop... stops) { Expression[] expressions = new Expression[stops.length * 2]; for (int i = 0; i < stops.length; i++) { expressions[i * 2] = literal(stops[i].value); @@ -1823,14 +1680,18 @@ public class Expression { return interpolate(interpolation, number, expressions); } + // + // Ramps, scales, curves + // + /** * interpolates linearly between the pair of stops just less than and just greater than the input. * * @return expression * @see Style specification */ - public static Expression linear() { - return new Expression<>("linear"); + public static Interpolator linear() { + return new Interpolator("linear"); } /** @@ -1843,7 +1704,7 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression exponential(@NonNull Number base) { + public static Interpolator exponential(@NonNull Number base) { return exponential(literal(base)); } @@ -1857,8 +1718,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression exponential(@NonNull Expression expression) { - return new Expression<>("exponential", expression); + public static Interpolator exponential(@NonNull Expression expression) { + return new Interpolator("exponential", expression); } /** @@ -1871,9 +1732,9 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression cubicBezier(@NonNull Expression x1, @NonNull Expression y1, - @NonNull Expression x2, @NonNull Expression y2) { - return new Expression<>("cubic-bezier", x1, y1, x2, y2); + public static Interpolator cubicBezier(@NonNull Expression x1, @NonNull Expression y1, + @NonNull Expression x2, @NonNull Expression y2) { + return new Interpolator("cubic-bezier", x1, y1, x2, y2); } /** @@ -1886,8 +1747,8 @@ public class Expression { * @return expression * @see Style specification */ - public static Expression cubicBezier(@NonNull Number x1, @NonNull Number y1, - @NonNull Number x2, @NonNull Number y2) { + public static Interpolator cubicBezier(@NonNull Number x1, @NonNull Number y1, + @NonNull Number x2, @NonNull Number y2) { return cubicBezier(literal(x1), literal(y1), literal(x2), literal(y2)); } @@ -1908,6 +1769,47 @@ public class Expression { return output; } + /** + * Converts the expression to Object array representation. + *

+ * The output will later be converted to a JSON Object array. + *

+ * + * @return the converted object array expression + */ + @NonNull + public Object[] toArray() { + List array = new ArrayList<>(); + array.add(operator); + if (arguments != null) { + for (Expression argument : arguments) { + if (argument instanceof Expression.ExpressionLiteral) { + array.add(toValue((ExpressionLiteral) argument)); + } else { + array.add(argument.toArray()); + } + } + } + return array.toArray(); + } + + /** + * Converts the expression value to an Object. + * + * @param expressionValue the expression value to convert + * @return the converted object expression + */ + private Object toValue(ExpressionLiteral expressionValue) { + Object value = expressionValue.toValue(); + if (value instanceof Expression.Color) { + return ((Expression.Color) value).convertColor(); + } else if (value instanceof Expression.ExpressionLiteral) { + return toValue((ExpressionLiteral) value); + } else if (value instanceof Expression) { + return ((Expression) value).toArray(); + } + return value; + } /** * Returns a string representation of the object that matches the definition set in the style specification. @@ -1919,7 +1821,7 @@ public class Expression { StringBuilder builder = new StringBuilder(); builder.append("[\"").append(operator).append("\""); if (arguments != null) { - for (Expression argument : arguments) { + for (Object argument : arguments) { builder.append(", "); if (argument instanceof ExpressionLiteral) { builder.append(((ExpressionLiteral) argument).toValue()); @@ -1931,4 +1833,97 @@ public class Expression { builder.append("]"); return builder.toString(); } + + /** + * ExpressionLiteral wraps an object to be used as a literal in an expression. + *

+ * ExpressionLiteral is created with {@link #literal(Number)}, {@link #literal(boolean)}, + * {@link #literal(String)} and {@link #literal(Object)}. + *

+ */ + private static class ExpressionLiteral extends Expression { + + protected Object literal; + + /** + * Create an ExpressionValue wrapper. + * + * @param object the object to be wrapped + */ + ExpressionLiteral(@NonNull Object object) { + this.literal = object; + } + + /** + * Get the wrapped object. + * + * @return the wrapped object + */ + Object toValue() { + return literal; + } + } + + /** + * Expression interpolator type. + *

+ * Is used for first parameter of {@link #interpolate(Interpolator, Expression, Stop...)}. + *

+ */ + public static class Interpolator extends Expression { + + Interpolator(@NonNull String operator, @Nullable Expression... arguments) { + super(operator, arguments); + } + } + + /** + * Expression color type. + */ + public static class Color { + + private int color; + + /** + * Creates a color color type from a color int. + * + * @param color the int color + */ + public Color(@ColorInt int color) { + this.color = color; + } + + /** + * Converts the int color to rgba(d, d, d, d) string representation + * + * @return + */ + public String convertColor() { + return PropertyFactory.colorToRgbaString(color); + } + } + + /** + * Expression array type. + */ + public static class Array { + } + + /** + * Expression stop type. + *

+ * Can be used for {@link #stop(Object, Object)} as part of varargs parameter in + * {@link #step(Number, Expression, Stop...)} or {@link #interpolate(Interpolator, Expression, Stop...)}. + *

+ */ + public static class Stop { + + private Object value; + private Object output; + + public Stop(Object value, Object output) { + this.value = value; + this.output = output; + } + } } \ No newline at end of file -- cgit v1.2.1 From 317794746e51ad801c9b53f987fc602acc533cc3 Mon Sep 17 00:00:00 2001 From: Chris Loer Date: Mon, 26 Feb 2018 13:22:15 -0800 Subject: [core,node] Pin 'nan' to ~2.8 to avoid Callback::Call deprecation. Alternative fix to #11288, until we figure out a proper async_hooks implementation. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4ff4b32735..977cd2b09c 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ }, "license": "BSD-2-Clause", "dependencies": { - "nan": "^2.6.2", + "nan": "~2.8", "node-pre-gyp": "^0.6.37", "npm-run-all": "^4.0.2" }, -- cgit v1.2.1 From 977e9f118c8f3a8d0b230b5c973530fb07018c48 Mon Sep 17 00:00:00 2001 From: Osana Babayan <32496536+osana@users.noreply.github.com> Date: Tue, 27 Feb 2018 18:18:05 +0100 Subject: [android] LatLngBounds can go over the antimeridian / date line. --- .../mapboxsdk/constants/GeometryConstants.java | 14 +++ .../mapbox/mapboxsdk/geometry/LatLngBounds.java | 112 ++++++++++++++---- .../mapboxsdk/geometry/LatLngBoundsTest.java | 131 +++++++++++++++++++++ 3 files changed, 236 insertions(+), 21 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/GeometryConstants.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/GeometryConstants.java index 1a7544d33a..7a17e500ca 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/GeometryConstants.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/GeometryConstants.java @@ -36,6 +36,20 @@ public class GeometryConstants { */ public static final double MIN_LATITUDE = -90; + /** + * This constant represents the latitude span when representing a geolocation. + * + * @since 6.0.0 + */ + public static final double LATITUDE_SPAN = 180; + + /** + * This constant represents the longitude span when representing a geolocation. + * + * @since 6.0.0 + */ + public static final double LONGITUDE_SPAN = 360; + /** * This constant represents the highest latitude value available to represent a geolocation. * diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java index cf647224ae..fc8d2ec8f0 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java @@ -29,6 +29,10 @@ public class LatLngBounds implements Parcelable { * Construct a new LatLngBounds based on its corners, given in NESW * order. * + * If eastern longitude is smaller than the western one, bounds will include antimeridian. + * For example, if the NE point is (10, -170) and the SW point is (-10, 170), then bounds will span over 20 degrees + * and cross the antimeridian. + * * @param northLatitude Northern Latitude * @param eastLongitude Eastern Longitude * @param southLatitude Southern Latitude @@ -48,10 +52,9 @@ public class LatLngBounds implements Parcelable { * @return the bounds representing the world */ public static LatLngBounds world() { - return new LatLngBounds.Builder() - .include(new LatLng(GeometryConstants.MAX_LATITUDE, GeometryConstants.MAX_LONGITUDE)) - .include(new LatLng(GeometryConstants.MIN_LATITUDE, GeometryConstants.MIN_LONGITUDE)) - .build(); + return LatLngBounds.from( + GeometryConstants.MAX_LATITUDE, GeometryConstants.MAX_LONGITUDE, + GeometryConstants.MIN_LATITUDE, GeometryConstants.MIN_LONGITUDE); } /** @@ -61,8 +64,21 @@ public class LatLngBounds implements Parcelable { * @return LatLng center of this LatLngBounds */ public LatLng getCenter() { - return new LatLng((this.latitudeNorth + this.latitudeSouth) / 2, - (this.longitudeEast + this.longitudeWest) / 2); + double latCenter = (this.latitudeNorth + this.latitudeSouth) / 2.0; + double longCenter; + + if (this.longitudeEast > this.longitudeWest) { + longCenter = (this.longitudeEast + this.longitudeWest) / 2; + } else { + double halfSpan = (GeometryConstants.LONGITUDE_SPAN + this.longitudeEast - this.longitudeWest) / 2.0; + longCenter = this.longitudeWest + halfSpan; + if (longCenter >= GeometryConstants.MAX_LONGITUDE) { + longCenter = this.longitudeEast - halfSpan; + } + return new LatLng(latCenter, longCenter); + } + + return new LatLng(latCenter, longCenter); } /** @@ -163,10 +179,26 @@ public class LatLngBounds implements Parcelable { * @return Span distance */ public double getLongitudeSpan() { - return Math.abs(this.longitudeEast - this.longitudeWest); + double longSpan = Math.abs(this.longitudeEast - this.longitudeWest); + if (this.longitudeEast > this.longitudeWest) { + return longSpan; + } + + // shortest span contains antimeridian + return GeometryConstants.LONGITUDE_SPAN - longSpan; } + static double getLongitudeSpan(final double longEast, final double longWest) { + double longSpan = Math.abs(longEast - longWest); + if (longEast > longWest) { + return longSpan; + } + + // shortest span contains antimeridian + return GeometryConstants.LONGITUDE_SPAN - longSpan; + } + /** * Validate if LatLngBounds is empty, determined if absolute distance is * @@ -196,21 +228,44 @@ public class LatLngBounds implements Parcelable { */ static LatLngBounds fromLatLngs(final List latLngs) { double minLat = GeometryConstants.MAX_LATITUDE; - double minLon = GeometryConstants.MAX_LONGITUDE; double maxLat = GeometryConstants.MIN_LATITUDE; - double maxLon = GeometryConstants.MIN_LONGITUDE; + + double eastLon = latLngs.get(0).getLongitude(); + double westLon = latLngs.get(1).getLongitude(); + double lonSpan = Math.abs(eastLon - westLon); + if (lonSpan < GeometryConstants.LONGITUDE_SPAN / 2) { + if (eastLon < westLon) { + double temp = eastLon; + eastLon = westLon; + westLon = temp; + } + } else { + lonSpan = GeometryConstants.LONGITUDE_SPAN - lonSpan; + if (westLon < eastLon) { + double temp = eastLon; + eastLon = westLon; + westLon = temp; + } + } for (final ILatLng gp : latLngs) { final double latitude = gp.getLatitude(); - final double longitude = gp.getLongitude(); - minLat = Math.min(minLat, latitude); - minLon = Math.min(minLon, longitude); maxLat = Math.max(maxLat, latitude); - maxLon = Math.max(maxLon, longitude); + + final double longitude = gp.getLongitude(); + if (!containsLongitude(eastLon, westLon, longitude)) { + final double eastSpan = getLongitudeSpan(longitude, westLon); + final double westSpan = getLongitudeSpan(eastLon, longitude); + if (eastSpan <= westSpan) { + eastLon = longitude; + } else { + westLon = longitude; + } + } } - return new LatLngBounds(maxLat, maxLon, minLat, minLon); + return new LatLngBounds(maxLat, eastLon, minLat, westLon); } /** @@ -322,6 +377,24 @@ public class LatLngBounds implements Parcelable { return false; } + + private boolean containsLatitude(final double latitude) { + return (latitude <= this.latitudeNorth) + && (latitude >= this.latitudeSouth); + } + + private boolean containsLongitude(final double longitude) { + return containsLongitude(this.longitudeEast, this.longitudeWest, longitude); + } + + static boolean containsLongitude(final double eastLon, final double westLon, final double longitude) { + if (eastLon > westLon) { + return (longitude <= eastLon) + && (longitude >= westLon); + } + return (longitude < eastLon) || (longitude > westLon); + } + /** * Determines whether this LatLngBounds contains a point. * @@ -329,12 +402,8 @@ public class LatLngBounds implements Parcelable { * @return true, if the point is contained within the bounds */ public boolean contains(final ILatLng latLng) { - final double latitude = latLng.getLatitude(); - final double longitude = latLng.getLongitude(); - return ((latitude <= this.latitudeNorth) - && (latitude >= this.latitudeSouth)) - && ((longitude <= this.longitudeEast) - && (longitude >= this.longitudeWest)); + return containsLatitude(latLng.getLatitude()) + && containsLongitude(latLng.getLongitude()); } /** @@ -344,7 +413,8 @@ public class LatLngBounds implements Parcelable { * @return true, if the bounds is contained within the bounds */ public boolean contains(final LatLngBounds other) { - return contains(other.getNorthEast()) && contains(other.getSouthWest()); + return contains(other.getNorthEast()) + && contains(other.getSouthWest()); } /** diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngBoundsTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngBoundsTest.java index e6c1fdd0cf..f03bbdb11c 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngBoundsTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngBoundsTest.java @@ -70,6 +70,82 @@ public class LatLngBoundsTest { assertEquals("LatLngSpan should be the same", new LatLngSpan(2, 2), latLngSpan); } + @Test + public void dateLineSpanBuilder1() { + latLngBounds = new LatLngBounds.Builder() + .include(new LatLng(10, -170)) + .include(new LatLng(-10, 170)) + .build(); + + LatLngSpan latLngSpan = latLngBounds.getSpan(); + assertEquals("LatLngSpan should be shortest distance", new LatLngSpan(20, 20), + latLngSpan); + } + + @Test + public void dateLineSpanBuilder2() { + latLngBounds = new LatLngBounds.Builder() + .include(new LatLng(-10, -170)) + .include(new LatLng(10, 170)) + .build(); + + LatLngSpan latLngSpan = latLngBounds.getSpan(); + assertEquals("LatLngSpan should be shortest distance", new LatLngSpan(20, 20), + latLngSpan); + } + + @Test + public void dateLineSpanFrom1() { + latLngBounds = LatLngBounds.from(10, -170, -10, 170); + LatLngSpan latLngSpan = latLngBounds.getSpan(); + assertEquals("LatLngSpan should be shortest distance", new LatLngSpan(20, 20), + latLngSpan); + } + + @Test + public void dateLineSpanFrom2() { + latLngBounds = LatLngBounds.from(10, 170, -10, -170); + LatLngSpan latLngSpan = latLngBounds.getSpan(); + assertEquals("LatLngSpan should be shortest distance", new LatLngSpan(20, 340), + latLngSpan); + } + + @Test + public void nearDateLineCenter1() { + latLngBounds = LatLngBounds.from(10, -175, -10, 165); + LatLng center = latLngBounds.getCenter(); + assertEquals("Center should match", new LatLng(0, 175), center); + } + + @Test + public void nearDateLineCenter2() { + latLngBounds = LatLngBounds.from(10, -165, -10, 175); + LatLng center = latLngBounds.getCenter(); + assertEquals("Center should match", new LatLng(0, -175), center); + } + + @Test + public void nearDateLineCenter3() { + latLngBounds = LatLngBounds.from(10, -170, -10, 170); + LatLng center = latLngBounds.getCenter(); + assertEquals("Center should match", new LatLng(0, -180), center); + } + + @Test + public void nearDateLineCenter4() { + latLngBounds = LatLngBounds.from(10, -180, -10, 0); + LatLng center = latLngBounds.getCenter(); + assertEquals("Center should match", new LatLng(0, 90), center); + } + + @Test + public void nearDateLineCenter5() { + latLngBounds = LatLngBounds.from(10, 180, -10, 0); + LatLng center = latLngBounds.getCenter(); + assertEquals("Center should match", new LatLng(0, 90), center); + } + + @Test public void center() { LatLng center = latLngBounds.getCenter(); @@ -120,6 +196,46 @@ public class LatLngBoundsTest { assertEquals("LatLngBounds should match", latLngBounds1, latLngBounds2); } + @Test + public void includesOverDateline1() { + + LatLngBounds latLngBounds = new LatLngBounds.Builder() + .include(new LatLng(10, -170)) + .include(new LatLng(-10, -175)) + .include(new LatLng(0, 170)) + .build(); + + assertEquals("LatLngSpan should be the same", + new LatLngSpan(20, 20), latLngBounds.getSpan()); + } + + @Test + public void includesOverDateline2() { + + LatLngBounds latLngBounds = new LatLngBounds.Builder() + .include(new LatLng(10, 170)) + .include(new LatLng(-10, 175)) + .include(new LatLng(0, -170)) + .build(); + + assertEquals("LatLngSpan should be the same", + new LatLngSpan(20, 20), latLngBounds.getSpan()); + } + + @Test + public void includesOverDateline3() { + + LatLngBounds latLngBounds = new LatLngBounds.Builder() + .include(new LatLng(10, 170)) + .include(new LatLng(-10, -170)) + .include(new LatLng(0, -180)) + .include(new LatLng(5, 180)) + .build(); + + assertEquals("LatLngSpan should be the same", + new LatLngSpan(20, 20), latLngBounds.getSpan()); + } + @Test public void containsNot() { assertFalse("LatLng should not be included", latLngBounds.contains(new LatLng(3, 1))); @@ -130,6 +246,21 @@ public class LatLngBoundsTest { assertTrue("LatLngBounds should be contained in the world", LatLngBounds.world().contains(latLngBounds)); } + @Test + public void worldSpan() { + assertEquals("LatLngBounds world span should be 180, 360", + GeometryConstants.LATITUDE_SPAN, LatLngBounds.world().getLatitudeSpan(), DELTA); + assertEquals("LatLngBounds world span should be 180, 360", + GeometryConstants.LONGITUDE_SPAN, LatLngBounds.world().getLongitudeSpan(), DELTA); + } + + @Test + public void emptySpan() { + LatLngBounds latLngBounds = LatLngBounds.from(GeometryConstants.MIN_LATITUDE, GeometryConstants.MAX_LONGITUDE, + GeometryConstants.MIN_LATITUDE, GeometryConstants.MAX_LONGITUDE); + assertTrue("LatLngBounds empty span", latLngBounds.isEmptySpan()); + } + @Test public void containsBounds() { LatLngBounds inner = new LatLngBounds.Builder() -- cgit v1.2.1 From 43a7db0b0bfd7d626ffed9adff3446fbbe111c15 Mon Sep 17 00:00:00 2001 From: Osana Babayan <32496536+osana@users.noreply.github.com> Date: Tue, 27 Feb 2018 18:27:22 +0100 Subject: [android] LatLngBounds: latNorth should be greater or equal than latSouth --- .../src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java | 6 ++++++ .../test/java/com/mapbox/mapboxsdk/geometry/LatLngBoundsTest.java | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java index fc8d2ec8f0..df8f764f44 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java @@ -283,6 +283,8 @@ public class LatLngBounds implements Parcelable { * This values of latNorth and latSouth should be in the range of [-90, 90], * see {@link GeometryConstants#MIN_LATITUDE} and {@link GeometryConstants#MAX_LATITUDE}, * otherwise IllegalArgumentException will be thrown. + * latNorth should be greater or equal latSouth, otherwise IllegalArgumentException will be thrown. + * *

* This method doesn't recalculate most east or most west boundaries. * Note that lonEast and lonWest will be wrapped to be in the range of [-180, 180], @@ -312,6 +314,10 @@ public class LatLngBounds implements Parcelable { throw new IllegalArgumentException("latitude must be between -90 and 90"); } + if (latNorth < latSouth) { + throw new IllegalArgumentException("LatSouth cannot be less than latNorth"); + } + lonEast = LatLng.wrap(lonEast, GeometryConstants.MIN_LONGITUDE, GeometryConstants.MAX_LONGITUDE); lonWest = LatLng.wrap(lonWest, GeometryConstants.MIN_LONGITUDE, GeometryConstants.MAX_LONGITUDE); diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngBoundsTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngBoundsTest.java index f03bbdb11c..29ffd6bbbe 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngBoundsTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngBoundsTest.java @@ -496,4 +496,11 @@ public class LatLngBoundsTest { exception.expectMessage("longitude must not be infinite"); LatLngBounds.from(20, 20, 0, Double.POSITIVE_INFINITY); } + + @Test + public void testConstructorCheckLatSouthGreaterLatNorth() { + exception.expect(IllegalArgumentException.class); + exception.expectMessage("LatSouth cannot be less than latNorth"); + LatLngBounds.from(0, 20, 20, 0); + } } -- cgit v1.2.1 From 848d7dff4e682c3d2485366f95649a5de4b1bd75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Paczos?= Date: Tue, 27 Feb 2018 18:35:05 +0100 Subject: [android ] - new gestures library (cp #11221) (#11332) * [android] new gesture library - added SNAPSHOT dependency * [android] new gesture library - cleaned up redundant classes * [android] new gesture library - limiting scale when rotating * [android] new gesture library - shove gesture filtering * [android] new gesture library - increase rotation threshold when scaling * [android] new gesture library - minimum angular velocity * [android] new gesture library - exposed gestures execution listeners * [android] new gesture library - notifying new listeners tests * [android] new gesture library - removed tracking setting * [android] new gesture library - resetting focal point with every scale/rotate callback * [android] new gesture library - fixed camera change dispatcher callbacks * [android] new gesture library - cancel velocity animations in maps onStop() * [android] new gesture library - extracted telemetry pushes to a method * [android] new gesture library - deprecated onScrollListener * [android] new gesture library - unified shove listener name (cherry picked from commit 7905bd6) --- platform/android/MapboxGLAndroidSDK/build.gradle | 1 + .../gesturedetectors/BaseGestureDetector.java | 160 --- .../gesturedetectors/MoveGestureDetector.java | 185 ---- .../gesturedetectors/RotateGestureDetector.java | 180 ---- .../gesturedetectors/ShoveGestureDetector.java | 214 ---- .../gesturedetectors/TwoFingerGestureDetector.java | 224 ---- .../multitouch/gesturedetectors/package-info.java | 4 - .../mapboxsdk/constants/MapboxConstants.java | 29 +- .../mapbox/mapboxsdk/maps/MapGestureDetector.java | 1096 ++++++++++---------- .../com/mapbox/mapboxsdk/maps/MapKeyListener.java | 8 +- .../java/com/mapbox/mapboxsdk/maps/MapView.java | 73 +- .../java/com/mapbox/mapboxsdk/maps/MapboxMap.java | 202 +++- .../java/com/mapbox/mapboxsdk/maps/Transform.java | 34 +- .../src/main/res/values/dimens.xml | 9 + .../mapboxsdk/maps/MapTouchListenersTest.java | 132 ++- .../com/mapbox/mapboxsdk/maps/MapboxMapTest.java | 2 +- platform/android/gradle/dependencies.gradle | 24 +- 17 files changed, 980 insertions(+), 1597 deletions(-) delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/BaseGestureDetector.java delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/MoveGestureDetector.java delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/RotateGestureDetector.java delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/ShoveGestureDetector.java delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/TwoFingerGestureDetector.java delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/package-info.java diff --git a/platform/android/MapboxGLAndroidSDK/build.gradle b/platform/android/MapboxGLAndroidSDK/build.gradle index 173b4fa7f8..94b816c1ab 100644 --- a/platform/android/MapboxGLAndroidSDK/build.gradle +++ b/platform/android/MapboxGLAndroidSDK/build.gradle @@ -3,6 +3,7 @@ apply plugin: 'com.android.library' dependencies { api dependenciesList.mapboxAndroidTelemetry api dependenciesList.mapboxJavaGeoJSON + api dependenciesList.mapboxAndroidGestures implementation dependenciesList.supportAnnotations implementation dependenciesList.supportFragmentV4 implementation dependenciesList.timber diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/BaseGestureDetector.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/BaseGestureDetector.java deleted file mode 100644 index b7bcb925a1..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/BaseGestureDetector.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.almeros.android.multitouch.gesturedetectors; - -import android.content.Context; -import android.view.MotionEvent; - -/** - * @author Almer Thie (code.almeros.com) Copyright (c) 2013, Almer Thie - * (code.almeros.com) - *

- * All rights reserved. - *

- * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - *

- * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - *

- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY - * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -public abstract class BaseGestureDetector { - protected final Context context; - protected boolean gestureInProgress; - - protected MotionEvent prevEvent; - protected MotionEvent currEvent; - - protected float currPressure; - protected float prevPressure; - protected long timeDelta; - - /** - * This value is the threshold ratio between the previous combined pressure - * and the current combined pressure. When pressure decreases rapidly - * between events the position values can often be imprecise, as it usually - * indicates that the user is in the process of lifting a pointer off of the - * device. This value was tuned experimentally. - */ - protected static final float PRESSURE_THRESHOLD = 0.67f; - - public BaseGestureDetector(Context context) { - this.context = context; - } - - /** - * All gesture detectors need to be called through this method to be able to - * detect gestures. This method delegates work to handler methods - * (handleStartProgressEvent, handleInProgressEvent) implemented in - * extending classes. - * - * @param event MotionEvent - * @return {@code true} as handled - */ - public boolean onTouchEvent(MotionEvent event) { - final int actionCode = event.getAction() & MotionEvent.ACTION_MASK; - if (!gestureInProgress) { - handleStartProgressEvent(actionCode, event); - } else { - handleInProgressEvent(actionCode, event); - } - return true; - } - - /** - * Called when the current event occurred when NO gesture is in progress - * yet. The handling in this implementation may set the gesture in progress - * (via gestureInProgress) or out of progress - * - * @param actionCode Action Code from MotionEvent - * @param event MotionEvent - */ - protected abstract void handleStartProgressEvent(int actionCode, - MotionEvent event); - - /** - * Called when the current event occurred when a gesture IS in progress. The - * handling in this implementation may set the gesture out of progress (via - * gestureInProgress). - * - * @param actionCode Action Code from MotionEvent - * @param event MotionEvent - */ - protected abstract void handleInProgressEvent(int actionCode, - MotionEvent event); - - protected void updateStateByEvent(MotionEvent curr) { - final MotionEvent prev = prevEvent; - - // Reset currEvent - if (currEvent != null) { - currEvent.recycle(); - currEvent = null; - } - currEvent = MotionEvent.obtain(curr); - - // Delta time - timeDelta = curr.getEventTime() - prev.getEventTime(); - - // Pressure - currPressure = curr.getPressure(curr.getActionIndex()); - prevPressure = prev.getPressure(prev.getActionIndex()); - } - - protected void resetState() { - if (prevEvent != null) { - prevEvent.recycle(); - prevEvent = null; - } - if (currEvent != null) { - currEvent.recycle(); - currEvent = null; - } - gestureInProgress = false; - } - - /** - * Returns {@code true} if a gesture is currently in progress. - * - * @return {@code true} if a gesture is currently in progress, {@code false} - * otherwise. - */ - public boolean isInProgress() { - return gestureInProgress; - } - - /** - * Return the time difference in milliseconds between the previous accepted - * GestureDetector event and the current GestureDetector event. - * - * @return Time difference since the last move event in milliseconds. - */ - public long getTimeDelta() { - return timeDelta; - } - - /** - * Return the event time of the current GestureDetector event being - * processed. - * - * @return Current GestureDetector event time in milliseconds. - */ - public long getEventTime() { - return currEvent.getEventTime(); - } - -} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/MoveGestureDetector.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/MoveGestureDetector.java deleted file mode 100644 index bc7dda6159..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/MoveGestureDetector.java +++ /dev/null @@ -1,185 +0,0 @@ -package com.almeros.android.multitouch.gesturedetectors; - -import android.content.Context; -import android.graphics.PointF; -import android.view.MotionEvent; - -/** - * @author Almer Thie (code.almeros.com) Copyright (c) 2013, Almer Thie - * (code.almeros.com) - *

- * All rights reserved. - *

- * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - *

- * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - *

- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY - * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -public class MoveGestureDetector extends BaseGestureDetector { - - /** - * Listener which must be implemented which is used by MoveGestureDetector - * to perform callbacks to any implementing class which is registered to a - * MoveGestureDetector via the constructor. - * - * @see MoveGestureDetector.SimpleOnMoveGestureListener - */ - public interface OnMoveGestureListener { - public boolean onMove(MoveGestureDetector detector); - - public boolean onMoveBegin(MoveGestureDetector detector); - - public void onMoveEnd(MoveGestureDetector detector); - } - - /** - * Helper class which may be extended and where the methods may be - * implemented. This way it is not necessary to implement all methods of - * OnMoveGestureListener. - */ - public static class SimpleOnMoveGestureListener implements - OnMoveGestureListener { - public boolean onMove(MoveGestureDetector detector) { - return false; - } - - public boolean onMoveBegin(MoveGestureDetector detector) { - return true; - } - - public void onMoveEnd(MoveGestureDetector detector) { - // Do nothing, overridden implementation may be used - } - } - - private static final PointF FOCUS_DELTA_ZERO = new PointF(); - - private final OnMoveGestureListener listener; - - private PointF focusExternal = new PointF(); - private PointF focusDeltaExternal = new PointF(); - - public MoveGestureDetector(Context context, OnMoveGestureListener listener) { - super(context); - this.listener = listener; - } - - @Override - protected void handleStartProgressEvent(int actionCode, MotionEvent event) { - switch (actionCode) { - case MotionEvent.ACTION_DOWN: - resetState(); // In case we missed an UP/CANCEL event - - prevEvent = MotionEvent.obtain(event); - timeDelta = 0; - - updateStateByEvent(event); - break; - - case MotionEvent.ACTION_MOVE: - gestureInProgress = listener.onMoveBegin(this); - break; - } - } - - @Override - protected void handleInProgressEvent(int actionCode, MotionEvent event) { - switch (actionCode) { - case MotionEvent.ACTION_UP: - case MotionEvent.ACTION_CANCEL: - listener.onMoveEnd(this); - resetState(); - break; - - case MotionEvent.ACTION_MOVE: - updateStateByEvent(event); - - // Only accept the event if our relative pressure is within - // a certain limit. This can help filter shaky data as a - // finger is lifted. - if (currPressure / prevPressure > PRESSURE_THRESHOLD) { - final boolean updatePrevious = listener.onMove(this); - if (updatePrevious) { - prevEvent.recycle(); - prevEvent = MotionEvent.obtain(event); - } - } - break; - } - } - - protected void updateStateByEvent(MotionEvent curr) { - super.updateStateByEvent(curr); - - final MotionEvent prev = prevEvent; - - // Focus intenal - PointF currFocusInternal = determineFocalPoint(curr); - PointF prevFocusInternal = determineFocalPoint(prev); - - // Focus external - // - Prevent skipping of focus delta when a finger is added or removed - boolean skipNextMoveEvent = prev.getPointerCount() != curr - .getPointerCount(); - focusDeltaExternal = skipNextMoveEvent ? FOCUS_DELTA_ZERO - : new PointF(currFocusInternal.x - prevFocusInternal.x, - currFocusInternal.y - prevFocusInternal.y); - - // - Don't directly use mFocusInternal (or skipping will occur). Add - // unskipped delta values to focusExternal instead. - focusExternal.x += focusDeltaExternal.x; - focusExternal.y += focusDeltaExternal.y; - } - - /** - * Determine (multi)finger focal point (a.k.a. center point between all - * fingers) - * - * @param motionEvent a {@link MotionEvent} object. - * @return PointF focal point - */ - private PointF determineFocalPoint(MotionEvent motionEvent) { - // Number of fingers on screen - final int pCount = motionEvent.getPointerCount(); - float x = 0.0f; - float y = 0.0f; - - for (int i = 0; i < pCount; i++) { - x += motionEvent.getX(i); - y += motionEvent.getY(i); - } - - return new PointF(x / pCount, y / pCount); - } - - public float getFocusX() { - return focusExternal.x; - } - - public float getFocusY() { - return focusExternal.y; - } - - public PointF getFocusDelta() { - return focusDeltaExternal; - } - -} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/RotateGestureDetector.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/RotateGestureDetector.java deleted file mode 100644 index 8c111a68df..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/RotateGestureDetector.java +++ /dev/null @@ -1,180 +0,0 @@ -package com.almeros.android.multitouch.gesturedetectors; - -import android.content.Context; -import android.view.MotionEvent; - -/** - * @author Almer Thie (code.almeros.com) Copyright (c) 2013, Almer Thie - * (code.almeros.com) - *

- * All rights reserved. - *

- * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - *

- * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - *

- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY - * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -public class RotateGestureDetector extends TwoFingerGestureDetector { - - /** - * Listener which must be implemented which is used by RotateGestureDetector - * to perform callbacks to any implementing class which is registered to a - * RotateGestureDetector via the constructor. - * - * @see RotateGestureDetector.SimpleOnRotateGestureListener - */ - public interface OnRotateGestureListener { - public boolean onRotate(RotateGestureDetector detector); - - public boolean onRotateBegin(RotateGestureDetector detector); - - public void onRotateEnd(RotateGestureDetector detector); - } - - /** - * Helper class which may be extended and where the methods may be - * implemented. This way it is not necessary to implement all methods of - * OnRotateGestureListener. - */ - public static class SimpleOnRotateGestureListener implements - OnRotateGestureListener { - public boolean onRotate(RotateGestureDetector detector) { - return false; - } - - public boolean onRotateBegin(RotateGestureDetector detector) { - return true; - } - - public void onRotateEnd(RotateGestureDetector detector) { - // Do nothing, overridden implementation may be used - } - } - - private final OnRotateGestureListener listener; - private boolean sloppyGesture; - - public RotateGestureDetector(Context context, - OnRotateGestureListener listener) { - super(context); - this.listener = listener; - } - - @Override - protected void handleStartProgressEvent(int actionCode, MotionEvent event) { - switch (actionCode) { - case MotionEvent.ACTION_POINTER_DOWN: - // At least the second finger is on screen now - - resetState(); // In case we missed an UP/CANCEL event - prevEvent = MotionEvent.obtain(event); - timeDelta = 0; - - updateStateByEvent(event); - - // See if we have a sloppy gesture - sloppyGesture = isSloppyGesture(event); - if (!sloppyGesture) { - // No, start gesture now - gestureInProgress = listener.onRotateBegin(this); - } - break; - - case MotionEvent.ACTION_MOVE: - if (!sloppyGesture) { - break; - } - - // See if we still have a sloppy gesture - sloppyGesture = isSloppyGesture(event); - if (!sloppyGesture) { - // No, start normal gesture now - gestureInProgress = listener.onRotateBegin(this); - } - - break; - - case MotionEvent.ACTION_POINTER_UP: - if (!sloppyGesture) { - break; - } - - break; - } - } - - @Override - protected void handleInProgressEvent(int actionCode, MotionEvent event) { - switch (actionCode) { - case MotionEvent.ACTION_POINTER_UP: - // Gesture ended but - updateStateByEvent(event); - - if (!sloppyGesture) { - listener.onRotateEnd(this); - } - - resetState(); - break; - - case MotionEvent.ACTION_CANCEL: - if (!sloppyGesture) { - listener.onRotateEnd(this); - } - - resetState(); - break; - - case MotionEvent.ACTION_MOVE: - updateStateByEvent(event); - - // Only accept the event if our relative pressure is within - // a certain limit. This can help filter shaky data as a - // finger is lifted. - if (currPressure / prevPressure > PRESSURE_THRESHOLD) { - final boolean updatePrevious = listener.onRotate(this); - if (updatePrevious) { - prevEvent.recycle(); - prevEvent = MotionEvent.obtain(event); - } - } - break; - } - } - - @Override - protected void resetState() { - super.resetState(); - sloppyGesture = false; - } - - /** - * Return the rotation difference from the previous rotate event to the - * current event. - * - * @return The current rotation //difference in degrees. - */ - public float getRotationDegreesDelta() { - double diffRadians = Math.atan2(prevFingerDiffY, prevFingerDiffX) - - Math.atan2(currFingerDiffY, currFingerDiffX); - return (float) (diffRadians * 180.0 / Math.PI); - } -} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/ShoveGestureDetector.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/ShoveGestureDetector.java deleted file mode 100644 index 9396578e48..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/ShoveGestureDetector.java +++ /dev/null @@ -1,214 +0,0 @@ -package com.almeros.android.multitouch.gesturedetectors; - -import android.content.Context; -import android.view.MotionEvent; - -/** - * @author Robert Nordan (robert.nordan@norkart.no) - *

- * Copyright (c) 2013, Norkart AS - *

- * All rights reserved. - *

- * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - *

- * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - *

- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY - * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -public class ShoveGestureDetector extends TwoFingerGestureDetector { - - /** - * Listener which must be implemented which is used by ShoveGestureDetector - * to perform callbacks to any implementing class which is registered to a - * ShoveGestureDetector via the constructor. - * - * @see ShoveGestureDetector.SimpleOnShoveGestureListener - */ - public interface OnShoveGestureListener { - public boolean onShove(ShoveGestureDetector detector); - - public boolean onShoveBegin(ShoveGestureDetector detector); - - public void onShoveEnd(ShoveGestureDetector detector); - } - - /** - * Helper class which may be extended and where the methods may be - * implemented. This way it is not necessary to implement all methods of - * OnShoveGestureListener. - */ - public static class SimpleOnShoveGestureListener implements - OnShoveGestureListener { - public boolean onShove(ShoveGestureDetector detector) { - return false; - } - - public boolean onShoveBegin(ShoveGestureDetector detector) { - return true; - } - - public void onShoveEnd(ShoveGestureDetector detector) { - // Do nothing, overridden implementation may be used - } - } - - private float prevAverageY; - private float currAverageY; - - private final OnShoveGestureListener listener; - private boolean sloppyGesture; - - public ShoveGestureDetector(Context context, OnShoveGestureListener listener) { - super(context); - this.listener = listener; - } - - @Override - protected void handleStartProgressEvent(int actionCode, MotionEvent event) { - switch (actionCode) { - case MotionEvent.ACTION_POINTER_DOWN: - // At least the second finger is on screen now - - resetState(); // In case we missed an UP/CANCEL event - prevEvent = MotionEvent.obtain(event); - timeDelta = 0; - - updateStateByEvent(event); - - // See if we have a sloppy gesture - sloppyGesture = isSloppyGesture(event); - if (!sloppyGesture) { - // No, start gesture now - gestureInProgress = listener.onShoveBegin(this); - } - break; - - case MotionEvent.ACTION_MOVE: - if (!sloppyGesture) { - break; - } - - // See if we still have a sloppy gesture - sloppyGesture = isSloppyGesture(event); - if (!sloppyGesture) { - // No, start normal gesture now - gestureInProgress = listener.onShoveBegin(this); - } - - break; - - case MotionEvent.ACTION_POINTER_UP: - if (!sloppyGesture) { - break; - } - - break; - } - } - - @Override - protected void handleInProgressEvent(int actionCode, MotionEvent event) { - switch (actionCode) { - case MotionEvent.ACTION_POINTER_UP: - // Gesture ended but - updateStateByEvent(event); - - if (!sloppyGesture) { - listener.onShoveEnd(this); - } - - resetState(); - break; - - case MotionEvent.ACTION_CANCEL: - if (!sloppyGesture) { - listener.onShoveEnd(this); - } - - resetState(); - break; - - case MotionEvent.ACTION_MOVE: - updateStateByEvent(event); - - // Only accept the event if our relative pressure is within - // a certain limit. This can help filter shaky data as a - // finger is lifted. Also check that shove is meaningful. - if (currPressure / prevPressure > PRESSURE_THRESHOLD - && Math.abs(getShovePixelsDelta()) > 0.5f) { - final boolean updatePrevious = listener.onShove(this); - if (updatePrevious) { - prevEvent.recycle(); - prevEvent = MotionEvent.obtain(event); - } - } - break; - } - } - - @Override - protected void resetState() { - super.resetState(); - sloppyGesture = false; - prevAverageY = 0.0f; - currAverageY = 0.0f; - } - - @Override - protected void updateStateByEvent(MotionEvent curr) { - super.updateStateByEvent(curr); - - final MotionEvent prev = prevEvent; - float py0 = prev.getY(0); - float py1 = prev.getY(1); - prevAverageY = (py0 + py1) / 2.0f; - - float cy0 = curr.getY(0); - float cy1 = curr.getY(1); - currAverageY = (cy0 + cy1) / 2.0f; - } - - @Override - protected boolean isSloppyGesture(MotionEvent event) { - boolean sloppy = super.isSloppyGesture(event); - if (sloppy) { - return true; - } - - // If it's not traditionally sloppy, we check if the angle between - // fingers - // is acceptable. - double angle = Math.abs(Math.atan2(currFingerDiffY, currFingerDiffX)); - // about 20 degrees, left or right - return !((0.0f < angle && angle < 0.35f) || 2.79f < angle - && angle < Math.PI); - } - - /** - * Return the distance in pixels from the previous shove event to the - * current event. - * - * @return The current distance in pixels. - */ - public float getShovePixelsDelta() { - return currAverageY - prevAverageY; - } -} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/TwoFingerGestureDetector.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/TwoFingerGestureDetector.java deleted file mode 100644 index db492b6556..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/TwoFingerGestureDetector.java +++ /dev/null @@ -1,224 +0,0 @@ -package com.almeros.android.multitouch.gesturedetectors; - -import android.content.Context; -import android.graphics.PointF; -import android.util.DisplayMetrics; -import android.view.MotionEvent; -import android.view.ViewConfiguration; - -/** - * @author Almer Thie (code.almeros.com) Copyright (c) 2013, Almer Thie - * (code.almeros.com) - *

- * All rights reserved. - *

- * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - *

- * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - *

- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY - * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -public abstract class TwoFingerGestureDetector extends BaseGestureDetector { - - private final float edgeSlop; - - protected float prevFingerDiffX; - protected float prevFingerDiffY; - protected float currFingerDiffX; - protected float currFingerDiffY; - - private float currLen; - private float prevLen; - - private PointF focus; - - public TwoFingerGestureDetector(Context context) { - super(context); - - ViewConfiguration config = ViewConfiguration.get(context); - - edgeSlop = config.getScaledEdgeSlop(); - } - - @Override - protected abstract void handleStartProgressEvent(int actionCode, - MotionEvent event); - - @Override - protected abstract void handleInProgressEvent(int actionCode, - MotionEvent event); - - protected void updateStateByEvent(MotionEvent curr) { - super.updateStateByEvent(curr); - - final MotionEvent prev = prevEvent; - - currLen = -1; - prevLen = -1; - - // Previous - final float px0 = prev.getX(0); - final float py0 = prev.getY(0); - final float px1 = prev.getX(1); - final float py1 = prev.getY(1); - final float pvx = px1 - px0; - final float pvy = py1 - py0; - prevFingerDiffX = pvx; - prevFingerDiffY = pvy; - - // Current - final float cx0 = curr.getX(0); - final float cy0 = curr.getY(0); - final float cx1 = curr.getX(1); - final float cy1 = curr.getY(1); - final float cvx = cx1 - cx0; - final float cvy = cy1 - cy0; - currFingerDiffX = cvx; - currFingerDiffY = cvy; - focus = determineFocalPoint(curr); - } - - /** - * Return the current distance between the two pointers forming the gesture - * in progress. - * - * @return Distance between pointers in pixels. - */ - public float getCurrentSpan() { - if (currLen == -1) { - final float cvx = currFingerDiffX; - final float cvy = currFingerDiffY; - currLen = (float) Math.sqrt(cvx * cvx + cvy * cvy); - } - return currLen; - } - - /** - * Return the previous distance between the two pointers forming the gesture - * in progress. - * - * @return Previous distance between pointers in pixels. - */ - public float getPreviousSpan() { - if (prevLen == -1) { - final float pvx = prevFingerDiffX; - final float pvy = prevFingerDiffY; - prevLen = (float) Math.sqrt(pvx * pvx + pvy * pvy); - } - return prevLen; - } - - /** - * MotionEvent has no getRawX(int) method; simulate it pending future API - * approval. - * - * @param event Motion Event - * @param pointerIndex Pointer Index - * @return Raw x value or 0 - */ - protected static float getRawX(MotionEvent event, int pointerIndex) { - float offset = event.getRawX() - event.getX(); - if (pointerIndex < event.getPointerCount()) { - return event.getX(pointerIndex) + offset; - } - return 0.0f; - } - - /** - * MotionEvent has no getRawY(int) method; simulate it pending future API - * approval. - * - * @param event Motion Event - * @param pointerIndex Pointer Index - * @return Raw y value or 0 - */ - protected static float getRawY(MotionEvent event, int pointerIndex) { - float offset = event.getRawY() - event.getY(); - if (pointerIndex < event.getPointerCount()) { - return event.getY(pointerIndex) + offset; - } - return 0.0f; - } - - /** - * Check if we have a sloppy gesture. Sloppy gestures can happen if the edge - * of the user's hand is touching the screen, for example. - * - * @param event Motion Event - * @return {@code true} if is sloppy gesture, {@code false} if not - */ - protected boolean isSloppyGesture(MotionEvent event) { - // As orientation can change, query the metrics in touch down - DisplayMetrics metrics = context.getResources().getDisplayMetrics(); - float rightSlopEdge = metrics.widthPixels - edgeSlop; - float bottomSlopEdge = metrics.heightPixels - edgeSlop; - - final float edgeSlop = this.edgeSlop; - - final float x0 = event.getRawX(); - final float y0 = event.getRawY(); - final float x1 = getRawX(event, 1); - final float y1 = getRawY(event, 1); - - boolean p0sloppy = x0 < edgeSlop || y0 < edgeSlop || x0 > rightSlopEdge - || y0 > bottomSlopEdge; - boolean p1sloppy = x1 < edgeSlop || y1 < edgeSlop || x1 > rightSlopEdge - || y1 > bottomSlopEdge; - - if (p0sloppy && p1sloppy) { - return true; - } else if (p0sloppy) { - return true; - } else if (p1sloppy) { - return true; - } - return false; - } - - /** - * Determine (multi)finger focal point (a.k.a. center point between all - * fingers) - * - * @param motionEvent Motion Event - * @return PointF focal point - */ - public static PointF determineFocalPoint(MotionEvent motionEvent) { - // Number of fingers on screen - final int pCount = motionEvent.getPointerCount(); - float x = 0.0f; - float y = 0.0f; - - for (int i = 0; i < pCount; i++) { - x += motionEvent.getX(i); - y += motionEvent.getY(i); - } - - return new PointF(x / pCount, y / pCount); - } - - public float getFocusX() { - return focus.x; - } - - public float getFocusY() { - return focus.y; - } - -} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/package-info.java deleted file mode 100644 index cff2f086dc..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/almeros/android/multitouch/gesturedetectors/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Do not use this package. Internal use only. - */ -package com.almeros.android.multitouch.gesturedetectors; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MapboxConstants.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MapboxConstants.java index 60362dd2e9..6f263e4635 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MapboxConstants.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MapboxConstants.java @@ -47,6 +47,31 @@ public class MapboxConstants { */ public static final long VELOCITY_THRESHOLD_IGNORE_FLING = 1000; + /** + * Value by which the default rotation threshold will be increased when scaling + */ + public static final float ROTATION_THRESHOLD_INCREASE_WHEN_SCALING = 25f; + + /** + * Time within which user needs to lift fingers for velocity animation to start. + */ + public static final long SCHEDULED_ANIMATION_TIMEOUT = 150L; + + /** + * Minimum angular velocity for rotation animation + */ + public static final float MINIMUM_ANGULAR_VELOCITY = 1.5f; + + /** + * Maximum angular velocity for rotation animation + */ + public static final float MAXIMUM_ANGULAR_VELOCITY = 20f; + + /** + * Factor to calculate tilt change based on pixel change during shove gesture. + */ + public static final float SHOVE_PIXEL_CHANGE_FACTOR = 0.1f; + /** * The currently supported minimum zoom level. */ @@ -78,14 +103,14 @@ public class MapboxConstants { public static final double MINIMUM_DIRECTION = 0; /** - * The currently used minimun scale factor to clamp to when a quick zoom gesture occurs + * The currently used minimum scale factor to clamp to when a quick zoom gesture occurs */ public static final float MINIMUM_SCALE_FACTOR_CLAMP = 0.00f; /** * The currently used maximum scale factor to clamp to when a quick zoom gesture occurs */ - public static final float MAXIMUM_SCALE_FACTOR_CLAMP = 0.45f; + public static final float MAXIMUM_SCALE_FACTOR_CLAMP = 0.15f; /** * Fragment Argument Key for MapboxMapOptions diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java index 8047e19809..5f5a10d0d0 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java @@ -5,26 +5,31 @@ import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.PointF; +import android.os.Handler; import android.support.annotation.Nullable; -import android.support.v4.view.GestureDetectorCompat; -import android.support.v4.view.ScaleGestureDetectorCompat; -import android.support.v4.view.animation.FastOutSlowInInterpolator; import android.view.InputDevice; import android.view.MotionEvent; -import android.view.ScaleGestureDetector; -import android.view.VelocityTracker; -import android.view.ViewConfiguration; - -import com.almeros.android.multitouch.gesturedetectors.RotateGestureDetector; -import com.almeros.android.multitouch.gesturedetectors.ShoveGestureDetector; -import com.almeros.android.multitouch.gesturedetectors.TwoFingerGestureDetector; +import android.view.animation.DecelerateInterpolator; + +import com.mapbox.android.gestures.AndroidGesturesManager; +import com.mapbox.android.gestures.MoveGestureDetector; +import com.mapbox.android.gestures.MultiFingerTapGestureDetector; +import com.mapbox.android.gestures.RotateGestureDetector; +import com.mapbox.android.gestures.ShoveGestureDetector; +import com.mapbox.android.gestures.StandardGestureDetector; +import com.mapbox.android.gestures.StandardScaleGestureDetector; import com.mapbox.android.telemetry.Event; import com.mapbox.android.telemetry.MapEventFactory; import com.mapbox.android.telemetry.MapState; +import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.constants.MapboxConstants; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.utils.MathUtils; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import java.util.concurrent.CopyOnWriteArrayList; import static com.mapbox.mapboxsdk.maps.MapboxMap.OnCameraMoveStartedListener.REASON_API_ANIMATION; @@ -32,24 +37,15 @@ import static com.mapbox.mapboxsdk.maps.MapboxMap.OnCameraMoveStartedListener.RE /** * Manages gestures events on a MapView. - *

- * Relies on gesture detection code in almeros.android.multitouch.gesturedetectors. - *

*/ final class MapGestureDetector { private final Transform transform; private final Projection projection; private final UiSettings uiSettings; - private final TrackingSettings trackingSettings; private final AnnotationManager annotationManager; private final CameraChangeDispatcher cameraChangeDispatcher; - private GestureDetectorCompat gestureDetector; - private ScaleGestureDetector scaleGestureDetector; - private RotateGestureDetector rotateGestureDetector; - private ShoveGestureDetector shoveGestureDetector; - // deprecated map touch API private MapboxMap.OnMapClickListener onMapClickListener; private MapboxMap.OnMapLongClickListener onMapLongClickListener; @@ -69,43 +65,73 @@ final class MapGestureDetector { private final CopyOnWriteArrayList onScrollListenerList = new CopyOnWriteArrayList<>(); - private PointF focalPoint; + private final CopyOnWriteArrayList onMoveListenerList + = new CopyOnWriteArrayList<>(); - private boolean twoTap; - private boolean quickZoom; - private boolean tiltGestureOccurred; - private boolean scrollGestureOccurred; + private final CopyOnWriteArrayList onRotateListenerList + = new CopyOnWriteArrayList<>(); + + private final CopyOnWriteArrayList onScaleListenerList + = new CopyOnWriteArrayList<>(); + + private final CopyOnWriteArrayList onShoveListenerList + = new CopyOnWriteArrayList<>(); + + /** + * User-set focal point. + */ + private PointF focalPoint; - private boolean scaleGestureOccurred; - private boolean recentScaleGestureOccurred; - private long scaleBeginTime; + private AndroidGesturesManager gesturesManager; + private boolean executeDoubleTap; - private boolean scaleAnimating; - private boolean rotateAnimating; + private Animator scaleAnimator; + private Animator rotateAnimator; + private final List scheduledAnimators = new ArrayList<>(); - private VelocityTracker velocityTracker; - private boolean wasZoomingIn; - private boolean wasClockwiseRotating; - private boolean rotateGestureOccurred; + /** + * Cancels scheduled velocity animations if user doesn't lift fingers within + * {@link MapboxConstants#SCHEDULED_ANIMATION_TIMEOUT} + */ + private Handler animationsTimeoutHandler = new Handler(); MapGestureDetector(Context context, Transform transform, Projection projection, UiSettings uiSettings, - TrackingSettings trackingSettings, AnnotationManager annotationManager, - CameraChangeDispatcher cameraChangeDispatcher) { + AnnotationManager annotationManager, CameraChangeDispatcher cameraChangeDispatcher) { this.annotationManager = annotationManager; this.transform = transform; this.projection = projection; this.uiSettings = uiSettings; - this.trackingSettings = trackingSettings; this.cameraChangeDispatcher = cameraChangeDispatcher; - // Touch gesture detectors + // Checking for context != null for testing purposes if (context != null) { - gestureDetector = new GestureDetectorCompat(context, new GestureListener()); - gestureDetector.setIsLongpressEnabled(true); - scaleGestureDetector = new ScaleGestureDetector(context, new ScaleGestureListener()); - ScaleGestureDetectorCompat.setQuickScaleEnabled(scaleGestureDetector, true); - rotateGestureDetector = new RotateGestureDetector(context, new RotateGestureListener()); - shoveGestureDetector = new ShoveGestureDetector(context, new ShoveGestureListener()); + gesturesManager = new AndroidGesturesManager(context); + + Set shoveScaleSet = new HashSet<>(); + shoveScaleSet.add(AndroidGesturesManager.GESTURE_TYPE_SHOVE); + shoveScaleSet.add(AndroidGesturesManager.GESTURE_TYPE_SCALE); + + Set shoveRotateSet = new HashSet<>(); + shoveRotateSet.add(AndroidGesturesManager.GESTURE_TYPE_SHOVE); + shoveRotateSet.add(AndroidGesturesManager.GESTURE_TYPE_ROTATE); + + Set ScaleLongPressSet = new HashSet<>(); + ScaleLongPressSet.add(AndroidGesturesManager.GESTURE_TYPE_SCALE); + ScaleLongPressSet.add(AndroidGesturesManager.GESTURE_TYPE_LONG_PRESS); + + gesturesManager.setMutuallyExclusiveGestures(shoveScaleSet, shoveRotateSet, ScaleLongPressSet); + + gesturesManager.setStandardGestureListener(new StandardGestureListener()); + gesturesManager.setMoveGestureListener(new MoveGestureListener()); + gesturesManager.setStandardScaleGestureListener(new ScaleGestureListener( + context.getResources().getDimension(R.dimen.mapbox_minimum_scale_velocity) + )); + gesturesManager.setRotateGestureListener(new RotateGestureListener( + context.getResources().getDimension(R.dimen.mapbox_minimum_scale_span_when_rotating), + context.getResources().getDimension(R.dimen.mapbox_minimum_angular_velocity) + )); + gesturesManager.setShoveGestureListener(new ShoveGestureListener()); + gesturesManager.setMultiFingerTapGestureListener(new TapGestureListener()); } } @@ -132,8 +158,9 @@ final class MapGestureDetector { /** * Get the current active gesture focal point. *

- * 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)}. + * This could be either the user provided focal point in + * {@link UiSettings#setFocalPoint(PointF)}or null. + * If it's null, gestures will use focal pointed returned by the detector. *

* * @return the current active gesture focal point. @@ -149,118 +176,79 @@ final class MapGestureDetector { * Forwards event to the related gesture detectors. *

* - * @param event the MotionEvent + * @param motionEvent the MotionEvent * @return True if touch event is handled */ - boolean onTouchEvent(MotionEvent event) { - // framework can return null motion events in edge cases #9432 - if (event == null) { + boolean onTouchEvent(MotionEvent motionEvent) { + // Framework can return null motion events in edge cases #9432 + if (motionEvent == null) { return false; } // Check and ignore non touch or left clicks - if ((event.getButtonState() != 0) && (event.getButtonState() != MotionEvent.BUTTON_PRIMARY)) { + if ((motionEvent.getButtonState() != 0) && (motionEvent.getButtonState() != MotionEvent.BUTTON_PRIMARY)) { return false; } - // Check two finger gestures first - scaleGestureDetector.onTouchEvent(event); - rotateGestureDetector.onTouchEvent(event); - shoveGestureDetector.onTouchEvent(event); + boolean result = gesturesManager.onTouchEvent(motionEvent); - // Handle two finger tap - switch (event.getActionMasked()) { + switch (motionEvent.getActionMasked()) { case MotionEvent.ACTION_DOWN: - if (velocityTracker == null) { - velocityTracker = VelocityTracker.obtain(); - } else { - velocityTracker.clear(); - } - velocityTracker.addMovement(event); - // First pointer down, reset scaleGestureOccurred, used to avoid triggering a fling after a scale gesture #7666 - recentScaleGestureOccurred = false; + cancelAnimators(); transform.setGestureInProgress(true); break; + case MotionEvent.ACTION_UP: + transform.setGestureInProgress(false); - case MotionEvent.ACTION_POINTER_DOWN: - // Second pointer down - twoTap = event.getPointerCount() == 2 - && uiSettings.isZoomGesturesEnabled(); - if (twoTap) { - // Confirmed 2nd Finger Down - if (isZoomValid(transform)) { - MapEventFactory mapEventFactory = new MapEventFactory(); - LatLng latLng = projection.fromScreenLocation(new PointF(event.getX(), event.getY())); - MapState twoFingerTap = new MapState(latLng.getLatitude(), latLng.getLongitude(), transform.getZoom()); - twoFingerTap.setGesture(Events.TWO_FINGER_TAP); - Events.obtainTelemetry().push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_CLICK, twoFingerTap)); - } + // Start all awaiting velocity animations + animationsTimeoutHandler.removeCallbacksAndMessages(null); + for (Animator animator : scheduledAnimators) { + animator.start(); } + scheduledAnimators.clear(); break; - case MotionEvent.ACTION_POINTER_UP: - // Second pointer up + case MotionEvent.ACTION_CANCEL: + scheduledAnimators.clear(); + transform.setGestureInProgress(false); break; + } - case MotionEvent.ACTION_UP: - // First pointer up - long tapInterval = event.getEventTime() - event.getDownTime(); - boolean isTap = tapInterval <= ViewConfiguration.getTapTimeout(); - boolean inProgress = rotateGestureDetector.isInProgress() - || scaleGestureDetector.isInProgress() - || shoveGestureDetector.isInProgress(); - - if (twoTap && isTap && !inProgress) { - if (focalPoint != null) { - transform.zoom(false, focalPoint); - } else { - PointF focalPoint = TwoFingerGestureDetector.determineFocalPoint(event); - transform.zoom(false, focalPoint); - } - twoTap = false; - return true; - } - - // Scroll / Pan Has Stopped - if (scrollGestureOccurred) { - if (isZoomValid(transform)) { - MapEventFactory mapEventFactory = new MapEventFactory(); - LatLng latLng = projection.fromScreenLocation(new PointF(event.getX(), event.getY())); - MapState dragend = new MapState(latLng.getLatitude(), latLng.getLongitude(), transform.getZoom()); - Events.obtainTelemetry().push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_DRAGEND, dragend)); - } - scrollGestureOccurred = false; + return result; + } - if (!scaleAnimating && !rotateAnimating) { - cameraChangeDispatcher.onCameraIdle(); - } - } + void cancelAnimators() { + if (scaleAnimator != null) { + scaleAnimator.cancel(); + } + if (rotateAnimator != null) { + rotateAnimator.cancel(); + } - twoTap = false; - transform.setGestureInProgress(false); - if (velocityTracker != null) { - velocityTracker.recycle(); - } - velocityTracker = null; - break; + animationsTimeoutHandler.removeCallbacksAndMessages(null); + scheduledAnimators.clear(); + } - case MotionEvent.ACTION_CANCEL: - twoTap = false; - transform.setGestureInProgress(false); - if (velocityTracker != null) { - velocityTracker.recycle(); - } - velocityTracker = null; - break; - case MotionEvent.ACTION_MOVE: - if (velocityTracker != null) { - velocityTracker.addMovement(event); - velocityTracker.computeCurrentVelocity(1000); - } - break; + /** + * Posted on main thread with {@link #animationsTimeoutHandler}. Cancels all scheduled animators if needed. + */ + private Runnable cancelAnimatorsRunnable = new Runnable() { + @Override + public void run() { + cancelAnimators(); } + }; - return gestureDetector.onTouchEvent(event); + /** + * Schedules a velocity animator to be executed when user lift fingers, + * unless canceled by the {@link #cancelAnimatorsRunnable}. + * + * @param animator animator ot be scheduled + */ + private void scheduleAnimator(Animator animator) { + scheduledAnimators.add(animator); + animationsTimeoutHandler.removeCallbacksAndMessages(null); + animationsTimeoutHandler.postDelayed(cancelAnimatorsRunnable, MapboxConstants.SCHEDULED_ANIMATION_TIMEOUT); } /** @@ -269,7 +257,7 @@ final class MapGestureDetector { * Examples of such events are mouse scroll events, mouse moves, joystick & trackpad. *

* - * @param event The MotionEvent occured + * @param event The MotionEvent occurred * @return True is the event is handled */ boolean onGenericMotionEvent(MotionEvent event) { @@ -291,7 +279,7 @@ final class MapGestureDetector { float scrollDist = event.getAxisValue(MotionEvent.AXIS_VSCROLL); // Scale the map by the appropriate power of two factor - transform.zoomBy(scrollDist, event.getX(), event.getY()); + transform.zoomBy(scrollDist, new PointF(event.getX(), event.getY())); return true; @@ -305,61 +293,14 @@ final class MapGestureDetector { return false; } - /** - * Responsible for handling one finger gestures. - */ - private class GestureListener extends android.view.GestureDetector.SimpleOnGestureListener { - + private final class StandardGestureListener extends StandardGestureDetector.SimpleStandardOnGestureListener { @Override - public boolean onDown(MotionEvent event) { - return true; - } - - @Override - public boolean onDoubleTapEvent(MotionEvent e) { - if (!uiSettings.isZoomGesturesEnabled() || !uiSettings.isDoubleTapGesturesEnabled()) { - return false; - } - - switch (e.getAction()) { - case MotionEvent.ACTION_DOWN: - break; - case MotionEvent.ACTION_MOVE: - break; - case MotionEvent.ACTION_UP: - if (quickZoom) { - cameraChangeDispatcher.onCameraIdle(); - quickZoom = false; - break; - } - - // notify camera change listener - cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE); - - // Single finger double tap - if (focalPoint != null) { - // User provided focal point - transform.zoom(true, focalPoint); - } else { - // Zoom in on gesture - transform.zoom(true, new PointF(e.getX(), e.getY())); - } - if (isZoomValid(transform)) { - MapEventFactory mapEventFactory = new MapEventFactory(); - LatLng latLng = projection.fromScreenLocation(new PointF(e.getX(), e.getY())); - MapState doubleTap = new MapState(latLng.getLatitude(), latLng.getLongitude(), transform.getZoom()); - doubleTap.setGesture(Events.DOUBLE_TAP); - Events.obtainTelemetry().push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_CLICK, doubleTap)); - } - break; - } - + public boolean onDown(MotionEvent motionEvent) { return true; } @Override public boolean onSingleTapUp(MotionEvent motionEvent) { - // Cancel any animation transform.cancelTransitions(); return true; } @@ -378,31 +319,51 @@ final class MapGestureDetector { notifyOnMapClickListeners(tapPoint); } - if (isZoomValid(transform)) { - MapEventFactory mapEventFactory = new MapEventFactory(); - LatLng latLng = projection.fromScreenLocation(new PointF(motionEvent.getX(), motionEvent.getY())); - MapState singleTap = new MapState(latLng.getLatitude(), latLng.getLongitude(), transform.getZoom()); - singleTap.setGesture(Events.SINGLE_TAP); - Events.obtainTelemetry().push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_CLICK, singleTap)); - } + sendTelemetryEvent(Events.SINGLE_TAP, new PointF(motionEvent.getX(), motionEvent.getY())); return true; } @Override - public void onLongPress(MotionEvent motionEvent) { - PointF longClickPoint = new PointF(motionEvent.getX(), motionEvent.getY()); + public boolean onDoubleTapEvent(MotionEvent motionEvent) { + int action = motionEvent.getActionMasked(); + if (action == MotionEvent.ACTION_DOWN) { + executeDoubleTap = true; + } + if (motionEvent.getActionMasked() == MotionEvent.ACTION_UP) { + if (!uiSettings.isZoomGesturesEnabled() || !uiSettings.isDoubleTapGesturesEnabled() || !executeDoubleTap) { + return false; + } + + transform.cancelTransitions(); + cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE); - if (!quickZoom) { - notifyOnMapLongClickListeners(longClickPoint); + // Single finger double tap + if (focalPoint != null) { + // User provided focal point + transform.zoomIn(focalPoint); + } else { + // Zoom in on gesture + transform.zoomIn(new PointF(motionEvent.getX(), motionEvent.getY())); + } + + sendTelemetryEvent(Events.DOUBLE_TAP, new PointF(motionEvent.getX(), motionEvent.getY())); + + return true; } + return super.onDoubleTapEvent(motionEvent); + } + + @Override + public void onLongPress(MotionEvent motionEvent) { + PointF longClickPoint = new PointF(motionEvent.getX(), motionEvent.getY()); + notifyOnMapLongClickListeners(longClickPoint); } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { - if ((!trackingSettings.isScrollGestureCurrentlyEnabled()) || recentScaleGestureOccurred) { + if ((!uiSettings.isScrollGesturesEnabled())) { // don't allow a fling is scroll is disabled - // and ignore when a scale gesture has occurred return false; } @@ -415,11 +376,7 @@ final class MapGestureDetector { return false; } - trackingSettings.resetTrackingModesIfRequired(true, false, false); - - // cancel any animation transform.cancelTransitions(); - cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE); // tilt results in a bigger translation, limiting input for #5281 @@ -435,230 +392,149 @@ final class MapGestureDetector { transform.moveBy(offsetX, offsetY, animationTime); notifyOnFlingListeners(); + return true; } + } - // Called for drags + private final class MoveGestureListener extends MoveGestureDetector.SimpleOnMoveGestureListener { @Override - public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { - if (!trackingSettings.isScrollGestureCurrentlyEnabled()) { + public boolean onMoveBegin(MoveGestureDetector detector) { + if (!uiSettings.isScrollGesturesEnabled()) { return false; } - if (tiltGestureOccurred) { - return false; - } + transform.cancelTransitions(); + cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE); - if (!scrollGestureOccurred) { - scrollGestureOccurred = true; + sendTelemetryEvent(Events.PAN, detector.getFocalPoint()); - // Cancel any animation - if (!scaleGestureOccurred) { - transform.cancelTransitions(); - cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE); - } + notifyOnMoveBeginListeners(detector); - if (isZoomValid(transform)) { - MapEventFactory mapEventFactory = new MapEventFactory(); - LatLng latLng = projection.fromScreenLocation(new PointF(e1.getX(), e1.getY())); - MapState pan = new MapState(latLng.getLatitude(), latLng.getLongitude(), transform.getZoom()); - pan.setGesture(Events.PAN); - Events.obtainTelemetry().push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_CLICK, pan)); - } - } + return true; + } - // reset tracking if needed - trackingSettings.resetTrackingModesIfRequired(true, false, false); + @Override + public boolean onMove(MoveGestureDetector detector, float distanceX, float distanceY) { + // dispatching start even once more if another detector ended, and this one didn't + cameraChangeDispatcher.onCameraMoveStarted(CameraChangeDispatcher.REASON_API_GESTURE); // Scroll the map transform.moveBy(-distanceX, -distanceY, 0 /*no duration*/); notifyOnScrollListeners(); + notifyOnMoveListeners(detector); return true; } - } - - void notifyOnMapClickListeners(PointF tapPoint) { - // deprecated API - if (onMapClickListener != null) { - onMapClickListener.onMapClick(projection.fromScreenLocation(tapPoint)); - } - // new API - for (MapboxMap.OnMapClickListener listener : onMapClickListenerList) { - listener.onMapClick(projection.fromScreenLocation(tapPoint)); + @Override + public void onMoveEnd(MoveGestureDetector detector, float velocityX, float velocityY) { + cameraChangeDispatcher.onCameraIdle(); + notifyOnMoveEndListeners(detector); } } - void notifyOnMapLongClickListeners(PointF longClickPoint) { - // deprecated API - if (onMapLongClickListener != null) { - onMapLongClickListener.onMapLongClick(projection.fromScreenLocation(longClickPoint)); - } + private final class ScaleGestureListener extends StandardScaleGestureDetector.SimpleStandardOnScaleGestureListener { - // new API - for (MapboxMap.OnMapLongClickListener listener : onMapLongClickListenerList) { - listener.onMapLongClick(projection.fromScreenLocation(longClickPoint)); - } - } + private final float minimumVelocity; - void notifyOnFlingListeners() { - // deprecated API - if (onFlingListener != null) { - onFlingListener.onFling(); - } + private PointF scaleFocalPoint; + private boolean quickZoom; - // new API - for (MapboxMap.OnFlingListener listener : onFlingListenerList) { - listener.onFling(); + ScaleGestureListener(float minimumVelocity) { + this.minimumVelocity = minimumVelocity; } - } - void notifyOnScrollListeners() { - //deprecated API - if (onScrollListener != null) { - onScrollListener.onScroll(); - } - - // new API - for (MapboxMap.OnScrollListener listener : onScrollListenerList) { - listener.onScroll(); - } - } - - /** - * Responsible for handling two finger gestures and double-tap drag gestures. - */ - private class ScaleGestureListener extends ScaleGestureDetector.SimpleOnScaleGestureListener { - - private static final int ANIMATION_TIME_MULTIPLIER = 77; - private static final double ZOOM_DISTANCE_DIVIDER = 5; - - private float scaleFactor = 1.0f; - private PointF scalePointBegin; - - // Called when two fingers first touch the screen @Override - public boolean onScaleBegin(ScaleGestureDetector detector) { + public boolean onScaleBegin(StandardScaleGestureDetector detector) { if (!uiSettings.isZoomGesturesEnabled()) { return false; } - recentScaleGestureOccurred = true; - scalePointBegin = new PointF(detector.getFocusX(), detector.getFocusY()); - scaleBeginTime = detector.getEventTime(); - if (isZoomValid(transform)) { - MapEventFactory mapEventFactory = new MapEventFactory(); - LatLng latLng = projection.fromScreenLocation(new PointF(detector.getFocusX(), detector.getFocusY())); - MapState pinch = new MapState(latLng.getLatitude(), latLng.getLongitude(), transform.getZoom()); - pinch.setGesture(Events.PINCH); - Events.obtainTelemetry().push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_CLICK, pinch)); + transform.cancelTransitions(); + cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE); + + quickZoom = detector.getPointersCount() == 1; + if (quickZoom) { + // when quickzoom, dismiss double tap and disable move gesture + executeDoubleTap = false; + gesturesManager.getMoveGestureDetector().setEnabled(false); } + + // increase rotate angle threshold when scale is detected first + gesturesManager.getRotateGestureDetector().setAngleThreshold( + gesturesManager.getRotateGestureDetector().getDefaultAngleThreshold() + + MapboxConstants.ROTATION_THRESHOLD_INCREASE_WHEN_SCALING + ); + + // setting focalPoint in #onScaleBegin() as well, because #onScale() might not get called before #onScaleEnd() + setScaleFocalPoint(detector); + + sendTelemetryEvent(Events.PINCH, scaleFocalPoint); + + notifyOnScaleBeginListeners(detector); + return true; } - // Called each time a finger moves - // Called for pinch zooms and quickzooms/quickscales @Override - public boolean onScale(ScaleGestureDetector detector) { - if (!uiSettings.isZoomGesturesEnabled()) { - return super.onScale(detector); - } + public boolean onScale(StandardScaleGestureDetector detector) { + // dispatching start even once more if another detector ended, and this one didn't + cameraChangeDispatcher.onCameraMoveStarted(CameraChangeDispatcher.REASON_API_GESTURE); - wasZoomingIn = (Math.log(detector.getScaleFactor()) / Math.log(Math.PI / 2)) > 0; - if (tiltGestureOccurred) { - return false; - } - - // Ignore short touches in case it is a tap - // Also ignore small scales - long time = detector.getEventTime(); - long interval = time - scaleBeginTime; - if (!scaleGestureOccurred && (interval <= ViewConfiguration.getTapTimeout())) { - return false; - } - - // If scale is large enough ignore a tap - scaleFactor *= detector.getScaleFactor(); - if ((scaleFactor > 1.1f) || (scaleFactor < 0.9f)) { - // notify camera change listener - cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE); - scaleGestureOccurred = true; - } + setScaleFocalPoint(detector); - if (!scaleGestureOccurred) { - return false; - } + float scaleFactor = detector.getScaleFactor(); + double zoomBy = getNewZoom(scaleFactor, quickZoom); + transform.zoomBy(zoomBy, scaleFocalPoint); - // Gesture is a quickzoom if there aren't two fingers - if (!quickZoom && !twoTap) { - cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE); - } - quickZoom = !twoTap; + notifyOnScaleListeners(detector); - // make an assumption here; if the zoom center is specified by the gesture, it's NOT going - // to be in the center of the map. Therefore the zoom will translate the map center, so tracking - // should be disabled. - trackingSettings.resetTrackingModesIfRequired(!quickZoom, false, false); - // Scale the map - if (focalPoint != null) { - // arround user provided focal point - transform.zoomBy(Math.log(detector.getScaleFactor()) / Math.log(Math.PI / 2), focalPoint.x, focalPoint.y); - } else if (quickZoom) { - cameraChangeDispatcher.onCameraMove(); - // clamp scale factors we feed to core #7514 - float scaleFactor = detector.getScaleFactor(); - // around center map - double zoomBy = Math.log(scaleFactor) / Math.log(Math.PI / 2); - boolean negative = zoomBy < 0; - zoomBy = MathUtils.clamp(Math.abs(zoomBy), - MapboxConstants.MINIMUM_SCALE_FACTOR_CLAMP, - MapboxConstants.MAXIMUM_SCALE_FACTOR_CLAMP); - transform.zoomBy(negative ? -zoomBy : zoomBy, uiSettings.getWidth() / 2, uiSettings.getHeight() / 2); - recentScaleGestureOccurred = true; - } else { - // around gesture - transform.zoomBy(Math.log(detector.getScaleFactor()) / Math.log(Math.PI / 2), - scalePointBegin.x, scalePointBegin.y); - } return true; } - // Called when fingers leave screen @Override - public void onScaleEnd(final ScaleGestureDetector detector) { - if (velocityTracker == null) { - return; - } + public void onScaleEnd(StandardScaleGestureDetector detector, float velocityX, float velocityY) { + cameraChangeDispatcher.onCameraIdle(); - if (rotateGestureOccurred || quickZoom) { - reset(); - return; + if (quickZoom) { + //if quickzoom, re-enabling move gesture detector + gesturesManager.getMoveGestureDetector().setEnabled(true); } - double velocityXY = Math.abs(velocityTracker.getYVelocity()) + Math.abs(velocityTracker.getXVelocity()); - if (velocityXY > MapboxConstants.VELOCITY_THRESHOLD_IGNORE_FLING / 2) { - scaleAnimating = true; - double zoomAddition = calculateScale(velocityXY); + // resetting default angle threshold + gesturesManager.getRotateGestureDetector().setAngleThreshold( + gesturesManager.getRotateGestureDetector().getDefaultAngleThreshold() + ); + + float velocityXY = Math.abs(velocityX) + Math.abs(velocityY); + if (velocityXY > minimumVelocity) { + double zoomAddition = calculateScale(velocityXY, detector.isScalingOut()); double currentZoom = transform.getRawZoom(); - long animationTime = (long) (Math.log(velocityXY) * ANIMATION_TIME_MULTIPLIER); - createScaleAnimator(currentZoom, zoomAddition, animationTime).start(); - } else if (!scaleAnimating) { - reset(); + long animationTime = (long) (Math.abs(zoomAddition) * 1000 / 4); + scaleAnimator = createScaleAnimator(currentZoom, zoomAddition, animationTime); + scheduleAnimator(scaleAnimator); } + + notifyOnScaleEndListeners(detector); } - private void reset() { - scaleAnimating = false; - scaleGestureOccurred = false; - scaleBeginTime = 0; - scaleFactor = 1.0f; - cameraChangeDispatcher.onCameraIdle(); + private void setScaleFocalPoint(StandardScaleGestureDetector detector) { + if (focalPoint != null) { + // around user provided focal point + scaleFocalPoint = focalPoint; + } else if (quickZoom) { + // around center + scaleFocalPoint = new PointF(uiSettings.getWidth() / 2, uiSettings.getHeight() / 2); + } else { + // around gesture + scaleFocalPoint = detector.getFocalPoint(); + } } - private double calculateScale(double velocityXY) { - double zoomAddition = (float) (Math.log(velocityXY) / ZOOM_DISTANCE_DIVIDER); - if (!wasZoomingIn) { + private double calculateScale(double velocityXY, boolean isScalingOut) { + double zoomAddition = (float) Math.log(velocityXY / 1000 + 1); + if (isScalingOut) { zoomAddition = -zoomAddition; } return zoomAddition; @@ -667,272 +543,387 @@ final class MapGestureDetector { private Animator createScaleAnimator(double currentZoom, double zoomAddition, long animationTime) { ValueAnimator animator = ValueAnimator.ofFloat((float) currentZoom, (float) (currentZoom + zoomAddition)); animator.setDuration(animationTime); - animator.setInterpolator(new FastOutSlowInInterpolator()); + animator.setInterpolator(new DecelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { - transform.setZoom((Float) animation.getAnimatedValue(), scalePointBegin, 0, true); + transform.setZoom((Float) animation.getAnimatedValue(), scaleFocalPoint, 0); } }); + animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { + transform.cancelTransitions(); cameraChangeDispatcher.onCameraMoveStarted(REASON_API_ANIMATION); } @Override public void onAnimationCancel(Animator animation) { - reset(); + transform.cancelTransitions(); } @Override public void onAnimationEnd(Animator animation) { - reset(); + cameraChangeDispatcher.onCameraIdle(); } }); return animator; } - } - /** - * Responsible for handling rotation gestures. - */ - private class RotateGestureListener extends RotateGestureDetector.SimpleOnRotateGestureListener { + private double getNewZoom(float scaleFactor, boolean quickZoom) { + double zoomBy = Math.log(scaleFactor) / Math.log(Math.PI / 2); + if (quickZoom) { + // clamp scale factors we feed to core #7514 + boolean negative = zoomBy < 0; + zoomBy = MathUtils.clamp(Math.abs(zoomBy), + MapboxConstants.MINIMUM_SCALE_FACTOR_CLAMP, + MapboxConstants.MAXIMUM_SCALE_FACTOR_CLAMP); + return negative ? -zoomBy : zoomBy; + } + return zoomBy; + } + } - private static final float ROTATE_INVOKE_ANGLE = 15.30f; - private static final float ROTATE_LIMITATION_ANGLE = 3.35f; - private static final float ROTATE_LIMITATION_DURATION = ROTATE_LIMITATION_ANGLE * 1.85f; + private final class RotateGestureListener extends RotateGestureDetector.SimpleOnRotateGestureListener { + private PointF rotateFocalPoint; + private final float minimumScaleSpanWhenRotating; + private final float minimumAngularVelocity; - private long beginTime = 0; - private boolean started = false; + RotateGestureListener(float minimumScaleSpanWhenRotating, float minimumAngularVelocity) { + this.minimumScaleSpanWhenRotating = minimumScaleSpanWhenRotating; + this.minimumAngularVelocity = minimumAngularVelocity; + } - // Called when two fingers first touch the screen @Override public boolean onRotateBegin(RotateGestureDetector detector) { - if (!trackingSettings.isRotateGestureCurrentlyEnabled()) { + if (!uiSettings.isRotateGesturesEnabled()) { return false; } - // notify camera change listener + transform.cancelTransitions(); cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE); - beginTime = detector.getEventTime(); - return true; - } + // when rotation starts, interrupting scale and increasing the threshold + // to make rotation without scaling easier + gesturesManager.getStandardScaleGestureDetector().setSpanSinceStartThreshold(minimumScaleSpanWhenRotating); + gesturesManager.getStandardScaleGestureDetector().interrupt(); - // Called each time one of the two fingers moves - // Called for rotation - @Override - public boolean onRotate(RotateGestureDetector detector) { - if (!trackingSettings.isRotateGestureCurrentlyEnabled() || tiltGestureOccurred) { - return false; - } + // setting in #onRotateBegin() as well, because #onRotate() might not get called before #onRotateEnd() + setRotateFocalPoint(detector); - // If rotate is large enough ignore a tap - // Also is zoom already started, don't rotate - float angle = detector.getRotationDegreesDelta(); - if (Math.abs(angle) >= ROTATE_INVOKE_ANGLE) { - if (isZoomValid(transform)) { - MapEventFactory mapEventFactory = new MapEventFactory(); - LatLng latLng = projection.fromScreenLocation(new PointF(detector.getFocusX(), detector.getFocusY())); - MapState rotation = new MapState(latLng.getLatitude(), latLng.getLongitude(), transform.getZoom()); - rotation.setGesture(Events.ROTATION); - Events.obtainTelemetry().push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_CLICK, rotation)); - } - started = true; - } + sendTelemetryEvent(Events.ROTATION, rotateFocalPoint); - if (!started) { - return false; - } + notifyOnRotateBeginListeners(detector); - wasClockwiseRotating = detector.getRotationDegreesDelta() > 0; - if (scaleBeginTime != 0) { - rotateGestureOccurred = true; - } + return true; + } - // rotation constitutes translation of anything except the center of - // rotation, so cancel both location and bearing tracking if required - trackingSettings.resetTrackingModesIfRequired(true, true, false); + @Override + public boolean onRotate(RotateGestureDetector detector, float rotationDegreesSinceLast, + float rotationDegreesSinceFirst) { + // dispatching start even once more if another detector ended, and this one didn't + cameraChangeDispatcher.onCameraMoveStarted(CameraChangeDispatcher.REASON_API_GESTURE); + + setRotateFocalPoint(detector); // Calculate map bearing value - double bearing = transform.getRawBearing() + angle; + double bearing = transform.getRawBearing() + rotationDegreesSinceLast; // Rotate the map - if (focalPoint != null) { - // User provided focal point - transform.setBearing(bearing, focalPoint.x, focalPoint.y); - } else { - // around gesture - transform.setBearing(bearing, detector.getFocusX(), detector.getFocusY()); - } + transform.setBearing(bearing, rotateFocalPoint.x, rotateFocalPoint.y); + + notifyOnRotateListeners(detector); + return true; } - // Called when the fingers leave the screen @Override - public void onRotateEnd(RotateGestureDetector detector) { - long interval = detector.getEventTime() - beginTime; - if ((!started && (interval <= ViewConfiguration.getTapTimeout())) || scaleAnimating || interval > 500) { - reset(); + public void onRotateEnd(RotateGestureDetector detector, float velocityX, float velocityY, float angularVelocity) { + cameraChangeDispatcher.onCameraIdle(); + + // resetting default scale threshold values + gesturesManager.getStandardScaleGestureDetector().setSpanSinceStartThreshold( + gesturesManager.getStandardScaleGestureDetector().getDefaultSpanSinceStartThreshold()); + + if (Math.abs(angularVelocity) < minimumAngularVelocity) { return; } - double angularVelocity = calculateVelocityVector(detector); - if (Math.abs(angularVelocity) > 0.001 && rotateGestureOccurred && !rotateAnimating) { - animateRotateVelocity(); - } else if (!rotateAnimating) { - reset(); - } - } + boolean negative = angularVelocity < 0; + angularVelocity = (float) Math.pow(angularVelocity, 2); + angularVelocity = MathUtils.clamp( + angularVelocity, MapboxConstants.MINIMUM_ANGULAR_VELOCITY, MapboxConstants.MAXIMUM_ANGULAR_VELOCITY); - private void reset() { - beginTime = 0; - started = false; - rotateAnimating = false; - rotateGestureOccurred = false; + long animationTime = (long) (Math.log(angularVelocity + 1) * 500); - if (!twoTap) { - cameraChangeDispatcher.onCameraIdle(); + if (negative) { + angularVelocity = -angularVelocity; } - } - private void animateRotateVelocity() { - rotateAnimating = true; - double currentRotation = transform.getRawBearing(); - double rotateAdditionDegrees = calculateVelocityInDegrees(); - createAnimator(currentRotation, rotateAdditionDegrees).start(); - } + rotateAnimator = createRotateAnimator(angularVelocity, animationTime); + scheduleAnimator(rotateAnimator); - private double calculateVelocityVector(RotateGestureDetector detector) { - return ((detector.getFocusX() * velocityTracker.getYVelocity()) - + (detector.getFocusY() * velocityTracker.getXVelocity())) - / (Math.pow(detector.getFocusX(), 2) + Math.pow(detector.getFocusY(), 2)); + notifyOnRotateEndListeners(detector); } - private double calculateVelocityInDegrees() { - double angleRadians = Math.atan2(velocityTracker.getXVelocity(), velocityTracker.getYVelocity()); - double angle = angleRadians / (Math.PI / 180); - if (angle <= 0) { - angle += 360; - } - - // limit the angle - angle = angle / ROTATE_LIMITATION_ANGLE; - - // correct direction - if (!wasClockwiseRotating) { - angle = -angle; + private void setRotateFocalPoint(RotateGestureDetector detector) { + if (focalPoint != null) { + // User provided focal point + rotateFocalPoint = focalPoint; + } else { + // around gesture + rotateFocalPoint = detector.getFocalPoint(); } - - return angle; } - private Animator createAnimator(double currentRotation, double rotateAdditionDegrees) { - ValueAnimator animator = ValueAnimator.ofFloat( - (float) currentRotation, - (float) (currentRotation + rotateAdditionDegrees) - ); - animator.setDuration((long) (Math.abs(rotateAdditionDegrees) * ROTATE_LIMITATION_DURATION)); + private Animator createRotateAnimator(float angularVelocity, long animationTime) { + ValueAnimator animator = ValueAnimator.ofFloat(angularVelocity, 0f); + animator.setDuration(animationTime); + animator.setInterpolator(new DecelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { - transform.setBearing((Float) animation.getAnimatedValue()); + transform.setBearing( + transform.getRawBearing() + (float) animation.getAnimatedValue(), + rotateFocalPoint.x, rotateFocalPoint.y, + 0L + ); } }); + animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { + transform.cancelTransitions(); cameraChangeDispatcher.onCameraMoveStarted(REASON_API_ANIMATION); } @Override public void onAnimationCancel(Animator animation) { - reset(); + cameraChangeDispatcher.onCameraIdle(); } @Override public void onAnimationEnd(Animator animation) { - reset(); + cameraChangeDispatcher.onCameraIdle(); } }); + return animator; } } - /** - * Responsible for handling 2 finger shove gestures. - */ - private class ShoveGestureListener implements ShoveGestureDetector.OnShoveGestureListener { - - private long beginTime = 0; - private float totalDelta = 0.0f; - + private final class ShoveGestureListener extends ShoveGestureDetector.SimpleOnShoveGestureListener { @Override public boolean onShoveBegin(ShoveGestureDetector detector) { if (!uiSettings.isTiltGesturesEnabled()) { return false; } - // notify camera change listener + transform.cancelTransitions(); cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE); + + sendTelemetryEvent(Events.PITCH, detector.getFocalPoint()); + + // disabling move gesture during shove + gesturesManager.getMoveGestureDetector().setEnabled(false); + + notifyOnShoveBeginListeners(detector); + return true; } @Override - public void onShoveEnd(ShoveGestureDetector detector) { - beginTime = 0; - totalDelta = 0.0f; - tiltGestureOccurred = false; + public boolean onShove(ShoveGestureDetector detector, float deltaPixelsSinceLast, float deltaPixelsSinceStart) { + // dispatching start even once more if another detector ended, and this one didn't + cameraChangeDispatcher.onCameraMoveStarted(CameraChangeDispatcher.REASON_API_GESTURE); + + // Get tilt value (scale and clamp) + double pitch = transform.getTilt(); + pitch -= MapboxConstants.SHOVE_PIXEL_CHANGE_FACTOR * deltaPixelsSinceLast; + pitch = MathUtils.clamp(pitch, MapboxConstants.MINIMUM_TILT, MapboxConstants.MAXIMUM_TILT); + + // Tilt the map + transform.setTilt(pitch); + + notifyOnShoveListeners(detector); + + return true; } @Override - public boolean onShove(ShoveGestureDetector detector) { - if (!uiSettings.isTiltGesturesEnabled()) { - return false; - } + public void onShoveEnd(ShoveGestureDetector detector, float velocityX, float velocityY) { + cameraChangeDispatcher.onCameraIdle(); - // Ignore short touches in case it is a tap - // Also ignore small tilt - long time = detector.getEventTime(); - long interval = time - beginTime; - if (!tiltGestureOccurred && (interval <= ViewConfiguration.getTapTimeout())) { - return false; - } + // re-enabling move gesture + gesturesManager.getMoveGestureDetector().setEnabled(true); - // If tilt is large enough ignore a tap - // Also if zoom already started, don't tilt - totalDelta += detector.getShovePixelsDelta(); - if (!tiltGestureOccurred && ((totalDelta > 10.0f) || (totalDelta < -10.0f))) { - tiltGestureOccurred = true; - beginTime = detector.getEventTime(); - if (isZoomValid(transform)) { - MapEventFactory mapEventFactory = new MapEventFactory(); - LatLng latLng = projection.fromScreenLocation(new PointF(detector.getFocusX(), detector.getFocusY())); - MapState pitch = new MapState(latLng.getLatitude(), latLng.getLongitude(), transform.getZoom()); - pitch.setGesture(Events.PITCH); - Events.obtainTelemetry().push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_CLICK, pitch)); - } - } + notifyOnShoveEndListeners(detector); + } + } - if (!tiltGestureOccurred) { + private final class TapGestureListener implements MultiFingerTapGestureDetector.OnMultiFingerTapGestureListener { + @Override + public boolean onMultiFingerTap(MultiFingerTapGestureDetector detector, int pointersCount) { + if (!uiSettings.isZoomGesturesEnabled() || pointersCount != 2) { return false; } - // Get tilt value (scale and clamp) - double pitch = transform.getTilt(); - pitch -= 0.1 * detector.getShovePixelsDelta(); - pitch = Math.max(MapboxConstants.MINIMUM_TILT, Math.min(MapboxConstants.MAXIMUM_TILT, pitch)); + transform.cancelTransitions(); + cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE); + + if (focalPoint != null) { + transform.zoomOut(focalPoint); + } else { + transform.zoomOut(detector.getFocalPoint()); + } - // Tilt the map - transform.setTilt(pitch); return true; } } + private void sendTelemetryEvent(String eventType, PointF focalPoint) { + if (isZoomValid(transform)) { + MapEventFactory mapEventFactory = new MapEventFactory(); + LatLng latLng = projection.fromScreenLocation(focalPoint); + MapState state = new MapState(latLng.getLatitude(), latLng.getLongitude(), transform.getZoom()); + state.setGesture(eventType); + Events.obtainTelemetry().push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_CLICK, state)); + } + } + + private boolean isZoomValid(Transform transform) { + if (transform == null) { + return false; + } + double mapZoom = transform.getZoom(); + return mapZoom >= MapboxConstants.MINIMUM_ZOOM && mapZoom <= MapboxConstants.MAXIMUM_ZOOM; + } + + void notifyOnMapClickListeners(PointF tapPoint) { + // deprecated API + if (onMapClickListener != null) { + onMapClickListener.onMapClick(projection.fromScreenLocation(tapPoint)); + } + + // new API + for (MapboxMap.OnMapClickListener listener : onMapClickListenerList) { + listener.onMapClick(projection.fromScreenLocation(tapPoint)); + } + } + + void notifyOnMapLongClickListeners(PointF longClickPoint) { + // deprecated API + if (onMapLongClickListener != null) { + onMapLongClickListener.onMapLongClick(projection.fromScreenLocation(longClickPoint)); + } + + // new API + for (MapboxMap.OnMapLongClickListener listener : onMapLongClickListenerList) { + listener.onMapLongClick(projection.fromScreenLocation(longClickPoint)); + } + } + + void notifyOnFlingListeners() { + // deprecated API + if (onFlingListener != null) { + onFlingListener.onFling(); + } + + // new API + for (MapboxMap.OnFlingListener listener : onFlingListenerList) { + listener.onFling(); + } + } + + void notifyOnScrollListeners() { + //deprecated API + if (onScrollListener != null) { + onScrollListener.onScroll(); + } + + // new API + for (MapboxMap.OnScrollListener listener : onScrollListenerList) { + listener.onScroll(); + } + } + + void notifyOnMoveBeginListeners(MoveGestureDetector detector) { + for (MapboxMap.OnMoveListener listener : onMoveListenerList) { + listener.onMoveBegin(detector); + } + } + + void notifyOnMoveListeners(MoveGestureDetector detector) { + for (MapboxMap.OnMoveListener listener : onMoveListenerList) { + listener.onMove(detector); + } + } + + void notifyOnMoveEndListeners(MoveGestureDetector detector) { + for (MapboxMap.OnMoveListener listener : onMoveListenerList) { + listener.onMoveEnd(detector); + } + } + + void notifyOnRotateBeginListeners(RotateGestureDetector detector) { + for (MapboxMap.OnRotateListener listener : onRotateListenerList) { + listener.onRotateBegin(detector); + } + } + + void notifyOnRotateListeners(RotateGestureDetector detector) { + for (MapboxMap.OnRotateListener listener : onRotateListenerList) { + listener.onRotate(detector); + } + } + + void notifyOnRotateEndListeners(RotateGestureDetector detector) { + for (MapboxMap.OnRotateListener listener : onRotateListenerList) { + listener.onRotateEnd(detector); + } + } + + void notifyOnScaleBeginListeners(StandardScaleGestureDetector detector) { + for (MapboxMap.OnScaleListener listener : onScaleListenerList) { + listener.onScaleBegin(detector); + } + } + + void notifyOnScaleListeners(StandardScaleGestureDetector detector) { + for (MapboxMap.OnScaleListener listener : onScaleListenerList) { + listener.onScale(detector); + } + } + + void notifyOnScaleEndListeners(StandardScaleGestureDetector detector) { + for (MapboxMap.OnScaleListener listener : onScaleListenerList) { + listener.onScaleEnd(detector); + } + } + + void notifyOnShoveBeginListeners(ShoveGestureDetector detector) { + for (MapboxMap.OnShoveListener listener : onShoveListenerList) { + listener.onShoveBegin(detector); + } + } + + void notifyOnShoveListeners(ShoveGestureDetector detector) { + for (MapboxMap.OnShoveListener listener : onShoveListenerList) { + listener.onShove(detector); + } + } + + void notifyOnShoveEndListeners(ShoveGestureDetector detector) { + for (MapboxMap.OnShoveListener listener : onShoveListenerList) { + listener.onShoveEnd(detector); + } + } + void setOnMapClickListener(MapboxMap.OnMapClickListener onMapClickListener) { this.onMapClickListener = onMapClickListener; } @@ -981,14 +972,43 @@ final class MapGestureDetector { onScrollListenerList.remove(onScrollListener); } - private boolean isZoomValid(Transform transform) { - if (transform == null) { - return false; - } - double mapZoom = transform.getZoom(); - if (mapZoom < MapboxConstants.MINIMUM_ZOOM || mapZoom > MapboxConstants.MAXIMUM_ZOOM) { - return false; - } - return true; + void addOnMoveListener(MapboxMap.OnMoveListener listener) { + onMoveListenerList.add(listener); + } + + void removeOnMoveListener(MapboxMap.OnMoveListener listener) { + onMoveListenerList.remove(listener); + } + + void addOnRotateListener(MapboxMap.OnRotateListener listener) { + onRotateListenerList.add(listener); + } + + void removeOnRotateListener(MapboxMap.OnRotateListener listener) { + onRotateListenerList.remove(listener); + } + + void addOnScaleListener(MapboxMap.OnScaleListener listener) { + onScaleListenerList.add(listener); + } + + void removeOnScaleListener(MapboxMap.OnScaleListener listener) { + onScaleListenerList.remove(listener); + } + + void addShoveListener(MapboxMap.OnShoveListener listener) { + onShoveListenerList.add(listener); + } + + void removeShoveListener(MapboxMap.OnShoveListener listener) { + onShoveListenerList.remove(listener); + } + + AndroidGesturesManager getGesturesManager() { + return gesturesManager; + } + + void setGesturesManager(AndroidGesturesManager gesturesManager) { + this.gesturesManager = gesturesManager; } -} +} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapKeyListener.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapKeyListener.java index d1f01a30f7..9bd9499fff 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapKeyListener.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapKeyListener.java @@ -128,7 +128,7 @@ final class MapKeyListener { // Zoom out PointF focalPoint = new PointF(uiSettings.getWidth() / 2, uiSettings.getHeight() / 2); - transform.zoom(false, focalPoint); + transform.zoomOut(focalPoint); return true; default: @@ -164,7 +164,7 @@ final class MapKeyListener { // Zoom in PointF focalPoint = new PointF(uiSettings.getWidth() / 2, uiSettings.getHeight() / 2); - transform.zoom(true, focalPoint); + transform.zoomIn(focalPoint); return true; } @@ -219,7 +219,7 @@ final class MapKeyListener { if (currentTrackballLongPressTimeOut != null) { // Zoom in PointF focalPoint = new PointF(uiSettings.getWidth() / 2, uiSettings.getHeight() / 2); - transform.zoom(true, focalPoint); + transform.zoomIn(focalPoint); } return true; @@ -261,7 +261,7 @@ final class MapKeyListener { if (!cancelled) { // Zoom out PointF pointF = new PointF(uiSettings.getWidth() / 2, uiSettings.getHeight() / 2); - transform.zoom(false, pointF); + transform.zoomOut(pointF); // Ensure the up action is not run currentTrackballLongPressTimeOut = null; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java index cf70300c6e..9ace60b481 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java @@ -23,6 +23,7 @@ import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.ZoomButtonsController; +import com.mapbox.android.gestures.AndroidGesturesManager; import com.mapbox.android.telemetry.AppUserTurnstile; import com.mapbox.android.telemetry.Event; import com.mapbox.android.telemetry.MapEventFactory; @@ -42,8 +43,6 @@ import com.mapbox.mapboxsdk.maps.widgets.MyLocationViewSettings; import com.mapbox.mapboxsdk.net.ConnectivityReceiver; import com.mapbox.mapboxsdk.storage.FileSource; -import javax.microedition.khronos.egl.EGLConfig; -import javax.microedition.khronos.opengles.GL10; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.ref.WeakReference; @@ -52,6 +51,9 @@ import java.util.Iterator; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; +import javax.microedition.khronos.egl.EGLConfig; +import javax.microedition.khronos.opengles.GL10; + import timber.log.Timber; import static com.mapbox.mapboxsdk.maps.widgets.CompassView.TIME_MAP_NORTH_ANIMATION; @@ -149,7 +151,7 @@ public class MapView extends FrameLayout { focalPointInvalidator.addListener(createFocalPointChangeListener()); // callback for registering touch listeners - RegisterTouchListener registerTouchListener = new RegisterTouchListener(); + GesturesManagerInteractionListener registerTouchListener = new GesturesManagerInteractionListener(); // callback for zooming in the camera CameraZoomInvalidator zoomInvalidator = new CameraZoomInvalidator(); @@ -184,7 +186,7 @@ public class MapView extends FrameLayout { mapCallback.attachMapboxMap(mapboxMap); // user input - mapGestureDetector = new MapGestureDetector(context, transform, proj, uiSettings, trackingSettings, + mapGestureDetector = new MapGestureDetector(context, transform, proj, uiSettings, annotationManager, cameraChangeDispatcher); mapKeyListener = new MapKeyListener(transform, trackingSettings, uiSettings); @@ -390,6 +392,7 @@ public class MapView extends FrameLayout { public void onStop() { if (mapboxMap != null) { // map was destroyed before it was started + mapGestureDetector.cancelAnimators(); mapboxMap.onStop(); } @@ -923,7 +926,7 @@ public class MapView extends FrameLayout { } } - private class RegisterTouchListener implements MapboxMap.OnRegisterTouchListener { + private class GesturesManagerInteractionListener implements MapboxMap.OnGesturesManagerInteractionListener { @Override public void onSetMapClickListener(MapboxMap.OnMapClickListener listener) { @@ -984,6 +987,56 @@ public class MapView extends FrameLayout { public void onRemoveFlingListener(MapboxMap.OnFlingListener listener) { mapGestureDetector.removeOnFlingListener(listener); } + + @Override + public void onAddMoveListener(MapboxMap.OnMoveListener listener) { + mapGestureDetector.addOnMoveListener(listener); + } + + @Override + public void onRemoveMoveListener(MapboxMap.OnMoveListener listener) { + mapGestureDetector.removeOnMoveListener(listener); + } + + @Override + public void onAddRotateListener(MapboxMap.OnRotateListener listener) { + mapGestureDetector.addOnRotateListener(listener); + } + + @Override + public void onRemoveRotateListener(MapboxMap.OnRotateListener listener) { + mapGestureDetector.removeOnRotateListener(listener); + } + + @Override + public void onAddScaleListener(MapboxMap.OnScaleListener listener) { + mapGestureDetector.addOnScaleListener(listener); + } + + @Override + public void onRemoveScaleListener(MapboxMap.OnScaleListener listener) { + mapGestureDetector.removeOnScaleListener(listener); + } + + @Override + public void onAddShoveListener(MapboxMap.OnShoveListener listener) { + mapGestureDetector.addShoveListener(listener); + } + + @Override + public void onRemoveShoveListener(MapboxMap.OnShoveListener listener) { + mapGestureDetector.removeShoveListener(listener); + } + + @Override + public AndroidGesturesManager getGesturesManager() { + return mapGestureDetector.getGesturesManager(); + } + + @Override + public void setGesturesManager(AndroidGesturesManager gesturesManager) { + mapGestureDetector.setGesturesManager(gesturesManager); + } } private static class MapZoomControllerListener implements ZoomButtonsController.OnZoomListener { @@ -1021,11 +1074,13 @@ public class MapView extends FrameLayout { } private void onZoom(boolean zoomIn, @Nullable PointF focalPoint) { - if (focalPoint != null) { - transform.zoom(zoomIn, focalPoint); + if (focalPoint == null) { + focalPoint = new PointF(mapWidth / 2, mapHeight / 2); + } + if (zoomIn) { + transform.zoomIn(focalPoint); } else { - PointF centerPoint = new PointF(mapWidth / 2, mapHeight / 2); - transform.zoom(zoomIn, centerPoint); + transform.zoomOut(focalPoint); } } } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java index 5573e2d243..69fc4d2f2d 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java @@ -17,6 +17,11 @@ import android.view.View; import android.view.ViewGroup; import com.mapbox.android.core.location.LocationEngine; +import com.mapbox.android.gestures.AndroidGesturesManager; +import com.mapbox.android.gestures.MoveGestureDetector; +import com.mapbox.android.gestures.RotateGestureDetector; +import com.mapbox.android.gestures.ShoveGestureDetector; +import com.mapbox.android.gestures.StandardScaleGestureDetector; import com.mapbox.geojson.Feature; import com.mapbox.geojson.Geometry; import com.mapbox.mapboxsdk.annotations.Annotation; @@ -73,13 +78,13 @@ public final class MapboxMap { private final MyLocationViewSettings myLocationViewSettings; private final CameraChangeDispatcher cameraChangeDispatcher; - private final OnRegisterTouchListener onRegisterTouchListener; + private final OnGesturesManagerInteractionListener onGesturesManagerInteractionListener; private MapboxMap.OnFpsChangedListener onFpsChangedListener; private PointF focalPoint; MapboxMap(NativeMapView map, Transform transform, UiSettings ui, TrackingSettings tracking, - MyLocationViewSettings myLocationView, Projection projection, OnRegisterTouchListener listener, + MyLocationViewSettings myLocationView, Projection projection, OnGesturesManagerInteractionListener listener, AnnotationManager annotations, CameraChangeDispatcher cameraChangeDispatcher) { this.nativeMapView = map; this.uiSettings = ui; @@ -88,7 +93,7 @@ public final class MapboxMap { this.myLocationViewSettings = myLocationView; this.annotationManager = annotations.bind(this); this.transform = transform; - this.onRegisterTouchListener = listener; + this.onGesturesManagerInteractionListener = listener; this.cameraChangeDispatcher = cameraChangeDispatcher; } @@ -1845,7 +1850,7 @@ public final class MapboxMap { */ @Deprecated public void setOnScrollListener(@Nullable OnScrollListener listener) { - onRegisterTouchListener.onSetScrollListener(listener); + onGesturesManagerInteractionListener.onSetScrollListener(listener); } /** @@ -1855,7 +1860,7 @@ public final class MapboxMap { * To unset the callback, use null. */ public void addOnScrollListener(@Nullable OnScrollListener listener) { - onRegisterTouchListener.onAddScrollListener(listener); + onGesturesManagerInteractionListener.onAddScrollListener(listener); } /** @@ -1865,7 +1870,7 @@ public final class MapboxMap { * To unset the callback, use null. */ public void removeOnScrollListener(@Nullable OnScrollListener listener) { - onRegisterTouchListener.onRemoveScrollListener(listener); + onGesturesManagerInteractionListener.onRemoveScrollListener(listener); } /** @@ -1877,7 +1882,7 @@ public final class MapboxMap { */ @Deprecated public void setOnFlingListener(@Nullable OnFlingListener listener) { - onRegisterTouchListener.onSetFlingListener(listener); + onGesturesManagerInteractionListener.onSetFlingListener(listener); } /** @@ -1887,7 +1892,7 @@ public final class MapboxMap { * To unset the callback, use null. */ public void addOnFlingListener(@Nullable OnFlingListener listener) { - onRegisterTouchListener.onAddFlingListener(listener); + onGesturesManagerInteractionListener.onAddFlingListener(listener); } /** @@ -1897,7 +1902,98 @@ public final class MapboxMap { * To unset the callback, use null. */ public void removeOnFlingListener(@Nullable OnFlingListener listener) { - onRegisterTouchListener.onRemoveFlingListener(listener); + onGesturesManagerInteractionListener.onRemoveFlingListener(listener); + } + + /** + * Adds a callback that's invoked when the map is moved. + * + * @param listener The callback that's invoked when the map is moved. + */ + public void addOnMoveListener(OnMoveListener listener) { + onGesturesManagerInteractionListener.onAddMoveListener(listener); + } + + /** + * Removes a callback that's invoked when the map is moved. + * + * @param listener The callback that's invoked when the map is moved. + */ + public void removeOnMoveListener(OnMoveListener listener) { + onGesturesManagerInteractionListener.onRemoveMoveListener(listener); + } + + /** + * Adds a callback that's invoked when the map is rotated. + * + * @param listener The callback that's invoked when the map is rotated. + */ + public void addOnRotateListener(OnRotateListener listener) { + onGesturesManagerInteractionListener.onAddRotateListener(listener); + } + + /** + * Removes a callback that's invoked when the map is rotated. + * + * @param listener The callback that's invoked when the map is rotated. + */ + public void removeOnRotateListener(OnRotateListener listener) { + onGesturesManagerInteractionListener.onRemoveRotateListener(listener); + } + + /** + * Adds a callback that's invoked when the map is scaled. + * + * @param listener The callback that's invoked when the map is scaled. + */ + public void addOnScaleListener(OnScaleListener listener) { + onGesturesManagerInteractionListener.onAddScaleListener(listener); + } + + /** + * Removes a callback that's invoked when the map is scaled. + * + * @param listener The callback that's invoked when the map is scaled. + */ + public void removeOnScaleListener(OnScaleListener listener) { + onGesturesManagerInteractionListener.onRemoveScaleListener(listener); + } + + /** + * Adds a callback that's invoked when the map is tilted. + * + * @param listener The callback that's invoked when the map is tilted. + */ + public void addOnShoveListener(OnShoveListener listener) { + onGesturesManagerInteractionListener.onAddShoveListener(listener); + } + + /** + * Remove a callback that's invoked when the map is tilted. + * + * @param listener The callback that's invoked when the map is tilted. + */ + public void removeOnShoveListener(OnShoveListener listener) { + onGesturesManagerInteractionListener.onRemoveShoveListener(listener); + } + + /** + * Sets a custom {@link AndroidGesturesManager} to handle {@link android.view.MotionEvent}s registered by the map. + * + * @param androidGesturesManager Gestures manager that interprets gestures based on the motion events. + * @see mapbox-gestures-android library + */ + public void setGesturesManager(AndroidGesturesManager androidGesturesManager) { + onGesturesManagerInteractionListener.setGesturesManager(androidGesturesManager); + } + + /** + * Get current {@link AndroidGesturesManager} that handles {@link android.view.MotionEvent}s registered by the map. + * + * @return Current gestures manager. + */ + public AndroidGesturesManager getGesturesManager() { + return onGesturesManagerInteractionListener.getGesturesManager(); } /** @@ -1909,7 +2005,7 @@ public final class MapboxMap { */ @Deprecated public void setOnMapClickListener(@Nullable OnMapClickListener listener) { - onRegisterTouchListener.onSetMapClickListener(listener); + onGesturesManagerInteractionListener.onSetMapClickListener(listener); } /** @@ -1919,7 +2015,7 @@ public final class MapboxMap { * To unset the callback, use null. */ public void addOnMapClickListener(@Nullable OnMapClickListener listener) { - onRegisterTouchListener.onAddMapClickListener(listener); + onGesturesManagerInteractionListener.onAddMapClickListener(listener); } /** @@ -1929,7 +2025,7 @@ public final class MapboxMap { * To unset the callback, use null. */ public void removeOnMapClickListener(@Nullable OnMapClickListener listener) { - onRegisterTouchListener.onRemoveMapClickListener(listener); + onGesturesManagerInteractionListener.onRemoveMapClickListener(listener); } /** @@ -1941,7 +2037,7 @@ public final class MapboxMap { */ @Deprecated public void setOnMapLongClickListener(@Nullable OnMapLongClickListener listener) { - onRegisterTouchListener.onSetMapLongClickListener(listener); + onGesturesManagerInteractionListener.onSetMapLongClickListener(listener); } /** @@ -1951,7 +2047,7 @@ public final class MapboxMap { * To unset the callback, use null. */ public void addOnMapLongClickListener(@Nullable OnMapLongClickListener listener) { - onRegisterTouchListener.onAddMapLongClickListener(listener); + onGesturesManagerInteractionListener.onAddMapLongClickListener(listener); } /** @@ -1961,7 +2057,7 @@ public final class MapboxMap { * To unset the callback, use null. */ public void removeOnMapLongClickListener(@Nullable OnMapLongClickListener listener) { - onRegisterTouchListener.onRemoveMapLongClickListener(listener); + onGesturesManagerInteractionListener.onRemoveMapLongClickListener(listener); } /** @@ -2220,7 +2316,9 @@ public final class MapboxMap { * Interface definition for a callback to be invoked when the map is scrolled. * * @see MapboxMap#setOnScrollListener(OnScrollListener) + * @deprecated Use {@link OnMoveListener} instead. */ + @Deprecated public interface OnScrollListener { /** * Called when the map is scrolled. @@ -2228,6 +2326,58 @@ public final class MapboxMap { void onScroll(); } + /** + * Interface definition for a callback to be invoked when the map is moved. + * + * @see MapboxMap#addOnMoveListener(OnMoveListener) + */ + public interface OnMoveListener { + void onMoveBegin(MoveGestureDetector detector); + + void onMove(MoveGestureDetector detector); + + void onMoveEnd(MoveGestureDetector detector); + } + + /** + * Interface definition for a callback to be invoked when the map is rotated. + * + * @see MapboxMap#addOnRotateListener(OnRotateListener) + */ + public interface OnRotateListener { + void onRotateBegin(RotateGestureDetector detector); + + void onRotate(RotateGestureDetector detector); + + void onRotateEnd(RotateGestureDetector detector); + } + + /** + * Interface definition for a callback to be invoked when the map is scaled. + * + * @see MapboxMap#addOnScaleListener(OnScaleListener) + */ + public interface OnScaleListener { + void onScaleBegin(StandardScaleGestureDetector detector); + + void onScale(StandardScaleGestureDetector detector); + + void onScaleEnd(StandardScaleGestureDetector detector); + } + + /** + * Interface definition for a callback to be invoked when the map is tilted. + * + * @see MapboxMap#addOnShoveListener(OnShoveListener) + */ + public interface OnShoveListener { + void onShoveBegin(ShoveGestureDetector detector); + + void onShove(ShoveGestureDetector detector); + + void onShoveEnd(ShoveGestureDetector detector); + } + /** * Interface definition for a callback to be invoked when the camera changes position. * @@ -2330,7 +2480,7 @@ public final class MapboxMap { * Interface definition for a callback to be invoked when a user registers an listener that is * related to touch and click events. */ - interface OnRegisterTouchListener { + interface OnGesturesManagerInteractionListener { void onSetMapClickListener(OnMapClickListener listener); void onAddMapClickListener(OnMapClickListener listener); @@ -2354,6 +2504,26 @@ public final class MapboxMap { void onAddFlingListener(OnFlingListener listener); void onRemoveFlingListener(OnFlingListener listener); + + void onAddMoveListener(OnMoveListener listener); + + void onRemoveMoveListener(OnMoveListener listener); + + void onAddRotateListener(OnRotateListener listener); + + void onRemoveRotateListener(OnRotateListener listener); + + void onAddScaleListener(OnScaleListener listener); + + void onRemoveScaleListener(OnScaleListener listener); + + void onAddShoveListener(OnShoveListener listener); + + void onRemoveShoveListener(OnShoveListener listener); + + AndroidGesturesManager getGesturesManager(); + + void setGesturesManager(AndroidGesturesManager gesturesManager); } /** diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java index 84a601039f..43c943a16f 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java @@ -205,6 +205,8 @@ final class Transform implements MapView.OnMapChangedListener { // cancel ongoing transitions mapView.cancelTransitions(); + + cameraChangeDispatcher.onCameraIdle(); } @UiThread @@ -235,39 +237,37 @@ final class Transform implements MapView.OnMapChangedListener { return mapView.getZoom(); } - void zoom(boolean zoomIn, @NonNull PointF focalPoint) { + void zoomIn(@NonNull PointF focalPoint) { CameraPosition cameraPosition = invalidateCameraPosition(); if (cameraPosition != null) { - int newZoom = (int) Math.round(cameraPosition.zoom + (zoomIn ? 1 : -1)); - setZoom(newZoom, focalPoint, MapboxConstants.ANIMATION_DURATION, false); - } else { - // we are not transforming, notify about being idle - cameraChangeDispatcher.onCameraIdle(); + int newZoom = (int) Math.round(cameraPosition.zoom + 1); + setZoom(newZoom, focalPoint, MapboxConstants.ANIMATION_DURATION); } } - void zoom(double zoomAddition, @NonNull PointF focalPoint, long duration) { + void zoomOut(@NonNull PointF focalPoint) { CameraPosition cameraPosition = invalidateCameraPosition(); if (cameraPosition != null) { - int newZoom = (int) Math.round(cameraPosition.zoom + zoomAddition); - setZoom(newZoom, focalPoint, duration, false); - } else { - // we are not transforming, notify about being idle - cameraChangeDispatcher.onCameraIdle(); + int newZoom = (int) Math.round(cameraPosition.zoom - 1); + setZoom(newZoom, focalPoint, MapboxConstants.ANIMATION_DURATION); } } + void zoomBy(double zoomAddition, @NonNull PointF focalPoint) { + setZoom(mapView.getZoom() + zoomAddition, focalPoint, 0); + } + void setZoom(double zoom, @NonNull PointF focalPoint) { - setZoom(zoom, focalPoint, 0, false); + setZoom(zoom, focalPoint, 0); } - void setZoom(double zoom, @NonNull PointF focalPoint, long duration, final boolean isAnimator) { + void setZoom(double zoom, @NonNull PointF focalPoint, long duration) { if (mapView != null) { mapView.addOnMapChangedListener(new MapView.OnMapChangedListener() { @Override public void onMapChanged(int change) { if (change == MapView.REGION_DID_CHANGE_ANIMATED) { - if (!isAnimator) { + if (duration > 0) { cameraChangeDispatcher.onCameraIdle(); } mapView.removeOnMapChangedListener(this); @@ -361,10 +361,6 @@ final class Transform implements MapView.OnMapChangedListener { } } - void zoomBy(double z, float x, float y) { - mapView.setZoom(mapView.getZoom() + z, new PointF(x, y), 0); - } - void moveBy(double offsetX, double offsetY, long duration) { if (duration > 0) { mapView.addOnMapChangedListener(new MapView.OnMapChangedListener() { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values/dimens.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values/dimens.xml index 1c6a265587..00fc05cf6d 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values/dimens.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values/dimens.xml @@ -6,4 +6,13 @@ 8dp 92dp 18dp + + + 150dp + + + 100dp + + + 0.025dp diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapTouchListenersTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapTouchListenersTest.java index eeb00355bd..5de55f47c9 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapTouchListenersTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapTouchListenersTest.java @@ -2,8 +2,13 @@ package com.mapbox.mapboxsdk.maps; import android.graphics.PointF; +import com.mapbox.android.gestures.MoveGestureDetector; +import com.mapbox.android.gestures.RotateGestureDetector; +import com.mapbox.android.gestures.ShoveGestureDetector; +import com.mapbox.android.gestures.StandardScaleGestureDetector; import com.mapbox.mapboxsdk.geometry.LatLng; +import org.junit.Before; import org.junit.Test; import static org.mockito.Mockito.mock; @@ -13,16 +18,23 @@ import static org.mockito.Mockito.when; public class MapTouchListenersTest { - @Test - public void onMapClickListenerTest() throws Exception { - LatLng latLng = new LatLng(); - PointF pointF = new PointF(); + private MapGestureDetector mapGestureDetector; + private LatLng latLng; + private PointF pointF; + + @Before + public void setUp() throws Exception { + latLng = new LatLng(); + pointF = new PointF(); Projection projection = mock(Projection.class); when(projection.fromScreenLocation(pointF)).thenReturn(latLng); - MapGestureDetector mapGestureDetector = new MapGestureDetector(null, - null, projection, null, null, null, null); + mapGestureDetector = new MapGestureDetector(null, + null, projection, null, null, null); + } + @Test + public void onMapClickListenerTest() throws Exception { MapboxMap.OnMapClickListener listener = mock(MapboxMap.OnMapClickListener.class); mapGestureDetector.addOnMapClickListener(listener); mapGestureDetector.notifyOnMapClickListeners(pointF); @@ -35,14 +47,6 @@ public class MapTouchListenersTest { @Test public void onMapLongClickListenerTest() throws Exception { - LatLng latLng = new LatLng(); - PointF pointF = new PointF(); - - Projection projection = mock(Projection.class); - when(projection.fromScreenLocation(pointF)).thenReturn(latLng); - MapGestureDetector mapGestureDetector = new MapGestureDetector(null, - null, projection, null, null, null, null); - MapboxMap.OnMapLongClickListener listener = mock(MapboxMap.OnMapLongClickListener.class); mapGestureDetector.addOnMapLongClickListener(listener); mapGestureDetector.notifyOnMapLongClickListeners(pointF); @@ -55,14 +59,6 @@ public class MapTouchListenersTest { @Test public void onFlingListenerTest() throws Exception { - LatLng latLng = new LatLng(); - PointF pointF = new PointF(); - - Projection projection = mock(Projection.class); - when(projection.fromScreenLocation(pointF)).thenReturn(latLng); - MapGestureDetector mapGestureDetector = new MapGestureDetector(null, - null, projection, null, null, null, null); - MapboxMap.OnFlingListener listener = mock(MapboxMap.OnFlingListener.class); mapGestureDetector.addOnFlingListener(listener); mapGestureDetector.notifyOnFlingListeners(); @@ -75,14 +71,6 @@ public class MapTouchListenersTest { @Test public void onScrollListenerTest() throws Exception { - LatLng latLng = new LatLng(); - PointF pointF = new PointF(); - - Projection projection = mock(Projection.class); - when(projection.fromScreenLocation(pointF)).thenReturn(latLng); - MapGestureDetector mapGestureDetector = new MapGestureDetector(null, - null, projection, null, null, null, null); - MapboxMap.OnScrollListener listener = mock(MapboxMap.OnScrollListener.class); mapGestureDetector.addOnScrollListener(listener); mapGestureDetector.notifyOnScrollListeners(); @@ -92,4 +80,88 @@ public class MapTouchListenersTest { mapGestureDetector.notifyOnScrollListeners(); verify(listener, times(1)).onScroll(); } + + @Test + public void onMoveListenerTest() throws Exception { + MapboxMap.OnMoveListener listener = mock(MapboxMap.OnMoveListener.class); + MoveGestureDetector detector = mock(MoveGestureDetector.class); + mapGestureDetector.addOnMoveListener(listener); + mapGestureDetector.notifyOnMoveBeginListeners(detector); + mapGestureDetector.notifyOnMoveListeners(detector); + mapGestureDetector.notifyOnMoveEndListeners(detector); + verify(listener, times(1)).onMoveBegin(detector); + verify(listener, times(1)).onMove(detector); + verify(listener, times(1)).onMoveEnd(detector); + + mapGestureDetector.removeOnMoveListener(listener); + mapGestureDetector.notifyOnMoveBeginListeners(detector); + mapGestureDetector.notifyOnMoveListeners(detector); + mapGestureDetector.notifyOnMoveEndListeners(detector); + verify(listener, times(1)).onMoveBegin(detector); + verify(listener, times(1)).onMove(detector); + verify(listener, times(1)).onMoveEnd(detector); + } + + @Test + public void onRotateListenerTest() throws Exception { + MapboxMap.OnRotateListener listener = mock(MapboxMap.OnRotateListener.class); + RotateGestureDetector detector = mock(RotateGestureDetector.class); + mapGestureDetector.addOnRotateListener(listener); + mapGestureDetector.notifyOnRotateBeginListeners(detector); + mapGestureDetector.notifyOnRotateListeners(detector); + mapGestureDetector.notifyOnRotateEndListeners(detector); + verify(listener, times(1)).onRotateBegin(detector); + verify(listener, times(1)).onRotate(detector); + verify(listener, times(1)).onRotateEnd(detector); + + mapGestureDetector.removeOnRotateListener(listener); + mapGestureDetector.notifyOnRotateBeginListeners(detector); + mapGestureDetector.notifyOnRotateListeners(detector); + mapGestureDetector.notifyOnRotateEndListeners(detector); + verify(listener, times(1)).onRotateBegin(detector); + verify(listener, times(1)).onRotate(detector); + verify(listener, times(1)).onRotateEnd(detector); + } + + @Test + public void onScaleListenerTest() throws Exception { + MapboxMap.OnScaleListener listener = mock(MapboxMap.OnScaleListener.class); + StandardScaleGestureDetector detector = mock(StandardScaleGestureDetector.class); + mapGestureDetector.addOnScaleListener(listener); + mapGestureDetector.notifyOnScaleBeginListeners(detector); + mapGestureDetector.notifyOnScaleListeners(detector); + mapGestureDetector.notifyOnScaleEndListeners(detector); + verify(listener, times(1)).onScaleBegin(detector); + verify(listener, times(1)).onScale(detector); + verify(listener, times(1)).onScaleEnd(detector); + + mapGestureDetector.removeOnScaleListener(listener); + mapGestureDetector.notifyOnScaleBeginListeners(detector); + mapGestureDetector.notifyOnScaleListeners(detector); + mapGestureDetector.notifyOnScaleEndListeners(detector); + verify(listener, times(1)).onScaleBegin(detector); + verify(listener, times(1)).onScale(detector); + verify(listener, times(1)).onScaleEnd(detector); + } + + @Test + public void onShoveListenerTest() throws Exception { + MapboxMap.OnShoveListener listener = mock(MapboxMap.OnShoveListener.class); + ShoveGestureDetector detector = mock(ShoveGestureDetector.class); + mapGestureDetector.addShoveListener(listener); + mapGestureDetector.notifyOnShoveBeginListeners(detector); + mapGestureDetector.notifyOnShoveListeners(detector); + mapGestureDetector.notifyOnShoveEndListeners(detector); + verify(listener, times(1)).onShoveBegin(detector); + verify(listener, times(1)).onShove(detector); + verify(listener, times(1)).onShoveEnd(detector); + + mapGestureDetector.removeShoveListener(listener); + mapGestureDetector.notifyOnShoveBeginListeners(detector); + mapGestureDetector.notifyOnShoveListeners(detector); + mapGestureDetector.notifyOnShoveEndListeners(detector); + verify(listener, times(1)).onShoveBegin(detector); + verify(listener, times(1)).onShove(detector); + verify(listener, times(1)).onShoveEnd(detector); + } } diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java index 5e9f94db28..d61947f00e 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java @@ -23,7 +23,7 @@ public class MapboxMapTest { mock(TrackingSettings.class), mock(MyLocationViewSettings.class), mock(Projection.class), - mock(MapboxMap.OnRegisterTouchListener.class), + mock(MapboxMap.OnGesturesManagerInteractionListener.class), mock(AnnotationManager.class), mock(CameraChangeDispatcher.class)); } diff --git a/platform/android/gradle/dependencies.gradle b/platform/android/gradle/dependencies.gradle index 4ef4ae2f7d..550f44ee26 100644 --- a/platform/android/gradle/dependencies.gradle +++ b/platform/android/gradle/dependencies.gradle @@ -8,24 +8,26 @@ ext { ] versions = [ - mapboxServices: '3.0.0-beta.2', + mapboxServices : '3.0.0-beta.2', mapboxTelemetry: '3.0.0-beta.1', - supportLib : '25.4.0', - espresso : '3.0.1', - testRunner : '1.0.1', - leakCanary : '1.5.1', - lost : '3.0.4', - junit : '4.12', - mockito : '2.10.0', - robolectric : '3.5.1', - timber : '4.5.1', - okhttp : '3.9.1' + mapboxGestures : '0.1.0-20180227.133736-12', + supportLib : '25.4.0', + espresso : '3.0.1', + testRunner : '1.0.1', + leakCanary : '1.5.1', + lost : '3.0.4', + junit : '4.12', + mockito : '2.10.0', + robolectric : '3.5.1', + timber : '4.5.1', + okhttp : '3.9.1' ] dependenciesList = [ mapboxJavaServices : "com.mapbox.mapboxsdk:mapbox-sdk-services:${versions.mapboxServices}", mapboxJavaGeoJSON : "com.mapbox.mapboxsdk:mapbox-sdk-geojson:${versions.mapboxServices}", mapboxAndroidTelemetry: "com.mapbox.mapboxsdk:mapbox-android-telemetry:${versions.mapboxTelemetry}", + mapboxAndroidGestures : "com.mapbox.mapboxsdk:mapbox-android-gestures:${versions.mapboxGestures}@aar", // for testApp mapboxJavaTurf : "com.mapbox.mapboxsdk:mapbox-sdk-turf:${versions.mapboxServices}", -- cgit v1.2.1 From 2dddcba3fc6f99de3046a6b5c69651a690b58509 Mon Sep 17 00:00:00 2001 From: Molly Lloyd Date: Tue, 27 Feb 2018 15:12:25 -0800 Subject: [ios, macos] cherry-pick darwin changes to tileset encoding param onto boba (#11324) * [ios, macos] add tileset encoding option to darwin sources (#11274) * add tileset encoding option to darwin sources * correct style guide * link out to dem encoding docs * markdownify comments * correct changelog --- .../darwin/docs/guides/For Style Authors.md.ejs | 1 + platform/darwin/src/MGLTileSource.h | 30 ++++++++++++++++++++++ platform/darwin/src/MGLTileSource.mm | 18 +++++++++++++ platform/darwin/test/MGLTileSetTests.mm | 17 ++++++++++++ platform/ios/CHANGELOG.md | 2 +- platform/ios/docs/guides/For Style Authors.md | 1 + platform/macos/docs/guides/For Style Authors.md | 1 + 7 files changed, 69 insertions(+), 1 deletion(-) diff --git a/platform/darwin/docs/guides/For Style Authors.md.ejs b/platform/darwin/docs/guides/For Style Authors.md.ejs index 37af150ac5..2ba7757fdf 100644 --- a/platform/darwin/docs/guides/For Style Authors.md.ejs +++ b/platform/darwin/docs/guides/For Style Authors.md.ejs @@ -205,6 +205,7 @@ In style JSON | In TileJSON | In the SDK `tileSize` | — | `MGLTileSourceOptionTileSize` `attribution` | `attribution` | `MGLTileSourceOptionAttributionHTMLString` (but consider specifying `MGLTileSourceOptionAttributionInfos` instead for improved security) `scheme` | `scheme` | `MGLTileSourceOptionTileCoordinateSystem` +`encoding` | – | `MGLTileSourceOptionDEMEncoding` ### Shape sources diff --git a/platform/darwin/src/MGLTileSource.h b/platform/darwin/src/MGLTileSource.h index 3dc268db60..2d75fa14d8 100644 --- a/platform/darwin/src/MGLTileSource.h +++ b/platform/darwin/src/MGLTileSource.h @@ -117,6 +117,7 @@ extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionAttributionInfos; */ extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionTileCoordinateSystem; + /** Tile coordinate systems that determine how tile coordinates in tile URLs are interpreted. @@ -141,6 +142,35 @@ typedef NS_ENUM(NSUInteger, MGLTileCoordinateSystem) { MGLTileCoordinateSystemTMS }; + +/** + An `NSNumber` object containing an unsigned integer that specifies the encoding + formula for raster-dem tilesets. The integer corresponds to one of + the constants described in `MGLDEMEncoding`. + + The default value for this option is `MGLDEMEncodingMapbox`. + + This option is not supported by the TileJSON spec. + */ +extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionDEMEncoding; + +/** + The encoding formula used to generate the raster-dem tileset +*/ + +typedef NS_ENUM(NSUInteger, MGLDEMEncoding) { + + /** + Raster tiles generated with the [Mapbox encoding formula](https://www.mapbox.com/help/access-elevation-data/#mapbox-terrain-rgb). + */ + MGLDEMEncodingMapbox = 0, + + /** + Raster tiles generated with the [Mapzen Terrarium encoding formula](https://aws.amazon.com/public-datasets/terrain/). + */ + MGLDEMEncodingTerrarium +}; + /** `MGLTileSource` is a map content source that supplies map tiles to be shown on the map. The location of and metadata about the tiles are defined either by an diff --git a/platform/darwin/src/MGLTileSource.mm b/platform/darwin/src/MGLTileSource.mm index bc985bd728..c37812ab8e 100644 --- a/platform/darwin/src/MGLTileSource.mm +++ b/platform/darwin/src/MGLTileSource.mm @@ -19,6 +19,7 @@ const MGLTileSourceOption MGLTileSourceOptionCoordinateBounds = @"MGLTileSourceO const MGLTileSourceOption MGLTileSourceOptionAttributionHTMLString = @"MGLTileSourceOptionAttributionHTMLString"; const MGLTileSourceOption MGLTileSourceOptionAttributionInfos = @"MGLTileSourceOptionAttributionInfos"; const MGLTileSourceOption MGLTileSourceOptionTileCoordinateSystem = @"MGLTileSourceOptionTileCoordinateSystem"; +const MGLTileSourceOption MGLTileSourceOptionDEMEncoding = @"MGLTileSourceOptionDEMEncoding"; @implementation MGLTileSource @@ -129,5 +130,22 @@ mbgl::Tileset MGLTileSetFromTileURLTemplates(NS_ARRAY_OF(NSString *) *tileURLTem } } + if (NSNumber *demEncodingNumber = options[MGLTileSourceOptionDEMEncoding]) { + if (![demEncodingNumber isKindOfClass:[NSValue class]]) { + [NSException raise:NSInvalidArgumentException + format:@"MGLTileSourceOptionDEMEncoding must be set to an NSValue or NSNumber."]; + } + MGLDEMEncoding demEncoding; + [demEncodingNumber getValue:&demEncoding]; + switch (demEncoding) { + case MGLDEMEncodingMapbox: + tileSet.encoding = mbgl::Tileset::DEMEncoding::Mapbox; + break; + case MGLDEMEncodingTerrarium: + tileSet.encoding = mbgl::Tileset::DEMEncoding::Terrarium; + break; + } + } + return tileSet; } diff --git a/platform/darwin/test/MGLTileSetTests.mm b/platform/darwin/test/MGLTileSetTests.mm index 4d5e1fcd05..74c84184e1 100644 --- a/platform/darwin/test/MGLTileSetTests.mm +++ b/platform/darwin/test/MGLTileSetTests.mm @@ -102,6 +102,23 @@ // the scheme is reflected by the mbgl tileset XCTAssertEqual(tileSet.scheme, mbgl::Tileset::Scheme::TMS); + + // when the dem enciding is changed using an NSNumber + tileSet = MGLTileSetFromTileURLTemplates(tileURLTemplates, @{ + MGLTileSourceOptionDEMEncoding: @(MGLDEMEncodingTerrarium), + }); + + // the encoding is reflected by the mbgl tileset + XCTAssertEqual(tileSet.encoding, mbgl::Tileset::DEMEncoding::Terrarium); + + // when the dem enciding is changed using an NSValue + MGLDEMEncoding terrarium = MGLDEMEncodingTerrarium; + tileSet = MGLTileSetFromTileURLTemplates(tileURLTemplates, @{ + MGLTileSourceOptionDEMEncoding: [NSValue value:&terrarium withObjCType:@encode(MGLDEMEncoding)], + }); + + // the encoding is reflected by the mbgl tileset + XCTAssertEqual(tileSet.encoding, mbgl::Tileset::DEMEncoding::Terrarium); } - (void)testInvalidTileSet { diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 7e82bf7dc7..739ff50a28 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -18,7 +18,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * A style can now display smooth hillshading and customize its appearance at runtime using the `MGLHillshadeStyleLayer` class. Hillshading is based on a rasterized digital elevation model supplied by the `MGLRasterDEMSource` class. ([#10642](https://github.com/mapbox/mapbox-gl-native/pull/10642)) * The `MGLSymbolStyleLayer.textFontNames` property can now depend on a feature’s attributes. ([#10850](https://github.com/mapbox/mapbox-gl-native/pull/10850)) * Added `MGLShapeSourceOptionWrapsCoordinates`, to specify whether the shape of an `MGLComputedShapeSource` should be wrapped to accommodate coordinates with longitudes beyond −180 and 180; and `MGLShapeSourceOptionClipsCoordinates`, to specify whether the shape of an `MGLComputedShapeSource` should be clipped at the edge of each tile. ([#11041](https://github.com/mapbox/mapbox-gl-native/pull/11041)) -* Added support for Mapzen Terrarium DEM encoding. ([#11154](https://github.com/mapbox/mapbox-gl-native/pull/11154)) +* Added support for Mapzen Terrarium DEM encoding. ([#11274](https://github.com/mapbox/mapbox-gl-native/pull/11274)) ### Map rendering diff --git a/platform/ios/docs/guides/For Style Authors.md b/platform/ios/docs/guides/For Style Authors.md index 02d23067ef..1f2803f3ec 100644 --- a/platform/ios/docs/guides/For Style Authors.md +++ b/platform/ios/docs/guides/For Style Authors.md @@ -154,6 +154,7 @@ In style JSON | In TileJSON | In the SDK `tileSize` | — | `MGLTileSourceOptionTileSize` `attribution` | `attribution` | `MGLTileSourceOptionAttributionHTMLString` (but consider specifying `MGLTileSourceOptionAttributionInfos` instead for improved security) `scheme` | `scheme` | `MGLTileSourceOptionTileCoordinateSystem` +`encoding` | – | `MGLTileSourceOptionDEMEncoding` ### Shape sources diff --git a/platform/macos/docs/guides/For Style Authors.md b/platform/macos/docs/guides/For Style Authors.md index de838cd78f..636cfa7eb7 100644 --- a/platform/macos/docs/guides/For Style Authors.md +++ b/platform/macos/docs/guides/For Style Authors.md @@ -141,6 +141,7 @@ In style JSON | In TileJSON | In the SDK `tileSize` | — | `MGLTileSourceOptionTileSize` `attribution` | `attribution` | `MGLTileSourceOptionAttributionHTMLString` (but consider specifying `MGLTileSourceOptionAttributionInfos` instead for improved security) `scheme` | `scheme` | `MGLTileSourceOptionTileCoordinateSystem` +`encoding` | – | `MGLTileSourceOptionDEMEncoding` ### Shape sources -- cgit v1.2.1 From 66609c975108d44483f4976dc2d73bd26849fac6 Mon Sep 17 00:00:00 2001 From: Chris Loer Date: Thu, 15 Feb 2018 09:51:34 -0800 Subject: [ios] Add "clear tile cache on entering background" to changelog. --- platform/ios/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 739ff50a28..9eb522f2b7 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -29,6 +29,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * Fixed an issue preventing `MGLImageSource`s from drawing on the map when the map is zoomed in and tilted. ([#10677](https://github.com/mapbox/mapbox-gl-native/pull/10677)) * Improved the sharpness of raster tiles on Retina displays. ([#10984](https://github.com/mapbox/mapbox-gl-native/pull/10984)) * Fixed a crash parsing a malformed style. ([#11001](https://github.com/mapbox/mapbox-gl-native/pull/11001)) +* Reduced memory usage by clearing in-memory tile cache before entering background. ([#11197](https://github.com/mapbox/mapbox-gl-native/pull/11197)) ### Annotations -- cgit v1.2.1 From 68a9e2ea926db80010ade77cda77ced53d412b28 Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Fri, 5 Jan 2018 04:06:44 -0500 Subject: [ios] Provide haptic feedback when user rotates to due north --- platform/ios/CHANGELOG.md | 1 + platform/ios/src/MGLMapView.h | 13 +++++++++++++ platform/ios/src/MGLMapView.mm | 21 +++++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 9eb522f2b7..b0f3e741e6 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -48,6 +48,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * Labels are now transliterated from more languages when VoiceOver is enabled. ([#10881](https://github.com/mapbox/mapbox-gl-native/pull/10881)) * Long-pressing the attribution button causes the SDK’s version number to be displayed in the action sheet that appears. ([#10650](https://github.com/mapbox/mapbox-gl-native/pull/10650)) * Reduced offline download size for styles with symbol layers that render only icons, and no text. ([#11055](https://github.com/mapbox/mapbox-gl-native/pull/11055)) +* Added haptic feedback that occurs when the user rotates the map to due north, configurable via `MGLMapView.hapticFeedbackEnabled`. ([#10847](https://github.com/mapbox/mapbox-gl-native/pull/10847)) ## 3.7.5 - February 16, 2018 diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h index 9c18965b09..44130f3c6d 100644 --- a/platform/ios/src/MGLMapView.h +++ b/platform/ios/src/MGLMapView.h @@ -483,6 +483,19 @@ MGL_EXPORT IB_DESIGNABLE */ @property(nonatomic, getter=isPitchEnabled) BOOL pitchEnabled; +/** + A Boolean value that determines whether the user will receive haptic feedback + for certain interactions with the map. + + When this property is set to `YES`, the default, a `UIImpactFeedbackStyleLight` + haptic feedback event be played when the user rotates the map to due north + (0°). + + This feature requires a device that supports haptic feedback, running iOS 10 or + newer. + */ +@property(nonatomic, getter=isHapticFeedbackEnabled) BOOL hapticFeedbackEnabled; + /** A floating-point value that determines the rate of deceleration after the user lifts their finger. diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 1cb4779555..bb8948150f 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -228,6 +228,7 @@ public: @property (nonatomic) CGFloat quickZoomStart; @property (nonatomic, getter=isDormant) BOOL dormant; @property (nonatomic, readonly, getter=isRotationAllowed) BOOL rotationAllowed; +@property (nonatomic) BOOL shouldTriggerHapticFeedbackForCompass; @property (nonatomic) MGLMapViewProxyAccessibilityElement *mapViewProxyAccessibilityElement; @property (nonatomic) MGLAnnotationContainerView *annotationContainerView; @property (nonatomic) MGLUserLocation *userLocation; @@ -525,6 +526,8 @@ public: [_twoFingerTap requireGestureRecognizerToFail:_twoFingerDrag]; [self addGestureRecognizer:_twoFingerTap]; + _hapticFeedbackEnabled = YES; + _decelerationRate = MGLMapViewDecelerationRateNormal; _quickZoom = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleQuickZoomGesture:)]; @@ -1513,6 +1516,8 @@ public: self.userTrackingMode = MGLUserTrackingModeFollow; } + self.shouldTriggerHapticFeedbackForCompass = NO; + [self notifyGestureDidBegin]; } else if (rotate.state == UIGestureRecognizerStateChanged) @@ -1535,6 +1540,22 @@ public: } [self cameraIsChanging]; + + // Trigger a light haptic feedback event when the user rotates to due north. + if (@available(iOS 10.0, *)) + { + if (self.isHapticFeedbackEnabled && fabs(newDegrees) <= 1 && self.shouldTriggerHapticFeedbackForCompass) + { + UIImpactFeedbackGenerator *hapticFeedback = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleLight]; + [hapticFeedback impactOccurred]; + + self.shouldTriggerHapticFeedbackForCompass = NO; + } + else if (fabs(newDegrees) > 1) + { + self.shouldTriggerHapticFeedbackForCompass = YES; + } + } } else if (rotate.state == UIGestureRecognizerStateEnded || rotate.state == UIGestureRecognizerStateCancelled) { -- cgit v1.2.1 From ab27e24ab0dd906668d73d35cbece8768dfd02c8 Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Fri, 5 Jan 2018 04:08:44 -0500 Subject: [ios] Restore iosapp's HUD visibility, adjust placement --- platform/ios/app/MBXViewController.m | 9 +++++- platform/ios/app/Main.storyboard | 60 +++++++++++++++++++----------------- 2 files changed, 40 insertions(+), 29 deletions(-) diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index 3d0abf0a24..5b9363af27 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -166,7 +166,6 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { self.debugLoggingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:@"MGLMapboxMetricsDebugLoggingEnabled"]; self.mapView.scaleBar.hidden = NO; self.mapView.showsUserHeadingIndicator = YES; - self.hudLabel.hidden = YES; if ([UIFont respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) { self.hudLabel.titleLabel.font = [UIFont monospacedDigitSystemFontOfSize:10 weight:UIFontWeightRegular]; } @@ -216,6 +215,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { [defaults setInteger:self.mapView.userTrackingMode forKey:@"MBXUserTrackingMode"]; [defaults setBool:self.mapView.showsUserLocation forKey:@"MBXShowsUserLocation"]; [defaults setInteger:self.mapView.debugMask forKey:@"MBXDebugMask"]; + [defaults setBool:self.showZoomLevelEnabled forKey:@"MBXShowsZoomLevelHUD"]; [defaults synchronize]; } @@ -241,6 +241,11 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { { self.mapView.debugMask = (MGLMapDebugMaskOptions)uncheckedDebugMask; } + if ([defaults boolForKey:@"MBXShowsZoomLevelHUD"]) + { + self.showZoomLevelEnabled = YES; + [self updateHUD]; + } } - (UIInterfaceOrientationMask)supportedInterfaceOrientations @@ -1898,6 +1903,8 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { - (void)updateHUD { if (!self.reuseQueueStatsEnabled && !self.showZoomLevelEnabled) return; + if (self.hudLabel.hidden) self.hudLabel.hidden = NO; + NSString *hudString; if (self.reuseQueueStatsEnabled) { diff --git a/platform/ios/app/Main.storyboard b/platform/ios/app/Main.storyboard index 507582213f..04e4f9ab45 100644 --- a/platform/ios/app/Main.storyboard +++ b/platform/ios/app/Main.storyboard @@ -1,11 +1,11 @@ - + - + @@ -26,40 +26,44 @@ + + + + + + + + - - - - @@ -133,14 +137,14 @@