DBViewer: fixing previous commit for very large databases (where we don't want to regenerate map if we don't show it)

This commit is contained in:
matlabbe
2017-07-12 21:39:51 -04:00
parent c833af1ae6
commit 19abbe0dbd
3 changed files with 9 additions and 4 deletions

View File

@@ -135,6 +135,7 @@ public:
signals: signals:
void configChanged(); void configChanged();
void mapShownRequested();
public slots: public slots:
void restoreDefaults(); void restoreDefaults();

View File

@@ -296,6 +296,7 @@ DatabaseViewer::DatabaseViewer(const QString & ini, QWidget * parent) :
connect(ui_->horizontalSlider_iterations, SIGNAL(sliderMoved(int)), this, SLOT(sliderIterationsValueChanged(int))); connect(ui_->horizontalSlider_iterations, SIGNAL(sliderMoved(int)), this, SLOT(sliderIterationsValueChanged(int)));
connect(ui_->spinBox_optimizationsFrom, SIGNAL(editingFinished()), this, SLOT(updateGraphView())); connect(ui_->spinBox_optimizationsFrom, SIGNAL(editingFinished()), this, SLOT(updateGraphView()));
connect(ui_->checkBox_spanAllMaps, SIGNAL(stateChanged(int)), this, SLOT(updateGraphView())); connect(ui_->checkBox_spanAllMaps, SIGNAL(stateChanged(int)), this, SLOT(updateGraphView()));
connect(ui_->graphViewer, SIGNAL(mapShownRequested()), this, SLOT(updateGraphView()));
connect(ui_->checkBox_ignorePoseCorrection, SIGNAL(stateChanged(int)), this, SLOT(updateGraphView())); connect(ui_->checkBox_ignorePoseCorrection, SIGNAL(stateChanged(int)), this, SLOT(updateGraphView()));
connect(ui_->checkBox_ignorePoseCorrection, SIGNAL(stateChanged(int)), this, SLOT(updateConstraintView())); connect(ui_->checkBox_ignorePoseCorrection, SIGNAL(stateChanged(int)), this, SLOT(updateConstraintView()));
connect(ui_->checkBox_ignoreGlobalLoop, SIGNAL(stateChanged(int)), this, SLOT(updateGraphView())); connect(ui_->checkBox_ignoreGlobalLoop, SIGNAL(stateChanged(int)), this, SLOT(updateGraphView()));
@@ -4098,7 +4099,7 @@ void DatabaseViewer::sliderIterationsValueChanged(int value)
ui_->graphViewer->clearMap(); ui_->graphViewer->clearMap();
occupancyGridViewer_->clear(); occupancyGridViewer_->clear();
if(graph.size() && localMaps.size() && if(graph.size() && localMaps.size() &&
(ui_->dockWidget_graphView->isVisible() || ui_->dockWidget_occupancyGridView->isVisible())) (ui_->graphViewer->isGridMapVisible() || ui_->dockWidget_occupancyGridView->isVisible()))
{ {
QTime time; QTime time;
time.start(); time.start();
@@ -4129,7 +4130,7 @@ void DatabaseViewer::sliderIterationsValueChanged(int value)
#endif #endif
// Generate 2d grid map? // Generate 2d grid map?
if(ui_->dockWidget_graphView->isVisible() || if((ui_->dockWidget_graphView->isVisible() && ui_->graphViewer->isGridMapVisible()) ||
(ui_->dockWidget_occupancyGridView->isVisible() && ui_->checkBox_grid_2d->isChecked())) (ui_->dockWidget_occupancyGridView->isVisible() && ui_->checkBox_grid_2d->isChecked()))
{ {
float xMin, yMin; float xMin, yMin;
@@ -4152,7 +4153,7 @@ void DatabaseViewer::sliderIterationsValueChanged(int value)
if(!map.empty()) if(!map.empty())
{ {
cv::Mat map8U = rtabmap::util3d::convertMap2Image8U(map); cv::Mat map8U = rtabmap::util3d::convertMap2Image8U(map);
if(ui_->dockWidget_graphView->isVisible()) if(ui_->dockWidget_graphView->isVisible() && ui_->graphViewer->isGridMapVisible())
{ {
ui_->graphViewer->updateMap(map8U, cell, xMin, yMin); ui_->graphViewer->updateMap(map8U, cell, xMin, yMin);
} }

View File

@@ -1361,7 +1361,6 @@ void GraphViewer::contextMenuEvent(QContextMenuEvent * event)
{ {
aShowHideGtGraph = menu.addAction(tr("Show ground truth graph")); aShowHideGtGraph = menu.addAction(tr("Show ground truth graph"));
} }
aShowHideGridMap->setEnabled(!_gridMap->pixmap().isNull());
aShowHideGraph->setEnabled(_nodeItems.size()); aShowHideGraph->setEnabled(_nodeItems.size());
aShowHideGlobalPath->setEnabled(_globalPathLinkItems.size()); aShowHideGlobalPath->setEnabled(_globalPathLinkItems.size());
aShowHideLocalPath->setEnabled(_localPathLinkItems.size()); aShowHideLocalPath->setEnabled(_localPathLinkItems.size());
@@ -1626,6 +1625,10 @@ void GraphViewer::contextMenuEvent(QContextMenuEvent * event)
else if(r == aShowHideGridMap) else if(r == aShowHideGridMap)
{ {
this->setGridMapVisible(!this->isGridMapVisible()); this->setGridMapVisible(!this->isGridMapVisible());
if(_gridMap->isVisible())
{
emit mapShownRequested();
}
} }
else if(r == aShowHideOrigin) else if(r == aShowHideOrigin)
{ {