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 }
Eigen::Forward
@ Forward
Definition: NumericalDiff.h:19
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
NETGeographicLib::GeographicErr
Exception class for NETGeographicLib.
Definition: NETGeographicLib.h:132
main
int main(array< System::String ^> ^)
Definition: dotnet/examples/ManagedCPP/example-GARS.cpp:4
array
Definition: numpy.h:821
len
size_t len(handle h)
Get the length of a Python object.
Definition: pytypes.h:2446
lon
static const double lon
Definition: testGeographicLib.cpp:34
NETGeographicLib
Definition: Accumulator.h:13
lat
static const double lat
Definition: testGeographicLib.cpp:34


gtsam
Author(s):
autogenerated on Thu Jul 4 2024 03:01:20