MCPcopy Create free account
hub / github.com/KDE/labplot / copyValidData

Method copyValidData

src/backend/worksheet/plots/cartesian/QQPlot.cpp:537–572  ·  view source on GitHub ↗

! * copy the non-nan and not masked values of the current column * into the vector \c data. */

Source from the content-addressed store, hash-verified

535 * into the vector \c data.
536 */
537void QQPlotPrivate::copyValidData(QVector<double>& data) const {
538 const int rowCount = dataColumn->rowCount();
539 data.reserve(rowCount);
540 double val;
541 if (dataColumn->columnMode() == AbstractColumn::ColumnMode::Double) {
542 auto* rowValues = reinterpret_cast<QVector<double>*>(reinterpret_cast<const Column*>(dataColumn)->data());
543 for (int row = 0; row < rowCount; ++row) {
544 val = rowValues->value(row);
545 if (std::isnan(val) || dataColumn->isMasked(row))
546 continue;
547
548 data.push_back(val);
549 }
550 } else if (dataColumn->columnMode() == AbstractColumn::ColumnMode::Integer) {
551 auto* rowValues = reinterpret_cast<QVector<int>*>(reinterpret_cast<const Column*>(dataColumn)->data());
552 for (int row = 0; row < rowCount; ++row) {
553 val = rowValues->value(row);
554 if (std::isnan(val) || dataColumn->isMasked(row))
555 continue;
556
557 data.push_back(val);
558 }
559 } else if (dataColumn->columnMode() == AbstractColumn::ColumnMode::BigInt) {
560 auto* rowValues = reinterpret_cast<QVector<qint64>*>(reinterpret_cast<const Column*>(dataColumn)->data());
561 for (int row = 0; row < rowCount; ++row) {
562 val = rowValues->value(row);
563 if (std::isnan(val) || dataColumn->isMasked(row))
564 continue;
565
566 data.push_back(val);
567 }
568 }
569
570 if (data.size() < rowCount)
571 data.squeeze();
572}
573
574/*!
575 recalculates the outer bounds and the shape of the curve.

Callers

nothing calls this directly

Calls 7

rowCountMethod · 0.45
reserveMethod · 0.45
columnModeMethod · 0.45
dataMethod · 0.45
valueMethod · 0.45
isMaskedMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected