Mercurial > hg > svcore
changeset 676:611a4fa14dde sv_v1.8
* Avoid including non-value columns in 3d-model column count (fixes #38)
author | Chris Cannam |
---|---|
date | Mon, 04 Apr 2011 15:20:29 +0100 |
parents | 341e4e1a6ed3 |
children | ce73529405e4 |
files | data/fileio/CSVFileReader.cpp data/fileio/CSVFormat.cpp |
diffstat | 2 files changed, 27 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/data/fileio/CSVFileReader.cpp Tue Mar 29 17:55:31 2011 +0100 +++ b/data/fileio/CSVFileReader.cpp Mon Apr 04 15:20:29 2011 +0100 @@ -179,6 +179,13 @@ std::map<QString, int> labelCountMap; + int valueColumns = 0; + for (int i = 0; i < m_format.getColumnCount(); ++i) { + if (m_format.getColumnPurpose(i) == CSVFormat::ColumnValue) { + ++valueColumns; + } + } + while (!in.atEnd()) { // QTextStream's readLine doesn't cope with old-style Mac @@ -225,7 +232,7 @@ model3 = new EditableDenseThreeDimensionalModel (sampleRate, windowSize, - list.size(), + valueColumns, EditableDenseThreeDimensionalModel::NoCompression); model = model3; break; @@ -301,16 +308,18 @@ for (int i = 0; i < list.size(); ++i) { + if (m_format.getColumnPurpose(i) != CSVFormat::ColumnValue) { + continue; + } + bool ok = false; float value = list[i].toFloat(&ok); - if (m_format.getColumnPurpose(i) == CSVFormat::ColumnValue) { - values.push_back(value); - } + values.push_back(value); if (firstEverValue || value < min) min = value; if (firstEverValue || value > max) max = value; - + if (firstEverValue) { startFrame = frameNo; model3->setStartFrame(startFrame);
--- a/data/fileio/CSVFormat.cpp Tue Mar 29 17:55:31 2011 +0100 +++ b/data/fileio/CSVFormat.cpp Mon Apr 04 15:20:29 2011 +0100 @@ -174,11 +174,11 @@ } } - std::cerr << "Estimated column qualities: "; - for (int i = 0; i < m_columnCount; ++i) { - std::cerr << int(m_columnQualities[i]) << " "; - } - std::cerr << std::endl; +// std::cerr << "Estimated column qualities: "; +// for (int i = 0; i < m_columnCount; ++i) { +// std::cerr << int(m_columnQualities[i]) << " "; +// } +// std::cerr << std::endl; } void @@ -286,15 +286,15 @@ } } - std::cerr << "Estimated column purposes: "; - for (int i = 0; i < m_columnCount; ++i) { - std::cerr << int(m_columnPurposes[i]) << " "; - } - std::cerr << std::endl; +// std::cerr << "Estimated column purposes: "; +// for (int i = 0; i < m_columnCount; ++i) { +// std::cerr << int(m_columnPurposes[i]) << " "; +// } +// std::cerr << std::endl; - std::cerr << "Estimated model type: " << m_modelType << std::endl; - std::cerr << "Estimated timing type: " << m_timingType << std::endl; - std::cerr << "Estimated units: " << m_timeUnits << std::endl; +// std::cerr << "Estimated model type: " << m_modelType << std::endl; +// std::cerr << "Estimated timing type: " << m_timingType << std::endl; +// std::cerr << "Estimated units: " << m_timeUnits << std::endl; } CSVFormat::ColumnPurpose