QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
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 
27 #ifndef QGSPROJECTFILETRANSFORM_H
28 #define QGSPROJECTFILETRANSFORM_H
29 
30 #include "qgis_core.h"
31 #include <QString>
32 #include <QDomDocument>
33 #include "qgsprojectversion.h"
34 
35 
36 class QgsRasterLayer;
37 
41 class CORE_EXPORT QgsProjectFileTransform
42 {
43  public:
44  //Default constructor
45  //QgsProjectfiletransform() {}
46 
52  QgsProjectFileTransform( QDomDocument &domDocument,
53  const QgsProjectVersion &version )
54  {
55  mDom = domDocument;
56  mCurrentVersion = version;
57  }
58 
59 
60  bool updateRevision( const QgsProjectVersion &version );
61 
65  void dump();
66 
67  static void convertRasterProperties( QDomDocument &doc, QDomNode &parentNode, QDomElement &rasterPropertiesElem, QgsRasterLayer *rlayer );
68 
69  private:
70 
71  typedef struct
72  {
73  QgsProjectVersion from;
75  void ( QgsProjectFileTransform::* transformFunc )();
76  } TransformItem;
77 
78  static TransformItem sTransformers[];
79 
80  QDomDocument mDom;
81  QgsProjectVersion mCurrentVersion;
82 
83  // Transformer functions below. Declare functions here,
84  // define them in qgsprojectfiletransform.cpp and add them
85  // to the transformArray with proper version number
86  void transformNull() {} // Do absolutely nothing
87  void transform081to090();
88  void transform091to0100();
89  void transform0100to0110();
90  void transform0110to1000();
91  void transform1100to1200();
92  void transform1400to1500();
93  void transform1800to1900();
94  void transform2200to2300();
95  void transform3000();
96 
97  //helper functions
98  static int rasterBandNumber( const QDomElement &rasterPropertiesElem, const QString &bandName, QgsRasterLayer *rlayer );
99  static void transformContrastEnhancement( QDomDocument &doc, const QDomElement &rasterproperties, QDomElement &rendererElem );
100  static void transformRasterTransparency( QDomDocument &doc, const QDomElement &orig, QDomElement &rendererElem );
101 };
102 
103 
104 #endif //QGSPROJECTFILETRANSFORM_H
105 
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.