Beispiel #1
0
        /// <summary>
        /// Transforms and saves the data.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void saveButton_Click(object sender, EventArgs e)
        {
            try
            {
                // Get spatial reference
                IFeatureClass benchmarks = (IFeatureClass)_benchmarkName.Open();
                _transform.SetSpatialReference(((IGeoDataset)benchmarks).SpatialReference);

                // Set benchmarks
                for (int i = 1; i < 4; i++)
                {
                    IFeature feature = benchmarks.GetFeature(i);
                    _transform.SetBenchmarkPoint(i, (IPoint)feature.ShapeCopy);
                }

                // Set total station benchmarks
                _transform.SetTSBenchmark(1, benchmark1ComboBox.Text);
                _transform.SetTSBenchmark(2, benchmark2ComboBox.Text);
                _transform.SetTSBenchmark(3, benchmark3ComboBox.Text);

                // Add data to be transformed
                foreach (IDatasetName dsName in EsriUtilities.GetFeatureClassNames(esriGeometryType.esriGeometryAny, _inputDatasetName))
                {
                    _transform.AddData((IFeatureClassName)dsName);
                }

                // Transform data
                IQueryFilter query = new QueryFilterClass();
                query.WhereClause = "\"Chosen\" = 1";
                ITable  table  = (ITable)_transformTableName.Open();
                ICursor cursor = table.Search(query, true);
                IRow    row    = cursor.NextRow();
                int     hinge  = Convert.ToInt32(((string)row.get_Value(table.FindField("Hinge"))).Split(' ')[1]);
                int     toBM   = Convert.ToInt32(((string)row.get_Value(table.FindField("Bearing"))).Split(' ')[2]);
                _transform.SaveData(hinge, toBM);

                // Close dialog
                Init();
                ChampExtension.GetExtension().GetApplyDockableWindow().Show(false);
                ArcMap.Document.ActiveView.Refresh();
            }
            catch (Exception ex)
            {
                ShowError(ex.Message);
            }
        }