其他分享
首页 > 其他分享> > 缩放到图层,缩放到要素

缩放到图层,缩放到要素

作者:互联网

public static void ZoomToLayer(IActiveView pActiveView, ILayer pLayer,double pading)
{
pActiveView.Extent = ((IGeoDataset)pLayer).Extent;
pActiveView.Extent.Width += pading;
pActiveView.Extent.Height += pading;
pActiveView.Refresh();
}

public static void ZoomToFeature(IFeature pFeature, int bufferDistant)
{
IGeometry tGeometry = pFeature.Shape as IGeometry; //缓冲处理,使处于边界的元素在视图中能够完全显示
ITopologicalOperator mTopologicalOperator = (ITopologicalOperator)tGeometry;
IGeometry mPolygonBuffer = mTopologicalOperator.Buffer(bufferDistant) as IGeometry;
//MapControl.Extent = mPolygonBuffer.Envelope;
//MapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, featureSelection, tGeometry.Envelope);
//ArcMap.Document.ActiveView.Extent = axMapControl1.ActiveView.Extent;
// ArcMap.Document.ActiveView.Refresh();
ArcMap.Document.ActiveView.Extent = mPolygonBuffer.Envelope;
ArcMap.Document.ActiveView.Refresh();
}

标签:要素,Document,放到,pActiveView,IGeometry,ArcMap,Extent,图层,ActiveView
来源: https://www.cnblogs.com/wzyong/p/16066434.html