Reply to topic

MarbleWidget: detect if user clicked on a line

linumatic
Registered Member
Posts
1
Karma
0
Hi,

how can I detect if a user clicked on a line on the map that was drawn using:
Code: Select all
void GeoPainter::drawPolyline( const GeoDataLineString & lineString )

I especially need to know which of the lines was selected. I did not find a suitable way especially when the line was drawn using:
Code: Select all
 Marble::Tessellate


EDIT 23.04.2020:

What I tried so far:
I discovered that MarbleWidget::whichFeatureAt returns nothing for poly lines.

I tried to use Marble::GeoDataLineString::latLonAltBox for determining with GeoDataLatLonAltBox::contains (const GeoDataCoordinates &) if the coordinate of my click position is within the GeoDataLatLonAltBox. This did not work as expected. Especially when drawing with Marble::Tessellate. The GeoDataLatLonAltBox does not respect the option.

I tried using GeoPainter::regionFromPolyline do determine if the clicked point lies within the region of one of the the GeoDataStringLines. Here I get performance issues (with 19.04.3) when calling GeoPainter::regionFromPolyline from within the render function. I get too many render events when the map is zoomed in. But apparently this approach does not work as well.

Currently I am out of ideas and would appreciate some help. Thanks.

Reply to topic

Bookmarks



Who is online

Registered users: appnganhang, Baidu [Spider], Bing [Bot], farid, Google [Bot], grahm, kingyoshi, nicoleagnew, TheraHedwig, thunder422, Yahoo [Bot], zeroarmor