public RhumbPanel() { InitializeComponent(); m_rhumb = Rhumb.WGS84(); m_Lat1TextBox.Text = "32"; m_lon1TextBox.Text = "-86"; m_lat2TextBox.Text = "33"; m_lon2TextBox.Text = "-87"; OnIndirect(this, null); }
private void OnValidate(object sender, EventArgs e) { try { double lat, lon, perim, area; PolygonArea pa = new PolygonArea(new Geodesic(50000.0, 0.001), true); pa = new PolygonArea(false); pa.AddPoint(32.0, -86.0); pa.AddEdge(20.0, 10000.0); pa.AddEdge(-45.0, 10000.0); pa.CurrentPoint(out lat, out lon); pa.Compute(false, false, out perim, out area); pa.TestEdge(-70.0, 5000.0, false, false, out perim, out area); pa.TestPoint(31.0, -86.5, false, false, out perim, out area); PolygonAreaExact p2 = new PolygonAreaExact(new GeodesicExact(), false); p2.AddPoint(32.0, -86.0); p2.AddEdge(20.0, 10000.0); p2.AddEdge(-45.0, 10000.0); p2.CurrentPoint(out lat, out lon); p2.Compute(false, false, out perim, out area); p2.TestEdge(-70.0, 5000.0, false, false, out perim, out area); p2.TestPoint(31.0, -86.5, false, false, out perim, out area); PolygonAreaRhumb p3 = new PolygonAreaRhumb(Rhumb.WGS84(), false); p3.AddPoint(32.0, -86.0); p3.AddEdge(20.0, 10000.0); p3.AddEdge(-45.0, 10000.0); p3.CurrentPoint(out lat, out lon); p3.Compute(false, false, out perim, out area); p3.TestEdge(-70.0, 5000.0, false, false, out perim, out area); p3.TestPoint(31.0, -86.5, false, false, out perim, out area); MessageBox.Show("No errors detected", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } }