libosmscout  0.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules
osmscout::GeoBox Class Referencefinal

#include <GeoBox.h>

Public Member Functions

GeoBox CropTo (const GeoBox &other) const
 Create new GeoBox to is cropped to the bounds of the passed geo box. More...
 
 GeoBox ()=default
 The default constructor creates an invalid instance. More...
 
 GeoBox (const GeoBox &other)=default
 Copy-Constructor. More...
 
 GeoBox (const GeoCoord &coordA, const GeoCoord &coordB)
 Initialize the GeoBox based on the given coordinates. More...
 
GeoCoord GetBottomLeft () const
 south-west corner More...
 
GeoCoord GetBottomRight () const
 south-east corner More...
 
GeoCoord GetCenter () const
 
std::string GetDisplayText () const
 Return a string representation of the coordinate value in a human readable format. More...
 
double GetHeight () const
 Returns the height of the bounding box (maxLat-minLat). More...
 
GeoCoord GetMaxCoord () const
 Return the coordinate with the maximum value for the lat/lon values of the area. More...
 
double GetMaxLat () const
 Return the maximum latitude of the GeBox. More...
 
double GetMaxLon () const
 Return the maximum longitude of the GeBox. More...
 
GeoCoord GetMinCoord () const
 Return the coordinate with the minimum value for the lat/lon values of the area. More...
 
double GetMinLat () const
 Return the minimum latitude of the GeBox. More...
 
double GetMinLon () const
 Return the minimum longitude of the GeBox. More...
 
double GetSize () const
 Returns the size of the bounding box (width*height). More...
 
GeoCoord GetTopLeft () const
 north-west corner More...
 
GeoCoord GetTopRight () const
 north-east corner More...
 
double GetWidth () const
 Returns the width of the bounding box (maxLon-minLon). More...
 
void Include (const GeoBox &other)
 Resize the bounding box to include the original bounding box and the given bounding box. More...
 
void Include (const GeoCoord &point)
 Resize the bounding box to include the original bounding box and the given point. More...
 
template<typename P >
bool Includes (const P &coord, bool openInterval=true) const
 Returns 'true' if coordinate is within the bounding box. More...
 
GeoBox Intersection (const GeoBox &other) const
 Create new GeoBox from intersection of this with other If not Intersects, invalid GeoBox is returned. More...
 
bool Intersects (const GeoBox &other, bool openInterval=true) const
 Returns true, if both GeoBox instances intersect with each other. More...
 
void Invalidate ()
 Invalidate the bounding Box. More...
 
bool IsValid () const
 Returns true, if the GeoBox instance is valid. More...
 
bool operator!= (const GeoBox &other) const
 
GeoBoxoperator= (const GeoBox &other)=default
 Assign the value of other. More...
 
bool operator== (const GeoBox &other) const
 
void Set (const GeoCoord &coordA, const GeoCoord &coordB)
 Assign a new rectangular area bases an two coordinates defining the bounds. More...
 

Static Public Member Functions

static GeoBox BoxByCenterAndRadius (const GeoCoord &center, const Distance &radius)
 Return an GeoBox based on the center and the radius [meters] of a circle around the center. More...
 

Detailed Description

Anonymous geographic rectangular bounding box.

The bounding box is defined by two coordinates (type GeoCoord) that span a (in coordinate space) rectangular area.

Constructor & Destructor Documentation

◆ GeoBox() [1/3]

osmscout::GeoBox::GeoBox ( )
default

The default constructor creates an invalid instance.

◆ GeoBox() [2/3]

osmscout::GeoBox::GeoBox ( const GeoBox other)
default

Copy-Constructor.

◆ GeoBox() [3/3]

osmscout::GeoBox::GeoBox ( const GeoCoord coordA,
const GeoCoord coordB 
)

Initialize the GeoBox based on the given coordinates.

The two Coordinates together span a rectangular (in coordinates, not on the sphere) area.

Member Function Documentation

◆ BoxByCenterAndRadius()

◆ CropTo()

GeoBox osmscout::GeoBox::CropTo ( const GeoBox other) const

