Ejemplo n.º 1
0
        public override void Click(enumContextKeys key)
        {
            switch (key)
            {
            case enumContextKeys.AddFeatureClass:
                using (frmFetClassDlg frm = new frmFetClassDlg())
                {
                    ICatalogEntity entity = new SpatialFeatureClass();
                    frm.SetSpatialDataset(_tag as SpatialFeatureDataset);
                    (entity as CatalogEntityBase)._connString = (_tag as CatalogEntityBase)._connString;
                    if (frm.ShowDialog(ref entity, true, false))
                    {
                        if ((entity as SpatialFeatureClass).SpatialRef == null)
                        {
                            (entity as SpatialFeatureClass).SpatialRef = (_tag as SpatialFeatureDataset).SpatialRef;
                        }
                        entity.Store();
                        AddChild(new CatalogFeatureClass(entity.Name, entity, entity.Description));
                    }
                }
                Refresh();
                break;

            case enumContextKeys.Property:
                using (frmFeatureDatasetsEditor frm = new frmFeatureDatasetsEditor())
                {
                    ICatalogEntity entity = _tag as ICatalogEntity;
                    if (frm.ShowDialog(ref entity, false, false))
                    {
                        entity.Store();
                        Refresh();
                    }
                }
                break;

            case enumContextKeys.Delete:
                if (MsgBox.ShowQuestionYesNo("确定要删除要素集\"" + _name + "\"吗?\n\n删除以后不能恢复。") == System.Windows.Forms.DialogResult.No)
                {
                    return;
                }
                SpatialFeatureDataset ds = _tag as SpatialFeatureDataset;
                using (ICatalogEntityClass c = new CatalogEntityClassFeatureDataset(ds._connString))
                {
                    c.Delete(ds);
                    ICatalogItem pIt = _parent;
                    _parent.Remove(this);
                    pIt.Refresh();
                }
                break;

            case enumContextKeys.ImportData:
                ImportData();
                break;

            default:
                base.Click(key);
                break;
            }
        }
Ejemplo n.º 2
0
        public override void Click(enumContextKeys key)
        {
            switch (key)
            {
            case enumContextKeys.AddFeatureDataset:
                using (frmFeatureDatasetsEditor frm = new frmFeatureDatasetsEditor())
                {
                    ICatalogEntity entity = new SpatialFeatureDataset();
                    (entity as CatalogEntityBase)._connString = (_tag as SpatialDatabaseConn).ConnectionString;
                    if (frm.ShowDialog(ref entity, true, false))
                    {
                        entity.Store();
                        AddChild(new CatalogFeatureDataset(entity.Name, entity, entity.Description));
                    }
                }
                Refresh();
                break;

            case enumContextKeys.AddFeatureClass:
                using (frmFetClassDlg frm = new frmFetClassDlg())
                {
                    ICatalogEntity entity = new SpatialFeatureClass();
                    frm.SetSpatialDataset(null);
                    (entity as CatalogEntityBase)._connString = (_tag as SpatialDatabaseConn).ConnectionString;
                    if (frm.ShowDialog(ref entity, true, false))
                    {
                        entity.Store();
                        AddChild(new CatalogFeatureClass(entity.Name, entity, entity.Description));
                    }
                }
                Refresh();
                break;

            case enumContextKeys.ImportData:
                ImportData();
                break;

            default:
                if (key == enumContextKeys.Refresh)
                {
                    (_tag as SpatialDatabaseConn).Refresh();
                }
                base.Click(key);
                break;
            }
        }