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.

MGLPolygon, MGLPolyline coordinates should be mutable #6160

Closed

Description

@1ec5

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.

/cc @incanus @pveugen

Activity

  1. added
    iOS
    macOS
    annotations
    on Aug 25, 2016
  2. added this to the ios-future milestone on Aug 26, 2016
  3. boundsj commented on Aug 29, 2016

    @boundsj
    Contributor

    Noting that #6185 landed that fixed #5844

  4. ryanbaumann commented on Oct 3, 2016

    @ryanbaumann

    @1ec5 What's an expected timeline on draggable/mutable points on iOS, now that #5844 is no longer a blocker?

  5. incanus commented on Oct 3, 2016

    @incanus
    Contributor

    @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.

  6. incanus commented on Oct 3, 2016

    @incanus
    Contributor

    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:

    foo

    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.

  7. modified the milestones: ios-v3.4.0, ios-future on Oct 3, 2016
  8. added
    beta blocker
    on Oct 3, 2016
  9. self-assigned this
    on Oct 3, 2016
  10. incanus commented on Oct 3, 2016

    @incanus
    Contributor

    This feels good for shapes, too.

    bar

  11. added a commit that references this issue on Oct 3, 2016
    086297d
  12. incanus commented on Oct 3, 2016

    @incanus
    Contributor

    PR for this ready for review in #6565.

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

Metadata

Metadata

Assignees

Labels

annotationsbeta blockerfeatureiOSmacOS

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions