robot.h

00001 
00002 #ifndef ROBOT_H
00003 #define ROBOT_H
00004 
00005 #include <QGraphicsItem>
00006 #include <QGraphicsLineItem>
00007 #include <QPainter>
00008 
00009 #define ROBOT_SIZE_X 30 * 2
00010 #define ROBOT_SIZE_Y 30 * 2
00011 #define OFFSET_X 10
00012 #define OFFSET_Y 0
00013 #define SENSOR_SHORT_COUNT 6
00014 #define SENSOR_LONG_COUNT 10
00015 
00016 #define BEACON1_X 600 + OFFSET_X
00017 #define BEACON1_Y 210 + OFFSET_Y
00018 #define BEACON2_X 0 + OFFSET_X
00019 #define BEACON2_Y 420 + OFFSET_Y
00020 #define BEACON3_X 0 + OFFSET_X
00021 #define BEACON3_Y 0 + OFFSET_Y
00022 
00027 /*struct position {
00028         qreal x;
00029         qreal y;
00030         qreal angle;
00031 };*/
00032 
00033 class robot : public QGraphicsItem
00034 {
00035 
00036 //Q_OBJECT
00037 public:
00038         QGraphicsScene *scene;
00039         robot(QGraphicsItem *parent = 0, QGraphicsScene *scene = 0);
00040         
00041         ~robot();
00042         //robotSensor *sens;
00043         QGraphicsLineItem *sensShort[SENSOR_SHORT_COUNT];
00044         QGraphicsLineItem *sensLong[SENSOR_LONG_COUNT];
00045         QGraphicsRectItem *robotBody;
00046         QGraphicsLineItem *beacons[3];
00047         QPoint *pCenter;
00048         QRectF boundingRect() const;
00049         void initBeacons();
00050         void setBeaconAngle(int,double);
00051         void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
00052         void rotateRobot (qreal angle);
00053         void sensorRange(qreal size, int sens_id);
00054         void moveRobot(double,double,double);
00055         char id;
00056         qreal actPhi;
00057 };
00058 
00059 #endif

Generated on Thu Sep 13 11:28:28 2007 for DCE-Eurobot by  doxygen 1.5.3