Draw Polyline
This example demonstrates how to draw a polyline on the map and center the camera on it. The polyline is built from a fixed set of coordinates, rendered as a magenta line, and the camera is then animated to frame the whole polyline within the visible map area. The map remains fully interactive, supporting pan, pinch-zoom, rotate and tilt.
Drawing and Framing the Polyline
flyToPolyline() builds the line, renders it, and moves the camera. A MarkerCollection of type Polyline holds a single Marker whose coordinate pairs define the line. The MarkerCollectionRenderSettings set the line's colours and thickness (a magenta inner line over a thin black outline). The collection is then added to the map view's markers collection (mapView.preferences?.markers) so it is drawn on the map. Finally, the camera is animated to the collection's bounding area (markerCollection.area) with centerOnRectArea, framing it inside the free space left by the toolbar and system bars.
The camera is framed into a rectangle rather than the full surface so the polyline is never hidden behind the toolbar or the system bars. getFreeSpaceRectangle() builds that rectangle from the toolbar height, the window insets and a fixed margin.
Drawing the Polyline When the Map Is Ready
The polyline is drawn as soon as the default map view is created. The onDefaultMapViewCreated callback positions the Magic Lane logo and calls flyToPolyline(mapView).
