-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuilding.h
47 lines (43 loc) · 1.19 KB
/
building.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
#ifndef BUILDING_H
#define BUILDING_H
#include "publicspace.h"
class building:public publicspace{
Q_DECLARE_TR_FUNCTIONS(building)
public:
typedef enum Function{Residential,Office,Cultural,Hotel,Commercial,Civic}function;
enum{Type=UserType+2};
building();
building(Function func);
~building();
int getFunction();
void setFunction(Function func);
int getLayer();
void setLayer(int layer);
QString getText();
void setText(int layer);
qreal getTotalArea();
void paint(QPainter*painter,const QStyleOptionGraphicsItem*option,
QWidget*);
virtual int type()const;
static qreal getnTotalArea();
static qreal getnArea();
static qreal getnTotalResArea();
protected:
//double click to change layer
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*);
private:
Function func;
int layer;
qreal area;
qreal totalArea;
static qreal nArea;
static qreal nTotalArea;
static qreal nTotalResArea;
//static qreal nTotalOfficeArea;
QString text;
QColor textColor;
QColor backgroundColor;
QRectF outlineRect() const;
void updateArea();
};
#endif // BUILDING_H