Create new GeoBox to is cropped to the bounds of the passed geo box.

Parameters
other

References GetMaxLat(), GetMaxLon(), GetMinLat(), and GetMinLon().

Referenced by osmscout::MercatorProjection::Set().

◆ GetBottomLeft()

GeoCoord osmscout::GeoBox::GetBottomLeft ( ) const
inline

◆ GetBottomRight()

GeoCoord osmscout::GeoBox::GetBottomRight ( ) const
inline

◆ GetCenter()

◆ GetDisplayText()

◆ GetHeight()

double osmscout::GeoBox::GetHeight ( ) const
inline

Returns the height of the bounding box (maxLat-minLat).

References osmscout::GeoCoord::GetLat().

Referenced by osmscout::CalculateCellLevel(), and osmscout::PolygonCenter().

◆ GetMaxCoord()

◆ GetMaxLat()

◆ GetMaxLon()

◆ GetMinCoord()

◆ GetMinLat()

◆ GetMinLon()

◆ GetSize()

double osmscout::GeoBox::GetSize ( ) const
inline

Returns the size of the bounding box (width*height).

Returns
GetWidth()*GetHeight()

◆ GetTopLeft()

GeoCoord osmscout::GeoBox::GetTopLeft ( ) const
inline

◆ GetTopRight()

GeoCoord osmscout::GeoBox::GetTopRight ( ) const
inline

◆ GetWidth()

double osmscout::GeoBox::GetWidth ( ) const
inline

Returns the width of the bounding box (maxLon-minLon).

References osmscout::GeoCoord::GetLon().

Referenced by osmscout::CalculateCellLevel(), and osmscout::PolygonCenter().

◆ Include() [1/2]

void osmscout::GeoBox::Include ( const GeoBox other)

Resize the bounding box to include the original bounding box and the given bounding box.

Changes the GeoBox to include the other bounding box, too (calculation of the common rectangular hull)

Parameters
otherOther geoBox to include, too

References osmscout::GeoCoord::GetLat(), osmscout::GeoCoord::GetLon(), GetMaxCoord(), GetMinCoord(), and osmscout::GeoCoord::Set().

Referenced by osmscout::GetBoundingBox(), osmscout::Area::GetBoundingBox(), osmscout::SearchRunnable::GetObjectDetails(), osmscout::LocationEntry::mergeWith(), osmscout::MapRenderer::overlayObjectsBox(), osmscout::PositionAgent::Process(), and osmscout::MercatorProjection::Set().

◆ Include() [2/2]

void osmscout::GeoBox::Include ( const GeoCoord point)

Resize the bounding box to include the original bounding box and the given point.

References osmscout::GeoCoord::GetLat(), osmscout::GeoCoord::GetLon(), and osmscout::GeoCoord::Set().

◆ Includes()

template<typename P >
bool osmscout::GeoBox::Includes ( const P &  coord,
bool  openInterval = true 
) const
inline

◆ Intersection()

GeoBox osmscout::GeoBox::Intersection ( const GeoBox other) const

Create new GeoBox from intersection of this with other If not Intersects, invalid GeoBox is returned.

Parameters
other

References GetMaxLat(), GetMaxLon(), GetMinLat(), GetMinLon(), and Intersects().

Referenced by osmscout::SRTM::GetHeightInBoundingBox().

◆ Intersects()

bool osmscout::GeoBox::Intersects ( const GeoBox other,
bool  openInterval = true 
) const
inline

◆ Invalidate()

void osmscout::GeoBox::Invalidate ( )
inline

◆ IsValid()

◆ operator!=()

bool osmscout::GeoBox::operator!= ( const GeoBox other) const
inline

References GetMaxCoord(), and GetMinCoord().

◆ operator=()

GeoBox& osmscout::GeoBox::operator= ( const GeoBox other)
default

Assign the value of other.

◆ operator==()

bool osmscout::GeoBox::operator== ( const GeoBox other) const
inline

References GetMaxCoord(), and GetMinCoord().

◆ Set()

void osmscout::GeoBox::Set ( const GeoCoord coordA,
const GeoCoord coordB 
)

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