diff data/model/SparseModel.h @ 777:eea8049df526

Fix incorrect retrieval of point in model by row number if point frame values fell between model resolution boundaries
author Chris Cannam
date Wed, 27 Mar 2013 14:51:49 +0000
parents e22b6e89a7f7
children d373ced0e6e9
line wrap: on
line diff
--- a/data/model/SparseModel.h	Mon Mar 25 12:15:36 2013 +0000
+++ b/data/model/SparseModel.h	Wed Mar 27 14:51:49 2013 +0000
@@ -386,6 +386,7 @@
     {
         m_rows.clear();
         for (PointListConstIterator i = m_points.begin(); i != m_points.end(); ++i) {
+//            std::cerr << "rebuildRowVector: row " << m_rows.size() << " -> " << i->frame << std::endl;
             m_rows.push_back(i->frame);
         }
     }
@@ -406,6 +407,7 @@
         PointListIterator i = i0;
 
         for (i = i0; i != i1; ++i) {
+            if (i->frame < frame) { continue; }
             if (indexAtFrame > 0) { --indexAtFrame; continue; }
             return i;
         }
@@ -427,11 +429,14 @@
         while (ri > 0 && m_rows[ri-1] == m_rows[row]) { --ri; ++indexAtFrame; }
         int initialIndexAtFrame = indexAtFrame;
 
+//        std::cerr << "getPointListIteratorForRow " << row << ": initialIndexAtFrame = " << initialIndexAtFrame << std::endl;
+
         PointListConstIterator i0, i1;
         getPointIterators(frame, i0, i1);
         PointListConstIterator i = i0;
 
         for (i = i0; i != i1; ++i) {
+            if (i->frame < frame) { continue; }
             if (indexAtFrame > 0) { --indexAtFrame; continue; }
             return i;
         }
@@ -579,7 +584,7 @@
     long end = start + m_resolution;
 
     PointType startPoint(start), endPoint(end);
-    
+
     startItr = m_points.lower_bound(startPoint);
       endItr = m_points.upper_bound(endPoint);
 }
@@ -603,6 +608,8 @@
 
     PointType startPoint(start), endPoint(end);
     
+//    std::cerr << "getPointIterators: start frame " << start << ", end frame " << end << ", m_resolution " << m_resolution << std::endl;
+    
     startItr = m_points.lower_bound(startPoint);
       endItr = m_points.upper_bound(endPoint);
 }
@@ -775,8 +782,8 @@
                               QString indent,
                               QString extraAttributes) const
 {
-    std::cerr << "SparseModel::toXml: extraAttributes = \"" 
-              << extraAttributes.toStdString() << std::endl;
+//    std::cerr << "SparseModel::toXml: extraAttributes = \"" 
+//              << extraAttributes.toStdString() << std::endl;
 
     QString type = getXmlOutputType();