C++ ArcGis 遍历polygon 的每个点。
2016-03-09 15:39
453 查看
C++ ArcGis 遍历polygon 的每个点。
代码实现:
IPolygon4Ptr ipPolygon(ipGeom);
IGeometryBagPtr exteriorRingGeometryBag = ipPolygon->GetExteriorRingBag();
IGeometryCollectionPtr exteriorRingGeometryCollection(exteriorRingGeometryBag);
// 取几何图形的个数
long lRegionCount = exteriorRingGeometryCollection->GetGeometryCount();
for (int i = 0; i < lRegionCount; i++)
{
IGeometryPtr exteriorRingGeometry = exteriorRingGeometryCollection->GetGeometry( i );
// 取外环的点
IPointCollectionPtr exteriorRingPointCollection( exteriorRingGeometry );
long lPointCount = exteriorRingPointCollection->GetPointCount();
for( int j = 0; j < lPointCount; j++ )
{
IPointPtr ipPoint = exteriorRingPointCollection->GetPoint( j );
}
// 取内环的点
IRingPtr ipRing( exteriorRingGeometry );
IGeometryBagPtr interiorRingGeometryBag = ipPolygon->GetInteriorRingBag( ipRing );
IGeometryCollectionPtr interiorRingGeometryCollection = ( IGeometryCollectionPtr )interiorRingGeometryBag;
long lInteriorCount = interiorRingGeometryCollection->GetGeometryCount();
for (int k = 0; k < lInteriorCount; k++)
{
IGeometryPtr interiorRingGeometry = interiorRingGeometryCollection->GetGeometry(k);
IPointCollectionPtr interiorRingPointCollection( interiorRingGeometry);
long lInteriorPointCount = interiorRingPointCollection->GetPointCount();
for (int m = 0; m < lInteriorPointCount; m++)
{
IPointPtr ipPoint = interiorRingPointCollection->GetPoint(m);
}
}
}
代码实现:
IPolygon4Ptr ipPolygon(ipGeom);
IGeometryBagPtr exteriorRingGeometryBag = ipPolygon->GetExteriorRingBag();
IGeometryCollectionPtr exteriorRingGeometryCollection(exteriorRingGeometryBag);
// 取几何图形的个数
long lRegionCount = exteriorRingGeometryCollection->GetGeometryCount();
for (int i = 0; i < lRegionCount; i++)
{
IGeometryPtr exteriorRingGeometry = exteriorRingGeometryCollection->GetGeometry( i );
// 取外环的点
IPointCollectionPtr exteriorRingPointCollection( exteriorRingGeometry );
long lPointCount = exteriorRingPointCollection->GetPointCount();
for( int j = 0; j < lPointCount; j++ )
{
IPointPtr ipPoint = exteriorRingPointCollection->GetPoint( j );
}
// 取内环的点
IRingPtr ipRing( exteriorRingGeometry );
IGeometryBagPtr interiorRingGeometryBag = ipPolygon->GetInteriorRingBag( ipRing );
IGeometryCollectionPtr interiorRingGeometryCollection = ( IGeometryCollectionPtr )interiorRingGeometryBag;
long lInteriorCount = interiorRingGeometryCollection->GetGeometryCount();
for (int k = 0; k < lInteriorCount; k++)
{
IGeometryPtr interiorRingGeometry = interiorRingGeometryCollection->GetGeometry(k);
IPointCollectionPtr interiorRingPointCollection( interiorRingGeometry);
long lInteriorPointCount = interiorRingPointCollection->GetPointCount();
for (int m = 0; m < lInteriorPointCount; m++)
{
IPointPtr ipPoint = interiorRingPointCollection->GetPoint(m);
}
}
}
相关文章推荐
- 外观模式之C++实现
- C++中typename关键字的使用方法和注意事项
- 深入理解C++浮点数(float、double)类型数据比较、相等判断
- “内存对界”原理——数据是如何对齐的
- 基本数据类型的大小(64bit)
- c++与web交互socket该发送的协议数据
- C/C++中stack和string的介绍
- 通过C++程序示例理解设计模式中的外观模式
- c/c++中static详解
- Accerlerated c++ 答案
- 【C++】《C++标准程序库》重难点分析(一)~(五)章
- codeforces-1B-Spreadsheets( C++ && PHP && 字符串操作 && 数学逻辑 )
- C++时间运用相关
- C++设计模式编程中Template Method模板方法模式的运用
- c/c++中const详解
- char 与 unsigned char的本质区别
- C语言模拟栈
- c/c++基础
- c++调用Python [boost::python]
- c++中基本的语法问题