You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
MGLPolygon, MGLPolyline coordinates should be mutable #6160
annotationsAnnotations on iOS and macOS or markers on Androidbeta blockerBlocks the next beta releasefeatureiOSMapbox Maps SDK for iOSmacOSMapbox Maps SDK for macOS
Just as it’s very convenient to be able to change an MGLPointAnnotation’s coordinate property and have the annotation move on the fly, it should be possible to change the shape of an MGLPolygon or MGLPolyline. This would be useful for GPS and fitness tracking applications as well as applications that allow the user to trace features over the map.
MGLMultiPoint has a coordinates property that – due to Objective-C language limitations – holds a C array of CLLocationCoordinate2Ds, rather than an NSArray that we’d easily be able to make mutable. Nonetheless, we could pair this property with one that holds an NSMutableArray of NSValues representing CLLocationCoordinate2Ds, then implement all the to-many getters and setters expected by KVO. Alternatively, we could add a -setCoordinates:range: method. Either approach will be somewhat messy in Objective-C and even messier when bridged to Swift.
This is the iOS/macOS equivalent of #5224 on Android. I consider this feature blocked by #5844. The awkwardness of the API we’d add would outweigh any benefits to implementing a stopgap API like in #5848 on Android.
@ryanbaumann Currently scoping this out. Draggable is a different, higher-level issue and would likely be as equally complex as the mutation part, but could also be implemented in a custom way by any SDK users.
This looks to be fairly straightforward—messy proof of concept done, which continually updates an MGLPolyline to connect (45, -122) and the map center upon map movement:
Did this by way of a temporary -[MGLMapView updateAnnotation:withAnnotation:] which takes MGLPolyline arguments.
The right way to do this is KVO in MGLMapView like how we do for point coordinates, but that uses the same core stuff under the hood (_mbglMap->updateAnnotation()) as this proof of concept, which proves this will be performant and look 👌.
Stay tuned—should finish this completely today or tomorrow.
annotationsAnnotations on iOS and macOS or markers on Androidbeta blockerBlocks the next beta releasefeatureiOSMapbox Maps SDK for iOSmacOSMapbox Maps SDK for macOS
Activity
boundsj commentedon Aug 29, 2016
Noting that #6185 landed that fixed #5844
ryanbaumann commentedon Oct 3, 2016
@1ec5 What's an expected timeline on draggable/mutable points on iOS, now that #5844 is no longer a blocker?
incanus commentedon Oct 3, 2016
@ryanbaumann Currently scoping this out. Draggable is a different, higher-level issue and would likely be as equally complex as the mutation part, but could also be implemented in a custom way by any SDK users.
incanus commentedon Oct 3, 2016
This looks to be fairly straightforward—messy proof of concept done, which continually updates an
MGLPolylineto connect(45, -122)and the map center upon map movement:Did this by way of a temporary
-[MGLMapView updateAnnotation:withAnnotation:]which takesMGLPolylinearguments.The right way to do this is KVO in
MGLMapViewlike how we do for point coordinates, but that uses the same core stuff under the hood (_mbglMap->updateAnnotation()) as this proof of concept, which proves this will be performant and look 👌.Stay tuned—should finish this completely today or tomorrow.
incanus commentedon Oct 3, 2016
This feels good for shapes, too.
[ios, macos] fixes #6160: allow updating multipoint coordinates
incanus commentedon Oct 3, 2016
PR for this ready for review in #6565.
[test] Native ignore for GL JS issue #6160
[test] Native ignore for GL JS issue #6160
[test] Native ignore for GL JS issue #6160
[test] Native ignore for GL JS issue #6160
[test] Native ignore for GL JS issue #6160