libosmscout 0.1
Loading...
Searching...
No Matches
osmscout::GeoBox Class Referencefinal

Anonymous geographic rectangular bounding box. More...

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

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.

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.

Referenced by BoxByCenterAndRadius(), CropTo(), GeoBox(), Include(), Intersection(), Intersects(), operator!=(), operator=(), and operator==().

◆ GeoBox() [2/3]

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

Copy-Constructor.

References GeoBox().

◆ 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 GeoBox(), GetMaxLat(), GetMaxLon(), GetMinLat(), and GetMinLon().

◆ 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).

Referenced by osmscout::CalculateCellLevel(), GetSize(), 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()

References GetHeight(), and GetWidth().

Referenced by osmscout::EnsureSimple().

◆ 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).

Referenced by osmscout::CalculateCellLevel(), GetSize(), 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 GeoBox(), osmscout::GeoCoord::GetLat(), osmscout::GeoCoord::GetLon(), GetMaxCoord(), and GetMinCoord().

Referenced by osmscout::EnsureSimple(), osmscout::Area::GetBoundingBox(), osmscout::GetBoundingBox(), osmscout::GetBoundingBox(), osmscout::GetBoundingBox(), osmscout::GetBoundingBox(), osmscout::SearchRunnable::GetObjectDetails(), osmscout::MapRenderer::overlayObjectsBox(), and osmscout::PositionAgent::Process().

◆ 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(), and osmscout::GeoCoord::GetLon().

◆ Includes()

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

Returns 'true' if coordinate is within the bounding box.

Parameters
otherGeoCoord to check for inclusion
openIntervalIf true, an open interval for the GeoBox is assumed else a closed interval.
Returns
True, if there is intersection, else false.

Referenced by osmscout::ElevationService< DataLoader >::ElevationProfile(), osmscout::GetLineIntersection(), osmscout::Node::Intersects(), osmscout::IsAreaAtLeastPartlyInArea(), osmscout::MapWidget::isInDatabaseBoundingBox(), osmscout::LinesIntersect(), osmscout::LookupModule::requestLocationDescription(), osmscout::LookupModule::requestRegionLookup(), and osmscout::SearchModule::SearchForLocations().

◆ 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 GeoBox(), GetMaxLat(), GetMaxLon(), GetMinLat(), GetMinLon(), and Intersects().

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

◆ Intersects()

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

Returns true, if both GeoBox instances intersect with each other.

Parameters
otherOther instance to compare against
openIntervalIf true, an open interval for this GeoBox is assumed else a closed interval.
Returns
True, if there is intersection, else false.

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

Referenced by osmscout::MapPainter::DrawContourLines(), osmscout::MapPainter::DrawHillShading(), osmscout::ElevationService< DataLoader >::ElevationProfile(), osmscout::FindPathIntersections(), osmscout::AreaIndex::GetOffsets(), osmscout::AreaNodeIndex::GetOffsets(), osmscout::MapRenderer::getOverlayObjects(), Intersection(), osmscout::TileCache::invalidate(), osmscout::IsAreaAtLeastPartlyInArea(), and osmscout::DBLoadJob::Run().

◆ Invalidate()

void osmscout::GeoBox::Invalidate ( )
inline

◆ IsValid()

bool osmscout::GeoBox::IsValid ( ) const
inline

Returns true, if the GeoBox instance is valid.

This means there were values assigned to the box. While being valid, the rectangle spanned by the coordinate might still be degraded.

Referenced by osmscout::TileCache::invalidate(), osmscout::MapWidget::isDatabaseLoaded(), osmscout::MapWidget::isInDatabaseBoundingBox(), osmscout::MapPainter::IsVisibleArea(), osmscout::MapRenderer::overlayObjectsBox(), osmscout::MapWidget::recenter(), osmscout::MapWidget::showLocation(), and osmscout::FileWriter::WriteBox().

◆ operator!=()

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

◆ operator=()

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

Assign the value of other.

References BoxByCenterAndRadius(), and GeoBox().

◆ operator==()

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

◆ Set()

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

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