Skip to content
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

Closed
1ec5 opened this issue Oct 5, 2016 · 3 comments
Closed
Assignees
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

Comments

@1ec5
Copy link
Contributor

1ec5 commented Oct 5, 2016

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.

/ref #6565 (comment)
/cc @incanus @friedbunny @boundsj @ryanbaumann

@1ec5 1ec5 added feature iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS annotations Annotations on iOS and macOS or markers on Android labels Oct 5, 2016
@1ec5 1ec5 added this to the ios-v3.4.0 milestone Oct 5, 2016
@boundsj boundsj modified the milestones: ios-3.4.1, ios-v3.4.0 Oct 30, 2016
@1ec5 1ec5 modified the milestones: ios-v3.4.0, ios-3.4.1 Nov 12, 2016
@1ec5
Copy link
Contributor Author

1ec5 commented 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
Copy link
Contributor Author

1ec5 commented Nov 29, 2016

#6890 (comment) all but spells out the code needed to fix this issue.

@1ec5
Copy link
Contributor Author

1ec5 commented Dec 7, 2016

Fixed in #7251 on the v3.4.0 release branch.

@1ec5 1ec5 closed this as completed Dec 7, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
annotations Annotations on iOS and macOS or markers on Android feature iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS
Projects
None yet
Development

No branches or pull requests

2 participants