mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-12 20:49:50 +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();
|
pathDatabase_ = UDirectory::getDir(path.toStdString()).c_str();
|
||||||
databaseFileName_ = UFile::getName(path.toStdString());
|
databaseFileName_ = UFile::getName(path.toStdString());
|
||||||
|
ui_->graphViewer->setWorkingDirectory(pathDatabase_);
|
||||||
|
|
||||||
// look if there are saved parameters
|
// look if there are saved parameters
|
||||||
ParametersMap parameters = dbDriver_->getLastParameters();
|
ParametersMap parameters = dbDriver_->getLastParameters();
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <QColorDialog>
|
#include <QColorDialog>
|
||||||
#include <QtSvg/QSvgGenerator>
|
#include <QtSvg/QSvgGenerator>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
#include <QtCore/QDateTime>
|
#include <QtCore/QDateTime>
|
||||||
@@ -1391,7 +1392,7 @@ void GraphViewer::contextMenuEvent(QContextMenuEvent * event)
|
|||||||
|
|
||||||
if(_gridCellSize)
|
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
|
else
|
||||||
{
|
{
|
||||||
@@ -1409,7 +1410,16 @@ void GraphViewer::contextMenuEvent(QContextMenuEvent * event)
|
|||||||
QPainter painter(&image);
|
QPainter painter(&image);
|
||||||
|
|
||||||
this->scene()->render(&painter);
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user