1 /** 2 * \file NETGeographicLib\EllipsoidPanel.cs 3 * \brief NETGeographicLib.Ellipsoid example 4 * 5 * NETGeographicLib is copyright (c) Scott Heiman (2013) 6 * GeographicLib is Copyright (c) Charles Karney (2010-2012) 7 * <charles@karney.com> and licensed under the MIT/X11 License. 8 * For more information, see 9 * https://geographiclib.sourceforge.io/ 10 **********************************************************************/ 11 using System; 12 using System.Collections.Generic; 13 using System.ComponentModel; 14 using System.Drawing; 15 using System.Data; 16 using System.Linq; 17 using System.Text; 18 using System.Windows.Forms; 19 using NETGeographicLib; 20 21 namespace Projections 22 { 23 public partial class EllipsoidPanel : UserControl 24 { 25 Ellipsoid m_ell = null; EllipsoidPanel()26 public EllipsoidPanel() 27 { 28 InitializeComponent(); 29 m_ell = new Ellipsoid(); 30 m_majorRadiusTextBox.Text = m_ell.EquatorialRadius.ToString(); 31 m_flatteningTextBox.Text = m_ell.Flattening.ToString(); 32 33 m_minorRadiusTextBox.Text = m_ell.MinorRadius.ToString(); 34 m_quarterMeridianTextBox.Text = m_ell.QuarterMeridian.ToString(); 35 m_areaTextBox.Text = m_ell.Area.ToString(); 36 m_volumeTextBox.Text = m_ell.Volume.ToString(); 37 m_2ndFlatTextBox.Text = m_ell.SecondFlattening.ToString(); 38 m_3rdFlatTextBox.Text = m_ell.ThirdFlattening.ToString(); 39 m_ecc2TextBox.Text = m_ell.EccentricitySq.ToString(); 40 m_2ecc2TextBox.Text = m_ell.SecondEccentricitySq.ToString(); 41 } 42 OnSet(object sender, EventArgs e)43 private void OnSet(object sender, EventArgs e) 44 { 45 try 46 { 47 double a = Double.Parse(m_majorRadiusTextBox.Text); 48 double f = Double.Parse(m_flatteningTextBox.Text); 49 m_ell = new Ellipsoid(a, f); 50 51 m_minorRadiusTextBox.Text = m_ell.MinorRadius.ToString(); 52 m_quarterMeridianTextBox.Text = m_ell.QuarterMeridian.ToString(); 53 m_areaTextBox.Text = m_ell.Area.ToString(); 54 m_volumeTextBox.Text = m_ell.Volume.ToString(); 55 m_2ndFlatTextBox.Text = m_ell.SecondFlattening.ToString(); 56 m_3rdFlatTextBox.Text = m_ell.ThirdFlattening.ToString(); 57 m_ecc2TextBox.Text = m_ell.EccentricitySq.ToString(); 58 m_2ecc2TextBox.Text = m_ell.SecondEccentricitySq.ToString(); 59 } 60 catch (Exception xcpt) 61 { 62 MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 63 } 64 } 65 OnCalculateLatitudes(object sender, EventArgs e)66 private void OnCalculateLatitudes(object sender, EventArgs e) 67 { 68 try 69 { 70 double phi = Double.Parse(m_phiTextBox.Text); 71 m_parametericLatTextBox.Text = m_ell.ParametricLatitude(phi).ToString(); 72 m_geocentricLatTextBox.Text = m_ell.GeocentricLatitude(phi).ToString(); 73 m_rectifyingLatTextBox.Text = m_ell.RectifyingLatitude(phi).ToString(); 74 m_authalicLatTextBox.Text = m_ell.AuthalicLatitude(phi).ToString(); 75 m_conformalTextBox.Text = m_ell.ConformalLatitude(phi).ToString(); 76 m_isometricLatTextBox.Text = m_ell.IsometricLatitude(phi).ToString(); 77 } 78 catch (Exception xcpt) 79 { 80 MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 81 } 82 } 83 OnValidate(object sender, EventArgs e)84 private void OnValidate(object sender, EventArgs e) 85 { 86 try 87 { 88 Ellipsoid ee = new Ellipsoid(50000.0, .003); 89 ee = new Ellipsoid(); 90 ee.AuthalicLatitude(30.0); 91 ee.CircleHeight(30.0); 92 ee.CircleRadius(30.0); 93 ee.ConformalLatitude(30.0); 94 ee.GeocentricLatitude(30.0); 95 ee.InverseAuthalicLatitude(30.0); 96 ee.InverseConformalLatitude(30.0); 97 ee.InverseGeocentricLatitude(30.0); 98 ee.InverseIsometricLatitude(30.0); 99 ee.InverseParametricLatitude(30.0); 100 ee.InverseRectifyingLatitude(30.0); 101 ee.IsometricLatitude(30.0); 102 ee.MeridianDistance(30.0); 103 ee.MeridionalCurvatureRadius(30.0); 104 ee.NormalCurvatureRadius(30.0, 60.0); 105 ee.ParametricLatitude(30.0); 106 ee.RectifyingLatitude(30.0); 107 ee.TransverseCurvatureRadius(30.0); 108 109 MessageBox.Show("no errors detected", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); 110 } 111 catch (Exception xcpt) 112 { 113 MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 114 } 115 } 116 } 117 } 118