diff data/model/EditableDenseThreeDimensionalModel.cpp @ 838:33fca917c800

Add toDelimitedDataString alternative with frame extents
author Chris Cannam
date Wed, 09 Oct 2013 14:47:19 +0100
parents 1424aa29ae95
children e802e550a1f2
line wrap: on
line diff
--- a/data/model/EditableDenseThreeDimensionalModel.cpp	Wed Oct 09 14:45:21 2013 +0100
+++ b/data/model/EditableDenseThreeDimensionalModel.cpp	Wed Oct 09 14:47:19 2013 +0100
@@ -483,6 +483,24 @@
     return s;
 }
 
+QString
+EditableDenseThreeDimensionalModel::toDelimitedDataString(QString delimiter, size_t f0, size_t f1) const
+{
+    QReadLocker locker(&m_lock);
+    QString s;
+    for (size_t i = 0; i < m_data.size(); ++i) {
+        size_t fr = m_startFrame + i * m_resolution;
+        if (fr >= f0 && fr < f1) {
+            QStringList list;
+            for (size_t j = 0; j < m_data.at(i).size(); ++j) {
+                list << QString("%1").arg(m_data.at(i).at(j));
+            }
+            s += list.join(delimiter) + "\n";
+        }
+    }
+    return s;
+}
+
 void
 EditableDenseThreeDimensionalModel::toXml(QTextStream &out,
                                           QString indent,