本文整理汇总了C++中QwtArray::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtArray::push_back方法的具体用法?C++ QwtArray::push_back怎么用?C++ QwtArray::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtArray
的用法示例。
在下文中一共展示了QwtArray::push_back方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 {
示例2: foreach
void
PfPvPlot::setData(RideItem *_rideItem)
{
rideItem = _rideItem;
RideFile *ride = rideItem->ride;
if (ride) {
setTitle(ride->startTime().toString(GC_DATETIME_FORMAT));
// quickly erase old data
curve->setVisible(false);
// handle zone stuff
refreshZoneItems();
// 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;
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;
dataSet.insert(std::make_pair<double, double>(aepf, cpv));
tot_cad += p1->cad;
tot_cad_points++;
}
}
if (tot_cad_points == 0) {
setTitle("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;
}
setCAD(tot_cad / tot_cad_points);
curve->setData(cpvArray, aepfArray);
// now show the data (zone shading would already be visible)
curve->setVisible(true);
}
}
else {