Stride Reference Manual
1.0
|
#include <GeoCoordCalculator.h>
Public Member Functions | |
double | getDistance (const GeoCoordinate &coord1, const GeoCoordinate &coord2) const |
template<class T > | |
GeoCoordinate | generateRandomCoord (const GeoCoordinate &coord, double radius, T rng) const |
Result is in kilometers Uses the haversine formula See: http://www.movable-type.co.uk/scripts/latlong.html. More... | |
GeoCoordinate | getMiddle (const GeoCoordinate &coord1, const GeoCoordinate &coord2) const |
radius is in kilometres TODO make the distribution fair More... | |
void | convertToRegularCoordinates (double &latitude, double &longitude) const |
Static Public Member Functions | |
static const GeoCoordCalculator & | getInstance () |
Singleton pattern. More... | |
Private Member Functions | |
GeoCoordCalculator () | |
~GeoCoordCalculator () | |
GeoCoordCalculator (GeoCoordCalculator const &)=delete | |
void | operator= (GeoCoordCalculator const &)=delete |
Definition at line 14 of file GeoCoordCalculator.h.
|
inlineprivate |
Definition at line 81 of file GeoCoordCalculator.h.
|
inlineprivate |
Definition at line 83 of file GeoCoordCalculator.h.
|
privatedelete |
|
static |
Singleton pattern.
Mean radius of the earth (in metres)
Definition at line 11 of file GeoCoordCalculator.cpp.
Referenced by stride::ClusterCalculator< type >::calcSurface(), stride::Simulator::chooseCluster(), stride::popgen::PopulationGenerator< U >::getCityRadius(), stride::popgen::PopulationGenerator< U >::getClusters(), stride::popgen::PopulationGenerator< U >::makeDistanceMap(), and stride::popgen::PopulationGenerator< U >::makeVillages().
double GeoCoordCalculator::getDistance | ( | const GeoCoordinate & | coord1, |
const GeoCoordinate & | coord2 | ||
) | const |
Definition at line 17 of file GeoCoordCalculator.cpp.
References stride::util::GeoCoordinate::m_latitude, stride::util::GeoCoordinate::m_longitude, and PI.
Referenced by stride::popgen::PopulationGenerator< U >::getCityRadius(), stride::popgen::PopulationGenerator< U >::getClusters(), and stride::popgen::PopulationGenerator< U >::makeDistanceMap().
|
inline |
Result is in kilometers Uses the haversine formula See: http://www.movable-type.co.uk/scripts/latlong.html.
Partially the inverse of GeoCoordCalculator::getDistance, therefore I use the same variable names For future improvements, use this: http://gis.stackexchange.com/questions/25877/generating-random-locations-nearby
Definition at line 25 of file GeoCoordCalculator.h.
References stride::util::GeoCoordinate::m_latitude, stride::util::GeoCoordinate::m_longitude, and PI.
Referenced by stride::popgen::PopulationGenerator< U >::makeVillages().
|
inline |
radius is in kilometres TODO make the distribution fair
Formula found online TODO test
Definition at line 59 of file GeoCoordCalculator.h.
References stride::util::GeoCoordinate::m_latitude, stride::util::GeoCoordinate::m_longitude, and PI.
void GeoCoordCalculator::convertToRegularCoordinates | ( | double & | latitude, |
double & | longitude | ||
) | const |
Definition at line 30 of file GeoCoordCalculator.cpp.
|
privatedelete |