Ejemplo n.º 1
0
 /// <summary>
 /// Clears everything.
 /// </summary>
 private void Init()
 {
     _transform = new ChampTransformClass();
     _transform.SetMap(ArcMap.Document.FocusMap);
     _benchmarkName                   = null;
     _transformTableName              = null;
     inputDatasetTextBox.Text         = "";
     controlPointsComboBox.DataSource = null;
     controlPointsComboBox.Text       = "";
     attributeFieldComboBox.Items.Clear();
     attributeFieldComboBox.Text = "";
     benchmark1ComboBox.Items.Clear();
     benchmark1ComboBox.Text = "";
     benchmark2ComboBox.Items.Clear();
     benchmark2ComboBox.Text = "";
     benchmark3ComboBox.Items.Clear();
     benchmark3ComboBox.Text     = "";
     benchmarkTextBox.Text       = "";
     transformTextBox.Text       = "";
     outputWorkspaceTextBox.Text = "";
 }
 /// <summary>
 /// Sets GPS benchmarks and compass bearings on the transform object and goes to the next
 /// screen.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void buttonSelectInputs_Click(object sender, EventArgs e)
 {
     try
     {
         if (radioButtonProj.Checked && comboBoxCoordSys.SelectedIndex == 0)
         {
             ShowError("If benchmarks are in projected coordinates, then the output" +
                       "coordinate system must also be projected.");
             return;
         }
         else if (radioButtonProj.Checked)
         {
             if (CheckAllCoords(false) && !ShowYesNoQuestion("These benchmark coordinates " +
                                                             "look unprojected. Are they really projected?"))
             {
                 return;
             }
             _transform.SetBenchmarkProj(1, double.Parse(textBoxLon1.Text),
                                         double.Parse(textBoxLat1.Text), double.Parse(textBoxElev1.Text));
             _transform.SetBenchmarkProj(2, double.Parse(textBoxLon2.Text),
                                         double.Parse(textBoxLat2.Text), double.Parse(textBoxElev2.Text));
             _transform.SetBenchmarkProj(3, double.Parse(textBoxLon3.Text),
                                         double.Parse(textBoxLat3.Text), double.Parse(textBoxElev3.Text));
         }
         else
         {
             if (!CheckAllCoords(false))
             {
                 ShowError("These benchmark coordinates are not geographic.");
                 return;
             }
             _transform.SetBenchmarkGeo(1, textBoxLon1.Text, textBoxLat1.Text,
                                        double.Parse(textBoxElev1.Text));
             _transform.SetBenchmarkGeo(2, textBoxLon2.Text, textBoxLat2.Text,
                                        double.Parse(textBoxElev2.Text));
             _transform.SetBenchmarkGeo(3, textBoxLon3.Text, textBoxLat3.Text,
                                        double.Parse(textBoxElev3.Text));
         }
         if (!string.IsNullOrEmpty(textBoxBearing12.Text))
         {
             _transform.SetCompassBearing(1, 2, double.Parse(textBoxBearing12.Text));
         }
         if (!string.IsNullOrEmpty(textBoxBearing13.Text))
         {
             _transform.SetCompassBearing(1, 3, double.Parse(textBoxBearing13.Text));
         }
         if (!string.IsNullOrEmpty(textBoxBearing23.Text))
         {
             _transform.SetCompassBearing(2, 3, double.Parse(textBoxBearing23.Text));
         }
         _transform.SetMap(ArcMap.Document.FocusMap);
         IEnvelope extent = _transform.GetBenchmark(1).Envelope;
         extent.Expand(1, 1, false);
         ArcMap.Document.ActiveView.Extent = extent;
         ArcMap.Document.FocusMap.MapScale = 24000;
         DeleteGraphicsLayers();
         ArcMap.Document.ActiveView.Refresh();
         _viewedTransforms.Clear();
         panelGPS.Visible   = false;
         panelInput.Visible = true;
     }
     catch (Exception ex)
     {
         ShowError(ex.Message);
     }
 }