]> rtime.felk.cvut.cz Git - eurobot/public.git/blobdiff - src/robomon/RobomonAtlantis.cpp
robomon controls map and trail visibility from the new View menu
[eurobot/public.git] / src / robomon / RobomonAtlantis.cpp
index 4d631829e571dcc7d6cfcb8b0563c0369ca585d7..08d2a2b12847aaa5468562f206b6dd61b19d8736 100644 (file)
@@ -177,11 +177,6 @@ void RobomonAtlantis::createMiscGroupBox()
        miscGroupBox->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
        QGridLayout *layout = new QGridLayout();
 
-       showMapPushButton = new QCheckBox(tr("Show &map"));
-       showMapPushButton->setShortcut(tr("m"));
-       
-       layout->addWidget(showMapPushButton, 0, 0);
-       
        obstacleSimulationCheckBox = new QCheckBox(tr("&Obstacle simulation"));
        obstacleSimulationCheckBox->setShortcut(tr("o"));
        layout->addWidget(obstacleSimulationCheckBox);
@@ -436,6 +431,8 @@ void RobomonAtlantis::createRobots()
        playgroundScene->addItem(robotEstPosUzv);
        playgroundScene->addItem(robotEstPosOdo);
        
+       showTrails(false);
+       
        playgroundScene->addItem(trailRefPos);
        playgroundScene->addItem(trailUzvPos);
        playgroundScene->addItem(trailOdoPos);
@@ -467,10 +464,6 @@ void RobomonAtlantis::createActions()
                connect(doCheckBox[0], SIGNAL(stateChanged(int)), 
                                        this, SLOT(setDO(int)));
 
-       /* path planning map */
-       connect(showMapPushButton, SIGNAL(clicked()),
-                       this, SLOT(showMap()));
-       
        connect(startPlug, SIGNAL(stateChanged(int)), this, SLOT(sendStart(int)));
        connect(puckInside, SIGNAL(stateChanged(int)), this, SLOT(sendPuckInside(int)));
        
@@ -595,32 +588,22 @@ void RobomonAtlantis::setChelae(int value)
        act_chelae(leftChela, rightChela);
 }
 
-void RobomonAtlantis::showMap()
+void RobomonAtlantis::showMap(bool show)
 {
        openSharedMemory();
 
        if (sharedMemoryOpened == false)
                return;
-
-       mapTimer = new QTimer(this);
-       connect(mapTimer, SIGNAL(timeout()), this, SLOT(paintMap()));
-       mapTimer->start(200);
-
-       disconnect(showMapPushButton, SIGNAL(clicked()), this, SLOT(showMap()));
-       connect(showMapPushButton, SIGNAL(clicked()),
-                               this, SLOT(showPlayground()));
-       playgroundScene->showMap(true);
-}
-
-void RobomonAtlantis::showPlayground()
-{
-       mapTimer->stop();
-       disconnect(mapTimer, SIGNAL(timeout()), this, SLOT(paintMap()));
-
-       disconnect(showMapPushButton, SIGNAL(clicked()),
-                               this, SLOT(showPlayground()));
-       connect(showMapPushButton, SIGNAL(clicked()), this, SLOT(showMap()));
-       playgroundScene->showMap(false);
+       
+       if (show) {
+               mapTimer = new QTimer(this);
+               connect(mapTimer, SIGNAL(timeout()), this, SLOT(paintMap()));
+               mapTimer->start(200);
+       } else {
+               mapTimer->stop();
+               disconnect(mapTimer, SIGNAL(timeout()), this, SLOT(paintMap()));
+       }
+       playgroundScene->showMap(show);
 }
 
 void RobomonAtlantis::paintMap()
@@ -1163,3 +1146,17 @@ void RobomonAtlantis::sendPuckInside(int value)
        ORTEPublicationSend(orte.publication_puck_inside);
 
 }
+
+void RobomonAtlantis::resetTrails()
+{
+       trailRefPos->reset();
+       trailUzvPos->reset();
+       trailOdoPos->reset();
+}
+
+void RobomonAtlantis::showTrails(bool show)
+{
+       trailRefPos->setVisible(show);
+       trailUzvPos->setVisible(show);
+       trailOdoPos->setVisible(show);
+}