Mercurial > hg > svcore
diff data/fileio/CSVFileReader.cpp @ 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 | 3a5ee4b6c9ad |
children | b4a8d8221eaf |
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);