예제 #1
0
        /// <summary>
        /// 表格单击
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public override void Table_SingleClick(object sender, MouseButtonEventArgs e)
        {
            GridControl         gridControl = sender as GridControl;
            GridColumn          column      = gridControl.CurrentColumn as GridColumn;
            MapTabDictoryCustom row         = gridControl.CurrentItem as MapTabDictoryCustom;

            if (column.VisibleIndex == objectIndex)
            {
            }
            //图形缩放
            var obj = gridControl.CurrentItem;

            if (obj == null)
            {
                return;
            }
            int      objectId = (int)row.Dic["OBJECTID"];
            IFeature feature  = featureDic[objectId];

            if (pLayer.Name == JTSYQCustom.JTSYQLayerName)
            {
                MapForm.CurrentJTSYQ = JTSYQCustom.FeaturesToJTSYQ(feature);
                MapForm.CurrentJTSYQ.MapTabDictoryCustom = row;
            }

            ArcGisUtils.axMapControl.Map.ClearSelection();
            ArcGisUtils.axMapControl.Map.SelectFeature(pLayer, feature);                          //第三个参数为是否只选中一个
            ArcGisUtils.axMapControl.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null); //选中要素高亮显示
            ArcGisUtils.axMapControl.ActiveView.Refresh();
        }
예제 #2
0
파일: MapCommand.cs 프로젝트: YB9527/CG
        private void ok()
        {
            if (siziE == null || jtsyq == null)
            {
                return;
            }
            JTSYQCustom jTSYQCustom = new JTSYQCustom(jtsyq);
            Dictionary <string, IList <IFeature> > featuresDic = ArcGisUtils.GetFeatureDicByLayer(features);
            //其他集体所有权
            IList <IFeature> siziFeatures;

            if (featuresDic.TryGetValue(JTSYQCustom.JTSYQLayerName, out siziFeatures))
            {
                IList <JTSYQ> sizeJTSYQS = JTSYQCustom.FeaturesToJTSYQ(siziFeatures);
                jTSYQCustom.SetSiZi(siziE, sizeJTSYQS);
            }
            jTSYQCustom.ArcGisSave();
        }
예제 #3
0
        /// <summary>
        /// 设置多个四至
        /// </summary>
        /// <param name="features"></param>
        private void SetJTSYQSiZi(PreviewKeyDownEventArgs e)
        {
            if (CurrentJTSYQ == null)
            {
                return;
            }
            IList <IFeature> features = ArcGisUtils.GetInstance().GetSelectFeature();

            if (!MyUtils.Utils.CheckListExists(features))
            {
                return;
            }
            JTSYQCustom jTSYQCustom = new JTSYQCustom(CurrentJTSYQ);
            Dictionary <string, IList <IFeature> > featuresDic = ArcGisUtils.GetFeatureDicByLayer(features);
            //其他集体所有权
            IList <IFeature> siziFeatures;

            if (featuresDic.TryGetValue(JTSYQCustom.JTSYQLayerName, out siziFeatures))
            {
                IList <JTSYQ> siziJTSYQS = JTSYQCustom.FeaturesToJTSYQ(siziFeatures);
                if (!MyUtils.Utils.CheckListExists(siziJTSYQS))
                {
                    return;
                }
                //移除自身地块
                int count = siziJTSYQS.Count;
                for (int a = 0; a < count; a++)
                {
                    JTSYQ round = siziJTSYQS[a];
                    if (round.Feature.OID == CurrentJTSYQ.Feature.OID)
                    {
                        siziJTSYQS.RemoveAt(a);
                        count--;
                        a--;
                    }
                }
                jTSYQCustom.SetSiZi(e, siziJTSYQS);
            }

            jTSYQCustom.ArcGisSave();

            //更新显示的table中 的josn数据
        }
예제 #4
0
        /// <summary>
        /// 表格双击
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public override void Table_Click(object sender, MouseButtonEventArgs e)
        {
            GridControl         gridControl = sender as GridControl;
            GridColumn          column      = gridControl.CurrentColumn as GridColumn;
            MapTabDictoryCustom row         = gridControl.CurrentItem as MapTabDictoryCustom;

            if (column.VisibleIndex == objectIndex)
            {
            }
            //图形缩放
            var      obj      = gridControl.CurrentItem;
            int      objectId = (int)row.Dic["OBJECTID"];
            IFeature feature  = featureDic[objectId];

            if (pLayer.Name == JTSYQCustom.JTSYQLayerName)
            {
                MapForm.CurrentJTSYQ = JTSYQCustom.FeaturesToJTSYQ(feature);
                MapForm.CurrentJTSYQ.MapTabDictoryCustom = row;
            }
            ArcGisUtils.ExtentShp(feature, pLayer, 2);
        }
예제 #5
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);
        }
예제 #6
0
 public IList <JTSYQ> GetJTSYQS(IList <IFeature> list)
 {
     return(JTSYQCustom.FeaturesToJTSYQ(list));
 }
예제 #7
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);
        }