diff data/model/AlignmentModel.h @ 407:88ad01799040

* Save alignments to session file. Needs much testing.
author Chris Cannam
date Tue, 29 Apr 2008 15:34:17 +0000
parents 700cd3350391
children 59e7fe1b1003
line wrap: on
line diff
--- a/data/model/AlignmentModel.h	Tue Apr 29 10:59:19 2008 +0000
+++ b/data/model/AlignmentModel.h	Tue Apr 29 15:34:17 2008 +0000
@@ -17,7 +17,7 @@
 #define _ALIGNMENT_MODEL_H_
 
 #include "Model.h"
-#include "SparseModel.h"
+#include "PathModel.h"
 #include "base/RealTime.h"
 
 #include <QString>
@@ -52,6 +52,12 @@
     size_t toReference(size_t frame) const;
     size_t fromReference(size_t frame) const;
 
+    void setPath(PathModel *path);
+
+    virtual void toXml(QTextStream &stream,
+                       QString indent = "",
+                       QString extraAttributes = "") const;
+
 signals:
     void modelChanged();
     void modelChanged(size_t startFrame, size_t endFrame);
@@ -68,54 +74,6 @@
 
     Model *m_inputModel; // I own this
 
-    struct PathPoint
-    {
-        PathPoint(long _frame) : frame(_frame), mapframe(_frame) { }
-        PathPoint(long _frame, long _mapframe) :
-            frame(_frame), mapframe(_mapframe) { }
-
-        int getDimensions() const { return 2; }
-
-        long frame;
-        long mapframe;
-
-        QString getLabel() const { return ""; }
-
-        void toXml(QTextStream &stream, QString indent = "",
-                   QString extraAttributes = "") const {
-            stream << QString("%1<point frame=\"%2\" mapframe=\"%3\" %4/>\n")
-                .arg(indent).arg(frame).arg(mapframe).arg(extraAttributes);
-        }
-        
-        QString toDelimitedDataString(QString delimiter,
-                                      size_t sampleRate) const {
-            QStringList list;
-            list << RealTime::frame2RealTime(frame, sampleRate).toString().c_str();
-            list << QString("%1").arg(mapframe);
-            return list.join(delimiter);
-        }
-
-        struct Comparator {
-            bool operator()(const PathPoint &p1, const PathPoint &p2) const {
-                if (p1.frame != p2.frame) return p1.frame < p2.frame;
-                return p1.mapframe < p2.mapframe;
-            }
-        };
-    
-        struct OrderComparator {
-            bool operator()(const PathPoint &p1, const PathPoint &p2) const {
-                return p1.frame < p2.frame;
-            }
-        };
-    };
-
-    class PathModel : public SparseModel<PathPoint>
-    {
-    public:
-        PathModel(size_t sampleRate, size_t resolution, bool notify = true) :
-            SparseModel<PathPoint>(sampleRate, resolution, notify) { }
-    };
-
     SparseTimeValueModel *m_rawPath; // I own this
     mutable PathModel *m_path; // I own this
     mutable PathModel *m_reversePath; // I own this