V8i Select Series 3 C# - How to get the count of queried features through programming

All,

I wrote the following method to query a particular feature with where clause. When I execute the method I can see in the microstation status bar "X features extracted". Is there any control through programming to identify the count of features extracted (X) in the last query. Right now I am doing a scan with same criteria to get the count.

// Method used to perform a query instances of a particular feature class using an optional attribute filter.
public void queryClass(string featureName, string whereClause, int queryOption)
{

_selectedFeatureNames = new List<string>();
// Get the open import criteria.
BGU.IImportCriteria criteria = GDI.GeoDataInterchangeAddIn.Instance.MasterFileImport;if (criteria == null)
return;// Set spatial filter criteria.
criteria.Geometry = null;// You can use the SpatialArea property with All, Fence, or View. Don't use Selection, that's for export.
if (queryOption == 1) // All
criteria.SpatialArea = BGU.SpatialArea.All;
else if (queryOption == 2) // View
criteria.SpatialArea = BGU.SpatialArea.View;
else if (queryOption == 3) // Fence
{
criteria.SpatialArea = BGU.SpatialArea.Fence;

}// Get the storage import.
BGU.IStorageImportCriteria storageImp = criteria.StorageImports[0] as BGU.IStorageImportCriteria;
if (storageImp == null)
return;
//Deselect all feature classes.
foreach (BGU.IClassImportCriteria currentClassImp in storageImp.ClassImports.Values)
{
//Storing the user current selection into list before clearing the selection
if (currentClassImp.Selected == true)
_selectedFeatureNames.Add(currentClassImp.Name);
currentClassImp.Selected = false;

}// Select the feature class(es) you want to query.
BGU.IClassImportCriteria classImp = storageImp.ClassImports[featureName] as BGU.IClassImportCriteria;
if (classImp != null)
classImp.Selected = true;// Optionally add a where clause for the selected feature classes.
if (whereClause != null && whereClause.Length > 0)
classImp.WhereClause = whereClause;// Execute the query.
GDI.GeoDataInterchangeAddIn.Instance.ImportOrExport(criteria, null, true, true);// Selecting the stored user feature selection list
foreach (BGU.IClassImportCriteria currentClassImp in storageImp.ClassImports.Values)
{
if (_selectedFeatureNames.Contains(currentClassImp.Name))
{
currentClassImp.Selected = true;
}
currentClassImp.WhereClause = "";}}

Parents Reply Children
No Data