async public Task <IExplorerObject> CreateExplorerObject(IExplorerObject parentExObject) { if (!CanCreate(parentExObject)) { return(null); } var instance = await parentExObject.GetInstanceAsync(); if (!(instance is IFeatureDataset) || !(((IDataset)instance).Database is SQLiteFDB)) { return(null); } SQLiteFDB fdb = ((IDataset)instance).Database as SQLiteFDB; FormNewFeatureclass dlg = await FormNewFeatureclass.Create(instance as IFeatureDataset); if (dlg.ShowDialog() != DialogResult.OK) { return(null); } IGeometryDef gDef = dlg.GeometryDef; int FCID = await fdb.CreateFeatureClass( parentExObject.Name, dlg.FeatureclassName, gDef, dlg.Fields); if (FCID < 0) { MessageBox.Show("ERROR: " + fdb.LastErrorMessage); return(null); } ISpatialIndexDef sIndexDef = await fdb.SpatialIndexDef(parentExObject.Name); await fdb.SetSpatialIndexBounds(dlg.FeatureclassName, "BinaryTree2", dlg.SpatialIndexExtents, 0.55, 200, dlg.SpatialIndexLevels); IDatasetElement element = await((IFeatureDataset)instance).Element(dlg.FeatureclassName); return(new SQLiteFDBFeatureClassExplorerObject( parentExObject as SQLiteFDBDatasetExplorerObject, _filename, parentExObject.Name, element)); }
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)); }