本文整理汇总了C++中CoordBox::merge方法的典型用法代码示例。如果您正苦于以下问题:C++ CoordBox::merge方法的具体用法?C++ CoordBox::merge怎么用?C++ CoordBox::merge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CoordBox
的用法示例。
在下文中一共展示了CoordBox::merge方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: snapMousePressEvent
void ScaleInteraction::snapMousePressEvent(QMouseEvent * anEvent, Feature* aLast)
{
QList<Feature*> sel;
if (view()->isSelectionLocked()) {
if (theMain->properties()->selection(0))
sel.append(theMain->properties()->selection(0));
else
sel.append(aLast);
} else {
sel = theMain->properties()->selection();
if (!sel.size() && aLast)
sel.append(aLast);
}
Radius = 1.0;
clearNoSnap();
Scaling.clear();
OriginalPosition.clear();
if (!sel.size())
return;
view()->setInteracting(true);
StartDragPosition = XY_TO_COORD(anEvent->pos());
OriginNode = NULL;
NodeOrigin = false;
CoordBox selBB = sel[0]->boundingBox();
for (int j=0; j<sel.size(); j++) {
selBB.merge(sel[j]->boundingBox());
if (CHECK_WAY(sel[j])) {
Way* R = STATIC_CAST_WAY(sel[j]);
for (int i=0; i<R->size(); ++i)
if (std::find(Scaling.begin(),Scaling.end(),R->get(i)) == Scaling.end())
Scaling.push_back(R->getNode(i));
addToNoSnap(R);
} else if (CHECK_NODE(sel[j])) {
if (!OriginNode && !NodeOrigin) {
OriginNode = STATIC_CAST_NODE(sel[j]);
NodeOrigin = true;
} else {
NodeOrigin = false;
}
}
}
if (Scaling.size() > 1) {
if (NodeOrigin) {
ScaleCenter = COORD_TO_XY(OriginNode->position());
} else {
ScaleCenter = COORD_TO_XY(selBB.center());
}
for (int i=0; i<Scaling.size(); ++i)
{
OriginalPosition.push_back(Scaling[i]->position());
addToNoSnap(Scaling[i]);
}
} else
Scaling.clear();
}
示例2: boundingBox
CoordBox Layer::boundingBox()
{
if(p->Features.size()==0) return CoordBox(Coord(0,0),Coord(0,0));
CoordBox Box;
bool haveFirst = false;
for (int i=0; i<p->Features.size(); ++i) {
if (p->Features.at(i)->isDeleted())
continue;
if (p->Features.at(i)->notEverythingDownloaded())
continue;
if (p->Features.at(i)->boundingBox().isNull())
continue;
if (haveFirst)
Box.merge(p->Features.at(i)->boundingBox());
else {
Box = p->Features.at(i)->boundingBox();
haveFirst = true;
}
}
return Box;
}