AE zoom to selected 地图刷新

1.zoom to selected 将选中的多个要素放大到视野中央(主要是计算所有选中要素的envelope,“envelope.Union(featureExtent);”)

ESRI.ArcGIS.Geometry.IEnvelope envelope = new ESRI.ArcGIS.Geometry.EnvelopeClass();
envelope.SetEmpty();

while (pFeature != null)
{
pFeatures_Search.Add(pFeature);

ESRI.ArcGIS.Geometry.IGeometry geometry = pFeature.Shape;
ESRI.ArcGIS.Geometry.IEnvelope featureExtent = geometry.Envelope;
envelope.Union(featureExtent);

pFeature = pFeatureCursor.NextFeature();
}

mapControl.Extent = envelope;
mapControl.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null);

 

2.刷新整个图层

IActiveView pActiveView = mapControl.ActiveView;
pActiveView.Extent = pLayer.AreaOfInterest.Envelope;//整个刷新
pActiveView.Refresh();

 

另外(当1刷新不够实时,用2刷新)

1、地图刷新有问题

mapControl.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null); 

2、刷新ok

IActiveView pActiveView = mapControl.ActiveView;
pActiveView.Refresh();

 

posted @ 2014-08-14 13:44  相信自己_  阅读(310)  评论(0编辑  收藏  举报