LineString::Touches uses Point::Touches, which always returns false in this case because the point from the event has no pixmap and Point::Touches returns false if the pixmap is not specified.
Furthermore, even if Point::Touches didn't always return false when there is no pixmap, the check is still wrong as you need to compute the bounding box of each segment of the line and then check if the point is within the bounding box.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The pixmap problem is fixed, however you're still just checking the points of the line rather than the bounding box created by the image. Here's an implementation that I've used in a subclass I created.
bool BetterLineString::Touches(qmapcontrol::Point click,
const qmapcontrol::MapAdapter mapadapter)
{
if (points().size() < 2)
{
// really shouldn't end up here since we always add 2 points
return false;
}
Furthermore, even if Point::Touches didn't always return false when there is no pixmap, the check is still wrong as you need to compute the bounding box of each segment of the line and then check if the point is within the bounding box.
Thanks for submitting the bug. Sorry for the late response, i've just joined the project.
I'll update this once i get a chance to confirm the bug
Just a note: This behaviour may have changed for you since i've removed the need to use QPixmap* in revision 41
I'll keep this open until i've had a chance to verify/fix
The pixmap problem is fixed, however you're still just checking the points of the line rather than the bounding box created by the image. Here's an implementation that I've used in a subclass I created.
bool BetterLineString::Touches(qmapcontrol::Point click,
const qmapcontrol::MapAdapter mapadapter)
{
if (points().size() < 2)
{
// really shouldn't end up here since we always add 2 points
return false;
}
}
added your changes to rev 56
cheers mate