mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
DatabaseViewer: fixed "Graph not created" error when clicking on export map/graph actions
This commit is contained in:
@@ -1262,7 +1262,10 @@ void DatabaseViewer::updateIds()
|
|||||||
if(ids_.size())
|
if(ids_.size())
|
||||||
{
|
{
|
||||||
updateLoopClosuresSlider();
|
updateLoopClosuresSlider();
|
||||||
updateGraphView();
|
if(ui_->graphViewer->isVisible())
|
||||||
|
{
|
||||||
|
updateGraphView();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1369,6 +1372,16 @@ void DatabaseViewer::generateLocalGraph()
|
|||||||
|
|
||||||
void DatabaseViewer::generateTOROGraph()
|
void DatabaseViewer::generateTOROGraph()
|
||||||
{
|
{
|
||||||
|
if(graphes_.empty())
|
||||||
|
{
|
||||||
|
this->updateGraphView();
|
||||||
|
if(graphes_.empty() || ui_->horizontalSlider_iterations->maximum() != (int)graphes_.size()-1)
|
||||||
|
{
|
||||||
|
QMessageBox::warning(this, tr("Cannot generate a graph"), tr("No graph in database?!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!graphes_.size() || !graphLinks_.size())
|
if(!graphes_.size() || !graphLinks_.size())
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Cannot generate a TORO graph"), tr("No poses or no links..."));
|
QMessageBox::warning(this, tr("Cannot generate a TORO graph"), tr("No poses or no links..."));
|
||||||
@@ -1401,6 +1414,16 @@ void DatabaseViewer::generateTOROGraph()
|
|||||||
|
|
||||||
void DatabaseViewer::generateG2OGraph()
|
void DatabaseViewer::generateG2OGraph()
|
||||||
{
|
{
|
||||||
|
if(graphes_.empty())
|
||||||
|
{
|
||||||
|
this->updateGraphView();
|
||||||
|
if(graphes_.empty() || ui_->horizontalSlider_iterations->maximum() != (int)graphes_.size()-1)
|
||||||
|
{
|
||||||
|
QMessageBox::warning(this, tr("Cannot generate a graph"), tr("No graph in database?!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!graphes_.size() || !graphLinks_.size())
|
if(!graphes_.size() || !graphLinks_.size())
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Cannot generate a g2o graph"), tr("No poses or no links..."));
|
QMessageBox::warning(this, tr("Cannot generate a g2o graph"), tr("No poses or no links..."));
|
||||||
@@ -1548,6 +1571,17 @@ void DatabaseViewer::generate3DMap()
|
|||||||
QMessageBox::warning(this, tr("Cannot generate a graph"), tr("The database is empty..."));
|
QMessageBox::warning(this, tr("Cannot generate a graph"), tr("The database is empty..."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(graphes_.empty())
|
||||||
|
{
|
||||||
|
this->updateGraphView();
|
||||||
|
if(graphes_.empty() || ui_->horizontalSlider_iterations->maximum() != (int)graphes_.size()-1)
|
||||||
|
{
|
||||||
|
QMessageBox::warning(this, tr("Cannot generate a graph"), tr("No graph in database?!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QStringList items;
|
QStringList items;
|
||||||
items.append("1");
|
items.append("1");
|
||||||
@@ -1622,6 +1656,16 @@ void DatabaseViewer::generate3DMap()
|
|||||||
|
|
||||||
void DatabaseViewer::detectMoreLoopClosures()
|
void DatabaseViewer::detectMoreLoopClosures()
|
||||||
{
|
{
|
||||||
|
if(graphes_.empty())
|
||||||
|
{
|
||||||
|
this->updateGraphView();
|
||||||
|
if(graphes_.empty() || ui_->horizontalSlider_iterations->maximum() != (int)graphes_.size()-1)
|
||||||
|
{
|
||||||
|
QMessageBox::warning(this, tr("Cannot generate a graph"), tr("No graph in database?!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const std::map<int, Transform> & optimizedPoses = graphes_.back();
|
const std::map<int, Transform> & optimizedPoses = graphes_.back();
|
||||||
|
|
||||||
int iterations = ui_->spinBox_detectMore_iterations->value();
|
int iterations = ui_->spinBox_detectMore_iterations->value();
|
||||||
@@ -3039,11 +3083,6 @@ void DatabaseViewer::sliderIterationsValueChanged(int value)
|
|||||||
}
|
}
|
||||||
void DatabaseViewer::updateGraphView()
|
void DatabaseViewer::updateGraphView()
|
||||||
{
|
{
|
||||||
if(!ui_->graphViewer->isVisible())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ui_->label_loopClosures->clear();
|
ui_->label_loopClosures->clear();
|
||||||
ui_->label_poses->clear();
|
ui_->label_poses->clear();
|
||||||
if(poses_.size())
|
if(poses_.size())
|
||||||
|
|||||||
Reference in New Issue
Block a user