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 SQLiteFDB)) { return(null); } SQLiteFDB fdb = ((IDataset)parentExObject.Object).Database as SQLiteFDB; 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 SQLiteFDBFeatureClassExplorerObject( parentExObject as SQLiteFDBDatasetExplorerObject, _filename, parentExObject.Name, element)); }
public bool Open() { if (_fdb == null) { return(false); } _dsID = _fdb.DatasetID(_dsname); if (_dsID < 0) { return(false); } _sRef = this.SpatialReference; _state = DatasetState.opened; _sIndexDef = _fdb.SpatialIndexDef(_dsID); return(true); }
async public Task <bool> Open() { if (_fdb == null) { return(false); } _dsID = await _fdb.DatasetID(_dsname); if (_dsID < 0) { return(false); } _sRef = await this.GetSpatialReference(); _state = DatasetState.opened; _sIndexDef = await _fdb.SpatialIndexDef(_dsID); return(true); }