Exemplo n.º 1
0
        /// <summary>
        /// 保存所有多部件集体所有权界址点
        /// </summary>
        /// <param name="jtsyqGroup"></param>
        public static IList <JZD> SaveMap(JTSYQ jtsyqGroup)
        {
            List <JZD> lists = new List <JZD>();

            foreach (JTSYQ jtsyq in jtsyqGroup.GroupJTSYQ)
            {
                var jzds = jtsyq.JZDS;
                if (Utils.CheckListExists(jzds))
                {
                    lists.AddRange(jzds);
                }
            }
            SaveMap(lists);
            return(lists);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 界址点近顺序编码
        /// </summary>
        /// <param name="jtsyq"></param>
        /// <param name="jzds"></param>
        /// <param name="featureLayer"></param>
        public static void SetBM(int startBH, JTSYQ jtsyq, IList <JZD> jzds, IFeatureLayer featureLayer)
        {
            if (jzds == null)
            {
                return;
            }
            //找到西北角第一点
            IPolygon pl = jtsyq.Feature.Shape as IPolygon;

            int[] fourPoint  = ArcGisUtils.GetFourPointsIndex(pl);
            int   index      = PointDiMin(fourPoint[0], jzds);
            int   startIndex = index;
            int   id         = jtsyq.OBJECTID;

            if (jzds.Count == 0)
            {
                MessageBox.Show("你选择的图中有没有界址点的,宗地是:" + jtsyq.QLR + ", 编码是:" + jtsyq.BM);
                return;
            }
            while (startIndex < jzds.Count)
            {
                JZD jzd = jzds[startIndex];
                jzd.JTSYQOBJECTID = id;
                jzd.JZDH          = startBH++;
                startIndex++;
            }
            int min = 0;

            while (min < index)
            {
                JZD jzd = jzds[min];
                jzd.JTSYQOBJECTID = id;
                jzd.JZDH          = startBH++;
                min++;
            }
            //修改
            Update(jzds);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 设置周围的界址线
        /// </summary>
        /// <param name="jtsyqs"></param>
        public static List <JZX> SetJZX(IList <JTSYQ> jtsyqs)
        {
            List <JZX>    list        = new List <JZX>();
            IList <JTSYQ> otherJTSYQS = new List <JTSYQ>();

            foreach (JTSYQ jtsyq in jtsyqs)
            {
                IGeometry geometry = jtsyq.Feature.Shape;
                //相交的面
                IList <IFeature> intersectFeature = ArcGisUtils.GetSeartchFeatures(JTSYQCustom.GetLayer(), geometry.Envelope, esriSpatialRelEnum.esriSpatialRelIntersects);
                IList <JTSYQ>    interJTSYQS      = JTSYQCustom.FeaturesToJTSYQ(intersectFeature);
                IList <JZX>      jzxs             = new List <JZX>();
                foreach (JTSYQ inter in interJTSYQS)
                {
                    if (JTSYQHasObject(inter.OBJECTID, jtsyqs))
                    {
                        continue;
                    }
                    JZX jzx = new JZX();
                    jzx.BM            = inter.BM;
                    jzx.QLR           = inter.QLR;
                    jzx.JTSYQOBJECTID = inter.OBJECTID;
                    IEnvelope envelope = jtsyq.Feature.Shape.Envelope;

                    IPolyline pl2          = ArcGisUtils.PolygonToPolyline(inter.Feature.Shape as IPolygon);
                    IGeometry clipGeometry = ArcGisUtils.GeometryClip(pl2, ArcGisUtils.ScaleEnvelope(envelope, 1.2));
                    jzx.Polyline = clipGeometry as IPolyline;
                    jzxs.Add(jzx);
                    inter.SelfJZX = jzx;
                    otherJTSYQS.Add(inter);
                }
                jtsyq.JZXS = jzxs;
            }

            //移除重复的地块
            int count = otherJTSYQS.Count;

            /* for (int a =0; a < count; a++)
             * {
             *   JTSYQ j1 = otherJTSYQS[a];
             *
             *   for (int b= a+1; b < count;b++)
             *   {
             *       JTSYQ j2 = otherJTSYQS[b];
             *       if(j1.OBJECTID == j2.OBJECTID)
             *       {
             *           otherJTSYQS.RemoveAt(b);
             *           b--;
             *           count--;
             *       }
             *   }
             *
             * }*/

            //移除被大地块所包含的
            for (int a = 0; a < count; a++)
            {
                JTSYQ            j1 = otherJTSYQS[a];
                IList <IFeature> containsFeature = ArcGisUtils.GetSeartchFeatures(JTSYQCustom.GetLayer(), ArcGisUtils.ScaleEnvelope(j1.Feature.Shape.Envelope, 0.9), esriSpatialRelEnum.esriSpatialRelContains);
                IList <JTSYQ>    containsJTSYQS  = JTSYQCustom.FeaturesToJTSYQ(containsFeature);
                if (containsJTSYQS != null)
                {
                    for (int c = 0; c < containsJTSYQS.Count; c++)
                    {
                        for (int b = 0; b < count; b++)
                        {
                            if (a == b)
                            {  //除自己
                                continue;
                            }
                            JTSYQ j2 = otherJTSYQS[b];
                            if (containsJTSYQS[c].OBJECTID == j2.OBJECTID)
                            {
                                otherJTSYQS.RemoveAt(b);
                                b--;
                                count--;
                            }
                        }
                    }
                }
            }
            List <JZX> lastJZXS = new List <JZX>();

            foreach (JTSYQ jtsyq in otherJTSYQS)
            {
                lastJZXS.Add(jtsyq.SelfJZX);
            }
            //groupJTSYQ.JZXS = lastJZXS;
            return(lastJZXS);
        }