00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "CFractale.hpp"
00024
00025 #include "../Fractale/Commun.hpp"
00026 #include "../Fractale/Image.hpp"
00027 #include "../Fractale/GPointInitialisation.hpp"
00028 #include "../Fractale/GFractale.hpp"
00029 #include "../Fractale/GAccumulateur.hpp"
00030 #include "../Fractale/Generateur.hpp"
00031
00032 #include <QObject>
00033
00034 #ifndef QT_NO_DEBUG
00035 #include <iostream>
00036 #endif
00037
00038 CFractale :: CFractale( Params params,
00039 QObject* parent )
00040 :QThread(parent),
00041 params(params)
00042 {
00043
00044
00045 #ifndef QT_NO_DEBUG
00046 std::cout << "CFractale (thread) created" << std::endl;
00047
00048 std::cout << "Initializor: " << params.lifct << std::endl;
00049 std::cout << "Generator: " << params.lgfct << std::endl;
00050 std::cout << "Accumulator: " << params.lafct << std::endl << std::endl;
00051
00052 std::cout << "Image(" << params.iWidth << ";" << params.iHeight << ")" << std::endl;
00053 std::cout << "Zone(" << params.zX << ";" << params.zY << ";" << params.zWidth << ";" << params.zHeight << ")" << std::endl << std::endl;
00054 #endif
00055 }
00056
00057 CFractale :: ~CFractale(void)
00058 {
00059 #ifndef QT_NO_DEBUG
00060 std::cout << "CFractale (thread) deleted" << std::endl;
00061 #endif
00062 }
00063
00064 void CFractale :: run(void)
00065 {
00066 Fractale::GPointInitialisation* initFCT = NULL;
00067 Fractale::GFractale* fractaleFCT = NULL;
00068 Fractale::GAccumulateur* accumulatorFCT = NULL;
00069
00070 switch ( params.lifct )
00071 {
00072 case lifctPOINTALEATOIRE:
00073 {
00074 initFCT = new Fractale::PointAleatoire();
00075 }break;
00076
00077 case lifctPOINTIMAGE:
00078 {
00079 initFCT = new Fractale::PointImage();
00080 }break;
00081
00082 case lifctENDOFLIST:
00083 {
00084 #ifndef QT_NO_DEBUG
00085 std::cout << "Problem with the identifier of the initializor function (lifctENDOFLIST)" << std::endl;
00086 #endif
00087 return;
00088 }break;
00089 }
00090
00091 switch ( params.lgfct )
00092 {
00093 case lgfctMANDELBROT:
00094 {
00095 fractaleFCT = new Fractale::Mandelbrot();
00096 }break;
00097
00098 case lgfctBATEAUENFEU:
00099 {
00100 fractaleFCT = new Fractale::BateauEnFeu();
00101 }break;
00102
00103 case lgfctTRICORN:
00104 {
00105 fractaleFCT = new Fractale::Tricorn();
00106 }break;
00107
00108 case lgfctJULIAN:
00109 {
00110 fractaleFCT = new Fractale::Julian();
00111 }break;
00112
00113 case lgfctNEWTON:
00114 {
00115 fractaleFCT = new Fractale::Newton();
00116 }break;
00117
00118 case lgfctNOVA:
00119 {
00120 fractaleFCT = new Fractale::Nova();
00121 }break;
00122
00123 case lgfctENDOFLIST:
00124 {
00125 #ifndef QT_NO_DEBUG
00126 std::cout << "Problem with the identifier of the fractale function (lifctENDOFLIST) " << std::endl;
00127 #endif
00128 delete initFCT;
00129 return;
00130 }break;
00131 }
00132
00133 switch ( params.lafct )
00134 {
00135 case lafctACCUMULERSURLASEQUENCE:
00136 {
00137 accumulatorFCT = new Fractale::AccumulerSurLaSequence();
00138 }break;
00139
00140 case lafctACCUMULERSURORIGINE:
00141 {
00142 accumulatorFCT = new Fractale::AccumulerSurOrigine();
00143 }break;
00144
00145 case lafctENDOFLIST:
00146 {
00147 #ifndef QT_NO_DEBUG
00148 std::cout << "Problem with the identifier of the accumulation function (lifctENDOFLIST) " << std::endl;
00149 #endif
00150 delete initFCT;
00151 delete fractaleFCT;
00152 return;
00153 }break;
00154 }
00155
00156 fractale = Fractale::Generateur(initFCT, fractaleFCT, accumulatorFCT, Fractale::Zone(params.zX,params.zY,params.zHeight,params.zWidth, params.iHeight, params.iWidth));
00157
00158 delete accumulatorFCT;
00159 delete fractaleFCT;
00160 delete initFCT;
00161 }