Stride Reference Manual  1.0
stride::util::GeoCoordCalculator Class Reference

#include <GeoCoordCalculator.h>

Collaboration diagram for stride::util::GeoCoordCalculator:
Collaboration graph

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 GeoCoordCalculatorgetInstance ()
 Singleton pattern. More...
 

Private Member Functions

 GeoCoordCalculator ()
 
 ~GeoCoordCalculator ()
 
 GeoCoordCalculator (GeoCoordCalculator const &)=delete
 
void operator= (GeoCoordCalculator const &)=delete
 

Detailed Description

Definition at line 14 of file GeoCoordCalculator.h.

Constructor & Destructor Documentation

stride::util::GeoCoordCalculator::GeoCoordCalculator ( )
inlineprivate

Definition at line 81 of file GeoCoordCalculator.h.

stride::util::GeoCoordCalculator::~GeoCoordCalculator ( )
inlineprivate

Definition at line 83 of file GeoCoordCalculator.h.

stride::util::GeoCoordCalculator::GeoCoordCalculator ( GeoCoordCalculator const &  )
privatedelete

Member Function Documentation

template<class T >
GeoCoordinate stride::util::GeoCoordCalculator::generateRandomCoord ( const GeoCoordinate coord,
double  radius,
rng 
) const
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().

GeoCoordinate stride::util::GeoCoordCalculator::getMiddle ( const GeoCoordinate coord1,
const GeoCoordinate coord2 
) const
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.

void stride::util::GeoCoordCalculator::operator= ( GeoCoordCalculator const &  )
privatedelete

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