arcgis engine 当在文本框输入一个城市,在地图上查找,当找到后怎么让mapcontrol自动跳转到地图上该点? 5
展开全部
参照下面代码,希望对你有帮助
IQueryFilter filter = new QueryFilterClass();
filter.WhereClause = " NAME='"+城市名称+"'";
IFeatrueSel.SelectFeatures(filter, esriSelectionResultEnum.esriSelectionResultNew, false);
IFeatureCursor cursor = IFeatureLay.Search(filter, false);
IFeature feat = cursor.NextFeature();
if (feat != null)
{
//先清除地图中被选中的要素
this.axMapControl1.Map.ClearSelection();
IGeometry zdGeo = feat.Shape;
try
{
this.axMapControl1.ActiveView.ExtentStack.Do(zdGeo.Envelope);
this.axMapControl1.ActiveView.Extent = zdGeo.Envelope;
this.axMapControl1.ActiveView.Refresh();
this.axMapControl1.FlashShape(zdGeo, 2, 300, Type.Missing);
}
catch (Exception ex)
{
return;
}
}
System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor);
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询