[每日一码] ARX 查找多段线的下一点
static void GetNextPt(const AcDbPolyline* plMin,const bool& gotonext,const int& plIndex,AcGePoint2d& ptNextS,AcGePoint2d& ptNextE){
int nextIndex = 0;
int count = plMin->numVerts();
if(!gotonext)
{
if(plIndex > 0)
{
nextIndex = plIndex - 1;
}
else
{
nextIndex = count - 1;
}
}
else
{
if(plIndex < count - 1)
{
nextIndex = plIndex + 1;
}
else
{
nextIndex = 0;
}
}
AcDbPolyline::SegType nextType = plMin->segType(nextIndex);
if(nextType == AcDbPolyline::SegType::kArc)
{
AcGeCircArc2d arc2d;
plMin->getArcSegAt(nextIndex,arc2d);
ptNextS = arc2d.startPoint();
ptNextE = arc2d.endPoint();
}
else
{
AcGeLineSeg2d line2d;
plMin->getLineSegAt(nextIndex,line2d);
ptNextS = line2d.startPoint();
ptNextE = line2d.endPoint();
}
}
页:
[1]