mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-04 03:43:46 +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:
47
geometry/latlon.hpp
Normal file
47
geometry/latlon.hpp
Normal file
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
|
||||
#include "base/math.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace ms
|
||||
{
|
||||
/// \brief Class for representing WGS point.
|
||||
class LatLon
|
||||
{
|
||||
public:
|
||||
static double constexpr kMinLat = -90.0;
|
||||
static double constexpr kMaxLat = 90.0;
|
||||
static double constexpr kMinLon = -180.0;
|
||||
static double constexpr kMaxLon = 180.0;
|
||||
static double constexpr kInvalid = -1000.0;
|
||||
|
||||
// Default values are invalid.
|
||||
double m_lat = kInvalid;
|
||||
double m_lon = kInvalid;
|
||||
|
||||
LatLon() = default;
|
||||
LatLon(double lat, double lon) : m_lat(lat), m_lon(lon) {}
|
||||
|
||||
static LatLon Invalid() { return LatLon(kInvalid, kInvalid); }
|
||||
static LatLon Zero() { return LatLon(0.0, 0.0); }
|
||||
|
||||
bool IsValid() const { return m_lat != kInvalid && m_lon != kInvalid; }
|
||||
bool operator==(ms::LatLon const & rhs) const;
|
||||
bool operator<(ms::LatLon const & rhs) const;
|
||||
|
||||
bool EqualDxDy(LatLon const & p, double eps) const;
|
||||
|
||||
struct Hash
|
||||
{
|
||||
size_t operator()(ms::LatLon const & p) const { return base::Hash(p.m_lat, p.m_lon); }
|
||||
};
|
||||
};
|
||||
|
||||
std::string DebugPrint(LatLon const & t);
|
||||
} // namespace ms
|
||||
|
||||
namespace base
|
||||
{
|
||||
bool AlmostEqualAbs(ms::LatLon const & ll1, ms::LatLon const & ll2, double const & eps);
|
||||
} // namespace base
|
||||
Reference in New Issue
Block a user