# HG changeset patch # User Chris Cannam # Date 1556707528 -3600 # Node ID 187c76c40c6f2574f17c471bc5a11ab74ffc51af # Parent cd6be949a16a8073cbafbd61836d014382eb7fba Ensure a self-alignment is always reported as complete, since there is nothing to calculate diff -r cd6be949a16a -r 187c76c40c6f data/model/AlignmentModel.cpp --- a/data/model/AlignmentModel.cpp Thu Apr 25 17:06:33 2019 +0100 +++ b/data/model/AlignmentModel.cpp Wed May 01 11:45:28 2019 +0100 @@ -48,6 +48,13 @@ if (m_rawPath && m_rawPath->isReady()) { pathCompletionChanged(); } + + if (m_reference == m_aligned) { + // Trivial alignment, e.g. of main model to itself, which we + // record so that we can distinguish the reference model for + // alignments from an unaligned model. No path required + m_pathComplete = true; + } } AlignmentModel::~AlignmentModel() @@ -101,14 +108,14 @@ if (!m_pathBegun && m_rawPath) { if (completion) *completion = 0; #ifdef DEBUG_ALIGNMENT_MODEL - SVDEBUG << "AlignmentModel::isReady: path not begun" << endl; + SVCERR << "AlignmentModel::isReady: path not begun" << endl; #endif return false; } if (m_pathComplete) { if (completion) *completion = 100; #ifdef DEBUG_ALIGNMENT_MODEL - SVDEBUG << "AlignmentModel::isReady: path complete" << endl; + SVCERR << "AlignmentModel::isReady: path complete" << endl; #endif return true; } @@ -118,7 +125,7 @@ // set at all yet (this case) if (completion) *completion = 0; #ifdef DEBUG_ALIGNMENT_MODEL - SVDEBUG << "AlignmentModel::isReady: no raw path" << endl; + SVCERR << "AlignmentModel::isReady: no raw path" << endl; #endif return false; } diff -r cd6be949a16a -r 187c76c40c6f data/model/Model.cpp --- a/data/model/Model.cpp Thu Apr 25 17:06:33 2019 +0100 +++ b/data/model/Model.cpp Wed May 01 11:45:28 2019 +0100 @@ -20,6 +20,8 @@ #include +//#define DEBUG_COMPLETION 1 + Model::~Model() { SVDEBUG << "Model::~Model(" << this << ")" << endl; @@ -163,15 +165,20 @@ int Model::getAlignmentCompletion() const { -// SVDEBUG << "Model::getAlignmentCompletion: m_alignment = " -// << m_alignment << endl; +#ifdef DEBUG_COMPLETION + SVCERR << "Model(" << this << ")::getAlignmentCompletion: m_alignment = " + << m_alignment << endl; +#endif if (!m_alignment) { if (m_sourceModel) return m_sourceModel->getAlignmentCompletion(); else return 100; } int completion = 0; (void)m_alignment->isReady(&completion); -// SVDEBUG << " -> " << completion << endl; +#ifdef DEBUG_COMPLETION + SVCERR << "Model(" << this << ")::getAlignmentCompletion: completion = " << completion + << endl; +#endif return completion; }