mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 09:30:25 +08:00
Cleanup gui
Fixed crash when a new location (B merged with previous location A through rehearsal) and then loop on a location already merged with the location A (which is not anymore in WM) Updated rejected hypothesis tag git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@299 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
@@ -24,7 +24,9 @@
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtGui/QAction>
|
||||
#include "utilite/ULogger.h"
|
||||
#include "KeypointItem.h"
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
@@ -37,6 +39,15 @@ ImageView::ImageView(QWidget * parent) :
|
||||
this->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
|
||||
this->setScene(new QGraphicsScene(this));
|
||||
connect(this->scene(), SIGNAL(sceneRectChanged(const QRectF &)), this, SLOT(updateZoom()));
|
||||
|
||||
_menu = new QMenu(tr(""), this);
|
||||
_showImage = _menu->addAction(tr("Show image"));
|
||||
_showImage->setCheckable(true);
|
||||
_showImage->setChecked(true);
|
||||
_showFeatures = _menu->addAction(tr("Show features"));
|
||||
_showFeatures->setCheckable(true);
|
||||
_showFeatures->setChecked(true);
|
||||
_saveImage = _menu->addAction(tr("Save picture..."));
|
||||
}
|
||||
|
||||
ImageView::~ImageView() {
|
||||
@@ -49,12 +60,20 @@ void ImageView::resetZoom()
|
||||
this->setDragMode(QGraphicsView::NoDrag);
|
||||
}
|
||||
|
||||
bool ImageView::isImageShown()
|
||||
{
|
||||
return _showImage->isChecked();
|
||||
}
|
||||
|
||||
bool ImageView::isFeaturesShown()
|
||||
{
|
||||
return _showFeatures->isChecked();
|
||||
}
|
||||
|
||||
void ImageView::contextMenuEvent(QContextMenuEvent * e)
|
||||
{
|
||||
QMenu menu(tr(""), this);
|
||||
QAction * saveImage = menu.addAction(tr("Save picture..."));
|
||||
|
||||
if(menu.exec(e->globalPos()) == saveImage)
|
||||
QAction * action = _menu->exec(e->globalPos());
|
||||
if(action == _saveImage)
|
||||
{
|
||||
QString text;
|
||||
#ifdef QT_SVG_LIB
|
||||
@@ -71,6 +90,26 @@ void ImageView::contextMenuEvent(QContextMenuEvent * e)
|
||||
img.save(text);
|
||||
}
|
||||
}
|
||||
else if(action == _showFeatures || action == _showImage)
|
||||
{
|
||||
this->updateItemsShown();
|
||||
}
|
||||
}
|
||||
|
||||
void ImageView::updateItemsShown()
|
||||
{
|
||||
QList<QGraphicsItem*> items = this->scene()->items();
|
||||
for(int i=0; i<items.size(); ++i)
|
||||
{
|
||||
if(qgraphicsitem_cast<KeypointItem*>(items.at(i)))
|
||||
{
|
||||
items.at(i)->setVisible(_showFeatures->isChecked());
|
||||
}
|
||||
else if(qgraphicsitem_cast<QGraphicsPixmapItem*>(items.at(i)))
|
||||
{
|
||||
items.at(i)->setVisible(_showImage->isChecked());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ImageView::updateZoom()
|
||||
|
||||
Reference in New Issue
Block a user