Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Podspec / submodule updates for 5.6.0-beta.1, adapt to gl-native immutable GeoJSON sources #100

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mapbox-gl-js
Submodule mapbox-gl-js added at 8e267f
29 changes: 15 additions & 14 deletions platform/darwin/src/MGLShapeSource.mm
Original file line number Diff line number Diff line change
Expand Up @@ -27,63 +27,64 @@
const MGLShapeSourceOption MGLShapeSourceOptionSimplificationTolerance = @"MGLShapeSourceOptionSimplificationTolerance";
const MGLShapeSourceOption MGLShapeSourceOptionLineDistanceMetrics = @"MGLShapeSourceOptionLineDistanceMetrics";

mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NSDictionary<MGLShapeSourceOption, id> *options) {
auto geoJSONOptions = mbgl::style::GeoJSONOptions();
mbgl::Immutable<mbgl::style::GeoJSONOptions> MGLGeoJSONOptionsFromDictionary(NSDictionary<MGLShapeSourceOption, id> *options) {

auto geoJSONOptions = mbgl::makeMutable<mbgl::style::GeoJSONOptions>();

if (NSNumber *value = options[MGLShapeSourceOptionMinimumZoomLevel]) {
if (![value isKindOfClass:[NSNumber class]]) {
[NSException raise:NSInvalidArgumentException
format:@"MGLShapeSourceOptionMaximumZoomLevel must be an NSNumber."];
}
geoJSONOptions.minzoom = value.integerValue;
geoJSONOptions->minzoom = value.integerValue;
}

if (NSNumber *value = options[MGLShapeSourceOptionMaximumZoomLevel]) {
if (![value isKindOfClass:[NSNumber class]]) {
[NSException raise:NSInvalidArgumentException
format:@"MGLShapeSourceOptionMaximumZoomLevel must be an NSNumber."];
}
geoJSONOptions.maxzoom = value.integerValue;
geoJSONOptions->maxzoom = value.integerValue;
}

if (NSNumber *value = options[MGLShapeSourceOptionBuffer]) {
if (![value isKindOfClass:[NSNumber class]]) {
[NSException raise:NSInvalidArgumentException
format:@"MGLShapeSourceOptionBuffer must be an NSNumber."];
}
geoJSONOptions.buffer = value.integerValue;
geoJSONOptions->buffer = value.integerValue;
}

if (NSNumber *value = options[MGLShapeSourceOptionSimplificationTolerance]) {
if (![value isKindOfClass:[NSNumber class]]) {
[NSException raise:NSInvalidArgumentException
format:@"MGLShapeSourceOptionSimplificationTolerance must be an NSNumber."];
}
geoJSONOptions.tolerance = value.doubleValue;
geoJSONOptions->tolerance = value.doubleValue;
}

if (NSNumber *value = options[MGLShapeSourceOptionClusterRadius]) {
if (![value isKindOfClass:[NSNumber class]]) {
[NSException raise:NSInvalidArgumentException
format:@"MGLShapeSourceOptionClusterRadius must be an NSNumber."];
}
geoJSONOptions.clusterRadius = value.integerValue;
geoJSONOptions->clusterRadius = value.integerValue;
}

if (NSNumber *value = options[MGLShapeSourceOptionMaximumZoomLevelForClustering]) {
if (![value isKindOfClass:[NSNumber class]]) {
[NSException raise:NSInvalidArgumentException
format:@"MGLShapeSourceOptionMaximumZoomLevelForClustering must be an NSNumber."];
}
geoJSONOptions.clusterMaxZoom = value.integerValue;
geoJSONOptions->clusterMaxZoom = value.integerValue;
}

if (NSNumber *value = options[MGLShapeSourceOptionClustered]) {
if (![value isKindOfClass:[NSNumber class]]) {
[NSException raise:NSInvalidArgumentException
format:@"MGLShapeSourceOptionClustered must be an NSNumber."];
}
geoJSONOptions.cluster = value.boolValue;
geoJSONOptions->cluster = value.boolValue;
}

if (NSDictionary *value = options[MGLShapeSourceOptionClusterProperties]) {
Expand Down Expand Up @@ -133,7 +134,7 @@

std::string keyString = std::string([key UTF8String]);

geoJSONOptions.clusterProperties.emplace(keyString, std::make_pair(std::move(map), std::move(reduce)));
geoJSONOptions->clusterProperties.emplace(keyString, std::make_pair(std::move(map), std::move(reduce)));
}
}

Expand All @@ -142,10 +143,10 @@
[NSException raise:NSInvalidArgumentException
format:@"MGLShapeSourceOptionLineDistanceMetrics must be an NSNumber."];
}
geoJSONOptions.lineMetrics = value.boolValue;
geoJSONOptions->lineMetrics = value.boolValue;
}

return geoJSONOptions;
return mbgl::makeMutable<mbgl::style::GeoJSONOptions>(std::move(geoJSONOptions));
}

@interface MGLShapeSource ()
Expand All @@ -159,7 +160,7 @@ @implementation MGLShapeSource

