-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
URL example does not work as of this commit since a change in core still needs to happen to trigger an update.
@boundsj, thanks for your PR! By analyzing the history of the files in this pull request, we identified @1ec5, @incanus and @friedbunny to be potential reviewers. |
This is a WIP to make the data properties of Note: I cherry picked #6770 to make this work for URLs. However I see that PR has an open question regarding the resetting of a request. I will monitor to see if additional changes should get pulled in here. |
NSString *string = [[NSString alloc] initWithData:_geoJSONData encoding:NSUTF8StringEncoding]; | ||
const auto geojson = mapbox::geojson::parse(string.UTF8String).get<mapbox::geojson::feature_collection>(); | ||
|
||
const auto geoJSONSource = reinterpret_cast<mbgl::style::GeoJSONSource *>(self.source); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These reinterpret_cast
s would be unnecessary if this class instead has a class extension that redefines the source
property to be of type mbgl::style::GeoJSONSource *
. We follow this covariant pattern in a few places, notably the style layer classes.
|
||
NSURL *url = self.URL.mgl_URLByStandardizingScheme; | ||
const auto geoJSONSource = reinterpret_cast<mbgl::style::GeoJSONSource *>(self.source); | ||
geoJSONSource->setURL(url.absoluteString.UTF8String); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either update features
or nil
it out.
For consistency, I also cherry picked @ivovandongen's 19a707d |
This will continue in #6793. I will address the change requests there. |
Fixes #6159
This adds support for updating a
MGLGeoJSONSource
'sgeoJSONData
,URL
, andfeatures
properties and having that update trigger a refresh of the map with the new source data.