[ios, macos] Snapshotter (runtime styling) delegates

Added a protocol and property for MGLMapSnapshotter’s delegate, which it uses for runtime styling. Generalized MGLStyle to be usable in the absence of MGLMapView. Moved MGLOpenGLStyleLayer code around to compile.
This commit is contained in:
Minh Nguyễn
2020-03-23 02:12:38 -07:00
committed by Minh Nguyễn
parent 180ab72055
commit 63bf91125a
17 changed files with 269 additions and 100 deletions

View File

@@ -243,8 +243,9 @@ mbgl::Immutable<mbgl::style::GeoJSONOptions> MGLGeoJSONOptionsFromDictionary(NSD
}
std::vector<mbgl::Feature> features;
if (self.mapView) {
features = self.mapView.renderer->querySourceFeatures(self.rawSource->getID(), { {}, optionalFilter });
if ([self.stylable isKindOfClass:[MGLMapView class]]) {
MGLMapView *mapView = (MGLMapView *)self.stylable;
features = mapView.renderer->querySourceFeatures(self.rawSource->getID(), { {}, optionalFilter });
}
return MGLFeaturesFromMBGLFeatures(features);
}
@@ -256,7 +257,7 @@ mbgl::Immutable<mbgl::style::GeoJSONOptions> MGLGeoJSONOptionsFromDictionary(NSD
mbgl::optional<mbgl::FeatureExtensionValue> extensionValue;
// Check parameters
if (!self.rawSource || !self.mapView || !cluster) {
if (!self.rawSource || !self.stylable || !cluster) {
return extensionValue;
}
@@ -269,11 +270,14 @@ mbgl::Immutable<mbgl::style::GeoJSONOptions> MGLGeoJSONOptionsFromDictionary(NSD
auto clusterFeature = geoJSON.get<mbgl::GeoJSONFeature>();
extensionValue = self.mapView.renderer->queryFeatureExtensions(self.rawSource->getID(),
clusterFeature,
"supercluster",
extension,
options);
if ([self.stylable isKindOfClass:[MGLMapView class]]) {
MGLMapView *mapView = (MGLMapView *)self.stylable;
extensionValue = mapView.renderer->queryFeatureExtensions(self.rawSource->getID(),
clusterFeature,
"supercluster",
extension,
options);
}
return extensionValue;
}