Beispiel #1
0
 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);
         MessageBox.Show("No errors detected", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (Exception xcpt)
     {
         MessageBox.Show(xcpt.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Beispiel #2
0
        private void OnAddEdge(object sender, EventArgs e)
        {
            try
            {
                double azi  = Double.Parse(m_azimuthTextBox.Text);
                double dist = Double.Parse(m_distanceTextBox.Text);

                m_poly.AddEdge(azi, dist);
                double lat, lon, length, area;
                m_poly.CurrentPoint(out lat, out lon);
                m_currLatTextBox.Text   = lat.ToString();
                m_currLonTextBox.Text   = lon.ToString();
                m_numPointsTextBox.Text = m_poly.Compute(false, false, out length, out area).ToString();
                m_lengthTextBox.Text    = length.ToString();
                if (!m_polylineCheckBox.Checked)
                {
                    m_areaTextBox.Text = area.ToString();
                }
            }
            catch (Exception xcpt)
            {
                MessageBox.Show(xcpt.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #3
0
 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);
         MessageBox.Show("No errors detected", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (Exception xcpt)
     {
         MessageBox.Show(xcpt.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }