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.

proposal: shape layer grouping API #1708

@incanus

Description

@incanus

If we proceed with this, it will also happen on Android.

Per voice with @kkaefer, our shape annotation implementation in #1655 could be improved by creating a layer grouping API identically-styled shapes.

Currently, each shape annotation gets its own style layer for reasons of:

  1. Eventual z-ordering by the client, much like MapKit's insertOverlay:aboveOverlay:.
  2. Styling, as shapes in the same layer get the same styling.

However, performance is a concern here. Adding 10,000 similarly-styled shapes means 10,000 more style layers, which means 10,000 more GL draw calls. 🚨 NOT TENABLE 🚨

If we introduced the concept of a shape group for identically-styled shapes, a consumer could add 10,000 blue polylines to the map and incur 1 style layer and 1 draw call.

Instead of:

mapView.addAnnotation(polyline1)
mapView.addAnnotation(polyline2)
// ...
mapView.addAnnotation(polyline10000)

It would look something like:

let polylineGroup = MGLMultiPointGroup
polylineGroup.addObject(polyline1)
polylineGroup.addObject(polyline2)
// ...
polylineGroup.addObject(polyline10000)
mapView.addAnnotationGroup(polylineGroup)

This would also allow functionality like:

  • Easy restyling of shape groups
  • Easy toggling of hide/show for shape groups

We would still support mapView.addAnnotation(polyline) like MapKit, with the understanding that it's more efficient to add many shapes with the groups API instead.

Thoughts @1ec5 @friedbunny?

Metadata

Metadata

Assignees

No one assigned

    Labels

    iOSMapbox Maps SDK for iOSperformanceSpeed, stability, CPU usage, memory usage, or power usage

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions