//获取标注圆内的注记集合 public static List <mcRecordSet> GetCircleAnnos(mcRecordSet recordset, mcRecordSet destRecordSet) { List <mcRecordSet> AnnoInCircles = new List <mcRecordSet>(); int SfcID = 0; SfcID = recordset.MoveFirst(); //找到图例中的注记圆 while (!recordset.IsEOF()) { IGeometry GeoResult = null; recordset.GetGeometry(out GeoResult); mcRect rect = null; GeoResult.CalRect(out rect); double width = Math.Round(rect.xmax - rect.xmin, 2); double heigth = Math.Round(rect.ymax - rect.ymin, 2); //判断是否是注记圆 if (Math.Abs(width - heigth) < 5) { //获取单个标注圆内的注记 mcRecordSet AnnoInCircle = null; mcQueryDef queryDef = new mcQueryDef(); queryDef.set_rect(rect, meSpaQueryMode.meModeContain); destRecordSet.Select(queryDef, out AnnoInCircle); AnnoInCircles.Add(AnnoInCircle); } SfcID = recordset.MoveNext(); } return(AnnoInCircles); }
//获取标注圆内的注记集合 public static List <mcRecordSet> GetCircleAnnosNew(List <IGeometry> geoCircelList, List <IGeomInfo> geoCircelInfoList, mcRecordSet AnnoRecordSet) { List <mcRecordSet> AnnoInCircles = new List <mcRecordSet>(); for (int i = 0; i < geoCircelList.Count; i++) { //获取单个标注圆内的注记 mcRect circleRect = null; geoCircelList[i].CalRect(out circleRect); IPntInfo pntInfo = geoCircelInfoList[i] as IPntInfo; mcRect ExpandRect = new mcRect(); ExpandRect.xmin = circleRect.xmin - (pntInfo.width / 2) - 2; ExpandRect.ymin = circleRect.ymin - (pntInfo.height / 2) - 2; ExpandRect.xmax = circleRect.xmax + (pntInfo.width / 2) + 2; ExpandRect.ymax = circleRect.ymax + (pntInfo.height / 2) + 2; mcRecordSet AnnoInCircle = null; mcQueryDef queryDef = new mcQueryDef(); queryDef.set_rect(ExpandRect, meSpaQueryMode.meModeContain); AnnoRecordSet.Select(queryDef, out AnnoInCircle); AnnoInCircles.Add(AnnoInCircle); } return(AnnoInCircles); }