Changeset 160 in PSPA for Interface_Web/trunk
- Timestamp:
- Dec 9, 2012, 1:50:14 PM (12 years ago)
- Location:
- Interface_Web/trunk/pspaWT
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/cmt/requirements
r156 r160 22 22 #macro PSPSLib_linkopts " -L${PSPAWTROOT}/$(Platform_bin) -lPSPSLib " 23 23 24 application pspaWT bareParticle.cc particleBeam.cc GWt_cell.cc GWt_rfgun.cc GWt_soleno.cc GWt_bend.cc GWt_globalParameters.cc GWt_drift.cc GWt_abstractElement.cc dataManager.cc elementsCollection.cc elementDrift.cc elementCell.cc elementRfgun.cc elementSoleno.cc elementBend.cc globalParameters.cc abstractElement.cc GWt_LigneFaisceau.cc GWt_pspaApplication.cc GWt_dialog.cc nomdElements.cc main.cc use_cppflags='" ${lib_PSPSLib_cppflags} "'24 application pspaWT bareParticle.cc particleBeam.cc GWt_cell.cc GWt_rfgun.cc GWt_soleno.cc GWt_bend.cc GWt_globalParameters.cc GWt_drift.cc GWt_abstractElement.cc dataManager.cc elementsCollection.cc elementDrift.cc elementCell.cc elementRfgun.cc elementSoleno.cc elementBend.cc globalParameters.cc abstractElement.cc GWt_LigneFaisceau.cc GWt_pspaApplication.cc GWt_dialog.cc nomdElements.cc nomDeLogiciel.cc main.cc use_cppflags='" ${lib_PSPSLib_cppflags} "' 25 25 26 26 macro DrawWt_linkopts " ${PSPSLib_linkopts} ${Wt_linkopts} ${boost_linkopts} ${dld_linkopts}" -
Interface_Web/trunk/pspaWT/include/nomDeLogiciel.h
r107 r160 4 4 #include <string> 5 5 6 using namespace std; 6 7 7 8 class nomDeLogiciel … … 23 24 int value_; 24 25 25 static Logiciel fromString( std::string s) 26 { 27 if (s == "parmela" ) return parmela; 28 else if ( s == "transport" ) return transport; 29 return unknownSoftware; 30 } 31 32 static std::string toString( Logiciel lg) 33 { 34 switch (lg) 35 { 36 case parmela : { return "parmela"; } 37 case transport : { return "transport"; } 38 case unknownSoftware : { return "unknownSoftware"; } 39 } 40 return "unknownSoftware"; 41 } 42 43 static Logiciel fromValue( int v) 44 { 45 switch (v) 46 { 47 case 0 : { return parmela; } 48 case 1 : { return transport; } 49 } 50 return unknownSoftware; 51 } 52 53 static int toValue( Logiciel lg) 54 { 55 switch (lg) 56 { 57 case parmela : { return 0; } 58 case transport : { return 1; } 59 case unknownSoftware : { return 2; } 60 } 61 return -1; 62 } 26 static Logiciel fromString( std::string s); 27 static std::string toString( Logiciel lg); 28 static Logiciel fromValue( int v); 29 static int toValue( Logiciel lg); 63 30 64 31 public : 65 32 // constructors 66 33 67 nomDeLogiciel() : program_(transport) 68 { 69 progString_ = toString(program_); 70 value_ = toValue(program_); 71 } 34 nomDeLogiciel(); 35 nomDeLogiciel(const string& s); 36 nomDeLogiciel(int val); 72 37 73 74 nomDeLogiciel(const string& s) 75 { 76 program_ = fromString(s); 77 progString_ = toString(program_); 78 value_ = toValue(program_); 79 } 80 81 nomDeLogiciel(int val) 82 { 83 program_ = fromValue(val); 84 progString_ = toString(program_); 85 value_ = toValue(program_); 86 } 87 88 static int getNumberOfSoftwares() { return toValue(unknownSoftware);} 38 static int getNumberOfSoftwares(); 89 39 90 40 inline std::string getString() const {return progString_;} … … 92 42 // operators 93 43 94 nomDeLogiciel& operator= (const nomDeLogiciel& nl) 95 { 96 program_ = nl.program_; 97 progString_ = nl.progString_; 98 value_ = nl.value_; 99 return *this; 100 } 101 102 bool operator== (const nomDeLogiciel& nl) 103 { 104 return ( program_ == nl.program_); 105 } 106 107 bool operator!= (const nomDeLogiciel& nl) 108 { 109 return ( program_ != nl.program_); 110 } 44 nomDeLogiciel& operator= (const nomDeLogiciel& nl); 45 bool operator== (const nomDeLogiciel& nl); 46 bool operator!= (const nomDeLogiciel& nl); 111 47 112 48 }; -
Interface_Web/trunk/pspaWT/include/nomdElements.h
r153 r160 6 6 enum typedElement {RFgun, drift, cell, bend, soleno, inconnu}; 7 7 8 9 8 10 class nomdElements 9 11 { 10 typedElement e_; 11 std::string eStr_; 12 std::string eImg_; 12 typedElement e_; // type entier (enum) 13 std::string eName_; // nom de l'element 14 std::string eImg_; // nom du fichier de l'icone 15 std::string eLabel_; // label affiche sous l'icone 13 16 14 typedElement fromString(std::string s); 15 std::string toString(typedElement eType); 16 std::string toImage(typedElement eType); 17 18 static typedElement fromImage(std::string s); 19 static std::string toName(typedElement eType); 20 static std::string toImage(typedElement eType); 21 static std::string toLabel(typedElement eType); 17 22 18 23 public : … … 26 31 27 32 static int getNumberOfElements(); 33 static string getImageFromType( typedElement tp); 34 static std::string getLabelFromType(typedElement tp); 35 28 36 typedElement getElementType() const; 29 37 std::string getElementName() const; -
Interface_Web/trunk/pspaWT/src/GWt_LigneFaisceau.cc
r156 r160 22 22 int nElts= nomdElements::getNumberOfElements(); 23 23 nObjets_= new Compteur[nElts]; 24 nomdElements *e;25 24 for(int k = 0; k < nElts; k++) { 26 25 typedElement eType= (typedElement)k; 27 e= new nomdElements(eType); 28 acceptDrops(e->getElementImage()); 29 delete e; 26 acceptDrops(nomdElements::getImageFromType(eType)); 30 27 } 31 28 … … 98 95 { 99 96 abstractElement* ptr = pspa_->getDataManager()->getCollection()->getElementPointer(k); 100 // typedElement eType= ptr->getName();101 // nomdElements e(eType);102 103 // GWt_abstractElement* gw = GWt_abstractElement::ajoute(pspa_,ptr, ptr->getName().getElementImage());104 97 GWt_abstractElement* gw = GWt_abstractElement::ajoute(pspa_,ptr); 105 98 if(gw == NULL) { -
Interface_Web/trunk/pspaWT/src/GWt_abstractElement.cc
r156 r160 19 19 20 20 dropped_ = new WPushButton(); 21 // dropped_->setIcon(image);22 21 dropped_->setIcon(element_->getName().getElementImage()); 23 22 dropped_->setMaximumSize(50,50); -
Interface_Web/trunk/pspaWT/src/GWt_pspaApplication.cc
r152 r160 111 111 int nElts= nomdElements::getNumberOfElements(); 112 112 113 nomdElements *e;114 113 for(int k = 0; k < nElts; k++) { 115 114 typedElement eType= (typedElement)k; 116 e= new nomdElements(eType); 117 string image = e->getElementImage(); 115 string image = nomdElements::getImageFromType(eType); 118 116 createDragImage(image.c_str(), 119 image.c_str(),image.c_str(), palette, e->getElementLabel());117 image.c_str(),image.c_str(), palette,nomdElements::getLabelFromType(eType)); 120 118 new WBreak(palette); 121 delete e;122 119 } 123 120 -
Interface_Web/trunk/pspaWT/src/nomdElements.cc
r153 r160 4 4 #include "nomdElements.h" 5 5 6 typedElement nomdElements::from String(std::string s)6 typedElement nomdElements::fromImage(std::string s) 7 7 { 8 8 if( strstr(s.c_str(),"rfgun") ) return RFgun; … … 14 14 } 15 15 16 std::string nomdElements::to String(typedElement eType)16 std::string nomdElements::toName(typedElement eType) 17 17 { 18 18 switch(eType) { … … 38 38 } 39 39 40 std::string nomdElements::toLabel(typedElement eType) 41 { 42 switch(eType) { 43 case RFgun : return "RFgun"; 44 case drift : return "drift"; 45 case cell : return "cell"; 46 case bend : return "bend"; 47 case soleno : return "solnd"; 48 default : return string(""); 49 } 50 } 51 52 40 53 nomdElements::nomdElements() 41 54 { 42 e_= fromString(""); 43 eStr_= toString(e_); 44 eImg_= toImage(e_); 55 e_= fromImage(""); 56 eName_ = toName(e_); 57 eImg_ = toImage(e_); 58 eLabel_ = toLabel(e_); 45 59 } 46 60 … … 48 62 { 49 63 e_= ne.e_; 50 eStr_= ne.eStr_; 51 eImg_= ne.eImg_; 64 eName_ = ne.eName_; 65 eImg_ = ne.eImg_; 66 eLabel_ = ne.eLabel_; 52 67 } 53 68 … … 55 70 { 56 71 e_= ne.e_; 57 eStr_= ne.eStr_; 58 eImg_= ne.eImg_; 72 eName_ = ne.eName_; 73 eImg_ = ne.eImg_; 74 eLabel_ = ne.eLabel_; 59 75 } 60 76 … … 62 78 nomdElements::nomdElements(const std::string& s) 63 79 { 64 e_= fromString(s); 65 eStr_= toString(e_); 66 eImg_= toImage(e_); 80 e_= fromImage(s); 81 eName_ = toName(e_); 82 eImg_ = toImage(e_); 83 eLabel_ = toLabel(e_); 67 84 } 68 85 … … 70 87 { 71 88 e_= eType; 72 eStr_= toString(e_); 73 eImg_= toImage(e_); 89 eName_ = toName(e_); 90 eImg_ = toImage(e_); 91 eLabel_ = toLabel(e_); 74 92 } 75 93 … … 78 96 } 79 97 98 std::string nomdElements::getImageFromType( typedElement tp) 99 { 100 return toImage(tp); 101 } 102 103 std::string nomdElements::getLabelFromType(typedElement tp) 104 { 105 return toLabel(tp); 106 } 107 108 109 110 80 111 typedElement nomdElements::getElementType() const { 81 112 return e_; … … 83 114 84 115 std::string nomdElements::getElementName() const { 85 return e Str_;116 return eName_; 86 117 } 87 118 … … 92 123 std::string nomdElements::getElementLabel() const 93 124 { 94 switch(e_) { 95 case RFgun : return "RFgun"; break; 96 case drift : return "drift"; break; 97 case cell : return "cell"; break; 98 case bend : return "bend"; break; 99 case soleno : return "solnd"; break; 100 default : return ""; 101 } 125 return eLabel_; 102 126 } 127 128 129 103 130 104 131 // operators … … 107 134 { 108 135 e_= ne.e_; 109 eStr_= ne.eStr_; 110 eImg_= ne.eImg_; 136 eName_ = ne.eName_; 137 eImg_ = ne.eImg_; 138 eLabel_ = ne.eLabel_; 111 139 }
Note: See TracChangeset
for help on using the changeset viewer.