49 lines
862 B
C++
49 lines
862 B
C++
/**
|
|
* @file route.cpp
|
|
* @author Alexander Klein (alex@kleiax.de)
|
|
* @brief
|
|
* @version 0.1
|
|
* @date 2022-01-31
|
|
*
|
|
* @copyright Copyright (c) 2022
|
|
*
|
|
*/
|
|
|
|
#include "route.h"
|
|
|
|
// TODO: Delete iostream
|
|
#include <iostream>
|
|
|
|
Route::Route() {
|
|
|
|
}
|
|
|
|
void Route::addPointToRoute(Point point) {
|
|
this->points.push_back(point);
|
|
}
|
|
|
|
Point Route::startRoute() {
|
|
if (this->points.size() < 1)
|
|
return Point(0, 0);
|
|
this->it = this->points.begin();
|
|
this->currentPoint = 1;
|
|
return *this->it;
|
|
}
|
|
|
|
Point Route::getNextPoint() {
|
|
if (this->it != this->points.end()) {
|
|
this->it++;
|
|
this->currentPoint++;
|
|
return *this->it;
|
|
}
|
|
else
|
|
return Point(0, 0);
|
|
}
|
|
|
|
RouteInfo Route::getRouteInfo() {
|
|
RouteInfo info;
|
|
info.totalPoints = this->points.size();
|
|
info.currentPoint = this->currentPoint;
|
|
return info;
|
|
}
|