Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

MGLMultiPoint (MGLPolyline, MGLPolygon) should allow removing coordinates #6583

Closed

Description

@1ec5

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

Activity

  1. added
    iOS
    macOS
    annotations
    on Oct 5, 2016
  2. added this to the ios-v3.4.0 milestone on Oct 5, 2016
  3. modified the milestones: , ios-v3.4.0 on Oct 30, 2016
  4. modified the milestones: ios-v3.4.0, on Nov 12, 2016
  5. 1ec5 commented on Nov 12, 2016

    @1ec5
    ContributorAuthor

    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.

  6. 1ec5 commented on Nov 29, 2016

    @1ec5
    ContributorAuthor

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

  7. self-assigned this
    on Nov 30, 2016
  8. 1ec5 commented on Dec 7, 2016

    @1ec5
    ContributorAuthor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

annotationsfeatureiOSmacOS

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions