Files
comaps/geometry/latlon.cpp
Konstantin Pastbin e3e4a1985a 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
2025-05-08 21:10:51 +07:00

37 lines
943 B
C++

#include "latlon.hpp"
#include <sstream>
#include <tuple>
namespace ms
{
bool LatLon::operator==(ms::LatLon const & rhs) const { return m_lat == rhs.m_lat && m_lon == rhs.m_lon; }
bool LatLon::operator<(ms::LatLon const & rhs) const
{
return std::tie(m_lat, m_lon) < std::tie(rhs.m_lat, rhs.m_lon);
}
bool LatLon::EqualDxDy(LatLon const & p, double eps) const
{
return (base::AlmostEqualAbs(m_lat, p.m_lat, eps) && base::AlmostEqualAbs(m_lon, p.m_lon, eps));
}
std::string DebugPrint(LatLon const & t)
{
std::ostringstream out;
out.precision(9); // <3>.<6> digits is enough here
out << "ms::LatLon(" << t.m_lat << ", " << t.m_lon << ")";
return out.str();
}
} // namespace ms
namespace base
{
bool AlmostEqualAbs(ms::LatLon const & ll1, ms::LatLon const & ll2, double const & eps)
{
return base::AlmostEqualAbs(ll1.m_lat, ll2.m_lat, eps) &&
base::AlmostEqualAbs(ll1.m_lon, ll2.m_lon, eps);
}
} // namespace base