Skip to content

feat(shapes): add support for drawing polyline, polygon and circle #157

@tafelnl

Description

@tafelnl

It should be possible to draw basic shapes on the map. There's actually already an open PR that adds this: #149

It adds the methods addPolygon, addPolyline and addCircle with some options. E.g. to fill them with a solid color and to adjust the color of the stroke (i.e. the border of the shape).

However, to be on par with the API the Google SDK offers, some additional functionality is needed as well.


We will first focus on completing the functionality of the polygon shape only. Later on, we will add similar functionality to the polyline and circle shapes as well. This way we keep the scope smaller. The requirements are as follows:


The API in the PR regarding the polygon (as said above) only has the addPolygon method right now. But it should be on par with the API that the Android SDK of Google itself offers (can be found here).

More specifically, this will thus entail the following changes:

  • 1. Keep a list of drawn polygons. This means a polygon that is added, should be saved in some sort together with an guid. For reference: the addMarker method has similar functionality.
  • 2. The PolygonOptions of the PR already supports specifying the points, tag, strokeColor, fillColor, strokeWidth, zIndex and the visibility. Support should also be added for clickable, geodesic, holes, strokePattern, strokeJointType.
  • 3. Add a getPolygon(id: string) method, that returns all properties of the specified polygon. For reference: the getḾap method has similar functionality.
  • 4. Add a updatePolygon(id: string, preferences: object) method, which accepts the same preference parameters as the addMarker method, so the polygon can be updated.
  • 5. Add a removePolygon(id: string) method, so a polygon can be removed (remember to update the list mentioned in 1 as well).

Bonus 1: it should be possible to - instead of a solid color fill - apply a pattern of images to a polygon. For more information, check this Stack Overflow question

Bonus 2: it should be possible to place the shapes on top of the markers. Normally they are drawn behind the markers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions