ADD: new track message, Entity class and Position class
This commit is contained in:
29
libs/geographiclib/examples/example-DMS.cpp
Normal file
29
libs/geographiclib/examples/example-DMS.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
// Example of using the GeographicLib::DMS class
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <exception>
|
||||
#include <GeographicLib/DMS.hpp>
|
||||
|
||||
using namespace std;
|
||||
using namespace GeographicLib;
|
||||
|
||||
int main() {
|
||||
try {
|
||||
{
|
||||
string dms = "30d14'45.6\"S";
|
||||
DMS::flag type;
|
||||
double ang = DMS::Decode(dms, type);
|
||||
cout << type << " " << ang << "\n";
|
||||
}
|
||||
{
|
||||
double ang = -30.245715;
|
||||
string dms = DMS::Encode(ang, 6, DMS::LATITUDE);
|
||||
cout << dms << "\n";
|
||||
}
|
||||
}
|
||||
catch (const exception& e) {
|
||||
cerr << "Caught exception: " << e.what() << "\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user