tools/drawMapTest/drawmapscene.h
author unc0rr
Sun, 28 Nov 2010 19:03:28 +0300
changeset 4427 c5193713055f
parent 4426 969e411c72aa
child 4434 34c305fbc63c
permissions -rw-r--r--
Basic encoding of drawn map
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4423
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
     1
#ifndef DRAWMAPSCENE_H
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
     2
#define DRAWMAPSCENE_H
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
     3
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
     4
#include <QGraphicsScene>
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
     5
4426
969e411c72aa Improve map editor a bit
unc0rr
parents: 4424
diff changeset
     6
class QGraphicsPathItem;
969e411c72aa Improve map editor a bit
unc0rr
parents: 4424
diff changeset
     7
4427
c5193713055f Basic encoding of drawn map
unc0rr
parents: 4426
diff changeset
     8
typedef QList<QList<QPoint> > Paths;
c5193713055f Basic encoding of drawn map
unc0rr
parents: 4426
diff changeset
     9
4423
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    10
class DrawMapScene : public QGraphicsScene
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    11
{
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    12
Q_OBJECT
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    13
public:
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    14
    explicit DrawMapScene(QObject *parent = 0);
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    15
4427
c5193713055f Basic encoding of drawn map
unc0rr
parents: 4426
diff changeset
    16
    QByteArray encode();
c5193713055f Basic encoding of drawn map
unc0rr
parents: 4426
diff changeset
    17
4423
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    18
signals:
4427
c5193713055f Basic encoding of drawn map
unc0rr
parents: 4426
diff changeset
    19
    void pathChanged();
4423
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    20
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    21
public slots:
4426
969e411c72aa Improve map editor a bit
unc0rr
parents: 4424
diff changeset
    22
    void undo();
4423
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    23
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    24
private:
4424
3225ea34e415 Some basic functionality
unc0rr
parents: 4423
diff changeset
    25
    QPen m_pen;
3225ea34e415 Some basic functionality
unc0rr
parents: 4423
diff changeset
    26
    QBrush m_brush;
4426
969e411c72aa Improve map editor a bit
unc0rr
parents: 4424
diff changeset
    27
    QGraphicsPathItem  * m_currPath;
4427
c5193713055f Basic encoding of drawn map
unc0rr
parents: 4426
diff changeset
    28
    Paths paths;
4424
3225ea34e415 Some basic functionality
unc0rr
parents: 4423
diff changeset
    29
4423
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    30
    virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * mouseEvent);
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    31
    virtual void mousePressEvent(QGraphicsSceneMouseEvent * mouseEvent);
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    32
    virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * mouseEvent);
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    33
};
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    34
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    35
#endif // DRAWMAPSCENE_H