QGIS API Documentation  2.99.0-Master (37c43df)
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 
38 class CORE_EXPORT QgsProjectFileTransform
39 {
40  public:
41  //Default constructor
42  //QgsProjectfiletransform() {}
44 
49  QgsProjectFileTransform( QDomDocument & domDocument,
50  const QgsProjectVersion& version )
51  {
52  mDom = domDocument;
53  mCurrentVersion = version;
54  }
55 
56 
57  bool updateRevision( const QgsProjectVersion& version );
58 
61  void dump();
62 
63  static void convertRasterProperties( QDomDocument& doc, QDomNode& parentNode, QDomElement& rasterPropertiesElem, QgsRasterLayer* rlayer );
64 
65  private:
66 
67  typedef struct
68  {
69  QgsProjectVersion from;
71  void ( QgsProjectFileTransform::* transformFunc )();
72  } transform;
73 
74  static transform transformers[];
75 
76  QDomDocument mDom;
77  QgsProjectVersion mCurrentVersion;
78 
79  // Transformer functions below. Declare functions here,
80  // define them in qgsprojectfiletransform.cpp and add them
81  // to the transformArray with proper version number
82  void transformNull() {} // Do absolutely nothing
83  void transform081to090();
84  void transform091to0100();
85  void transform0100to0110();
86  void transform0110to1000();
87  void transform1100to1200();
88  void transform1400to1500();
89  void transform1800to1900();
90  void transform2200to2300();
91 
92  //helper functions
93  static int rasterBandNumber( const QDomElement &rasterPropertiesElem, const QString &bandName, QgsRasterLayer *rlayer );
94  static void transformContrastEnhancement( QDomDocument &doc, const QDomElement &rasterproperties, QDomElement &rendererElem );
95  static void transformRasterTransparency( QDomDocument& doc, const QDomElement& orig, QDomElement& rendererElem );
96 };
97 
98 
99 #endif //QGSPROJECTFILETRANSFORM_H
100 
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
A class to describe the version of a project.
QgsProjectFileTransform(QDomDocument &domDocument, const QgsProjectVersion &version)
Create an instance from a Dom and a supplied version.