private static bool CheckBZPoint(IPoint pt1, IList <IFeatureLayer> layers, double radius) { foreach (IFeatureLayer layer in layers) { if (ArcGisUtils.CircleSelect(pt1, layer, radius).Count != 0) { return(false); } } return(true); }
public static IList <JZD> SearchOrCreateJZD(JTSYQ jtsyq, IFeatureLayer featureLayer) { IList <JZD> list = new List <JZD>(); string bm = jtsyq.BM; IPolygon polygon = jtsyq.Feature.Shape as IPolygon; IPointCollection pc = polygon as IPointCollection; //减少一个收尾的 因闭合多一个点 int max = pc.PointCount - 1; for (int a = 0; a < max; a++) { IPoint pt1 = pc.Point[a]; IList <JZD> oldJZDS = JZDCustom.FeatureToList(ArcGisUtils.CircleSelect(pc.get_Point(a), featureLayer)); if (!Utils.CheckListExists(oldJZDS)) { continue; } else if (oldJZDS.Count >= 2) { RemoveMoreJZD(oldJZDS); } bool flag = true; foreach (JZD jzd in oldJZDS) { flag = false; string jzdbm = jzd.ZDNUM; //如果有空编码 或者 本宗地 直接添加 if (Utils.IsStrNull(jzdbm) || jzdbm.Equals(bm)) { jzd.JZDIndex = a; jzd.ZDNUM = bm; bool hasJzd = true; //检查重复是不有重复点 foreach (JZD jzd1 in list) { double dx = Math.Abs(pc.get_Point(a).X - (jzd1.Feature.Shape as IPoint).X); if (dx < 0.01) { double dy = Math.Abs(pc.get_Point(a).Y - (jzd1.Feature.Shape as IPoint).Y); hasJzd = false; break; } } if (hasJzd) { list.Add(jzd); } break; } } if (flag) { IPoint JTSYQJZD = pc.get_Point(a); //检查完才能确定,是否有其他宗地编码,则创建 JZD jzd = new JZD(); Point point = new PointClass(); point.PutCoords(JTSYQJZD.X, JTSYQJZD.Y); jzd.ZDNUM = bm; jzd.JZDIndex = a; jzd.Point = point; SaveMap(jzd); list.Add(jzd); } } return(list); }
private IList <JZD> ExtractJzd(JTSYQ dk, IFeatureLayer dkLayer, IFeatureLayer jzdLayer) { IFeature feature = dk.Feature; IPolygon polygon = feature.Shape as IPolygon; IPointCollection pointCollection = polygon as IPointCollection; IList <JZD> list = new List <JZD>(); int num = pointCollection.PointCount - 2; IPoint point = new PointClass(); point.X = 0.0; point.Y = 0.0; IList <JTSYQ> list2 = JTSYQCustom.FeaturesToJTSYQ(ArcGisUtils.CircleSelect(pointCollection.get_Point(num), dkLayer)); IList <JTSYQ> list3 = JTSYQCustom.FeaturesToJTSYQ(ArcGisUtils.CircleSelect(pointCollection.get_Point(0), dkLayer)); IList <JTSYQ> entity = JTSYQCustom.FeaturesToJTSYQ(ArcGisUtils.CircleSelect(pointCollection.get_Point(1), dkLayer)); for (int i = 0; i <= num; i++) { IPoint point2 = pointCollection.get_Point(i); int num2 = list3.Count <JTSYQ>(); bool flag2 = num2 > list2.Count || num2 > entity.Count; if (flag2) { JZD JZD = new JZD(); JZD.JZDIndex = i; JZD.Point = point2; list.Add(JZD); point = point2; } else { bool flag3 = num2 != 1 && this.DifferentDks(list3, list2); if (flag3) { JZD JZD = new JZD(); JZD.JZDIndex = i; JZD.Point = point2; list.Add(JZD); point = point2; } else { double num3 = ArcGisUtils.CalculateTwoPt(point2, point); bool flag4 = i == 0; double num4 = -1; if (flag4) { num4 = ArcGisUtils.Angle(point2, pointCollection.get_Point(num), pointCollection.get_Point(1)); } else { bool flag5 = i == num; if (flag5) { num4 = ArcGisUtils.Angle(point2, pointCollection.get_Point(i - 1), pointCollection.get_Point(0)); double num5 = ArcGisUtils.CalculateTwoPt(point2, pointCollection.get_Point(0)); bool flag6 = num5 < num3; if (flag6) { num3 = num5; } } else { num4 = ArcGisUtils.Angle(point2, pointCollection.get_Point(i - 1), pointCollection.get_Point(i + 1)); } } bool flag7 = num4 < 150; if (flag7) { bool flag8 = num4 <130.0 || num3> 2.0; if (flag8) { //检查与上一个 int count = list.Count - 1; if (count >= 0) { double di = ArcGisUtils.CalculateTwoPt(point2, list[count].Point); if (di > 1) { //有上一个点的话,要大于50距离才增加 JZD JZD = new JZD(); JZD.JZDIndex = i; JZD.Point = point2; list.Add(JZD); point = point2; } } else { JZD JZD = new JZD(); JZD.JZDIndex = i; JZD.Point = point2; list.Add(JZD); point = point2; } } else { IList <IFeature> featureCursor = ArcGisUtils.CircleSelect(point2, jzdLayer); if (Utils.CheckListExists(featureCursor)) { JZD JZD = new JZD(); JZD.JZDIndex = i; JZD.Point = point2; list.Add(JZD); point = point2; } } } } } list2 = list3; list3 = entity; bool flag10 = i != num; if (flag10) { entity = JTSYQCustom.FeaturesToJTSYQ(ArcGisUtils.CircleSelect(pointCollection.get_Point(i + 2), dkLayer)); } else { entity = JTSYQCustom.FeaturesToJTSYQ(ArcGisUtils.CircleSelect(pointCollection.get_Point(0), dkLayer)); } } return(list); }