Libosmium  2.10.3
Fast and flexible C++ library for working with OpenStreetMap data
Public Member Functions | Private Attributes | List of all members
osmium::Box Class Reference

#include <box.hpp>

Collaboration diagram for osmium::Box:
Collaboration graph
[legend]

Public Member Functions

constexpr Box () noexcept
 
 Box (double minx, double miny, double maxx, double maxy)
 
 Box (const osmium::Location &bottom_left, const osmium::Location &top_right)
 
 Box (const Box &)=default
 
 Box (Box &&)=default
 
Boxoperator= (const Box &)=default
 
Boxoperator= (Box &&)=default
 
 ~Box ()=default
 
Boxextend (const Location &location) noexcept
 
Boxextend (const Box &box) noexcept
 
constexpr operator bool () const noexcept
 
constexpr bool valid () const noexcept
 
constexpr Location bottom_left () const noexcept
 
Locationbottom_left () noexcept
 
constexpr Location top_right () const noexcept
 
Locationtop_right () noexcept
 
bool contains (const osmium::Location &location) const noexcept
 
double size () const
 

Private Attributes

osmium::Location m_bottom_left
 
osmium::Location m_top_right
 

Detailed Description

Bounding box. A box is defined by two locations (bottom left location and top right location) or, alternatively by four coordinates (minx, miny, maxx, and maxy). If both locations are undefined, the box is undefined, too.

Constructor & Destructor Documentation

§ Box() [1/5]

constexpr osmium::Box::Box ( )
inlinenoexcept

Create undefined Box. Use the extend() function to add actual bounds.

§ Box() [2/5]

osmium::Box::Box ( double  minx,
double  miny,
double  maxx,
double  maxy 
)
inline

Create box from minimum and maximum coordinates.

Precondition
minx <= maxx && miny <= maxy

§ Box() [3/5]

osmium::Box::Box ( const osmium::Location bottom_left,
const osmium::Location top_right 
)
inline

Create box from bottom left and top right locations.

Precondition
Either both locations must be defined or neither.
If both locations are defined, the bottom left location must actually be to the left and below the top right location. Same coordinates for bottom/top or left/right are also okay.

§ Box() [4/5]

osmium::Box::Box ( const Box )
default

§ Box() [5/5]

osmium::Box::Box ( Box &&  )
default

§ ~Box()

osmium::Box::~Box ( )
default

Member Function Documentation

§ bottom_left() [1/2]

constexpr Location osmium::Box::bottom_left ( ) const
inlinenoexcept

Access bottom-left location.

§ bottom_left() [2/2]

Location& osmium::Box::bottom_left ( )
inlinenoexcept

Access bottom-left location.

§ contains()

bool osmium::Box::contains ( const osmium::Location location) const
inlinenoexcept

Check whether the location is inside the box.

Precondition
Location must be defined.
Box must be defined.

§ extend() [1/2]

Box& osmium::Box::extend ( const Location location)
inlinenoexcept

Extend this bounding box by the specified location. If the location is invalid, the bounding box is unchanged. If the box is undefined it will only contain the new location after this call.

Parameters
locationThe location we want to extend the box by.
Returns
A reference to this box.

§ extend() [2/2]

Box& osmium::Box::extend ( const Box box)
inlinenoexcept

Extend this bounding box by the specified box. If the specified box is undefined, the bounding box is unchanged.

Parameters
boxThe box to extend by.
Returns
A reference to this box.

§ operator bool()

constexpr osmium::Box::operator bool ( ) const
inlineexplicitnoexcept

Box is defined, ie. contains defined locations.

§ operator=() [1/2]

Box& osmium::Box::operator= ( const Box )
default

§ operator=() [2/2]

Box& osmium::Box::operator= ( Box &&  )
default

§ size()

double osmium::Box::size ( ) const
inline

Calculate size of the box in square degrees.

Note that this measure isn't very useful if you want to know the real-world size of the bounding box!

Exceptions
osmium::invalid_locationunless all coordinates are valid.

§ top_right() [1/2]

constexpr Location osmium::Box::top_right ( ) const
inlinenoexcept

Access top-right location.

§ top_right() [2/2]

Location& osmium::Box::top_right ( )
inlinenoexcept

Access top-right location.

§ valid()

constexpr bool osmium::Box::valid ( ) const
inlinenoexcept

Box is valid, ie. defined and inside usual bounds (-180<=lon<=180, -90<=lat<=90).

Member Data Documentation

§ m_bottom_left

osmium::Location osmium::Box::m_bottom_left
private

§ m_top_right

osmium::Location osmium::Box::m_top_right
private

The documentation for this class was generated from the following file: