while (bdtbEnt.valid())
{
dan::Vector<dan::Vector<dan::Point3DF> > bdtbCircleNode = bdtbEnt->getNodes(); //获得BDTB图层的环节点
QNodesArray bdtbNodesArray = SDFUN::nodes3dTonodesArray(bdtbCircleNode); //转成QVector
dan::Vector<int> deleteEnt;
bool isok;
for (int t = 0; t != bdtbNodesArray.size(); ++t)
{
for (int i = 0; i != bdtbNodesArray[t].size(); ++i)
{
dan::Object<iDataPlugin::IPGEntityCursor> xzqEntCursor = ipDatabase->iDataSSGetPath(xzqLayer, bdtbEnt->getNodes(), iDataPlugin::IPGDataBase::IntersectsItemShape); //得到相接的xzqEntCursor
dan::Object<iDataPlugin::IPGEntity> xzqEnt = xzqEntCursor->next();
int ttk = 0;
isok = true;
while (xzqEnt.valid())
{
ttk++;
if (ttk == 1)
{
isok = false;
}
test = 2;
dan::Vector<dan::Vector<dan::Point3DF> > xzqCircleNode = xzqEnt->getNodes(); //获得BDTB图层的环节点;
QNodesArray xzqNodesArray = SDFUN::nodes3dTonodesArray(xzqCircleNode); //转成QList
for (int m = 0; m != xzqNodesArray.size(); ++m)
{
QPointF ptclose;
int nidx;
double dparam;
double distanceShort = SquarePtDistPoly(bdtbNodesArray[t][i], xzqNodesArray[m], ptclose, nidx, dparam); //得到点到面的最短距离
if (distanceShort < 1e-3) //如果距离最近则说明该点位于相交线上;而后进行判断是否为同一点:
{
for (QPointF var : xzqNodesArray[m])
{
double dist_tmp = square2dDist(bdtbNodesArray[t][i], var);
if (dist_tmp < 1e-3)//只要有一个点的距离很小,就认为是同一点
{
isok = true;
break;
}
}
}
}
xzqEnt = xzqEntCursor->next();
}
if (!isok)
{
//需要再判断是否在其他图层当中--.--
bdtbNodesArray[t].removeAt(i);
i--;
test = 0;
}
}
}
if (test == 0)
{
bdtbEnt->setNodes(SDFUN::nodes3dTonodesArray(bdtbNodesArray));
modifyEntList.append(bdtbEnt);
}
if (modifyEntList.size() > 5000)
{
ipDatabase->modifyEntityFromDatabase(bdtbLayer, modifyEntList); //删除节点后修改
modifyEntList.clear();
}
bdtbEnt = bdtbEntCursor->next();
}
progressbar->closeProgress();
if (modifyEntList.size() > 0)
{
ipDatabase->modifyEntityFromDatabase(bdtbLayer, modifyEntList); //修改实体到图层
QMessageBox::warning(NULL, QString::fromLocal8Bit("节点去除"), QString::fromLocal8Bit("多余节点去除完成"));
}
adapter->refresh();