根据图层名称获取图层
public IFeatureLayer getLayer(AxMapControl axMapControl, string layerName)
{
if (axMapControl.LayerCount > 0)
{
for (int i = 0; i < axMapControl.LayerCount; i++)
{
ILayer pLayer = axMapControl.get_Layer(i);
if (pLayer.Name == layerName)
return pLayer as FeatureLayer;
}
}
return null;
}
按条件查询图层要素,并闪烁
public void searchFeatures(AxMapControl mapControl,string sqlfilter,IFeatureLayer pFeatureLayer)
{
IFeatureLayer pFeatLyr = pFeatureLayer;
IQueryFilter pFilter = new QueryFilterClass();
pFilter.WhereClause = sqlfilter;
IFeatureCursor pFeatCursor = pFeatLyr.Search(pFilter,true);
IFeature pFeat = pFeatCursor.NextFeature();
while (pFeat != null)
{
if (pFeat != null)
{