-
Notifications
You must be signed in to change notification settings - Fork 0
/
Patch.h
51 lines (41 loc) · 1.07 KB
/
Patch.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* Patch.h
*
* Created on: Jun 9, 2010
* Author: Vincent
*/
#ifndef PATCH_H_
#define PATCH_H_
#include <QRect>
#include <QPolygon>
#include <QDataStream>
#include <QList>
class Patch;
typedef QList<Patch> PatchList;
// Methods to save Patches
QDataStream & operator<<(QDataStream & stream, const Patch & patch);
QDataStream & operator>>(QDataStream & stream, Patch & patch);
QDataStream & operator<<(QDataStream & stream, const PatchList & patchList);
QDataStream & operator>>(QDataStream & stream, PatchList & patchList);
class Patch {
public:
enum PatchType {
PATCH_NULL, PATCH_POLYGON, PATCH_ELLIPSE, PATCH_RECTANGLE
};
public:
Patch(PatchType type = PATCH_NULL);
virtual ~Patch();
void setType(PatchType type);
PatchType getType() const;
void setPolygon(const QPolygon & polygon);
void setRectangle(const QRect & rectangle);
const QPolygon & getPolygon() const;
const QRect & getRectangle() const;
const QRect & getEllipse() const;
private:
PatchType type;
QPolygon polygon;
QRect rectangle;
};
typedef QList<Patch> PatchList;
#endif /* PATCH_H_ */