1 using System;
2 using NETGeographicLib;
3 
4 namespace example_CassiniSoldner
5 {
6     class Program
7     {
Main(string[] args)8         static void Main(string[] args)
9         {
10             try {
11                 Geodesic geod = new Geodesic(); // WGS84
12                 const double lat0 = 48 + 50/60.0, lon0 = 2 + 20/60.0; // Paris
13                 CassiniSoldner proj = new CassiniSoldner(lat0, lon0, geod);
14                 {
15                     // Sample forward calculation
16                     double lat = 50.9, lon = 1.8; // Calais
17                     double x, y;
18                     proj.Forward(lat, lon, out x, out y);
19                     Console.WriteLine(String.Format("X: {0} Y: {1}", x, y));
20                 }
21                 {
22                     // Sample reverse calculation
23                     double x = -38e3, y = 230e3;
24                     double lat, lon;
25                     proj.Reverse(x, y, out lat, out lon);
26                     Console.WriteLine(String.Format("Latitude: {0} Longitude: {1}", lat, lon));
27                 }
28             }
29             catch (GeographicErr e) {
30                 Console.WriteLine( String.Format( "Caught exception: {0}", e.Message ) );
31             }
32         }
33     }
34 }
35