Skip to content

Commit

Permalink
DbViewer tool: added database's parameter overriding from arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
matlabbe committed Mar 29, 2024
1 parent 0ba79be commit 3b73590
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion guilib/include/rtabmap/gui/DatabaseViewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class RTABMAP_GUI_EXPORT DatabaseViewer : public QMainWindow
public:
DatabaseViewer(const QString & ini = QString(), QWidget * parent = 0);
virtual ~DatabaseViewer();
bool openDatabase(const QString & path);
bool openDatabase(const QString & path, const ParametersMap & overridenParameters = ParametersMap());
bool isSavedMaximized() const {return savedMaximized_;}
void showCloseButton(bool visible = true);

Expand Down
5 changes: 4 additions & 1 deletion guilib/src/DatabaseViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ void DatabaseViewer::openDatabase()
}
}

bool DatabaseViewer::openDatabase(const QString & path)
bool DatabaseViewer::openDatabase(const QString & path, const ParametersMap & overriddenParameters)
{
UDEBUG("Open database \"%s\"", path.toStdString().c_str());
if(QFile::exists(path))
Expand Down Expand Up @@ -844,6 +844,9 @@ bool DatabaseViewer::openDatabase(const QString & path)
// look if there are saved parameters
ParametersMap parameters = dbDriver_->getLastParameters();

// add overridden parameters
uInsert(parameters, overriddenParameters);

if(parameters.size())
{
const ParametersMap & currentParameters = ui_->parameters_toolbox->getParameters();
Expand Down
4 changes: 2 additions & 2 deletions tools/DatabaseViewer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ int main(int argc, char * argv[])

mainWindow->showNormal();

if(argc == 2)
if(argc >= 2)
{
mainWindow->openDatabase(argv[1]);
mainWindow->openDatabase(argv[argc-1], rtabmap::Parameters::parseArguments(argc, argv, true));
}

// Now wait for application to finish
Expand Down

0 comments on commit 3b73590

Please sign in to comment.