Ejemplo n.º 1
0
        private void btnSelectGDB_Click(object sender, EventArgs e)
        {
            frmOpenFile file = new frmOpenFile();

            file.AddFilter(new MyGxFilterWorkspaces(), true);
            if (file.ShowDialog() == DialogResult.OK)
            {
                IGxDatabase database = file.Items.get_Element(0) as IGxDatabase;
                if (database != null)
                {
                    this.txtGDB.Text = (database as IGxObject).FullName;
                    if (!database.IsConnected)
                    {
                        database.Connect();
                    }
                    IWorkspaceReplicas workspace = database.Workspace as IWorkspaceReplicas;
                    if (workspace != null)
                    {
                        IEnumReplica replicas = workspace.Replicas;
                        replicas.Reset();
                        IReplica replica2 = replicas.Next();
                        if (replica2 != null)
                        {
                            this.lblCheckOutName.Text = replica2.Name;
                            this.txtGDB.Tag           = database.WorkspaceName;
                        }
                        else
                        {
                            this.txtGDB.Tag = null;
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            frmOpenFile file = new frmOpenFile();

            file.AddFilter(new MyGxFilterDatasets(), true);
            file.AllowMultiSelect = false;
            if (file.ShowDialog() == DialogResult.OK)
            {
                IGxDataset dataset = file.Items.get_Element(0) as IGxDataset;
                if (dataset != null)
                {
                    IGeoDataset dataset2 = dataset.Dataset as IGeoDataset;
                    if (dataset2 != null)
                    {
                        this.ispatialReference_0 = dataset2.SpatialReference;
                        TreeNode node = new TreeNode(this.ispatialReference_0.Name, 2, 2)
                        {
                            Tag = this.ispatialReference_0
                        };
                        this.treeNode_0.Nodes.Add(node);
                        this.method_4(this.ispatialReference_0);
                        this.method_6();
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            frmOpenFile file = new frmOpenFile();

            file.AddFilter(new MyGxFilterDatasets(), true);
            file.AllowMultiSelect = false;
            if (file.ShowDialog() == DialogResult.OK)
            {
                IGxDataset dataset = file.Items.get_Element(0) as IGxDataset;
                if (dataset != null)
                {
                    IGeoDataset dataset2 = dataset.Dataset as IGeoDataset;
                    if (dataset2 != null)
                    {
                        if (dataset2.SpatialReference is IUnknownCoordinateSystem)
                        {
                            this.ispatialReferenceInfo_0 = null;
                            this.textBoxName.Text        = "<NONE>";
                            this.textBoxName.Tag         = null;
                        }
                        else
                        {
                            this.ispatialReferenceInfo_0 =
                                (dataset2.SpatialReference as ISpatialReference3).VerticalCoordinateSystem;
                            this.textBoxName.Tag  = this.ispatialReferenceInfo_0;
                            this.textBoxName.Text = this.ispatialReferenceInfo_0.Name;
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void btnTemplateDB_Click(object sender, EventArgs e)
        {
            frmOpenFile openFile = new frmOpenFile();

            openFile.Text             = "选择模板数据库";
            openFile.AllowMultiSelect = false;
            openFile.AddFilter(new MyGxFilterPersonalGeodatabases(), true);
            openFile.AddFilter(new MyGxFilterFileGeodatabases(), false);
            openFile.AddFilter(new MyGxFilterEnteripesGeoDatabases(), false);
            if (openFile.ShowDialog() == DialogResult.OK)
            {
                IGxDatabase database = openFile.Items.get_Element(0) as IGxDatabase;
                if (database != null)
                {
                    IFeatureWorkspace pWorkspace =
                        Yutai.ArcGIS.Common.Helpers.WorkspaceHelper.GetWorkspace((database as IGxObject).FullName);
                    if (pWorkspace == null)
                    {
                        return;
                    }
                    bool isExists1 = ((IWorkspace2)pWorkspace).get_NameExists(esriDatasetType.esriDTTable, "MAPTEMPLATE");
                    bool isExists2 = ((IWorkspace2)pWorkspace).get_NameExists(esriDatasetType.esriDTTable, "MAPTEMPLATECLASS");
                    bool isExists3 = ((IWorkspace2)pWorkspace).get_NameExists(esriDatasetType.esriDTTable, "MAPTEMPLATEELEMENT");
                    bool isExists4 = ((IWorkspace2)pWorkspace).get_NameExists(esriDatasetType.esriDTTable, "MAPTEMPLATEEPARAM");
                    if (isExists4 && isExists1 && isExists3 && isExists2)
                    {
                        this.txtDB.Text = BuildConnectionString((database as IGxObject).FullName);
                    }
                    else
                    {
                        MessageService.Current.Warn("该数据库内没有地图制图模板数据!请重新选择!");
                    }
                }
            }
        }
Ejemplo n.º 5
0
        private void btnSelectOutLocation_Click(object sender, EventArgs e)
        {
            frmOpenFile file = new frmOpenFile
            {
                Text = "保存位置"
            };

            file.RemoveAllFilters();
            file.AddFilter(new MyGxFilterWorkspaces(), true);
            if (file.ShowDialog() == DialogResult.OK)
            {
                IArray items = file.Items;
                if (items.Count != 0)
                {
                    this.cboConfigKey.Properties.Items.Clear();
                    this.igxObject_0 = items.get_Element(0) as IGxObject;
                    IRasterWorkspaceEx ex = this.igxObject_0.InternalObjectName.Open() as IRasterWorkspaceEx;
                    this.method_1(ex as IGeodatabaseRelease, this.ispatialReference_1);
                    this.method_1(ex as IGeodatabaseRelease, this.ispatialReference_0);
                    this.txtLoaction.Name = this.igxObject_0.FullName;
                    if ((this.igxObject_0 is IGxDatabase) && (this.igxObject_0 as IGxDatabase).IsRemoteDatabase)
                    {
                        this.method_2((this.igxObject_0 as IGxDatabase).Workspace as IWorkspaceConfiguration);
                    }
                }
            }
        }
Ejemplo n.º 6
0
        private void btnDB_Click(object sender, EventArgs e)
        {
            frmOpenFile openFile = new frmOpenFile();

            openFile.AllowMultiSelect = false;
            openFile.AddFilter(new MyGxFilterWorkspaces(), true);
            openFile.AddFilter(new MyGxFilterFeatureDatasets(), false);
            if (openFile.ShowDialog() == DialogResult.OK)
            {
                IGxObject gxObject = openFile.Items.get_Element(0);
                if (gxObject is IGxDatabase)
                {
                    IGxDatabase database = gxObject as IGxDatabase;
                    txtDB.Text = database.WorkspaceName.PathName;
                    txtDB.Tag  = database;
                    label1.Tag = "Database";
                    xtraTabControl1.TabPages[0].PageVisible = true;
                }
                else if (gxObject is IGxDataset)
                {
                    IGxDataset dataset = gxObject as IGxDataset;
                    txtDB.Text = dataset.DatasetName.WorkspaceName.PathName + "\\" + dataset.DatasetName.Name;
                    txtDB.Tag  = dataset;
                    label1.Tag = "Dataset";
                    xtraTabControl1.TabPages[0].PageVisible = false;
                }
            }
        }
Ejemplo n.º 7
0
        private void btnOpenTable_Click(object sender, EventArgs e)
        {
            frmOpenFile file = new frmOpenFile();

            file.AddFilter(new MyGxFilterDatasets(), true);
            if (file.ShowDialog() == DialogResult.OK)
            {
                ITable dataset = (file.Items.get_Element(0) as IGxDataset).Dataset as ITable;
                if (dataset != null)
                {
                    this.cboRelatingTable.Properties.Items.Add(new ObjectWrap(dataset));
                }
            }
        }
Ejemplo n.º 8
0
        private void btnOpenFile_Click(object sender, EventArgs e)
        {
            frmOpenFile file = new frmOpenFile();

            file.AddFilter(new MyGxFilterSurfaceDatasets(), true);
            if (file.ShowDialog() == DialogResult.OK)
            {
                IDataset dataset = (file.Items.get_Element(0) as IGxDataset).Dataset;
                if (dataset != null)
                {
                    ISurface surface = this.method_1(dataset);
                    if (surface != null)
                    {
                        this.cboSufer.Items.Add(new SuferWrap(surface));
                        this.cboSufer.SelectedIndex = this.cboSufer.Items.Count - 1;
                    }
                }
            }
        }
Ejemplo n.º 9
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            frmOpenFile file = new frmOpenFile();

            file.AddFilter(new MyGxFilterDatasets(), true);
            file.AllowMultiSelect = false;
            if (file.ShowDialog() == DialogResult.OK)
            {
                IGxDataset dataset = file.Items.get_Element(0) as IGxDataset;
                if (dataset != null)
                {
                    IGeoDataset dataset2 = dataset.Dataset as IGeoDataset;
                    if (dataset2 != null)
                    {
                        this.ispatialReference_0 = dataset2.SpatialReference;
                        this.textBoxName.Text    = this.ispatialReference_0.Name;
                        this.textBoxName.Tag     = this.ispatialReference_0;
                        if (this.ispatialReference_0 is IUnknownCoordinateSystem)
                        {
                            this.btnModify.Enabled = false;
                        }
                        else
                        {
                            this.btnModify.Enabled = true;
                        }
                        IControlPrecision2 precision = this.ispatialReference_0 as IControlPrecision2;
                        if (NewObjectClassHelper.m_pObjectClassHelper.IsHighPrecision != precision.IsHighPrecision)
                        {
                            if (precision.IsHighPrecision)
                            {
                                precision.IsHighPrecision = NewObjectClassHelper.m_pObjectClassHelper.IsHighPrecision;
                                (this.ispatialReference_0 as ISpatialReferenceResolution).ConstructFromHorizon();
                            }
                            else
                            {
                                precision.IsHighPrecision = NewObjectClassHelper.m_pObjectClassHelper.IsHighPrecision;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 10
0
        private void btnSelectOutLocation_Click(object sender, EventArgs e)
        {
            frmOpenFile file = new frmOpenFile
            {
                Text = "保存位置"
            };

            file.RemoveAllFilters();
            file.AddFilter(new MyGxFilterWorkspaces(), true);
            if (file.ShowDialog() == DialogResult.OK)
            {
                IArray items = file.Items;
                if (items.Count != 0)
                {
                    this.igxObject_0 = items.get_Element(0) as IGxObject;
                    IRasterWorkspaceEx ex = this.igxObject_0.InternalObjectName.Open() as IRasterWorkspaceEx;
                    this.method_0(ex as IGeodatabaseRelease, this.ispatialReference_0);
                    this.txtLoaction.Text = this.igxObject_0.FullName;
                }
            }
        }
Ejemplo n.º 11
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            frmOpenFile file = new frmOpenFile();

            file.AddFilter(new MyGxFilterDatasets(), true);
            file.AllowMultiSelect = false;
            if (file.ShowDialog() == DialogResult.OK)
            {
                IGxDataset dataset = file.Items.get_Element(0) as IGxDataset;
                if (dataset != null)
                {
                    IGeoDataset dataset2 = dataset.Dataset as IGeoDataset;
                    if (dataset2 != null)
                    {
                        this.ispatialReference_0 = dataset2.SpatialReference;
                        IControlPrecision2 precision = this.ispatialReference_0 as IControlPrecision2;
                        if (this.bool_2 != precision.IsHighPrecision)
                        {
                            if (precision.IsHighPrecision)
                            {
                                precision.IsHighPrecision = this.bool_2;
                                (this.ispatialReference_0 as ISpatialReferenceResolution).ConstructFromHorizon();
                            }
                            else
                            {
                                precision.IsHighPrecision = this.bool_2;
                            }
                        }
                        this.method_1(this.ispatialReference_0);
                        if (this.SpatialReferenceChanged != null)
                        {
                            this.SpatialReferenceChanged(this.ispatialReference_0);
                        }
                        this.method_0();
                    }
                }
            }
        }
Ejemplo n.º 12
0
        private void btnLayer_Click(object sender, EventArgs e)
        {
            frmOpenFile openFile = new frmOpenFile();

            openFile.AllowMultiSelect = false;
            openFile.AddFilter(new MyGxFilterFeatureClasses(), true);
            if (openFile.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            IGxObject         gxObject   = openFile.Items.get_Element(0) as IGxObject;
            IFeatureClassName pClassName = gxObject.InternalObjectName as IFeatureClassName;
            //IWorkspace pWorkspace=((IName) pClassName.FeatureDatasetName.WorkspaceName).Open();
            IFeatureClass pClass = ((IName)pClassName).Open();

            if (pClass.ShapeType != esriGeometryType.esriGeometryPolygon)
            {
                MessageService.Current.Warn("索引图层只能是多边形图层,请重新选择!");
                return;
            }
            txtLayer.Text = ((IDataset)pClass).Name;
            txtLayer.Tag  = ((IDataset)pClass).Workspace.ConnectionProperties;
            LoadField(pClass);
        }