comparison data/model/AlignmentModel.h @ 1766:85b9b466a59f

Merge from branch by-id
author Chris Cannam
date Wed, 17 Jul 2019 14:24:51 +0100
parents ee7fd2c01d87
children f19711ab7074
comparison
equal deleted inserted replaced
1730:649ac57c5a2d 1766:85b9b466a59f
15 15
16 #ifndef SV_ALIGNMENT_MODEL_H 16 #ifndef SV_ALIGNMENT_MODEL_H
17 #define SV_ALIGNMENT_MODEL_H 17 #define SV_ALIGNMENT_MODEL_H
18 18
19 #include "Model.h" 19 #include "Model.h"
20 #include "PathModel.h" 20 #include "Path.h"
21 #include "base/RealTime.h" 21 #include "base/RealTime.h"
22 22
23 #include <QString> 23 #include <QString>
24 #include <QStringList> 24 #include <QStringList>
25 25
28 class AlignmentModel : public Model 28 class AlignmentModel : public Model
29 { 29 {
30 Q_OBJECT 30 Q_OBJECT
31 31
32 public: 32 public:
33 AlignmentModel(Model *reference, 33 AlignmentModel(ModelId reference /* any model */,
34 Model *aligned, 34 ModelId aligned /* any model */,
35 SparseTimeValueModel *path); 35 ModelId path /* a SparseTimeValueModel */);
36 ~AlignmentModel(); 36 ~AlignmentModel();
37 37
38 bool isOK() const override; 38 bool isOK() const override;
39 39
40 void setError(QString error) { m_error = error; } 40 void setError(QString error) { m_error = error; }
51 } 51 }
52 const ZoomConstraint *getZoomConstraint() const override; 52 const ZoomConstraint *getZoomConstraint() const override;
53 53
54 QString getTypeName() const override { return tr("Alignment"); } 54 QString getTypeName() const override { return tr("Alignment"); }
55 55
56 const Model *getReferenceModel() const; 56 ModelId getReferenceModel() const;
57 const Model *getAlignedModel() const; 57 ModelId getAlignedModel() const;
58 58
59 sv_frame_t toReference(sv_frame_t frame) const; 59 sv_frame_t toReference(sv_frame_t frame) const;
60 sv_frame_t fromReference(sv_frame_t frame) const; 60 sv_frame_t fromReference(sv_frame_t frame) const;
61 61
62 void setPathFrom(SparseTimeValueModel *rawpath); 62 void setPathFrom(ModelId pathSource); // a SparseTimeValueModel
63 void setPath(PathModel *path); 63 void setPath(const Path &path);
64 64
65 void toXml(QTextStream &stream, 65 void toXml(QTextStream &stream,
66 QString indent = "", 66 QString indent = "",
67 QString extraAttributes = "") const override; 67 QString extraAttributes = "") const override;
68 68
69 QString toDelimitedDataString(QString, DataExportOptions, 69 QString toDelimitedDataString(QString, DataExportOptions,
70 sv_frame_t, sv_frame_t) const override { 70 sv_frame_t, sv_frame_t) const override {
71 return ""; 71 return "";
72 } 72 }
73 73
74 signals: 74 signals:
75 void modelChanged(); 75 void completionChanged(ModelId);
76 void modelChangedWithin(sv_frame_t startFrame, sv_frame_t endFrame);
77 void completionChanged();
78 76
79 protected slots: 77 protected slots:
80 void pathChanged(); 78 void pathSourceChangedWithin(ModelId, sv_frame_t startFrame, sv_frame_t endFrame);
81 void pathChangedWithin(sv_frame_t startFrame, sv_frame_t endFrame); 79 void pathSourceCompletionChanged(ModelId);
82 void pathCompletionChanged();
83 80
84 protected: 81 protected:
85 Model *m_reference; // I don't own this 82 ModelId m_reference;
86 Model *m_aligned; // I don't own this 83 ModelId m_aligned;
87 84
88 SparseTimeValueModel *m_rawPath; // I own this 85 ModelId m_pathSource; // a SparseTimeValueModel, which we need a
89 mutable PathModel *m_path; // I own this 86 // handle on only while it's still being generated
90 mutable PathModel *m_reversePath; // I own this 87
88 mutable std::unique_ptr<Path> m_path;
89 mutable std::unique_ptr<Path> m_reversePath;
91 bool m_pathBegun; 90 bool m_pathBegun;
92 bool m_pathComplete; 91 bool m_pathComplete;
93 QString m_error; 92 QString m_error;
94 93
95 void constructPath() const; 94 void constructPath() const;
96 void constructReversePath() const; 95 void constructReversePath() const;
97 96
98 sv_frame_t align(PathModel *path, sv_frame_t frame) const; 97 sv_frame_t performAlignment(const Path &path, sv_frame_t frame) const;
99 }; 98 };
100 99
101 #endif 100 #endif