mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 05:13:58 +00:00
Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run: git remote add om-historic [om-historic.git repo url] git fetch --tags om-historic git replace squashed-history historic-commits
This commit is contained in:
44
routing/checkpoints.hpp
Normal file
44
routing/checkpoints.hpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include "geometry/point2d.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace routing
|
||||
{
|
||||
class Checkpoints final
|
||||
{
|
||||
public:
|
||||
Checkpoints() = default;
|
||||
Checkpoints(m2::PointD const & start, m2::PointD const & finish) : m_points({start, finish}) {}
|
||||
explicit Checkpoints(std::vector<m2::PointD> && points);
|
||||
|
||||
m2::PointD const & GetStart() const { return m_points.front(); }
|
||||
m2::PointD const & GetFinish() const { return m_points.back(); }
|
||||
std::vector<m2::PointD> const & GetPoints() const { return m_points; }
|
||||
size_t GetPassedIdx() const { return m_passedIdx; }
|
||||
|
||||
void SetPointFrom(m2::PointD const & point);
|
||||
m2::PointD const & GetPoint(size_t pointIdx) const;
|
||||
m2::PointD const & GetPointFrom() const;
|
||||
m2::PointD const & GetPointTo() const;
|
||||
|
||||
size_t GetNumSubroutes() const { return m_points.size() - 1; }
|
||||
bool IsFinished() const { return m_passedIdx >= GetNumSubroutes(); }
|
||||
|
||||
double GetSummaryLengthBetweenPointsMeters() const;
|
||||
|
||||
void PassNextPoint();
|
||||
|
||||
private:
|
||||
// m_points contains start, finish and intermediate points.
|
||||
std::vector<m2::PointD> m_points = {m2::PointD::Zero(), m2::PointD::Zero()};
|
||||
// m_passedIdx is the index of the checkpoint by which the user passed by.
|
||||
// By default, user has passed 0, it is start point.
|
||||
size_t m_passedIdx = 0;
|
||||
};
|
||||
|
||||
std::string DebugPrint(Checkpoints const & checkpoints);
|
||||
} // namespace routing
|
||||
Reference in New Issue
Block a user