]> rtime.felk.cvut.cz Git - eurobot/public.git/commitdiff
robomon: Add ability to draw map rectangles smaller
authorMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 26 Apr 2010 08:47:00 +0000 (10:47 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 26 Apr 2010 08:47:00 +0000 (10:47 +0200)
This is not used now, but it can be easiliy activated by setting
MAP_RECT_SCALE to a value between 0 and 1.

src/robomon/PlaygroundScene.cpp

index eecfd84557ca97335d0ca01e740f30b4be7d1ad8..1b1e3bbe923f9d8ec3c312a51d4b9cc6ce880880 100644 (file)
@@ -245,13 +245,16 @@ void PlaygroundScene::showObstacle(int val)
 
 void PlaygroundScene::initMap()
 {
+#define MAP_RECT_SCALE 1.0
        this->map = new QGraphicsItemGroup();
        for(int i=0; i < MAP_WIDTH; i++) {
                for(int j=0; j<MAP_HEIGHT; j++) {
                        rects[i][j] = new QGraphicsRectItem(
-                                       QRectF(i*MAP_CELL_SIZE_MM, (MAP_HEIGHT-1-j)*MAP_CELL_SIZE_MM,
-                                              MAP_CELL_SIZE_MM,MAP_CELL_SIZE_MM));
-                       rects[i][j]->setPen(QPen());
+                               QRectF(i*MAP_CELL_SIZE_MM + MAP_CELL_SIZE_MM * (1 - MAP_RECT_SCALE)/2,
+                                      (MAP_HEIGHT-1-j)*MAP_CELL_SIZE_MM + MAP_CELL_SIZE_MM * (1 - MAP_RECT_SCALE)/2,
+                                      MAP_CELL_SIZE_MM * MAP_RECT_SCALE ,
+                                      MAP_CELL_SIZE_MM * MAP_RECT_SCALE));
+                       rects[i][j]->setPen(QPen(Qt::NoPen));
                        rects[i][j]->setBrush(QBrush(Qt::lightGray));
                        map->addToGroup(rects[i][j]);
                }