Mercurial > hg > svcore
changeset 1696:187c76c40c6f single-point
Ensure a self-alignment is always reported as complete, since there is nothing to calculate
author | Chris Cannam |
---|---|
date | Wed, 01 May 2019 11:45:28 +0100 |
parents | cd6be949a16a |
children | c077a97d055f |
files | data/model/AlignmentModel.cpp data/model/Model.cpp |
diffstat | 2 files changed, 20 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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; }
--- 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 <iostream> +//#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; }