Enable debug for Segment matching at runtime

Using the command line paramter: --debug-rules gc.routes.debug=true
This commit is contained in:
Alejandro Martinez
2025-12-02 12:33:21 -03:00
parent 9e8ed1717a
commit 7cdb14ca7a

View File

@@ -30,6 +30,10 @@
#include <QFile>
#include <QXmlInputSource>
#include <QXmlSimpleReader>
#include <QDebug>
Q_DECLARE_LOGGING_CATEGORY(gcRoutes)
Q_LOGGING_CATEGORY(gcRoutes, "gc.routes")
#define tr(s) QObject::tr(s)
@@ -126,7 +130,7 @@ RouteSegment::addPoint(RoutePoint _point)
void
RouteSegment::search(RideItem *item, RideFile*ride, QList<IntervalItem*>&here)
{
//qDebug() << "Opening ride: " << item->fileName << " for " << name;
qCDebug(gcRoutes) << "Opening ride: " << item->fileName << " for " << name;
double minimumprecision = 0.100; //100m
@@ -172,7 +176,7 @@ RouteSegment::search(RideItem *item, RideFile*ride, QList<IntervalItem*>&here)
} else {
if (_dist<minimumprecision) {
start = 0; //try to start
// qDebug() << " Start point identified...";
qCDebug(gcRoutes) << " Start point identified...";
}
}
}
@@ -214,7 +218,7 @@ RouteSegment::search(RideItem *item, RideFile*ride, QList<IntervalItem*>&here)
if (start == 0) {
start = point->secs;
precision = 0;
// qDebug() << " Start time " << start << "\r\n";
qCDebug(gcRoutes) << " Start time " << start << "\r\n";
}
if (minimumdistance>precision)
@@ -223,11 +227,11 @@ RouteSegment::search(RideItem *item, RideFile*ride, QList<IntervalItem*>&here)
break;
}
else {
//qDebug() << " WARNING route diverge at " << point->secs << "(" << i <<") after " << (point->secs-start)<< "secs for " << minimumdistance << "km " << routepoint.lat << "-" << routepoint.lon << "/" << point->lat << "-" << point->lon << "\r\n";
qCDebug(gcRoutes) << " WARNING route diverge at " << point->secs << "(" << i <<") after " << (point->secs-start)<< "secs for " << minimumdistance << "km " << routepoint.lat << "-" << routepoint.lon << "/" << point->lat << "-" << point->lon << "\r\n";
diverge++;
if (diverge>2) {
//qDebug() << " STOP route diverge at " << point->secs << "(" << i <<") after " << (point->secs-start)<< "secs for " << minimumdistance << "km " << routepoint.lat << "-" << routepoint.lon << "/" << point->lat << "-" << point->lon << "\r\n";
qCDebug(gcRoutes) << " STOP route diverge at " << point->secs << "(" << i <<") after " << (point->secs-start)<< "secs for " << minimumdistance << "km " << routepoint.lat << "-" << routepoint.lon << "/" << point->lat << "-" << point->lon << "\r\n";
//try to restart
resetroute = true; // reset the route point to the first route point
@@ -241,7 +245,7 @@ RouteSegment::search(RideItem *item, RideFile*ride, QList<IntervalItem*>&here)
if (!present && !resetroute) {
//qDebug() << " Route not identified (distance " << precision << "km)\r\n";
qCDebug(gcRoutes) << " Route not identified (distance " << precision << "km)\r\n";
break;
@@ -252,7 +256,7 @@ RouteSegment::search(RideItem *item, RideFile*ride, QList<IntervalItem*>&here)
if (n == this->getPoints().count()-1) {
// Add the interval and continue search
//qDebug() << " >>> Route identified in ride: " << name << " start: " << start << " stop: " << stop << " (distance " << precision << "km)\r\n";
qCDebug(gcRoutes) << " >>> Route identified in ride: " << name << " start: " << start << " stop: " << stop << " (distance " << precision << "km)\r\n";
IntervalItem *intervalItem = new IntervalItem(item, name,
start, stop,