This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
MGLMultiPoint (MGLPolyline, MGLPolygon) should allow removing coordinates #6583
Labels
annotations
Annotations on iOS and macOS or markers on Android
feature
iOS
Mapbox Maps SDK for iOS
macOS
Mapbox Maps SDK for macOS
Milestone
Now that #6565 has landed, it’s possible to replace a segment (series of coordinates) of an MGLMultiPoint, MGLPolyline, or MGLPolygon with a segment of equal length, append coordinates to the end of the shape, or replace a segment at the end while appending. However, it isn’t possible to truncate (shrink) the shape, splice out (delete) a segment in the beginning or middle of the shape, or replace all the coordinates without replacing the shape annotation outright (since we try to avoid
memcpy()
of overlapping memory).To complete the feature we added in #6565, we need to add the following methods to MGLMultiPoint:
-setCoordinates:count:
-replaceCoordinatesInRange:withCoordinates:count:
(and remove or deprecate-replaceCoordinatesInRange:withCoordinates:
)-insertCoordinates:count:atIndex:
-removeCoordinatesInRange:
-appendCoordinates:count:
These operations have tricky edge cases that make our manual use of C memory management particularly perilous: an off-by-one error can go undetected even with unit tests. So I think we should convert the internal representation to use a
std::vector
instead of a heap-allocated C array: #6580. Once we fix #5201, we’ll need to factor out the implementations of these methods into freestanding C functions to avoid repetition./ref #6565 (comment)
/cc @incanus @friedbunny @boundsj @ryanbaumann
The text was updated successfully, but these errors were encountered: