public static void ShowFeaturesByFieldValue(this IFeatureLayer pFeatureLayer, string filedName, string value)
{
if (pFeatureLayer == null)
{
return;
}
ESRI.ArcGIS.Carto.IFeatureLayerDefinition pDef = (ESRI.ArcGIS.Carto.IFeatureLayerDefinition)pFeatureLayer;
IActiveView activeView = ArcMap.Document.FocusMap as IActiveView;
string mWhere = string.Empty;
if (value.Length == 0)
{
mWhere = "";
}
else
{
mWhere = filedName + "='" + value + "'";
}
//清除现有选择
pDef.DefinitionExpression = "";
activeView.Refresh();
pDef.DefinitionExpression = mWhere;
activeView.Refresh();
}
public static void ShowFeaturesByFieldValue(IMap map, IFeatureLayer pFeatureLayer, string filedName, string value)
{
ESRI.ArcGIS.Carto.IFeatureLayerDefinition pDef = (ESRI.ArcGIS.Carto.IFeatureLayerDefinition)pFeatureLayer;
IActiveView activeView = map as IActiveView;
string mWhere = string.Empty;
if (value.Length == 0)
{
mWhere = "";
}
else
{
mWhere = filedName + "='" + value + "'";
}
//清除现有选择
pDef.DefinitionExpression = "";
activeView.Refresh();
pDef.DefinitionExpression = mWhere;
activeView.Refresh();
}
定义查询(根据字段内容显示要素)
最新推荐文章于 2024-11-07 08:51:26 发布