- (instancetype)initWithIdentifier:(NSString *)identifier URL:(NSURL *)url options:(NSDictionary<NSString *, id> *)options {
auto geoJSONOptions = MGLGeoJSONOptionsFromDictionary(options);
auto source = std::make_unique<mbgl::style::GeoJSONSource>(identifier.UTF8String, geoJSONOptions);
auto source = std::make_unique<mbgl::style::GeoJSONSource>(identifier.UTF8String, std::move(geoJSONOptions));
if (self = [super initWithPendingSource:std::move(source)]) {
self.URL = url;
}
Expand All @@ -168,7 +169,7 @@ - (instancetype)initWithIdentifier:(NSString *)identifier URL:(NSURL *)url optio

- (instancetype)initWithIdentifier:(NSString *)identifier shape:(nullable MGLShape *)shape options:(NSDictionary<MGLShapeSourceOption, id> *)options {
auto geoJSONOptions = MGLGeoJSONOptionsFromDictionary(options);
auto source = std::make_unique<mbgl::style::GeoJSONSource>(identifier.UTF8String, geoJSONOptions);
auto source = std::make_unique<mbgl::style::GeoJSONSource>(identifier.UTF8String, std::move(geoJSONOptions));
if (self = [super initWithPendingSource:std::move(source)]) {
if ([shape isMemberOfClass:[MGLShapeCollection class]]) {
static dispatch_once_t onceToken;
Expand Down
3 changes: 2 additions & 1 deletion platform/darwin/src/MGLShapeSource_Private.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#import "MGLFoundation.h"
#import "MGLShapeSource.h"
#include <mbgl/util/immutable.hpp>

NS_ASSUME_NONNULL_BEGIN

Expand All @@ -10,7 +11,7 @@ namespace mbgl {
}

MGL_EXPORT
mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NSDictionary<MGLShapeSourceOption, id> *options);
mbgl::Immutable<mbgl::style::GeoJSONOptions> MGLGeoJSONOptionsFromDictionary(NSDictionary<MGLShapeSourceOption, id> *options);

@interface MGLShapeSource (Private)

Expand Down
16 changes: 8 additions & 8 deletions platform/darwin/test/MGLShapeSourceTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ - (void)testGeoJSONOptionsFromDictionary {
MGLShapeSourceOptionLineDistanceMetrics: @YES};

auto mbglOptions = MGLGeoJSONOptionsFromDictionary(options);
XCTAssertTrue(mbglOptions.cluster);
XCTAssertEqual(mbglOptions.clusterRadius, 42);
XCTAssertEqual(mbglOptions.clusterMaxZoom, 98);
XCTAssertEqual(mbglOptions.maxzoom, 99);
XCTAssertEqual(mbglOptions.buffer, 1976);
XCTAssertEqual(mbglOptions.tolerance, 0.42);
XCTAssertTrue(mbglOptions.lineMetrics);
XCTAssertTrue(!mbglOptions.clusterProperties.empty());
XCTAssertTrue(mbglOptions->cluster);
XCTAssertEqual(mbglOptions->clusterRadius, 42);
XCTAssertEqual(mbglOptions->clusterMaxZoom, 98);
XCTAssertEqual(mbglOptions->maxzoom, 99);
XCTAssertEqual(mbglOptions->buffer, 1976);
XCTAssertEqual(mbglOptions->tolerance, 0.42);
XCTAssertTrue(mbglOptions->lineMetrics);
XCTAssertTrue(!mbglOptions->clusterProperties.empty());

options = @{MGLShapeSourceOptionClustered: @"number 1"};
XCTAssertThrows(MGLGeoJSONOptionsFromDictionary(options));
Expand Down
10 changes: 5 additions & 5 deletions platform/ios/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT

## 5.6.0

* No public-facing changes in v5.6.0-alpha.2.
* No public-facing changes in v5.6.0-beta.1.

### Packaging
* Integrates [`MapboxMobileEvents`](https://github.com/mapbox/mapbox-events-ios) as a dependency. ([#60](https://github.com/mapbox/mapbox-gl-native-ios/pull/60))
- CocoaPods: no change.
- Carthage: as an interim measure, please specify `github "mapbox/mapbox-events-ios" == 0.10.1-alpha` in your Cartfile.
- Manual installation: New Github release artifact (`mapbox-ios-sdk-5.6.0-alpha.1-dynamic-with-events.zip`) contains the `MapboxMobileEvents.framework`; please install this along with `Mapbox.framework`
* Integrates [`MapboxMobileEvents`](https://github.com/mapbox/mapbox-events-ios) as a dependency ([#60](https://github.com/mapbox/mapbox-gl-native-ios/pull/60)). As a result, the following installation processes have changed:
- CocoaPods: You now must include `use frameworks!` in your Podfile.
- Carthage: Specify `github "mapbox/mapbox-events-ios" == 0.10.2` in your Cartfile. Additionally, please note that if you are using `--no-use-binaries`, the `MapboxMobileEvents.framework` will still be installed as a dynamic framework.
- Manual installation: New Github release artifact (`mapbox-ios-sdk-5.6.0-beta.2-dynamic-with-events.zip`) contains the `MapboxMobileEvents.framework`; please install this along with `Mapbox.framework`

### Networking and storage
* Make network requests for expired resources lower priority than requests for new resources. ([#15950](https://github.com/mapbox/mapbox-gl-native/pull/15950))
Expand Down
7 changes: 7 additions & 0 deletions platform/ios/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ You can alternatively install the SDK as a static framework:

For instructions on installing stable release versions of the Mapbox Maps SDK for iOS with CocoaPods, see [our website](https://www.mapbox.com/install/ios/cocoapods/).

As of v5.6.0, you must specify `use_frameworks!` in your Podfile.

##### Testing pre-releases with CocoaPods

To test pre-releases of the dynamic framework, directly specify the version in your `Podfile`:
Expand Down Expand Up @@ -162,14 +164,19 @@ Note that these builds lack some debugging information, which could make develop

For instructions on installing stable release versions of the Mapbox Maps SDK for iOS with Carthage, see [our website](https://www.mapbox.com/install/ios/carthage/).

Please note that as of ios-v5.6.0-alpha.2, `--no-use-binaries` has no affect on projects built with the Mapbox framework.

##### Testing pre-releases with Carthage

To test pre-releases of the dynamic framework, directly specify the version in your Cartfile:

```json
binary "https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json" ~> x.x.x-alpha.1
github "mapbox/mapbox-events-ios" == x.x.x
```

Where `x.x.x` is the latest version of the [Mapbox Mobile Events](https://github.com/mapbox/mapbox-events-ios) library.

##### Testing snapshot releases with Carthage

This project does not currently support using snapshot releases via Carthage.
Expand Down
2 changes: 1 addition & 1 deletion platform/ios/Mapbox-iOS-SDK-snapshot-dynamic.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |m|

version = '5.6.0-alpha.2'
version = '5.6.0-beta.1'

m.name = 'Mapbox-iOS-SDK-snapshot-dynamic'
m.version = "#{version}-snapshot"
Expand Down
2 changes: 1 addition & 1 deletion platform/ios/Mapbox-iOS-SDK-stripped.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |m|

version = '5.6.0-alpha.2'
version = '5.6.0-beta.1'

m.name = 'Mapbox-iOS-SDK-stripped'
m.version = "#{version}-stripped"
Expand Down
2 changes: 1 addition & 1 deletion platform/ios/Mapbox-iOS-SDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |m|

version = '5.6.0-alpha.2'
version = '5.6.0-beta.1'

m.name = 'Mapbox-iOS-SDK'
m.version = version
Expand Down
1 change: 1 addition & 0 deletions vendor/benchmark
Submodule benchmark added at e776aa
1 change: 1 addition & 0 deletions vendor/boost
Submodule boost added at e841ea
1 change: 1 addition & 0 deletions vendor/cheap-ruler-cpp
Submodule cheap-ruler-cpp added at 98cbe7
1 change: 1 addition & 0 deletions vendor/earcut.hpp
Submodule earcut.hpp added at a38076
1 change: 1 addition & 0 deletions vendor/eternal
Submodule eternal added at 960f4c
1 change: 1 addition & 0 deletions vendor/geojson-vt-cpp
Submodule geojson-vt-cpp added at 32020b
1 change: 1 addition & 0 deletions vendor/geojson.hpp
Submodule geojson.hpp added at 97f81e
1 change: 1 addition & 0 deletions vendor/geometry.hpp
Submodule geometry.hpp added at c83a2a
1 change: 1 addition & 0 deletions vendor/glfw
Submodule glfw added at 53c8c7
1 change: 1 addition & 0 deletions vendor/jni.hpp
Submodule jni.hpp added at 8f55ac
1 change: 1 addition & 0 deletions vendor/kdbush.hpp
Submodule kdbush.hpp added at bbbbf6
2 changes: 1 addition & 1 deletion vendor/mapbox-gl-native
Submodule mapbox-gl-native updated 3387 files
1 change: 1 addition & 0 deletions vendor/optional
Submodule optional added at 5f08e2
1 change: 1 addition & 0 deletions vendor/pixelmatch-cpp
Submodule pixelmatch-cpp added at 61f433
1 change: 1 addition & 0 deletions vendor/polylabel
Submodule polylabel added at 51f09d
1 change: 1 addition & 0 deletions vendor/protozero
Submodule protozero added at 951a8d
1 change: 1 addition & 0 deletions vendor/rapidjson
Submodule rapidjson added at f54b0e
1 change: 1 addition & 0 deletions vendor/shelf-pack-cpp
Submodule shelf-pack-cpp added at c231b5
1 change: 1 addition & 0 deletions vendor/supercluster.hpp
Submodule supercluster.hpp added at 274ec1
1 change: 1 addition & 0 deletions vendor/unique_resource
Submodule unique_resource added at cba309
1 change: 1 addition & 0 deletions vendor/variant
Submodule variant added at 02bd1a
1 change: 1 addition & 0 deletions vendor/vector-tile
Submodule vector-tile added at 5084db
1 change: 1 addition & 0 deletions vendor/wagyu
Submodule wagyu added at 0ff3b5