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:
Konstantin Pastbin
2025-04-13 16:37:30 +07:00
commit e3e4a1985a
12931 changed files with 13195100 additions and 0 deletions

65
routing/checkpoints.cpp Normal file
View File

@@ -0,0 +1,65 @@
#include "routing/checkpoints.hpp"
#include "geometry/mercator.hpp"
#include "base/assert.hpp"
#include <iomanip>
#include <sstream>
namespace routing
{
Checkpoints::Checkpoints(std::vector<m2::PointD> && points) : m_points(std::move(points))
{
CHECK_GREATER_OR_EQUAL(m_points.size(), 2,
("Checkpoints should at least contain start and finish"));
}
void Checkpoints::SetPointFrom(m2::PointD const & point)
{
ASSERT_LESS(m_passedIdx, m_points.size(), ());
m_points[m_passedIdx] = point;
}
m2::PointD const & Checkpoints::GetPoint(size_t pointIdx) const
{
ASSERT_LESS(pointIdx, m_points.size(), ());
return m_points[pointIdx];
}
m2::PointD const & Checkpoints::GetPointFrom() const
{
CHECK(!IsFinished(), ());
return GetPoint(m_passedIdx);
}
m2::PointD const & Checkpoints::GetPointTo() const
{
CHECK(!IsFinished(), ());
return GetPoint(m_passedIdx + 1);
}
void Checkpoints::PassNextPoint()
{
CHECK(!IsFinished(), ());
++m_passedIdx;
}
double Checkpoints::GetSummaryLengthBetweenPointsMeters() const
{
double dist = 0.0;
for (size_t i = 1; i < m_points.size(); ++i)
dist += mercator::DistanceOnEarth(m_points[i - 1], m_points[i]);
return dist;
}
std::string DebugPrint(Checkpoints const & checkpoints)
{
std::ostringstream out;
out << "Checkpoints(";
for (auto const & pt : checkpoints.GetPoints())
out << DebugPrint(mercator::ToLatLon(pt)) << "; ";
out << "passed: " << checkpoints.GetPassedIdx() << ")";
return out.str();
}
} // namespace routing