Circles (part 1)
Description
Implements circles
Screenshots
Technical details
When using Circle in Mapbox / MapLibre, its size can only be specified in pixels, not in meters: https://github.com/mapbox/mapbox-gl-native/issues/4312#issuecomment-466420652
Therefore, approximate the circle using a polygon. Use the Turf library to generate an approximation.
A workaround for the issue that looks like https://github.com/mapbox/mapbox-gl-js/issues/11235 is implemented.
TODO: Implement stroke pattern. For this some changes to some messy code is necessary, to be implemented in part 2.org.maplibre.gl:android-plugin-annotation-v9 are necessary.
Tests
- Install https://github.com/googlemaps/android-samples/tree/main/ApiDemos/kotlin
- Use Circle demo
- Long-clicking on map adds a circle.
- Circles reflect hue and opacity from the sliders at the top.
- Circles storkes reflect hue and stroke width from the sliders at the top.
- A circle that spans across either north or south pole does not draw an incorrect horizontal line (see GH issue linked above). It is expected not to fill, Google Maps would also not fill it according to docs.
Note: Dragging the marker crashes the app. When a marker is dragged, the sample app wants to update the circle, so the source is changed by the annotation plugin to reflect the changed radius. This means that the marker is re-inserted to the map by the annotation plugin. This means that the drag is stopped. This means that the app wants to update the circle, so the source is changed by the annotation plugin. … Possible workaround is delaying the drag callbacks to next UI draw, however this still makes dragging very laggy. This is however not really related to this MR and needs separate fixing of dragging functionality (!57 (merged) fixes other issues, not this one – it doesn't make it worse).
Note: stroke pattern cannot be picked yet. Not yet implemented as stated above.
Issues
- https://gitlab.e.foundation/e/os/backlog/-/issues/913
- https://github.com/microg/GmsCore/issues/1118
- https://github.com/microg/GmsCore/issues/1666