-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathrenderarea.h
123 lines (107 loc) · 2.63 KB
/
renderarea.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#ifndef RENDERAREA_H
#define RENDERAREA_H
#include <QPainterPath>
#include <QWidget>
#include "renderarea.h"
#include <QPolygonF>
#include "dbasefile.h"
class PointTheme
{
public:
PointTheme(){m_dBaseData = NULL; m_data.clear(); m_nCount=0;}
void addPoint(QPointF pt){m_data.push_back(pt); m_nCount++;}
int GetCount(){return m_nCount;}
QVector<QPointF>* GetData(){return &m_data;}
void addPoints(QVector<QPointF> ptArr)
{
for (int i=0; i<ptArr.size(); i++)
{
QPointF pt = ptArr.at(i);
m_data.push_back(pt);
m_nCount++;
}
}
void addPoints(QPointF *ptArr, int size)
{
for (int i=0; i<size; i++)
{
QPointF pt = ptArr[i];
m_data.push_back(pt);
m_nCount++;
}
}
private:
QVector<QPointF> m_data;
int m_nCount;
QColor m_color;
public:
DBaseFile *m_dBaseData;
QString m_themeName;
};
class PolygonTheme
{
public:
PolygonTheme(){m_dBaseData = NULL; m_data.clear(); m_nCount=0;}
void addPolygon(QPolygonF poly){m_data.push_back(poly); m_nCount++;}
int GetCount(){return m_nCount;}
QVector<QPolygonF>* GetData(){return &m_data;}
void addPolygons(QVector<QPolygonF> polyArr)
{
for (int i=0; i<polyArr.size(); i++)
{
QPolygonF pt = polyArr.at(i);
m_data.push_back(pt);
m_nCount++;
}
}
void addPolygons(QPolygonF *polyArr, int size)
{
for (int i=0; i<size; i++)
{
QPolygonF pt = polyArr[i];
m_data.push_back(pt);
m_nCount++;
}
}
private:
QVector<QPolygonF> m_data;
int m_nCount;
QColor m_color;
public:
DBaseFile *m_dBaseData;
QString m_themeName;
};
class RenderArea : public QWidget
{
Q_OBJECT
public:
RenderArea(const QPainterPath &path, QWidget *parent = 0);
RenderArea();
~RenderArea();
QSize minimumSizeHint() const;
QSize sizeHint() const;
public slots:
void clearAll();
void addPointTheme(QVector<QPointF> *pts, DBaseFile* dbase, QString fileName);
void addPolygonTheme(QVector<QPolygonF> *polys, DBaseFile* dbase, QString fileName);
void addPolylineTheme(QVector<QPolygonF> *polys, DBaseFile* dbase, QString fileName);
void UpdateDisplay();
public:
QVector<PointTheme> * GetPointData(){return &m_points;}
QVector<PolygonTheme> * GetPolygonData(){return &m_polygons;}
QVector<PolygonTheme> * GetPolylineData(){return &m_polylines;}
protected:
void paintEvent(QPaintEvent *event);
private:
QPainterPath m_path;
QColor m_fillColor;
int m_penWidth;
QColor m_penColor;
QPicture *m_pixmap;
bool m_updated;
double m_left, m_right, m_top, m_bottom;
QVector<PointTheme> m_points;
QVector<PolygonTheme> m_polygons;
QVector<PolygonTheme> m_polylines;
};
#endif