QGIS API Documentation  2.0.1-Dufour
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsprojectfiletransform.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsprojectfiletransform.h - description
3  -------------------
4  begin : Sun 15 dec 2007
5  copyright : (C) 2007 by Magnus Homann
6  email : magnus at homann.se
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
26 #ifndef QGSPROJECTFILETRANSFORM_H
27 #define QGSPROJECTFILETRANSFORM_H
28 
29 #include <QString>
30 #include <QDomDocument>
31 #include <vector>
32 #include "qgsprojectversion.h"
33 
34 class QgsRasterLayer;
35 
36 class CORE_EXPORT QgsProjectFileTransform
37 {
38  public:
39  //Default constructor
40  //QgsProjectfiletransform() {}
42 
47  QgsProjectFileTransform( QDomDocument & domDocument,
48  QgsProjectVersion version )
49  {
50  mDom = domDocument;
51  mCurrentVersion = version;
52  }
53 
54 
55  bool updateRevision( QgsProjectVersion version );
56 
59  void dump();
60 
61  static void convertRasterProperties( QDomDocument& doc, QDomNode& parentNode, QDomElement& rasterPropertiesElem, QgsRasterLayer* rlayer );
62 
63  private:
64 
65  typedef struct
66  {
69  void ( QgsProjectFileTransform::* transformFunc )();
70  } transform;
71 
72  static transform transformers[];
73 
74  QDomDocument mDom;
76 
77  // Transformer functions below. Declare functions here,
78  // define them in qgsprojectfiletransform.cpp and add them
79  // to the transformArray with proper version number
80  void transformNull() {}; // Do absolutely nothing
81  void transform081to090();
82  void transform091to0100();
83  void transform0100to0110();
84  void transform0110to1000();
85  void transform1100to1200();
86  void transform1400to1500();
87  void transform1800to1900();
88 
89  //helper functions
90  static int rasterBandNumber( const QDomElement& rasterPropertiesElem, const QString bandName, QgsRasterLayer* rlayer );
91  static void transformContrastEnhancement( QDomDocument& doc, const QDomElement& rasterproperties, QDomElement& rendererElem );
92  static void transformRasterTransparency( QDomDocument& doc, const QDomElement& orig, QDomElement& rendererElem );
93 };
94 
95 
96 #endif //QGSPROJECTFILETRANSFORM_H
97