/// <summary>
 /// 是否存在记录
 /// </summary>
 /// <param name="filter"></param>
 /// <returns></returns>
 public bool HasRecord(ZFilter filter)
 {
     using (ZFeatureCursor cursor = Search(filter))
     {
         return(cursor.NextFeature() != null);
     }
 }
 /// <summary>
 /// Delete the Rows in the database selected by the specified query.
 /// </summary>
 /// <param name="filter"></param>
 public bool Delete(ZFilter filter)
 {
     try
     {
         ITable table = featureClass as ITable;
         table.DeleteSearchedRows(filter.Value);
         return(true);
     }
     catch {
         return(false);
     }
 }
        /// <summary>
        /// 复制数据到另一张表
        /// </summary>
        /// <param name="outZWorkspace">目标工作空间</param>
        /// <param name="name">目标图层名</param>
        /// <param name="filter">查询条件</param>
        public void CopyTo(ZWorkspace outZWorkspace, string name, ZFilter filter)
        {
            // 数据源
            IFeatureClassName inputFClassName = ((IDataset)featureClass).FullName as IFeatureClassName;
            // 目标数据集
            IDataset       outDataSet       = outZWorkspace.workspace as IDataset;
            IWorkspaceName outWorkspaceName = outDataSet.FullName as IWorkspaceName;
            // 目标图层
            IFeatureClassName outputFClassName = new FeatureClassNameClass();
            IDatasetName      dataSetName      = outputFClassName as IDatasetName;

            dataSetName.WorkspaceName = outWorkspaceName;
            dataSetName.Name          = name;
            // 导出
            FeatureDataConverterClass converter = new FeatureDataConverterClass();

            converter.ConvertFeatureClass(inputFClassName, filter.Value, null, outputFClassName, null, featureClass.Fields, "", 100, 0);
            // 释放资源
            Marshal.ReleaseComObject(converter);
        }
        /// <summary>
        /// Delete the Rows in the database selected by the specified query.
        /// </summary>
        /// <param name="where"></param>
        /// <param name="zGeo"></param>
        /// <param name="rel"></param>
        public bool Delete(string where = "1=1", ZGeometry zGeo = null, SpatialRelEnum rel = SpatialRelEnum.esriSpatialRelIntersects)
        {
            ZFilter filter = new ZFilter(where, zGeo, featureClass.ShapeFieldName, rel);

            return(Delete(filter));
        }
        /// <summary>
        /// Returns a cursor that can be used to update features selected by the specified
        /// </summary>
        /// <param name="filter"></param>
        /// <param name="useBuffering"></param>
        /// <returns></returns>
        public ZFeatureCursor Update(ZFilter filter, bool useBuffering)
        {
            IFeatureCursor cursor = featureClass.Update(filter.Value, useBuffering);

            return(new ZFeatureCursor(cursor));
        }
        /// <summary>
        /// Returns a cursor that can be used to update features selected by the specified
        /// </summary>
        /// <param name="filter"></param>
        /// <param name="useBuffering"></param>
        /// <returns></returns>
        public ZFeatureCursor Update(string where = "1=1", ZGeometry zGeo = null, SpatialRelEnum rel = SpatialRelEnum.esriSpatialRelIntersects, bool useBuffering = true)
        {
            ZFilter filter = new ZFilter(where, zGeo, featureClass.ShapeFieldName, rel);

            return(Update(filter, useBuffering));
        }
        /// <summary>
        /// 空间属性查询
        /// </summary>
        /// <param name="where"></param>
        /// <param name="geometry"></param>
        /// <returns></returns>
        public ZFeatureCursor Search(ZFilter filter)
        {
            IFeatureCursor cursor = featureClass.Search(filter.Value, false);

            return(new ZFeatureCursor(cursor));
        }
 /// <summary>
 /// The number of features selected by the specified query.
 /// </summary>
 /// <param name="filter"></param>
 /// <returns></returns>
 public int RecordCount(ZFilter filter)
 {
     return(featureClass.FeatureCount(filter.Value));
 }