summaryrefslogtreecommitdiff
path: root/platform/darwin/src
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/src')
-rw-r--r--platform/darwin/src/MGLComputedShapeSource.mm17
-rw-r--r--platform/darwin/src/MGLShapeCollection.mm1
-rw-r--r--platform/darwin/src/MGLShapeSource.mm8
3 files changed, 26 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLComputedShapeSource.mm b/platform/darwin/src/MGLComputedShapeSource.mm
index 609db7f399..0493131922 100644
--- a/platform/darwin/src/MGLComputedShapeSource.mm
+++ b/platform/darwin/src/MGLComputedShapeSource.mm
@@ -4,6 +4,7 @@
#import "MGLSource_Private.h"
#import "MGLShape_Private.h"
#import "MGLGeometry_Private.h"
+#import "MGLShapeCollection.h"
#include <mbgl/map/map.hpp>
#include <mbgl/style/sources/custom_geometry_source.hpp>
@@ -131,6 +132,14 @@ mbgl::style::CustomGeometrySource::Options MBGLCustomGeometrySourceOptionsFromDi
mbgl::FeatureCollection featureCollection;
featureCollection.reserve(data.count);
for (MGLShape <MGLFeature> * feature in data) {
+ if ([feature isMemberOfClass:[MGLShapeCollection class]]) {
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ NSLog(@"MGLShapeCollection initialized with MGLFeatures will not retain attributes."
+ @"Use MGLShapeCollectionFeature to retain attributes instead."
+ @"This will be logged only once.");
+ });
+ }
mbgl::Feature geoJsonObject = [feature geoJSONObject].get<mbgl::Feature>();
featureCollection.push_back(geoJsonObject);
}
@@ -196,6 +205,14 @@ mbgl::style::CustomGeometrySource::Options MBGLCustomGeometrySourceOptionsFromDi
for (MGLShape <MGLFeature> * feature in features) {
mbgl::Feature geoJsonObject = [feature geoJSONObject].get<mbgl::Feature>();
featureCollection.push_back(geoJsonObject);
+ if ([feature isMemberOfClass:[MGLShapeCollection class]]) {
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ NSLog(@"MGLShapeCollection initialized with MGLFeatures will not retain attributes."
+ @"Use MGLShapeCollectionFeature to retain attributes instead."
+ @"This will be logged only once.");
+ });
+ }
}
const auto geojson = mbgl::GeoJSON{featureCollection};
static_cast<mbgl::style::CustomGeometrySource *>(self.rawSource)->setTileData(tileID, geojson);
diff --git a/platform/darwin/src/MGLShapeCollection.mm b/platform/darwin/src/MGLShapeCollection.mm
index 74e78a764a..5db1ee335c 100644
--- a/platform/darwin/src/MGLShapeCollection.mm
+++ b/platform/darwin/src/MGLShapeCollection.mm
@@ -1,6 +1,7 @@
#import "MGLShapeCollection.h"
#import "MGLShape_Private.h"
+#import "MGLFeature.h"
#import <mbgl/style/conversion/geojson.hpp>
diff --git a/platform/darwin/src/MGLShapeSource.mm b/platform/darwin/src/MGLShapeSource.mm
index 1425269012..9457d2569a 100644
--- a/platform/darwin/src/MGLShapeSource.mm
+++ b/platform/darwin/src/MGLShapeSource.mm
@@ -105,6 +105,14 @@ mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NSDictionary<MGLShap
auto geoJSONOptions = MGLGeoJSONOptionsFromDictionary(options);
auto source = std::make_unique<mbgl::style::GeoJSONSource>(identifier.UTF8String, geoJSONOptions);
if (self = [super initWithPendingSource:std::move(source)]) {
+ if ([shape isMemberOfClass:[MGLShapeCollection class]]) {
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ NSLog(@"MGLShapeCollection initialized with MGLFeatures will not retain attributes."
+ @"Use MGLShapeCollectionFeature to retain attributes instead."
+ @"This will be logged only once.");
+ });
+ }
self.shape = shape;
}
return self;