mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 17:40:23 +08:00
GraphViewer: Fixed scale of saved PNG/SVG
This commit is contained in:
@@ -594,6 +594,7 @@ bool DatabaseViewer::openDatabase(const QString & path)
|
||||
{
|
||||
pathDatabase_ = UDirectory::getDir(path.toStdString()).c_str();
|
||||
databaseFileName_ = UFile::getName(path.toStdString());
|
||||
ui_->graphViewer->setWorkingDirectory(pathDatabase_);
|
||||
|
||||
// look if there are saved parameters
|
||||
ParametersMap parameters = dbDriver_->getLastParameters();
|
||||
|
||||
@@ -39,6 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <QColorDialog>
|
||||
#include <QtSvg/QSvgGenerator>
|
||||
#include <QInputDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QDateTime>
|
||||
@@ -1391,7 +1392,7 @@ void GraphViewer::contextMenuEvent(QContextMenuEvent * event)
|
||||
|
||||
if(_gridCellSize)
|
||||
{
|
||||
_root->setScale(1.0f/_gridCellSize); // grid map precision (for 5cm grid cell, x20 to have 1pix/5cm)
|
||||
_root->setScale(1.0f/(_gridCellSize*100.0f)); // grid map precision (for 5cm grid cell, x20 to have 1pix/5cm)
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1409,7 +1410,16 @@ void GraphViewer::contextMenuEvent(QContextMenuEvent * event)
|
||||
QPainter painter(&image);
|
||||
|
||||
this->scene()->render(&painter);
|
||||
image.save(targetDir + name);
|
||||
if(!image.isNull())
|
||||
{
|
||||
image.save(targetDir + name);
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::warning(this,
|
||||
tr("Save PNG"),
|
||||
tr("Could not export in PNG (the scene may be too large %1x%2), try saving in SVG.").arg(sceneSize.width()).arg(sceneSize.height()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user