4423
|
1 |
#ifndef DRAWMAPSCENE_H
|
|
2 |
#define DRAWMAPSCENE_H
|
|
3 |
|
|
4 |
#include <QGraphicsScene>
|
4442
|
5 |
#include <QPainterPath>
|
4423
|
6 |
|
4426
|
7 |
class QGraphicsPathItem;
|
|
8 |
|
4427
|
9 |
typedef QList<QList<QPoint> > Paths;
|
|
10 |
|
4423
|
11 |
class DrawMapScene : public QGraphicsScene
|
|
12 |
{
|
|
13 |
Q_OBJECT
|
|
14 |
public:
|
|
15 |
explicit DrawMapScene(QObject *parent = 0);
|
|
16 |
|
4427
|
17 |
QByteArray encode();
|
4442
|
18 |
void decode(QByteArray data);
|
4427
|
19 |
|
4423
|
20 |
signals:
|
4427
|
21 |
void pathChanged();
|
4423
|
22 |
|
|
23 |
public slots:
|
4426
|
24 |
void undo();
|
4439
|
25 |
void simplifyLast();
|
4423
|
26 |
|
|
27 |
private:
|
4424
|
28 |
QPen m_pen;
|
|
29 |
QBrush m_brush;
|
4426
|
30 |
QGraphicsPathItem * m_currPath;
|
4427
|
31 |
Paths paths;
|
4424
|
32 |
|
4423
|
33 |
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * mouseEvent);
|
|
34 |
virtual void mousePressEvent(QGraphicsSceneMouseEvent * mouseEvent);
|
|
35 |
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * mouseEvent);
|
4442
|
36 |
|
|
37 |
QPainterPath pointsToPath(const QList<QPoint> points);
|
4423
|
38 |
};
|
|
39 |
|
|
40 |
#endif // DRAWMAPSCENE_H
|