Changeset 455 in PSPA
- Timestamp:
- Dec 16, 2013, 5:16:54 PM (10 years ago)
- Location:
- Interface_Web/trunk/pspaWT
- Files:
-
- 63 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/History
r453 r455 5 5 PSPA - Plateforme de simulation en physique des accélérateurs 6 6 ========================================================= 7 8 16 Décembre 2013 : Laurent Garnier 9 Un certain nombre d'arguments/méthodes sont postfixés par "deprecated". Ils vont être supprimé prochainement et ne servent déja probablement plus a rien pour la plupart d'entre eux. 10 11 - abstractSoftware : 12 o DEPRECATED : Passage a "deprecated" des fonctions et arguments suivants : 13 - initComputationLimits() 14 - ComputationLimitsOk() 15 - numeroDeb 16 - numeroFin 17 o Suppression des paramètres globParamPtr_ et sectParamPtr_ 18 qui sont désormais des paramètres de "dataManager" et "section" 19 o Ajout de la méthode getSectionToExecute() 20 o Changement du constructeur : 21 - abstractSoftware(string,globalParameters*,dataManager*); 22 Par 23 - abstractSoftware(string, sectionToExecute*); 24 o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin. 25 - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir) 26 Remplacé par : 27 - createInputFile(particleBeam* beamBefore, string workingDir) 28 29 - dataManager 30 o DEPRECATED : Passage a "deprecated" des fonctions et arguments suivants : 31 - getBeamLineSize() 32 - getDiagnosticBeam(string) 33 - getLabelFromElementNumero() 34 - getLabelFromElementLabel() 35 o Supression de : 36 - addSectionToExecute() 37 - addElement() 38 - getElementPointerFromNumero() 39 - clearSectionToExecute() 40 41 - unknowSoftware : 42 o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin. 43 - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir) 44 Remplacé par : 45 - createInputFile(particleBeam* beamBefore, string workingDir) 46 47 - sectionToExecute : Désormais cette classe possède un vector d'abstractElement. 48 o Changement du constructeur : 49 - sectionToExecute(abstractElement*,abstractElement*,abstractSoftware*) 50 Remplacé par : 51 - sectionToExecute(abstractElement*,abstractSoftware*) -> Plus besoin de connaitre la fin, on ajoute les éléments au et 52 à mesure dans la sectionToExecute. 53 o supression de : 54 - getFirstElement() -> On parcours désormais un vecteur d'éléments 55 - getLastElement() 56 - getElementNumberInSection() 57 - getLastElementNumberInSection() 58 - firstElementNumberInBeamLine, lastElementNumberInBeamLine, firstElement, lastElement 59 o ajout d'un vecteur d'"abstractElement*" à cette section et des méthodes associées 60 61 - sector : 62 o ajout des méthodes et paramètres : 63 - addElementAfter() 64 - setSoftware() 65 - clearSectionToExecute() 66 - clearSectionToExecute(int) 67 - dataManager_, sectorParam_ 68 69 - sectorParameters : 70 o Changement du constructeur en ajoutant un paramètre vers le "sector" d'origine 71 o Renommage de "sector_" en "sectorsStatements_" pour éviter les confusions 72 73 - softwareGenerator : 74 o Changement du constructeur : 75 - softwareGenerator(string inputFileName, globalParameters* globals, dataManager* dt); 76 Par : 77 - softwareGenerator(string inputFileName, sectionToExecute*) 78 o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin. 79 - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir) 80 81 - softwareParmela : 82 o Changement du constructeur : 83 - softwareParmela(string inputFileName, globalParameters* globals, dataManager* dt); 84 Par : 85 - softwareParmela(string inputFileName, sectionToExecute*) 86 o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin. 87 - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir) 88 89 - softwareTest : 90 o Changement du constructeur : 91 - softwareTest(string inputFileName, globalParameters* globals, dataManager* dt); 92 Par : 93 - softwareTest(string inputFileName, sectionToExecute*) 94 o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin. 95 - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir) 96 97 - softwareUsersProgram : 98 o Changement du constructeur : 99 - softwareUsersProgram(string inputFileName, globalParameters* globals, dataManager* dt); 100 Par : 101 - softwareUsersProgram(string inputFileName, sectionToExecute*) 102 o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin. 103 - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir) 104 105 106 - softwareMadX : 107 o Changement du constructeur : 108 - softwareMadX(string inputFileName, globalParameters* globals, dataManager* dt); 109 Par : 110 - softwareMadX(string inputFileName, sectionToExecute*) 111 o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin. 112 - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir) 113 114 115 - softwareTransport : 116 o Changement du constructeur : 117 - softwareTransport(string inputFileName, globalParameters* globals, dataManager* dt); 118 Par : 119 - softwareTransport(string inputFileName, sectionToExecute*) 120 o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin. 121 - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir) 122 123 - GWt_elementBeam, Cell, Bend, Drift... : 124 o Changement du constructeur pour l'associer à un abstrastElement 125 126 - GWt_elementLigneFaisceu : 127 o Remplacement de : 128 - initialize_ligneFaisceau(nomdElements::typedElement eType,GWt_ligneFaisceau* ligne); 129 Par : 130 - initialize_ligneFaisceau(GWt_ligneFaisceau* ligne, abstractElement* abstractElem) 131 o Suppression du pointeur vers PspaApplication* 132 o DEPRECATED : GWt_abstractElement 133 134 - GWt_dropZoneLigneFaisceau : 135 o Desormais une dropZone n'est plus lié à PspaApplication mais à un dataManager 136 137 - GWt_sectionToExecute : 138 o Ajout d'un pointer vers le section qui contient cette section 139 140 - GWt_softwarePanel : 141 o Cette classe n'est plus liée à PspaApplication, mais au GWt_sector qui la contient 142 143 - GWt_ligneFaisceau : 144 o Desormais cette classe n'est plus lié à PspaApplication mais à un dataManager et un GWt_sector 145 o DEPRECATED : 146 - update() 147 - manageLineFaisceauLayout() 148 149 - GWt_sectorParameters 150 o DEPRECATED : 151 - createSector() 152 - buttons() 153 - execDialog() 154 155 - PspaApplication : 156 o La beamLine n'est plus gérée dans cette classe mais dans le dataManager, de ce fait, un certain nombre de fonctions et arguments disparaissent : 157 o DEPRECATED : 158 - beamLine 159 - createBeamLine() 160 o Un certain nombre de fonction sont déplacée dans la nouvelle classe GWt_accelerator : 161 - dialogOnGraphics() 162 - faireDessinPhaseSpace(WContainerWidget* toto, particleBeam* beam, string elementLabel, string namex, string namey, int typeFaisceau) 163 - faireDessinEnveloppe(WContainerWidget* toto, string type) 164 - chartPlot2vec(WContainerWidget* toto,vector<double>& xcor,vector<double>& ycor,Wt::Chart::SeriesType seriesType,Wt::Chart::FillRangeType fillRange,Wt::Chart::AxisValue value,bool isGridLinesEnables,string title,string legendx,string legendy,int width,int height,bool makeIcon = false) 165 - removePathFromConfigName(string& config) 166 - removeExtensionFromConfigName(string& config) 167 - removeBeamLine() 168 - dessiner() 169 - dessinerEnveloppe() 170 - dessinerPhaseSpace() 171 - dessinerHistogramme() 172 173 - GWt_accelerator : 174 o Nouvelle classe afin de gérer toutes les fonctions spécifiques à un accélérateur et non pas à l'application PSPA. Cette classe pourra servir si l'on à plusieurs accélérateurs dans PSPA. 175 7 176 8 177 12 Décembre 2013 : Laurent Garnier -
Interface_Web/trunk/pspaWT/sources/controler/include/abstractSoftware.h
r431 r455 15 15 16 16 class dataManager; 17 class sectionToExecute; 17 18 18 19 class abstractSoftware … … 21 22 protected : 22 23 23 unsigned numeroDeb_, numeroFin_; 24 globalParameters* globParamPtr_; 25 sectorParameters* sectParamPtr_; //xx 24 unsigned numeroDeb_deprecated_, numeroFin_deprecated_; 26 25 dataManager* dataManager_; 27 26 string inputFileName_; … … 41 40 42 41 bool launchJob(string commandLine, string& resul); 43 bool initComputationLimits (unsigned int numeroDeb,unsigned int numeroFin);44 bool ComputationLimitsOk () const;42 bool initComputationLimits_deprecated(unsigned int numeroDeb,unsigned int numeroFin); 43 bool ComputationLimitsOk_deprecated() const; 45 44 46 45 void registerElement(nomdElements::typedElement nomdel,trivaluedBool b); 47 46 48 public : 47 sectionToExecute* getSectionToExecute() { 48 return sectionToExecute_; 49 } 49 50 50 abstractSoftware(string,globalParameters*,dataManager*); 51 abstractSoftware(string,sectorParameters*,dataManager*); 51 public : 52 53 abstractSoftware(string, sectionToExecute*); 52 54 ~abstractSoftware() {;} 53 55 … … 58 60 trivaluedBool doAcceptElement(nomdElements::typedElement typdel); 59 61 60 virtual bool createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin,string workingDir) = 0;62 virtual bool createInputFile(particleBeam* beamBefore, string workingDir) = 0; 61 63 virtual bool execute(string workingDir) = 0; 62 64 virtual bool buildBeamAfterElements(string workingDir) = 0; … … 72 74 return nameOfSoftware_.getString(); 73 75 } 76 private : 77 sectionToExecute* sectionToExecute_; 78 74 79 }; 75 80 #endif -
Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h
r449 r455 28 28 virtual ~dataManager(); 29 29 void consoleMessage(string message); 30 int getBeamLineSize ();30 int getBeamLineSize_deprecated(); 31 31 inline globalParameters* getGlobalParameters() {return &globParam_;} 32 32 inline particleBeam* getCurrentBeam() {return currentBeam_;} 33 34 // xx35 inline sectorParameters* getSectorParameters() {return §orParam_;}36 33 37 34 particleBeam* getDiagnosticBeam(unsigned index); 38 particleBeam* getDiagnosticBeam (string elementLabel);35 particleBeam* getDiagnosticBeam_deprecated(string elementLabel); 39 36 40 sectionToExecute* addSectionToExecute(abstractElement* debut,int debutIndex, abstractElement* fin, int finIndex, nomDeLogiciel logiciel);41 42 abstractElement* addElement(nomdElements::typedElement elemType);43 void removeElement(string);44 45 37 /** Add a new sector 46 38 */ … … 49 41 /** return all sectors 50 42 */ 51 inline std::vector <sector*> getSectors() {return sectors_;};43 inline std::vector <sector*> getSectors() {return jobList_;}; 52 44 53 45 /** … … 55 47 @return return "" if not found 56 48 */ 57 string getLabelFromElementNumero (int numero);49 string getLabelFromElementNumero_deprecated(int numero); 58 50 59 51 /** … … 61 53 @return return -1 if not found 62 54 */ 63 int getNumeroFromElementLabel(string); 64 abstractElement* getElementPointerFromNumero(int); 55 int getNumeroFromElementLabel_deprecated(string); 65 56 66 57 void initializeExecution(); … … 82 73 /** return the jobList size 83 74 */ 84 inline intgetJobListSize() const {75 inline unsigned long getJobListSize() const { 85 76 return jobList_.size(); 86 77 } … … 96 87 } 97 88 98 /** Clear a specific jobList */ 99 void clearSectionToExecute(int a); 100 89 90 /** 91 Return the application attatch to this controler 92 */ 93 inline PspaApplication* getPspaApplication() { 94 return pspa_; 95 }; 96 97 101 98 private: 102 99 103 100 globalParameters globParam_; 104 sectorParameters sectorParam_; //xx105 101 particleBeam* currentBeam_; 106 102 PspaApplication* pspa_; 107 unsigned firstComputedElemNumero_;108 unsigned lastComputedElemNumero_;109 103 110 104 vector<particleBeam> diagnosticBeam_; 111 105 vector<unsigned> indexElementToIndexDiag_; 112 vector<sectionToExecute*> jobList_; 113 vector <sector*> sectors_; 106 vector <sector*> jobList_; 114 107 void removeFile(string nameOfFile); 115 void clearSectionToExecute();116 abstractSoftware* createSoftwareConnexion(nomDeLogiciel logi);117 108 }; 118 109 #endif -
Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h
r442 r455 108 108 void buildMomentRepresentation(); 109 109 void clear(); 110 intgetNbParticles() const;110 unsigned long getNbParticles() const; 111 111 const beam2Moments& getTransportMoments() const; 112 112 double getUnnormalizedEmittanceX(); -
Interface_Web/trunk/pspaWT/sources/controler/include/sectionToExecute.h
r431 r455 9 9 { 10 10 public : 11 /** Create a new sectionToExecute and initialize it with the given element 12 */ 13 sectionToExecute(abstractElement*); 11 14 12 sectionToExecute(abstractElement*,abstractElement*,abstractSoftware*); 15 /** Create a new sectionToExecute and initialize it with the given element and software 16 */ 17 sectionToExecute(abstractElement*,abstractSoftware*); 13 18 14 19 /** Deprecated : To be removed ! */ … … 17 22 ~sectionToExecute() {;} 18 23 19 inline abstractElement* getFirstElement() {20 return firstElement;21 }22 23 inline abstractElement* getLastElement() {24 return lastElement;25 }26 27 /** Deprecated : To be removed ! */28 inline int getElementNumberInSection() const {29 return firstElementNumberInBeamLine;30 }31 32 /** Deprecated : To be removed ! */33 inline int getLastElementNumberInSection() const {34 return lastElementNumberInBeamLine;35 }36 37 24 inline abstractSoftware* getSoftware() const { 38 return software ;25 return software_; 39 26 } 40 27 41 private : 28 inline abstractSoftware* setSoftware(abstractSoftware* soft) { 29 software_ = soft; 30 } 31 32 /** 33 Get the vector of elements of this sector 34 */ 35 inline std::vector< abstractElement* > getElements() {return elements_;}; 36 37 bool insertAfter(abstractElement*,abstractElement*); 42 38 43 abstractElement* firstElement; 44 abstractElement* lastElement; 45 abstractSoftware* software; 39 private : 46 40 47 int firstElementNumberInBeamLine; 48 int lastElementNumberInBeamLine; 41 abstractSoftware* software_; 42 43 std::vector< abstractElement* > elements_; 49 44 }; 50 45 #endif -
Interface_Web/trunk/pspaWT/sources/controler/include/sector.h
r449 r455 3 3 4 4 #include <vector> 5 #include "sectionToExecute.h" 5 #include <string> 6 7 #include "nomDeLogiciel.h" 8 #include "sectorParameters.h" 9 10 class sectionToExecute; 11 class abstractElement; 12 class dataManager; 6 13 7 14 class sector … … 9 16 public : 10 17 11 sector( std::string name = "sector default name");18 sector(dataManager*, std::string name = "sector default name"); 12 19 virtual ~sector(); 13 20 /** … … 47 54 */ 48 55 inline std::string getName() { return name_;}; 49 50 /**51 Return the vector of sectors inside this sector52 */53 inline std::vector <sector*> getInnerSectors() { return sectors_;};54 55 /**56 Add an inner sector57 */58 inline void addInnerSector(sector* s) {59 if (s) sectors_.push_back(s);60 };61 56 62 57 /** … … 72 67 }; 73 68 69 /** Add an element after another one. Will put it in the same sectionToExecuteList. If the element after is NULL 70 it will create a new sectionToExecute and put it inside. 71 */ 72 void addElementAfter(abstractElement*,abstractElement*); 73 74 /** 75 set the specific software for the given sectionToExecute number 76 */ 77 bool setSoftware(nomDeLogiciel, unsigned int sectionToExecuteNumber); 78 79 void clearSectionToExecute(); 80 /** Clear a specific jobList */ 81 void clearSectionToExecute(int a); 82 83 inline sectorParameters getSectorParameters() { 84 return sectorParam_; 85 } 86 74 87 private: 75 std::vector <sector*> sectors_; 88 76 89 std::vector <sectionToExecute*> sectionToExecute_; 77 90 … … 80 93 sector* duplicatedFrom_; 81 94 unsigned int repetitionNumber_; 95 dataManager* dataManager_; 96 sectorParameters sectorParam_; //xx 82 97 }; 83 98 #endif -
Interface_Web/trunk/pspaWT/sources/controler/include/sectorParameters.h
r436 r455 10 10 typedef pair<string, vector<string> > statements; 11 11 12 class sector; 13 12 14 class sectorParameters 13 15 { 14 16 string geometry_; 15 vector<statements> sectors _;17 vector<statements> sectorsStatements_; 16 18 17 19 public : 18 20 19 sectorParameters( );21 sectorParameters(sector*); 20 22 ~sectorParameters() {;} 21 23 … … 27 29 void setSectors(const vector<statements>&); 28 30 vector<statements> getSectors() const; 31 sector* sector_; 29 32 }; 30 33 #endif -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareGenerator.h
r431 r455 18 18 19 19 softwareGenerator(); 20 softwareGenerator(string inputFileName, globalParameters* globals, dataManager* dt);20 softwareGenerator(string inputFileName, sectionToExecute*); 21 21 22 22 virtual ~softwareGenerator() {;} 23 23 24 virtual bool createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin,string workingDir);24 virtual bool createInputFile(particleBeam* beamBefore, string workingDir); 25 25 virtual bool execute(string workingDir); 26 26 virtual bool buildBeamAfterElements(string workingDir); -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareMadx.h
r431 r455 13 13 14 14 softwareMadx(); 15 softwareMadx(string,sect orParameters*,dataManager*);15 softwareMadx(string,sectionToExecute*); 16 16 virtual ~softwareMadx() {;} 17 17 18 virtual bool createInputFile(particleBeam*, unsigned int,unsigned int,string);18 virtual bool createInputFile(particleBeam*, string); 19 19 virtual bool execute(string); 20 20 virtual bool buildBeamAfterElements(string); -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareParmela.h
r418 r455 36 36 softwareParmela(); 37 37 38 softwareParmela(string inputFileName, globalParameters* globals, dataManager* beamLine);38 softwareParmela(string inputFileName, sectionToExecute*); 39 39 40 40 virtual ~softwareParmela() {;} 41 41 42 42 43 virtual bool createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin,string workingDir);43 virtual bool createInputFile(particleBeam* beamBefore, string workingDir); 44 44 45 45 virtual bool execute(string workingDir); -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareTest.h
r386 r455 18 18 softwareTest(); 19 19 20 softwareTest(string inputFileName, globalParameters* globals, dataManager*);20 softwareTest(string inputFileName, sectionToExecute*); 21 21 22 22 virtual ~softwareTest() {;} 23 23 24 24 25 virtual bool createInputFile( particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin,string workingDir);25 virtual bool createInputFile( particleBeam* beamBefore, string workingDir); 26 26 27 27 -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareTransport.h
r418 r455 20 20 public : 21 21 softwareTransport(); 22 softwareTransport(string inputFileName, globalParameters* globals, dataManager* beamLine);22 softwareTransport(string inputFileName, sectionToExecute*); 23 23 24 24 virtual ~softwareTransport() {;} 25 virtual bool createInputFile( particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin,string workingDir);25 virtual bool createInputFile( particleBeam* beamBefore, string workingDir); 26 26 27 27 virtual bool execute(string workingDir); -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareUnknown.h
r431 r455 11 11 virtual ~softwareUnknown() {;} 12 12 13 virtual bool createInputFile(particleBeam*, unsigned int,unsigned int,string);13 virtual bool createInputFile(particleBeam*,sectionToExecute* sectionToExe, string); 14 14 virtual bool execute(string); 15 15 virtual bool buildBeamAfterElements(string); -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareUsersprogram.h
r442 r455 13 13 public : 14 14 softwareUsersprogram(); 15 softwareUsersprogram(string inputFileName, globalParameters* globals, dataManager* beamLine);15 softwareUsersprogram(string inputFileName, sectionToExecute*); 16 16 17 17 virtual ~softwareUsersprogram() {;} 18 virtual bool createInputFile( particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin,string workingDir);18 virtual bool createInputFile( particleBeam* beamBefore, string workingDir); 19 19 20 20 virtual bool execute(string workingDir); -
Interface_Web/trunk/pspaWT/sources/controler/src/abstractSoftware.cc
r442 r455 7 7 abstractSoftware::abstractSoftware() 8 8 { 9 globParamPtr_ = NULL;10 sectParamPtr_ = NULL; //xx11 9 dataManager_ = NULL; 12 10 nameOfSoftware_ = nomDeLogiciel("unknownSoftware"); 13 11 } 14 12 15 abstractSoftware::abstractSoftware(string inputFileName, globalParameters* globals, dataManager* dt)13 abstractSoftware::abstractSoftware(string inputFileName, sectionToExecute* sect) 16 14 { 17 15 inputFileName_ = inputFileName; 18 globParamPtr_ = globals; 19 sectParamPtr_ = NULL; //xx 20 dataManager_ = dt; 21 numeroDeb_ = 0; 22 numeroFin_ = 0; 16 sectionToExecute_ = sect; 17 numeroDeb_deprecated_ = 0; 18 numeroFin_deprecated_ = 0; 23 19 nameOfSoftware_ = nomDeLogiciel("unknownSoftware"); 24 20 } 25 21 26 abstractSoftware::abstractSoftware(string inputFileName,sectorParameters* lattice,dataManager* dt) 22 bool abstractSoftware::initComputationLimits_deprecated(unsigned int numeroDeb,unsigned int numeroFin_deprecated_) 27 23 { 28 inputFileName_ = inputFileName; 29 globParamPtr_ = NULL; 30 sectParamPtr_ = lattice; 31 dataManager_ = dt; 32 numeroDeb_ = 0; 33 numeroFin_ = 0; 34 nameOfSoftware_ = nomDeLogiciel("unknownSoftware"); 24 /* numeroDeb_deprecated_ = numeroDeb; 25 numeroFin_deprecated__ = numeroFin_deprecated_; 26 return ComputationLimitsOk_deprecated(); 27 */ 35 28 } 36 29 37 bool abstractSoftware:: initComputationLimits(unsigned int numeroDeb,unsigned int numeroFin)30 bool abstractSoftware::ComputationLimitsOk_deprecated() const 38 31 { 39 numeroDeb_ = numeroDeb; 40 numeroFin_ = numeroFin; 41 return ComputationLimitsOk(); 42 } 43 44 bool abstractSoftware::ComputationLimitsOk() const 45 { 46 if (numeroDeb_ < 1 || numeroFin_ < 1 || numeroDeb_ > dataManager_->getBeamLineSize() || numeroFin_ > dataManager_->getBeamLineSize() ) { 32 /* if (numeroDeb_deprecated_ < 1 || numeroFin_deprecated__ < 1 || numeroDeb_deprecated_ > dataManager_->getBeamLineSize() || numeroFin_deprecated__ > dataManager_->getBeamLineSize() ) { 47 33 dataManager_->consoleMessage(" abstractSoftware::initComputationLimit : num of element out of limits in software " + getName() ); 48 34 return false; … … 50 36 return true; 51 37 } 38 */ 39 return true; 52 40 } 53 41 -
Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc
r449 r455 8 8 #include "GWt_pspaApplication.h" 9 9 #include "GWt_console.h" 10 11 #include "softwareParmela.h" 12 #include "softwareTransport.h" 13 #include "softwareGenerator.h" 14 #include "softwareGenerator.h" 15 #include "softwareUsersprogram.h" 16 #include "softwareTest.h" 17 #include "softwareMadx.h" //xx 18 #include "softwareUnknown.h" //xx 10 #include "GWt_ligneFaisceau.h" // FIXME to be removed ! 19 11 20 12 #include <boost/filesystem.hpp> … … 46 38 } 47 39 48 string dataManager::getLabelFromElementNumero(int numero) 49 { 50 abstractElement* ptr = pspa_->getBeamLine()->getAbstractElement(numero-1); 40 string dataManager::getLabelFromElementNumero_deprecated(int numero) 41 { 42 /* 43 abstractElement* ptr = pspa_->getBeamLine()->getAbstractElement(numero-1); 51 44 if ( ptr == NULL ) return ""; 52 45 return ptr->getLabel(); 53 } 54 55 int dataManager::getNumeroFromElementLabel(string label) 56 { 57 int index = -1; 46 */ 47 return ""; 48 } 49 50 int dataManager::getNumeroFromElementLabel_deprecated(string label) 51 { 52 /* int index = -1; 58 53 for (int k = 0; k < getBeamLineSize() ; k++) { 59 54 if (pspa_->getBeamLine()->getAbstractElement(k) != NULL) { … … 66 61 } 67 62 return index; 68 } 69 70 abstractElement* dataManager::getElementPointerFromNumero(int k) 71 { 72 return pspa_->getBeamLine()->getAbstractElement(k-1); 73 } 74 75 sectionToExecute* dataManager::addSectionToExecute(abstractElement* debut,int debutIndex, abstractElement* fin, int finIndex, nomDeLogiciel logiciel) 76 { 77 #if BAVARD > 0 78 cout << "***********************************" << endl; 79 cout << " dataManager::addSectionToExecute " << endl << endl; 80 #endif 81 82 abstractSoftware* prog; 83 string inputFileName; 84 if(logiciel == nomDeLogiciel::parmela) { 85 inputFileName = "parmin"; 86 prog = new softwareParmela(inputFileName, &globParam_, this); 87 } else if (logiciel == nomDeLogiciel::transport) { 88 inputFileName = "transport.input"; 89 prog = new softwareTransport(inputFileName, &globParam_, this); 90 } else if (logiciel == nomDeLogiciel::generator) { 91 inputFileName = "generator.in"; 92 prog = new softwareGenerator(inputFileName, &globParam_, this); 93 } else if (logiciel == nomDeLogiciel::madx) { 94 inputFileName = "madx.input"; 95 prog = new softwareMadx(inputFileName,§orParam_,this); 96 } else if (logiciel == nomDeLogiciel::usersprogram) { 97 inputFileName = "dummy"; 98 prog = new softwareUsersprogram(inputFileName, &globParam_, this); 99 } else if (logiciel == nomDeLogiciel::test) { 100 prog = new softwareTest(inputFileName, &globParam_, this); 101 } else { 102 prog = new softwareUnknown(); // xx 103 } 104 105 jobList_.push_back(new sectionToExecute(debut,debutIndex,fin,finIndex,prog)); 106 return jobList_.back(); 107 } 108 109 void dataManager::clearSectionToExecute() 110 { 111 unsigned k; 112 for(k = 0; k < jobList_.size(); k++) 113 { 114 if ( jobList_[k] != NULL ) clearSectionToExecute(k); 115 } 116 jobList_.clear(); 117 } 118 119 void dataManager::clearSectionToExecute(int a) 120 { 121 cout << " dataManager::clearSectionToExecute : effacement de la section d'index = " << a << endl; 122 if (a < 0) return; 123 if (a >= (int)jobList_.size()) return; 124 125 // lors de la creation de la section on a fait un 'new' d'un 126 // softwareXXXX : on fait ici le 'delete' 127 128 const abstractSoftware* soft = jobList_.at(a)->getSoftware(); 129 if ( soft != NULL ) delete soft; 130 jobList_.erase (jobList_.begin()+a); 131 } 63 */ 64 return 0; 65 } 66 132 67 133 68 void dataManager::initializeExecution() … … 148 83 indexElementToIndexDiag_.clear(); 149 84 currentBeam_ = NULL; 150 f irstComputedElemNumero_ = getBeamLineSize();151 lastComputedElemNumero_ = 1;152 clearSectionToExecute();85 for (unsigned int a=0; a< jobList_.size(); a++) { 86 jobList_[a]->clearSectionToExecute(); 87 } 153 88 } 154 89 … … 171 106 172 107 bool success = true; 173 abstractSoftware* softw = NULL;174 108 string workingDir = pspa_->getWorkingDir(); 175 109 176 // on verifie la consecution des sections 177 int lastel = 0;110 111 // Main loop ! 178 112 for(unsigned k = 0; k < jobList_.size(); k++) { 179 if ( jobList_[k]->getElementNumberInSection() != lastel +1 ) { 180 consoleMessage("dataManager::executeAll ERROR : sections should be consecutive "); 181 return false; 182 } else { 183 lastel = jobList_[k]->getLastElementNumberInSection(); 184 } 185 } 186 187 unsigned debut; 188 unsigned fin; 189 for(unsigned k = 0; k < jobList_.size(); k++) { 190 191 #if BAVARD > 0 113 sector* sector = jobList_[k]; 114 115 // for the moment, we put everything in one line without loops 116 for (unsigned int l=0; l <sector->getSectionsToExecute().size(); l++) { 117 sectionToExecute* section = sector->getSectionsToExecute()[l]; 118 abstractSoftware* softw = section->getSoftware(); 119 120 #if BAVARD > 0 192 121 cout << " dataManager::executeAll je m'apprete a executer : " << (jobList_[k]->getSoftware()->getName()) << endl; 193 122 #endif 194 195 debut = jobList_[k]->getElementNumberInSection(); 196 fin = jobList_[k]->getLastElementNumberInSection(); 197 softw = jobList_[k]->getSoftware(); 198 199 //cout << "k= " << k << ", de " << jobList_[k]->getFirstElement()->getLabel() << " à " << jobList_[k]->getLastElement()->getLabel() << " avec " << softw->getName() << endl; 200 123 124 //cout << "k= " << k << ", de " << jobList_[k]->getFirstElement()->getLabel() << " à " << jobList_[k]->getLastElement()->getLabel() << " avec " << softw->getName() << endl; 125 201 126 if (softw == NULL) { 202 127 success = false; … … 205 130 } 206 131 207 success = softw->createInputFile(currentBeam_, debut,fin,workingDir);132 success = softw->createInputFile(currentBeam_,workingDir); 208 133 if ( success ) { 209 134 success = softw->execute(workingDir); … … 222 147 if ( !success ) break; 223 148 224 if ( debut < firstComputedElemNumero_ ) firstComputedElemNumero_ = debut; 225 if ( fin > lastComputedElemNumero_ ) lastComputedElemNumero_ = fin; 226 227 #if BAVARD > 0 228 cout << "dataManager::executeAll #diagnosticBeam= " << diagnosticBeam_.size() << endl; 229 cout << "dataManager::executeAll #getBeamLineSize()= " << getBeamLineSize() << endl; 230 for (unsigned j = debut; j <= fin; j++) { 231 abstractElement* elPtr= getElementPointerFromNumero(j); 232 cout << "[" << j << "] " << elPtr->getNomdElement().getExpandedName() << endl; 233 } 149 #if BAVARD > 0 150 cout << "dataManager::executeAll #diagnosticBeam= " << diagnosticBeam_.size() << endl; 151 cout << "dataManager::executeAll #getBeamLineSize()= " << getBeamLineSize() << endl; 152 std::vector< abstractElement* > elements = section->getElements(); 153 for (unsigned j = 0; j < elements.size(); j++) { 154 cout << "[" << j << "] " << elements[j]->getNomdElement().getExpandedName() << endl; 155 } 234 156 #endif 235 157 } //l 236 158 } //k 237 159 // if ( currentBeam_ ) { … … 241 163 // currentBeam_->readFromAMLFile(aml_file); 242 164 // } 243 cout << " dataManager::executeAll() : premier element = " << firstComputedElemNumero_ << " dernier = " << lastComputedElemNumero_<< endl;165 cout << " dataManager::executeAll() " << endl; 244 166 245 167 return success; … … 264 186 265 187 outfile << globParam_.FileOutputFlow(); 266 outfile << sectorParam_.FileOutputFlow(); 267 188 189 // FIXME Francois: Comment sauver la configuration des section ? 190 for (unsigned int a=0; a< jobList_.size(); a++) { 191 outfile << jobList_[a]->getSectorParameters().FileOutputFlow(); 192 } 193 // END 194 268 195 abstractElement* elPtr; 269 for(int k = 0; k < getBeamLineSize() ; k++) 270 { 271 elPtr = pspa_->getBeamLine()->getAbstractElement(k); 272 outfile << elPtr->FileOutputFlow(); 273 } 196 for (unsigned k = 0; k < jobList_.size(); k++) { 197 sector* sector = jobList_[k]; 198 for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) { 199 sectionToExecute* section = sector->getSectionsToExecute()[l]; 200 for (unsigned m = 0; m < section->getElements().size(); m++) { 201 elPtr = section->getElements()[m]; 202 outfile << elPtr->FileOutputFlow(); 203 } 204 } 205 } 274 206 outfile.close(); 275 207 } … … 300 232 301 233 abstractElement* elPtr; 302 for(int k = 0; k < getBeamLineSize() ; k++) { 303 elPtr = pspa_->getBeamLine()->getAbstractElement(k); 304 elPtr->InputRep(sect); 305 } 306 234 for (unsigned k = 0; k < jobList_.size(); k++) { 235 sector* sector = jobList_[k]; 236 for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) { 237 sectionToExecute* section = sector->getSectionsToExecute()[l]; 238 for (unsigned m = 0; m < section->getElements().size(); m++) { 239 elPtr = section->getElements()[m]; 240 elPtr->InputRep(sect); 241 } 242 } 243 } 307 244 cout << "!Create the AML file ---------------------------" << endl; 308 245 AMLReader reader; … … 335 272 globParam_.FileInput(infile); 336 273 } else if (elementLabel == string("sectors") ) { 337 sectorParam_.raz(); 338 sectorParam_.FileInput(infile); 274 // FIXME Francois !!!!!!! 275 // sectorParam_.raz(); 276 // sectorParam_.FileInput(infile); 277 // END 339 278 } else { 340 279 elementType = nomdElements::getTypeFromLabel(elementLabel); … … 371 310 } 372 311 373 particleBeam* dataManager::getDiagnosticBeam(string elementLabel) 374 { 375 return getDiagnosticBeam( getNumeroFromElementLabel(elementLabel) -1); 312 particleBeam* dataManager::getDiagnosticBeam_deprecated(string elementLabel) 313 { 314 // FIXME : Devra etre changé par une récupération par "abstractElement" et non pas par label 315 unsigned int number = 0; 316 abstractElement* elPtr; 317 for (unsigned k = 0; k < jobList_.size(); k++) { 318 sector* sector = jobList_[k]; 319 for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) { 320 sectionToExecute* section = sector->getSectionsToExecute()[l]; 321 for (unsigned m = 0; m < section->getElements().size(); m++) { 322 elPtr = section->getElements()[m]; 323 if (elPtr->getLabel() == elementLabel) { 324 return getDiagnosticBeam(number); 325 } 326 number ++; 327 } 328 } 329 } 330 return NULL; 376 331 } 377 332 … … 390 345 if ( type == "x" ) { 391 346 unsigned i = 0; 392 cout << " dataManager::donneesRmsEnveloppe BeamLineSize = " << getBeamLineSize()<< endl;347 cout << " dataManager::donneesRmsEnveloppe " << endl; 393 348 // for (unsigned k = 0; k < getBeamLineSize(); k++) { 394 for (unsigned k = firstComputedElemNumero_ -1 ; k < lastComputedElemNumero_ ; k++) { 395 abstractElement* elPtr = pspa_->getBeamLine()->getAbstractElement(k); 396 // if(elPtr->getNomdElement().getElementType() == snapshot) continue; 397 // if(elPtr->getNomdElement().getElementType() == fit) continue; 398 particleBeam* beamToDraw = getDiagnosticBeam(i); 399 if ( !beamToDraw->momentRepresentationOk() ) { 400 beamToDraw->buildMomentRepresentation(); 401 } 402 403 longueur += elPtr->getLenghtOfElement(); 404 valeur = beamToDraw->getXmaxRms(); 405 cout << " dataManager::donneesRmsEnveloppe index = " << k << " longueur = " << longueur << " enveloppe : " << valeur << endl; 406 xcor.push_back(0.01*longueur); // on passe en metres 407 ycor.push_back(valeur); 408 i++; 349 for (unsigned k = 0; k < jobList_.size(); k++) { 350 sector* sector = jobList_[k]; 351 for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) { 352 sectionToExecute* section = sector->getSectionsToExecute()[l]; 353 for (unsigned m = 0; m < section->getElements().size(); m++) { 354 abstractElement* elPtr = section->getElements()[m]; 355 // if(elPtr->getNomdElement().getElementType() == snapshot) continue; 356 // if(elPtr->getNomdElement().getElementType() == fit) continue; 357 particleBeam* beamToDraw = getDiagnosticBeam(i); 358 if ( !beamToDraw->momentRepresentationOk() ) { 359 beamToDraw->buildMomentRepresentation(); 360 } 361 362 longueur += elPtr->getLenghtOfElement(); 363 valeur = beamToDraw->getXmaxRms(); 364 cout << " dataManager::donneesRmsEnveloppe index = " << k << " longueur = " << longueur << " enveloppe : " << valeur << endl; 365 xcor.push_back(0.01*longueur); // on passe en metres 366 ycor.push_back(valeur); 367 i++; 368 } 369 } 409 370 } 410 371 legendy.clear(); … … 413 374 } 414 375 415 int dataManager::getBeamLineSize() { 416 return pspa_->getBeamLine()->getBeamLineSize(); 417 } 418 419 420 abstractSoftware* dataManager::createSoftwareConnexion(nomDeLogiciel logi) 421 { 422 string inputFileName; 423 if(logi == nomDeLogiciel::parmela) { 424 cout << " dataManager::createSoftwareConnexion : logiciel identifie : parmela " << endl; 425 inputFileName = "parmin"; 426 return new softwareParmela(inputFileName, &globParam_, this); 427 } else if (logi == nomDeLogiciel::transport) { 428 cout << " dataManager::createSoftwareConnexion : logiciel identifie : transport " << endl; 429 inputFileName = "transport.input"; 430 return new softwareTransport(inputFileName, &globParam_, this); 431 } else if (logi == nomDeLogiciel::generator) { 432 cout << " dataManager::createSoftwareConnexion : logiciel identifie : generator " << endl; 433 inputFileName = "generator.in"; 434 return new softwareGenerator(inputFileName, &globParam_, this); 435 } else if (logi == nomDeLogiciel::test) { 436 cout << " dataManager::createSoftwareConnexion : logiciel identifie : test " << endl; 437 return new softwareTest(inputFileName, &globParam_, this); 438 } else { 439 cout << " dataManager::createSoftwareConnexion : logiciel identifie : null " << endl; 440 return NULL; 441 } 442 } 376 int dataManager::getBeamLineSize_deprecated() { 377 // FIXME : Cette methode ne doit pas exister, mis a part pour savoir quelle est la taille de la beamLine 378 unsigned int i = 0; 379 for (unsigned k = 0; k < jobList_.size(); k++) { 380 sector* sector = jobList_[k]; 381 for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) { 382 i += sector->getSectionsToExecute()[l]->getElements().size(); 383 } 384 } 385 return i; 386 } 387 443 388 444 389 sector* dataManager::addNewSector() { … … 448 393 str >> result; 449 394 450 sector* sect = new sector( std::string("sector ") + result);451 sectors_.push_back(sect);395 sector* sect = new sector(this, std::string("sector ") + result); 396 jobList_.push_back(sect); 452 397 return sect; 453 398 } -
Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc
r442 r455 30 30 } 31 31 32 intparticleBeam::getNbParticles() const {32 unsigned long particleBeam::getNbParticles() const { 33 33 return relativePartic_.size(); 34 34 } -
Interface_Web/trunk/pspaWT/sources/controler/src/sectionToExecute.cc
r419 r455 2 2 3 3 4 sectionToExecute::sectionToExecute(abstractElement* f, abstractElement* l , abstractSoftware* s) { 5 firstElement = f; 6 lastElement =l; 7 software = s; 4 sectionToExecute::sectionToExecute(abstractElement* a) { 5 elements_.push_back(a); 8 6 } 9 7 10 8 11 sectionToExecute::sectionToExecute(abstractElement* f, int fI, abstractElement* l , int lI, abstractSoftware* s) { 12 firstElement = f; 13 lastElement =l; 14 15 firstElementNumberInBeamLine = fI; 16 lastElementNumberInBeamLine =lI; 17 18 software = s; 9 sectionToExecute::sectionToExecute(abstractElement* f, abstractSoftware* s) { 10 elements_.push_back(f); 11 software_ = s; 19 12 } 20 13 14 15 bool sectionToExecute::insertAfter(abstractElement* previousElement,abstractElement* currentElement) { 16 17 std::vector<abstractElement*>::iterator it; 18 for (it = elements_.begin(); it < elements_.end(); it++) { 19 if (*it == previousElement ) { 20 elements_.insert (it+1,currentElement); 21 return true; 22 } 23 } 24 return false; 25 } 26 27 /* 28 bool sectionToExecute::setSoftware(nomDeLogiciel logiciel) { 29 30 if (sectionToExecuteNumber >= sectionToExecute_.size()) { 31 return false; 32 } 33 34 abstractSoftware* prog; 35 string inputFileName; 36 if(logiciel == nomDeLogiciel::parmela) { 37 inputFileName = "parmin"; 38 prog = new softwareParmela(inputFileName, this); 39 } else if (logiciel == nomDeLogiciel::transport) { 40 inputFileName = "transport.input"; 41 prog = new softwareTransport(inputFileName, this); 42 } else if (logiciel == nomDeLogiciel::generator) { 43 inputFileName = "generator.in"; 44 prog = new softwareGenerator(inputFileName, this); 45 } else if (logiciel == nomDeLogiciel::madx) { 46 inputFileName = "madx.input"; 47 prog = new softwareMadx(inputFileName,this); 48 } else if (logiciel == nomDeLogiciel::usersprogram) { 49 inputFileName = "dummy"; 50 prog = new softwareUsersprogram(inputFileName, this); 51 } else if (logiciel == nomDeLogiciel::test) { 52 prog = new softwareTest(inputFileName, this); 53 } else { 54 prog = new softwareUnknown(); // xx 55 } 56 57 sectionToExecute_[sectionToExecuteNumber]->setSoftware(prog); 58 return true; 59 } 60 */ -
Interface_Web/trunk/pspaWT/sources/controler/src/sector.cc
r449 r455 8 8 9 9 #include "sector.h" 10 #include "softwareParmela.h" 11 #include "softwareTransport.h" 12 #include "softwareGenerator.h" 13 #include "softwareGenerator.h" 14 #include "softwareUsersprogram.h" 15 #include "softwareTest.h" 16 #include "softwareMadx.h" //xx 17 #include "softwareUnknown.h" //xx 10 18 11 sector::sector(std::string name): 19 #include "sectionToExecute.h" 20 #include "dataManager.h" 21 22 sector::sector(dataManager* data, std::string name): 12 23 reflected_(false), 13 24 duplicatedFrom_(NULL), 14 25 repetitionNumber_(1), 15 name_(name) 26 name_(name), 27 dataManager_(data), 28 sectorParam_(this) 16 29 { 17 30 … … 20 33 sector::~sector() { 21 34 } 35 36 void sector::addElementAfter(abstractElement* currentElement ,abstractElement* previousElement){ 37 if (previousElement == NULL) { 38 if (sectionToExecute_.size() == 0) { 39 sectionToExecute_.push_back(new sectionToExecute(currentElement)); 40 } else { 41 sectionToExecute_.insert ( sectionToExecute_.begin() , new sectionToExecute(currentElement) ); 42 } 43 } else { 44 45 for (unsigned int i=0; i<sectionToExecute_.size(); i++) { 46 sectionToExecute* section = sectionToExecute_[i]; 47 if (section->insertAfter(previousElement,currentElement)) { 48 return; 49 } 50 } 51 } 52 } 53 54 void sector::clearSectionToExecute() 55 { 56 unsigned k; 57 for(k = 0; k < sectionToExecute_.size(); k++) 58 { 59 if ( sectionToExecute_[k] != NULL ) clearSectionToExecute(k); 60 } 61 sectionToExecute_.clear(); 62 } 63 64 void sector::clearSectionToExecute(int a) 65 { 66 cout << " dataManager::clearSectionToExecute : effacement de la section d'index = " << a << endl; 67 if (a < 0) return; 68 if (a >= (int)sectionToExecute_.size()) return; 69 70 // lors de la creation de la section on a fait un 'new' d'un 71 // softwareXXXX : on fait ici le 'delete' 72 73 const abstractSoftware* soft = sectionToExecute_.at(a)->getSoftware(); 74 if ( soft != NULL ) delete soft; 75 sectionToExecute_.erase (sectionToExecute_.begin()+a); 76 } -
Interface_Web/trunk/pspaWT/sources/controler/src/sectorParameters.cc
r436 r455 5 5 #define BAVARD 1 6 6 7 sectorParameters::sectorParameters() 7 sectorParameters::sectorParameters(sector* sect): 8 sector_(sect) 8 9 { 9 10 geometry_= string("CIRCULAR"); 10 sectors _.push_back(statements("vide",vector<string>()));11 sectors _.back().second.push_back("xxx");12 sectors _.back().second.push_back("xxx");13 sectors _.back().second.push_back("Unchecked");14 sectors _.back().second.push_back("1");11 sectorsStatements_.push_back(statements("vide",vector<string>())); 12 sectorsStatements_.back().second.push_back("xxx"); 13 sectorsStatements_.back().second.push_back("xxx"); 14 sectorsStatements_.back().second.push_back("Unchecked"); 15 sectorsStatements_.back().second.push_back("1"); 15 16 } 16 17 … … 45 46 void sectorParameters::raz() 46 47 { 47 if(!sectors _.empty()) sectors_.clear();48 if(!sectorsStatements_.empty()) sectorsStatements_.clear(); 48 49 } 49 50 … … 52 53 ostringstream sortie; 53 54 sortie << " sectors " << endl; 54 sortie << sectors _.size() << endl;55 for(int i = 0; i < sectors _.size(); i++) {56 sortie << sectors _.at(i).first << " " << sectors_.at(i).second.at(0) << " " << sectors_.at(i).second.at(1) << " " << sectors_.at(i).second.at(2) << " " << sectors_.at(i).second.at(3) << endl;55 sortie << sectorsStatements_.size() << endl; 56 for(int i = 0; i < sectorsStatements_.size(); i++) { 57 sortie << sectorsStatements_.at(i).first << " " << sectorsStatements_.at(i).second.at(0) << " " << sectorsStatements_.at(i).second.at(1) << " " << sectorsStatements_.at(i).second.at(2) << " " << sectorsStatements_.at(i).second.at(3) << endl; 57 58 } 58 59 return sortie.str(); … … 66 67 for(int i = 0; i < n; i++) { 67 68 ifs >> txt; 68 sectors _.push_back(statements(txt,vector<string>()));69 sectorsStatements_.push_back(statements(txt,vector<string>())); 69 70 for(int j = 0; j < 4; j++) { 70 71 ifs >> txt; 71 sectors _.back().second.push_back(txt);72 sectorsStatements_.back().second.push_back(txt); 72 73 } 73 74 } … … 104 105 105 106 vector<statements> sectorParameters::getSectors() const { 106 return sectors _;107 return sectorsStatements_; 107 108 } 108 109 … … 114 115 #endif 115 116 116 if(!sectors _.empty()) sectors_.clear();117 if(!sectorsStatements_.empty()) sectorsStatements_.clear(); 117 118 118 119 for(int i = 0; i < v.size(); i++) { 119 sectors _.push_back(statements(v.at(i).first,vector<string>()));120 sectorsStatements_.push_back(statements(v.at(i).first,vector<string>())); 120 121 for(int j = 0; j < 4; j++) 121 sectors _.back().second.push_back(v.at(i).second.at(j));122 sectorsStatements_.back().second.push_back(v.at(i).second.at(j)); 122 123 } 123 124 124 125 #if BAVARD > 0 125 cout << "sectors _.size()= " << sectors_.size() << endl;126 for(int i = 0; i < sectors _.size(); i++) {127 cout << "name= " << sectors _.at(i).first << ", de " << sectors_.at(i).second.at(0) << ", Ã " << sectors_.at(i).second.at(1) << ", reflection = " << sectors_.at(i).second.at(2) << ", repeat= " << sectors_.at(i).second.at(3) << endl << endl;126 cout << "sectorsStatements_.size()= " << sectorsStatements_.size() << endl; 127 for(int i = 0; i < sectorsStatements_.size(); i++) { 128 cout << "name= " << sectorsStatements_.at(i).first << ", de " << sectorsStatements_.at(i).second.at(0) << ", Ã " << sectorsStatements_.at(i).second.at(1) << ", reflection = " << sectorsStatements_.at(i).second.at(2) << ", repeat= " << sectorsStatements_.at(i).second.at(3) << endl << endl; 128 129 } 129 130 #endif -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareGenerator.cc
r442 r455 12 12 } 13 13 14 softwareGenerator::softwareGenerator(string inputFileName, globalParameters* globals, dataManager* dt) : abstractSoftware(inputFileName, globals, dt)14 softwareGenerator::softwareGenerator(string inputFileName, sectionToExecute* sect) : abstractSoftware(inputFileName, sect) 15 15 { 16 16 cout << " softwareUsersprogram::softwareGenerator ENREGISTREMENT " << endl; … … 19 19 } 20 20 21 bool softwareGenerator::createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin,string workingDir)21 bool softwareGenerator::createInputFile(particleBeam* beamBefore, string workingDir) 22 22 { 23 if ( !initComputationLimits(numeroDeb,numeroFin) ) return false; 24 25 if ( numeroDeb_ != numeroFin_ ) return false; 26 27 abstractElement* elPtr; 28 elPtr = dataManager_->getElementPointerFromNumero(numeroDeb_); 29 30 if ( elPtr->getNomdElement().getElementType() != nomdElements::RFgun ) { 23 abstractElement* firstElement = getSectionToExecute()->getElements().front(); 24 25 if ( firstElement->getNomdElement().getElementType() != nomdElements::RFgun ) { 31 26 dataManager_->consoleMessage(" softwareGenerator::createInputFile : the element must be rfgun " ); 32 27 cerr << " softwareGenerator::createInputFile : the element must be rfgun" << endl; … … 47 42 outfile << " Add=FALSE, N_add=0" << endl; 48 43 outfile << " Species='electrons'" << endl; 49 // outfile << elPtr->generatorOutputFlow() << endl;50 51 outfile << elementsData( elPtr->parametersToSoftware()) << endl;44 // outfile << firstElement->generatorOutputFlow() << endl; 45 46 outfile << elementsData(firstElement->parametersToSoftware()) << endl; 52 47 53 48 outfile << "/" << endl; … … 62 57 63 58 ostringstream sortie; 64 sortie << " EXECUTION DE GENERATOR DE l'ELEMENT " << numeroDeb_ << " A L'ELEMENT " << numeroFin_ << endl;59 sortie << " EXECUTION DE GENERATOR DE l'ELEMENT " << numeroDeb_deprecated_ << " A L'ELEMENT " << numeroFin_deprecated_ << endl; 65 60 66 61 string generatorJob = workingDir + "generator"; … … 97 92 98 93 bool result = true; 99 if ( !ComputationLimitsOk () ) return false;100 101 if ( numeroDeb_ != numeroFin_ ) {94 if ( !ComputationLimitsOk_deprecated() ) return false; 95 96 if ( numeroDeb_deprecated_ != numeroFin_deprecated_ ) { 102 97 dataManager_->consoleMessage(" softwareGenerator::buildBeamAfterElements : only one element (rfgun) must be calculated " ); 103 98 return false; -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareMadx.cc
r436 r455 8 8 } 9 9 10 softwareMadx::softwareMadx(string inputFileName,sect orParameters* lattice,dataManager* dt) : abstractSoftware(inputFileName,lattice,dt)10 softwareMadx::softwareMadx(string inputFileName,sectionToExecute* sect) : abstractSoftware(inputFileName,sect) 11 11 { 12 12 nameOfSoftware_ = nomDeLogiciel("madx"); … … 16 16 } 17 17 18 bool softwareMadx::createInputFile(particleBeam* beamBefore, unsigned int numeroDeb,unsigned int numeroFin,string workingDir)18 bool softwareMadx::createInputFile(particleBeam* beamBefore, string workingDir) 19 19 { 20 20 cout << "***********************************" << endl; … … 22 22 23 23 dataManager_->consoleMessage(" softwareMadx::createInputFile"); 24 if (!initComputationLimits(numeroDeb,numeroFin)) return false;25 24 26 25 string name = workingDir + inputFileName_; … … 33 32 } 34 33 35 cout << " softwareMadx::createInputFile(...) lecture des elts de " << numeroDeb_ << " Ã " << numeroFin_<< endl;34 cout << " softwareMadx::createInputFile(...) lecture des elts " << endl; 36 35 37 36 // element label ////////////////////////// … … 40 39 41 40 abstractElement* elPtr; 42 for(unsigned k = numeroDeb_; k <= numeroFin_; k++) 41 std::vector <abstractElement*> elements = getSectionToExecute()->getElements(); 42 for(unsigned k = 0; k < elements.size(); k++) 43 43 { 44 elPtr = dataManager_->getElementPointerFromNumero(k);44 elPtr = elements[k]; 45 45 //cout << " debug:: element [" << k << "] " << elPtr->getNomdElement().getExpandedName() << endl; 46 46 vector<statements> v= elPtr->parametersToSoftware(); … … 52 52 outfile << endl; // saut de ligne 53 53 54 //_______________________________________________________ 55 // FIXME Francois !!!!! 56 //_______________________________________________________ 57 /* 54 58 vector<statements> u = sectParamPtr_->getSectors(); 55 59 for(unsigned int i = 0; i < u.size(); i++) { … … 59 63 unsigned bi = dataManager_->getNumeroFromElementLabel(u.at(i).second.at(1)); 60 64 61 for(unsigned k = numeroDeb_; k <= numeroFin_; k++) { 62 elPtr = dataManager_->getElementPointerFromNumero(k); 65 std::vector <abstractElement*> elements = getSectionToExecute()->getElements(); 66 for(unsigned k = 0; k < elements.size(); k++) { 67 elPtr = elements[k]; 63 68 64 69 if(k >= ai && k <= bi) { … … 85 90 ostringstream os; 86 91 os << "all: " << "line=("; 87 for(unsigned k = numeroDeb_; k <= numeroFin_; k++) {88 elPtr = dataManager_->getElementPointerFromNumero(k);92 for(unsigned k = 0; k < elements.size(); k++) { 93 elPtr = elements[k]; 89 94 bool isMember = false; 90 95 … … 112 117 }// i 113 118 114 if(isMember && k == numeroFin_) os << ");";115 119 if(isMember && k == (elements.size()-1)) os << ");"; 120 116 121 if(!isMember) { 117 if(k == numeroFin_) os << elPtr->getLabel() << ");";122 if(k == (elements.size()-1)) os << elPtr->getLabel() << ");"; 118 123 else os << elPtr->getLabel() << ","; 119 124 } … … 131 136 outfile << "twiss,save,centre,file = "+workingDir+"twiss.out;" << endl; //p51 132 137 outfile << "stop;" << endl; 138 139 */ 140 //_______________________________________________________ 141 // FIXME Francois !!!!! 142 //_______________________________________________________ 133 143 134 144 outfile.close(); … … 174 184 175 185 ostringstream sortie; 176 sortie << " run madx from " << numeroDeb_ << " to " << numeroFin_<< endl;186 sortie << " run madx " << endl; 177 187 178 188 string mjob = workingDir + "madx64"; -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc
r418 r455 12 12 } 13 13 14 softwareParmela::softwareParmela(string inputFileName, globalParameters* globals, dataManager* dt) : abstractSoftware(inputFileName, globals, dt)14 softwareParmela::softwareParmela(string inputFileName,sectionToExecute* sect) : abstractSoftware(inputFileName, sect) 15 15 { 16 16 nameOfSoftware_ = nomDeLogiciel("parmela"); … … 26 26 void softwareParmela::setRelativeParmelaElementIndices() { 27 27 relativeParmelaElementIndices_.clear(); 28 relativeParmelaElementIndices_.resize(numeroFin_ - numeroDeb_ + 1, -1);28 relativeParmelaElementIndices_.resize(numeroFin_deprecated_ - numeroDeb_deprecated_ + 1, -1); 29 29 cout << " setRelativeParmelaElementIndices() taille a priori : " << relativeParmelaElementIndices_.size() << endl; 30 abstractElement* elPtr = dataManager_->getElementPointerFromNumero(numeroDeb_);30 abstractElement* elPtr = getSectionToExecute()->getElements().front(); 31 31 32 32 bool there_is_rfgun = ( elPtr->getNomdElement().getElementType() == nomdElements::RFgun ); … … 34 34 // les elements de parmela sont indexes de 1 Ã max, s'il n'y a pas de rfgun 35 35 if ( !there_is_rfgun ) { 36 offsetNumElem = numeroDeb_ -1;36 offsetNumElem = numeroDeb_deprecated_ -1; 37 37 // les elements de parmela sont indexes de 0 Ã max, s'il y a un rfgun 38 38 } else { 39 offsetNumElem = numeroDeb_ ;39 offsetNumElem = numeroDeb_deprecated_; 40 40 } 41 41 42 42 // index du premier element de parmela 43 int id= numeroDeb_ - offsetNumElem;43 int id= numeroDeb_deprecated_ - offsetNumElem; 44 44 unsigned k; 45 45 unsigned curseur = 0; 46 for ( k= numeroDeb_; k <= numeroFin_; k++ ) {47 abstractElement* elem = dataManager_->getElementPointerFromNumero(k);46 for ( k=0; k < getSectionToExecute()->getElements().size() ; k++ ) { 47 abstractElement* elem = getSectionToExecute()->getElements()[k]; 48 48 cout << " liste PARMELA no absolu " << k << " relatif provisoire " << relativeParmelaElementIndices_.at(curseur) << endl; 49 49 // if ( elem->is_accepted_by_software(nameOfSoftware_) == TBoolOk ) { … … 58 58 59 59 60 bool softwareParmela::createInputFile(particleBeam* beamBefore, unsigned int numeroDeb,unsigned int numeroFin,string workingDir)60 bool softwareParmela::createInputFile(particleBeam* beamBefore, string workingDir) 61 61 { 62 62 unsigned int k; 63 if ( !initComputationLimits(numeroDeb,numeroFin) ) return false; 63 64 64 setRelativeParmelaElementIndices(); 65 65 string name = workingDir + inputFileName_; … … 72 72 } 73 73 74 abstractElement* elPtr ;74 abstractElement* elPtr = getSectionToExecute()->getElements().front(); 75 75 double initalKineticEnergy = 0.0; 76 elPtr = dataManager_->getElementPointerFromNumero(numeroDeb_); 77 bool there_is_rfgun = ( elPtr->getNomdElement().getElementType() == nomdElements::RFgun ); 76 bool there_is_rfgun = (elPtr->getNomdElement().getElementType() == nomdElements::RFgun ); 78 77 79 78 if ( !there_is_rfgun ) { … … 84 83 // offsetNumElem_ = numeroDeb_ -1; 85 84 } else { 86 elPtr->setPhaseStep( globParamPtr_->getIntegrationStep() );85 elPtr->setPhaseStep( dataManager_->getGlobalParameters()->getIntegrationStep() ); 87 86 initalKineticEnergy = elPtr->getInitialKineticEnergy(); 88 87 // les elements de parmela sont indexes de 0 Ã max, s'il y a un rfgun 89 // offsetNumElem_ = numeroDeb_;90 88 } 91 89 92 90 outfile << "TITLE" << endl; 93 91 outfile << " titre provisoire " << endl; 94 outfile << "RUN /n0=1 /ip=999 /freq=" << globParamPtr_->getFrequency() << " /z0=0.0 /W0=" << initalKineticEnergy << " /itype=1" << endl;92 outfile << "RUN /n0=1 /ip=999 /freq=" << dataManager_->getGlobalParameters()->getFrequency() << " /z0=0.0 /W0=" << initalKineticEnergy << " /itype=1" << endl; 95 93 outfile << "OUTPUT 0" << endl; 96 unsigned int premier = numeroDeb_ ;97 94 if ( there_is_rfgun ) { 98 // outfile << dataManager_->getElementPointerFromNumero(numeroDeb_)->parmelaOutputFlow(); 99 outfile << elementsData(dataManager_->getElementPointerFromNumero(numeroDeb_)->parametersToSoftware()); 100 premier++; 95 // outfile << dataManager_->getElementPointerFromNumero(numeroDeb_deprecated_)->parmelaOutputFlow(); 96 outfile << elementsData(elPtr->parametersToSoftware()); 101 97 } else { 102 98 outfile << "INPUT 0 /NP=" << beamBefore->getNbParticles() << endl; 103 99 } 104 100 105 for ( k = premier; k <= numeroFin_; k++) 101 // retrouver le sector !! 102 for ( k =1; k <= getSectionToExecute()->getElements().size(); k++) 106 103 { 107 elPtr = dataManager_->getElementPointerFromNumero(k); 108 if (elPtr) { 109 // outfile << elPtr->parmelaOutputFlow(); 110 outfile << elementsData(elPtr->parametersToSoftware()); 111 } 104 outfile << elementsData(getSectionToExecute()->getElements()[k]->parametersToSoftware()); 112 105 } 113 106 114 107 outfile << "ZOUT" << endl; 115 outfile << "START /wt=0.0 /dwt=" << globParamPtr_->getIntegrationStep() << " /nsteps=" << globParamPtr_->getNbSteps() << " nsc=" << globParamPtr_->getScPeriod() << " /nout=10" << endl;108 outfile << "START /wt=0.0 /dwt=" << dataManager_->getGlobalParameters()->getIntegrationStep() << " /nsteps=" << dataManager_->getGlobalParameters()->getNbSteps() << " nsc=" << dataManager_->getGlobalParameters()->getScPeriod() << " /nout=10" << endl; 116 109 outfile << "END" << endl; 117 110 outfile.close(); … … 125 118 126 119 ostringstream sortie; 127 sortie << " EXECUTION DE PARMELA DE l'ELEMENT " << numeroDeb_ << " A L'ELEMENT " << numeroFin_ << endl;120 sortie << " EXECUTION DE PARMELA DE l'ELEMENT " << numeroDeb_deprecated_ << " A L'ELEMENT " << numeroFin_deprecated_ << endl; 128 121 129 122 string parmelaJob = workingDir + "parmela"; … … 158 151 bool result = true; 159 152 160 if ( !ComputationLimitsOk () ) return false;153 if ( !ComputationLimitsOk_deprecated() ) return false; 161 154 unsigned curseur; 162 for(unsigned k = numeroDeb_; k <= numeroFin_; k++) 163 { 164 abstractElement* elem = dataManager_->getElementPointerFromNumero(k); 155 for ( unsigned int k=0; k < getSectionToExecute()->getElements().size() ; k++ ) { 156 abstractElement* elem = getSectionToExecute()->getElements()[k]; 165 157 if ( elem == NULL ) { 166 158 dataManager_->consoleMessage(" softwareParmela::buildBeamAfterElements : null pointer on element " ); … … 168 160 } 169 161 170 curseur = k - numeroDeb_ ;162 curseur = k - numeroDeb_deprecated_; 171 163 172 164 if ( relativeParmelaElementIndices_.at(curseur) < 0 ) { … … 192 184 bareParticle refPart; 193 185 vector<bareParticle> particles; 194 double freq= globParamPtr_->getFrequency();186 double freq= dataManager_->getGlobalParameters()->getFrequency(); 195 187 unsigned numeroParmel; 196 188 numeroParmel = (unsigned)relativeParmelaElementIndices_.at(curseur); -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareTest.cc
r386 r455 14 14 15 15 16 softwareTest::softwareTest(string inputFileName, globalParameters* globals, dataManager* dt) : abstractSoftware( inputFileName, globals, dt)16 softwareTest::softwareTest(string inputFileName,sectionToExecute* sect) : abstractSoftware(inputFileName, sect) 17 17 { 18 18 nameOfSoftware_ = nomDeLogiciel("test"); 19 19 } 20 20 21 bool softwareTest::createInputFile( particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin,string workingDir)21 bool softwareTest::createInputFile( particleBeam* beamBefore, string workingDir) 22 22 { 23 23 dataManager_->consoleMessage(" softwareTest::createInputFile " ); … … 39 39 bool result = true; 40 40 unsigned k; 41 for ( k= numeroDeb_ ; k <= numeroFin_; k++)41 for ( k= numeroDeb_deprecated_; k <= numeroFin_deprecated_; k++) 42 42 { 43 43 particleBeam* newDiag = dataManager_->updateCurrentDiagnostic(true); -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareTransport.cc
r418 r455 11 11 } 12 12 13 softwareTransport::softwareTransport(string inputFileName, globalParameters* globals, dataManager* dt) : abstractSoftware(inputFileName, globals, dt)13 softwareTransport::softwareTransport(string inputFileName,sectionToExecute* sect) : abstractSoftware(inputFileName, sect) 14 14 { 15 15 nameOfSoftware_ = nomDeLogiciel("transport"); … … 22 22 } 23 23 24 bool softwareTransport::createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin,string workingDir)24 bool softwareTransport::createInputFile(particleBeam* beamBefore, string workingDir) 25 25 { 26 26 27 27 28 29 if ( !initComputationLimits(numeroDeb,numeroFin) ) return false; 30 31 abstractElement* premierEl = NULL; 32 premierEl = dataManager_->getElementPointerFromNumero(numeroDeb_); 28 abstractElement* premierEl = getSectionToExecute()->getElements().front(); 33 29 34 30 // ceinture et bretelles … … 88 84 89 85 abstractElement* elPtr; 90 for (unsigned k = numeroDeb_; k <= numeroFin_; k++)86 for (unsigned k = 0; k < getSectionToExecute()->getElements().size(); k++) 91 87 { 92 elPtr = dataManager_->getElementPointerFromNumero(k);88 elPtr = getSectionToExecute()->getElements()[k]; 93 89 cout << "debug:: element [" << k << "] " << elPtr->getNomdElement().getExpandedName() << endl; 94 90 // outfile << elPtr->transportOutputFlow(); … … 109 105 110 106 ostringstream sortie; 111 sortie << " EXECUTION DE TRANSPORT DE " << numeroDeb_ << " a " << numeroFin_ << endl;107 sortie << " EXECUTION DE TRANSPORT DE " << numeroDeb_deprecated_ << " a " << numeroFin_deprecated_ << endl; 112 108 113 109 string transportJob = workingDir + "transport"; … … 145 141 146 142 bool result = true; 147 if ( !ComputationLimitsOk () ) return false;148 149 for (unsigned k = numeroDeb_; k <= numeroFin_; k++)143 if ( !ComputationLimitsOk_deprecated() ) return false; 144 145 for (unsigned k = 0; k < getSectionToExecute()->getElements().size(); k++) 150 146 { 151 abstractElement* ptr = dataManager_->getElementPointerFromNumero(k);147 abstractElement* ptr = getSectionToExecute()->getElements()[k]; 152 148 if ( ptr == NULL ) { 153 149 dataManager_->consoleMessage(" softwareTransport::buildBeamAfterElements : null pointer on element " ); -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareUnknown.cc
r431 r455 17 17 } 18 18 19 bool softwareUnknown::createInputFile(particleBeam* beamBefore, unsigned int numeroDeb,unsigned int numeroFin,string workingDir)19 bool softwareUnknown::createInputFile(particleBeam* beamBefore,sectionToExecute* sectionToExe, string workingDir) 20 20 { 21 21 return true; -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareUsersprogram.cc
r442 r455 10 10 } 11 11 12 softwareUsersprogram::softwareUsersprogram(string inputFileName, globalParameters* globals, dataManager* dt) : abstractSoftware(inputFileName, globals, dt)12 softwareUsersprogram::softwareUsersprogram(string inputFileName, sectionToExecute* sect) : abstractSoftware(inputFileName, sect) 13 13 { 14 14 cout << " softwareUsersprogram::softwareUsersprogram ENREGISTREMENT " << endl; … … 17 17 } 18 18 19 bool softwareUsersprogram::createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin,string workingDir)19 bool softwareUsersprogram::createInputFile(particleBeam* beamBefore, string workingDir) 20 20 { 21 21 22 abstractElement* element = getSectionToExecute()->getElements().front(); 22 23 23 if ( !initComputationLimits(numeroDeb,numeroFin) ) return false;24 if ( numeroDeb_ != numeroFin_ ) {25 cout << " ERROR softwareUsersprogram::createInputFile : plusieurs elements " << endl;26 return false;27 }28 29 abstractElement* element = NULL;30 element = dataManager_->getElementPointerFromNumero(numeroDeb_);31 24 // Dans le cas où l'element n'est pas snapshot 32 25 if ( element->getNomdElement().getElementType() != nomdElements::snapshot ) { … … 63 56 64 57 ostringstream sortie; 65 sortie << " EXECUTION DE " << nomProgram_ << " element " << numeroDeb_ <<endl;58 sortie << " EXECUTION DE " << nomProgram_ << endl; 66 59 67 60 string usersprogramJob = workingDir + nomProgram_; … … 103 96 104 97 105 if ( !ComputationLimitsOk () ) return false;106 98 if ( !ComputationLimitsOk_deprecated() ) return false; 99 107 100 // for (unsigned k = numeroDeb_; k <= numeroFin_; k++) 108 109 abstractElement* ptr = dataManager_->getElementPointerFromNumero(numeroDeb_);101 102 abstractElement* ptr = getSectionToExecute()->getElements().front(); 110 103 if ( ptr == NULL ) { 111 104 dataManager_->consoleMessage("ERROR softwareUsersprogram::buildBeamAfterElements : null pointer on element " ); -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_accelerator.h
r446 r455 6 6 #include <Wt/WContainerWidget> 7 7 #include <Wt/WScrollArea> 8 #include "GWt_pspaApplication.h" 8 #include <Wt/WComboBox> 9 #include <Wt/WDialog> 10 #include <Wt/WPdfImage> 11 #include <Wt/Chart/WCartesianChart> 12 #include <Wt/WLength> 13 9 14 #include "dataManager.h" 10 15 16 #include "GWt_dialog.h" 11 17 12 18 using namespace Wt; … … 18 24 19 25 public: 20 GWt_accelerator(WContainerWidget* parent,PspaApplication* pspa);26 GWt_accelerator(WContainerWidget*, dataManager*); 21 27 virtual ~GWt_accelerator(); 22 28 inline WContainerWidget* getAcceleratorDetailledView() {return acceleratorDetailledView_;}; 23 29 inline WLayout* getAcceleratorGlobalViewLayout() {return acceleratorGlobalViewLayout_;}; 24 inline PspaApplication* getControler() { return pspa_;}; 25 30 inline dataManager* getDataManager() { return dataManager_;}; 31 void faireDessin(); 32 WContainerWidget* createDrawingWidget(); 33 26 34 private : 27 35 WContainerWidget* acceleratorDetailledView_; 28 36 void addSector(); 29 37 void run(); 38 void closeGraphicDialog(); 39 void dialogOnGraphics(); 40 void dessiner(); 41 void faireDessinPhaseSpace(WContainerWidget* toto, particleBeam* beam, string elementLabel, string namex, string namey, int typeFaisceau); 42 void faireDessinEnveloppe(WContainerWidget* toto, string type); 43 void dessinerEnveloppe(); 44 void dessinerPhaseSpace(); 45 void dessinerHistogramme(); 46 void chartPlot2vec(WContainerWidget* toto,vector<double>& xcor,vector<double>& ycor,Wt::Chart::SeriesType seriesType,Wt::Chart::FillRangeType fillRange,Wt::Chart::AxisValue value,bool isGridLinesEnables,string title,string legendx,string legendy,int width,int height,bool makeIcon = false); 47 48 49 30 50 WLayout* acceleratorGlobalViewLayout_; 31 PspaApplication* pspa_; 51 dataManager* dataManager_; 52 WComboBox* choixElementDessin_; 53 WComboBox* choixTypeDessinFaisceau_; 54 WComboBox* choixAbsPhase_; 55 WComboBox* choixOrdPhase_; 56 WComboBox* choixEnveloppeDessin_; 57 WComboBox* choixHistoDessin_; 58 WComboBox* choixVariableHisto_; 59 GWt_dialog* graphicsDialog_; 60 WButtonGroup *group_; 61 vector<GWt_dialog*> eDialog_; 62 WContainerWidget* toto_; 63 string nameOfCase_; 64 32 65 }; 33 66 -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_dropZoneLigneFaisceau.h
r453 r455 2 2 #define GWT_DROPZONELIGNEFAISEAU_SEEN 3 3 4 #include " GWt_pspaApplication.h"4 #include "dataManager.h" 5 5 #include "GWt_ligneFaisceau.h" 6 6 … … 14 14 public : 15 15 16 GWt_dropZoneLigneFaisceau( PspaApplication* pspa_,GWt_ligneFaisceau* parent);16 GWt_dropZoneLigneFaisceau(dataManager* ,GWt_ligneFaisceau* ); 17 17 ~GWt_dropZoneLigneFaisceau(); 18 18 inline GWt_ligneFaisceau* getParent() {return parent_;}; 19 19 20 20 private: 21 void initialise( PspaApplication* pspa);21 void initialise( dataManager*); 22 22 void mouseOver(const WMouseEvent &e ); 23 23 void mouseOut(const WMouseEvent &e ); -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementBeam.h
r437 r455 18 18 19 19 GWt_elementBeam() {;} 20 GWt_elementBeam(GWt_elementLigneFaisceau* );20 GWt_elementBeam(GWt_elementLigneFaisceau*, abstractElement* ); 21 21 ~GWt_elementBeam() {;} 22 22 -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementBend.h
r437 r455 17 17 18 18 GWt_elementBend() {;} 19 GWt_elementBend(GWt_elementLigneFaisceau* );19 GWt_elementBend(GWt_elementLigneFaisceau*, abstractElement* ); 20 20 ~GWt_elementBend() {;} 21 21 -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementCell.h
r437 r455 26 26 27 27 GWt_elementCell() {;} 28 GWt_elementCell(GWt_elementLigneFaisceau* );28 GWt_elementCell(GWt_elementLigneFaisceau*, abstractElement* ); 29 29 ~GWt_elementCell() {;} 30 30 -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementDrift.h
r437 r455 20 20 21 21 GWt_elementDrift() {;} 22 GWt_elementDrift(GWt_elementLigneFaisceau* );22 GWt_elementDrift(GWt_elementLigneFaisceau*, abstractElement* ); 23 23 ~GWt_elementDrift() {;} 24 24 -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementFit.h
r437 r455 14 14 15 15 GWt_elementFit() {;} 16 GWt_elementFit(GWt_elementLigneFaisceau* );16 GWt_elementFit(GWt_elementLigneFaisceau*, abstractElement* ); 17 17 ~GWt_elementFit() {;} 18 18 -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementLigneFaisceau.h
r453 r455 4 4 #include "GWt_abstractElement.h" 5 5 #include "GWt_dropZoneLigneFaisceau.h" 6 #include " GWt_pspaApplication.h"6 #include "dataManager.h" 7 7 8 8 #include <Wt/WContainerWidget> … … 31 31 */ 32 32 33 GWt_elementLigneFaisceau(PspaApplication*,GWt_ligneFaisceau*); 34 GWt_elementLigneFaisceau(nomdElements::typedElement,PspaApplication*,GWt_ligneFaisceau*); 33 GWt_elementLigneFaisceau(dataManager*,GWt_ligneFaisceau*, abstractElement* abstractElem); 35 34 36 35 ~GWt_elementLigneFaisceau(); … … 46 45 47 46 void setElementLabel(std::string label); 48 void update(); 49 47 48 50 49 inline GWt_dropZoneLigneFaisceau* getDropZoneLeft() { 51 50 return dropZoneLeft_; … … 57 56 58 57 inline GWt_abstractElement* getGWt_AbstractElement() { 59 return GWt_abstractElement_ ;58 return GWt_abstractElement_deprecated_; 60 59 } 61 60 inline void setSoftwareName(std::string name) { … … 67 66 void removeDone(GWt_abstractElement*); 68 67 std::string getElementNumberInBeamLine(nomdElements el); 69 void initialize_ligneFaisceau( nomdElements::typedElement eType,GWt_ligneFaisceau* ligne);68 void initialize_ligneFaisceau(GWt_ligneFaisceau* ligne, abstractElement* abstractElem); 70 69 void mouseWentOut(); 71 70 void mouseWentOver(); 71 /** 72 Update the software of this element according to the sectionToExecute software. Will change the color of this object 73 */ 74 void updateSoftware(); 72 75 void setBGColor(const WColor); 73 76 GWt_dialog* messageDropZone_; … … 77 80 GWt_dropZoneLigneFaisceau* dropZoneRight_; 78 81 WText* elementLabel_; 79 PspaApplication* pspa_;80 GWt_abstractElement* GWt_abstractElement_ ;82 dataManager* dataManager_; 83 GWt_abstractElement* GWt_abstractElement_deprecated_; 81 84 WContainerWidget* elementContainer_; 82 85 WText* actionParameters_; -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementMpole.h
r437 r455 21 21 22 22 GWt_elementMpole() {;} 23 GWt_elementMpole(GWt_elementLigneFaisceau* );23 GWt_elementMpole(GWt_elementLigneFaisceau*, abstractElement*); 24 24 ~GWt_elementMpole() {;} 25 25 -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementRfgun.h
r437 r455 25 25 26 26 GWt_elementRfgun() {;} 27 GWt_elementRfgun(GWt_elementLigneFaisceau* );27 GWt_elementRfgun(GWt_elementLigneFaisceau* , abstractElement*); 28 28 ~GWt_elementRfgun() {;} 29 29 -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementSnapshot.h
r442 r455 21 21 22 22 GWt_elementSnapshot() {;} 23 GWt_elementSnapshot(GWt_elementLigneFaisceau*, int);23 GWt_elementSnapshot(GWt_elementLigneFaisceau*, abstractElement*, int); 24 24 ~GWt_elementSnapshot() {;} 25 25 -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementSoleno.h
r437 r455 26 26 27 27 GWt_elementSoleno() {;} 28 GWt_elementSoleno(GWt_elementLigneFaisceau* );28 GWt_elementSoleno(GWt_elementLigneFaisceau* , abstractElement*); 29 29 ~GWt_elementSoleno() {;} 30 30 -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_ligneFaisceau.h
r453 r455 15 15 16 16 class GWt_dropZoneLigneFaisceau; 17 class GWt_sector; 17 18 18 19 class compteur { … … 26 27 class GWt_ligneFaisceau : public WContainerWidget 27 28 { 28 PspaApplication* pspa_;29 29 dataManager* dataManager_; 30 30 31 public : 31 32 GWt_ligneFaisceau() {;} 33 GWt_ligneFaisceau(PspaApplication*); 34 32 33 GWt_ligneFaisceau(dataManager*,GWt_sector*); 34 35 35 /** 36 36 … … 75 75 76 76 void update(); 77 78 79 80 void update(int);81 77 78 /** update the status of the given index element 79 */ 80 void update_deprecated(int); 81 82 82 void initializeSoftwares(); 83 84 private : 85 void manageLineFaisceauLayout(); 86 GWt_dropZoneLigneFaisceau* allDropZone_; 87 WHBoxLayout* ligneFaisceauLayout_; 83 84 /** Return the sector of this beamLine */ 85 inline GWt_sector* getUISector() { return UI_sector_;}; 86 87 private : 88 void manageLineFaisceauLayout_deprecated(); 89 void buildBeamLineWidget(); 90 91 GWt_dropZoneLigneFaisceau* allDropZone_; 92 WHBoxLayout* ligneFaisceauLayout_; 93 GWt_sector* UI_sector_; 88 94 }; 89 95 -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h
r453 r455 14 14 #include <Wt/WComboBox> 15 15 #include <Wt/WPushButton> 16 #include <Wt/WDialog>17 #include <Wt/WPdfImage>18 #include <Wt/Chart/WCartesianChart>19 #include <Wt/WLength>20 16 #include <Wt/WButtonGroup> 21 17 … … 23 19 #include "GWt_console.h" 24 20 #include "GWt_softwarePanel.h" 25 #include "GWt_ligneFaisceau.h"26 21 #include "GWt_globalParameters.h" 27 22 #include "GWt_sectorParameters.h" … … 30 25 31 26 class GWt_abstractElementFactory; 27 class GWt_ligneFaisceau; 32 28 33 29 using namespace Wt; … … 39 35 40 36 dataManager* dtmanage_; 41 string nameOfCase_;42 37 string workingDir_; 43 38 WDialog* dialogSave_; … … 45 40 WLineEdit* saveNameEdit_; 46 41 WLineEdit* openNameEdit_; 47 GWt_ligneFaisceau* beamLine_ ;42 GWt_ligneFaisceau* beamLine_deprecated_; 48 43 49 44 GWt_globalParameters* globalParam_; 50 45 GWt_sectorParameters* sectorParam_; 51 52 GWt_dialog* graphicsDialog_; 53 WButtonGroup *group_; 54 vector<GWt_dialog*> eDialog_; 55 46 string nameOfCase_; 47 56 48 WText* probleme_; 57 WComboBox* choixElementDessin_;58 WComboBox* choixTypeDessinFaisceau_;59 WComboBox* choixAbsPhase_;60 WComboBox* choixOrdPhase_;61 WComboBox* choixEnveloppeDessin_;62 WComboBox* choixHistoDessin_;63 WComboBox* choixVariableHisto_;64 49 65 WContainerWidget* toto_;66 50 WString applicationDefaultTitle_; 67 51 68 GWt_softwarePanel* executeWidget_;69 52 WFileUpload* uploadFileSelectorWidget_; 70 53 GWt_console* console_; … … 73 56 WText* createTitle(const WString&); 74 57 WWidget* createPalette(WContainerWidget* parent); 75 WWidget* createBeamLine ();58 WWidget* createBeamLine_deprecated(); 76 59 WWidget* createExecuteWidget(); 77 WContainerWidget* createDrawingWidget();78 60 79 61 WWidget* createDashBoard(WContainerWidget*); 62 80 63 void messageBox1(); 81 64 void messageBox2(); … … 83 66 // extensions (.001, .002,...) pour les fichiers "snapshot" 84 67 int extensionFile_; 85 void closeGraphicDialog();86 68 87 69 void createDragImage(const char *url,const char *smallurl,const char *mimeType,WContainerWidget *p,WString()); … … 93 75 void fileTooLarge(); 94 76 95 void dialogOnGraphics();96 void faireDessinPhaseSpace(WContainerWidget* toto, particleBeam* beam, string elementLabel, string namex, string namey, int typeFaisceau);97 void faireDessinEnveloppe(WContainerWidget* toto, string type);98 void chartPlot2vec(WContainerWidget* toto,vector<double>& xcor,vector<double>& ycor,Wt::Chart::SeriesType seriesType,Wt::Chart::FillRangeType fillRange,Wt::Chart::AxisValue value,bool isGridLinesEnables,string title,string legendx,string legendy,int width,int height,bool makeIcon = false);99 100 77 bool removePathFromConfigName(string& config); 101 78 bool removeExtensionFromConfigName(string& config); 102 void removeBeamLine();103 79 104 void dessiner();105 void dessinerEnveloppe();106 void dessinerPhaseSpace();107 void dessinerHistogramme();108 109 80 public : 110 81 … … 122 93 } 123 94 124 inline GWt_softwarePanel* getExecuteWidget() {125 return executeWidget_;126 }127 128 95 inline GWt_ligneFaisceau* getBeamLine() { 129 return beamLine_ ;96 return beamLine_deprecated_; 130 97 } 131 98 -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sectionToExecute.h
r407 r455 7 7 8 8 class GWt_softwarePanel; 9 class GWt_sector; 9 10 10 11 class GWt_sectionToExecute : public Wt::WContainerWidget 11 12 { 12 13 public : 13 GWt_sectionToExecute(Wt::WComboBox*,Wt::WComboBox*,Wt::WComboBox*,Wt::WContainerWidget* buttonPanel,GWt_softwarePanel* sPanel );14 GWt_sectionToExecute(Wt::WComboBox*,Wt::WComboBox*,Wt::WComboBox*,Wt::WContainerWidget* buttonPanel,GWt_softwarePanel* sPanel,GWt_sector*); 14 15 15 16 ~GWt_sectionToExecute() {;} … … 65 66 Wt::WContainerWidget* warningsContainer_; 66 67 Wt::WContainerWidget* errorsContainer_; 68 GWt_sector* UI_sector_; 67 69 }; 68 70 -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sector.h
r453 r455 6 6 #include <Wt/WContainerWidget> 7 7 #include "sector.h" 8 #include "GWt_pspaApplication.h"9 8 #include "GWt_accelerator.h" 9 #include "GWt_ligneFaisceau.h" 10 10 11 11 using namespace Wt; … … 17 17 18 18 public: 19 GWt_sector(GWt_accelerator* parent,sector*);19 GWt_sector(GWt_accelerator*,sector*); 20 20 virtual ~GWt_sector(); 21 void createWidgetBeamLine(PspaApplication* pspa,WContainerWidget* parent); 22 21 void createWidgetBeamLine(WContainerWidget* parent); 22 /* Return the controler sector element for this UI sector*/ 23 inline sector* getSectorControler() {return sectorControler_;}; 24 inline GWt_softwarePanel* getExecuteWidget() { 25 return executeWidget_; 26 } 27 /** 28 Get the accelerator for this sector 29 */ 30 inline GWt_accelerator* getAccelerator() { 31 return UI_Accelerator_; 32 } 33 23 34 private : 24 GWt_ligneFaisceau* beamLine_;35 GWt_ligneFaisceau* UI_beamLine_; 25 36 void setIcon(WLayout*); 26 37 void displayWidgetBeamLine(); 27 GWt_accelerator* parent_; 28 sector* sector_; 38 GWt_accelerator* UI_Accelerator_; 39 sector* sectorControler_; 40 GWt_softwarePanel* executeWidget_; 41 29 42 }; 30 43 -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sectorParameters.h
r436 r455 19 19 class GWt_sectorParameters : public WContainerWidget 20 20 { 21 dataManager* dt_;22 21 vector<statements> sectors_; 23 22 … … 33 32 WGroupBox *gb_; 34 33 35 void createSector ();36 WContainerWidget* buttons (int);34 void createSector_deprecated(); 35 WContainerWidget* buttons_deprecated(int); 37 36 void dialogDone(WDialog::DialogCode code); 38 37 void add(); … … 43 42 public : 44 43 45 GWt_sectorParameters() {;} 46 GWt_sectorParameters(dataManager*); 44 GWt_sectorParameters() {;}; 47 45 virtual ~GWt_sectorParameters() {;} 48 46 49 void execDialog ();47 void execDialog_deprecated(); 50 48 void setText(WText*); 51 49 }; -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_softwarePanel.h
r449 r455 20 20 21 21 class PspaApplication; 22 class GWt_sector; 22 23 23 24 class GWt_softwarePanel : public WContainerWidget … … 25 26 public : 26 27 27 GWt_softwarePanel(dataManager*, PspaApplication*,WContainerWidget*);28 GWt_softwarePanel(dataManager*, GWt_sector*); 28 29 virtual ~GWt_softwarePanel(); 29 30 … … 45 46 WPushButton *exec_go_; 46 47 WContainerWidget* contenuSections_; 47 PspaApplication* pspa_;48 GWt_sector* UIsector_; 48 49 49 50 std::vector <GWt_sectionToExecute*> sections_; -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_accelerator.cc
r446 r455 8 8 #include <Wt/WHBoxLayout> 9 9 #include <Wt/WComboBox> 10 #include <Wt/WRadioButton> 10 11 #include <Wt/WPushButton> 11 12 #include <Wt/WGroupBox> 13 #include <Wt/WStandardItemModel> 12 14 13 15 #include <string> 14 16 15 GWt_accelerator::GWt_accelerator(WContainerWidget* parent, PspaApplication* pspa) :17 GWt_accelerator::GWt_accelerator(WContainerWidget* parent, dataManager* dt) : 16 18 WContainerWidget(parent), 17 pspa_(pspa)19 dataManager_(dt) 18 20 { 19 21 setObjectName("accelerator"); 20 22 addStyleClass("acceleratorPanel"); 21 23 nameOfCase_ = "pspa"; // default // FIXME 24 25 22 26 WContainerWidget* menu = new WContainerWidget(this); 23 27 menu->addStyleClass("acceleratorMenu"); … … 59 63 runParameters->setMinimumSize(32,32); 60 64 65 WPushButton* boutongraphicalAnalysis = new WPushButton("",menu); 66 boutongraphicalAnalysis->setStyleClass("histoButton"); 67 boutongraphicalAnalysis->setToolTip ("analyse graphique"); 68 boutongraphicalAnalysis->setMaximumSize(32,32); 69 boutongraphicalAnalysis->setMinimumSize(32,32); 70 71 61 72 new WBreak(this); 62 73 … … 79 90 addSectorParameters->clicked().connect(this,&GWt_accelerator::addSector); 80 91 runParameters->clicked().connect(this,&GWt_accelerator::run); 81 92 boutongraphicalAnalysis->clicked().connect(this, &GWt_accelerator::dialogOnGraphics); 93 94 graphicsDialog_ = new GWt_dialog("graphical analysis",createDrawingWidget(),false); 95 graphicsDialog_->setMinimumSize(400,400); 96 graphicsDialog_->setClosable(true); 97 graphicsDialog_->hide(); 82 98 83 99 } … … 90 106 void GWt_accelerator::addSector() 91 107 { 92 sector* sect = pspa_->getDataManager()->addNewSector();108 sector* sect = getDataManager()->addNewSector(); 93 109 GWt_sector* addedSector = new GWt_sector(this,sect); 94 110 } … … 97 113 { 98 114 } 115 116 void GWt_accelerator::faireDessin() 117 { 118 choixElementDessin_->clear(); 119 choixHistoDessin_->clear(); 120 121 for (unsigned k = 0; k < getDataManager()->getSectors().size(); k++) { 122 sector* sector = getDataManager()->getSectors()[k]; 123 for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) { 124 sectionToExecute* section = sector->getSectionsToExecute()[l]; 125 for (unsigned m = 0; m < section->getElements().size(); m++) { 126 127 abstractElement* elPtr = section->getElements()[m]; 128 // if(elPtr->getNomdElement().getElementType() == snapshot) continue; 129 130 choixElementDessin_->addItem(elPtr->getLabel()); 131 choixHistoDessin_->addItem(elPtr->getLabel()); 132 } 133 } 134 } 135 } 136 137 WContainerWidget* GWt_accelerator::createDrawingWidget() 138 { 139 WGridLayout *glayout= new WGridLayout(); 140 WContainerWidget* dessin = new WContainerWidget(); 141 dessin->setLayout(glayout); 142 143 group_ = new Wt::WButtonGroup(this); 144 145 ///////////////////////////////////////////////////////////////////// 146 147 choixEnveloppeDessin_ = new WComboBox(); 148 choixEnveloppeDessin_->addItem("x"); 149 // choixEnveloppeDessin_->addItem("y"); 150 Wt::WRadioButton *button1= new WRadioButton(" enveloppe"); 151 group_->addButton(button1,1); 152 glayout->addWidget(button1,0,1); 153 glayout->addWidget(choixEnveloppeDessin_,0,2); 154 ///////////////////////////////////////////////////////////////////// 155 156 choixElementDessin_ = new WComboBox(); 157 choixElementDessin_->setMinimumSize(50,10); 158 choixTypeDessinFaisceau_ = new WComboBox(); 159 choixTypeDessinFaisceau_->addItem("courant_snyder"); 160 choixTypeDessinFaisceau_->addItem("macroparticles"); 161 Wt::WRadioButton *button2= new WRadioButton(" phase space after element"); 162 163 choixAbsPhase_ = new WComboBox(); 164 choixAbsPhase_->addItem("x"); 165 choixAbsPhase_->addItem("y"); 166 choixAbsPhase_->addItem("dz"); 167 choixAbsPhase_->addItem("xp"); 168 choixAbsPhase_->addItem("yp"); 169 choixAbsPhase_->addItem("dE/E"); 170 choixAbsPhase_->setCurrentIndex(0); 171 172 choixOrdPhase_ = new WComboBox(); 173 choixOrdPhase_->addItem("x"); 174 choixOrdPhase_->addItem("y"); 175 choixOrdPhase_->addItem("dz"); 176 choixOrdPhase_->addItem("xp"); 177 choixOrdPhase_->addItem("yp"); 178 choixOrdPhase_->addItem("dE/E"); 179 choixOrdPhase_->setCurrentIndex(3); 180 181 group_->addButton(button2,2); 182 glayout->addWidget(button2,1,1); 183 glayout->addWidget(choixElementDessin_,1,2); 184 glayout->addWidget(choixTypeDessinFaisceau_,1,3); 185 // glayout->addWidget(new WText("abs. :"),2,2); 186 glayout->addWidget(choixAbsPhase_,2,2); 187 // glayout->addWidget(new WText("ord. :"),2,4); 188 glayout->addWidget(choixOrdPhase_,2,3); 189 ///////////////////////////////////////////////////////////////////// 190 191 choixVariableHisto_= new WComboBox(); 192 choixVariableHisto_->addItem("x"); 193 choixVariableHisto_->addItem("y"); 194 choixVariableHisto_->addItem("z"); 195 choixVariableHisto_->addItem("xp"); 196 choixVariableHisto_->addItem("yp"); 197 choixVariableHisto_->addItem("dE/E"); 198 choixVariableHisto_->setCurrentIndex(5); 199 200 choixHistoDessin_ = new WComboBox(); 201 Wt::WRadioButton *button3= new WRadioButton(" histogram after element "); 202 group_->addButton(button3,3); 203 204 glayout->addWidget(button3,3,1); 205 glayout->addWidget(choixHistoDessin_,3,2); 206 glayout->addWidget(choixVariableHisto_,3,3); 207 ///////////////////////////////////////////////////////////////////// 208 209 WPushButton *close= new WPushButton("close"); 210 glayout->addWidget(close,4,1); 211 close->clicked().connect(this,&GWt_accelerator::closeGraphicDialog); 212 213 WPushButton *draw= new WPushButton("draw"); 214 glayout->addWidget(draw,4,2,2,1); 215 draw->clicked().connect(this,&GWt_accelerator::dessiner); 216 ///////////////////////////////////////////////////////////////////// 217 218 toto_ = new WContainerWidget(); 219 dessin->addWidget(toto_); 220 return dessin; 221 } 222 223 224 void GWt_accelerator::dialogOnGraphics() 225 { 226 graphicsDialog_->show(); 227 } 228 229 230 void GWt_accelerator::closeGraphicDialog() 231 { 232 cout << " close graphicsDialog_" << endl; 233 for(unsigned i = 0; i < eDialog_.size(); i++) eDialog_[i]->done(WDialog::Rejected); 234 eDialog_.clear(); 235 graphicsDialog_->done(WDialog::Rejected); 236 } 237 238 239 240 void GWt_accelerator::dessiner() 241 { 242 int k= group_->checkedId(); 243 cout << "dessiner k= " << k << endl; 244 245 switch(k) { 246 case 1: 247 dessinerEnveloppe(); 248 break; 249 case 2: 250 dessinerPhaseSpace(); 251 break; 252 case 3: 253 dessinerHistogramme(); 254 break; 255 default: 256 GWt_dialog graphicalWarning("graphical analysis","select a button",GWt_dialog::Warning,false,true); 257 graphicalWarning.exec(); 258 break; 259 } 260 } 261 262 void GWt_accelerator::dessinerPhaseSpace() 263 { 264 265 int typeFaisceau = choixTypeDessinFaisceau_->currentIndex(); 266 // int index = choixElementDessin_->currentIndex(); 267 string nameAbs = choixAbsPhase_->currentText().toUTF8(); 268 string nameOrd = choixOrdPhase_->currentText().toUTF8(); 269 if ( nameAbs == nameOrd ) { 270 GWt_dialog phaseSpaceError(" graphical analysis", "the beam coordinates must be different !", GWt_dialog::Error, false,true); 271 phaseSpaceError.exec(); 272 return; 273 } 274 string elementLabel = choixElementDessin_->currentText().toUTF8(); 275 particleBeam* beam = dataManager_->getDiagnosticBeam_deprecated(elementLabel); 276 // particleBeam* beam = dtmanage_->getDiagnosticBeam(index); 277 278 if ( beam == NULL ) { 279 GWt_dialog warningBeamState(" graphical analysis", "the beam does not exist at the end of this element !", GWt_dialog::Error, false,true); 280 warningBeamState.exec(); 281 return; 282 } 283 284 toto_->clear(); 285 faireDessinPhaseSpace(toto_, beam, elementLabel, nameAbs, nameOrd, typeFaisceau); 286 287 // if ( typeFaisceau == 0 ) 288 // { 289 // if ( !beam->momentRepresentationOk() ) beam->buildMomentRepresentation(); 290 // faireDessinTransport(toto_, beam, nameAbs, nameOrd ); 291 // } 292 // else if ( typeFaisceau == 1 ) 293 // { 294 // if ( beam->particleRepresentationOk() ) faireDessinParmela(toto_, beam, nameAbs, nameOrd ); 295 // else { 296 // GWt_dialog warningBeamState(" graphical analysis", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true); 297 // warningBeamState.exec(); 298 // } 299 // } 300 // else { 301 // GWt_dialog warningTypeDrawing(" graphical analysis", "type of drawing not programmed !", GWt_dialog::Error, false,true); 302 // warningTypeDrawing.exec(); 303 // } 304 } 305 306 void GWt_accelerator::dessinerEnveloppe() 307 { 308 toto_->clear(); 309 310 int typeEnveloppe = choixEnveloppeDessin_->currentIndex(); 311 if ( typeEnveloppe == 0 ) 312 { 313 faireDessinEnveloppe(toto_, "x"); 314 } 315 else { 316 GWt_dialog warningTypeEnveloppe(" graphical analysis", "type of enveloppe drawing not programmed !", GWt_dialog::Error, false,true); 317 warningTypeEnveloppe.exec(); 318 } 319 } 320 321 void GWt_accelerator::faireDessinEnveloppe(WContainerWidget* toto, string type) 322 { 323 324 std::time_t result = std::time(NULL); 325 326 GWt_dialog* envDialog = new GWt_dialog(WString("enveloppe (")+std::asctime(std::localtime(&result))+")",toto,false); 327 eDialog_.push_back(envDialog); 328 envDialog->setMinimumSize(400,400); 329 envDialog->setClosable(true); 330 envDialog->show(); 331 332 // unsigned nbel = dtmanage_->getBeamLineSize(); 333 vector<double> xcor; 334 vector<double> ycor; 335 string titre; 336 string legendx; 337 string legendy; 338 dataManager_->donneesRmsEnveloppe(type,xcor,ycor,titre,legendx,legendy); 339 340 Wt::Chart::SeriesType seriesType = Wt::Chart::LineSeries; 341 Wt::Chart::FillRangeType fillRange = Wt::Chart::NoFill; 342 Wt::Chart::AxisValue location = Wt::Chart::ZeroValue; 343 bool isGridLinesEnabled = false; 344 chartPlot2vec(envDialog->contents(),xcor,ycor,seriesType,fillRange,location,isGridLinesEnabled,titre,legendx,legendy,500,300); 345 } 346 347 void GWt_accelerator::faireDessinPhaseSpace(WContainerWidget* toto, particleBeam* beam, string elementLabel, string namex, string namey, int typeFaisceau) 348 { 349 350 vector<double> xcor; 351 vector<double> ycor; 352 vector<string> legende; 353 string titre; 354 Wt::Chart::SeriesType seriesType; 355 356 if ( typeFaisceau == 0 ) { 357 seriesType = Wt::Chart::LineSeries; 358 titre = "phase space rms"; 359 beam->donneesDessinEllipse(xcor,ycor,legende,namex,namey); 360 } else if ( typeFaisceau == 1 ) { 361 seriesType = Wt::Chart::PointSeries; 362 titre = " phase space "; 363 beam->particlesPhaseSpaceData(xcor,ycor,legende,namex,namey); 364 // for ( int kk=0; kk < xcor.size(); kk++) 365 // { 366 // cout << " dess. phas. x= " << xcor.at(kk) << " x'= " << ycor.at(kk) << endl; 367 // } 368 } else { 369 GWt_dialog warningBeamState(" graphical analysis", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true); 370 warningBeamState.exec(); 371 return; 372 } 373 374 std::time_t result = std::time(NULL); 375 GWt_dialog* phaseSpaceDialog = new GWt_dialog(WString("phase space (")+std::asctime(std::localtime(&result))+")",toto,false); 376 eDialog_.push_back(phaseSpaceDialog); 377 phaseSpaceDialog->setMinimumSize(400,400); 378 phaseSpaceDialog->setClosable(true); 379 new WText(" case : " + nameOfCase_, phaseSpaceDialog->contents()); 380 new WBreak(phaseSpaceDialog->contents()); 381 new WText(" after element : " + elementLabel, phaseSpaceDialog->contents()); 382 383 for (int k=0 ; k < (int)legende.size(); k++) { 384 new WBreak(phaseSpaceDialog->contents()); 385 new WText(legende.at(k), phaseSpaceDialog->contents()); 386 } 387 388 Wt::Chart::FillRangeType fillRange = Wt::Chart::NoFill; 389 Wt::Chart::AxisValue location = Wt::Chart::ZeroValue; 390 bool isGridLinesEnabled = false; 391 chartPlot2vec(phaseSpaceDialog->contents(),xcor,ycor,seriesType,fillRange,location,isGridLinesEnabled,titre,namex,namey,500,300); 392 393 phaseSpaceDialog->show(); 394 } 395 396 397 void GWt_accelerator::dessinerHistogramme() 398 { 399 toto_->clear(); 400 401 // std::time_t result = std::time(NULL); 402 // GWt_dialog* histoDialog = new GWt_dialog(WString("histogramme (")+std::asctime(std::localtime(&result))+")",toto_,false); 403 // eDialog_.push_back(histoDialog); 404 // histoDialog->setMinimumSize(400,400); 405 // histoDialog->setClosable(true); 406 407 string elementLabel = choixHistoDessin_->currentText().toUTF8(); 408 particleBeam* beam = dataManager_->getDiagnosticBeam_deprecated(elementLabel); 409 if (beam == NULL) { 410 GWt_dialog warningBeamState("histogram","the beam does not exist at the end of this element !", GWt_dialog::Error, false,true); 411 warningBeamState.exec(); 412 return; 413 } 414 415 if (!beam->particleRepresentationOk()) { 416 GWt_dialog warningBeamState("histogram", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true); 417 warningBeamState.exec(); 418 return; 419 } 420 421 unsigned iabs= choixVariableHisto_->currentIndex(); 422 vector<double> xcor; 423 vector<int> hist; 424 // double out[3]= {0.0}; 425 vector<string> legende; 426 beam->histogramme(iabs,xcor,hist,legende); 427 428 cout<<"xcor.size()= "<<xcor.size()<<", hist.size()= "<<hist.size()<<endl; 429 ////////////////////////////////////////////////////////////////////////////////// 430 431 int n = hist.size(); 432 vector<double> x; 433 x.resize(2*n+2); 434 vector<double> y; 435 y.resize(2*n+2); 436 437 int j= 0; 438 x.at(j)= xcor[0]; 439 y.at(j)= 0.0; 440 j++; 441 x.at(j)= xcor[0]; 442 y.at(j)= hist[0]; 443 j++; 444 445 for (int i = 1; i < n; ++i) { 446 x.at(j)= xcor[i]; 447 y.at(j)= hist[i-1]; 448 j++; 449 x.at(j)= xcor[i]; 450 y.at(j)= hist[i]; 451 j++; 452 } 453 454 x.at(j)= xcor[n]; 455 y.at(j)= hist[n-1]; 456 j++; 457 x.at(j)= xcor[n]; 458 y.at(j)= 0.0; 459 ////////////////////////////////////////////////////////////////////////////////// 460 std::time_t result = std::time(NULL); 461 GWt_dialog* histoDialog = new GWt_dialog(WString("histogramme (")+std::asctime(std::localtime(&result))+")",toto_,false); 462 eDialog_.push_back(histoDialog); 463 histoDialog->setMinimumSize(400,400); 464 histoDialog->setClosable(true); 465 466 histoDialog->show(); 467 468 WContainerWidget *w= histoDialog->contents(); 469 470 // // legendes 471 // string unites[2]; 472 // if(iabs == 0 || iabs == 1 || iabs == 2) { 473 // unites[0]= unites[1]= " mm"; 474 // } 475 // if(iabs == 3 || iabs == 4) { 476 // unites[0]= unites[1]= " mrad"; 477 // } 478 // if(iabs == 5) { 479 // unites[0]= " MeV"; unites[1]= " KeV"; 480 // } 481 482 new WText(" case : " + nameOfCase_, w); 483 new WBreak(w); 484 new WText(" after element : " + elementLabel, w); 485 486 for (int k=0 ; k < (int)legende.size(); k++) { 487 new WBreak(w); 488 new WText(legende.at(k), w); 489 } 490 491 492 // new WText(" entries : "+ mixedTools::intToString((int)out[0]),w); 493 // new WBreak(w); 494 // new WText(" mean : "+ mixedTools::doubleToString(out[1])+unites[0],w); 495 // new WBreak(w); 496 // new WText(" sigma rms : "+ mixedTools::doubleToString(out[2])+unites[1],w); 497 ////////////////////////////////////////////////////////////////////////////////// 498 499 string titre; 500 if(iabs == 0) titre="x-coordinate"; 501 if(iabs == 1) titre="y-coordinate"; 502 if(iabs == 2) titre="z-coordinate"; 503 if(iabs == 3) titre="xp-divergence"; 504 if(iabs == 4) titre="yp-devergence"; 505 if(iabs == 5) titre="kinetic energy"; 506 507 string xname; 508 if(iabs == 0) xname=" x (mm)"; 509 if(iabs == 1) xname=" y (mm)"; 510 if(iabs == 2) xname=" z (mm)"; 511 if(iabs == 3) xname=" xp (mrad)"; 512 if(iabs == 4) xname=" yp (mrad)"; 513 if(iabs == 5) xname=" dEcin/Ecin (%)"; 514 515 string yname; 516 Wt::Chart::SeriesType seriesType = Wt::Chart::LineSeries; 517 Wt::Chart::FillRangeType fillRange = Wt::Chart::ZeroValueFill; 518 Wt::Chart::AxisValue location = Wt::Chart::MinimumValue; 519 bool isGridLinesEnabled = true; 520 chartPlot2vec(w,x,y,seriesType,fillRange,location,isGridLinesEnabled,titre,xname,yname,500,300); 521 } 522 523 524 525 void GWt_accelerator::chartPlot2vec(WContainerWidget* toto,vector<double>& xcor,vector<double>& ycor,Wt::Chart::SeriesType seriesType,Wt::Chart::FillRangeType fillRange,Wt::Chart::AxisValue value,bool isGridLinesEnables,string title,string legendx,string legendy,int width,int height,bool makeIcon) 526 { 527 int nbpts = xcor.size(); 528 cout << " PspaApplication::chartPlot2vec nbpts = " << nbpts << endl; 529 530 WStandardItemModel *model = new WStandardItemModel(nbpts, 2, toto); 531 for (int i = 0; i < nbpts; ++i) { 532 model->setData(i, 0, xcor.at(i)); 533 model->setData(i, 1, ycor.at(i)); 534 // cout << " PspaApplication::chartPlot2vec el= " << i+1 << " x= " << xcor.at(i) << " y= " << ycor.at(i) << endl; 535 } 536 // cout << " PspaApplication::chartPlot2vec FLAG 0 " << endl; 537 Wt::Chart::WCartesianChart *chart = new Wt::Chart::WCartesianChart(toto); 538 if (!makeIcon) chart->setTitle(title); 539 chart->initLayout(); 540 chart->setModel(model); // set the model 541 chart->setXSeriesColumn(0); // set the column that holds the X data 542 543 chart->setType(Wt::Chart::ScatterPlot); // set type to ScatterPlot 544 chart->setLegendEnabled(false); // enable the legend 545 546 // Provide space for the X and Y axis and title. 547 chart->setPlotAreaPadding(80, Left); 548 chart->setPlotAreaPadding(40, Bottom); 549 chart->setPlotAreaPadding(60, Top); 550 551 // Typically, for mathematical functions, you want the axes to cross 552 // at the 0 mark (value= ZeroValue) 553 chart->axis(Wt::Chart::XAxis).setLocation(value); 554 chart->axis(Wt::Chart::YAxis).setLocation(value); 555 556 // cout << " PspaApplication::chartPlot2vec FLAG 1 " << endl; 557 558 Wt::Chart::WDataSeries s(1,seriesType); 559 s.setPen(WColor("red")); 560 s.setFillRange(fillRange); 561 chart->addSeries(s); 562 563 Wt::Chart::WAxis& axis = chart->axis(Wt::Chart::XAxis); 564 axis.setLabelFormat("%.3f"); 565 axis.setTitle(legendx); 566 567 chart->axis(Wt::Chart::Y1Axis).setTitle(legendy); 568 569 if(isGridLinesEnables) { 570 axis.setGridLinesEnabled(true); 571 chart->axis(Wt::Chart::Y1Axis).setGridLinesEnabled(true); 572 } 573 // cout << " PspaApplication::chartPlot2vec FLAG 2 " << endl; 574 575 chart->resize(width,height); // WPaintedWidget must be given explicit size 576 chart->setMargin(10, Top | Bottom); // ? 577 chart->setMargin(WLength::Auto, Left | Right); //? 578 579 if (makeIcon) { 580 chart->setLegendEnabled(false); // enable the legend 581 chart->setPlotAreaPadding(0); 582 chart->setAxisPadding(0); 583 WFont xAxisFont = chart->axis(Wt::Chart::XAxis).labelFont(); 584 xAxisFont.setSize(8); 585 WFont yAxisFont = chart->axis(Wt::Chart::YAxis).labelFont(); 586 yAxisFont.setSize(8); 587 chart->axis(Wt::Chart::XAxis).setLabelFont(xAxisFont); 588 chart->axis(Wt::Chart::YAxis).setLabelFont(yAxisFont); 589 } 590 // cout << " PspaApplication::chartPlot2vec FLAG 3 " << endl; 591 592 #ifdef HAS_IMAGEMAGIC 593 594 // cout << " PspaApplication::chartPlot2vec FLAG MAGIC " << endl; 595 596 // no background 597 chart->setBackground(WBrush(Wt::NoBrush)); 598 599 // axis black 600 chart->axis(XAxis).setPen(WColor("black")); 601 chart->axis(YAxis).setPen(WColor("black")); 602 603 std::string name; 604 /* 605 Wt::WRasterImage pngImage("png", 1000, 1000); 606 Wt::WPainter p(&pngImage); 607 chart->paint(p); 608 name = workingDir_ + "/chart-"+sessionId ()+".png"; 609 std::ofstream f(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary); 610 pngImage.write(f); 611 */ 612 613 Wt::WPdfImage pdfImage("1000", "600"); 614 { 615 Wt::WPainter p1(&pdfImage); 616 chart->paint(p1); 617 } 618 619 name = workingDir_ + "/chart-"+sessionId ()+".pdf"; 620 std::ofstream f1(name.c_str(), std::ios::out | std::ios::binary); 621 pdfImage.write(f1); 622 623 new WText("<a href='workingArea/chart-"+sessionId ()+".pdf' target='_blank'>Sauvegarder l'image</a>",toto); 624 625 #endif 626 // cout << " PspaApplication::chartPlot2vec FLAG FIN" << endl; 627 628 } 629 630 631 632 -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_dropZoneLigneFaisceau.cc
r453 r455 10 10 #include "nomdElements.h" 11 11 12 GWt_dropZoneLigneFaisceau::GWt_dropZoneLigneFaisceau( PspaApplication* pspa,GWt_ligneFaisceau* parent) 12 class dataManager; 13 14 GWt_dropZoneLigneFaisceau::GWt_dropZoneLigneFaisceau( dataManager* data,GWt_ligneFaisceau* parent) 13 15 : WContainerWidget(), 14 16 parent_(parent) 15 17 { 16 initialise( pspa);18 initialise(data); 17 19 } 18 20 … … 21 23 } 22 24 23 void GWt_dropZoneLigneFaisceau::initialise( PspaApplication* pspa)25 void GWt_dropZoneLigneFaisceau::initialise(dataManager* dataMgr) 24 26 { 25 27 … … 32 34 33 35 // accept drops 34 vector <GWt_abstractElement*> elems = pspa->getAbstractElementFactory()->getAllElements();36 vector <GWt_abstractElement*> elems = dataMgr->getPspaApplication()->getAbstractElementFactory()->getAllElements(); 35 37 for(int a = 0; a < elems.size(); a++) { 36 38 acceptDrops(elems[a]->getMimeType()); -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementBeam.cc
r437 r455 8 8 #include <Wt/WPushButton> 9 9 10 GWt_elementBeam::GWt_elementBeam(GWt_elementLigneFaisceau* elemLigne )11 :GWt_abstractElement( new elementBeam())10 GWt_elementBeam::GWt_elementBeam(GWt_elementLigneFaisceau* elemLigne,abstractElement* abstract) 11 :GWt_abstractElement(abstract) 12 12 { 13 13 elementLigneFaiseauContainer_ = elemLigne; -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementBend.cc
r437 r455 9 9 #include <Wt/WPushButton> 10 10 11 GWt_elementBend::GWt_elementBend(GWt_elementLigneFaisceau* elemLigne )12 :GWt_abstractElement( new elementBend())11 GWt_elementBend::GWt_elementBend(GWt_elementLigneFaisceau* elemLigne ,abstractElement* abstract) 12 :GWt_abstractElement(abstract) 13 13 { 14 14 elementLigneFaiseauContainer_ = elemLigne; -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementCell.cc
r437 r455 10 10 #include <Wt/WPanel> 11 11 12 GWt_elementCell::GWt_elementCell(GWt_elementLigneFaisceau* elemLigne )13 :GWt_abstractElement( new elementCell())12 GWt_elementCell::GWt_elementCell(GWt_elementLigneFaisceau* elemLigne,abstractElement* abstract) 13 :GWt_abstractElement(abstract) 14 14 { 15 15 elementLigneFaiseauContainer_ = elemLigne; -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementDrift.cc
r437 r455 9 9 #include <Wt/WPushButton> 10 10 11 GWt_elementDrift::GWt_elementDrift(GWt_elementLigneFaisceau* elemLigne )12 :GWt_abstractElement( new elementDrift())11 GWt_elementDrift::GWt_elementDrift(GWt_elementLigneFaisceau* elemLigne,abstractElement* abstract) 12 :GWt_abstractElement(abstract) 13 13 { 14 14 elementLigneFaiseauContainer_ = elemLigne; -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementFit.cc
r437 r455 9 9 #include <Wt/WComboBox> 10 10 11 GWt_elementFit::GWt_elementFit(GWt_elementLigneFaisceau* elemLigne )12 :GWt_abstractElement( new elementFit())11 GWt_elementFit::GWt_elementFit(GWt_elementLigneFaisceau* elemLigne,abstractElement* abstract) 12 :GWt_abstractElement(abstract) 13 13 { 14 14 elementLigneFaiseauContainer_ = elemLigne; -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementLigneFaisceau.cc
r453 r455 19 19 #define PSPA_DEBUG 1 20 20 21 GWt_elementLigneFaisceau::GWt_elementLigneFaisceau(PspaApplication* pspa,GWt_ligneFaisceau* ligne) 21 22 GWt_elementLigneFaisceau::GWt_elementLigneFaisceau(dataManager* data,GWt_ligneFaisceau* ligne, abstractElement* abstractElem) 22 23 : WContainerWidget(), 23 24 firstTimeInsertMessage_(NULL), 24 25 dropZoneLeft_(NULL), 25 26 dropZoneRight_(NULL), 26 GWt_abstractElement_ (NULL),27 GWt_abstractElement_deprecated_(NULL), 27 28 elementLabel_(NULL), 28 pspa_(pspa) 29 { 30 initialize_ligneFaisceau(nomdElements::inconnu,ligne); 31 } 32 33 34 GWt_elementLigneFaisceau::GWt_elementLigneFaisceau(nomdElements::typedElement type,PspaApplication* pspa,GWt_ligneFaisceau* ligne) 35 : WContainerWidget(), 36 firstTimeInsertMessage_(NULL), 37 dropZoneLeft_(NULL), 38 dropZoneRight_(NULL), 39 GWt_abstractElement_(NULL), 40 elementLabel_(NULL), 41 pspa_(pspa) 29 dataManager_(data) 42 30 { 43 31 // set the css name 44 32 setObjectName("elementLigneFaisceau"); 45 initialize_ligneFaisceau( type,ligne);46 } 47 48 void GWt_elementLigneFaisceau::initialize_ligneFaisceau( nomdElements::typedElement eType,GWt_ligneFaisceau* ligne)33 initialize_ligneFaisceau(ligne,abstractElem); 34 } 35 36 void GWt_elementLigneFaisceau::initialize_ligneFaisceau(GWt_ligneFaisceau* ligne, abstractElement* abstractElem) 49 37 { 50 cout << " new GWt_elementLigneFaisceau : "<< nomdElements::getLabelFromType(eType) << endl;51 52 38 // set layout 53 39 // +----------+--------+---------+ … … 62 48 63 49 // add first line : initialize arrow and link images 64 dropZoneLeft_ = new GWt_dropZoneLigneFaisceau( pspa_,ligne);65 dropZoneRight_ = new GWt_dropZoneLigneFaisceau( pspa_,ligne);50 dropZoneLeft_ = new GWt_dropZoneLigneFaisceau(dataManager_,ligne); 51 dropZoneRight_ = new GWt_dropZoneLigneFaisceau(dataManager_,ligne); 66 52 67 53 // change object name in order to manage css : … … 73 59 74 60 // add first line : initialize arrow and link images 75 dropZoneLeft_ = new GWt_dropZoneLigneFaisceau( pspa_,ligne);76 dropZoneRight_ = new GWt_dropZoneLigneFaisceau( pspa_,ligne);61 dropZoneLeft_ = new GWt_dropZoneLigneFaisceau(dataManager_,ligne); 62 dropZoneRight_ = new GWt_dropZoneLigneFaisceau(dataManager_,ligne); 77 63 78 64 // change object name in order to manage css : … … 84 70 85 71 // add the image if present 86 72 73 nomdElements::typedElement eType = abstractElem->getNomdElement().getElementType(); 74 87 75 switch ( eType ) { 88 76 case nomdElements::RFgun : 89 GWt_abstractElement_ = new GWt_elementRfgun(this);77 GWt_abstractElement_deprecated_ = new GWt_elementRfgun(this,abstractElem); 90 78 break; 91 79 case nomdElements::drift : 92 GWt_abstractElement_ = new GWt_elementDrift(this);80 GWt_abstractElement_deprecated_ = new GWt_elementDrift(this,abstractElem); 93 81 break; 94 82 case nomdElements::cell : 95 GWt_abstractElement_ = new GWt_elementCell(this);83 GWt_abstractElement_deprecated_ = new GWt_elementCell(this,abstractElem); 96 84 break; 97 85 case nomdElements::bend : 98 GWt_abstractElement_ = new GWt_elementBend(this);86 GWt_abstractElement_deprecated_ = new GWt_elementBend(this,abstractElem); 99 87 break; 100 88 case nomdElements::soleno : 101 GWt_abstractElement_ = new GWt_elementSoleno(this);89 GWt_abstractElement_deprecated_ = new GWt_elementSoleno(this,abstractElem); 102 90 break; 103 91 case nomdElements::beam : 104 GWt_abstractElement_ = new GWt_elementBeam(this);92 GWt_abstractElement_deprecated_ = new GWt_elementBeam(this,abstractElem); 105 93 break; 106 94 case nomdElements::fit : 107 GWt_abstractElement_ = new GWt_elementFit(this);95 GWt_abstractElement_deprecated_ = new GWt_elementFit(this,abstractElem); 108 96 break; 109 97 case nomdElements::mpole : 110 GWt_abstractElement_ = new GWt_elementMpole(this);98 GWt_abstractElement_deprecated_ = new GWt_elementMpole(this,abstractElem); 111 99 break; 112 100 case nomdElements::snapshot : 113 101 { 114 int incr = pspa_->getExtensionFile();102 int incr = dataManager_->getPspaApplication()->getExtensionFile(); 115 103 incr++; 116 pspa_->setExtensionFile(incr);117 GWt_abstractElement_ = new GWt_elementSnapshot(this,incr);104 dataManager_->getPspaApplication()->setExtensionFile(incr); 105 GWt_abstractElement_deprecated_ = new GWt_elementSnapshot(this,abstractElem,incr); 118 106 break; 119 107 } 120 108 case nomdElements::inconnu : 121 GWt_abstractElement_ = NULL;109 GWt_abstractElement_deprecated_ = NULL; 122 110 } 123 111 … … 129 117 elementContainer_->setLayout(vLayoutElementContainer); 130 118 131 if (GWt_abstractElement_ != NULL) {132 vLayoutElementContainer->addWidget(GWt_abstractElement_ );133 GWt_abstractElement_ ->setMaximumSize(64,40);134 GWt_abstractElement_ ->setMinimumSize(64,40);135 } 136 137 if (GWt_abstractElement_ == NULL) {119 if (GWt_abstractElement_deprecated_ != NULL) { 120 vLayoutElementContainer->addWidget(GWt_abstractElement_deprecated_); 121 GWt_abstractElement_deprecated_->setMaximumSize(64,40); 122 GWt_abstractElement_deprecated_->setMinimumSize(64,40); 123 } 124 125 if (GWt_abstractElement_deprecated_ == NULL) { 138 126 elementLabel_ = new WText(); 139 127 } else { 140 elementLabel_ = new WText(GWt_abstractElement_ ->getAbstractElement()->getLabel());128 elementLabel_ = new WText(GWt_abstractElement_deprecated_->getAbstractElement()->getLabel()); 141 129 } 142 130 … … 191 179 elementContainer_->mouseWentOut().connect(this,&GWt_elementLigneFaisceau::mouseWentOut); 192 180 elementContainer_->mouseWentOver().connect(this,&GWt_elementLigneFaisceau::mouseWentOver); 193 actionParameters_->clicked().connect(GWt_abstractElement_,&GWt_abstractElement::showParameters); 194 actionTrash_->clicked().connect(GWt_abstractElement_,&GWt_abstractElement::deleteElement); 181 actionParameters_->clicked().connect(GWt_abstractElement_deprecated_,&GWt_abstractElement::showParameters); 182 actionTrash_->clicked().connect(GWt_abstractElement_deprecated_,&GWt_abstractElement::deleteElement); 183 184 updateSoftware(); 195 185 } 196 186 … … 198 188 {} 199 189 200 void GWt_elementLigneFaisceau::update ()190 void GWt_elementLigneFaisceau::updateSoftware() 201 191 { 202 192 if (getGWt_AbstractElement()->getAbstractElement()) { … … 229 219 { 230 220 clear(); 231 GWt_abstractElement_ = elem;232 addWidget(GWt_abstractElement_ );221 GWt_abstractElement_deprecated_ = elem; 222 addWidget(GWt_abstractElement_deprecated_); 233 223 if (static_cast <WContainerWidget*> (parent())) { 234 224 WContainerWidget* wc = static_cast <WContainerWidget*> (parent()); -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementMpole.cc
r437 r455 9 9 #include <Wt/WPushButton> 10 10 11 GWt_elementMpole::GWt_elementMpole(GWt_elementLigneFaisceau* elm) : GWt_abstractElement(new elementMultipole()) 11 GWt_elementMpole::GWt_elementMpole(GWt_elementLigneFaisceau* elm,abstractElement* abstract) : 12 GWt_abstractElement(abstract) 12 13 { 13 14 elementLigneFaiseauContainer_ = elm; -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementRfgun.cc
r437 r455 8 8 #include <Wt/WPushButton> 9 9 10 GWt_elementRfgun::GWt_elementRfgun(GWt_elementLigneFaisceau* elemLigne )11 :GWt_abstractElement( new elementRfgun())10 GWt_elementRfgun::GWt_elementRfgun(GWt_elementLigneFaisceau* elemLigne,abstractElement* abstract) 11 :GWt_abstractElement(abstract) 12 12 { 13 13 elementLigneFaiseauContainer_ = elemLigne; -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementSnapshot.cc
r442 r455 9 9 #include <Wt/WPushButton> 10 10 11 GWt_elementSnapshot::GWt_elementSnapshot(GWt_elementLigneFaisceau* elemLigne, int num) : GWt_abstractElement(new elementSnapshot(num)) 11 GWt_elementSnapshot::GWt_elementSnapshot(GWt_elementLigneFaisceau* elemLigne,abstractElement* abstract, int num) : 12 GWt_abstractElement(abstract) 12 13 { 13 14 elementLigneFaiseauContainer_ = elemLigne; -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementSoleno.cc
r437 r455 8 8 #include <Wt/WPushButton> 9 9 10 GWt_elementSoleno::GWt_elementSoleno(GWt_elementLigneFaisceau* elemLigne )11 :GWt_abstractElement( new elementSoleno())10 GWt_elementSoleno::GWt_elementSoleno(GWt_elementLigneFaisceau* elemLigne,abstractElement* abstract) 11 :GWt_abstractElement(abstract) 12 12 { 13 13 elementLigneFaiseauContainer_ = elemLigne; -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_ligneFaisceau.cc
r453 r455 3 3 #include "GWt_elementLigneFaisceau.h" 4 4 #include "GWt_ligneFaisceau.h" 5 5 #include "GWt_sector.h" 6 #include "abstractElement.h" 6 7 #include "nomDeLogiciel.h" 7 8 … … 11 12 12 13 13 GWt_ligneFaisceau::GWt_ligneFaisceau(PspaApplication* ps) : 14 WContainerWidget(), 15 pspa_(ps) 14 GWt_ligneFaisceau::GWt_ligneFaisceau(dataManager* data,GWt_sector* sect) : 15 WContainerWidget(), 16 dataManager_(data), 17 UI_sector_(sect) 16 18 { 17 19 … … 24 26 // set the object name 25 27 setObjectName("ligneFaisceau"); 26 clear();28 buildBeamLineWidget(); 27 29 } 28 30 … … 34 36 // add the first drop zone 35 37 decorationStyle().setBorder (WBorder (WBorder::Dotted)); 36 allDropZone_ = new GWt_dropZoneLigneFaisceau( pspa_,this);38 allDropZone_ = new GWt_dropZoneLigneFaisceau(dataManager_,this); 37 39 WVBoxLayout* fit = new WVBoxLayout(); 38 40 allDropZone_->setLayout(fit); … … 49 51 GWt_abstractElement* GWt_ligneFaisceau::addElement(nomdElements::typedElement eType, GWt_dropZoneLigneFaisceau* dropContainer ) 50 52 { 51 52 GWt_abstractElement* GWtAbstractElem = NULL; 53 cout << " addElement::element : " << nomdElements::getLabelFromType(eType) << endl; 54 55 // 3 cases : 56 // -dropContainer is an element of the ligneFaisceauLayout_ 57 // -dropContainer is an element of the GWt_elementLigneFaisceau_ 58 // -dropContainer is NULL, insert in the last element 59 60 if(eType == nomdElements::inconnu) { 61 cout << "GWt_ligneFaisceau::element type " << eType << " inconnu " << endl; 62 return NULL; 63 } 64 65 // add the element to the datamanager 66 67 // first time we insert an element : 68 GWt_elementLigneFaisceau* firstElemIsElement = dynamic_cast <GWt_elementLigneFaisceau*> (ligneFaisceauLayout_->itemAt(0)->widget()); 69 70 if( (ligneFaisceauLayout_->count() == 1) && (!firstElemIsElement) ) { 71 int index = indexOf(dropContainer); 72 if( (index != -1) || (dropContainer == NULL) ) { // found 73 // remove global drop zone 74 ligneFaisceauLayout_->clear(); 75 // add first element 76 GWt_elementLigneFaisceau* elemLigneFaisceau = new GWt_elementLigneFaisceau(eType,pspa_,this); 77 ligneFaisceauLayout_->addWidget(elemLigneFaisceau,1); 78 GWtAbstractElem = elemLigneFaisceau->getGWt_AbstractElement(); 79 // remove arrow from begin and end 80 81 } else { // error 82 return NULL; 83 } 84 } else { 85 int index = -1; 53 54 55 GWt_abstractElement* UIabstractElement = NULL; 56 57 // Add this element to the DataManager 58 59 // create a new abstractElement 60 // FIXME : To be move in an abstractFactory in the controler !! 61 abstractElement* currentElement = NULL; 62 switch ( eType ) { 63 case nomdElements::RFgun : 64 currentElement = new elementRfgun(); 65 break; 66 case nomdElements::drift : 67 currentElement = new elementDrift(); 68 break; 69 case nomdElements::cell : 70 currentElement = new elementCell(); 71 break; 72 case nomdElements::bend : 73 currentElement = new elementBend(); 74 break; 75 case nomdElements::soleno : 76 currentElement = new elementSoleno(); 77 break; 78 case nomdElements::beam : 79 currentElement = new elementBeam(); 80 break; 81 case nomdElements::fit : 82 currentElement = new elementFit(); 83 break; 84 case nomdElements::mpole : 85 currentElement = new elementMultipole(); 86 break; 87 case nomdElements::snapshot : 88 { 89 // FIXME : Snapshot a gérér 90 /* int incr = dataManager_->getPspaApplication()->getExtensionFile(); 91 incr++; 92 dataManager_->getPspaApplication()->setExtensionFile(incr); 93 */ 94 currentElement = new elementSnapshot(); 95 break; 96 } 97 } 98 99 100 // look for the previous element 101 abstractElement* previousElement = NULL; 102 86 103 for (int a=0; a< ligneFaisceauLayout_->count(); a++) { 87 104 GWt_elementLigneFaisceau* elem = static_cast <GWt_elementLigneFaisceau*> (ligneFaisceauLayout_->itemAt(a)->widget ()); 88 105 if (elem) { 89 if (elem->getDropZoneLeft() == dropContainer) { 90 index = a; 91 } 92 if (elem->getDropZoneRight() == dropContainer) { 93 index = a+1; 94 } 95 } 96 97 } 98 99 // ligneFaisceauLayout_->addWidget(new GWt_elementLigneFaiseau(ptr),0); 100 GWt_elementLigneFaisceau* elemLigneFaisceau = new GWt_elementLigneFaisceau(eType, pspa_,this); 101 if (index != -1) { 102 ligneFaisceauLayout_->insertWidget(index,elemLigneFaisceau,1); 103 GWtAbstractElem = elemLigneFaisceau->getGWt_AbstractElement(); 104 } else { 105 ligneFaisceauLayout_->addWidget(elemLigneFaisceau,1); 106 GWtAbstractElem = elemLigneFaisceau->getGWt_AbstractElement(); 107 } 108 } 109 manageLineFaisceauLayout(); 110 111 return GWtAbstractElem; 112 } 113 114 115 void GWt_ligneFaisceau::manageLineFaisceauLayout() { 106 if (elem->getDropZoneRight() == dropContainer) { 107 previousElement = elem->getGWt_AbstractElement()->getAbstractElement(); 108 } 109 } 110 } 111 112 getUISector()->getSectorControler()->addElementAfter(currentElement,previousElement ); 113 114 buildBeamLineWidget(); 115 return UIabstractElement; 116 117 } 118 119 120 void GWt_ligneFaisceau::manageLineFaisceauLayout_deprecated() { 116 121 // special : hide/setVisible arrow : 117 122 for (int a=0; a< ligneFaisceauLayout_->count(); a++) { … … 151 156 } 152 157 153 pspa_->getExecuteWidget()->updateSections(); 154 } 155 158 // FIXME 159 UI_sector_->getExecuteWidget()->updateSections(); 160 } 161 162 163 void GWt_ligneFaisceau::buildBeamLineWidget() { 164 // clear the layout and set default text 165 clear(); 166 bool first = true; 167 168 // Get the dataManager's sector 169 // rebuild the beamLine 170 171 GWt_elementLigneFaisceau* elemLigneFaisceau = NULL; 172 for (unsigned int i =0; i< UI_sector_->getSectorControler()->getSectionsToExecute().size(); i++) { 173 std::vector <abstractElement*> abstractElem = UI_sector_->getSectorControler()->getSectionsToExecute()[i]->getElements(); 174 for (unsigned int j=0; j< abstractElem.size(); j++) { 175 176 elemLigneFaisceau = new GWt_elementLigneFaisceau(dataManager_, 177 this, 178 abstractElem[j]); 179 180 // remove default text 181 if (first) { 182 first = false; 183 ligneFaisceauLayout_->clear(); 184 ligneFaisceauLayout_->addWidget(elemLigneFaisceau); 185 186 elemLigneFaisceau->getDropZoneLeft()->setStyleClass("elementLigneFaiseau_transparent"); 187 elemLigneFaisceau->getDropZoneRight()->setStyleClass("elementLigneFaiseau_line"); 188 189 } else { 190 ligneFaisceauLayout_->addWidget(elemLigneFaisceau); 191 192 elemLigneFaisceau->getDropZoneLeft()->setStyleClass( "elementLigneFaiseau_line"); 193 elemLigneFaisceau->getDropZoneRight()->setStyleClass("elementLigneFaiseau_line"); 194 } 195 196 } 197 } 198 // remove last line 199 if (elemLigneFaisceau != NULL) { 200 elemLigneFaisceau->getDropZoneRight()->setStyleClass("elementLigneFaiseau_transparent"); 201 } 202 203 } 156 204 157 205 158 206 void GWt_ligneFaisceau::update() { 159 manageLineFaisceauLayout ();207 manageLineFaisceauLayout_deprecated(); 160 208 } 161 209 … … 186 234 187 235 // manage widgets if necessary 188 manageLineFaisceauLayout ();236 manageLineFaisceauLayout_deprecated(); 189 237 } 190 238 } … … 201 249 202 250 if (GWt_elementLigneFaisceau* elem = dynamic_cast <GWt_elementLigneFaisceau*> (ligneFaisceauLayout_->itemAt(a)->widget ())) { 203 if (index == i) { 204 if (elem->getGWt_AbstractElement()) { 205 return elem->getGWt_AbstractElement()->getAbstractElement(); 206 } 251 if (index == i) { 252 if (elem->getGWt_AbstractElement()) { 253 return elem->getGWt_AbstractElement()->getAbstractElement(); 207 254 } 208 index ++; 209 } 210 } 211 } 255 } 256 index ++; 257 } 258 } 259 } 260 return NULL; 261 } 262 263 264 265 int GWt_ligneFaisceau::getAbstractElementNumeroFromLabel(std::string txt){ 266 int index = 1; 267 if (txt == "") { 212 268 return NULL; 213 } 214 215 216 217 int GWt_ligneFaisceau::getAbstractElementNumeroFromLabel(std::string txt){ 218 int index = 1; 219 if (txt == "") { 220 return NULL; 221 } 222 223 for (int a=0; a< ligneFaisceauLayout_->count(); a++) { 224 if (ligneFaisceauLayout_->itemAt(a)) { 225 226 if (GWt_elementLigneFaisceau* elem = dynamic_cast <GWt_elementLigneFaisceau*> (ligneFaisceauLayout_->itemAt(a)->widget ())) { 227 if (elem->getGWt_AbstractElement()) { 228 if (elem->getGWt_AbstractElement()->getAbstractElement()->getLabel() == txt) { 229 return index; 230 } 231 } 232 index ++; 233 } 234 } 235 } 236 return NULL; 237 269 } 270 271 for (int a=0; a< ligneFaisceauLayout_->count(); a++) { 272 if (ligneFaisceauLayout_->itemAt(a)) { 273 274 if (GWt_elementLigneFaisceau* elem = dynamic_cast <GWt_elementLigneFaisceau*> (ligneFaisceauLayout_->itemAt(a)->widget ())) { 275 if (elem->getGWt_AbstractElement()) { 276 if (elem->getGWt_AbstractElement()->getAbstractElement()->getLabel() == txt) { 277 return index; 278 } 279 } 280 index ++; 281 } 282 } 283 } 284 return NULL; 285 238 286 } 239 287 … … 263 311 } 264 312 265 void GWt_ligneFaisceau::update (int i){313 void GWt_ligneFaisceau::update_deprecated(int i){ 266 314 int index = 0; 267 315 268 316 // first if 1 269 317 // i--; 270 318 271 319 for (int a=0; a< ligneFaisceauLayout_->count(); a++) { 272 320 if (GWt_elementLigneFaisceau* elem = dynamic_cast <GWt_elementLigneFaisceau*> (ligneFaisceauLayout_->itemAt(a)->widget ())) { 273 321 if (index == i) { 274 322 // elem->update(); 275 323 } 276 324 index ++; -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc
r453 r455 45 45 WApplication(env), 46 46 applicationDefaultTitle_("portail PSPA"), 47 beamLine_(NULL),48 47 extensionFile_(0) 49 48 { … … 79 78 WPushButton* boutonRestaure = new WPushButton(); 80 79 WPushButton* boutonLoadNew = new WPushButton(); 81 WPushButton* boutongraphicalAnalysis = new WPushButton();82 80 WPushButton* boutonTrash = new WPushButton(); 83 81 … … 85 83 boutonRestaure->setStyleClass("restoreButton"); 86 84 boutonLoadNew->setStyleClass("loadNewButton"); 87 boutongraphicalAnalysis->setStyleClass("histoButton");88 85 boutonTrash->setStyleClass("trashButton"); 89 86 … … 91 88 boutonRestaure->setToolTip ("restaurer la configuration depuis le serveur"); 92 89 boutonLoadNew->setToolTip ("charger une configuration"); 93 boutongraphicalAnalysis->setToolTip ("analyse graphique"); 94 boutonTrash->setToolTip ("tout effacer"); 90 boutonTrash->setToolTip ("supprimer l'accélerateur"); // FIXME ! a terminer 95 91 96 92 boutonSauve->setMaximumSize(38,38); … … 100 96 boutonLoadNew->setMaximumSize(38,38); 101 97 boutonLoadNew->setMinimumSize(38,38); 102 boutongraphicalAnalysis->setMaximumSize(38,38);103 boutongraphicalAnalysis->setMinimumSize(38,38);104 98 boutonTrash->setMaximumSize(38,38); 105 99 boutonTrash->setMinimumSize(38,38); … … 109 103 // Upload when the button is clicked. React to a succesfull upload. 110 104 boutonLoadNew->clicked().connect(this, &PspaApplication::openFileSelector); 111 boutongraphicalAnalysis->clicked().connect(this, &PspaApplication::dialogOnGraphics);112 boutonTrash->clicked().connect(this, &PspaApplication::removeBeamLine);113 105 toolbarLayout->addWidget(boutonSauve , 0,Wt::AlignMiddle); 114 106 toolbarLayout->addWidget(boutonRestaure , 0,Wt::AlignMiddle); 115 107 toolbarLayout->addWidget(boutonLoadNew , 0,Wt::AlignMiddle); 116 toolbarLayout->addWidget(boutongraphicalAnalysis , 0,Wt::AlignMiddle);117 108 toolbarLayout->addWidget(boutonTrash , 0,Wt::AlignMiddle); 118 109 toolbarLayout->addWidget(new WText("") , 1,Wt::AlignMiddle); … … 138 129 139 130 140 GWt_accelerator* accel = new GWt_accelerator(acceleratorContainerWidget,this);131 new GWt_accelerator(acceleratorContainerWidget,dtmanage_); 141 132 new WBreak(acceleratorContainerWidget); 142 133 143 WScrollArea* scroll = new WScrollArea(acceleratorContainerWidget); 144 scroll->setWidget(createBeamLine()); 145 scroll->setMinimumSize(300,150); 146 134 135 // --------------------------------------------------------------- 136 // ********************* Ancien code : A supprimer *************** 137 // --------------------------------------------------------------- 138 beamLine_deprecated_ = NULL; 139 /* 140 WScrollArea* scroll = new WScrollArea(acceleratorContainerWidget); 141 scroll->setWidget(createBeamLine__deprecated()); 142 scroll->setMinimumSize(300,150); 143 */ 144 147 145 new WBreak(acceleratorContainerWidget); 148 146 //----------- … … 153 151 154 152 globalParam_ = new GWt_globalParameters(dtmanage_); 155 sectorParam_ = new GWt_sectorParameters( dtmanage_);153 sectorParam_ = new GWt_sectorParameters(); 156 154 WWidget* dboard = createDashBoard(acceleratorContainerWidget); 157 155 dboard->setMinimumSize(300,100); … … 161 159 //----------- 162 160 163 graphicsDialog_ = new GWt_dialog("graphical analysis",createDrawingWidget(),false);164 graphicsDialog_->setMinimumSize(400,400);165 graphicsDialog_->setClosable(true);166 graphicsDialog_->hide();167 168 executeWidget_ = new GWt_softwarePanel(dtmanage_,this,acceleratorContainerWidget);169 executeWidget_->setMinimumSize(400,100);170 161 171 162 new WBreak(acceleratorContainerWidget); … … 219 210 void PspaApplication::messageBox2() 220 211 { 221 sectorParam_->execDialog ();212 sectorParam_->execDialog_deprecated(); 222 213 return; 223 214 } … … 245 236 } 246 237 247 Wt::WWidget* PspaApplication::createBeamLine()238 /*Wt::WWidget* PspaApplication::createBeamLine__deprecated() 248 239 { 249 240 extensionFile_= 0; 250 if (!beamLine_) { 251 beamLine_ = new GWt_ligneFaisceau(this); 241 if (!beamLine__deprecated_) { 242 // FIXME : get the one of the first app/sector for the moment 243 beamLine__deprecated_ = accel_toBeRenameAsLocal->firstSector__deprecated()->getUIBeamLine ? 252 244 } else { 253 245 beamLine_->clear(); … … 256 248 setTitle(applicationDefaultTitle_); 257 249 258 return beamLine_; 259 } 260 261 void PspaApplication::dialogOnGraphics() 262 { 263 graphicsDialog_->show(); 264 } 265 266 WContainerWidget* PspaApplication::createDrawingWidget() 267 { 268 WGridLayout *glayout= new WGridLayout(); 269 WContainerWidget* dessin = new WContainerWidget(); 270 dessin->setLayout(glayout); 271 272 group_ = new Wt::WButtonGroup(this); 273 274 ///////////////////////////////////////////////////////////////////// 275 276 choixEnveloppeDessin_ = new WComboBox(); 277 choixEnveloppeDessin_->addItem("x"); 278 // choixEnveloppeDessin_->addItem("y"); 279 Wt::WRadioButton *button1= new WRadioButton(" enveloppe"); 280 group_->addButton(button1,1); 281 glayout->addWidget(button1,0,1); 282 glayout->addWidget(choixEnveloppeDessin_,0,2); 283 ///////////////////////////////////////////////////////////////////// 284 285 choixElementDessin_ = new WComboBox(); 286 choixElementDessin_->setMinimumSize(50,10); 287 choixTypeDessinFaisceau_ = new WComboBox(); 288 choixTypeDessinFaisceau_->addItem("courant_snyder"); 289 choixTypeDessinFaisceau_->addItem("macroparticles"); 290 Wt::WRadioButton *button2= new WRadioButton(" phase space after element"); 291 292 choixAbsPhase_ = new WComboBox(); 293 choixAbsPhase_->addItem("x"); 294 choixAbsPhase_->addItem("y"); 295 choixAbsPhase_->addItem("dz"); 296 choixAbsPhase_->addItem("xp"); 297 choixAbsPhase_->addItem("yp"); 298 choixAbsPhase_->addItem("dE/E"); 299 choixAbsPhase_->setCurrentIndex(0); 300 301 choixOrdPhase_ = new WComboBox(); 302 choixOrdPhase_->addItem("x"); 303 choixOrdPhase_->addItem("y"); 304 choixOrdPhase_->addItem("dz"); 305 choixOrdPhase_->addItem("xp"); 306 choixOrdPhase_->addItem("yp"); 307 choixOrdPhase_->addItem("dE/E"); 308 choixOrdPhase_->setCurrentIndex(3); 309 310 group_->addButton(button2,2); 311 glayout->addWidget(button2,1,1); 312 glayout->addWidget(choixElementDessin_,1,2); 313 glayout->addWidget(choixTypeDessinFaisceau_,1,3); 314 // glayout->addWidget(new WText("abs. :"),2,2); 315 glayout->addWidget(choixAbsPhase_,2,2); 316 // glayout->addWidget(new WText("ord. :"),2,4); 317 glayout->addWidget(choixOrdPhase_,2,3); 318 ///////////////////////////////////////////////////////////////////// 319 320 choixVariableHisto_= new WComboBox(); 321 choixVariableHisto_->addItem("x"); 322 choixVariableHisto_->addItem("y"); 323 choixVariableHisto_->addItem("z"); 324 choixVariableHisto_->addItem("xp"); 325 choixVariableHisto_->addItem("yp"); 326 choixVariableHisto_->addItem("dE/E"); 327 choixVariableHisto_->setCurrentIndex(5); 328 329 choixHistoDessin_ = new WComboBox(); 330 Wt::WRadioButton *button3= new WRadioButton(" histogram after element "); 331 group_->addButton(button3,3); 332 333 glayout->addWidget(button3,3,1); 334 glayout->addWidget(choixHistoDessin_,3,2); 335 glayout->addWidget(choixVariableHisto_,3,3); 336 ///////////////////////////////////////////////////////////////////// 337 338 WPushButton *close= new WPushButton("close"); 339 glayout->addWidget(close,4,1); 340 close->clicked().connect(this,&PspaApplication::closeGraphicDialog); 341 342 WPushButton *draw= new WPushButton("draw"); 343 glayout->addWidget(draw,4,2,2,1); 344 draw->clicked().connect(this,&PspaApplication::dessiner); 345 ///////////////////////////////////////////////////////////////////// 346 347 toto_ = new WContainerWidget(); 348 dessin->addWidget(toto_); 349 return dessin; 350 } 351 352 void PspaApplication::closeGraphicDialog() 353 { 354 cout << " close graphicsDialog_" << endl; 355 for(unsigned i = 0; i < eDialog_.size(); i++) eDialog_[i]->done(WDialog::Rejected); 356 eDialog_.clear(); 357 graphicsDialog_->done(WDialog::Rejected); 358 } 359 360 void PspaApplication::dessiner() 361 { 362 int k= group_->checkedId(); 363 cout << "dessiner k= " << k << endl; 364 365 switch(k) { 366 case 1: 367 dessinerEnveloppe(); 368 break; 369 case 2: 370 dessinerPhaseSpace(); 371 break; 372 case 3: 373 dessinerHistogramme(); 374 break; 375 default: 376 GWt_dialog graphicalWarning("graphical analysis","select a button",GWt_dialog::Warning,false,true); 377 graphicalWarning.exec(); 378 break; 379 } 380 } 381 250 return beamLine__deprecated_; 251 } 252 */ 382 253 383 254 void PspaApplication::sauver() … … 511 382 GWt_dialog* messageBox= new GWt_dialog("Error during upload file" ,message ,GWt_dialog::Error,false,true); 512 383 messageBox->show(); 513 }514 515 void PspaApplication::faireDessin()516 {517 choixElementDessin_->clear();518 choixHistoDessin_->clear();519 520 int nombre = dtmanage_->getBeamLineSize();521 for(int i = 1; i <= nombre; i++) {522 abstractElement* elPtr = dtmanage_->getElementPointerFromNumero(i);523 // if(elPtr->getNomdElement().getElementType() == snapshot) continue;524 525 choixElementDessin_->addItem(elPtr->getLabel());526 choixHistoDessin_->addItem(elPtr->getLabel());527 }528 }529 530 void PspaApplication::dessinerPhaseSpace()531 {532 533 int typeFaisceau = choixTypeDessinFaisceau_->currentIndex();534 // int index = choixElementDessin_->currentIndex();535 string nameAbs = choixAbsPhase_->currentText().toUTF8();536 string nameOrd = choixOrdPhase_->currentText().toUTF8();537 if ( nameAbs == nameOrd ) {538 GWt_dialog phaseSpaceError(" graphical analysis", "the beam coordinates must be different !", GWt_dialog::Error, false,true);539 phaseSpaceError.exec();540 return;541 }542 string elementLabel = choixElementDessin_->currentText().toUTF8();543 particleBeam* beam = dtmanage_->getDiagnosticBeam(elementLabel);544 // particleBeam* beam = dtmanage_->getDiagnosticBeam(index);545 546 if ( beam == NULL ) {547 GWt_dialog warningBeamState(" graphical analysis", "the beam does not exist at the end of this element !", GWt_dialog::Error, false,true);548 warningBeamState.exec();549 return;550 }551 552 toto_->clear();553 faireDessinPhaseSpace(toto_, beam, elementLabel, nameAbs, nameOrd, typeFaisceau);554 555 // if ( typeFaisceau == 0 )556 // {557 // if ( !beam->momentRepresentationOk() ) beam->buildMomentRepresentation();558 // faireDessinTransport(toto_, beam, nameAbs, nameOrd );559 // }560 // else if ( typeFaisceau == 1 )561 // {562 // if ( beam->particleRepresentationOk() ) faireDessinParmela(toto_, beam, nameAbs, nameOrd );563 // else {564 // GWt_dialog warningBeamState(" graphical analysis", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);565 // warningBeamState.exec();566 // }567 // }568 // else {569 // GWt_dialog warningTypeDrawing(" graphical analysis", "type of drawing not programmed !", GWt_dialog::Error, false,true);570 // warningTypeDrawing.exec();571 // }572 }573 574 void PspaApplication::dessinerEnveloppe()575 {576 toto_->clear();577 578 int typeEnveloppe = choixEnveloppeDessin_->currentIndex();579 if ( typeEnveloppe == 0 )580 {581 faireDessinEnveloppe(toto_, "x");582 }583 else {584 GWt_dialog warningTypeEnveloppe(" graphical analysis", "type of enveloppe drawing not programmed !", GWt_dialog::Error, false,true);585 warningTypeEnveloppe.exec();586 }587 }588 589 void PspaApplication::faireDessinEnveloppe(WContainerWidget* toto, string type)590 {591 592 std::time_t result = std::time(NULL);593 594 GWt_dialog* envDialog = new GWt_dialog(WString("enveloppe (")+std::asctime(std::localtime(&result))+")",toto,false);595 eDialog_.push_back(envDialog);596 envDialog->setMinimumSize(400,400);597 envDialog->setClosable(true);598 envDialog->show();599 600 // unsigned nbel = dtmanage_->getBeamLineSize();601 vector<double> xcor;602 vector<double> ycor;603 string titre;604 string legendx;605 string legendy;606 dtmanage_->donneesRmsEnveloppe(type,xcor,ycor,titre,legendx,legendy);607 608 Wt::Chart::SeriesType seriesType = LineSeries;609 Wt::Chart::FillRangeType fillRange = NoFill;610 Wt::Chart::AxisValue location = ZeroValue;611 bool isGridLinesEnabled = false;612 chartPlot2vec(envDialog->contents(),xcor,ycor,seriesType,fillRange,location,isGridLinesEnabled,titre,legendx,legendy,500,300);613 }614 615 void PspaApplication::faireDessinPhaseSpace(WContainerWidget* toto, particleBeam* beam, string elementLabel, string namex, string namey, int typeFaisceau)616 {617 618 vector<double> xcor;619 vector<double> ycor;620 vector<string> legende;621 string titre;622 Wt::Chart::SeriesType seriesType;623 624 if ( typeFaisceau == 0 ) {625 seriesType = LineSeries;626 titre = "phase space rms";627 beam->donneesDessinEllipse(xcor,ycor,legende,namex,namey);628 } else if ( typeFaisceau == 1 ) {629 seriesType = PointSeries;630 titre = " phase space ";631 beam->particlesPhaseSpaceData(xcor,ycor,legende,namex,namey);632 // for ( int kk=0; kk < xcor.size(); kk++)633 // {634 // cout << " dess. phas. x= " << xcor.at(kk) << " x'= " << ycor.at(kk) << endl;635 // }636 } else {637 GWt_dialog warningBeamState(" graphical analysis", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);638 warningBeamState.exec();639 return;640 }641 642 std::time_t result = std::time(NULL);643 GWt_dialog* phaseSpaceDialog = new GWt_dialog(WString("phase space (")+std::asctime(std::localtime(&result))+")",toto,false);644 eDialog_.push_back(phaseSpaceDialog);645 phaseSpaceDialog->setMinimumSize(400,400);646 phaseSpaceDialog->setClosable(true);647 new WText(" case : " + nameOfCase_, phaseSpaceDialog->contents());648 new WBreak(phaseSpaceDialog->contents());649 new WText(" after element : " + elementLabel, phaseSpaceDialog->contents());650 651 for (int k=0 ; k < (int)legende.size(); k++) {652 new WBreak(phaseSpaceDialog->contents());653 new WText(legende.at(k), phaseSpaceDialog->contents());654 }655 656 Wt::Chart::FillRangeType fillRange = NoFill;657 Wt::Chart::AxisValue location = ZeroValue;658 bool isGridLinesEnabled = false;659 chartPlot2vec(phaseSpaceDialog->contents(),xcor,ycor,seriesType,fillRange,location,isGridLinesEnabled,titre,namex,namey,500,300);660 661 phaseSpaceDialog->show();662 384 } 663 385 … … 878 600 879 601 880 602 /* 881 603 void PspaApplication::removeBeamLine() { 882 createBeamLine ();604 createBeamLine__deprecated(); 883 605 executeWidget_->updateSections(); 884 606 } 885 886 void PspaApplication::chartPlot2vec(WContainerWidget* toto,vector<double>& xcor,vector<double>& ycor,SeriesType seriesType,FillRangeType fillRange,AxisValue value,bool isGridLinesEnables,string title,string legendx,string legendy,int width,int height,bool makeIcon) 887 { 888 int nbpts = xcor.size(); 889 cout << " PspaApplication::chartPlot2vec nbpts = " << nbpts << endl; 890 891 WStandardItemModel *model = new WStandardItemModel(nbpts, 2, toto); 892 for (int i = 0; i < nbpts; ++i) { 893 model->setData(i, 0, xcor.at(i)); 894 model->setData(i, 1, ycor.at(i)); 895 // cout << " PspaApplication::chartPlot2vec el= " << i+1 << " x= " << xcor.at(i) << " y= " << ycor.at(i) << endl; 896 } 897 // cout << " PspaApplication::chartPlot2vec FLAG 0 " << endl; 898 WCartesianChart *chart = new WCartesianChart(toto); 899 if (!makeIcon) chart->setTitle(title); 900 chart->initLayout(); 901 chart->setModel(model); // set the model 902 chart->setXSeriesColumn(0); // set the column that holds the X data 903 904 chart->setType(ScatterPlot); // set type to ScatterPlot 905 chart->setLegendEnabled(false); // enable the legend 906 907 // Provide space for the X and Y axis and title. 908 chart->setPlotAreaPadding(80, Left); 909 chart->setPlotAreaPadding(40, Bottom); 910 chart->setPlotAreaPadding(60, Top); 911 912 // Typically, for mathematical functions, you want the axes to cross 913 // at the 0 mark (value= ZeroValue) 914 chart->axis(XAxis).setLocation(value); 915 chart->axis(YAxis).setLocation(value); 916 917 // cout << " PspaApplication::chartPlot2vec FLAG 1 " << endl; 918 919 WDataSeries s(1,seriesType); 920 s.setPen(WColor("red")); 921 s.setFillRange(fillRange); 922 chart->addSeries(s); 923 924 WAxis& axis = chart->axis(XAxis); 925 axis.setLabelFormat("%.3f"); 926 axis.setTitle(legendx); 927 928 chart->axis(Y1Axis).setTitle(legendy); 929 930 if(isGridLinesEnables) { 931 axis.setGridLinesEnabled(true); 932 chart->axis(Y1Axis).setGridLinesEnabled(true); 933 } 934 // cout << " PspaApplication::chartPlot2vec FLAG 2 " << endl; 935 936 chart->resize(width,height); // WPaintedWidget must be given explicit size 937 chart->setMargin(10, Top | Bottom); // ? 938 chart->setMargin(WLength::Auto, Left | Right); //? 939 940 if (makeIcon) { 941 chart->setLegendEnabled(false); // enable the legend 942 chart->setPlotAreaPadding(0); 943 chart->setAxisPadding(0); 944 WFont xAxisFont = chart->axis(XAxis).labelFont(); 945 xAxisFont.setSize(8); 946 WFont yAxisFont = chart->axis(YAxis).labelFont(); 947 yAxisFont.setSize(8); 948 chart->axis(XAxis).setLabelFont(xAxisFont); 949 chart->axis(YAxis).setLabelFont(yAxisFont); 950 } 951 // cout << " PspaApplication::chartPlot2vec FLAG 3 " << endl; 952 953 #ifdef HAS_IMAGEMAGIC 954 955 // cout << " PspaApplication::chartPlot2vec FLAG MAGIC " << endl; 956 957 // no background 958 chart->setBackground(WBrush(Wt::NoBrush)); 959 960 // axis black 961 chart->axis(XAxis).setPen(WColor("black")); 962 chart->axis(YAxis).setPen(WColor("black")); 963 964 std::string name; 965 /* 966 Wt::WRasterImage pngImage("png", 1000, 1000); 967 Wt::WPainter p(&pngImage); 968 chart->paint(p); 969 name = workingDir_ + "/chart-"+sessionId ()+".png"; 970 std::ofstream f(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary); 971 pngImage.write(f); 972 */ 973 974 Wt::WPdfImage pdfImage("1000", "600"); 975 { 976 Wt::WPainter p1(&pdfImage); 977 chart->paint(p1); 978 } 979 980 name = workingDir_ + "/chart-"+sessionId ()+".pdf"; 981 std::ofstream f1(name.c_str(), std::ios::out | std::ios::binary); 982 pdfImage.write(f1); 983 984 new WText("<a href='workingArea/chart-"+sessionId ()+".pdf' target='_blank'>Sauvegarder l'image</a>",toto); 985 986 #endif 987 // cout << " PspaApplication::chartPlot2vec FLAG FIN" << endl; 988 989 } 990 991 void PspaApplication::dessinerHistogramme() 992 { 993 toto_->clear(); 994 995 // std::time_t result = std::time(NULL); 996 // GWt_dialog* histoDialog = new GWt_dialog(WString("histogramme (")+std::asctime(std::localtime(&result))+")",toto_,false); 997 // eDialog_.push_back(histoDialog); 998 // histoDialog->setMinimumSize(400,400); 999 // histoDialog->setClosable(true); 1000 1001 string elementLabel = choixHistoDessin_->currentText().toUTF8(); 1002 particleBeam* beam = dtmanage_->getDiagnosticBeam(elementLabel); 1003 if (beam == NULL) { 1004 GWt_dialog warningBeamState("histogram","the beam does not exist at the end of this element !", GWt_dialog::Error, false,true); 1005 warningBeamState.exec(); 1006 return; 1007 } 1008 1009 if (!beam->particleRepresentationOk()) { 1010 GWt_dialog warningBeamState("histogram", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true); 1011 warningBeamState.exec(); 1012 return; 1013 } 1014 1015 unsigned iabs= choixVariableHisto_->currentIndex(); 1016 vector<double> xcor; 1017 vector<int> hist; 1018 // double out[3]= {0.0}; 1019 vector<string> legende; 1020 beam->histogramme(iabs,xcor,hist,legende); 1021 1022 cout<<"xcor.size()= "<<xcor.size()<<", hist.size()= "<<hist.size()<<endl; 1023 ////////////////////////////////////////////////////////////////////////////////// 1024 1025 int n = hist.size(); 1026 vector<double> x; 1027 x.resize(2*n+2); 1028 vector<double> y; 1029 y.resize(2*n+2); 1030 1031 int j= 0; 1032 x.at(j)= xcor[0]; 1033 y.at(j)= 0.0; 1034 j++; 1035 x.at(j)= xcor[0]; 1036 y.at(j)= hist[0]; 1037 j++; 1038 1039 for (int i = 1; i < n; ++i) { 1040 x.at(j)= xcor[i]; 1041 y.at(j)= hist[i-1]; 1042 j++; 1043 x.at(j)= xcor[i]; 1044 y.at(j)= hist[i]; 1045 j++; 1046 } 1047 1048 x.at(j)= xcor[n]; 1049 y.at(j)= hist[n-1]; 1050 j++; 1051 x.at(j)= xcor[n]; 1052 y.at(j)= 0.0; 1053 ////////////////////////////////////////////////////////////////////////////////// 1054 std::time_t result = std::time(NULL); 1055 GWt_dialog* histoDialog = new GWt_dialog(WString("histogramme (")+std::asctime(std::localtime(&result))+")",toto_,false); 1056 eDialog_.push_back(histoDialog); 1057 histoDialog->setMinimumSize(400,400); 1058 histoDialog->setClosable(true); 1059 1060 histoDialog->show(); 1061 1062 WContainerWidget *w= histoDialog->contents(); 1063 1064 // // legendes 1065 // string unites[2]; 1066 // if(iabs == 0 || iabs == 1 || iabs == 2) { 1067 // unites[0]= unites[1]= " mm"; 1068 // } 1069 // if(iabs == 3 || iabs == 4) { 1070 // unites[0]= unites[1]= " mrad"; 1071 // } 1072 // if(iabs == 5) { 1073 // unites[0]= " MeV"; unites[1]= " KeV"; 1074 // } 1075 1076 new WText(" case : " + nameOfCase_, w); 1077 new WBreak(w); 1078 new WText(" after element : " + elementLabel, w); 1079 1080 for (int k=0 ; k < (int)legende.size(); k++) { 1081 new WBreak(w); 1082 new WText(legende.at(k), w); 1083 } 1084 1085 1086 // new WText(" entries : "+ mixedTools::intToString((int)out[0]),w); 1087 // new WBreak(w); 1088 // new WText(" mean : "+ mixedTools::doubleToString(out[1])+unites[0],w); 1089 // new WBreak(w); 1090 // new WText(" sigma rms : "+ mixedTools::doubleToString(out[2])+unites[1],w); 1091 ////////////////////////////////////////////////////////////////////////////////// 1092 1093 string titre; 1094 if(iabs == 0) titre="x-coordinate"; 1095 if(iabs == 1) titre="y-coordinate"; 1096 if(iabs == 2) titre="z-coordinate"; 1097 if(iabs == 3) titre="xp-divergence"; 1098 if(iabs == 4) titre="yp-devergence"; 1099 if(iabs == 5) titre="kinetic energy"; 1100 1101 string xname; 1102 if(iabs == 0) xname=" x (mm)"; 1103 if(iabs == 1) xname=" y (mm)"; 1104 if(iabs == 2) xname=" z (mm)"; 1105 if(iabs == 3) xname=" xp (mrad)"; 1106 if(iabs == 4) xname=" yp (mrad)"; 1107 if(iabs == 5) xname=" dEcin/Ecin (%)"; 1108 1109 string yname; 1110 Wt::Chart::SeriesType seriesType = LineSeries; 1111 Wt::Chart::FillRangeType fillRange = ZeroValueFill; 1112 Wt::Chart::AxisValue location = MinimumValue; 1113 bool isGridLinesEnabled = true; 1114 chartPlot2vec(w,x,y,seriesType,fillRange,location,isGridLinesEnabled,titre,xname,yname,500,300); 1115 } 1116 1117 607 */ 608 -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sectionToExecute.cc
r431 r455 9 9 #include "GWt_softwarePanel.h" 10 10 11 GWt_sectionToExecute::GWt_sectionToExecute(Wt::WComboBox* first,Wt::WComboBox* last,Wt::WComboBox* soft,Wt::WContainerWidget* buttonPanel, GWt_softwarePanel* sPanel )11 GWt_sectionToExecute::GWt_sectionToExecute(Wt::WComboBox* first,Wt::WComboBox* last,Wt::WComboBox* soft,Wt::WContainerWidget* buttonPanel, GWt_softwarePanel* sPanel,GWt_sector* sect) 12 12 :WContainerWidget(), 13 13 firstElement(first), 14 14 lastElement(last), 15 15 software(soft), 16 softwarePanel(sPanel) 16 softwarePanel(sPanel), 17 UI_sector_(sect) 17 18 { 18 19 Wt::WGridLayout* mainContainerLayout = new Wt::WGridLayout(); … … 138 139 139 140 } 141 142 /* 143 void GWt_sectionToExecute::setSoftware(nomDeLogiciel logiciel) 144 { 145 UI_sector_->getSectorControler()->setSoftware(logiciel); 146 147 } 148 149 */ -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sector.cc
r453 r455 11 11 12 12 GWt_sector::GWt_sector(GWt_accelerator* parent,sector* sect) : 13 parent_(parent),14 sector _(sect)13 UI_Accelerator_(parent), 14 sectorControler_(sect) 15 15 { 16 setIcon( parent->getAcceleratorGlobalViewLayout());16 setIcon(UI_Accelerator_->getAcceleratorGlobalViewLayout()); 17 17 } 18 18 … … 34 34 parentLineLayout->addWidget(sectorContainer); 35 35 36 WLabel* icon = new WLabel(sector _->getName(),sectorContainer);36 WLabel* icon = new WLabel(sectorControler_->getName(),sectorContainer); 37 37 icon->setStyleClass("sectionIcon"); 38 38 icon->setHeight(100); … … 42 42 43 43 std::stringstream str; 44 str << sector _->getRepetitionNumber();44 str << sectorControler_->getRepetitionNumber(); 45 45 std::string result; 46 46 str >> result; … … 48 48 // Add repetition times 49 49 WText* t = new WText(" x"+result+" ",sectorContainer); 50 if (sector _->getRepetitionNumber() > 1) {51 t->setToolTip(" repeted "+result+" times");50 if (sectorControler_->getRepetitionNumber() > 1) { 51 t->setToolTip("executed "+result+" times"); 52 52 } else { 53 t->setToolTip(" repeted "+result+" time");53 t->setToolTip("executed "+result+" time"); 54 54 } 55 55 new WBreak(sectorContainer); 56 56 57 57 // Add refected 58 if (sector _->getReflected()) {59 WText* t = new WText(" reflected from "+sector _->getDuplicatedFrom()->getName(),sectorContainer);60 } else if (sector _->getDuplicatedFrom() != NULL) {61 WText* t = new WText(" duplicated from "+sector _->getDuplicatedFrom()->getName(),sectorContainer);58 if (sectorControler_->getReflected()) { 59 WText* t = new WText(" reflected from "+sectorControler_->getDuplicatedFrom()->getName(),sectorContainer); 60 } else if (sectorControler_->getDuplicatedFrom() != NULL) { 61 WText* t = new WText(" duplicated from "+sectorControler_->getDuplicatedFrom()->getName(),sectorContainer); 62 62 } 63 63 new WBreak(sectorContainer); … … 68 68 69 69 70 void GWt_sector::createWidgetBeamLine( PspaApplication* pspa,WContainerWidget* parent) {70 void GWt_sector::createWidgetBeamLine(WContainerWidget* parent) { 71 71 72 72 // suppress old detailled view if present 73 73 parent->clear(); 74 74 75 // add the detailled view 75 76 WContainerWidget* wdg = new WContainerWidget(parent); 76 77 … … 89 90 // menu->setLayout(hmenuLayout); 90 91 91 new WLabel(sector _->getName()+" ",menu);92 new WLabel(sectorControler_->getName()+" ",menu); 92 93 93 94 WPushButton* actionParameters = new WPushButton("",menu); … … 110 111 111 112 // Add beamLine for this sector 112 beamLine_ = new GWt_ligneFaisceau(pspa); 113 vContainerLayout->addWidget(beamLine_); 113 UI_beamLine_ = new GWt_ligneFaisceau(getAccelerator()->getDataManager(),this); 114 vContainerLayout->addWidget(UI_beamLine_); 115 116 // add the software panel 117 executeWidget_ = new GWt_softwarePanel(getAccelerator()->getDataManager(),this); 118 vContainerLayout->addWidget(executeWidget_); 119 120 114 121 wdg->setLayout(vContainerLayout); 115 122 } … … 117 124 118 125 void GWt_sector::displayWidgetBeamLine() { 119 createWidgetBeamLine( parent_->getControler(),parent_->getAcceleratorDetailledView());126 createWidgetBeamLine(getAccelerator()->getAcceleratorDetailledView()); 120 127 } -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sectorParameters.cc
r436 r455 15 15 #define BAVARD 0 16 16 17 GWt_sectorParameters::GWt_sectorParameters(dataManager* dt)18 {19 dt_ = dt;20 }21 22 17 void GWt_sectorParameters::setText(WText *st) 23 18 { … … 25 20 } 26 21 27 void GWt_sectorParameters::execDialog ()22 void GWt_sectorParameters::execDialog_deprecated() 28 23 { 29 24 #if BAVARD > 0 … … 41 36 42 37 gb_ = new WGroupBox("sectors",dialog_->contents()); 43 createSector();38 // createSector(); 44 39 45 40 dialog_->contents()->addWidget(new WBreak()); … … 58 53 } 59 54 60 void GWt_sectorParameters::createSector ()55 void GWt_sectorParameters::createSector_deprecated() 61 56 { 62 57 #if BAVARD > 0 … … 68 63 hbox->setContentsMargins(0,0,0,0); 69 64 70 vector<statements> v = dt_->getSectorParameters()->getSectors();65 /* vector<statements> v = getSectors(); 71 66 72 67 hbox->addWidget(new WText("name : ")); … … 89 84 hbox->addWidget(repeat_); 90 85 91 WContainerWidget* bs= buttons (cnt_.size());86 WContainerWidget* bs= buttons_deprecated(cnt_.size()); 92 87 hbox->addWidget(bs); 93 88 … … 115 110 116 111 w3->setLayout(grid); 117 gb_->addWidget(w3); 118 } 119 120 WContainerWidget* GWt_sectorParameters::buttons(int num) 112 gb_->addWidget(w3); 113 */ 114 } 115 116 WContainerWidget* GWt_sectorParameters::buttons_deprecated(int num) 121 117 { 122 118 #if BAVARD > 0 … … 157 153 setStatus("OK..."); 158 154 setAttributes(); 159 dt_->getSectorParameters()->setSectors(sectors_);155 // setSectors(sectors_); 160 156 } else { 161 157 setStatus("Cancelled!"); … … 163 159 } 164 160 165 #if BAVARD > 0161 /*#if BAVARD > 0 166 162 cout << "dialogDone():: sectors_.size()= " << sectors_.size() << endl; 167 163 for(int i = 0; i < sectors_.size(); i++) { … … 169 165 } 170 166 #endif 171 167 */ 172 168 cnt_.clear(); 173 169 } … … 182 178 setStatus("add sector"); 183 179 setAttributes(); 184 createSector();180 // createSector(); 185 181 } 186 182 -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc
r449 r455 17 17 #include "GWt_dialog.h" 18 18 #include "GWt_console.h" 19 #include "GWt_sector.h" 19 20 #include "GWt_globalParameters.h" 20 21 #include "GWt_sectionToExecute.h" … … 23 24 #define BAVARD 0 24 25 25 GWt_softwarePanel::GWt_softwarePanel(dataManager* dataManager, PspaApplication* pspa,WContainerWidget* parent)26 : WContainerWidget( parent)27 { 28 dtmanage_ = dataManager; 29 pspa_ = pspa; 26 GWt_softwarePanel::GWt_softwarePanel(dataManager* dataManager,GWt_sector* sect) 27 : WContainerWidget(), 28 dtmanage_(dataManager), 29 UIsector_(sect) 30 { 30 31 31 32 // bouton execute … … 51 52 void GWt_softwarePanel::addSectionToExecuteW() 52 53 { 54 cout << "***********************************" << endl; 55 cout << "* A réécrire *" << endl; 56 cout << "***********************************" << endl; 57 return; 53 58 #if BAVARD > 0 54 59 cout << "***********************************" << endl; … … 56 61 #endif 57 62 58 abstractElement* premierElement ;59 abstractElement* dernierElement ;63 abstractElement* premierElement = NULL; 64 abstractElement* dernierElement = NULL; 60 65 61 66 int premierIndex = 0; … … 63 68 64 69 cout << "sections_.size() = " << sections_.size() << endl; 65 70 /* 66 71 // if there is no section 67 72 if(sections_.size() == 0) { … … 87 92 88 93 dtmanage_->addSectionToExecute(premierElement,premierIndex,dernierElement,dernierIndex,nomDeLogiciel()); 89 94 */ 90 95 std::string premierElementLabel = ""; 91 96 std::string dernierElementLabel = ""; … … 109 114 fillComboWithSoftwares(softCombo); 110 115 111 GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFromCombo,lineToCombo,softCombo,createAddDeletePushButtons(sections_.size()),this );116 GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFromCombo,lineToCombo,softCombo,createAddDeletePushButtons(sections_.size()),this,UIsector_); 112 117 113 118 stringstream st; … … 165 170 // traitement de la premiere ligne 166 171 // on impose le depart du calcul au premier element 167 string premier = dtmanage_->getLabelFromElementNumero(1); 172 string premier = ""; 173 if (UIsector_->getSectorControler()) { 174 if (UIsector_->getSectorControler()->getSectionsToExecute().size() > 0) { 175 if (UIsector_->getSectorControler()->getSectionsToExecute()[0]->getElements().size() > 0) { 176 premier = UIsector_->getSectorControler()->getSectionsToExecute()[0]->getElements()[0]->getLabel(); 177 } 178 } 179 } 180 181 // FIXME : A réécrire 182 /* 168 183 if (sections_.size() > 0) { 169 184 sections_[0]->setFirstElementCurrentSelection(premier); … … 235 250 exec_go_->enable(); 236 251 } 237 252 */ 238 253 return true; 239 254 } … … 241 256 bool GWt_softwarePanel::areDataCoherent() 242 257 { 258 // FIXME 259 cout << "***********************************" << endl; 260 cout << "** To be move in controler **" << endl; 261 cout << "***********************************" << endl; 262 return true; 243 263 #if BAVARD > 0 244 264 cout << "***********************************" << endl; … … 247 267 248 268 bool caMarche = true; 249 269 /* 250 270 // initialize dataManager 251 271 dtmanage_->initializeExecution(); … … 299 319 sections_[a]->setWarnings(diagnosticWarnings); 300 320 }//a 301 321 */ 302 322 return caMarche; 303 323 } … … 319 339 320 340 // delete from dataManager 321 dtmanage_->clearSectionToExecute(sectionIndex);341 UIsector_->getSectorControler()->clearSectionToExecute(sectionIndex); 322 342 323 343 // delete from User Interface … … 352 372 // exec_go_->setDisabled(true); 353 373 calculDialog.hide(); 354 pspa_->faireDessin();374 UIsector_->getAccelerator()->faireDessin(); 355 375 } 356 376 357 377 void GWt_softwarePanel::fillComboWithElements(Wt::WComboBox* cBox) 358 378 { 359 if (cBox == NULL) return; 379 // FIXME 380 cout << "***********************************" << endl; 381 cout << "** To be move in controler **" << endl; 382 cout << "***********************************" << endl; 383 return; 384 385 /* if (cBox == NULL) return; 360 386 361 387 // get the last item selected … … 376 402 } 377 403 cBox->refresh(); 404 */ 378 405 } 379 406
Note: See TracChangeset
for help on using the changeset viewer.