mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-16 17:39:58 +00:00
GoogleMap: Add a searchPoint method
This commit is contained in:
@@ -760,6 +760,31 @@ WebBridge::clearHover()
|
||||
{
|
||||
}
|
||||
|
||||
QList<RideFilePoint*>
|
||||
WebBridge::searchPoint(double lat, double lng)
|
||||
{
|
||||
QList<RideFilePoint*> list;
|
||||
|
||||
RideItem *rideItem = gm->property("ride").value<RideItem*>();
|
||||
|
||||
RideFilePoint *candidat = NULL;
|
||||
foreach (RideFilePoint *p1, rideItem->ride()->dataPoints()) {
|
||||
if (p1->lat == 0 && p1->lon == 0)
|
||||
continue;
|
||||
|
||||
if (((p1->lat-lat> 0 && p1->lat-lat< 0.0001) || (p1->lat-lat< 0 && p1->lat-lat> -0.0001)) &&
|
||||
((p1->lon-lng> 0 && p1->lon-lng< 0.0001) || (p1->lon-lng< 0 && p1->lon-lng> -0.0001))) {
|
||||
// Vérifie distance avec dernier candidat
|
||||
candidat = p1;
|
||||
} else if (candidat) {
|
||||
list.append(candidat);
|
||||
candidat = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
void
|
||||
WebBridge::hoverPath(double lat, double lng)
|
||||
{
|
||||
@@ -773,6 +798,12 @@ WebBridge::hoverPath(double lat, double lng)
|
||||
IntervalItem *bottom = (IntervalItem *) allIntervals->child(count-1);
|
||||
if (bottom->text(0).startsWith(name)) { //delete allIntervals->takeChild(count-1);
|
||||
|
||||
/*qDebug() << "searchPoint";
|
||||
QList<RideFilePoint*> list = searchPoint(lat, lng);
|
||||
for (int i=0;i<list.count();i++) {
|
||||
qDebug() << list.at(i)->secs;
|
||||
}*/
|
||||
|
||||
RideItem *rideItem = gm->property("ride").value<RideItem*>();
|
||||
|
||||
double position = 0.0;
|
||||
@@ -785,6 +816,10 @@ WebBridge::hoverPath(double lat, double lng)
|
||||
}
|
||||
}
|
||||
|
||||
if (position == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (bottom->start>position) {
|
||||
bottom->start = position;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user