dotnet/examples/ManagedCPP/example-GARS.cpp
Go to the documentation of this file.
1 using namespace System;
2 using namespace NETGeographicLib;
3 
5 {
6  try {
7  {
8  // Sample forward calculation
9  double lat = 57.64911, lon = 10.40744; // Jutland
10  String^ gars;
11  for (int prec = 0; prec <= 2; ++prec) {
12  GARS::Forward(lat, lon, prec, gars);
13  Console::WriteLine(String::Format("Precision: {0} GARS: {1}", prec, gars));
14  }
15  }
16  {
17  // Sample reverse calculation
18  String^ gars = gcnew String("381NH45");
19  double lat, lon;
20  for (int len = 5; len <= gars->Length; ++len) {
21  int prec;
22  GARS::Reverse(gars->Substring(0, len), lat, lon, prec, true);
23  Console::WriteLine(String::Format("Precision: {0} Latitude: {1} Longitude {2}", prec, lat, lon));
24  }
25  }
26  }
27  catch (GeographicErr^ e) {
28  Console::WriteLine(String::Format("Caught Exception {0}", e->Message));
29  return 1;
30  }
31  return 0;
32 }
static const double lat
Exception class for NETGeographicLib.
Definition: numpy.h:680
Array< double, 1, 3 > e(1./3., 0.5, 2.)
static const double lon
int main(array< System::String ^> ^)
size_t len(handle h)
Get the length of a Python object.
Definition: pytypes.h:2244


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:34:12