本文整理汇总了C++中GraphNode::getCenter方法的典型用法代码示例。如果您正苦于以下问题:C++ GraphNode::getCenter方法的具体用法?C++ GraphNode::getCenter怎么用?C++ GraphNode::getCenter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GraphNode
的用法示例。
在下文中一共展示了GraphNode::getCenter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeChecklineRequirements
/** Finds which checklines must be visited before driving on this quad
* (useful for rescue)
*/
void QuadGraph::computeChecklineRequirements(GraphNode* node,
int latest_checkline)
{
for (unsigned int n=0; n<node->getNumberOfSuccessors(); n++)
{
const int succ_id = node->getSuccessor(n);
// warp-around
if (succ_id == 0) break;
GraphNode* succ = m_all_nodes[succ_id];
int new_latest_checkline =
CheckManager::get()->getChecklineTriggering(node->getCenter(),
succ->getCenter() );
if(new_latest_checkline==-1)
new_latest_checkline = latest_checkline;
/*
printf("Quad %i : checkline %i\n", succ_id, new_latest_checkline);
printf("Quad %i :\n", succ_id);
for (std::set<int>::iterator it = these_checklines.begin();it != these_checklines.end(); it++)
{
printf(" Depends on checkline %i\n", *it);
}
*/
if (new_latest_checkline != -1)
succ->setChecklineRequirements(new_latest_checkline);
computeChecklineRequirements(succ, new_latest_checkline);
}
} // computeChecklineRequirements
示例2: mouseMoveEvent
void GraphView::mouseMoveEvent(QMouseEvent *event)
{
if (currentAction == MOVING && selectedItem && event->button() != Qt::RightButton) {
QPointF newPos = mapToScene(event->pos());
GraphNode* node = dynamic_cast<GraphNode*>(selectedItem);
if (node) {
QRect rect = this->geometry();
if (event->pos().x() - node->getRadius() > rect.left() && event->pos().x() + node->getRadius() < rect.right() &&
event->pos().y() - node->getRadius() > rect.top() && event->pos().y() + node->getRadius() < rect.bottom()) {
QPointF oldPos = node->getCenter();
undoStack->push(new MoveNodeCommand(node, oldPos, newPos));
}
}
}
}