added endRoute and getPreviousPoint

This commit is contained in:
2022-12-28 17:45:18 +01:00
parent 212b845791
commit 1fabf0ab16
2 changed files with 24 additions and 4 deletions
+22 -4
View File
@@ -105,16 +105,34 @@ Point Route::startRoute() {
return *this->it;
}
Point Route::endRoute() {
if (this->points.size() < 1)
return Point(0, 0);
this->it = this->points.end();
this->currentPoint = this->points.size();
return *this->it;
}
Point Route::getNextPoint() {
if (this->it != this->points.end()) {
this->it++;
this->currentPoint++;
return *this->it;
} else if (this->it == this->points.end() && this->currentPoint != this->points.size()) {
this->currentPoint++;
return *this->it;
// } else if (this->it == this->points.end() && this->currentPoint != this->points.size()) {
// this->currentPoint++;
// return *this->it;
} else
return Point(0, 0);
return Point();
}
Point Route::getPreviousPoint() {
if (this->it != this->points.begin()) {
this->it--;
this->currentPoint--;
return *this->it;
} else {
return Point();
}
}
RouteInfo Route::getRouteInfo() {