Exemple #1
0
        protected override void FillEntityToCotrols()
        {
            if (_isNew)
            {
                Text = "新建空间数据集...";
            }
            else
            {
                Text = "编辑空间数据集属性...";
            }
            SpatialFeatureDataset ds = _entity as SpatialFeatureDataset;

            if (_isNew)
            {
                return;
            }
            txtName.Text       = _entity.Name;
            txtDecription.Text = _entity.Description;
            txtMapScale.Value  = ds.MapScale;
            txtSource.Text     = ds.Source;
            if (ds.SpatialRef != null)
            {
                ISpatialReference sref = SpatialReferenceFactory.GetSpatialReferenceByWKT(ds.SpatialRef, enumWKTSource.EsriPrjFile);
                ucSpatialRef1.SpatialReference = sref;
            }
        }
Exemple #2
0
        public override string ToString(object value)
        {
            ICatalogItem ci = value as ICatalogItem;

            if (ci is CatalogLocal)
            {
                return((ci as CatalogLocal).Tag.ToString());
            }
            else if (ci is CatalogFile)
            {
                return((ci as CatalogFile).Tag.ToString());
            }
            else if (ci is CatalogDatabaseConn)
            {
                return(((ci as CatalogDatabaseConn).Tag as SpatialDatabaseConn).ConnectionString);
            }
            else if (ci is CatalogFeatureDataset)
            {
                SpatialFeatureDataset sfd = (ci as CatalogFeatureDataset).Tag as SpatialFeatureDataset;
                return((sfd as CatalogEntityBase)._connString + "@" + sfd.Name);
            }
            else if (ci is CatalogFeatureClass)
            {
                SpatialFeatureClass sfc = (ci as CatalogFeatureClass).Tag as SpatialFeatureClass;
                return((sfc as CatalogEntityBase)._connString + "@" + sfc.Name);
            }
            else
            {
                return(base.ToString());
            }
        }
Exemple #3
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;
            }
        }
        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;
            }
        }
Exemple #5
0
 public FetClassWriterDb(ICatalogItem locationItem)
 {
     if (locationItem is CatalogDatabaseConn)
     {
         _dbConn = DbConnectionFactory.CreateDbConnection(((locationItem as CatalogDatabaseConn).Tag as SpatialDatabaseConn).ConnectionString);
     }
     else if (locationItem is CatalogFeatureDataset)
     {
         CatalogFeatureDataset cfd = locationItem as CatalogFeatureDataset;
         SpatialFeatureDataset sfd = cfd.Tag as SpatialFeatureDataset;
         _dbConn        = DbConnectionFactory.CreateDbConnection((sfd as CatalogEntityBase)._connString);
         _datasetId     = sfd.Id;
         _dstSpatialRef = SpatialReferenceFactory.GetSpatialReferenceByWKT(sfd.SpatialRef, enumWKTSource.EsriPrjFile);
     }
     else
     {
         throw new NotSupportedException("类型为\"" + locationItem + "\"的位置暂不支持写。");
     }
     _adapter = DiffDbAdapterFactory.GetDiffDbAdapter(_dbConn);
     _dbConn.Open();
 }
Exemple #6
0
 private void FillDataset(SpatialFeatureDataset ds)
 {
     txtDataset.Text = ds.Name;
     txtDataset.Tag  = ds;
 }
Exemple #7
0
 internal void SetSpatialDataset(SpatialFeatureDataset ds)
 {
     _dataset = ds;
 }