public void RefreshFrom(object obj) { if (!(obj is pgFeatureClass)) { return; } pgFeatureClass fc = (pgFeatureClass)obj; if (fc.Name != this.Name) { return; } this.Envelope = fc.Envelope; this.SpatialReference = fc.SpatialReference; this.IDFieldName = fc.IDFieldName; this.ShapeFieldName = fc.ShapeFieldName; _geomDef.GeometryType = fc.GeometryType; _geomDef.HasZ = fc.HasZ; _geomDef.HasM = fc.HasM; Fields fields = new Fields(fc.Fields); if (fields != null) { fields.PrimaryDisplayField = m_fields.PrimaryDisplayField; } m_fields = fields; }
async static public Task <pgFeatureClass> Create(pgFDB fdb, IDataset dataset, GeometryDef geomDef) { var fc = new pgFeatureClass(); fc._fdb = fdb; fc._dataset = dataset; fc._geomDef = (geomDef != null) ? geomDef : new GeometryDef(); if (fc._geomDef != null && fc._geomDef.SpatialReference == null && dataset is IFeatureDataset) { fc._geomDef.SpatialReference = await((IFeatureDataset)dataset).GetSpatialReference(); } fc.m_fields = new Fields(); return(fc); }
async void SqlFDB_TableAltered(string table) { if (_layers == null) { return; } foreach (IDatasetElement element in _layers) { if (element.Class is pgFeatureClass && ((pgFeatureClass)element.Class).Name == table) { var fields = await _fdb.FeatureClassFields(this._dsID, table); pgFeatureClass fc = element.Class as pgFeatureClass; ((Fields)fc.Fields).Clear(); foreach (IField field in fields) { ((Fields)fc.Fields).Add(field); } } } }