Moving coordinate auxiliary functions into the appropriate place
This commit is contained in:
@@ -21,6 +21,8 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
#ifndef COORDINATE_H_
|
||||
#define COORDINATE_H_
|
||||
|
||||
#include "../Util/StringUtil.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <climits>
|
||||
@@ -87,7 +89,7 @@ inline double ApproximateDistance(const _Coordinate &c1, const _Coordinate &c2)
|
||||
return ApproximateDistance( c1.lat, c1.lon, c2.lat, c2.lon );
|
||||
}
|
||||
|
||||
inline double ApproximateDistanceByEuclid(const _Coordinate &c1, const _Coordinate &c2) {
|
||||
inline double ApproximateEuclideanDistance(const _Coordinate &c1, const _Coordinate &c2) {
|
||||
assert(c1.lat != INT_MIN);
|
||||
assert(c1.lon != INT_MIN);
|
||||
assert(c2.lat != INT_MIN);
|
||||
@@ -105,4 +107,30 @@ inline double ApproximateDistanceByEuclid(const _Coordinate &c1, const _Coordina
|
||||
return d;
|
||||
}
|
||||
|
||||
static inline void convertInternalLatLonToString(const int value, std::string & output) {
|
||||
char buffer[100];
|
||||
buffer[10] = 0; // Nullterminierung
|
||||
char* string = printInt< 10, 5 >( buffer, value );
|
||||
output = string;
|
||||
}
|
||||
|
||||
static inline void convertInternalCoordinateToString(const _Coordinate & coord, std::string & output) {
|
||||
std::string tmp;
|
||||
convertInternalLatLonToString(coord.lon, tmp);
|
||||
output = tmp;
|
||||
output += ",";
|
||||
convertInternalLatLonToString(coord.lat, tmp);
|
||||
output += tmp;
|
||||
output += " ";
|
||||
}
|
||||
static inline void convertInternalReversedCoordinateToString(const _Coordinate & coord, std::string & output) {
|
||||
std::string tmp;
|
||||
convertInternalLatLonToString(coord.lat, tmp);
|
||||
output = tmp;
|
||||
output += ",";
|
||||
convertInternalLatLonToString(coord.lon, tmp);
|
||||
output += tmp;
|
||||
output += " ";
|
||||
}
|
||||
|
||||
#endif /* COORDINATE_H_ */
|
||||
|
||||
Reference in New Issue
Block a user