Changeset 381 in PSPA


Ignore:
Timestamp:
Mar 9, 2013, 5:12:55 PM (11 years ago)
Author:
lemeur
Message:

complements graphiques, legendes et unification unites

Location:
Interface_Web/trunk/pspaWT
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h

    r368 r381  
    5353  bool executeAll();
    5454 
    55    void donneesRmsEnveloppe(string type,vector<double>& xcor,vector<double>& ycor);
     55  void donneesRmsEnveloppe(string type,vector<double>& xcor,vector<double>& ycor, string& titre, string& legendx, string& legendy);
    5656
    5757  /**
     
    6363   
    6464    bool restoreElements(string inputFileName);
    65 
    66 
    6765   
    68     private :
    6966   
    7067
  • Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h

    r377 r381  
    4949double getUnnormalizedTranspPhaseSpaceArea(unsigned TranspIndexAbs, unsigned TranspIndexOrd);
    5050
     51
     52 unsigned pspaCoorIndexFromString(string nameCoor) const;
     53 unsigned transportCoorIndexFromString(string nameCoor) const;
     54
    5155inline double dimensionalFactorFromTransportToGraphics(unsigned index) {
    52   if ( index == 0 || index == 2 || index == 4 ) return 10.;
    53   else return  1.0;
     56  if ( index == 0 || index == 2 || index == 4 ) return 10.;   // mm
     57  else return  1.0;  // mrad
    5458}
     59
     60
     61
    5562
    5663 inline string transportVariableName(unsigned index) {
     
    6875  }
    6976 }
     77
     78
     79
    7080
    7181 inline string graphicTransportUnitName(unsigned index) {
     
    107117  void printAllXYZ() const;
    108118  void Zrange(double& zmin, double& zmax) const;
    109   //  void donneesDessinEllipseXxp(vector<double>& xcor, vector<double>& ycor);
    110   void donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, unsigned indexAbs, unsigned indexOrd);
    111   void particlesPhaseSpaceData(vector<double>& xcor, vector<double>& ycor, unsigned indexAbs, unsigned indexOrd);
     119  void donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, string namex, string namey);
     120  void particlesPhaseSpaceData(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, string namex, string namey);
    112121  virtual string FileOutputFlow() const;
    113122  virtual bool FileInput(ifstream& ifs);
  • Interface_Web/trunk/pspaWT/sources/controler/include/softwareParmela.h

    r375 r381  
    1212  // donc prevoir un offset pour le raccord a pspa
    1313  unsigned offsetNumElem_;
    14 
     14  //  vector<unsigned> relativeParmelaElementNumbers_;
    1515
    1616  bool beamFromParmela(string workingDir,unsigned numeroElement, double referencefrequency, vector<double>& centroid, bareParticle& refPart,vector<bareParticle>& particles );
  • Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc

    r371 r381  
    55#include "softwareTransport.h"
    66#include "GWt_pspaApplication.h"
    7 #include "GWt_console.h"
     7#include "GWt_console.h"Ò
    88#include "softwareGenerator.h"
    99#include "softwareTest.h"
     
    261261
    262262// on ne tient pas compte des elements "snapshot" presents dans la beamLine
    263 void dataManager::donneesRmsEnveloppe(string type,vector<double>& xcor,vector<double>& ycor)
     263void dataManager::donneesRmsEnveloppe(string type,vector<double>& xcor,vector<double>& ycor, string& titre, string& legendx, string& legendy)
    264264{
    265265  double longueur = 0.0;
     
    267267  xcor.clear();
    268268  ycor.clear();
    269 
     269  titre.clear();
     270  titre = " rms enveloppe ";
     271  legendx.clear();
     272  legendx = " z (m)";
    270273  if ( type == "x" ) {
    271274    unsigned i = 0;
     
    274277    for (unsigned k = firstComputedElemNumero_ -1 ; k < lastComputedElemNumero_ ; k++) {
    275278      abstractElement* elPtr = pspa_->getBeamLine()->getAbstractElement(k);
    276       if(elPtr->getNomdElement().getElementType() == snapshot) continue;
    277       if(elPtr->getNomdElement().getElementType() == fit) continue;
     279           if(elPtr->getNomdElement().getElementType() == snapshot) continue;
     280      //      if(elPtr->getNomdElement().getElementType() == fit) continue;
    278281
    279282      if ( !diagnosticBeam_.at(i).momentRepresentationOk() ) {
     
    284287      valeur = diagnosticBeam_.at(i).getXmaxRms();
    285288      cout << " dataManager::donneesRmsEnveloppe index = " << k <<  " longueur = " << longueur << " enveloppe : " << valeur << endl;
    286       xcor.push_back(longueur);
     289      xcor.push_back(0.01*longueur);  // on passe en metres
    287290      ycor.push_back(valeur);
    288291      i++;
    289292    }
     293    legendy.clear();
     294    legendy = " x (cm) ";
    290295  }
    291296}
  • Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc

    r377 r381  
    345345
    346346
    347 void particleBeam::particlesPhaseSpaceData(vector<double>& xcor, vector<double>& ycor, unsigned indexAbs, unsigned indexOrd) {
     347void particleBeam::particlesPhaseSpaceData(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, string namex, string namey) {
     348
     349  unsigned indexAbs, indexOrd;
     350  indexAbs = pspaCoorIndexFromString(namex);
     351  indexOrd = pspaCoorIndexFromString(namey);
     352 
    348353  particlesPhaseSpaceComponent(xcor, indexAbs);
    349354  particlesPhaseSpaceComponent(ycor, indexOrd);
     355  legende.clear();
     356    legende.push_back( "phase space " + namex + "," + namey);
     357    legende.push_back( "particle number : " +   mixedTools::intToString(getNbParticles()));
    350358}
    351359
     
    360368  if ( index <= 2 ) {
    361369    for (unsigned i = 0; i < goodPartic_.size(); ++i) {
    362       coord.at(i) =  goodPartic_.at(i).getPosition().getComponent(index);
     370      coord.at(i) =  10.*goodPartic_.at(i).getPosition().getComponent(index);  // en mm
    363371    }
    364372    return;
     
    369377      double begamz = goodPartic_.at(i).getBetaGamma().getComponent(2);
    370378      if ( begamz != 0.0) {
    371         coord.at(i) =  1000.*goodPartic_.at(i).getBetaGamma().getComponent(index - 3)/begamz; // mimmiradians
     379        coord.at(i) =  1000.*goodPartic_.at(i).getBetaGamma().getComponent(index - 3)/begamz; // milliradians
    372380      } else {
    373381        coord.at(i) = 0.0;
     
    403411}
    404412
    405 
    406 void particleBeam::donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, unsigned indexAbs, unsigned indexOrd) {
     413unsigned particleBeam::pspaCoorIndexFromString(string nameCoor) const {
     414  if ( nameCoor == "x" ) {
     415    return 0;
     416  } else if ( nameCoor == "y" ) {
     417    return 1;
     418  } else if ( nameCoor == "dz" ) {
     419    return 2;
     420  } else if ( nameCoor == "xp" ) {
     421    return 3;
     422  } else if ( nameCoor == "yp" ) {
     423    return 4;
     424  } else if ( nameCoor == "dE/E" ) {
     425    return 5;
     426  } else {
     427    return 99;
     428  }
     429}
     430
     431unsigned particleBeam::transportCoorIndexFromString(string nameCoor) const {
     432  if ( nameCoor == "x" ) {
     433    return 0;
     434  } else if ( nameCoor == "y" ) {
     435    return 2;
     436  } else if ( nameCoor == "dz" ) {
     437    return 4;
     438  } else if ( nameCoor == "xp" ) {
     439    return 1;
     440  } else if ( nameCoor == "yp" ) {
     441    return 3;
     442  } else if ( nameCoor == "dE/E" ) {
     443    return 5;
     444  } else {
     445    return 99;
     446  }
     447}
     448
     449//void particleBeam::donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, unsigned indexAbs, unsigned indexOrd) {
     450
     451void particleBeam::donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, string namex, string namey) {
    407452  int k;
    408453  double x,y;
    409   cout << " particleBeam::donneesDessinEllipse index recus x" << indexAbs << " index y " << indexOrd << endl;
    410 
    411   if ( !momentRepresentationOk_ ) return;
    412 
    413   if ( indexAbs > 5 || indexOrd > 5 ) return;
     454  if ( !momentRepresentationOk_ ) buildMomentRepresentation();
     455
     456  //  if ( !momentRepresentationOk_ ) return;
     457
     458  unsigned indexAbs, indexOrd;
     459
     460
     461  // index TRANSPORT
     462  indexAbs = transportCoorIndexFromString(namex);
     463  indexOrd = transportCoorIndexFromString(namey);
     464  cout << " namex= " << namex << " indexAbs= " << indexAbs << " namey= " << namey << " indexOrd= " << indexOrd << endl;
     465    if ( indexAbs > 5 || indexOrd > 5 ) return;
    414466
    415467  xcor.clear();
    416468  ycor.clear();
    417   // les index sont dans l'ordre x,y,z,xp,yp, de/E
    418   // on traduit en TRANSPORT
    419 
    420   indexAbs = indexFromPspaToTransport(indexAbs);
    421   indexOrd = indexFromPspaToTransport(indexOrd);
     469
    422470
    423471
     
    427475
    428476
    429   // a completer
     477
    430478  legende.clear();
    431479  //  if ( indexAbs == 0 && indexOrd == 1 ) {
  • Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc

    r373 r381  
    112112}
    113113
     114
     115
    114116bool softwareParmela::buildBeamAfterElements(unsigned int numeroDeb,unsigned int numeroFin, vector<particleBeam>& beams, string workingDir)
    115117{
     
    130132        string cliche = workingDir + param[2].c_str();
    131133        if( beamToParmela(cliche,&beams.at(avantDernier)) ) {
    132           cout<<"["<<k<<"] : ecrit sur fichier " << cliche << " le contenu de beam["<<avantDernier<<"]"<<endl;
     134          cout  <<  "["  <<  k  <<  "] : ecrit sur fichier " << cliche << " le contenu de beam["<<avantDernier<<"]"<<endl;
    133135        }
    134         continue;
     136        // continue;
    135137      }
    136138     
     
    144146      double freq= globParamPtr_->getFrequency();
    145147     
     148      cout << " lecture PARMELA el no absolu " << k << " nom " << elem->getNomdElement().getElementName() << endl;
    146149      if(!beamFromParmela(workingDir,id,freq,centroid,refPart,particles))
    147150        {
  • Interface_Web/trunk/pspaWT/sources/controler/src/softwareTransport.cc

    r355 r381  
    153153        string cliche = workingDir + param[2].c_str();
    154154         cout<<"["<<k<<"] : ecrit sur fichier " << cliche << " le contenu de beam["<<avantDernier<<"]"<<endl;
    155          continue;
     155         //      continue;
    156156      }
    157157
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h

    r379 r381  
    8484 
    8585  void dialogOnGraphics();
    86   //  void setModelComponentForPhaseSpace(WStandardItemModel* model, vector<bareParticle>& partic, unsigned indexParticleComponent, unsigned modelComponent);
    87 void faireDessinParmela(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd, string namex, string namey  );
    88   void faireDessinTransport(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd, string namex, string namey);
     86  void faireDessinPhaseSpace(WContainerWidget* toto, particleBeam* beam, string namex, string namey, int typeFaisceau);
     87
     88 //  void setModelComponentForPhaseSpace(WStandardItemModel* model, vector<bareParticle>& partic, unsigned indexParticleComponent, unsigned modelComponent);
     89void faireDessinParmela(WContainerWidget* toto, particleBeam* beam, string namex, string namey  );
     90  void faireDessinTransport(WContainerWidget* toto, particleBeam* beam, string namex, string namey);
    8991  void faireDessinEnveloppe(WContainerWidget* toto, string type);
    9092  //  void scatterPlot1D(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor);
    91   void chartPlot2vec(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor, bool drawPoints, int width, int height, bool makeIcon=false);
     93  void chartPlot2vec(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor, bool drawPoints, string title, string legendx, string legendy, int width, int height, bool makeIcon=false);
    9294  bool removePathFromConfigName(string& config);
    9395  bool removeExtensionFromConfigName(string& config);
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc

    r379 r381  
    512512  int typeFaisceau = choixTypeDessinFaisceau_->currentIndex();
    513513  int index = choixElementDessin_->currentIndex();
    514   unsigned xabs = choixAbsPhase_->currentIndex();
    515   unsigned yord = choixOrdPhase_->currentIndex();
    516   if ( xabs == yord ) {
     514  string nameAbs = choixAbsPhase_->currentText().toUTF8();
     515  string nameOrd = choixOrdPhase_->currentText().toUTF8();
     516  if ( nameAbs == nameOrd ) {
    517517        GWt_dialog phaseSpaceError(" graphical analysis", "the beam coordinates must be different !", GWt_dialog::Error, false,true);
    518518        phaseSpaceError.exec();
    519519        return;
    520520  }
    521   string nameAbs = choixAbsPhase_->currentText().toUTF8();
    522   string nameOrd = choixOrdPhase_->currentText().toUTF8();
    523521
    524522  particleBeam* beam = dtmanage_->getDiagnosticBeam(index);
     
    531529   
    532530    toto_->clear();
    533  
    534   if ( typeFaisceau == 0 )
    535     {
    536       if ( !beam->momentRepresentationOk() ) beam->buildMomentRepresentation();
    537       cout << " PspaApplication::dessinerPhaseSpace cood cliquees " << xabs << " " << yord << endl;
    538       faireDessinTransport(toto_, beam, xabs, yord, nameAbs, nameOrd );
    539     }
    540   else if ( typeFaisceau == 1 )
    541     {
    542       if ( beam->particleRepresentationOk() ) faireDessinParmela(toto_, beam, xabs, yord, nameAbs, nameOrd );
    543       else {
    544         GWt_dialog warningBeamState(" graphical analysis", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);
    545         warningBeamState.exec();
    546       }
    547     }
    548   else {
    549     GWt_dialog warningTypeDrawing(" graphical analysis", "type of  drawing not programmed !", GWt_dialog::Error, false,true);
    550     warningTypeDrawing.exec();
    551   }
     531    faireDessinPhaseSpace(toto_, beam, nameAbs, nameOrd, typeFaisceau);
     532
     533  // if ( typeFaisceau == 0 )
     534  //   {
     535  //     if ( !beam->momentRepresentationOk() ) beam->buildMomentRepresentation();
     536  //     faireDessinTransport(toto_, beam, nameAbs, nameOrd );
     537  //   }
     538  // else if ( typeFaisceau == 1 )
     539  //   {
     540  //     if ( beam->particleRepresentationOk() ) faireDessinParmela(toto_, beam, nameAbs, nameOrd );
     541  //     else {
     542  //    GWt_dialog warningBeamState(" graphical analysis", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);
     543  //    warningBeamState.exec();
     544  //     }
     545  //   }
     546  // else {
     547  //   GWt_dialog warningTypeDrawing(" graphical analysis", "type of  drawing not programmed !", GWt_dialog::Error, false,true);
     548  //   warningTypeDrawing.exec();
     549  // }
    552550}
    553551
     
    579577  vector<double> xcor;
    580578  vector<double> ycor;
    581   // dtmanage_->donneesRmsEnveloppe(type,1, nbel, xcor,ycor);
    582     dtmanage_->donneesRmsEnveloppe(type,xcor,ycor);
    583     chartPlot2vec(envDialog->contents(), xcor, ycor, false,500,300);
    584 
    585 }
    586 
    587 void PspaApplication::faireDessinParmela(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd, string namex, string namey )
     579    string titre;
     580    string legendx;
     581    string legendy;
     582    dtmanage_->donneesRmsEnveloppe(type,xcor,ycor, titre, legendx, legendy);
     583    chartPlot2vec(envDialog->contents(), xcor, ycor, false,titre, legendx, legendy,500,300);
     584
     585}
     586
     587void PspaApplication::faireDessinPhaseSpace(WContainerWidget* toto, particleBeam* beam, string namex, string namey, int typeFaisceau)
     588{
     589
     590  vector<double> xcor;
     591  vector<double> ycor;
     592  vector<string> legende;
     593  string titre;
     594  bool pointsDrawing;
     595  if ( typeFaisceau == 0 ) {
     596    pointsDrawing = false;
     597    titre = "phase space rms";
     598    beam->donneesDessinEllipse(xcor,ycor,legende, namex, namey);
     599  } else if (  typeFaisceau == 1 ) {
     600    pointsDrawing = true;
     601    titre = " phase space ";
     602    beam->particlesPhaseSpaceData(xcor, ycor, legende, namex, namey);
     603  } else {
     604        GWt_dialog warningBeamState(" graphical analysis", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);
     605        warningBeamState.exec();
     606        return;
     607  }
     608
     609
     610  GWt_dialog* phaseSpaceDialog = new GWt_dialog("phase space",toto,false);
     611  eDialog_.push_back(phaseSpaceDialog);
     612  phaseSpaceDialog->setMinimumSize(400,400);
     613  phaseSpaceDialog->setClosable(true);
     614  new WText(nameOfCase_, phaseSpaceDialog->contents());
     615 
     616
     617  for (int k=0 ; k < legende.size(); k++) {
     618    new WBreak(phaseSpaceDialog->contents());
     619    new WText(legende.at(k), phaseSpaceDialog->contents());
     620  }
     621  chartPlot2vec(phaseSpaceDialog->contents(), xcor, ycor,pointsDrawing ,titre, namex, namey,500,300);
     622  phaseSpaceDialog->show();
     623
     624}
     625
     626
     627
     628void PspaApplication::faireDessinParmela(WContainerWidget* toto, particleBeam* beam, string namex, string namey )
    588629{
    589630  cout << " faireDessinParmela " << endl;
     
    594635  // pointsDialog->show();
    595636     
    596   //    vector<bareParticle>& partic = beam->getParticleVector();
    597   new WText(nameOfCase_ + " : phase space " + namex + " ," + namey + " ; particle number : "+ mixedTools::intToString(beam->getNbParticles()), pointsDialog->contents());
     637  new WText(nameOfCase_, pointsDialog->contents());
     638
    598639
    599640  vector<double> xcor;
    600641  vector<double> ycor;
    601   beam->particlesPhaseSpaceData(xcor, ycor, indexAbs, indexOrd);
    602   chartPlot2vec(pointsDialog->contents(), xcor, ycor, true,400,400);
     642  vector<string> legende;
     643  beam->particlesPhaseSpaceData(xcor, ycor, legende, namex, namey);
     644  for (int k=0 ; k < legende.size(); k++) {
     645    new WBreak(pointsDialog->contents());
     646    new WText(legende.at(k), pointsDialog->contents());
     647  }
     648  string titre = " phase space ";
     649  chartPlot2vec(pointsDialog->contents(), xcor, ycor, true,titre,namex, namey,400,400);
    603650
    604651
     
    610657}
    611658
    612 void PspaApplication::faireDessinTransport(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd, string namex, string namey)
     659void PspaApplication::faireDessinTransport(WContainerWidget* toto, particleBeam* beam, string namex, string namey)
    613660{
    614661  GWt_dialog* ellipseDialog = new GWt_dialog("ellipse",toto,false);
     
    622669  vector<double> ycor;
    623670  vector<string> legende;
    624   beam->donneesDessinEllipse(xcor,ycor,legende, indexAbs, indexOrd);
     671  beam->donneesDessinEllipse(xcor,ycor,legende, namex, namey);
    625672
    626673  for (int k=0 ; k < legende.size(); k++) {
     
    628675    new WText(legende.at(k), ellipseDialog->contents());
    629676  }
    630   //  beam->donneesDessinEllipseXxp(xcor,ycor);
    631   //  scatterPlot1D(ellipseDialog->contents(),xcor,ycor); 
    632   chartPlot2vec(ellipseDialog->contents(), xcor, ycor, false,500,300);
    633 }
    634 
    635 // void PspaApplication::scatterPlot1D(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor)
    636 // {
    637 //     int nbpts = xcor.size();
    638 //     cout << " PspaApplication::scatterPlot1D nbpts = " << nbpts << endl;
    639 //     WStandardItemModel *model = new WStandardItemModel(nbpts, 2, toto);
    640 //     for (int i = 0; i < nbpts; ++i) {
    641 //         model->setData(i, 0, xcor.at(i));
    642 //         model->setData(i, 1, ycor.at(i));
    643 //         //    cout << " PspaApplication::scatterPlot1D el= " << i+1 << " x= " << xcor.at(i) << " y= " << ycor.at(i) << endl;
    644 //     }
    645    
    646 //     WCartesianChart *chart = new WCartesianChart(toto);
    647 //     chart->setTitle("titre");
    648    
    649 //     //  chart->initLayout();
    650    
    651 //     chart->setModel(model);        // set the model
    652 //     chart->setXSeriesColumn(0);    // set the column that holds the X data
    653 //     chart->setLegendEnabled(true); // enable the legend
    654    
    655 //     chart->setType(ScatterPlot);   // set type to ScatterPlot
    656    
    657 //     // Typically, for mathematical functions, you want the axes to cross
    658 //     // at the 0 mark:
    659 //     chart->axis(XAxis).setLocation(ZeroValue);
    660 //     chart->axis(YAxis).setLocation(ZeroValue);
    661    
    662 //     // Provide space for the X and Y axis and title.
    663 //     //   chart->setPlotAreaPadding(80, Left);
    664 //     //   chart->setPlotAreaPadding(40, Top | Bottom);
    665 //     // Add the curves
    666 //     WDataSeries s(1, LineSeries, Y1Axis);
    667 //     chart->addSeries(s);
    668    
    669 //     // chart->setBackground (WBrush(WColor("blue")));
    670 //     chart->resize(500, 300); // WPaintedWidget must be given explicit size
    671    
    672 // #ifdef HAS_IMAGEMAGIC
    673 //     Wt::WRasterImage pngImage("png", 600, 600);
    674 //     Wt::WPainter p(&pngImage);
    675    
    676 //     chart->paint(p);
    677 //     std::string name;
    678 //     name = workingDir_ + "/chart-"+sessionId ()+".png";
    679 //     std::ofstream f(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary);
    680 //     pngImage.write(f);
    681    
    682 //     new WText("<a href='workingArea/chart-"+sessionId ()+".png' target='_blank'>Afficher l'image</a>",toto);
    683    
    684 //     /*
    685 //      Wt::WPdfImage pdfImage("30cm", "30cm");
    686 //      Wt::WPainter p1(&pdfImage);
    687 //      chart->paint(p1);
    688 //      std::ofstream f1("chart.pdf", std::ios::out | std::ios::binary);
    689 //      pdfImage.write(f1);
    690 //      */
    691 // #endif
    692 // }
    693 
    694 // dernier parametre, drawPoints : true = on trace des points (phase space) ; false = on trace des lignes 'enveloppes...)
    695 void PspaApplication::chartPlot2vec(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor, bool drawPoints,int width, int height, bool makeIcon)
     677  string titre = "phase space rms";
     678  chartPlot2vec(ellipseDialog->contents(), xcor, ycor, false,titre, namex, namey,500,300);
     679}
     680
     681
     682// parametre drawPoints : true = on trace des points (phase space) ; false = on trace des lignes (enveloppes...)
     683void PspaApplication::chartPlot2vec(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor, bool drawPoints,string title,string legendx, string legendy,int width, int height, bool makeIcon)
    696684{
    697685    int nbpts = xcor.size();
     
    706694    WCartesianChart *chart = new WCartesianChart(toto);
    707695    if (!makeIcon) {
    708         chart->setTitle("titre");
     696        chart->setTitle(title);
    709697    }
    710698    chart->initLayout();
     
    726714
    727715    // Provide space for the X and Y axis and title.
    728     if ( drawPoints ) {
    729       chart->setPlotAreaPadding(80, Left);
    730       chart->setPlotAreaPadding(40, Top | Bottom);
    731       WDataSeries s(1, PointSeries, Y1Axis);
    732       chart->addSeries(s);
    733       chart->resize(width, height); // WPaintedWidget must be given explicit size
    734      } else {
     716      chart->setPlotAreaPadding(80, Left);  // ?
     717      chart->setPlotAreaPadding(40, Bottom);
     718      chart->setPlotAreaPadding(60, Top);
     719      if ( drawPoints ) {
     720       WDataSeries s(1, PointSeries, Y1Axis);
     721       chart->addSeries(s);   
     722      } else {
    735723       WDataSeries s(1, LineSeries, Y1Axis);
    736724       chart->addSeries(s);   
     725      }
    737726       chart->resize(width, height); // WPaintedWidget must be given explicit size
    738      }
     727
     728
     729       WAxis& axis = chart->axis(XAxis);
     730       axis.setLabelFormat("%.3f");
     731       //       axis.setGridLinesEnabled(true);
     732       axis.setTitle(legendx);
     733
     734       WAxis& axey = chart->axis(YAxis);
     735       axey.setTitle(legendy);
     736       // axis = chart->axis(YAxis);
     737       // axis.setLabelFormat("%.3f");
     738       // axis.setGridLinesEnabled(true);
     739       // axis.setTitle(legendy);
    739740
    740741    if (makeIcon) {
     
    903904  string unites[2];
    904905  if(iabs == 0 || iabs == 1 || iabs == 2) {
    905     unites[0]= unites[1]= " cm";
     906    unites[0]= unites[1]= " mm";
    906907  }
    907908  if(iabs == 3 || iabs == 4) {
     
    942943  axis.setGridLinesEnabled(true);
    943944
    944   if(iabs == 0) axis.setTitle(WString(" x (cm)"));
    945   if(iabs == 1) axis.setTitle(WString(" y (cm)"));
    946   if(iabs == 2) axis.setTitle(WString(" z (cm)"));
     945  if(iabs == 0) axis.setTitle(WString(" x (mm)"));
     946  if(iabs == 1) axis.setTitle(WString(" y (mm)"));
     947  if(iabs == 2) axis.setTitle(WString(" z (mm)"));
    947948  if(iabs == 3) axis.setTitle(WString(" xp (mrad)"));
    948949  if(iabs == 4) axis.setTitle(WString(" yp (mrad)"));
  • Interface_Web/trunk/pspaWT/workingArea/philFit.save

    r376 r381  
    33rfgun
    44rfgun01
    5 1500  5  0.1
     5500  5  0.1
    660  0
    771e-06 1e-12
Note: See TracChangeset for help on using the changeset viewer.