Changeset 287 in PSPA for Interface_Web


Ignore:
Timestamp:
Jan 28, 2013, 3:21:51 PM (11 years ago)
Author:
garnier
Message:

ajout de tooltip et nettoyage de code

Location:
Interface_Web/trunk/pspaWT
Files:
37 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/History

    r286 r287  
    55     PSPA - Plateforme de simulation en physique des accélérateurs
    66     =========================================================
     7
     828 Janvier 2012  Laurent Garnier
     9- GWt_ligneFaisceau:
     10  o Suppression de code inutile
     11  o insertion des éléments dans la liste des objets de la ligne
     12
     13- GWt_bend, GWt_drift, GWt_beam
     14  GWt_soleno, GWt_fit, GWt_rfgun
     15  GWt_cell : ajout d'une méthode print()
     16
     17- GWt_elementLigneFaisceau.cc : Ajout d'un tooltipsurles éléments et suppression
     18  de méthodes inutiles
     19
     20- mixedTools.h : ajout de la méthode boolToString()
     21
     22- elementRfgun, elementFit, elementSoleno
     23  elementBeam, elementDrift, elementBend
     24  elementCell : ajout d'une méthode print()
    725
    82625 Janvier 2012  Laurent Garnier
  • Interface_Web/trunk/pspaWT/sources/controler/include/abstractElement.h

    r271 r287  
    1414class abstractElement
    1515{
    16  protected :
    17  
    18   int nbParam_;
    19   string* parametersString_;
    20   //  double phaseStep_; // a recuperer dans les parametres globaux (methode setPhaseStep)
    21   double phaseStepMax_;
    22 
    23   double defaultLength_;
    24   double defaultAperture_;
    25   string defaultLabel_;
    26 
    27   string label_;
    28   nomdElements elementName_;
    29 
    30   double lenghtElem_; // cm
    31   double aperture_; // cm
    32 
    33   double stepmaxcm_;
    34   //  bool curvedTrajectory_;
    35 
    36   void setDefaultValues();
    37   void setDefaults();
    38 
    39  public :
    40 
    41   abstractElement();
    42   abstractElement(string lab);
    43   virtual ~abstractElement();
    44 
    45   void setParameters(double ll,double aper);
    46   void setLabel(string lab);
    47   string getLabel() const;
    48   //  typedElement getName() const;
    49   nomdElements getNomdElement() const;
    50 
    51   /* string getElementImage() const; */
    52   /* string getElementName() const; */
    53 
    54   double getLenghtOfElement() const;
    55   int getNbParams() const; 
    56   /* bool is_parmela_ignored() const; */
    57   /* bool is_parmela_element() const; */
    58   /* bool is_transport_element() const; */
    59   virtual trivaluedBool is_accepted_by_software(nomDeLogiciel soft) const;
    60   virtual void setPhaseStep(double);
    61   virtual double getInitialKineticEnergy() const;
    62 
    63   virtual void setParametersString(string* param) = 0;
    64   virtual string* getParametersString() const = 0;
    65   virtual string parmelaOutputFlow() const = 0;
    66   virtual string transportOutputFlow() const = 0;
    67   virtual string FileOutputFlow() const = 0;
    68   virtual void FileInput(ifstream& ifs) = 0;
     16    protected :
     17   
     18    int nbParam_;
     19    string* parametersString_;
     20    //  double phaseStep_; // a recuperer dans les parametres globaux (methode setPhaseStep)
     21    double phaseStepMax_;
     22   
     23    double defaultLength_;
     24    double defaultAperture_;
     25    string defaultLabel_;
     26   
     27    string label_;
     28    nomdElements elementName_;
     29   
     30    double lenghtElem_; // cm
     31    double aperture_; // cm
     32   
     33    double stepmaxcm_;
     34    //  bool curvedTrajectory_;
     35   
     36    void setDefaultValues();
     37    void setDefaults();
     38   
     39    public :
     40   
     41    abstractElement();
     42    abstractElement(string lab);
     43    virtual ~abstractElement();
     44   
     45    void setParameters(double ll,double aper);
     46    void setLabel(string lab);
     47    string getLabel() const;
     48    //  typedElement getName() const;
     49    nomdElements getNomdElement() const;
     50   
     51    /* string getElementImage() const; */
     52    /* string getElementName() const; */
     53   
     54    double getLenghtOfElement() const;
     55    int getNbParams() const;
     56    /* bool is_parmela_ignored() const; */
     57    /* bool is_parmela_element() const; */
     58    /* bool is_transport_element() const; */
     59    virtual trivaluedBool is_accepted_by_software(nomDeLogiciel soft) const;
     60    virtual void setPhaseStep(double);
     61    virtual double getInitialKineticEnergy() const;
     62   
     63    virtual void setParametersString(string* param) = 0;
     64    virtual string* getParametersString() const = 0;
     65    virtual string parmelaOutputFlow() const = 0;
     66    virtual string transportOutputFlow() const = 0;
     67    virtual string FileOutputFlow() const = 0;
     68    virtual void FileInput(ifstream& ifs) = 0;
     69    virtual string print() = 0;
    6970};
    7071#endif
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementBeam.h

    r257 r287  
    1111class elementBeam : public abstractElement
    1212{
     13   
     14    double x_, xp_, y_, yp_;
     15    double dl_, del_;
     16    double p0_;
     17   
     18    double xDef_, xpDef_, yDef_, ypDef_;
     19    double dlDef_, delDef_;
     20    double p0Def_;
     21   
     22    void setDefaultValues();
     23   
     24    void setDefaults();
     25   
     26    public :
     27   
     28    elementBeam();
     29   
     30    ~elementBeam();
     31   
     32    virtual  trivaluedBool is_accepted_by_software(nomDeLogiciel soft) const;
     33   
     34   
     35    virtual void setParametersString(string* param);
     36   
     37    virtual string* getParametersString() const;
     38   
     39    virtual  string parmelaOutputFlow() const;
     40   
     41   
     42    virtual string transportOutputFlow() const;
     43   
     44   
     45    virtual string FileOutputFlow() const;
     46   
     47    virtual void FileInput(ifstream& ifs);
    1348
    14   double x_, xp_, y_, yp_;
    15   double dl_, del_;
    16   double p0_;
    17 
    18   double xDef_, xpDef_, yDef_, ypDef_;
    19   double dlDef_, delDef_;
    20   double p0Def_;
    21 
    22   void setDefaultValues();
    23 
    24   void setDefaults();
    25 
    26  public :
    27 
    28   elementBeam();
    29 
    30 ~elementBeam();
    31 
    32 virtual  trivaluedBool is_accepted_by_software(nomDeLogiciel soft) const;
    33 
    34 
    35  virtual void setParametersString(string* param);
    36 
    37   virtual string* getParametersString() const;
    38 
    39  virtual  string parmelaOutputFlow() const;
    40 
    41 
    42  virtual string transportOutputFlow() const;
    43 
    44 
    45   virtual string FileOutputFlow() const;
    46 
    47   virtual void FileInput(ifstream& ifs);
    48 
     49    /** return a string with all parameters and value
     50     */
     51    string print();
     52   
    4953};
    5054#endif
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementBend.h

    r257 r287  
    77#include "mathematicalTools.h"
    88//#include "PhysicalConstants.h"
    9  
     9
    1010
    1111using namespace std;
     
    1616class elementBend : public abstractElement
    1717{
    18 
    19   double angleDeg_; // deg.
    20   double radius_; // m
    21   double beta1_; // deg.
    22   double beta2_; // deg.
    23   double momentum_; // MeV/c
    24 
    25   double angleDegDef_; // deg.
    26   double radiusDef_; // m
    27   double beta1Def_; // deg.
    28   double beta2Def_; // deg.
    29   double momentumDef_; // MeV/c
    30 
    31 
    32 
    33   void setDefaultValues();
    34   void setDefaults();
    35 
    36 
    37  public:
    38 
    39   elementBend();
    40 
    41   ~elementBend() {;}
    42 
    43   double getLenghtOfElement() const;
    44 
    45  virtual trivaluedBool is_accepted_by_software(nomDeLogiciel soft) const;
    46 
    47 
    48   virtual void setParametersString(string* param);
    49 
    50   virtual string* getParametersString() const;
    51 
    52   virtual  string parmelaOutputFlow() const;
    53 
    54  virtual string transportOutputFlow() const;
    55 
    56  virtual  string FileOutputFlow() const;
    57 
    58  virtual void FileInput(ifstream& ifs);
    59 
     18   
     19    double angleDeg_; // deg.
     20    double radius_; // m
     21    double beta1_; // deg.
     22    double beta2_; // deg.
     23    double momentum_; // MeV/c
     24   
     25    double angleDegDef_; // deg.
     26    double radiusDef_; // m
     27    double beta1Def_; // deg.
     28    double beta2Def_; // deg.
     29    double momentumDef_; // MeV/c
     30   
     31   
     32   
     33    void setDefaultValues();
     34    void setDefaults();
     35   
     36   
     37public:
     38   
     39    elementBend();
     40   
     41    ~elementBend() {;}
     42   
     43    double getLenghtOfElement() const;
     44   
     45    virtual trivaluedBool is_accepted_by_software(nomDeLogiciel soft) const;
     46   
     47   
     48    virtual void setParametersString(string* param);
     49   
     50    virtual string* getParametersString() const;
     51   
     52    virtual  string parmelaOutputFlow() const;
     53   
     54    virtual string transportOutputFlow() const;
     55   
     56    virtual  string FileOutputFlow() const;
     57   
     58    virtual void FileInput(ifstream& ifs);
     59   
     60    /** return a string with all parameters and value
     61     */
     62    string print();
     63   
    6064};
    6165
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementCell.h

    r257 r287  
    1313class elementCell : public abstractElement
    1414{
    15 
    16   //  int nbParam_;
    17   // string* parametersString_;
    18 
    19 
    20   double initialPhaseDef_;
    21   double acceleratingFieldDef_;
    22 
    23   string acceleratingShapeFileDef_;
    24   string focusingMagFileDef_;
    25   double offsetMagDef_;
    26   double scaleFactorDef_;
    27 
    28   double initialPhase_;
    29   double acceleratingField_;
    30 
    31   string acceleratingShapeFile_;
    32   string focusingMagFile_;
    33   double offsetMag_;
    34   double scaleFactor_;
    35 
    36 
    37   void setDefaultValues();
    38 
    39   void setDefaults();
    40 
    41  public :
    42 
    43   elementCell();
    44 
    45 
    46   ~elementCell() { ;}
    47 
    48  virtual trivaluedBool is_accepted_by_software(nomDeLogiciel soft) const;
    49 
    50   virtual string* getParametersString() const;
    51 
    52  virtual void setParametersString(string* param);
    53 
    54   virtual  string parmelaOutputFlow() const;
    55 
    56 virtual string transportOutputFlow() const
    57   {
    58     ostringstream sortie;
    59     cout << " CELL sortie transport non programmee " << endl;
    60     return sortie.str();
    61   }
    62 
    63 
    64   virtual string FileOutputFlow() const;
    65 
    66   virtual void FileInput(ifstream& ifs);
    67 
     15   
     16    //  int nbParam_;
     17    // string* parametersString_;
     18   
     19   
     20    double initialPhaseDef_;
     21    double acceleratingFieldDef_;
     22   
     23    string acceleratingShapeFileDef_;
     24    string focusingMagFileDef_;
     25    double offsetMagDef_;
     26    double scaleFactorDef_;
     27   
     28    double initialPhase_;
     29    double acceleratingField_;
     30   
     31    string acceleratingShapeFile_;
     32    string focusingMagFile_;
     33    double offsetMag_;
     34    double scaleFactor_;
     35   
     36   
     37    void setDefaultValues();
     38   
     39    void setDefaults();
     40   
     41    public :
     42   
     43    elementCell();
     44   
     45   
     46    ~elementCell() { ;}
     47   
     48    virtual trivaluedBool is_accepted_by_software(nomDeLogiciel soft) const;
     49   
     50    virtual string* getParametersString() const;
     51   
     52    virtual void setParametersString(string* param);
     53   
     54    virtual  string parmelaOutputFlow() const;
     55   
     56    virtual string transportOutputFlow() const
     57    {
     58        ostringstream sortie;
     59        cout << " CELL sortie transport non programmee " << endl;
     60        return sortie.str();
     61    }
     62   
     63   
     64    virtual string FileOutputFlow() const;
     65   
     66    virtual void FileInput(ifstream& ifs);
     67   
     68    /** return a string with all parameters and value
     69     */
     70    string print();
     71   
    6872};
    6973
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementDrift.h

    r271 r287  
    99class elementDrift : public abstractElement
    1010{
    11 
    12   void setDefaultValues();
    13 
    14   void setDefaults();
    15 
    16  public:
    17 
    18   elementDrift();
    19 
    20 
    21   ~elementDrift() {;}
    22 
    23  virtual trivaluedBool is_accepted_by_software(nomDeLogiciel soft) const;
    24 
    25 
    26   virtual string* getParametersString() const;
    27 
    28   virtual void setParametersString(string* param);
    29 
    30   virtual  string parmelaOutputFlow() const;
    31 
    32   virtual string transportOutputFlow() const;
    33 
    34 
    35   virtual string FileOutputFlow() const;
    36 
    37   virtual void FileInput(ifstream& ifs);
    38 
     11   
     12    void setDefaultValues();
     13   
     14    void setDefaults();
     15   
     16public:
     17   
     18    elementDrift();
     19   
     20   
     21    ~elementDrift() {;}
     22   
     23    virtual trivaluedBool is_accepted_by_software(nomDeLogiciel soft) const;
     24   
     25   
     26    virtual string* getParametersString() const;
     27   
     28    virtual void setParametersString(string* param);
     29   
     30    virtual  string parmelaOutputFlow() const;
     31   
     32    virtual string transportOutputFlow() const;
     33   
     34   
     35    virtual string FileOutputFlow() const;
     36   
     37    virtual void FileInput(ifstream& ifs);
     38   
     39    /** return a string with all parameters and value
     40     */
     41    string print();
     42   
    3943};
    4044
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementFit.h

    r257 r287  
    1111class elementFit : public abstractElement
    1212{
    13 
    14 
    15   // unites transport ( cm ; mrad)
    16   string variableName_;
    17   double variableValue_, tolerance_;
    18 
    19   string variableNameDef_;
    20   double variableValueDef_, toleranceDef_;
    21 
    22   void setDefaultValues();
    23   void setDefaults();
    24 
    25 
    26  public:
    27 
    28   elementFit();
    29   ~elementFit() {;}
    30 
    31  virtual  trivaluedBool is_accepted_by_software(nomDeLogiciel soft) const;
    32 
    33 
    34   virtual void setParametersString(string* param);
    35 
    36   virtual string* getParametersString() const;
    37 
    38   virtual  string parmelaOutputFlow() const;
    39 
    40  virtual string transportOutputFlow() const;
    41 
    42  virtual  string FileOutputFlow() const;
    43 
    44  virtual void FileInput(ifstream& ifs);
    45 
     13   
     14   
     15    // unites transport ( cm ; mrad)
     16    string variableName_;
     17    double variableValue_, tolerance_;
     18   
     19    string variableNameDef_;
     20    double variableValueDef_, toleranceDef_;
     21   
     22    void setDefaultValues();
     23    void setDefaults();
     24   
     25   
     26public:
     27   
     28    elementFit();
     29    ~elementFit() {;}
     30   
     31    virtual  trivaluedBool is_accepted_by_software(nomDeLogiciel soft) const;
     32   
     33   
     34    virtual void setParametersString(string* param);
     35   
     36    virtual string* getParametersString() const;
     37   
     38    virtual  string parmelaOutputFlow() const;
     39   
     40    virtual string transportOutputFlow() const;
     41   
     42    virtual  string FileOutputFlow() const;
     43   
     44    virtual void FileInput(ifstream& ifs);
     45   
     46    /** return a string with all parameters and value
     47     */
     48    string print();
     49   
    4650};
    4751#endif
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementRfgun.h

    r257 r287  
    1212class elementRfgun : public abstractElement
    1313{
    14 
    15   //  int nbParam_;
    16   //  string* parametersString_;
    17 
    18   double defaultPhaseStep_;
    19   int defaultNmacrop_;
    20   double defaultSigma_t_;
    21   double defaultSigma_r_;
    22   double defaultE_cin_;
    23   double defaultSigma_E_;
    24   double defaultNb_true_particles_;
    25 
    26   double phaseStep_; // a recuperer dans les parametres globaux (methode setPhaseStep)
    27   int nmacrop_;
    28   double sigma_t_; // picoseconds
    29   double sigma_r_; // cm
    30   double E_cin_;   // MeV
    31   double sigma_E_; // MeV
    32   double nb_true_particles_;
    33 
    34   void setDefaultValues();
    35  
    36   void setDefaults();
    37 
    38  public:
    39 
    40   elementRfgun();
    41 
    42   ~elementRfgun() {;}
    43 
    44  virtual  trivaluedBool is_accepted_by_software(nomDeLogiciel soft) const;
    45 
    46   virtual void setPhaseStep(double ph) { phaseStep_ = ph;}
    47  
    48  
    49   virtual string* getParametersString() const;
    50  
    51   virtual void setParametersString(string* param);
    52  
    53   virtual inline double getInitialKineticEnergy() const {return E_cin_;}
    54  
    55   virtual string parmelaOutputFlow() const;
    56  
    57   virtual string transportOutputFlow() const
    58   {
    59     ostringstream sortie;
    60     cout << " CELL sortie transport non programmee " << endl;
    61     return sortie.str();
    62   }
    63  
    64  virtual string FileOutputFlow() const;
    65  
    66  virtual void FileInput(ifstream& ifs);
    67 
    68 
     14   
     15    //  int nbParam_;
     16    //  string* parametersString_;
     17   
     18    double defaultPhaseStep_;
     19    int defaultNmacrop_;
     20    double defaultSigma_t_;
     21    double defaultSigma_r_;
     22    double defaultE_cin_;
     23    double defaultSigma_E_;
     24    double defaultNb_true_particles_;
     25   
     26    double phaseStep_; // a recuperer dans les parametres globaux (methode setPhaseStep)
     27    int nmacrop_;
     28    double sigma_t_; // picoseconds
     29    double sigma_r_; // cm
     30    double E_cin_;   // MeV
     31    double sigma_E_; // MeV
     32    double nb_true_particles_;
     33   
     34    void setDefaultValues();
     35   
     36    void setDefaults();
     37   
     38public:
     39   
     40    elementRfgun();
     41   
     42    ~elementRfgun() {;}
     43   
     44    virtual  trivaluedBool is_accepted_by_software(nomDeLogiciel soft) const;
     45   
     46    virtual void setPhaseStep(double ph) { phaseStep_ = ph;}
     47   
     48   
     49    virtual string* getParametersString() const;
     50   
     51    virtual void setParametersString(string* param);
     52   
     53    virtual inline double getInitialKineticEnergy() const {return E_cin_;}
     54   
     55    virtual string parmelaOutputFlow() const;
     56   
     57    virtual string transportOutputFlow() const
     58    {
     59        ostringstream sortie;
     60        cout << " CELL sortie transport non programmee " << endl;
     61        return sortie.str();
     62    }
     63   
     64    virtual string FileOutputFlow() const;
     65   
     66    virtual void FileInput(ifstream& ifs);
     67   
     68    /** return a string with all parameters and value
     69     */
     70    string print();
     71   
     72   
    6973};
    7074
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementSoleno.h

    r257 r287  
    88//#include "mathematicalTools.h"
    99//#include "PhysicalConstants.h"
    10  
     10
    1111using namespace std;
    1212class elementSoleno : public abstractElement
    1313{
    14 
    15   double B0_;   // en kilogauss
    16   double B0Def_;   // en kilogauss
    17 
    18   bool varyB0_;
    19   bool varyB0Def_;
    20 
    21 
    22 
    23   void setDefaultValues();
    24   void setDefaults();
    25 
    26 
    27  
    28  public :
    29 
    30   elementSoleno();
    31 
    32   ~elementSoleno() {;}
    33 
    34   virtual trivaluedBool is_accepted_by_software(nomDeLogiciel soft) const;
    35 
    36  virtual void setParametersString(string* param);
    37 
    38  virtual string* getParametersString() const;
    39 
    40  virtual  string parmelaOutputFlow() const;
    41 
    42  virtual string transportOutputFlow() const;
    43 
    44  virtual  string FileOutputFlow() const;
    45 
    46  virtual void FileInput(ifstream& ifs);
    47 
     14   
     15    double B0_;   // en kilogauss
     16    double B0Def_;   // en kilogauss
     17   
     18    bool varyB0_;
     19    bool varyB0Def_;
     20   
     21   
     22   
     23    void setDefaultValues();
     24    void setDefaults();
     25   
     26   
     27   
     28    public :
     29   
     30    elementSoleno();
     31   
     32    ~elementSoleno() {;}
     33   
     34    virtual trivaluedBool is_accepted_by_software(nomDeLogiciel soft) const;
     35   
     36    virtual void setParametersString(string* param);
     37   
     38    virtual string* getParametersString() const;
     39   
     40    virtual  string parmelaOutputFlow() const;
     41   
     42    virtual string transportOutputFlow() const;
     43   
     44    virtual  string FileOutputFlow() const;
     45   
     46    virtual void FileInput(ifstream& ifs);
     47   
     48    /** return a string with all parameters and value
     49     */
     50    string print();
     51   
    4852};
    4953#endif
  • Interface_Web/trunk/pspaWT/sources/controler/include/mixedTools.h

    r257 r287  
    99class mixedTools
    1010{
    11  public:
    12 
    13   static string doubleToString(double x)
    14   {
    15     std::ostringstream ostr;
    16     ostr << x;
    17     return ostr.str();
    18   }
    19   static string intToString(int x)
    20   {
    21     std::ostringstream ostr;
    22     ostr << x;
    23     return ostr.str();
    24   }
     11public:
     12   
     13    static string doubleToString(double x)
     14    {
     15        std::ostringstream ostr;
     16        ostr << x;
     17        return ostr.str();
     18    }
     19    static string intToString(int x)
     20    {
     21        std::ostringstream ostr;
     22        ostr << x;
     23        return ostr.str();
     24    }
     25    static string boolToString(bool x)
     26    {
     27        if (x) {
     28            return "true";
     29        } else {
     30            return "false";
     31        }
     32    }
    2533};
    26 
     34   
    2735#endif
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementBeam.cc

    r271 r287  
    33#include "mixedTools.h"
    44
    5 
    6 
    75elementBeam::elementBeam() :  abstractElement() {
    8   setDefaultValues();
    9   setDefaults();
    10   elementName_ = nomdElements("beam");
    11   nbParam_ = elementName_.getElementNbParameters();
    12   parametersString_ = new string[nbParam_+1];
    13   //  transportOk_ = true;
     6    setDefaultValues();
     7    setDefaults();
     8    elementName_ = nomdElements("beam");
     9    nbParam_ = elementName_.getElementNbParameters();
     10    parametersString_ = new string[nbParam_+1];
     11    //  transportOk_ = true;
    1412}
    1513
     
    1715
    1816void elementBeam::setDefaultValues() {
    19   defaultLabel_ = "beam999";
    20   xDef_ = 0.0;
    21   xpDef_ = 0.0;
    22   yDef_ = 0.0;
    23   ypDef_ = 0.0;
    24   dlDef_ = 0.0;
    25   delDef_ = 0.0;
    26   p0Def_ = 0.0;
    27   }
     17    defaultLabel_ = "beam999";
     18    xDef_ = 0.0;
     19    xpDef_ = 0.0;
     20    yDef_ = 0.0;
     21    ypDef_ = 0.0;
     22    dlDef_ = 0.0;
     23    delDef_ = 0.0;
     24    p0Def_ = 0.0;
     25}
    2826
    29   void elementBeam::setDefaults() {
     27void elementBeam::setDefaults() {
    3028    label_ = defaultLabel_;
    3129    x_ = xDef_;
     
    3634    del_ = delDef_;
    3735    p0_ = p0Def_;
    38   }
     36}
    3937
    4038trivaluedBool elementBeam::is_accepted_by_software(nomDeLogiciel soft) const {
    41   if ( soft == nomDeLogiciel::transport ) return ok;
    42   else return error;
     39    if ( soft == nomDeLogiciel::transport ) return ok;
     40    else return error;
    4341}
    4442
    4543string* elementBeam::getParametersString() const {
    46    int compteur = -1;
    47   parametersString_[++compteur] = mixedTools::intToString(nbParam_);
    48   parametersString_[++compteur] = label_;
    49   parametersString_[++compteur] = mixedTools::doubleToString(x_);
    50   parametersString_[++compteur] = mixedTools::doubleToString(xp_);
    51   parametersString_[++compteur] = mixedTools::doubleToString(y_);
    52   parametersString_[++compteur] = mixedTools::doubleToString(yp_);
    53   parametersString_[++compteur] = mixedTools::doubleToString(dl_);
    54   parametersString_[++compteur] = mixedTools::doubleToString(del_);
    55   parametersString_[++compteur] = mixedTools::doubleToString(p0_);
    56    if ( compteur != nbParam_ ) {
    57      cerr << " elementBeam::getParametersString() : ERROR nr pf parameters dosnt match " << endl;
    58      return NULL;
    59    }
    60   return parametersString_;
     44    int compteur = -1;
     45    parametersString_[++compteur] = mixedTools::intToString(nbParam_);
     46    parametersString_[++compteur] = label_;
     47    parametersString_[++compteur] = mixedTools::doubleToString(x_);
     48    parametersString_[++compteur] = mixedTools::doubleToString(xp_);
     49    parametersString_[++compteur] = mixedTools::doubleToString(y_);
     50    parametersString_[++compteur] = mixedTools::doubleToString(yp_);
     51    parametersString_[++compteur] = mixedTools::doubleToString(dl_);
     52    parametersString_[++compteur] = mixedTools::doubleToString(del_);
     53    parametersString_[++compteur] = mixedTools::doubleToString(p0_);
     54    if ( compteur != nbParam_ ) {
     55        cerr << " elementBeam::getParametersString() : ERROR nr pf parameters doesnt match " << endl;
     56        return NULL;
     57    }
     58    return parametersString_;
    6159}
    6260
    6361void elementBeam::setParametersString(string* param) {
    64   if ( param == NULL )
     62    if ( param == NULL )
    6563    {
    66       cerr << "  elementBeam::setParametersString parameters empty parameter set";
    67       return;
     64        cerr << "  elementBeam::setParametersString parameters empty parameter set";
     65        return;
    6866    }
    69    int compteur = -1;
    70   int nbparam = atoi(param[++compteur].c_str());
    71   if ( nbparam != nbParam_ )
     67    int compteur = -1;
     68    int nbparam = atoi(param[++compteur].c_str());
     69    if ( nbparam != nbParam_ )
    7270    {
    73       cerr << "  elementBeam::setParametersString parameters do not match for a BEAM";
    74       return;
     71        cerr << "  elementBeam::setParametersString parameters do not match for a BEAM";
     72        return;
    7573    }
    76 
    77   label_ = param[++compteur];
    78   x_ = atof(param[++compteur].c_str());
    79   xp_ = atof(param[++compteur].c_str());
    80   y_ = atof(param[++compteur].c_str());
    81   yp_ = atof(param[++compteur].c_str());
    82   dl_ = atof(param[++compteur].c_str());
    83   del_ = atof(param[++compteur].c_str());
    84   p0_ = atof(param[++compteur].c_str());
     74   
     75    label_ = param[++compteur];
     76    x_ = atof(param[++compteur].c_str());
     77    xp_ = atof(param[++compteur].c_str());
     78    y_ = atof(param[++compteur].c_str());
     79    yp_ = atof(param[++compteur].c_str());
     80    dl_ = atof(param[++compteur].c_str());
     81    del_ = atof(param[++compteur].c_str());
     82    p0_ = atof(param[++compteur].c_str());
    8583}
    8684
    87  string elementBeam::parmelaOutputFlow() const
    88   {
     85string elementBeam::parmelaOutputFlow() const
     86{
    8987    ostringstream sortie;
    9088    cout << " BEAM sortie parmela non programmee " << endl;
    9189    return sortie.str();
    92   }
     90}
    9391
    9492string elementBeam::transportOutputFlow() const {
    95   ostringstream sortie;
    96   beam2Moments moments(x_, xp_, y_, yp_, dl_, del_);
    97   cout << " elementBeam::transportOutputFlow(), p0 = " << p0_ << endl;
    98   sortie << label_ << ":" << moments.writeToTransportInput(p0_);
    99   return sortie.str();
     93    ostringstream sortie;
     94    beam2Moments moments(x_, xp_, y_, yp_, dl_, del_);
     95    cout << " elementBeam::transportOutputFlow(), p0 = " << p0_ << endl;
     96    sortie << label_ << ":" << moments.writeToTransportInput(p0_);
     97    return sortie.str();
    10098}
    10199
     
    107105    sortie << x_ << "  " << xp_ << " " <<  y_  << " " <<  yp_  << endl;
    108106    sortie << dl_ << "  " << del_ << " " <<  p0_  << endl;
    109   cout << " elementBeam::FileOutputFlow, p0 = " << p0_ << endl;
     107    cout << " elementBeam::FileOutputFlow, p0 = " << p0_ << endl;
    110108    return sortie.str();
    111   }
     109}
    112110
    113111void elementBeam::elementBeam::FileInput(ifstream& ifs) {
    114   ifs >> label_;
    115   ifs >> x_ >> xp_ >>  y_ >> yp_;
    116   ifs >> dl_ >> del_ >> p0_;
    117   cout << " elementBeam::FileFileInput, p0 = " << p0_ << endl;
    118   lenghtElem_ = getLenghtOfElement();
     112    ifs >> label_;
     113    ifs >> x_ >> xp_ >>  y_ >> yp_;
     114    ifs >> dl_ >> del_ >> p0_;
     115    cout << " elementBeam::FileFileInput, p0 = " << p0_ << endl;
     116    lenghtElem_ = getLenghtOfElement();
    119117    cout << " elementBeam::FileInput calcule longueur = " << lenghtElem_ << endl;
    120118}
     119
     120
     121string elementBeam::print() {
     122    string txt = "";
     123    txt += label_;
     124    txt += "\n 1/2 horizontal beam extend rms (cm) : ";
     125    txt += mixedTools::doubleToString(x_);
     126    txt += "\n 1/2 horizontal beam divergence rms (mrad) : ";
     127    txt += mixedTools::doubleToString(xp_);
     128    txt += "\n1/2 vertical beam extend rms (cm) : ";
     129    txt += mixedTools::doubleToString(y_);
     130    txt += "\n1/2 horizontal beam divergence rms (mrad) : ";
     131    txt += mixedTools::doubleToString(yp_);
     132    txt += "\n1/2 longitudinal beam extend rms (cm) : ";
     133    txt += mixedTools::doubleToString(dl_);
     134    txt += "\n1/2 momentum spread rms (mrad) : ";
     135    txt += mixedTools::doubleToString(del_);
     136    txt += "\nmomentum of the central trajectory (GeV/c) : ";
     137    txt += mixedTools::doubleToString(p0_);
     138   
     139    return txt;
     140}
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementBend.cc

    r271 r287  
    33#include "mathematicalConstants.h"
    44#include "PhysicalConstants.h"
    5 elementBend::elementBend() :  abstractElement()
     5
     6elementBend::elementBend() :  abstractElement()
    67{
    78  setDefaultValues();
     
    131132    cout << " elementBend::FileInput calcule longueur = " << lenghtElem_ << endl;
    132133}
     134
     135
     136string elementBend::print() {
     137    string txt = "";
     138
     139    txt += label_;
     140    txt += "\nangle (deg.) : ";
     141    txt += mixedTools::doubleToString(angleDeg_);
     142    txt += "\nradius (m) : ";
     143    txt += mixedTools::doubleToString(radius_);
     144    txt += "\nmomentum (MeV/c) : ";
     145    txt += mixedTools::doubleToString(momentum_);
     146    txt += "\nlength (cm) : ";
     147    txt += mixedTools::doubleToString(lenghtElem_);
     148    txt += "\naperture (cm) : ";
     149    txt += mixedTools::doubleToString(aperture_);
     150    txt += "\npole face rotations (deg.) entrance : ";
     151    txt += mixedTools::doubleToString(beta1_);
     152    txt += "\nexit : ";
     153    txt += mixedTools::doubleToString(beta2_);
     154   
     155    return txt;
     156}
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementCell.cc

    r271 r287  
    55#include "mathematicalTools.h"
    66#include "mixedTools.h"
    7 
    87
    98
     
    137136  ifs >> offsetMag_ >> scaleFactor_;
    138137}
     138
     139
     140string elementCell::print() {
     141    string txt = "";
     142
     143
     144    txt += label_;
     145    txt += "\nlength (cm) : ";
     146    txt += mixedTools::doubleToString(lenghtElem_);
     147    txt += "\naperture (cm) : ";
     148    txt += mixedTools::doubleToString(aperture_);
     149    txt += "\ninitial phase (deg.) : ";
     150    txt += mixedTools::doubleToString(initialPhase_);
     151    txt += "\nmax phase step (deg.) : ";
     152    txt += mixedTools::doubleToString(phaseStepMax_);
     153    txt += "\nmax accelerating field (MV/m) : ";
     154    txt += mixedTools::doubleToString(acceleratingField_);
     155    txt += "\nname of file for field shape : ";
     156    txt += acceleratingShapeFile_;
     157    txt += "\nname of file for focusing mag. field : ";
     158    txt += focusingMagFile_;
     159    txt += "\n z-offset for mag. field : ";
     160    txt += mixedTools::doubleToString(offsetMag_);
     161    txt += "\n scaling factor for mag. field : ";
     162    txt += mixedTools::doubleToString(scaleFactor_);
     163    return txt;
     164}
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementDrift.cc

    r271 r287  
    9797  ifs >> lenghtElem_ >>  aperture_;
    9898}
     99
     100
     101string elementDrift::print() {
     102    string txt = "";
     103
     104    txt += label_;
     105    txt += "\nlength (cm) : ";
     106    txt += mixedTools::doubleToString(lenghtElem_);
     107    txt += "\naperture (cm) : ";
     108    txt += mixedTools::doubleToString(aperture_);
     109   
     110    return txt;
     111}
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementFit.cc

    r271 r287  
    44elementFit::elementFit() : abstractElement()
    55{
    6   setDefaultValues();
    7   setDefaults();
    8   elementName_ = nomdElements("fit");
    9   nbParam_ = elementName_.getElementNbParameters();
    10   parametersString_ = new string[nbParam_+1];
    11   // transportOk_ = true;
    12   // parmelaIgnored_ = true;
     6    setDefaultValues();
     7    setDefaults();
     8    elementName_ = nomdElements("fit");
     9    nbParam_ = elementName_.getElementNbParameters();
     10    parametersString_ = new string[nbParam_+1];
     11    // transportOk_ = true;
     12    // parmelaIgnored_ = true;
    1313}
    1414
    1515void elementFit::setDefaultValues()
    16   {
     16{
    1717    defaultLabel_ = "fit999";
    1818    variableNameDef_ = "";
    1919    variableValueDef_ = 0.0;
    2020    toleranceDef_ = 0.0;
    21   }
     21}
    2222
    2323void elementFit::setDefaults()
    24   {
     24{
    2525    label_ = defaultLabel_;
    2626    variableName_ = variableNameDef_;
    2727    variableValue_ = variableValueDef_;
    2828    tolerance_ = toleranceDef_;
    29   }
     29}
    3030
    3131trivaluedBool elementFit::is_accepted_by_software(nomDeLogiciel soft) const {
    32   if ( soft == nomDeLogiciel::transport ) return ok;
    33   else if ( soft == nomDeLogiciel::parmela ) return warning;
    34   else return error;
     32    if ( soft == nomDeLogiciel::transport ) return ok;
     33    else if ( soft == nomDeLogiciel::parmela ) return warning;
     34    else return error;
    3535}
    3636
    3737
    38  string* elementFit::getParametersString() const
    39  {
    40    int compteur = -1;
    41    parametersString_[++compteur] = mixedTools::intToString(nbParam_);
    42    parametersString_[++compteur] = label_;
    43    parametersString_[++compteur] = variableName_;
    44    parametersString_[++compteur] = mixedTools::doubleToString(variableValue_ );
    45    parametersString_[++compteur] = mixedTools::doubleToString(tolerance_);
    46    if ( compteur != nbParam_ ) {
    47      cerr << " elementFit::getParametersString() : ERROR nr pf parameters dosnt match " << endl;
    48      return NULL;
    49    }
    50    return parametersString_;   
    51  }
     38string* elementFit::getParametersString() const
     39{
     40    int compteur = -1;
     41    parametersString_[++compteur] = mixedTools::intToString(nbParam_);
     42    parametersString_[++compteur] = label_;
     43    parametersString_[++compteur] = variableName_;
     44    parametersString_[++compteur] = mixedTools::doubleToString(variableValue_ );
     45    parametersString_[++compteur] = mixedTools::doubleToString(tolerance_);
     46    if ( compteur != nbParam_ ) {
     47        cerr << " elementFit::getParametersString() : ERROR nr pf parameters dosnt match " << endl;
     48        return NULL;
     49    }
     50    return parametersString_;
     51}
    5252
    5353void elementFit::setParametersString(string* param)
    5454{
    55   if ( param == NULL )
     55    if ( param == NULL )
    5656    {
    57       cerr << "  elementFit::setParametersString parameters empty parameter set";
    58       return;
     57        cerr << "  elementFit::setParametersString parameters empty parameter set";
     58        return;
    5959    }
    60   int compteur = -1;
    61   int nbparam = atoi(param[++compteur].c_str());
    62   if ( nbparam != nbParam_ )
     60    int compteur = -1;
     61    int nbparam = atoi(param[++compteur].c_str());
     62    if ( nbparam != nbParam_ )
    6363    {
    64       cerr << "  elementFit::setParametersString parameters do not match for a BEND" << endl;
    65       return;
     64        cerr << "  elementFit::setParametersString parameters do not match for a BEND" << endl;
     65        return;
    6666    }
    67 
    68   label_ = param[++compteur];
    69   variableName_ = param[++compteur];
    70   variableValue_ = atof(param[++compteur].c_str());
    71   tolerance_ = atof(param[++compteur].c_str());
     67   
     68    label_ = param[++compteur];
     69    variableName_ = param[++compteur];
     70    variableValue_ = atof(param[++compteur].c_str());
     71    tolerance_ = atof(param[++compteur].c_str());
    7272}
    7373
    7474
    7575string elementFit::parmelaOutputFlow() const
    76   {
     76{
    7777    ostringstream sortie;
    7878    return sortie.str();
    79   }
     79}
    8080
    8181string elementFit::transportOutputFlow() const
    82   {
     82{
    8383    ostringstream sortie;
    8484    sortie << label_ << ":" << "  FIT," << variableName_ << " = " << variableValue_ << ", TOLER = " << tolerance_ << " ;" << endl;
    8585    if ( variableName_ == "R11" || variableName_ == "R22" || variableName_ == "R12" || variableName_ == "R21" ) {
    86       sortie << " PRINT, TRANS;" << endl;
     86        sortie << " PRINT, TRANS;" << endl;
    8787    }
    8888    return sortie.str();
    89   }
     89}
    9090
    9191string elementFit::FileOutputFlow() const
    92   {
     92{
    9393    ostringstream sortie;
    9494    //    sortie << elementName_.getElementType() << endl;
     
    9797    sortie  <<    variableName_ << " " << variableValue_ << " " << tolerance_ << endl;
    9898    return sortie.str();
    99   }
     99}
    100100
    101101void elementFit::FileInput(ifstream& ifs)
    102102{
    103   ifs >> label_;
    104   ifs  >>  variableName_ >>  variableValue_   >> tolerance_;
     103    ifs >> label_;
     104    ifs  >>  variableName_ >>  variableValue_   >> tolerance_;
    105105}
     106
     107
     108string elementFit::print() {
     109    string txt = "";
     110 
     111    txt += label_;
     112    return txt;
     113}
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementRfgun.cc

    r271 r287  
    44#include "mathematicalTools.h"
    55#include "mixedTools.h"
    6 
    76
    87
     
    120119  ifs >> phaseStep_ >> nb_true_particles_;
    121120}
     121
     122
     123string elementRfgun::print() {
     124    string txt = "";
     125   
     126    txt += label_;
     127    txt += "\nnr of macroparticles : ";
     128    txt += mixedTools::doubleToString(nb_true_particles_);
     129    txt += "\nsigma_t (ps) : ";
     130    txt += mixedTools::doubleToString(sigma_t_);
     131    txt += "\nsigma_r (cm) : ";
     132    txt += mixedTools::doubleToString(sigma_r_);
     133    txt += "\ninitial kinetic energy (MeV) : ";
     134    txt += mixedTools::doubleToString(E_cin_);
     135    txt += "\nsigma_Ecin (MeV) : ";
     136    txt += mixedTools::doubleToString(sigma_E_);
     137    txt += "\ntrue number of part. in beam : ";
     138    txt += mixedTools::boolToString(nmacrop_);
     139   
     140    return txt;
     141}
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementSoleno.cc

    r271 r287  
    11#include "elementSoleno.h"
    22#include "mixedTools.h"
    3 
    43
    54
     
    109108  ifs >> lenghtElem_ >>  aperture_ >> B0_ >> varyB0_ ;
    110109}
     110
     111
     112string elementSoleno::print() {
     113    string txt = "";
     114
     115    txt += label_;
     116    txt += "\nlength (cm) : ";
     117    txt += mixedTools::doubleToString(lenghtElem_);
     118    txt += "\naperture (cm) : ";
     119    txt += mixedTools::doubleToString(aperture_);
     120    txt += "\nfield (kG) : ";
     121    txt += mixedTools::doubleToString(B0_);
     122    txt += "\n : may vary ? ";
     123    txt += mixedTools::boolToString(varyB0_);
     124   
     125    return txt;
     126}
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_abstractElement.h

    r272 r287  
    88#include <Wt/WDialog>
    99#include <Wt/WImage>
     10#include <Wt/WString>
    1011#include <Wt/WPushButton>
    1112#include <Wt/WContainerWidget>
     
    4748    virtual void dialogDone() = 0;
    4849    virtual WImage* getImage() = 0;
     50    virtual WString print() = 0;
    4951   
    5052private:
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_beam.h

    r272 r287  
    2424   
    2525    WImage* getImage();
    26    
     26    WString print();
     27
    2728private:
    2829    WImage* image_;
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_bend.h

    r272 r287  
    2323   
    2424    WImage* getImage();
     25    WString print();
    2526   
    2627private:
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_cell.h

    r272 r287  
    3434   
    3535    WImage* getImage();
     36    WString print();
    3637   
    3738private:
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_drift.h

    r272 r287  
    2525    virtual void dialogDone();
    2626    WImage* getImage();
     27    WString print();
    2728   
    2829private:
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementLigneFaisceau.h

    r273 r287  
    6161    void removeDone(GWt_abstractElement*);
    6262    std::string getElementNumberInBeamLine(nomdElements el);
    63     void removeOtherDropZone(GWt_elementLigneFaisceau*);
    6463    void initialize_ligneFaisceau(abstractElement*);
    6564    GWt_dialog* messageDropZone_;
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_fit.h

    r272 r287  
    2020   
    2121    WImage* getImage();
     22    WString print();
    2223   
    2324private:
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_rfgun.h

    r272 r287  
    3131   
    3232    WImage* getImage();
     33    WString print();
    3334   
    3435private:
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_soleno.h

    r272 r287  
    3232   
    3333    WImage* getImage();
     34    WString print();
    3435   
    3536private:
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_beam.cc

    r272 r287  
    7979    return image_;
    8080}
     81
     82
     83WString GWt_beam::print(){
     84    return WString(abstractElement_->print());
     85}
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_bend.cc

    r272 r287  
    8383    return image_;
    8484}
     85
     86
     87WString GWt_bend::print(){
     88    return WString(abstractElement_->print());
     89}
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_cell.cc

    r272 r287  
    107107    return image_;
    108108}
     109
     110
     111WString GWt_cell::print(){
     112    return WString(abstractElement_->print());
     113}
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_drift.cc

    r272 r287  
    5454    return image_;
    5555}
     56
     57
     58WString GWt_drift::print(){
     59    return WString(abstractElement_->print());
     60}
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_dropZoneLigneFaisceau.cc

    r286 r287  
    1010
    1111
    12 #define PSPA_DEBUG 1
     12//#define PSPA_DEBUG 1
    1313
    1414GWt_dropZoneLigneFaisceau::GWt_dropZoneLigneFaisceau()
     
    123123    typedElement eType = e.getElementType();
    124124    ligneFaisceau->addElement(eType, this);
    125    
    126    
    127     /*
    128      nomdElements e(evt.mimeType());
    129      typedElement eType = e.getElementType();
    130      
    131      // update source if necessary
    132      cout<<"dynamic_cast SOURCE------" << evt.source() << endl;
    133      if (dynamic_cast <GWt_dropZoneLigneFaisceau*> (evt.source())) {
    134      cout<<"OKIKKKIIII" << dynamic_cast <GWt_dropZoneLigneFaisceau*> (evt.source()) << endl;
    135      removeOtherDropZone(dynamic_cast <GWt_dropZoneLigneFaisceau*> (evt.source()));
    136      }
    137      
    138      if(eType == inconnu) {
    139      cout << "GWt_LigneFaisceau::element type " << eType << " inconnu " << endl;
    140      return;
    141      }
    142      
    143      if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
    144      GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
    145      console->addConsoleMessage(e.getElementName());
    146      }
    147      
    148      abstractElement* ptr = pspa_->getDataManager()->addElement(eType);
    149      
    150      ptr->setLabel(getElementNumberInBeamLine(e));
    151      
    152      GWt_abstractElement* insertedAbstractElement = GWt_abstractElement::ajoute(ptr);
    153      cout << " je vais ajouter l'element  " << ptr->getNomdElement().getElementName() << " de type " << ptr->getNomdElement().getElementType() << "ID "<< insertedAbstractElement << endl;
    154      
    155      if(insertedAbstractElement == NULL) return;
    156      insertedAbstractElement->setLabelWidget();
    157      
    158      WSignalMapper<GWt_abstractElement *> *mapper= new WSignalMapper<GWt_abstractElement *>(this);
    159      mapper->mapped().connect(this,&GWt_dropZoneLigneFaisceau::onClick);
    160      mapper->mapConnect(insertedAbstractElement->getImage()->doubleClicked(),insertedAbstractElement);
    161      
    162      //////////////////////////////////////////////////////////////////
    163      
    164      // add the dropped widget
    165      printf("add the dropped widget\n");
    166      
    167      // add drop zone before and after
    168      if (static_cast <WContainerWidget*> (parent())) {
    169      WContainerWidget* wc = static_cast <WContainerWidget*> (parent());
    170      
    171      cout<<"add the dropped parent %d"<< wc << " COUNT:"<< count () <<"<---------------"<< endl;
    172      // do not insert new element if some element is already present
    173      
    174      WBoxLayout* layout = ((WBoxLayout*)(wc->layout()));
    175      bool replaceElement = false;
    176      
    177      if (abstractElement_) {
    178      replaceElement = true;
    179      }
    180      
    181      // insert one before
    182      if (!replaceElement) {
    183      // if it the first element of the beam line
    184      if (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this))) == 0) {
    185      layout->insertWidget (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this))), new GWt_dropZoneLigneFaisceau(pspa_,false));
    186      
    187      } else {
    188      layout->insertWidget (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this))), new GWt_dropZoneLigneFaisceau(pspa_,true));
    189      }
    190      }
    191      // FIXME Replace
    192      
    193      // complete widget
    194      clear();
    195      arrowImage_ = NULL;
    196      abstractElement_ = insertedAbstractElement->getWidget();
    197      addWidget(abstractElement_);
    198      // change strech (useful if it was the last one)
    199      layout->setStretchFactor(this,0);
    200      
    201      // change background
    202      decorationStyle().setBackgroundColor (WColor("white"));
    203      
    204      // remove border
    205      decorationStyle().setBorder (WBorder (WBorder::None));
    206      
    207      
    208      // insert after
    209      // if it is the last, add a strech factor and no link image
    210      cout<<" nb elem:"<< layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this)))+1 << " COUNT:"<< wc->count () <<"<---------------ID:"<< abstractElement_ << endl;
    211      if (!replaceElement) {
    212      if (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this)))+1 == wc->count()) {
    213      layout->insertWidget (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this)))+1, new GWt_dropZoneLigneFaisceau(pspa_,false),1);
    214      } else {
    215      layout->insertWidget (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (this)))+1, new GWt_dropZoneLigneFaisceau(pspa_));
    216      }
    217      }
    218      */
    219    
    220     /*
    221      * Set the image to be draggable, showing the other image (dragImage)
    222      * to be used as the widget that is visually dragged.
    223      */
    224     /*
    225      WImage *dragImage = new WImage(e.getImageFromType(eType).c_str(),this);
    226      
    227      //    setDraggable(evt.mimeType(),dragImage,true);//,insertedAbstractElement->getButton(),true);
    228      abstractElement_->setDraggable(evt.mimeType(),dragImage,true, this);
    229      
    230      
    231      cout<<"add the dropped parent %d"<< wc << " COUNT:"<< wc->count () <<"<---------------"<< endl;
    232      }
    233      
    234      
    235      
    236      //insertedAbstractElement->getWidget()->decorationStyle().setBackgroundColor (WColor("blue"));
    237      pspa_->updateSelections();
    238      
    239      */
    240125}
    241126
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementLigneFaisceau.cc

    r282 r287  
    125125            dragElementZone_->setMaximumSize(32,32);
    126126            dragElementZone_->setMinimumSize(32,32);
     127            dragElementZone_->setToolTip(abstractElement_->print());
    127128        }
    128129    }
     
    175176
    176177
    177 
    178 void GWt_elementLigneFaisceau::removeOtherDropZone(GWt_elementLigneFaisceau* other)
    179 {
    180     // 3 cases :
    181     // - first element : remove elem + link after
    182     // - last element : remove elem + link before
    183     // - middle element : remove elem + link after/before
    184    
    185     WContainerWidget* wc = static_cast <WContainerWidget*> (parent());
    186     WBoxLayout* layout = ((WBoxLayout*)(wc->layout()));
    187    
    188 #ifdef PSPA_DEBUG
    189     if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
    190         GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
    191         console->addConsoleMessage("GWt_elementLigneFaisceau::mouseOut");
    192         console->addConsoleMessage("remove from drag Zone");
    193     }
    194     cout << "remove from drag Zone id" << layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (other))) << " count:" << layout->count()<< endl;
    195 #endif
    196     // first element
    197     if (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (other))) == 1) {
    198         if (layout->itemAt (2)) {
    199             layout->removeItem (layout->itemAt(2));
    200 #ifdef PSPA_DEBUG
    201             if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
    202                 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
    203                 console->addConsoleMessage(" remove first link ");
    204             }
    205 #endif
    206         }
    207        
    208         // last and middle
    209     } else if (layout->indexOf ((WLayoutItem*)(layout->findWidgetItem (other))) == layout->count()-2) {
    210         if (layout->itemAt (layout->count()-3)) {
    211             layout->removeItem (layout->itemAt(layout->count()-3));
    212 #ifdef PSPA_DEBUG
    213             if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
    214                 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
    215                 console->addConsoleMessage(" remove first link ");
    216             }
    217 #endif
    218         }
    219     }
    220    
    221     // remove the drop zone
    222     if (layout->findWidgetItem (other)) {
    223         layout->removeItem (layout->itemAt(layout->indexOf((WLayoutItem*)(layout->findWidgetItem (other)))));
    224 #ifdef PSPA_DEBUG
    225         if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
    226             GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
    227             console->addConsoleMessage(" remove drop zone ");
    228         }
    229 #endif
    230         }
    231    
    232    
    233         // FIXME ne pas passer par un label mais par un abstrastElement
    234         //  pspa_->getDataManager()->getCollection()->eraseElement(label);
    235     //  pspa_->updateSelections();
    236 }
    237178
    238179
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_fit.cc

    r272 r287  
    8282    return image_;
    8383}
     84
     85
     86WString GWt_fit::print(){
     87    return WString(abstractElement_->print());
     88}
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_ligneFaisceau.cc

    r284 r287  
    6565    {
    6666        abstractElement* ptr = pspa_->getDataManager()->getCollection()->getElementPointerFromIndex(k);
    67                 GWt_abstractElement* gw = GWt_abstractElement::ajoute(ptr);
    68          if(gw == NULL) {
    69 /*
    70  GWt_dialog warningDialog("PSPA : restore configuration", " Element type "+ptr->getNomdElement().getElementName()+" not reconized", GWt_dialog::Error,true,true);
    71              warningDialog.exec();
    72 */
    73          }
    74          gw->setLabelWidget();
    75          
     67       
    7668        nObjets_[ptr->getNomdElement().getElementType()].incr();
    7769       
    7870        ligneFaisceauLayout_->addWidget(new GWt_elementLigneFaisceau(ptr),1);
    7971       
    80        
    81         /*      if (k < ((unsigned)nbElem-1)) {
    82          ligneFaisceauLayout_->addWidget(new GWt_elementLigneFaiseau());
    83          } else {
    84          ligneFaisceauLayout_->addWidget(new GWt_elementLigneFaiseau());
    85          }
    86          */
    8772    }
    8873    manageLineFaisceauLayout();
     
    9580   
    9681    cout << " Entree addElement element " << nomdElements::getLabelFromType(eType) << endl;
     82   
     83    int nElements= nomdElements ::getNumberOfElements();
     84    nObjets_= new Compteur[nElements];
    9785   
    9886    // 2 cases :
     
    137125        //  ligneFaisceauLayout_->addWidget(new GWt_elementLigneFaiseau(ptr),0);
    138126        if (index != -1) {
     127            nObjets_[ptr->getNomdElement().getElementType()].incr();
    139128            ligneFaisceauLayout_->insertWidget(index,new GWt_elementLigneFaisceau(ptr),1);
    140129        }
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc

    r272 r287  
    212212    cout << "createDragImage" << dragImage<<endl;
    213213    result->setDraggable(mimeType,dragImage,true);
    214    
    215214}
    216215
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_rfgun.cc

    r272 r287  
    7676    return image_;
    7777}
     78
     79
     80WString GWt_rfgun::print(){
     81    return WString(abstractElement_->print());
     82}
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_soleno.cc

    r272 r287  
    6464    return image_;
    6565}
     66
     67
     68WString GWt_soleno::print(){
     69    return WString(abstractElement_->print());
     70}
Note: See TracChangeset for help on using the changeset viewer.