public static bool QueryMessPoint(IActiveView activeView, IFeatureClass featureClass, string whereClause, ISpatialReference spatRef, out IGeometry geometry) { try { ESRI.ArcGIS.Geodatabase.IQueryFilter queryFilter = new ESRI.ArcGIS.Geodatabase.QueryFilterClass(); queryFilter.WhereClause = whereClause; ESRI.ArcGIS.Geodatabase.IFeatureCursor featureCursor = featureClass.Search(queryFilter, false); geometry = Geometry.GeometryOp.ConstructUnion(featureCursor); IGeoDataset geodataset = featureClass as IGeoDataset; geometry.SpatialReference = geodataset.SpatialReference; geometry.Project(spatRef); return true; } catch (System.Exception ex) { System.Diagnostics.Debug.Write(ex.Message); geometry = null; return false; } }
时间: 2024-10-25 22:39:37