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


C++ QwtPlotCurve::detach方法代码示例

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


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

示例1: i

void
PfPvPlot::setData(RideItem *_rideItem)
{
    // clear out any interval curves which are presently defined
    if (intervalCurves.size()) {
       QListIterator<QwtPlotCurve *> i(intervalCurves);
       while (i.hasNext()) {
           QwtPlotCurve *curve = i.next();
           curve->detach();
           delete curve;
       }
    }
    intervalCurves.clear();

    rideItem = _rideItem;
    RideFile *ride = rideItem->ride();

    if (ride) {

        // quickly erase old data
        curve->setVisible(false);


        // due to the discrete power and cadence values returned by the
        // power meter, there will very likely be many duplicate values.
        // Rather than pass them all to the curve, use a set to strip
        // out duplicates.
        std::set<std::pair<double, double> > dataSet;
        std::set<std::pair<double, double> > dataSetSelected;

        long tot_cad = 0;
        long tot_cad_points = 0;

        foreach(const RideFilePoint *p1, ride->dataPoints()) {

            if (p1->watts != 0 && p1->cad != 0) {

                double aepf = (p1->watts * 60.0) / (p1->cad * cl_ * 2.0 * PI);
                double cpv = (p1->cad * cl_ * 2.0 * PI) / 60.0;

                if (aepf <= 2500) { // > 2500 newtons is our out of bounds
                    dataSet.insert(std::make_pair<double, double>(aepf, cpv));
                    tot_cad += p1->cad;
                    tot_cad_points++;
                }
            }
        }

        setCAD(tot_cad_points ? tot_cad / tot_cad_points : 0);

        if (tot_cad_points == 0) {
            //setTitle(tr("no cadence"));
            refreshZoneItems();
            curve->setVisible(false);

        } else {
            // Now that we have the set of points, transform them into the
            // QwtArrays needed to set the curve's data.
            QwtArray<double> aepfArray;
            QwtArray<double> cpvArray;

            std::set<std::pair<double, double> >::const_iterator j(dataSet.begin());
            while (j != dataSet.end()) {
                const std::pair<double, double>& dataPoint = *j;

                aepfArray.push_back(dataPoint.first);
                cpvArray.push_back(dataPoint.second);

                ++j;
            }

            curve->setData(cpvArray, aepfArray);
            QwtSymbol sym;
            sym.setStyle(QwtSymbol::Ellipse);
            sym.setSize(6);
            sym.setBrush(QBrush(Qt::NoBrush));

            // now show the data (zone shading would already be visible)
            refreshZoneItems();
            curve->setVisible(true);
        }
    } else {
开发者ID:jasonwiener,项目名称:GoldenCheetah,代码行数:82,代码来源:PfPvPlot.cpp

示例2: removeCurve

void Plot::removeCurve(int index)
{
    QwtPlotCurve *c = d_curves[index];
    c->detach();
    d_curves.remove (index);
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:6,代码来源:plot.cpp

示例3: setData

void ScatterPlot::setData (ScatterSettings *settings)
{
    // get application settings
    cranklength = appsettings->value(this, GC_CRANKLENGTH, 0.0).toDouble() / 1000.0;

    // if there are no settings or incomplete settings
    // create a null data plot
    if (settings == NULL || settings->ride == NULL || settings->ride->ride() == NULL ||
        settings->x == 0 || settings->y == 0 ) {
        return;
    }


    // if its not setup or no settings exist default to 175mm cranks
    if (cranklength == 0.0) cranklength = 0.175;

    //
    // Create Main Plot dataset - used to frame intervals
    //
    int points=0;

    x.clear();
    y.clear();
    x.resize(settings->ride->ride()->dataPoints().count());
    y.resize(settings->ride->ride()->dataPoints().count());

    double maxY = maxX = -65535;
    double minY = minX = 65535;

    foreach(const RideFilePoint *point, settings->ride->ride()->dataPoints()) {

        double xv = x[points] = pointType(point, settings->x, context->athlete->useMetricUnits, cranklength);
        double yv = y[points] = pointType(point, settings->y, context->athlete->useMetricUnits, cranklength);

        // skip zeroes?
        if (!(settings->ignore && (x[points] == 0 || y[points] == 0))) {
            points++;
            if (yv > maxY) maxY = yv;
            if (yv < minY) minY = yv;
            if (xv > maxX) maxX = xv;
            if (xv < minX) minX = xv;
        }
    }

    QwtSymbol sym;
    sym.setStyle(QwtSymbol::Ellipse);
    sym.setSize(6);
    sym.setPen(GCColor::invert(GColor(CPLOTBACKGROUND)));
    sym.setBrush(QBrush(Qt::NoBrush));
    QPen p;
    p.setColor(GColor(CPLOTSYMBOL));
    sym.setPen(p);

    // wipe away existing
	if (all) {
        all->detach();
	    delete all;
    }

    // setup the framing curve
    if (settings->frame) {
        all = new QwtPlotCurve();
        all->setSymbol(new QwtSymbol(sym));
        all->setStyle(QwtPlotCurve::Dots);
        all->setRenderHint(QwtPlotItem::RenderAntialiased);
	    all->setData(x.constData(), y.constData(), points);
        all->attach(this);
    } else {
        all = NULL;
    }

    QPen gridPen(GColor(CPLOTGRID));
    gridPen.setStyle(Qt::DotLine);

    if (grid) {
        grid->detach();
        delete grid;
    }

    if (settings->gridlines) {
        grid = new QwtPlotGrid();
        grid->setPen(gridPen);
        grid->enableX(true);
        grid->enableY(true);
        grid->attach(this);
    } else {
        grid = NULL;
    }

    setAxisTitle(yLeft, describeType(settings->y, true, useMetricUnits));
    setAxisTitle(xBottom, describeType(settings->x, true, useMetricUnits));

    // truncate PfPv values to make easier to read
    if (settings->y == MODEL_AEPF) setAxisScale(yLeft, 0, 600);
    else setAxisScale(yLeft, minY, maxY);
    if (settings->x == MODEL_CPV) setAxisScale(xBottom, 0, 3);
    else setAxisScale(xBottom, minX, maxX);

    //
    // Create Interval Plot dataset - used to frame intervals
//.........这里部分代码省略.........
开发者ID:bbrond,项目名称:GoldenCheetah,代码行数:101,代码来源:ScatterPlot.cpp


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