最近做项目用到一些AE的知识,记录一下。
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;
}