GeoDesk for C++
Fast and storage-efficient spatial database engine for OpenStreetMap features
|
An axis-aligned bounding box. More...
#include <Box.h>
Public Member Functions | |
constexpr | Box () |
constexpr | Box (int minX, int minY, int maxX, int maxY) |
constexpr | Box (Coordinate c) |
bool | isSimple () const |
A Box is simple if it is non-empty and does not straddle the Antimeridian. | |
bool | intersects (const Box &other) const |
bool | contains (int32_t x, int32_t y) const |
bool | containsSimple (int32_t x, int32_t y) const |
bool | containsSimple (Coordinate c) const |
bool | contains (Coordinate c) const |
bool | containsSimple (const Box &other) const |
Assumes neither box is empty, and neither crosses Antimeridian. | |
bool | contains (const Box &other) const |
int64_t | widthSimple () const |
int64_t | height () const |
double | area () const |
void | buffer (int32_t b) |
Coordinate | center () const |
int | minX () const |
int | minY () const |
int | maxX () const |
int | maxY () const |
double | minLon () const |
double | minLat () const |
double | maxLon () const |
double | maxLat () const |
Coordinate | topLeft () const |
Coordinate | bottomRight () const |
Coordinate | topRight () const |
Coordinate | bottomLeft () const |
void | setMinX (int32_t v) |
void | setMinY (int32_t v) |
void | setMaxX (int32_t v) |
void | setMaxY (int32_t v) |
bool | isEmpty () const |
bool | operator== (const Box &other) const |
bool | operator!= (const Box &other) const |
int32_t & | operator[] (size_t index) |
const int32_t & | operator[] (size_t index) const |
void | expandToIncludeSimple (const Box &b) |
void | expandToInclude (Coordinate c) |
void | expandToIncludeX (int32_t x) |
void | setEmpty () |
GEODESK_API void | format (char *buf) const |
GEODESK_API std::string | toString () const |
Static Public Member Functions | |
static constexpr Box | ofWorld () |
Returns a Box that encompasses the entire world. | |
static Box | normalizedSimple (Coordinate a, Coordinate b) |
Creates a simple Box regardless of order of coordinates. | |
static Box | unitsAroundXY (int32_t d, Coordinate pt) |
static Box | simpleIntersection (const Box &a, const Box &b) |
Returns a Box that represents the intersection of two Box objects. | |
static const Box & | simpleSmaller (const Box &a, const Box &b) |
An axis-aligned bounding box.
A Box represents minimum and maximum X and Y coordinates in a Mercator-projected plane. It can straddle the Antimeridian (in which case minX is larger than maxX). A Box can also be empty (in which case minY is larger than maxY).
A Box is considered simple if it is non-empty and does not straddle the Antimeridian (i.e. maxX >= minX && maxY >= minY
). Box methods with Simple
in their name assume that a Box is simple, allowing a more efficient implementation (but return an invalid result in case the Box is not).
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Assumes neither box is empty, and neither crosses Antimeridian.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
GEODESK_API void geodesk::Box::format | ( | char * | buf | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
A Box is simple if it is non-empty and does not straddle the Antimeridian.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
Creates a simple Box regardless of order of coordinates.
|
inlinestaticconstexpr |
Returns a Box that encompasses the entire world.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
GEODESK_API std::string geodesk::Box::toString | ( | ) | const |
|
inlinestatic |
|
inline |