ArcEngine二次开发之提取外包矩
1、通过ITopologicalOperator接口,此方法适用于需要获得包含几个或多个要素的最小外包矩形
public IEnvelope GetEnvelope(IGeometryCollection pGeometryCollection)
{
IPolygon pPolygon = new PolygonClass();
ITopologicalOperator pTopo;
pTopo = pPolygon as ITopologicalOperator;
pTopo.ConstructUnion(pGeometryCollection as IEnumGeometry);
IEnvelope pEnvelope = pPolygon.Envelope;
return pEnvelope;
}
2、通过IGeoDataset 接口,此方法适用于获得一个要素图层的外包矩形(即包含所有要素的最小外包矩形)
public IEnvelope GetEnvelope(IFeatureClass pFeatureClass)
{
IGeoDataset pGeoDataset;
pGeoDataset = pFeatureClass as IGeoDataset;
IEnvelope pEnvelope = pGeoDataset.Extent;
return pEnvelope;
}
3、要素的属性 pFeature.Extent,获得单个要素的外包矩
public IEnvelope GetEnvelope(IFeature pFeature)
{
IEnvelope pEnvelope = pFeature.Extent;
return pEnvelope;
}
————————————————
版权声明:本文为CSDN博主「RicardoMTan」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/RicardoMTan/article/details/84565591