bool checkMultipart() //检查是否是多部分要素
{
IFeaturePtr ipFeature = getFeature(); //选择要素---
IGeometryPtr ipGeometry;
ipFeature->get_Shape(&ipGeometry);
IGeometryCollectionPtr ipGeometryCollection = (IGeometryCollectionPtr)ipGeometry;
long geometryCount;
ipGeometryCollection->get_GeometryCount(&geometryCount); //得到由多少个图形组成;
if (geometryCount > 1) //判断大于1时--
{
IGeometryPtr ipCheckGeometry, ipNewCheckGeometry;
for (int i = 0; i < geometryCount-1; i++)
{
ipGeometryCollection->get_Geometry(i,&ipCheckGeometry);
ipGeometryCollection->get_Geometry(i+1, &ipNewCheckGeometry); //该Geometry类型为esriGeometryRing reason: because the polygon is included--by ring;
IRingPtr ipCheckRing = (IRingPtr)ipCheckGeometry; //强制转换:
IRingPtr ipNewCheckRing = (IRingPtr)ipNewCheckGeometry;
short checkInteriror, checkOuter;
ipCheckRing->get_IsExterior(&checkInteriror); // determine whether is 外环
ipNewCheckRing->get_IsExterior(&checkOuter);
if (checkInteriror == 0 || checkOuter == 0)
{
return false;
}
else if(checkInteriror == -1 || checkOuter == -1)
{
return true;
}
}
}
return false;
}
multipart要素是啥--
简单介绍--
see it===
其中 ---如果有内外环的就不算多要素;;