C#进行MapX二次开发之地图搜索
2010-09-30 21:05:05 来源:WEB开发网查找的时候,我们得到了每个Feature,然后对Feature的ID和Name进行判断查找,如何有匹配的,就表示找到了一个对象,如果最后一个也没有,那么本次地图查找应该没有匹配的元素了,Feature的查找代码如下所示
#region 遍历特性
for (int i = 1; i < feature.Count; i++)
{
try
{
object objLocation = ds.get_Value(feature[i], "Name");
object objID = ds.get_Value(feature[i], "Id");
string strLocation = (objLocation == null) ? "" : objLocation.ToString();
string strID = (objID == null) ? "" : objID.ToString();
if (!resultList.ContainsKey(strID) && feature[i].FeatureID != 0)
{
ResultOfSearching searchInfo = new ResultOfSearching();
searchInfo.FeatureID = feature[i].FeatureID;
searchInfo.ID = strID;
searchInfo.Layer = layer;
searchInfo.Location = feature[i].Name;
if (!resultList.ContainsKey(strID))
{
resultList.Add(strID, searchInfo);
}
if (!allResultList.ContainsKey(strID))
{
allResultList.Add(strID, searchInfo);
}
}
}
catch(Exception ex)
{
//LogHelper.Error(ex);
}
}
#endregion
更多精彩
赞助商链接