Exemplo 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;
            }
        }
Exemplo n.º 2
0
 private void Load()
 {
     try
     {
         using (ICatalogEntityClass cec = new CatalogEntityClassFeatureDataset(_connectionString))
         {
             _featureDatasets = cec.Query(new SpatialFeatureDataset());
         }
         using (ICatalogEntityClass cec = new CatalogEntityClassFeatureClass(_connectionString))
         {
             _featureClasses = cec.Query("length(datasetid)=0");
         }
         _isLoaded = true;
     }
     catch (Exception ex)
     {
         _isLoaded = false;
         MsgBox.ShowError(ex.Message);
     }
 }