-
Notifications
You must be signed in to change notification settings - Fork 9
/
renderarea.h
45 lines (41 loc) · 1.25 KB
/
renderarea.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef RENDERAREA_H
#define RENDERAREA_H
#include <QWidget>
#include "pose.h"
#include "beliefstate.h"
#include <QMutex>
#include <QPainterPath>
class RenderArea : public QWidget
{
Q_OBJECT
Pose pose; // pose of the robot to be drawn
public:
explicit RenderArea(QWidget *parent = 0);
void changePose(Pose p) {pose = p; update();}
Pose getStartPose();
Pose getEndPose();
void setStartPose(Pose p);
void setEndPose(Pose p);
void setTrajectory(QPainterPath p);
void toggleTrajectory(bool x) { drawTraj = x; this->update();}
protected:
void paintEvent(QPaintEvent *);
void drawField(QPainter &painter);
void drawBot(QPainter &painter);
void drawPose(QPainter &painter, int index); //index is 0 or 1, for start or end pose respectively.
void drawTrajectory(QPainter &painter);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *);
void mouseMoveEvent(QMouseEvent *event);
bool scribbling;
int x[2], y[2]; //
double theta[2]; // All in QWidget coordinate system. Needs to be converted to our coordinates.
int idx;
QPainterPath traj;
bool drawTraj;
signals:
void painting();
public slots:
void drawPoint(QPointF pt);
};
#endif // RENDERAREA_H