! * copy the non-nan and not masked values of the current column * into the vector \c data. */
| 703 | * into the vector \c data. |
| 704 | */ |
| 705 | void 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 | } |