forked from qgis/QGIS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqgsbench.h
99 lines (69 loc) · 2.57 KB
/
qgsbench.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
/***************************************************************************
qgsbench.h - Benchmark
-------------------
begin : 2011-11-15
copyright : (C) 2011 Radim Blazek
email : radim dot blazek at gmail dot com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSBENCH_H
#define QGSBENCH_H
#include <QCoreApplication>
#include <QDomDocument>
#include <QDomNode>
#include <QMap>
#include <QPainter>
#include <QString>
#include <QTime>
#include <QVariant>
#include <QVector>
#include "qgsmapsettings.h"
class QgsBench : public QObject
{
Q_OBJECT
public:
QgsBench( int width, int height, int cycles );
// start time counter
void start();
// save elapsed time since last start() in list and restarts counter
void elapsed();
void render();
void printLog( const QString &printTime );
bool openProject( const QString &fileName );
void setExtent( const QgsRectangle &extent );
void saveSnapsot( const QString &fileName );
void saveLog( const QString &fileName );
QString serialize( const QMap<QString, QVariant> &map, int level = 0 );
void setRenderHints( const QPainter::RenderHints &hints ) { mRendererHints = hints; }
void setParallel( bool enabled ) { mParallel = enabled; }
public slots:
void readProject( const QDomDocument &doc );
private:
// snapshot image width
int mWidth;
// snapshot image height
int mHeight;
// Number of rendering cycles
int mIterations;
QgsRectangle mExtent;
bool mSetExtent;
QPainter::RenderHints mRendererHints;
// log map
QMap<QString, QVariant> mLogMap;
double mUserStart;
double mSysStart;
QTime mWallTime; // 'wall clock' time
// user, sys, total times
QVector<double *> mTimes;
QImage mImage;
QgsMapSettings mMapSettings;
bool mParallel;
};
#endif // QGSBENCH_H