00001 #include <qcanvas.h>
00002 #include <qmessagebox.h>
00003 #include <qpoint.h>
00004 #include "gui_debug.h"
00005 #include <iostream>
00006
00007
00008
00009 #define FRAMEPIX "pix/simu_rahmen.gif"
00010 #define BASEPIX "pix/simu_sockel.gif"
00011 #define HOLDERPIX "pix/simu_halter.gif"
00012
00013 using namespace std;
00014
00018 class MyCanvasView : public QCanvasView
00019 {
00020
00021 public:
00022 MyCanvasView( QCanvas *c, QWidget *parent=0, const char *name=0, WFlags f=0 ) : QCanvasView( c, parent, name, f ) {
00023 canvas = c;
00024 initCanvas();
00025 }
00026
00027 MyCanvasView( QWidget *parent=0, const char *name=0) : QCanvasView( parent, name, 0 ) {
00028 canvas = new QCanvas(canvas_width, canvas_height);
00029 initCanvas();
00030 }
00031
00032 void moveRobot(int _row, int _col);
00033 void setDimension (int _rows, int _cols, int _initRow, int _initCol);
00034
00035 private:
00036
00037 QCanvas *canvas;
00038 QCanvasSprite *frame, *base, *holder;
00039 QCanvasPixmapArray *frame_pix, *base_pix, *holder_pix;
00040 QCanvasRectangle *bottom;
00041 QCanvasText *distanceText, *posText;
00042 QPoint oldPos;
00043
00044 static const int canvas_width = 460;
00045 static const int canvas_height = 400;
00046
00047 static const int stand_total_width = 330;
00048 static const int stand_total_height = 118;
00049 static const int stand_beam_width = 15;
00050 static const int stand_beam_height = 15;
00051
00052 static const int base_total_width = 170;
00053 static const int base_total_height = 200;
00054 static const int base_beam_width = 36;
00055 static const int base_beam_height = 20;
00056
00057 static const int holder_total_width = 46;
00058 static const int holder_total_height = 29;
00059
00060 static const int base_inner_height = base_total_height - base_beam_height - stand_beam_height;
00061 static const int stand_inner_height = stand_total_height - (2*stand_beam_height);
00062 static const int stand_inner_width = stand_total_width - (2*stand_beam_width) - base_total_width;
00063
00064 static const int bottom_start_y = stand_total_height +
00065 (base_total_height - stand_beam_height - base_beam_height) +1;
00066
00067 static const int bottom_width = stand_total_width + (stand_inner_width - base_total_width);
00068
00069 int iRows, iCols;
00070 int distance;
00071
00072
00073 void initCanvas();
00074 void paintBottom();
00075 };
00076
00077