码迷,mamicode.com
首页 > 其他好文 > 详细

获取图层上选中的要数

时间:2018-11-26 16:16:49      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:geo   move   prope   contains   ddl   partial   bsp   int   iss   

 IFeatureLayer pFeatureLayer = (CustomProperty as IFeatureLayer);
                ISelectionSet pSelectionSet = (pFeatureLayer as IFeatureSelection).SelectionSet;
                if (pSelectionSet == null)
                {
                    return;
                }
                if (pSelectionSet.Count > 10000)
                {
                    M_hookHelper.FocusMap.ClearSelection();
                }
                if (pSelectionSet.Count > 0 || oids.Count > 0)
                {
                    List<int> listRemoveObjectID = new List<int>();
                    IEnumIDs enumIDs = pSelectionSet.IDs;
                    enumIDs.Reset();
                    int objectid = 0;
                    while ((objectid = enumIDs.Next()) >= 0)
                    {
                        if (oids.Contains(objectid))
                        {
                            oids.Remove(objectid);
                            continue;
                        }
                        listRemoveObjectID.Add(objectid);
                    }
                    if (listRemoveObjectID.Count > 0)
                    {
                        pSelectionSet.RemoveList(listRemoveObjectID.Count, ref listRemoveObjectID.ToArray()[0]);
                    }
                }
                if (oids.Count > 0)
                {
                    pSelectionSet.AddList(oids.Count, ref oids.ToArray()[0]);
                    //IsShowSelectData = true;
                }

                M_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, M_hookHelper.ActiveView.Extent);

获取图层上选中的要数

标签:geo   move   prope   contains   ddl   partial   bsp   int   iss   

原文地址:https://www.cnblogs.com/baimy/p/10020542.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!