Update to mapbox-gl-native sangria (#41)
This commit is contained in:
@@ -140,7 +140,7 @@ mbgl::style::CustomGeometrySource::Options MBGLCustomGeometrySourceOptionsFromDi
|
||||
@"This will be logged only once.");
|
||||
});
|
||||
}
|
||||
mbgl::Feature geoJsonObject = [feature geoJSONObject].get<mbgl::Feature>();
|
||||
mbgl::GeoJSONFeature geoJsonObject = [feature geoJSONObject].get<mbgl::GeoJSONFeature>();
|
||||
featureCollection.push_back(geoJsonObject);
|
||||
}
|
||||
const auto geojson = mbgl::GeoJSON{featureCollection};
|
||||
@@ -204,7 +204,7 @@ mbgl::style::CustomGeometrySource::Options MBGLCustomGeometrySourceOptionsFromDi
|
||||
mbgl::FeatureCollection featureCollection;
|
||||
featureCollection.reserve(features.count);
|
||||
for (MGLShape <MGLFeature> * feature in features) {
|
||||
mbgl::Feature geoJsonObject = [feature geoJSONObject].get<mbgl::Feature>();
|
||||
mbgl::GeoJSONFeature geoJsonObject = [feature geoJSONObject].get<mbgl::GeoJSONFeature>();
|
||||
featureCollection.push_back(geoJsonObject);
|
||||
if ([feature isMemberOfClass:[MGLShapeCollection class]]) {
|
||||
static dispatch_once_t onceToken;
|
||||
|
||||
@@ -336,8 +336,8 @@ MGL_DEFINE_FEATURE_ATTRIBUTES_GETTER();
|
||||
featureCollection.reserve(self.shapes.count);
|
||||
for (MGLShape <MGLFeature> *feature in self.shapes) {
|
||||
auto geoJSONObject = feature.geoJSONObject;
|
||||
MGLAssert(geoJSONObject.is<mbgl::Feature>(), @"Feature collection must only contain features.");
|
||||
featureCollection.push_back(geoJSONObject.get<mbgl::Feature>());
|
||||
MGLAssert(geoJSONObject.is<mbgl::GeoJSONFeature>(), @"Feature collection must only contain features.");
|
||||
featureCollection.push_back(geoJSONObject.get<mbgl::GeoJSONFeature>());
|
||||
}
|
||||
return featureCollection;
|
||||
}
|
||||
@@ -470,7 +470,7 @@ public:
|
||||
return shape;
|
||||
}
|
||||
|
||||
MGLShape <MGLFeature> * operator()(const mbgl::Feature &feature) const {
|
||||
MGLShape <MGLFeature> * operator()(const mbgl::GeoJSONFeature &feature) const {
|
||||
MGLShape <MGLFeature> *shape = (MGLShape <MGLFeature> *)MGLFeatureFromMBGLFeature(feature);
|
||||
return shape;
|
||||
}
|
||||
@@ -485,6 +485,14 @@ public:
|
||||
};
|
||||
|
||||
NSArray<MGLShape <MGLFeature> *> *MGLFeaturesFromMBGLFeatures(const std::vector<mbgl::Feature> &features) {
|
||||
NSMutableArray *shapes = [NSMutableArray arrayWithCapacity:features.size()];
|
||||
for (const auto &feature : features) {
|
||||
[shapes addObject:MGLFeatureFromMBGLFeature(static_cast<mbgl::GeoJSONFeature>(feature))];
|
||||
}
|
||||
return shapes;
|
||||
}
|
||||
|
||||
NSArray<MGLShape <MGLFeature> *> *MGLFeaturesFromMBGLFeatures(const std::vector<mbgl::GeoJSONFeature> &features) {
|
||||
NSMutableArray *shapes = [NSMutableArray arrayWithCapacity:features.size()];
|
||||
for (const auto &feature : features) {
|
||||
[shapes addObject:MGLFeatureFromMBGLFeature(feature)];
|
||||
@@ -492,7 +500,7 @@ NSArray<MGLShape <MGLFeature> *> *MGLFeaturesFromMBGLFeatures(const std::vector<
|
||||
return shapes;
|
||||
}
|
||||
|
||||
id <MGLFeature> MGLFeatureFromMBGLFeature(const mbgl::Feature &feature) {
|
||||
id <MGLFeature> MGLFeatureFromMBGLFeature(const mbgl::GeoJSONFeature &feature) {
|
||||
NSMutableDictionary *attributes = [NSMutableDictionary dictionaryWithCapacity:feature.properties.size()];
|
||||
for (auto &pair : feature.properties) {
|
||||
auto &value = pair.second;
|
||||
@@ -515,7 +523,7 @@ MGLShape* MGLShapeFromGeoJSON(const mapbox::geojson::geojson &geojson) {
|
||||
return shape;
|
||||
}
|
||||
|
||||
mbgl::Feature mbglFeature(mbgl::Feature feature, id identifier, NSDictionary *attributes)
|
||||
mbgl::GeoJSONFeature mbglFeature(mbgl::GeoJSONFeature feature, id identifier, NSDictionary *attributes)
|
||||
{
|
||||
if (identifier) {
|
||||
NSExpression *identifierExpression = [NSExpression expressionForConstantValue:identifier];
|
||||
|
||||
@@ -16,10 +16,17 @@ MGL_EXPORT
|
||||
NSArray<MGLShape <MGLFeature> *> *MGLFeaturesFromMBGLFeatures(const std::vector<mbgl::Feature> &features);
|
||||
|
||||
/**
|
||||
Returns an `MGLFeature` object converted from the given mbgl::Feature
|
||||
Returns an array of `MGLFeature` objects converted from the given vector of
|
||||
vector tile features.
|
||||
*/
|
||||
MGL_EXPORT
|
||||
id <MGLFeature> MGLFeatureFromMBGLFeature(const mbgl::Feature &feature);
|
||||
NSArray<MGLShape <MGLFeature> *> *MGLFeaturesFromMBGLFeatures(const std::vector<mbgl::GeoJSONFeature> &features);
|
||||
|
||||
/**
|
||||
Returns an `MGLFeature` object converted from the given mbgl::GeoJSONFeature
|
||||
*/
|
||||
MGL_EXPORT
|
||||
id <MGLFeature> MGLFeatureFromMBGLFeature(const mbgl::GeoJSONFeature &feature);
|
||||
|
||||
/**
|
||||
Returns an `MGLShape` representing the given geojson. The shape can be
|
||||
@@ -28,11 +35,11 @@ id <MGLFeature> MGLFeatureFromMBGLFeature(const mbgl::Feature &feature);
|
||||
MGLShape* MGLShapeFromGeoJSON(const mapbox::geojson::geojson &geojson);
|
||||
|
||||
/**
|
||||
Takes an `mbgl::Feature` object, an identifer, and attributes dictionary and
|
||||
Takes an `mbgl::GeoJSONFeature` object, an identifer, and attributes dictionary and
|
||||
returns the feature object with converted `mbgl::FeatureIdentifier` and
|
||||
`mbgl::PropertyMap` properties.
|
||||
*/
|
||||
mbgl::Feature mbglFeature(mbgl::Feature feature, id identifier, NSDictionary * attributes);
|
||||
mbgl::GeoJSONFeature mbglFeature(mbgl::GeoJSONFeature feature, id identifier, NSDictionary * attributes);
|
||||
|
||||
/**
|
||||
Returns an `NSDictionary` representation of an `MGLFeature`.
|
||||
|
||||
@@ -262,12 +262,12 @@ mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NSDictionary<MGLShap
|
||||
|
||||
auto geoJSON = [cluster geoJSONObject];
|
||||
|
||||
if (!geoJSON.is<mbgl::Feature>()) {
|
||||
if (!geoJSON.is<mbgl::GeoJSONFeature>()) {
|
||||
MGLAssert(0, @"cluster geoJSON object is not a feature.");
|
||||
return extensionValue;
|
||||
}
|
||||
|
||||
auto clusterFeature = geoJSON.get<mbgl::Feature>();
|
||||
auto clusterFeature = geoJSON.get<mbgl::GeoJSONFeature>();
|
||||
|
||||
extensionValue = self.mapView.renderer->queryFeatureExtensions(self.rawSource->getID(),
|
||||
clusterFeature,
|
||||
@@ -293,7 +293,7 @@ mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NSDictionary<MGLShap
|
||||
return @[];
|
||||
}
|
||||
|
||||
std::vector<mbgl::Feature> leaves = featureExtension->get<mbgl::FeatureCollection>();
|
||||
std::vector<mbgl::GeoJSONFeature> leaves = featureExtension->get<mbgl::FeatureCollection>();
|
||||
return MGLFeaturesFromMBGLFeatures(leaves);
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NSDictionary<MGLShap
|
||||
return @[];
|
||||
}
|
||||
|
||||
std::vector<mbgl::Feature> leaves = featureExtension->get<mbgl::FeatureCollection>();
|
||||
std::vector<mbgl::GeoJSONFeature> leaves = featureExtension->get<mbgl::FeatureCollection>();
|
||||
return MGLFeaturesFromMBGLFeatures(leaves);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user