本文整理汇总了C++中Selection::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ Selection::contains方法的具体用法?C++ Selection::contains怎么用?C++ Selection::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Selection
的用法示例。
在下文中一共展示了Selection::contains方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setSelection
void Model::setSelection(const Selection& s)
{
// OPTIMIZEME
for (auto& elt : m_segments)
elt.selection.set(s.contains(&elt));
for (auto& elt : m_points)
elt->selection.set(s.contains(elt));
}
示例2: setSelection
void DisplayedElementsModel::setSelection(
const Selection & s)
{
for_each_in_tuple(elements(), [&] (auto elt) {
elt->selection.set(s.contains(elt.data())); // OPTIMIZEME
});
}
示例3: EditCommand
void
TimeInstantLayer::resizeSelection(Selection s, Selection newSize)
{
if (!m_model) return;
SparseOneDimensionalModel::EditCommand *command =
new SparseOneDimensionalModel::EditCommand(m_model,
tr("Resize Selection"));
SparseOneDimensionalModel::PointList points =
m_model->getPoints(s.getStartFrame(), s.getEndFrame());
double ratio =
double(newSize.getEndFrame() - newSize.getStartFrame()) /
double(s.getEndFrame() - s.getStartFrame());
for (SparseOneDimensionalModel::PointList::iterator i = points.begin();
i != points.end(); ++i) {
if (s.contains(i->frame)) {
double target = i->frame;
target = newSize.getStartFrame() +
double(target - s.getStartFrame()) * ratio;
SparseOneDimensionalModel::Point newPoint(*i);
newPoint.frame = lrint(target);
command->deletePoint(*i);
command->addPoint(newPoint);
}
}
finish(command);
}
示例4: tripSatisfiesConstraints
bool ScatterPlotWidget::tripSatisfiesConstraints(const KdTrip::Trip *trip,
std::vector<SelectionGraphNode*> groupNodeConstraints,
std::vector<SelectionGraphEdge*> groupEdgeConstraints){
//this set registers the nodes that are only support for edges
set<int> alreadyProcessedNodes;
//test edges
vector<SelectionGraphEdge*>::iterator edgeIterator;
for(edgeIterator = groupEdgeConstraints.begin() ; edgeIterator != groupEdgeConstraints.end() ; ++edgeIterator){
SelectionGraphEdge* edge = *edgeIterator;
SelectionGraphNode* tail = edge->getTail();
SelectionGraphNode* head = edge->getHead();
alreadyProcessedNodes.insert(tail->getId());
alreadyProcessedNodes.insert(head->getId());
if(tripSatisfiesEdge(trip,edge))
return true;
}
//test nodes
vector<SelectionGraphNode*>::iterator nodeIterator;
for(nodeIterator = groupNodeConstraints.begin() ; nodeIterator != groupNodeConstraints.end() ; ++ nodeIterator){
SelectionGraphNode* node = *nodeIterator;
if(alreadyProcessedNodes.count(node->getId()) > 0)
continue;
Selection* sel = node->getSelection();
if((sel->getType() == Selection::START || sel->getType() == Selection::START_AND_END) &&
sel->contains(QPointF(trip->pickup_lat,trip->pickup_long))){
return true;
}
else if((sel->getType() == Selection::END || sel->getType() == Selection::START_AND_END) &&
sel->contains(QPointF(trip->dropoff_lat,trip->dropoff_long))){
return true;
}
}
//
return false;
}
示例5:
Selection*
SelectionRepository::getSelectionOn(float x, float y)
{
for (int i=selections.size()-1;i>=0;i--)
{
Selection *sel = selections.at(i);
if (sel->contains(x,y))
return sel;
}
return NULL;
}
示例6: point
void
TimeInstantLayer::copy(View *v, Selection s, Clipboard &to)
{
if (!m_model) return;
SparseOneDimensionalModel::PointList points =
m_model->getPoints(s.getStartFrame(), s.getEndFrame());
for (SparseOneDimensionalModel::PointList::iterator i = points.begin();
i != points.end(); ++i) {
if (s.contains(i->frame)) {
Clipboard::Point point(i->frame, i->label);
point.setReferenceFrame(alignToReference(v, i->frame));
to.addPoint(point);
}
}
}