在文本框输入一个城市,在地图上查找,当找到后让mapcontrol自动跳转到地图上该点。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
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);
|
AE中将地图页面跳转到指定坐标点
1
2
3
4
|
Mappoint p=
new
Mappoint();
p.x=已知点X坐标;
p.y=已知点Y坐标;
mapControl1.Extent.CenterAt(p);
|
参考文章
1. arcgis engine 当在文本框输入一个城市,在地图上查找定位