Beispiel #1
0
        private static IPoint GetBZPoint(JZD jzd, IList <IFeatureLayer> layers)
        {
            IPoint pt1    = jzd.Feature.Shape as IPoint;
            IPoint pt2    = jzd.Feature.Shape as IPoint;
            double radius = 30;
            int    basic  = 10;

            for (int a = 1; a < 7; a++)
            {
                pt1.X += basic * a;
                if (CheckBZPoint(pt1, layers, radius))
                {
                    return(pt1);
                }
                pt1.Y += basic * a;
                if (CheckBZPoint(pt1, layers, radius))
                {
                    return(pt1);
                }
                pt2.X -= basic * a;
                if (CheckBZPoint(pt2, layers, radius))
                {
                    return(pt2);
                }
                pt2.Y -= basic * a;
                if (CheckBZPoint(pt2, layers, radius))
                {
                    return(pt2);
                }
            }

            return(jzd.Feature.Shape as IPoint);
        }
Beispiel #2
0
        private static void SetJZDRowValue(NPOI.SS.UserModel.IRow row, JZD jzd)
        {
            IPoint point = jzd.Feature.Shape as IPoint;

            row.GetCell(1).SetCellValue("J" + jzd.JZDH);
            row.GetCell(2).SetCellValue(point.X);
            row.GetCell(3).SetCellValue(point.Y);
        }
Beispiel #3
0
        private static int PointDiMin(int startIndex, IList <JZD> jzds)
        {
            int dx  = -1;
            int dx2 = -1;
            int max = jzds.Count - 1;

            for (int a = 0; a < max; a++)
            {
                JZD jzd = jzds[a];
                dx = Math.Abs(jzd.JZDIndex - startIndex);
                if (dx == 0)
                {
                    return(a);
                }
                dx2 = Math.Abs(jzds[a + 1].JZDIndex - startIndex);
                if (dx < dx2)
                {
                    return(a);
                }
            }
            return(max);
        }
Beispiel #4
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);
        }
Beispiel #5
0
 public JZDCustom(JZD JZD)
 {
     this.JZD = JZD;
 }
Beispiel #6
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);
        }
Beispiel #7
0
 /// <summary>
 /// jzd保存进入map
 /// </summary>
 /// <param name="jzd"></param>
 public static void SaveMap(JZD jzd)
 {
     AddJzdFeature(jzd, jzd.Point, GetJZDLayer().FeatureClass);
 }