|
区域在区域内
// Function name : RgnInRgn
// Descrīption : is Region1 in Region2?
// Return type : bool
// Argument : const AcDbRegion* pRegion1
// Argument : const AcDbRegion* pRegion2
bool RgnInRgn(const AcDbRegion* pRegion1,const AcDbRegion* pRegion2)
{
if (pRegion1==NULL||pRegion2==NULL) return false;
AcDbObjectPointer< AcDbRegion > spRegion1;
AcDbObjectPointer< AcDbRegion > spRegion2;
if (spRegion1.create()!=Acad::eOk)
{
acdbFail("\n内存不足");
return false;
}
if (spRegion2.create()!=Acad::eOk)
{
acdbFail("\n内存不足");
return false;
}
if ((spRegion1->copyFrom(pRegion1)!= Acad::eOk)||
(spRegion2->copyFrom(pRegion2)!= Acad::eOk))
{
acdbFail("\n无法复制对象");
return false;
}
bool bResult=false;
if(spRegion1->booleanOper(AcDb::kBoolIntersect, spRegion2.object()) == Acad::eOk)
{
if ((spRegion2->isNull()==Adesk::kTrue)&&(spRegion1->isNull()!=Adesk::kTrue)){
double area1,area0;
spRegion1->getArea(area1);
pRegion1->getArea(area0);
if ((area0 - area1) < AcGeContext::gTol.equalPoint())
bResult=true;
}
}
return bResult;
} |
|