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.
MGLMultiPoint (MGLPolyline, MGLPolygon) should allow removing coordinates #6583
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:
optionally -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.
Activity
1ec5 commentedon Nov 12, 2016
Putting this bug back on the 3.4.0 milestone, because it makes no sense to be able to grow a polyline but not shrink it.
1ec5 commentedon Nov 29, 2016
#6890 (comment) all but spells out the code needed to fix this issue.
1ec5 commentedon Dec 7, 2016
Fixed in #7251 on the v3.4.0 release branch.