51 lines
983 B
C++
51 lines
983 B
C++
/**
|
|
* @file route.h
|
|
* @author Alexander Klein (alex@kleiax.de)
|
|
* @brief
|
|
* @version 0.1
|
|
* @date 2022-01-31
|
|
*
|
|
* @copyright Copyright (c) 2022
|
|
*
|
|
*/
|
|
|
|
#ifndef ROUTE_H
|
|
#define ROUTE_H
|
|
|
|
#include <cstdint>
|
|
#include <list>
|
|
|
|
|
|
class Point{
|
|
public:
|
|
Point(double lat, double lon) { this->lat = lat; this->lon = lon; }
|
|
Point(){ this->lat = 0; this->lon = 0; }
|
|
|
|
double lat = 0;
|
|
double lon = 0;
|
|
|
|
bool operator==(const Point& rhs) const {
|
|
return this->lat == rhs.lat && this->lon == rhs.lon;
|
|
}
|
|
|
|
bool isValid() const { return this->lat + this->lon; }
|
|
};
|
|
|
|
class Route {
|
|
public:
|
|
Route();
|
|
void addPointToRoute(Point point);
|
|
Point startRoute();
|
|
Point getNextPoint();
|
|
|
|
uint16_t getNumberOfPoints() { return this->count_points; }
|
|
|
|
private:
|
|
uint16_t count_points = 0;
|
|
|
|
std::list<Point> points;
|
|
std::list<Point>::iterator* it;
|
|
|
|
};
|
|
|
|
#endif // ROUTE_H
|