本文整理汇总了C++中ViewEdge::getId方法的典型用法代码示例。如果您正苦于以下问题:C++ ViewEdge::getId方法的具体用法?C++ ViewEdge::getId怎么用?C++ ViewEdge::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewEdge
的用法示例。
在下文中一共展示了ViewEdge::getId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NonTVertex
ViewVertex *ViewMap::InsertViewVertex(SVertex *iVertex, vector<ViewEdge*>& newViewEdges)
{
NonTVertex *vva = dynamic_cast<NonTVertex*>(iVertex->viewvertex());
if (vva)
return vva;
// because it is not already a ViewVertex, this SVertex must have only 2 FEdges. The incoming one still belongs
// to ioEdge, the outgoing one now belongs to newVEdge
const vector<FEdge *>& fedges = iVertex->fedges();
if (fedges.size() != 2) {
cerr << "ViewMap warning: Can't split the ViewEdge" << endl;
return NULL;
}
FEdge *fend(NULL), *fbegin(NULL);
for (vector<FEdge *>::const_iterator fe = fedges.begin(), feend = fedges.end(); fe != feend; ++fe) {
if ((*fe)->vertexB() == iVertex) {
fend = (*fe);
}
if ((*fe)->vertexA() == iVertex) {
fbegin = (*fe);
}
if ((fbegin != NULL) && (fend != NULL))
break;
}
ViewEdge *ioEdge = fbegin->viewedge();
ViewShape *vshape = ioEdge->viewShape();
vva = new NonTVertex(iVertex);
// if the ViewEdge is a closed loop, we don't create a new VEdge
if (ioEdge->A() == 0) {
// closed loop
ioEdge->setA(vva);
ioEdge->setB(vva);
// update sshape
vshape->sshape()->RemoveEdgeFromChain(ioEdge->fedgeA());
vshape->sshape()->RemoveEdgeFromChain(ioEdge->fedgeB());
ioEdge->setFEdgeA(fbegin);
ioEdge->setFEdgeB(fend);
// Update FEdges
fend->setNextEdge(NULL);
fbegin->setPreviousEdge(NULL);
// update new View Vertex:
vva->AddOutgoingViewEdge(ioEdge);
vva->AddIncomingViewEdge(ioEdge);
vshape->sshape()->AddChain(ioEdge->fedgeA());
vshape->sshape()->AddChain(ioEdge->fedgeB());
}
else {
// Create new ViewEdge
ViewEdge *newVEdge = new ViewEdge(vva, ioEdge->B(), fbegin, ioEdge->fedgeB(), vshape);
newVEdge->setId(Id(ioEdge->getId().getFirst(), ioEdge->getId().getSecond() + 1));
newVEdge->setNature(ioEdge->getNature());
//newVEdge->UpdateFEdges(); // done in the ViewEdge constructor
// Update old ViewEdge
ioEdge->setB(vva);
ioEdge->setFEdgeB(fend);
// Update FEdges
fend->setNextEdge(NULL);
fbegin->setPreviousEdge(NULL);
// update new View Vertex:
vva->AddOutgoingViewEdge(newVEdge);
vva->AddIncomingViewEdge(ioEdge);
NonTVertex *vvb = dynamic_cast<NonTVertex*>(newVEdge->B());
if (vvb)
vvb->Replace(ioEdge, newVEdge);
// update ViewShape
//vshape->AddEdge(newVEdge);
// update SShape
vshape->sshape()->AddChain(fbegin);
// update ViewMap
//_VEdges.push_back(newVEdge);
newViewEdges.push_back(newVEdge);
}
// update ViewShape
vshape->AddVertex(vva);
// update ViewMap
_VVertices.push_back(vva);
return vva;
}