tools/drawMapTest/drawmapscene.h
changeset 14354 20178fa3a74a
parent 14353 5cc671f988e7
child 14355 bc29fc6df7a2
equal deleted inserted replaced
14353:5cc671f988e7 14354:20178fa3a74a
     1 #ifndef DRAWMAPSCENE_H
       
     2 #define DRAWMAPSCENE_H
       
     3 
       
     4 #include <QGraphicsScene>
       
     5 #include <QPainterPath>
       
     6 
       
     7 class QGraphicsPathItem;
       
     8 
       
     9 typedef QList<QList<QPoint> > Paths;
       
    10 
       
    11 class DrawMapScene : public QGraphicsScene
       
    12 {
       
    13 Q_OBJECT
       
    14 public:
       
    15     explicit DrawMapScene(QObject *parent = 0);
       
    16 
       
    17     QByteArray encode();
       
    18     void decode(QByteArray data);
       
    19 
       
    20 signals:
       
    21     void pathChanged();
       
    22 
       
    23 public slots:
       
    24     void undo();
       
    25     void simplifyLast();
       
    26 
       
    27 private:
       
    28     QPen m_pen;
       
    29     QBrush m_brush;
       
    30     QGraphicsPathItem  * m_currPath;
       
    31     Paths paths;
       
    32 
       
    33     virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * mouseEvent);
       
    34     virtual void mousePressEvent(QGraphicsSceneMouseEvent * mouseEvent);
       
    35     virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * mouseEvent);
       
    36 
       
    37     QPainterPath pointsToPath(const QList<QPoint> points);
       
    38 };
       
    39 
       
    40 #endif // DRAWMAPSCENE_H