libosmscout
0.1
|
#include <GeoCoord.h>
Public Types | |
using | GeoCoordBuffer = std::array< std::byte, 7 > |
Public Member Functions | |
GeoCoord | Add (const Bearing &bearing, const Distance &distance) const |
Get coordinate of position + course and distance. More... | |
void | EncodeToBuffer (GeoCoordBuffer &buffer) const |
Encode the coordinate value into a buffer - as it would be done by FileScanner/FileWriter classes. More... | |
GeoCoord ()=default | |
The default constructor creates an uninitialized instance (for performance reasons). More... | |
GeoCoord (const GeoCoord &other)=default | |
GeoCoord (double lat, double lon) | |
Initialize the coordinate with the given latitude and longitude values. More... | |
std::string | GetDisplayText () const |
Return a string representation of the coordinate value in a human readable format. More... | |
Distance | GetDistance (const GeoCoord &target) const |
Get distance between two coordinates. More... | |
Id | GetHash () const |
Encode the coordinate value into a number (the number has hash character). More... | |
Id | GetId () const |
Returns a fast calculable unique id for the coordinate. More... | |
double | GetLat () const |
Return the latitude value of the coordinate. More... | |
double | GetLon () const |
Return the latitude value of the coordinate. More... | |
bool | IsEqual (const GeoCoord &other) const |
Return true if both coordinates are equal (using == operator) More... | |
bool | IsValid () const |
Return true if latitude is in range <-90,+90> and longitude in range <-180,+180> More... | |
bool | operator!= (const GeoCoord &other) const |
Return true if coordinates are not equal. More... | |
Distance | operator- (const GeoCoord &other) const |
bool | operator< (const GeoCoord &other) const |
std::ostream & | operator<< (std::ostream &stream) const |
GeoCoord & | operator= (const GeoCoord &other)=default |
Assign the value of other. More... | |
bool | operator== (const GeoCoord &other) const |
Return true if both coordinates are equals (using == operator) More... | |
void | Set (double lat, double lon) |
Assign a new latitude and longitude value to the coordinate. More... | |
Static Public Member Functions | |
static bool | Parse (const std::string &text, GeoCoord &coord) |
Parse a textual representation of a geo coordinate from a string to an GeoCoord instance. More... | |
Static Public Attributes | |
static constexpr int | MaxLatitude = 90 |
static constexpr int | MaxLongitude = 180 |
static constexpr int | MinLatitude = -90 |
static constexpr int | MinLongitude = -180 |
Anonymous geographic coordinate.
using osmscout::GeoCoord::GeoCoordBuffer = std::array<std::byte,7> |
|
default |
The default constructor creates an uninitialized instance (for performance reasons).
|
default |
|
inline |
Initialize the coordinate with the given latitude and longitude values.
Get coordinate of position + course and distance.
bearing | Target course in degree |
distance | Target distance |
References osmscout::Distance::AsMeter(), and osmscout::GetEllipsoidalDistance().
|
inline |
Encode the coordinate value into a buffer - as it would be done by FileScanner/FileWriter classes.
The coord will be encoded with the maximum resolution (of the library), Coords with the same buffer value thus will in effect equal.
References osmscout::latConversionFactor, and osmscout::lonConversionFactor.
std::string osmscout::GeoCoord::GetDisplayText | ( | ) | const |
Return a string representation of the coordinate value in a human readable format.
References GetLat(), and GetLon().
Referenced by osmscout::LocationEntry::getDebugString(), osmscout::DescriptionService::GetDescription(), osmscout::GeoBox::GetDisplayText(), osmscout::SRTM::GetHeightAtLocation(), osmscout::LocationInfoModel::onLocationDescription(), and osmscout::LocationListModel::setPattern().
Get distance between two coordinates.
target | Target coordinate to measure distance |
References osmscout::GetEllipsoidalDistance().
|
inline |
Encode the coordinate value into a number (the number has hash character).
References osmscout::latConversionFactor, and osmscout::lonConversionFactor.
Id osmscout::GeoCoord::GetId | ( | ) | const |
Returns a fast calculable unique id for the coordinate.
Coordinates with have the same latitude and longitude value in the supported resolution wil have the same id.
The id does not have any semantics regarding sorting. Coordinates with close ids do not need to be close in location.
References osmscout::latConversionFactor, and osmscout::lonConversionFactor.
|
inline |
Return the latitude value of the coordinate.
Referenced by osmscout::AreaSorter(), osmscout::GeoBox::BoxByCenterAndRadius(), osmscout::CalculateDistancePointToLineSegment(), osmscout::MapObjectInfoModel::data(), osmscout::NearPOIModel::data(), osmscout::LocationListModel::data(), osmscout::LocationDescriptionService::DescribeLocationByWay(), osmscout::DistanceToSegment(), osmscout::MapPainter::DrawHillShading(), osmscout::FindPathIntersections(), osmscout::Projection::BatchTransformer::GeoToPixel(), osmscout::TileProjection::GeoToPixel(), osmscout::MercatorProjection::GeoToPixel(), osmscout::GeoBox::GetBottomRight(), osmscout::GeoBox::GetCenter(), osmscout::SimpleRoutingService::GetClosestRoutableNode(), GetDisplayText(), osmscout::GetEllipsoidalDistance(), osmscout::GeoBox::GetHeight(), osmscout::SRTM::GetHeightAtLocation(), osmscout::SRTM::GetHeightInBoundingBox(), osmscout::Point::GetId(), osmscout::Point::GetLat(), osmscout::LocationEntry::getLat(), osmscout::RouteStep::getLat(), osmscout::GeoBox::GetMaxLat(), osmscout::GeoBox::GetMinLat(), osmscout::OSMTileId::GetOSMTile(), osmscout::getSegDistSq(), osmscout::GetSphericalBearingFinal(), osmscout::GetSphericalBearingInitial(), osmscout::GetSphericalDistance(), osmscout::GetSunriseSunset(), osmscout::CoverageIndex::GetTile(), osmscout::TileId::GetTile(), osmscout::GeoBox::GetTopLeft(), osmscout::MapWidget::hoverMoveEvent(), osmscout::GeoBox::Include(), osmscout::GeoBox::Includes(), osmscout::GeoBox::Intersects(), osmscout::MercatorProjection::IsValidFor(), osmscout::TileProjection::IsValidFor(), osmscout::MercatorProjection::Move(), osmscout::MoveHandler::moveNow(), osmscout::MapWidget::onIconFound(), osmscout::NavigationModel::onPositionEstimate(), osmscout::NavigationModel::onRerouteRequest(), osmscout::MapPainterOpenGL::OnTranslation(), osmscout::pointToPolygonDist(), osmscout::FileScanner::Read(), osmscout::GeoBox::Set(), osmscout::MercatorProjection::Set(), osmscout::TileProjection::SetInternal(), osmscout::SunriseSunset::setLongitude(), and osmscout::FileWriter::WriteCoord().
|
inline |
Return the latitude value of the coordinate.
Referenced by osmscout::AreaSorter(), osmscout::GeoBox::BoxByCenterAndRadius(), osmscout::CalculateDistancePointToLineSegment(), osmscout::MapObjectInfoModel::data(), osmscout::NearPOIModel::data(), osmscout::LocationListModel::data(), osmscout::LocationDescriptionService::DescribeLocationByWay(), osmscout::DistanceToSegment(), osmscout::MapPainter::DrawHillShading(), osmscout::FindPathIntersections(), osmscout::Projection::BatchTransformer::GeoToPixel(), osmscout::TileProjection::GeoToPixel(), osmscout::MercatorProjection::GeoToPixel(), osmscout::GeoBox::GetBottomRight(), osmscout::GeoBox::GetCenter(), osmscout::SimpleRoutingService::GetClosestRoutableNode(), GetDisplayText(), osmscout::GetEllipsoidalDistance(), osmscout::SRTM::GetHeightAtLocation(), osmscout::SRTM::GetHeightInBoundingBox(), osmscout::Point::GetId(), osmscout::Point::GetLon(), osmscout::LocationEntry::getLon(), osmscout::RouteStep::getLon(), osmscout::GeoBox::GetMaxLon(), osmscout::GeoBox::GetMinLon(), osmscout::OSMTileId::GetOSMTile(), osmscout::getSegDistSq(), osmscout::GetSphericalBearingFinal(), osmscout::GetSphericalBearingInitial(), osmscout::GetSphericalDistance(), osmscout::GetSunriseSunset(), osmscout::CoverageIndex::GetTile(), osmscout::TileId::GetTile(), osmscout::GeoBox::GetTopLeft(), osmscout::GeoBox::GetWidth(), osmscout::MapWidget::hoverMoveEvent(), osmscout::GeoBox::Include(), osmscout::GeoBox::Includes(), osmscout::GeoBox::Intersects(), osmscout::MercatorProjection::IsValidFor(), osmscout::TileProjection::IsValidFor(), osmscout::MercatorProjection::Move(), osmscout::MoveHandler::moveNow(), osmscout::MapWidget::onIconFound(), osmscout::NavigationModel::onPositionEstimate(), osmscout::NavigationModel::onRerouteRequest(), osmscout::MapPainterOpenGL::OnTranslation(), osmscout::MercatorProjection::PixelToGeo(), osmscout::pointToPolygonDist(), osmscout::FileScanner::Read(), osmscout::GeoBox::Set(), osmscout::SunriseSunset::setLatitude(), and osmscout::FileWriter::WriteCoord().
|
inline |
Return true if both coordinates are equal (using == operator)
|
inline |
Return true if latitude is in range <-90,+90> and longitude in range <-180,+180>
Referenced by Parse().
|
inline |
Return true if coordinates are not equal.
|
inline |
|
inline |
Assign the value of other.
|
inline |
Return true if both coordinates are equals (using == operator)
|
static |
Parse a textual representation of a geo coordinate from a string to an GeoCoord instance.
The text should follow the following expression:
[+|-|N|S] <coordinate> [N|S] [+|-|W|E] <coordinate> [W|E]
coordinate may have one of these formats: DDD[.DDDDD] DD°[D[.DDD]'[D[.DDD]"]] DD°[D[.DDD]
The means:
Possibly in future more variants will be supported. It is guaranteed that the result of GetDisplayText() is successfully parsed.
text | Text containing the textual representation |
coord | The resulting coordinate, if the text was correctly parsed |
References osmscout::EatWhitespace(), IsValid(), osmscout::ScanCoordinate(), and Set().
Referenced by osmscout::LocationListModel::setPattern().
|
inline |
Assign a new latitude and longitude value to the coordinate.
Referenced by osmscout::CalculateDistancePointToLineSegment(), osmscout::Way::GetCenter(), osmscout::Area::Ring::GetCenter(), osmscout::Area::GetCenter(), osmscout::GeoBox::Include(), osmscout::GeoBox::Invalidate(), osmscout::MoveHandler::moveNow(), Parse(), osmscout::TileProjection::PixelToGeo(), osmscout::MercatorProjection::PixelToGeo(), and osmscout::GeoBox::Set().
|
staticconstexpr |
Referenced by osmscout::WaterIndex::GetRegions(), and osmscout::CmdLineGeoCoordArgParser::Parse().
|
staticconstexpr |
Referenced by osmscout::WaterIndex::GetRegions(), and osmscout::CmdLineGeoCoordArgParser::Parse().
|
staticconstexpr |
Referenced by osmscout::CmdLineGeoCoordArgParser::Parse().
|
staticconstexpr |
Referenced by osmscout::CmdLineGeoCoordArgParser::Parse().