QGIS API Documentation  2.0.1-Dufour
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsrasterchecker.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrasterchecker.h - compare two rasters
3  --------------------------------------
4  Date : 5 Sep 2012
5  Copyright : (C) 2012 by Radim Blazek
6  email : radim dot blazek at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSRASTERCHECKER_H
17 #define QGSRASTERCHECKER_H
18 
19 #include <QDir>
20 #include <QString>
21 #include <qgsmaprenderer.h>
22 class QImage;
23 
29 class CORE_EXPORT QgsRasterChecker
30 {
31  public:
32 
34 
37 
38  QString report() { return mReport; };
46  bool runTest( QString theVerifiedKey, QString theVerifiedUri,
47  QString theExpectedKey, QString theExpectedUri );
48  private:
49  QString mReport;
50  QString mExpectedUri;
51  QString mCheckedUri;
52  QString mTabStyle;
53  QString mCellStyle;
54  QString mOkStyle;
55  QString mErrStyle;
56  QString mErrMsgStyle;
57 
58  // Log error in html
59  void error( QString theMessage, QString &theReport );
60  // compare values and add table row in html report, set ok to false if not equal
61  QString compareHead();
62  bool compare( double verifiedVal, double expectedVal, double theTolerance );
63  void compare( QString theParamName, int verifiedVal, int expectedVal, QString &theReport, bool &theOk );
64  void compare( QString theParamName, double verifiedVal, double expectedVal, QString &theReport, bool &theOk, double theTolerance = 0 );
65  void compareRow( QString theParamName, QString verifiedVal, QString expectedVal, QString &theReport, bool theOk, QString theDifference = "", QString theTolerance = "" );
66  double tolerance( double val, int places = 6 );
67 }; // class QgsRasterChecker
68 
69 #endif