From e3b3a08f5f795d21a8ec60fa3b70b87c10b3a16d Mon Sep 17 00:00:00 2001 From: matlabbe Date: Sat, 28 Jan 2017 15:49:29 -0500 Subject: [PATCH] DbViewer: fixed features not added in right image when adding loop closure --- guilib/src/DatabaseViewer.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/guilib/src/DatabaseViewer.cpp b/guilib/src/DatabaseViewer.cpp index 1cd343aa..e6515d03 100644 --- a/guilib/src/DatabaseViewer.cpp +++ b/guilib/src/DatabaseViewer.cpp @@ -4250,6 +4250,7 @@ void DatabaseViewer::addConstraint() bool DatabaseViewer::addConstraint(int from, int to, bool silent, bool updateGraph) { + bool switchedIds = false; if(from == to) { UWARN("Cannot add link to same node"); @@ -4257,6 +4258,7 @@ bool DatabaseViewer::addConstraint(int from, int to, bool silent, bool updateGra } else if(from < to) { + switchedIds = true; int tmp = from; from = to; to = tmp; @@ -4293,8 +4295,16 @@ bool DatabaseViewer::addConstraint(int from, int to, bool silent, bool updateGra if(!silent) { - ui_->graphicsView_A->setFeatures(fromS.getWords(), dataFrom.depthRaw()); - ui_->graphicsView_B->setFeatures(toS.getWords(), dataTo.depthRaw()); + if(switchedIds) + { + ui_->graphicsView_A->setFeatures(toS.getWords(), dataTo.depthRaw()); + ui_->graphicsView_B->setFeatures(fromS.getWords(), dataFrom.depthRaw()); + } + else + { + ui_->graphicsView_A->setFeatures(fromS.getWords(), dataFrom.depthRaw()); + ui_->graphicsView_B->setFeatures(toS.getWords(), dataTo.depthRaw()); + } updateWordsMatching(); }