comparison data/model/AlignmentModel.cpp @ 1862:3072aa267248

Permit setting completion directly on the alignment model, if we aren't using a transform to populate the path source but are instead going to set the path directly after completion
author Chris Cannam
date Fri, 22 May 2020 16:23:25 +0100
parents edc2d0e635dc
children
comparison
equal deleted inserted replaced
1861:9219834e39a4 1862:3072aa267248
27 m_pathSource(pathSource), 27 m_pathSource(pathSource),
28 m_path(nullptr), 28 m_path(nullptr),
29 m_reversePath(nullptr), 29 m_reversePath(nullptr),
30 m_pathBegun(false), 30 m_pathBegun(false),
31 m_pathComplete(false), 31 m_pathComplete(false),
32 m_relativePitch(0) 32 m_relativePitch(0),
33 m_explicitlySetCompletion(-1)
33 { 34 {
34 setPathFrom(pathSource); 35 setPathFrom(pathSource);
35 36
36 if (m_reference == m_aligned) { 37 if (m_reference == m_aligned) {
37 // Trivial alignment, e.g. of main model to itself, which we 38 // Trivial alignment, e.g. of main model to itself, which we
103 } 104 }
104 105
105 bool 106 bool
106 AlignmentModel::isReady(int *completion) const 107 AlignmentModel::isReady(int *completion) const
107 { 108 {
109 if (m_explicitlySetCompletion != -1) {
110 if (completion) *completion = m_explicitlySetCompletion;
111 return (m_explicitlySetCompletion == 100);
112 }
108 if (!m_pathBegun && !m_pathSource.isNone()) { 113 if (!m_pathBegun && !m_pathSource.isNone()) {
109 if (completion) *completion = 0; 114 if (completion) *completion = 0;
110 #ifdef DEBUG_ALIGNMENT_MODEL 115 #ifdef DEBUG_ALIGNMENT_MODEL
111 SVCERR << "AlignmentModel::isReady: path not begun" << endl; 116 SVCERR << "AlignmentModel::isReady: path not begun" << endl;
112 #endif 117 #endif
152 157
153 ModelId 158 ModelId
154 AlignmentModel::getAlignedModel() const 159 AlignmentModel::getAlignedModel() const
155 { 160 {
156 return m_aligned; 161 return m_aligned;
162 }
163
164 void
165 AlignmentModel::setCompletion(int completion)
166 {
167 m_explicitlySetCompletion = completion;
168 emit completionChanged(getId());
157 } 169 }
158 170
159 sv_frame_t 171 sv_frame_t
160 AlignmentModel::toReference(sv_frame_t frame) const 172 AlignmentModel::toReference(sv_frame_t frame) const
161 { 173 {