-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrect.h
41 lines (30 loc) · 1 KB
/
grect.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
#ifndef GRECT_H
#define GRECT_H
#include <QGraphicsItem>
#include <QRectF>
#include <QPainter>
#include <QPointF>
#include "vector.h"
#include "matrix.h"
// Třída pro vykreslovaný čtverec
class GRect : public QGraphicsItem
{
public:
GRect(int ID,float Size,short sAlpha = 255);
~GRect() { delete[] pPoints; }
QRectF boundingRect() const { return QRectF(pPoints[0].x(),pPoints[0].y(),fSize*2,fSize*2); }
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void reset();
void transform(const Matrix<float>& T);
void selectMe(bool select) { bSelected = select; }
static Vector<float> Point2Vector(const QPointF& pt);
static QPointF Vector2Point(const Vector<float>& v) { return QPointF(v[0],v[1]); }
private:
int nID;
bool bSelected;
float fSize;
const float fDefaultSize;
QPointF *pPoints;
QColor Border,Body,Corner,Selected;
};
#endif // GRECT_H