connect(showMap, SIGNAL(toggled( bool )), robomonAtlantis, SLOT(showMap(bool)));
connect(showTrails, SIGNAL(toggled( bool )), robomonAtlantis, SLOT(showTrails(bool)));
connect(resetTrails, SIGNAL(triggered()), robomonAtlantis, SLOT(resetTrails()));
+
+ connect(showRobotRef, SIGNAL(toggled(bool)), robomonAtlantis->robotRefPos, SLOT(mySetVisible(bool)));
+ connect(showRobotEst, SIGNAL(toggled(bool)), robomonAtlantis->robotEstPosBest, SLOT(mySetVisible(bool)));
+ connect(showRobotEstOdo, SIGNAL(toggled(bool)), robomonAtlantis->robotEstPosOdo, SLOT(mySetVisible(bool)));
+ connect(showRobotEstIndepOdo, SIGNAL(toggled(bool)), robomonAtlantis->robotEstPosIndepOdo, SLOT(mySetVisible(bool)));
+
+ showRobotRef->setChecked(true);
+ showRobotEst->setChecked(true);
+ showRobotEstOdo->setChecked(false);
+ showRobotEstIndepOdo->setChecked(false);
}
void MainWindow::about()
showTrails->setCheckable(true);
showMap = new QAction("Show &map", this);
showMap->setCheckable(true);
- resetTrails = new QAction("&Reset trails", this);
+ resetTrails = new QAction("Re&set trails", this);
+
+ showRobotRef = new QAction("&Reference position", this);
+ showRobotRef->setCheckable(true);
+ showRobotEst = new QAction("&Best available estimated position", this);
+ showRobotEst->setCheckable(true);
+ showRobotEstOdo = new QAction("&Motor odometry", this);
+ showRobotEstOdo->setCheckable(true);
+ showRobotEstIndepOdo = new QAction("&Independent odometry", this);
+ showRobotEstIndepOdo->setCheckable(true);
}
void MainWindow::createMenus()
m->addAction(showMap);
m->addAction(showTrails);
m->addAction(resetTrails);
+ QMenu *robot = m->addMenu(tr("&Robot"));
+
+ robot->addAction(showRobotRef);
+ robot->addAction(showRobotEst);
+ robot->addAction(showRobotEstOdo);
+ robot->addAction(showRobotEstIndepOdo);
toolsMenu = menuBar()->addMenu(tr("&Tools"));
toolsMenu->addAction(robomonTuningAct);
void RobomonAtlantis::showTrails(bool show)
{
- trailRefPos->setVisible(show);
- trailEstPosBest->setVisible(show);
-// trailPosIndepOdo->setVisible(show);
-// trailOdoPos->setVisible(show);
+ trailRefPos->setVisible(show && robotRefPos->isVisible());
+ trailEstPosBest->setVisible(show && robotEstPosBest->isVisible());
+ trailPosIndepOdo->setVisible(show && robotEstPosIndepOdo->isVisible());
+ trailOdoPos->setVisible(show && robotEstPosOdo->isVisible());
}
#include <QGraphicsLineItem>
#include <QPainter>
-class Robot : public QGraphicsItem
+class Robot : public QGraphicsObject
{
+ Q_OBJECT
public:
Robot(const QString &aText, const QPen &pen = QPen(), const QBrush &brush = QBrush());
~Robot();
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void moveRobot(double x, double y, double angle);
+public slots:
+ void mySetVisible(bool show);
private:
QString text;
QPen pen;