Hi there, here's a quick untested code snippet that hopefully nudges you in the right direction, there may be a better way to do it, but it's repurposed from a gps breadcrumb function I had and looking at the SDK sample for Geometries>Nearest Vertex:
MapGraphicsView *map_control;
std::shared_ptr<GraphicsOverlay> layer_geometries;
std::shared_ptr<PolylineBuilder> polyline_tracks;
std::shared_ptr<SimpleLineSymbol> polyline_pen;
std::shared_ptr<Graphic> polyline_graphic;
// choose your line style
polyline_pen = std::make_shared<SimpleLineSymbol>(SimpleLineSymbolStyle::Dot, QColor(0, 0, 255, 100), 5);
map_control = new MapGraphicsView(this);
layer_geometries = std::make_shared<GraphicsOverlay>();
map_control->graphicsOverlays()->append(p->layer_geometries.get());
connect(m_mapView, &MapGraphicsView::mouseClicked, this, [=](QMouseEvent& e)
{
Point clicked_location = map_control->screenToLocation(e.x(), e.y());
polyline_tracks->addPoint(clicked_location );
std::shared_ptr<PolylineBuilder>close_points(p->gps_tracks);
close_points->addPoint(p->gps_tracks->parts()->part(0)->startPoint());
polyline_graphic= std::make_shared<Graphic>(close_points->toGeometry(), polyline_pen.get());
layer_geometries->graphics()->clear();
layer_geometries->graphics()->append(p->polyline_graphic.get());
});
Edit: Check out this sample program with markup - Markup Documentation. Source code here: dynamic-situational-awareness-qt/Shared/markup