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

Method copyValidData

src/frontend/spreadsheet/StatisticsColumnWidget.cpp:705–740  ·  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

703 * into the vector \c data.
704 */
705void StatisticsColumnWidget::copyValidData(QVector<double>& data) const {
706 const int rowCount = m_column->rowCount();
707 data.reserve(rowCount);
708 double val;
709 if (m_column->columnMode() == AbstractColumn::ColumnMode::Double) {
710 auto* rowValues = reinterpret_cast<QVector<double>*>(m_column->data());
711 for (int row = 0; row < rowCount; ++row) {
712 val = rowValues->value(row);
713 if (std::isnan(val) || m_column->isMasked(row))
714 continue;
715
716 data.push_back(val);
717 }
718 } else if (m_column->columnMode() == AbstractColumn::ColumnMode::Integer) {
719 auto* rowValues = reinterpret_cast<QVector<int>*>(m_column->data());
720 for (int row = 0; row < rowCount; ++row) {
721 val = rowValues->value(row);
722 if (std::isnan(val) || m_column->isMasked(row))
723 continue;
724
725 data.push_back(val);
726 }
727 } else if (m_column->columnMode() == AbstractColumn::ColumnMode::BigInt) {
728 auto* rowValues = reinterpret_cast<QVector<qint64>*>(m_column->data());
729 for (int row = 0; row < rowCount; ++row) {
730 val = rowValues->value(row);
731 if (std::isnan(val) || m_column->isMasked(row))
732 continue;
733
734 data.push_back(val);
735 }
736 }
737
738 if (data.size() < rowCount)
739 data.squeeze();
740}

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