summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorBrad Leege <bleege@gmail.com>2016-06-09 15:10:05 -0500
committerBrad Leege <bleege@gmail.com>2016-06-09 15:10:05 -0500
commit3972044308410bc5281e267b5247a3a0898c777a (patch)
tree95bdbee967eb783be701847fc07072868c9040c2 /platform
parentb90571107d6fa5dd970d77c0b67029de8cd3461a (diff)
parent40211abd9a6cb6a3b0eb8dbe61e1ccb605d19677 (diff)
downloadqtlocation-mapboxgl-3972044308410bc5281e267b5247a3a0898c777a.tar.gz
Merge branch 'master' of github.com:mapbox/mapbox-gl-native
Diffstat (limited to 'platform')
-rw-r--r--platform/default/webp_reader.cpp7
-rw-r--r--platform/ios/CHANGELOG.md7
-rw-r--r--platform/ios/DEVELOPING.md42
-rw-r--r--platform/ios/Mapbox-iOS-SDK-symbols.podspec2
-rw-r--r--platform/ios/Mapbox-iOS-SDK.podspec2
-rw-r--r--platform/ios/app/MBXViewController.m78
-rw-r--r--platform/ios/src/MGLMapView.h14
-rw-r--r--platform/ios/src/MGLMapView.mm52
-rw-r--r--platform/node/CHANGELOG.md4
-rw-r--r--platform/osx/INSTALL.md10
-rw-r--r--platform/osx/app/MapDocument.m13
-rw-r--r--platform/osx/src/MGLMapView.h14
-rw-r--r--platform/osx/src/MGLMapView.mm14
-rw-r--r--platform/qt/scripts/configure.sh2
14 files changed, 129 insertions, 132 deletions
diff --git a/platform/default/webp_reader.cpp b/platform/default/webp_reader.cpp
index 37d23da110..5b0eaf4741 100644
--- a/platform/default/webp_reader.cpp
+++ b/platform/default/webp_reader.cpp
@@ -15,8 +15,11 @@ PremultipliedImage decodeWebP(const uint8_t* data, size_t size) {
throw std::runtime_error("failed to retrieve WebP basic header information");
}
- std::unique_ptr<uint8_t[]> webp(WebPDecodeRGBA(data, size, &width, &height));
- if (!webp) {
+ int stride = width * 4;
+ size_t webpSize = stride * height;
+ auto webp = std::make_unique<uint8_t[]>(webpSize);
+
+ if (!WebPDecodeRGBAInto(data, size, webp.get(), webpSize, stride)) {
throw std::runtime_error("failed to decode WebP data");
}
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md
index 8c2eeca35f..2b34571d1c 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -21,19 +21,24 @@ Mapbox welcomes participation and contributions from everyone. Please read [CON
- Fixed an issue preventing KVO change notifications from being generated on MGLMapView’s `userTrackingMode` key path when `-setUserTrackingMode:animated:` is called. ([#4724](https://github.com/mapbox/mapbox-gl-native/pull/4724))
- Rendering now occurs on the main thread, fixing a hang when calling `-[MGLMapView styleURL]` before the map view has fully loaded or while the application is in the background. ([#2909](https://github.com/mapbox/mapbox-gl-native/pull/2909))
- Improved responsiveness when zooming in then immediately panning around. ([#4595](https://github.com/mapbox/mapbox-gl-native/pull/4595))
+- Fixed a crash setting MGLMapView’s `userLocationVerticalAlignment` property before a user location update has occurred. ([#5274](https://github.com/mapbox/mapbox-gl-native/issues/5274))
- Added category methods on NSValue for converting to and from the structure types defined in MGLGeometry.h. ([#4802](https://github.com/mapbox/mapbox-gl-native/pull/4802))
- Added NSFormatter subclasses for converting geographic coordinates and directions into display strings. ([#4802](https://github.com/mapbox/mapbox-gl-native/pull/4802))
- Added a new method, `-[MGLMapView cameraThatFitsCoordinateBounds:]`, to get a camera that you can pass into `-setCamera:` that fits the given coordinate bounds. ([#4790](https://github.com/mapbox/mapbox-gl-native/pull/4790))
- Added a `-reloadStyle:` action to MGLMapView to force a reload of the current style. ([#4728](https://github.com/mapbox/mapbox-gl-native/pull/4728))
- A more specific user agent string is now sent with style and tile requests. ([#4012](https://github.com/mapbox/mapbox-gl-native/pull/4012))
- Mapbox Telemetry is automatically disabled while the host application is running in the iOS Simulator. ([#4726](https://github.com/mapbox/mapbox-gl-native/pull/4726))
-- Fixed an issue preventing `-[MGLMapViewDelegate mapViewDidFinishLoadingMap:]` from being called when returning to the view controller containing the map view from another view controller. ([#5164](https://github.com/mapbox/mapbox-gl-native/pull/5164))
- Suppressed “Unable to make space for entry” console spew. ([#4708](https://github.com/mapbox/mapbox-gl-native/pull/4708))
- Removed unused SVG files from the SDK’s resource bundle. ([#4641](https://github.com/mapbox/mapbox-gl-native/pull/4641))
- Deprecated `-[MGLMapView emptyMemoryCache]`. ([#4725](https://github.com/mapbox/mapbox-gl-native/pull/4725))
- Added `MGLCoordinateInCoordinateBounds()`, a function that tests whether or not a coordinate is in a given bounds. ([#5053](https://github.com/mapbox/mapbox-gl-native/pull/5053))
- Added a new option to `MGLMapDebugMaskOptions`, `MGLMapDebugWireframesMask`, that shows wireframes instead of the usual rendered output. ([#4359](https://github.com/mapbox/mapbox-gl-native/pull/4359))
+## 3.2.3
+
+- Fixed an issue preventing `-[MGLMapViewDelegate mapViewDidFinishLoadingMap:]` from being called when returning to the view controller containing the map view from another view controller. ([#5164](https://github.com/mapbox/mapbox-gl-native/pull/5164))
+- Declarations in the API documentation are shown in both Objective-C and Swift. ([realm/jazzy#530](https://github.com/realm/jazzy/pull/530))
+
## 3.2.2
- Existing MGLStyle class methods that return default style URLs have been deprecated in favor of new methods that require an explicit style version parameter. The deprecated, unversioned methods continue to return version 8 of the respective styles and will not be updated as new versions of the styles are released. ([#4759](https://github.com/mapbox/mapbox-gl-native/pull/4759))
diff --git a/platform/ios/DEVELOPING.md b/platform/ios/DEVELOPING.md
index 67481d4f8a..d771f7541b 100644
--- a/platform/ios/DEVELOPING.md
+++ b/platform/ios/DEVELOPING.md
@@ -8,30 +8,42 @@ The Mapbox iOS SDK and iosapp demo application build against the iOS 7.0 SDK. Th
## Building the SDK
-[Install core dependencies](../../INSTALL.md), then run
+Make sure that you have the [core dependencies](../../INSTALL.md) installed.
+
+Create and open an Xcode workspace that includes both the SDK source and some Objective-C test applications by running:
```bash
make iproj
```
-which will create and open an Xcode workspace that includes both the SDK source and some Objective-C test applications. Before building, use the scheme picker button in the toolbar to change the scheme to “iosapp” and the destination to one of the simulators or connected devices listed in the menu.
+### Xcode schemes
+
+Before building, use the scheme picker button in the toolbar to change the scheme to **iosapp** and the destination to one of the simulators or connected devices listed in the menu.
-“iosapp” is only one of several shared schemes. Others include:
+**iosapp** is only one of several shared schemes. Others include:
-* “CI” builds exactly what gets built for continuous integration on Bitrise.
-* “bench” is a simple benchmarking application. For more consistent results between runs, run platform/ios/benchmark/assets/{glyphs,tiles}/download.sh to download any necessary resources.
-* “dynamic” builds the SDK as a dynamic framework.
-* “static” builds the SDK as a static library and separate resource bundle.
-* “dynamic+static” is a combination of the “dynamic” and “static” schemes.
+* **CI** builds exactly what gets built for continuous integration on Bitrise.
+* **bench** is a simple benchmarking application. For more consistent results between runs, run `platform/ios/benchmark/assets/{glyphs,tiles}/download.sh` to download any necessary resources.
+* **dynamic** builds the SDK as a dynamic framework.
+* **static** builds the SDK as a static library and separate resource bundle.
+* **dynamic+static** is a combination of the **dynamic** and **static** schemes.
If you don’t have an Apple Developer account, change the destination to a simulator such as “iPhone 6s” before you run and build the app.
-`iproj` is only one of several available `make` rules. Others include:
+### Packaging builds
+
+Install [jazzy](https://github.com/realm/jazzy) for generating API documentation:
+
+```bash
+[sudo] gem install jazzy
+```
+
+Build and package the SDK by using one of the following commands:
-* `make ipackage` builds both dynamic and static frameworks in the Release configuration for devices and the iOS Simulator.
+* `make ipackage` builds both dynamic and static frameworks in the Debug configuration for devices and the iOS Simulator.
+* `make iframework` builds a dynamic framework in the Debug configuration for devices and the iOS Simulator. The CocoaPods pod downloads the output of this target.
* `make ipackage-sim` builds a dynamic framework in the Debug configuration for the iOS simulator. This is the fastest target.
-* `make ipackage-strip` builds both dynamic and static frameworks in the Release configuration, stripped of debug symbols, for devices and the iOS Simulator.
-* `make iframework` builds a dynamic framework in the Release configuration for devices and the iOS Simulator. The CocoaPods pod downloads the output of this target.
+* `make ipackage-strip` builds both dynamic and static frameworks in the Debug configuration, stripped of debug symbols, for devices and the iOS Simulator.
* `make ifabric` builds a special static framework for compatibility with the Fabric Mac application.
You can customize the build output by passing the following arguments into the `make` invocation:
@@ -41,12 +53,14 @@ You can customize the build output by passing the following arguments into the `
* `FORMAT=dynamic` builds only a dynamic framework. `FORMAT=static` builds only a static framework, for compatibility with iOS 7.x.
* `SYMBOLS=NO` strips the build output of any debug symbols, yielding much smaller binaries.
-These targets require that you install [jazzy](https://github.com/realm/jazzy) for generating API documentation:
+An example command that creates a dynamic framework suitable for eventual App Store distribution:
```bash
-[sudo] gem install jazzy
+make iframework BUILDTYPE=Release SYMBOLS=NO
```
+The products of these build commands can be found in the `build/ios/pkg` folder at the base of the repository.
+
## Contributing
### Adding a source code file
diff --git a/platform/ios/Mapbox-iOS-SDK-symbols.podspec b/platform/ios/Mapbox-iOS-SDK-symbols.podspec
index a29e9467ea..3642d8b7de 100644
--- a/platform/ios/Mapbox-iOS-SDK-symbols.podspec
+++ b/platform/ios/Mapbox-iOS-SDK-symbols.podspec
@@ -10,7 +10,7 @@ Pod::Spec.new do |m|
m.author = { 'Mapbox' => 'mobile@mapbox.com' }
m.screenshot = 'https://raw.githubusercontent.com/mapbox/mapbox-gl-native/master/platform/ios/screenshot.png'
m.social_media_url = 'https://twitter.com/mapbox'
- m.documentation_url = 'https://www.mapbox.com/ios-sdk/'
+ m.documentation_url = 'https://www.mapbox.com/ios-sdk/api/'
m.source = {
:http => "https://mapbox.s3.amazonaws.com/mapbox-gl-native/ios/builds/mapbox-ios-sdk-#{m.version.to_s}-dynamic.zip",
diff --git a/platform/ios/Mapbox-iOS-SDK.podspec b/platform/ios/Mapbox-iOS-SDK.podspec
index 33b83e5370..da9213dba2 100644
--- a/platform/ios/Mapbox-iOS-SDK.podspec
+++ b/platform/ios/Mapbox-iOS-SDK.podspec
@@ -10,7 +10,7 @@ Pod::Spec.new do |m|
m.author = { 'Mapbox' => 'mobile@mapbox.com' }
m.screenshot = 'https://raw.githubusercontent.com/mapbox/mapbox-gl-native/master/platform/ios/screenshot.png'
m.social_media_url = 'https://twitter.com/mapbox'
- m.documentation_url = 'https://www.mapbox.com/ios-sdk/'
+ m.documentation_url = 'https://www.mapbox.com/ios-sdk/api/'
m.source = {
:http => "https://mapbox.s3.amazonaws.com/mapbox-gl-native/ios/builds/mapbox-ios-sdk-#{m.version.to_s}-dynamic.zip",
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m
index 70f777422d..8317aee1d9 100644
--- a/platform/ios/app/MBXViewController.m
+++ b/platform/ios/app/MBXViewController.m
@@ -575,7 +575,7 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
- (MGLAnnotationView *)mapView:(MGLMapView *)mapView viewForAnnotation:(id<MGLAnnotation>)annotation
{
// Use GL backed pins for dropped pin annotations
- if ([annotation isMemberOfClass:[MBXDroppedPinAnnotation class]])
+ if ([annotation isKindOfClass:[MBXDroppedPinAnnotation class]])
{
return nil;
}
@@ -603,82 +603,6 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
return annotationView;
}
-- (MGLAnnotationImage *)mapView:(MGLMapView * __nonnull)mapView imageForAnnotation:(id <MGLAnnotation> __nonnull)annotation
-{
- if ([annotation isKindOfClass:[MBXDroppedPinAnnotation class]]
- || [annotation isKindOfClass:[MBXCustomCalloutAnnotation class]])
- {
- return nil; // use default marker
- }
-
- NSString *title = [(MGLPointAnnotation *)annotation title];
- if (!title.length) return nil;
- NSString *lastTwoCharacters = [title substringFromIndex:title.length - 2];
-
- MGLAnnotationImage *annotationImage = [mapView dequeueReusableAnnotationImageWithIdentifier:lastTwoCharacters];
-
- if ( ! annotationImage)
- {
- UIColor *color;
-
- // make every tenth annotation blue
- if ([lastTwoCharacters hasSuffix:@"0"]) {
- color = [UIColor blueColor];
- } else {
- color = [UIColor redColor];
- }
-
- UIImage *image = [self imageWithText:lastTwoCharacters backgroundColor:color];
- annotationImage = [MGLAnnotationImage annotationImageWithImage:image reuseIdentifier:lastTwoCharacters];
-
- // don't allow touches on blue annotations
- if ([color isEqual:[UIColor blueColor]]) annotationImage.enabled = NO;
- }
-
- return annotationImage;
-}
-
-- (UIImage *)imageWithText:(NSString *)text backgroundColor:(UIColor *)color
-{
- CGRect rect = CGRectMake(0, 0, 20, 15);
-
- UIGraphicsBeginImageContextWithOptions(rect.size, NO, [[UIScreen mainScreen] scale]);
-
- CGContextRef ctx = UIGraphicsGetCurrentContext();
-
- CGContextSetFillColorWithColor(ctx, [[color colorWithAlphaComponent:0.75] CGColor]);
- CGContextFillRect(ctx, rect);
-
- CGContextSetStrokeColorWithColor(ctx, [[UIColor blackColor] CGColor]);
- CGContextStrokeRectWithWidth(ctx, rect, 2);
-
- NSAttributedString *drawString = [[NSAttributedString alloc] initWithString:text attributes:@{
- NSFontAttributeName: [UIFont fontWithName:@"Arial-BoldMT" size:12],
- NSForegroundColorAttributeName: [UIColor whiteColor],
- }];
- CGSize stringSize = drawString.size;
- CGRect stringRect = CGRectMake((rect.size.width - stringSize.width) / 2,
- (rect.size.height - stringSize.height) / 2,
- stringSize.width,
- stringSize.height);
- [drawString drawInRect:stringRect];
-
- UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
- UIGraphicsEndImageContext();
- return image;
-}
-
-- (void)mapView:(MGLMapView *)mapView didDeselectAnnotation:(id<MGLAnnotation>)annotation {
- NSString *title = [(MGLPointAnnotation *)annotation title];
- if ( ! title.length)
- {
- return;
- }
- NSString *lastTwoCharacters = [title substringFromIndex:title.length - 2];
- MGLAnnotationImage *annotationImage = [mapView dequeueReusableAnnotationImageWithIdentifier:lastTwoCharacters];
- annotationImage.image = annotationImage.image ? nil : [self imageWithText:lastTwoCharacters backgroundColor:[UIColor grayColor]];
-}
-
- (BOOL)mapView:(__unused MGLMapView *)mapView annotationCanShowCallout:(__unused id <MGLAnnotation>)annotation
{
return YES;
diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h
index d02c3a93a9..63d799bda9 100644
--- a/platform/ios/src/MGLMapView.h
+++ b/platform/ios/src/MGLMapView.h
@@ -882,9 +882,10 @@ IB_DESIGNABLE
Adds an annotation to the map view.
@note `MGLMultiPolyline`, `MGLMultiPolygon`, and `MGLShapeCollection` objects
- cannot be added to the map view at this time. Any multipolyline,
- multipolygon, or shape collection object that is passed into this method is
- silently ignored.
+ cannot be added to the map view at this time. Nor can `MGLMultiPoint`
+ objects that are not instances of `MGLPolyline` or `MGLPolygon`. Any
+ multipoint, multipolyline, multipolygon, or shape collection object that is
+ specified is silently ignored.
@param annotation The annotation object to add to the receiver. This object
must conform to the `MGLAnnotation` protocol. The map view retains the
@@ -895,9 +896,10 @@ IB_DESIGNABLE
Adds an array of annotations to the map view.
@note `MGLMultiPolyline`, `MGLMultiPolygon`, and `MGLShapeCollection` objects
- cannot be added to the map view at this time. Any multipolyline,
- multipolygon, or shape collection objects that are passed in are silently
- ignored.
+ cannot be added to the map view at this time. Nor can `MGLMultiPoint`
+ objects that are not instances of `MGLPolyline` or `MGLPolygon`. Any
+ multipoint, multipolyline, multipolygon, or shape collection objects that
+ are specified are silently ignored.
@param annotations An array of annotation objects. Each object in the array
must conform to the `MGLAnnotation` protocol. The map view retains each
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 1ad758dc77..5d1bcb1109 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -1779,8 +1779,16 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
if (annotation == [self annotationWithTag:annotationTag])
{
const mbgl::Point<double> point = MGLPointFromLocationCoordinate2D(annotation.coordinate);
- MGLAnnotationImage *annotationImage = [self imageOfAnnotationWithTag:annotationTag];
- _mbglMap->updateAnnotation(annotationTag, mbgl::SymbolAnnotation { point, annotationImage.styleIconIdentifier.UTF8String ?: "" });
+
+ MGLAnnotationContext &annotationContext = _annotationContextsByAnnotationTag.at(annotationTag);
+ NSString *symbolName;
+ if (!annotationContext.annotationView)
+ {
+ MGLAnnotationImage *annotationImage = [self imageOfAnnotationWithTag:annotationTag];
+ symbolName = annotationImage.styleIconIdentifier;
+ }
+
+ _mbglMap->updateAnnotation(annotationTag, mbgl::SymbolAnnotation { point, symbolName.UTF8String ?: "" });
if (annotationTag == _selectedAnnotationTag)
{
[self deselectAnnotation:annotation animated:YES];
@@ -2095,8 +2103,7 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
}
std::sort(visibleAnnotations.begin(), visibleAnnotations.end());
- auto foundElement = std::find(visibleAnnotations.begin(), visibleAnnotations.end(),
- ((MGLAnnotationAccessibilityElement *)element).tag);
+ auto foundElement = std::find(visibleAnnotations.begin(), visibleAnnotations.end(), tag);
if (foundElement == visibleAnnotations.end())
{
return NSNotFound;
@@ -2835,7 +2842,14 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
if ([annotation isKindOfClass:[MGLMultiPoint class]])
{
- // The multipoint knows how to style itself (with the map view’s help).
+ // Actual multipoints aren’t supported as annotations.
+ if ([annotation isMemberOfClass:[MGLMultiPoint class]]
+ || [annotation isMemberOfClass:[MGLMultiPointFeature class]])
+ {
+ continue;
+ }
+
+ // The polyline or polygon knows how to style itself (with the map view’s help).
MGLMultiPoint *multiPoint = (MGLMultiPoint *)annotation;
if (!multiPoint.pointCount) {
continue;
@@ -2846,13 +2860,9 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
context.annotation = annotation;
_annotationContextsByAnnotationTag[annotationTag] = context;
}
- else if ([annotation isKindOfClass:[MGLMultiPolyline class]]
- || [annotation isKindOfClass:[MGLMultiPolygon class]]
- || [annotation isKindOfClass:[MGLShapeCollection class]])
- {
- continue;
- }
- else
+ else if ( ! [annotation isKindOfClass:[MGLMultiPolyline class]]
+ || ![annotation isKindOfClass:[MGLMultiPolygon class]]
+ || ![annotation isKindOfClass:[MGLShapeCollection class]])
{
MGLAnnotationView *annotationView;
NSString *symbolName;
@@ -3384,10 +3394,13 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
{
MGLAnnotationContext &annotationContext = _annotationContextsByAnnotationTag.at(annotationTag);
- if (annotationContext.annotationView)
+ MGLAnnotationView *annotationView = annotationContext.annotationView;
+ if (annotationView)
{
// Annotations represented by views use the view frame as the positioning rect.
- positioningRect = annotationContext.annotationView.frame;
+ positioningRect = annotationView.frame;
+
+ [annotationView.superview bringSubviewToFront:annotationView];
}
}
@@ -3832,9 +3845,10 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
[self.locationManager stopUpdatingHeading];
- if (self.userLocationAnnotationView)
+ CLLocation *location = self.userLocation.location;
+ if (location && self.userLocationAnnotationView)
{
- [self locationManager:self.locationManager didUpdateLocations:@[self.userLocation.location] animated:animated];
+ [self locationManager:self.locationManager didUpdateLocations:@[location] animated:animated];
}
break;
@@ -3882,7 +3896,11 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
_userLocationVerticalAlignment = alignment;
if (self.userTrackingMode != MGLUserTrackingModeNone)
{
- [self locationManager:self.locationManager didUpdateLocations:@[self.userLocation.location] animated:animated];
+ CLLocation *location = self.userLocation.location;
+ if (location)
+ {
+ [self locationManager:self.locationManager didUpdateLocations:@[location] animated:animated];
+ }
}
}
diff --git a/platform/node/CHANGELOG.md b/platform/node/CHANGELOG.md
index a8f1d5be72..e1bff6cc28 100644
--- a/platform/node/CHANGELOG.md
+++ b/platform/node/CHANGELOG.md
@@ -1,3 +1,7 @@
+# 3.2.1
+
+- Fixes a memory leak in raster image data ([#5269](https://github.com/mapbox/mapbox-gl-native/pull/5269))
+
# 3.2.0
- Switches to [earcut.hpp](https://github.com/mapbox/earcut.hpp) for tessellation ([#2444](https://github.com/mapbox/mapbox-gl-native/pull/2444))
diff --git a/platform/osx/INSTALL.md b/platform/osx/INSTALL.md
index 8a4323aa8e..63b8947227 100644
--- a/platform/osx/INSTALL.md
+++ b/platform/osx/INSTALL.md
@@ -21,7 +21,15 @@ Grab a [prebuilt release](https://github.com/mapbox/mapbox-gl-native/releases/)
## Usage
-In a storyboard or XIB, add a view to your view controller. (Drag Custom View from the Object library to the View Controller scene on the Interface Builder canvas.) In the Identity inspector, set the view’s custom class to `MGLMapView`. If you need to manipulate the map view programmatically:
+In a storyboard or XIB:
+
+1. Add a view to your view controller or window. (Drag Custom View from the Object library to the View Controller scene on the Interface Builder canvas. In a XIB, drag it instead to the window on the canvas.)
+2. In the Identity inspector, set the view’s custom class to `MGLMapView`.
+3. MGLMapView needs to be layer-backed:
+ * You can make the window layer-backed by selecting the window and checking Full Size Content View in the Attributes inspector. This allows the map view to underlap the title bar and toolbar.
+ * Alternatively, if you don’t want the entire window to be layer-backed, you can make just the map view layer-backed by selecting it and checking its entry under the View Effects inspector’s Core Animation Layer section.
+
+If you need to manipulate the map view programmatically:
1. Switch to the Assistant Editor.
1. Import the `Mapbox` module.
diff --git a/platform/osx/app/MapDocument.m b/platform/osx/app/MapDocument.m
index 4274126747..e9f3b99592 100644
--- a/platform/osx/app/MapDocument.m
+++ b/platform/osx/app/MapDocument.m
@@ -18,7 +18,18 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
NSMutableArray *flattenedShapes = [NSMutableArray arrayWithCapacity:shapes.count];
for (id <MGLAnnotation> shape in shapes) {
NSArray *subshapes;
- if ([shape isKindOfClass:[MGLMultiPolyline class]]) {
+ // Flatten multipoints but not polylines or polygons.
+ if ([shape isMemberOfClass:[MGLMultiPoint class]]) {
+ NSUInteger pointCount = [(MGLMultiPoint *)shape pointCount];
+ CLLocationCoordinate2D *coordinates = [(MGLMultiPoint *)shape coordinates];
+ NSMutableArray *pointAnnotations = [NSMutableArray arrayWithCapacity:pointCount];
+ for (NSUInteger i = 0; i < pointCount; i++) {
+ MGLPointAnnotation *pointAnnotation = [[MGLPointAnnotation alloc] init];
+ pointAnnotation.coordinate = coordinates[i];
+ [pointAnnotations addObject:pointAnnotation];
+ }
+ subshapes = pointAnnotations;
+ } else if ([shape isKindOfClass:[MGLMultiPolyline class]]) {
subshapes = [(MGLMultiPolyline *)shape polylines];
} else if ([shape isKindOfClass:[MGLMultiPolygon class]]) {
subshapes = [(MGLMultiPolygon *)shape polygons];
diff --git a/platform/osx/src/MGLMapView.h b/platform/osx/src/MGLMapView.h
index 5c7e75135b..7b3efd293b 100644
--- a/platform/osx/src/MGLMapView.h
+++ b/platform/osx/src/MGLMapView.h
@@ -535,9 +535,10 @@ IB_DESIGNABLE
Adds an annotation to the map view.
@note `MGLMultiPolyline`, `MGLMultiPolygon`, and `MGLShapeCollection` objects
- cannot be added to the map view at this time. Any multipolyline,
- multipolygon, or shape collection object that is passed into this method is
- silently ignored.
+ cannot be added to the map view at this time. Nor can `MGLMultiPoint`
+ objects that are not instances of `MGLPolyline` or `MGLPolygon`. Any
+ multipoint, multipolyline, multipolygon, or shape collection object that is
+ specified is silently ignored.
@param annotation The annotation object to add to the receiver. This object
must conform to the `MGLAnnotation` protocol. The map view retains the
@@ -549,9 +550,10 @@ IB_DESIGNABLE
Adds an array of annotations to the map view.
@note `MGLMultiPolyline`, `MGLMultiPolygon`, and `MGLShapeCollection` objects
- cannot be added to the map view at this time. Any multipolyline,
- multipolygon, or shape collection objects that are passed in are silently
- ignored.
+ cannot be added to the map view at this time. Nor can `MGLMultiPoint`
+ objects that are not instances of `MGLPolyline` or `MGLPolygon`. Any
+ multipoint, multipolyline, multipolygon, or shape collection objects that
+ are specified are silently ignored.
@param annotations An array of annotation objects. Each object in the array
must conform to the `MGLAnnotation` protocol. The map view retains each
diff --git a/platform/osx/src/MGLMapView.mm b/platform/osx/src/MGLMapView.mm
index 03b94c25ba..ac4eae9d34 100644
--- a/platform/osx/src/MGLMapView.mm
+++ b/platform/osx/src/MGLMapView.mm
@@ -1608,6 +1608,12 @@ public:
NSAssert([annotation conformsToProtocol:@protocol(MGLAnnotation)], @"Annotation does not conform to MGLAnnotation");
if ([annotation isKindOfClass:[MGLMultiPoint class]]) {
+ // Actual multipoints aren’t supported as annotations.
+ if ([annotation isMemberOfClass:[MGLMultiPoint class]]
+ || [annotation isMemberOfClass:[MGLMultiPointFeature class]]) {
+ continue;
+ }
+
// The multipoint knows how to style itself (with the map view’s help).
MGLMultiPoint *multiPoint = (MGLMultiPoint *)annotation;
if (!multiPoint.pointCount) {
@@ -1618,11 +1624,9 @@ public:
MGLAnnotationContext context;
context.annotation = annotation;
_annotationContextsByAnnotationTag[annotationTag] = context;
- } else if ([annotation isKindOfClass:[MGLMultiPolyline class]]
- || [annotation isKindOfClass:[MGLMultiPolygon class]]
- || [annotation isKindOfClass:[MGLShapeCollection class]]) {
- continue;
- } else {
+ } else if (![annotation isKindOfClass:[MGLMultiPolyline class]]
+ || ![annotation isKindOfClass:[MGLMultiPolygon class]]
+ || ![annotation isKindOfClass:[MGLShapeCollection class]]) {
MGLAnnotationImage *annotationImage = nil;
if (delegateHasImagesForAnnotations) {
annotationImage = [self.delegate mapView:self imageForAnnotation:annotation];
diff --git a/platform/qt/scripts/configure.sh b/platform/qt/scripts/configure.sh
index 4b855f7c58..5f31c853d2 100644
--- a/platform/qt/scripts/configure.sh
+++ b/platform/qt/scripts/configure.sh
@@ -28,6 +28,8 @@ if [ "$MASON_PLATFORM" == "osx" ]; then
CONFIG+=" 'opengl_ldflags%': ['-framework OpenGL', '-framework CoreFoundation'],"$LN
}
else
+ VALGRIND_VERSION=latest
+
function print_opengl_flags {
CONFIG+=" 'opengl_cflags%': $(quote_flags $(pkg-config gl x11 --cflags)),"$LN
CONFIG+=" 'opengl_ldflags%': $(quote_flags $(pkg-config gl x11 --libs)),"$LN