-
Notifications
You must be signed in to change notification settings - Fork 3
/
Polygon.h
48 lines (34 loc) · 893 Bytes
/
Polygon.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
#ifndef POLYGON_H
#define POLYGON_H
#include <QtGui>
#include "PolyDot.h"
class Polygon : public QObject, public QGraphicsItem
{
Q_OBJECT
Q_INTERFACES(QGraphicsItem)
public:
Polygon(bool inner=false);
~Polygon();
QRectF boundingRect() const;
void addBoundaryPoint(QPointF pos);
//open/close poly for edition
void close() { closed = true; }
void open() { closed = false;}
/* is closed for edition*/
bool isClosed() { return closed;}
/* is this inner poly of some other poly? */
bool isInner() {return inner;}
QString toString();
QList<PolyDot*> boundary;
signals:
void polyChanged();
public slots:
void dotUpdate();
protected:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
private:
Polygon *basePolygon;
bool closed;
bool inner;
};
#endif // POLYGON_H