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


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

本文整理汇总了C++中QCPRange::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ QCPRange::contains方法的具体用法?C++ QCPRange::contains怎么用?C++ QCPRange::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QCPRange的用法示例。


在下文中一共展示了QCPRange::contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: plotAnalyze

void plot_analytics::plotAnalyze( QCPGraph *target, plotStats *stats, QCPRange keyRange)
{
    QCPGraphDataContainer::const_iterator plotIterator = target->data().data()->findBegin(keyRange.lower,true);
    QCPGraphDataContainer::const_iterator targetDataEnd = target->data().data()->findEnd(keyRange.upper,true);
    QCPGraphData currentPoint, prevPoint;

    //Find the data ranges
    currentPoint.key = keyRange.lower;
    prevPoint = QCPGraphData(plotIterator->key, plotIterator->value);

    while(plotIterator != targetDataEnd && (keyRange.contains(plotIterator->key) || stats->totalData_entrys < 2))
    {
        currentPoint = QCPGraphData(plotIterator->key, plotIterator->value);
        handlePoints(currentPoint, prevPoint, stats);

        //Value is weighted to account for datapoints that may not be equally spaced
        if(!isInvalidData(currentPoint.value) && !isInvalidData(prevPoint.value))
            stats->avgValue += currentPoint.value*(currentPoint.key-prevPoint.key);

        prevPoint = QCPGraphData(plotIterator->key, plotIterator->value);
        ++plotIterator;
    }
    //Divide by total seconds
    stats->avgValue /= stats->totalData_seconds;
}
开发者ID:whidbey,项目名称:SmartPlot,代码行数:25,代码来源:plot_analytics.cpp

示例2: clearUnwantedPoints

void plot_analytics::clearUnwantedPoints(QCPGraph *target, QCPGraph *enableReference, QCPRange valueEnableRange)
{
    QCPGraphDataContainer::iterator plotIterator = target->data()->begin();
    QCPGraphDataContainer::const_iterator refIterator;

    //First we scan and any time the reference plot is not in range wipe the plot data.
    //TODO: This will break the plot, do we clone the plot? That could be a huge amount of data...
    while(plotIterator != target->data()->end())
    {
        //Find closest reference point
        refIterator = enableReference->data().data()->findBegin(plotIterator->key, true);
        if (!valueEnableRange.contains(refIterator->value))
            plotIterator->value = std::numeric_limits<double>::quiet_NaN();

        ++plotIterator;
    }
}
开发者ID:whidbey,项目名称:SmartPlot,代码行数:17,代码来源:plot_analytics.cpp


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