tools/drawMapTest/drawmapscene.h
author unc0rr
Mon, 29 Nov 2010 22:23:56 +0300
changeset 4434 34c305fbc63c
parent 4427 c5193713055f
child 4439 27a896207aae
permissions -rw-r--r--
Simple simplify() function
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();
4434
34c305fbc63c Simple simplify() function
unc0rr
parents: 4427
diff changeset
    23
    void simplify();
4423
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    24
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    25
private:
4424
3225ea34e415 Some basic functionality
unc0rr
parents: 4423
diff changeset
    26
    QPen m_pen;
3225ea34e415 Some basic functionality
unc0rr
parents: 4423
diff changeset
    27
    QBrush m_brush;
4426
969e411c72aa Improve map editor a bit
unc0rr
parents: 4424
diff changeset
    28
    QGraphicsPathItem  * m_currPath;
4427
c5193713055f Basic encoding of drawn map
unc0rr
parents: 4426
diff changeset
    29
    Paths paths;
4424
3225ea34e415 Some basic functionality
unc0rr
parents: 4423
diff changeset
    30
4423
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    31
    virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * mouseEvent);
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    32
    virtual void mousePressEvent(QGraphicsSceneMouseEvent * mouseEvent);
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    33
    virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * mouseEvent);
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
4391526e436e Initial commit of the Draw Map Scene
unc0rr
parents:
diff changeset
    36
#endif // DRAWMAPSCENE_H