Пример #1
0
        private void btnSelectWorkspace_Click(object sender, EventArgs e)
        {
            frmOpenFile file = new frmOpenFile
            {
                Text = "选择工作空间"
            };

            file.RemoveAllFilters();
            file.AddFilter(new MyGxFilterWorkspaces(), true);
            if (file.DoModalOpen() == DialogResult.OK)
            {
                IArray items = file.Items;
                if (items.Count != 0)
                {
                    IGxObject obj2 = items.get_Element(0) as IGxObject;
                    if (obj2 is IGxDatabase)
                    {
                        this.iworkspace_0 = (obj2 as IGxDatabase).Workspace;
                    }
                    else if (obj2 is IGxFolder)
                    {
                        IWorkspaceName name = new WorkspaceNameClass
                        {
                            WorkspaceFactoryProgID = "esriDataSourcesFile.ShapefileWorkspaceFactory",
                            PathName = (obj2.InternalObjectName as IFileName).Path
                        };
                        this.iworkspace_0 = (name as IName).Open() as IWorkspace;
                    }
                    this.txtWorkspaceName.Text = this.iworkspace_0.PathName;
                    this.txtWorkspaceName.Tag  = this.iworkspace_0;
                }
            }
        }
Пример #2
0
        private void btnSelectInputFeatures_Click(object sender, EventArgs e)
        {
            frmOpenFile file = new frmOpenFile
            {
                Text = "选择数据集"
            };

            file.RemoveAllFilters();
            file.AddFilter(new MyGxFilterDatasets(), true);
            if (file.DoModalOpen() == DialogResult.OK)
            {
                IArray items = file.Items;
                if (items.Count == 0)
                {
                    return;
                }
                IGxObject obj2 = items.get_Element(0) as IGxObject;
                this.txtInputFeatureClass.Text = obj2.FullName;
                this.txtInputFeatureClass.Tag  = obj2;
            }
            if (this.txtInputFeatureClass.Text.Length > 0)
            {
                this.btnAdd.Enabled = true;
            }
        }
Пример #3
0
        private void btnSelectOutDataset_Click(object sender, EventArgs e)
        {
            frmOpenFile file = new frmOpenFile
            {
                Text = "选择数据集"
            };

            file.RemoveAllFilters();
            file.AddFilter(new MyGxFilterDatasets(), true);
            if (file.DoModalOpen() == DialogResult.OK)
            {
                IArray items = file.Items;
                if (items.Count != 0)
                {
                    IGxObject obj2 = items.get_Element(0) as IGxObject;
                    this.txtOutDataset.Text = obj2.FullName;
                    this.txtOutDataset.Tag  = obj2;
                }
            }
        }
Пример #4
0
        private void btnSelectInputFeatures_Click(object sender, EventArgs e)
        {
            frmOpenFile file = new frmOpenFile
            {
                Text = "选择要素"
            };

            file.RemoveAllFilters();
            file.AddFilter(new MyGxFilterTablesAndFeatureClasses(), true);
            if (file.DoModalOpen() == DialogResult.OK)
            {
                if (file.Items.Count == 0)
                {
                    return;
                }
                IGxDataset dataset = file.Items.get_Element(0) as IGxDataset;
                if (dataset != null)
                {
                    if ((this.Table.Type == esriDatasetType.esriDTFeatureClass) &&
                        (dataset.Type == esriDatasetType.esriDTFeatureClass))
                    {
                        if (this.FeatureClass.ShapeType == (dataset.Dataset as IFeatureClass).ShapeType)
                        {
                            if (this.method_1(this.Table.Workspace, dataset.DatasetName.WorkspaceName) &&
                                ((this.FeatureClass as IDataset).Name == dataset.DatasetName.Name))
                            {
                                MessageBox.Show("源对象类和目标对象类必须不同!");
                                return;
                            }
                            this.txtInputFeatureClass.Text = (dataset as IGxObject).FullName;
                            this.txtInputFeatureClass.Tag  = dataset;
                        }
                        else
                        {
                            MessageBox.Show("装载数据必须和源数据有相同的几何数据类型!");
                        }
                    }
                    else if ((this.Table.Type == esriDatasetType.esriDTTable) &&
                             (dataset.Type == esriDatasetType.esriDTTable))
                    {
                        if (this.method_1(this.Table.Workspace, dataset.DatasetName.WorkspaceName) &&
                            (this.Table.Name == dataset.DatasetName.Name))
                        {
                            MessageBox.Show("源对象类和目标对象类必须不同!");
                            return;
                        }
                        this.txtInputFeatureClass.Text = (dataset as IGxObject).FullName;
                        this.txtInputFeatureClass.Tag  = dataset;
                    }
                }
                else
                {
                    this.txtInputFeatureClass.Text = "";
                    this.txtInputFeatureClass.Tag  = null;
                }
            }
            if (this.txtInputFeatureClass.Text.Length > 0)
            {
                this.btnAdd.Enabled = true;
            }
        }