]> rtime.felk.cvut.cz Git - eurobot/public.git/commitdiff
robomon: Allow shape-detect to be switched on/off from menu
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 18 Jan 2011 12:24:08 +0000 (13:24 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 18 Jan 2011 12:24:08 +0000 (13:24 +0100)
src/robomon/RobomonAtlantis.cpp
src/robomon/hokuyoscan.cpp
src/robomon/hokuyoscan.h

index 246dbaefdf849811bfc657c5f26c73a735ce6759..06849fcab4334fa87a44758068cc7ad181654869 100644 (file)
@@ -1008,10 +1008,5 @@ void RobomonAtlantis::showTrails(bool show)
 
 void RobomonAtlantis::showShapeDetect(bool show)
 {
-       if (show)
-       {
-
-       } else {
-
-       }
+    hokuyoScan->showShapeDetect = show;
 }
index 26194b2e3fd157f059db2bc858ff4dbb8015b106..6ecb529134a471a2374469444b537b00745bc9fd 100644 (file)
@@ -5,7 +5,7 @@
 #include <robodim.h>
 #include <iostream>
 
-HokuyoScan::HokuyoScan() : QGraphicsItem()
+HokuyoScan::HokuyoScan() : QGraphicsItem(), showShapeDetect(false)
 {
     memset(&data, 0, sizeof(data));
 }
@@ -22,7 +22,7 @@ QRectF HokuyoScan::boundingRect() const
     return QRectF(tl, br);
 }
 
-void HokuyoScan::drawShapeDetect(QPainter * painter)
+void HokuyoScan::paintShapeDetect(QPainter * painter)
 {
        Shape_detect sd;
 
@@ -80,7 +80,8 @@ void HokuyoScan::paint(QPainter * painter, const QStyleOptionGraphicsItem * opti
     }
     painter->drawPolygon(points, point_num);
 
-    drawShapeDetect(painter);
+    if (showShapeDetect)
+       paintShapeDetect(painter);
 
 }
 
index 372e0fc5ea48baaf4051db3efa9d12cdd6c0a41c..f0be8c4a1657064d8f420133ae66cf06ef5e2823 100644 (file)
@@ -13,6 +13,7 @@ class HokuyoScan : public QGraphicsItem
 {
     float x, y, phi;
 public:
+    bool showShapeDetect;
     struct hokuyo_scan_type data;
     HokuyoScan();
     QRectF boundingRect() const;
@@ -20,7 +21,7 @@ public:
     void setPosition(double x, double y, double phi);
     void newScan(struct hokuyo_scan_type *scan);
 
-       void drawShapeDetect(QPainter * painter);
+    void paintShapeDetect(QPainter * painter);
 
     ~HokuyoScan();
 };