I'm trying to figure out why I'm getting this error in Xcode when trying to write this function. I've included the following files.
#include "GeographicLib/Geodesic.hpp"
using namespace GeographicLib;
Xcode is telling me that it's expecting a class or namespace on the line that declares the Geodesic.
double Route::totalDistance()
{
double totalDis = 0;
try
{
const Geodesic& geod = Geodesic::WGS84();
}
catch (const exception& e) {
cerr << "Caught exception: " << e.what() << "\n";
return 1;
}
for (vector<route_node>::iterator it = route.begin()+1; it != route.end(); ++it)
{
double
lat1 = it->latitude, lon1 = it->longitude,
lat2 = (it+1)->latitude, lon2 = (it+1)->longitude;
double s12;
geod.Inverse(lat1, lon1, lat2, lon2, s12);
totalDis += s12;
}
return totalDis;
}
Aucun commentaire:
Enregistrer un commentaire