获取图层上选中的要数
Posted baimy
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了获取图层上选中的要数相关的知识,希望对你有一定的参考价值。
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);
以上是关于获取图层上选中的要数的主要内容,如果未能解决你的问题,请参考以下文章
获取DataGridView上选中的一行并转换为一个DataRow类型
Photoshop Javascript 获取活动文档中的所有图层