当前位置: 首页>>代码示例>>C++>>正文


C++ Selection::contains方法代码示例

本文整理汇总了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));
}
开发者ID:OSSIA,项目名称:Score,代码行数:8,代码来源:CurveModel.cpp

示例2: setSelection

void DisplayedElementsModel::setSelection(
        const Selection & s)
{
    for_each_in_tuple(elements(), [&] (auto elt) {
        elt->selection.set(s.contains(elt.data())); // OPTIMIZEME
    });
 }
开发者ID:himito,项目名称:i-score,代码行数:7,代码来源:DisplayedElementsModel.cpp

示例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);
}
开发者ID:,项目名称:,代码行数:34,代码来源:

示例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;
}
开发者ID:Rambo2015,项目名称:TaxiVis,代码行数:42,代码来源:scatterplotwidget.cpp

示例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;
}
开发者ID:Rambo2015,项目名称:birdvis,代码行数:11,代码来源:BasicModules.cpp

示例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);
        }
    }
}
开发者ID:,项目名称:,代码行数:17,代码来源:


注:本文中的Selection::contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。