7 #include <mapbox/geometry/point.hpp>
8 #include <mapbox/geometry/point_arithmetic.hpp>
9 #include <mapbox/geometry/line_string.hpp>
10 #include <mapbox/geometry/box.hpp>
17 class CanonicalTileID;
18 class UnwrappedTileID;
33 : lat(lat_), lon(lon_) {
34 if (std::isnan(lat)) {
35 throw std::domain_error(
"latitude must not be NaN");
37 if (std::isnan(lon)) {
38 throw std::domain_error(
"longitude must not be NaN");
40 if (std::abs(lat) > 90.0) {
41 throw std::domain_error(
"latitude must be between -90 and 90");
43 if (!std::isfinite(lon)) {
44 throw std::domain_error(
"longitude must not be infinite");
63 const double delta = std::abs(end.lon - lon);
74 return a.lat == b.lat && a.lon == b.lon;
100 std::swap(bounds.sw, bounds.ne);
166 bool containsLatitude(
double latitude)
const;
170 return (!a.bounded && !b.bounded) || (a.bounded && b.bounded && a.sw == b.sw && a.ne == b.ne);
195 EdgeInsets(
double t_ = 0,
double l_ = 0,
double b_ = 0,
double r_ = 0)
196 : _top(t_), _left(l_), _bottom(b_), _right(r_) {
197 if (std::isnan(_top)) {
198 throw std::domain_error(
"top must not be NaN");
200 if (std::isnan(_left)) {
201 throw std::domain_error(
"left must not be NaN");
203 if (std::isnan(_bottom)) {
204 throw std::domain_error(
"bottom must not be NaN");
206 if (std::isnan(_right)) {
207 throw std::domain_error(
"right must not be NaN");
211 double top()
const {
return _top; }
212 double left()
const {
return _left; }
213 double bottom()
const {
return _bottom; }
214 double right()
const {
return _right; }
217 return _top == 0 && _left == 0 && _bottom == 0 && _right == 0;
223 _bottom += o._bottom;
229 _top + o._top, _left + o._left, _bottom + o._bottom, _right + o._right,
236 return a._top == b._top && a._left == b._left && a._bottom == b._bottom && a._right == b._right;
The distance on each side between a rectangle and a rectangle within.
void operator+=(const EdgeInsets &o)
ScreenCoordinate getCenter(uint16_t width, uint16_t height) const
friend bool operator==(const EdgeInsets &a, const EdgeInsets &b)
EdgeInsets operator+(const EdgeInsets &o) const
friend bool operator!=(const EdgeInsets &a, const EdgeInsets &b)
EdgeInsets(double t_=0, double l_=0, double b_=0, double r_=0)
friend bool operator!=(const LatLngBounds &a, const LatLngBounds &b)
bool crossesAntimeridian() const
static LatLngBounds hull(const LatLng &a, const LatLng &b)
LatLngBounds(const CanonicalTileID &)
bool contains(const LatLngBounds &area, LatLng::WrapMode wrap=LatLng::Unwrapped) const
static LatLngBounds singleton(const LatLng &a)
void extend(const LatLng &point)
void extend(const LatLngBounds &bounds)
static LatLngBounds world()
bool intersects(LatLngBounds area, LatLng::WrapMode wrap=LatLng::Unwrapped) const
bool contains(const CanonicalTileID &tileID) const
friend bool operator==(const LatLngBounds &a, const LatLngBounds &b)
LatLng constrain(const LatLng &p) const
static LatLngBounds empty()
bool contains(const LatLng &point, LatLng::WrapMode wrap=LatLng::Unwrapped) const
friend bool operator!=(const LatLng &a, const LatLng &b)
void unwrapForShortestPath(const LatLng &end)
LatLng(double lat_=0, double lon_=0, WrapMode mode=Unwrapped)
friend bool operator==(const LatLng &a, const LatLng &b)
LatLng(const UnwrappedTileID &id)
LatLng(const CanonicalTileID &id)
std::enable_if_t< std::is_integral_v< T >, T > max(T a, T b)
constexpr double DEGREES_MAX
std::enable_if_t< std::is_integral_v< T >, T > min(T a, T b)
constexpr double LONGITUDE_MAX
T wrap(T value, T min, T max)
mapbox::geometry::box< double > ScreenBox
mapbox::geometry::point< double > ScreenCoordinate
mapbox::geometry::line_string< double > ScreenLineString