QGIS API Documentation  master-6227475
src/core/qgsprojectfiletransform.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                           qgsprojectfiletransform.h  -  description
00003                              -------------------
00004     begin                : Sun 15 dec 2007
00005     copyright            : (C) 2007 by Magnus Homann
00006     email                : magnus at homann.se
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00026 #ifndef QGSPROJECTFILETRANSFORM_H
00027 #define QGSPROJECTFILETRANSFORM_H
00028 
00029 #include <QString>
00030 #include <QDomDocument>
00031 #include <vector>
00032 #include "qgsprojectversion.h"
00033 
00034 class QgsRasterLayer;
00035 
00036 class CORE_EXPORT QgsProjectFileTransform
00037 {
00038   public:
00039     //Default constructor
00040     //QgsProjectfiletransform() {}
00041     ~QgsProjectFileTransform() {}
00042 
00047     QgsProjectFileTransform( QDomDocument & domDocument,
00048                              QgsProjectVersion version )
00049     {
00050       mDom = domDocument;
00051       mCurrentVersion = version;
00052     }
00053 
00054 
00055     bool updateRevision( QgsProjectVersion version );
00056 
00059     void dump();
00060 
00061     static void convertRasterProperties( QDomDocument& doc, QDomNode& parentNode, QDomElement& rasterPropertiesElem, QgsRasterLayer* rlayer );
00062 
00063   private:
00064 
00065     typedef struct
00066     {
00067       QgsProjectVersion from;
00068       QgsProjectVersion to;
00069       void ( QgsProjectFileTransform::* transformFunc )();
00070     } transform;
00071 
00072     static transform transformers[];
00073 
00074     QDomDocument mDom;
00075     QgsProjectVersion mCurrentVersion;
00076 
00077     // Transformer functions below. Declare functions here,
00078     // define them in qgsprojectfiletransform.cpp and add them
00079     // to the transformArray with proper version number
00080     void transformNull() {}; // Do absolutely nothing
00081     void transform081to090();
00082     void transform091to0100();
00083     void transform0100to0110();
00084     void transform0110to1000();
00085     void transform1100to1200();
00086     void transform1400to1500();
00087     void transform1800to1900();
00088 
00089     //helper functions
00090     static int rasterBandNumber( const QDomElement& rasterPropertiesElem, const QString bandName, QgsRasterLayer* rlayer );
00091     static void transformContrastEnhancement( QDomDocument& doc, const QDomElement& rasterproperties, QDomElement& rendererElem );
00092     static void transformRasterTransparency( QDomDocument& doc, const QDomElement& orig, QDomElement& rendererElem );
00093 };
00094 
00095 
00096 #endif //QGSPROJECTFILETRANSFORM_H
00097 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines