diff options
Diffstat (limited to 'platform/darwin/src/MGLPointCollection.mm')
-rw-r--r-- | platform/darwin/src/MGLPointCollection.mm | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/platform/darwin/src/MGLPointCollection.mm b/platform/darwin/src/MGLPointCollection.mm index ab4a9c978e..387a575b2d 100644 --- a/platform/darwin/src/MGLPointCollection.mm +++ b/platform/darwin/src/MGLPointCollection.mm @@ -1,17 +1,19 @@ #import "MGLPointCollection_Private.h" #import "MGLGeometry_Private.h" +#import <mbgl/util/geojson.hpp> #import <mbgl/util/geometry.hpp> -#import <mbgl/util/feature.hpp> NS_ASSUME_NONNULL_BEGIN @implementation MGLPointCollection { - MGLCoordinateBounds _bounds; + MGLCoordinateBounds _overlayBounds; std::vector<CLLocationCoordinate2D> _coordinates; } +@synthesize overlayBounds = _overlayBounds; + + (instancetype)pointCollectionWithCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count { return [[self alloc] initWithCoordinates:coords count:count]; @@ -28,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN { bounds.extend(mbgl::LatLng(coordinate.latitude, coordinate.longitude)); } - _bounds = MGLCoordinateBoundsFromLatLngBounds(bounds); + _overlayBounds = MGLCoordinateBoundsFromLatLngBounds(bounds); } return self; } @@ -61,17 +63,12 @@ NS_ASSUME_NONNULL_BEGIN std::copy(_coordinates.begin() + range.location, _coordinates.begin() + NSMaxRange(range), coords); } -- (MGLCoordinateBounds)overlayBounds -{ - return _bounds; -} - - (BOOL)intersectsOverlayBounds:(MGLCoordinateBounds)overlayBounds { - return MGLLatLngBoundsFromCoordinateBounds(_bounds).intersects(MGLLatLngBoundsFromCoordinateBounds(overlayBounds)); + return MGLCoordinateBoundsIntersectsCoordinateBounds(_overlayBounds, overlayBounds); } -- (mbgl::Feature)featureObject +- (mbgl::Geometry<double>)geometryObject { mbgl::MultiPoint<double> multiPoint; multiPoint.reserve(self.pointCount); @@ -79,7 +76,7 @@ NS_ASSUME_NONNULL_BEGIN { multiPoint.push_back(mbgl::Point<double>(self.coordinates[i].longitude, self.coordinates[i].latitude)); } - return mbgl::Feature {multiPoint}; + return multiPoint; } - (NSDictionary *)geoJSONDictionary |