コード例 #1
0
        /// <summary>
        /// Adds the feataure classes to be transformed, sets the benchmark attribute IDs,
        /// transforms the data into graphics, and fills the error boxes on the next panel.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonTransform_Click(object sender, EventArgs e)
        {
            try
            {
                IDatasetName controlName = (IDatasetName)comboBoxControlPts.SelectedItem;
                _transform.ClearData();
                foreach (ListViewItem item in listViewData.Items)
                {
                    if (!_nameComparer.Equal((IDatasetName)item.Tag, controlName))
                    {
                        _transform.AddData((IFeatureClassName)item.Tag);
                    }
                }
                _transform.SetTSBenchmark(1, comboBoxBM1Att.SelectedItem.ToString());
                _transform.SetTSBenchmark(2, comboBoxBM2Att.SelectedItem.ToString());
                _transform.SetTSBenchmark(3, comboBoxBM3Att.SelectedItem.ToString());

                string rbName       = FormUtilities.GetCheckedRadioButton(groupBoxBMs).Name;
                int    defaultHinge = int.Parse(rbName.Substring(rbName.Length - 1));
                rbName = FormUtilities.GetCheckedRadioButton(groupBoxRotation).Name;
                int defaultBearing = int.Parse(rbName.Substring(rbName.Length - 1));
                rbName = string.Format("radioButton{0}{1}{2}", rbName.Contains("GPS") ? "GPS" : "Compass",
                                       defaultHinge, defaultBearing);

                IEnvelope extent = new EnvelopeClass();
                foreach (ListViewItem item in listViewData.CheckedItems)
                {
                    extent.Union(_transform.TransformFeatures2Graphics((IFeatureClassName)item.Tag,
                                                                       _graphicsColor));
                }
                ArcMap.Document.ActiveView.Extent = extent;
                ArcMap.Document.FocusMap.MapScale = 10000;
                ArcMap.Document.ActiveView.Refresh();

                ((RadioButton)panelOutput.Controls.Find(rbName, true)[0]).Checked = false; // to force things to update
                ((RadioButton)panelOutput.Controls.Find(rbName, true)[0]).Checked = true;

                string id;
                for (int hingeIndex = 1; hingeIndex <= 3; hingeIndex++)
                {
                    for (int bearingIndex = 1; bearingIndex <= 3; bearingIndex++)
                    {
                        if (bearingIndex != hingeIndex)
                        {
                            for (int benchmarkIndex = 1; benchmarkIndex <= 3; benchmarkIndex++)
                            {
                                if (benchmarkIndex != hingeIndex)
                                {
                                    id = hingeIndex.ToString() + bearingIndex.ToString() +
                                         benchmarkIndex.ToString();
                                    SetError("HGPS" + id);
                                    SetError("ZGPS" + id);
                                    SetError("HCompass" + id);
                                    SetError("ZCompass" + id);
                                }
                            }
                        }
                    }
                }

                panelInput.Visible  = false;
                panelOutput.Visible = true;
            }
            catch (Exception ex)
            {
                ShowError(ex.Message);
            }
        }