public IExplorerObject CreateExplorerObject(IExplorerObject parentExObject) { if (!CanCreate(parentExObject)) { return(null); } if (!(parentExObject.Object is IFeatureDataset) || !(((IDataset)parentExObject.Object).Database is AccessFDB)) { return(null); } AccessFDB fdb = ((IDataset)parentExObject.Object).Database as AccessFDB; FormNewFeatureclass dlg = new FormNewFeatureclass(parentExObject.Object as IFeatureDataset); if (dlg.ShowDialog() != DialogResult.OK) { return(null); } IGeometryDef gDef = dlg.GeometryDef; int FCID = fdb.CreateFeatureClass( parentExObject.Name, dlg.FeatureclassName, gDef, dlg.Fields); if (FCID < 0) { MessageBox.Show("ERROR: " + fdb.lastErrorMsg); return(null); } ISpatialIndexDef sIndexDef = fdb.SpatialIndexDef(parentExObject.Name); fdb.SetSpatialIndexBounds(dlg.FeatureclassName, "BinaryTree2", dlg.SpatialIndexExtents, 0.55, 200, dlg.SpatialIndexLevels); IDatasetElement element = ((IFeatureDataset)parentExObject.Object)[dlg.FeatureclassName]; return(new AccessFDBFeatureClassExplorerObject( parentExObject as AccessFDBDatasetExplorerObject, _filename, parentExObject.Name, element)); }
public bool Open() { if (_connString == null || _connString == "" || _dsname == null || _dsname == "" || _fdb == null) { return(false); } _dsID = _fdb.DatasetID(_dsname); if (_dsID == -1) { return(false); } _sRef = _fdb.SpatialReference(_dsname); _sIndexDef = _fdb.SpatialIndexDef(_dsID); _state = DatasetState.opened; return(true); }