Esempio n. 1
0
        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);
        }