/** * @file route.h * @author Alexander Klein (alex@kleiax.de) * @brief Contains a class which hold multiple Points * @version 0.1 * @date 2022-01-31 * * @copyright Copyright (c) 2022 * */ #ifndef ROUTE_H #define ROUTE_H #include #include /** * @brief A to handle points on the earth * * The points inherits latidue and longitude as doubles * */ class Point{ public: /** * @brief Construct a new Point object * * @param lat latidude * @param lon longitude */ Point(double lat, double lon) { this->lat = lat; this->lon = lon; } Point(){ this->lat = 0; this->lon = 0; } double lat = 0; double lon = 0; /** * @brief checks if to points are equal * * @param rhs * @return true * @return false */ bool operator==(const Point& rhs) const { return this->lat == rhs.lat && this->lon == rhs.lon; } /** * @brief Checks if the Point is valid * * @return true * @return false */ bool isValid() const { return this->lat + this->lon; } }; /** * @brief Holds some route information * */ struct RouteInfo{ /** * @brief Selected number of Points */ uint16_t currentPoint; /** * @brief Total points stored in route */ uint16_t totalPoints; }; /** * @brief A class to manage multiple points * * The list of point presents a route which can be driven */ class Route { public: /** * @brief Construct a new Route object */ Route(); /** * @brief Adds a point to the list * * @param point */ void addPointToRoute(Point point); /** * @brief Select the first point as target * * @return Point */ Point startRoute(); /** * @brief Get the next point and set it as target * * @return Point is zero if there are no more Points */ Point getNextPoint(); /** * @brief Get the Route Info object * * @return RouteInfo */ RouteInfo getRouteInfo(); private: uint16_t currentPoint = 0; std::list points; std::list::iterator it; }; #endif // ROUTE_H