QTfrontend/drawmapscene.h
changeset 4520 e7882bd1a894
parent 4442 f8424e1bc936
child 4560 5d6c7f88db73
equal deleted inserted replaced
4519:aee36896d46b 4520:e7882bd1a894
       
     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