Ignore:
Timestamp:
Mar 28, 2013, 4:32:42 PM (11 years ago)
Author:
garnier
Message:

Correction dans les comboBox

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc

    r404 r407  
    22#include <string.h>
    33#include <vector>
     4#include <ctime>
    45
    56#include "GWt_pspaApplication.h"
     
    575576{
    576577 
    577   GWt_dialog* envDialog = new GWt_dialog("enveloppe",toto,false);
     578  std::time_t result = std::time(NULL);
     579 
     580  GWt_dialog* envDialog = new GWt_dialog(WString("enveloppe&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(")+std::asctime(std::localtime(&result))+")",toto,false);
    578581  eDialog_.push_back(envDialog);
    579582  envDialog->setMinimumSize(400,400);
     
    618621    return;
    619622  }
    620 
    621   GWt_dialog* phaseSpaceDialog = new GWt_dialog("phase space",toto,false);
     623 
     624  std::time_t result = std::time(NULL);
     625  GWt_dialog* phaseSpaceDialog = new GWt_dialog(WString("phase space&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(")+std::asctime(std::localtime(&result))+")",toto,false);
    622626  eDialog_.push_back(phaseSpaceDialog);
    623627  phaseSpaceDialog->setMinimumSize(400,400);
     
    852856}
    853857
    854 void PspaApplication::old_dessinerHistogramme()
    855 {
    856   // pour mon test : histo en energie
    857   toto_->clear();
    858  
    859   GWt_dialog* histoDialog = new GWt_dialog("histogramme",toto_,false);
    860   eDialog_.push_back(histoDialog);
    861   histoDialog->setMinimumSize(400,400);
    862   histoDialog->setClosable(true);
    863  
    864   // int index = choixHistoDessin_->currentIndex();   
    865   // particleBeam* beam = dtmanage_->getDiagnosticBeam(index);
    866    string elementLabel = choixHistoDessin_->currentText().toUTF8();   
    867    particleBeam* beam = dtmanage_->getDiagnosticBeam(elementLabel);
    868   if (beam == NULL) {
    869     GWt_dialog warningBeamState("histogram","the beam does not exist at the end of this element !", GWt_dialog::Error, false,true);
    870     warningBeamState.exec();
    871     return;
    872   }
    873  
    874   if (!beam->particleRepresentationOk()) {
    875     GWt_dialog warningBeamState("histogram", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);
    876     warningBeamState.exec();
    877     return;
    878   }
    879 
    880   histoDialog->show();
    881   vector<double> xcor;
    882   vector<int> hist;
    883   double out[3]= {0.0};
    884 
    885   unsigned iabs= choixVariableHisto_->currentIndex(); 
    886   beam->histogramme(iabs,xcor,hist,out);
    887 
    888   cout<<"xcor.size()= "<<xcor.size()<<", hist.size()= "<<hist.size()<<endl;
    889   //////////////////////////////////////////////////////////////////////////////////
    890 
    891   WContainerWidget *w= histoDialog->contents();
    892   int n = hist.size();
    893   int nbpts= 2*(n+1);
    894   WStandardItemModel *model = new WStandardItemModel(nbpts,2,w);
    895 
    896   int j= 0;
    897   model->setData(j,0,xcor[0]);
    898   model->setData(j,1,0.0);
    899   j++;
    900   model->setData(j,0,xcor[0]);
    901   model->setData(j,1,hist[0]);
    902   j++;
    903 
    904   for (int i = 1; i < n; ++i) {
    905     model->setData(j,0,xcor[i]);
    906     model->setData(j,1,hist[i-1]);
    907     j++;
    908     model->setData(j,0,xcor[i]);
    909     model->setData(j,1,hist[i]);
    910     j++;
    911   }
    912 
    913   model->setData(j,0,xcor[n]);
    914   model->setData(j,1,hist[n-1]);
    915   j++;
    916   model->setData(j,0,xcor[n]);
    917   model->setData(j,1,0.0);
    918 
    919   // legendes
    920   string unites[2];
    921   if(iabs == 0 || iabs == 1 || iabs == 2) {
    922     unites[0]= unites[1]= " mm";
    923   }
    924   if(iabs == 3 || iabs == 4) {
    925     unites[0]= unites[1]= " mrad";
    926   }
    927   if(iabs == 5) {
    928     unites[0]= " MeV"; unites[1]= " KeV";
    929   }
    930 
    931   new WText(" entries : "+ mixedTools::intToString((int)out[0]),w);
    932   new WBreak(w);
    933   new WText(" mean : "+ mixedTools::doubleToString(out[1])+unites[0],w);
    934   new WBreak(w);
    935   new WText(" sigma rms : "+ mixedTools::doubleToString(out[2])+unites[1],w);
    936    
    937   WCartesianChart *chart = new WCartesianChart(w);
    938 
    939   if(iabs == 0) chart->setTitle("x-coordinate");
    940   if(iabs == 1) chart->setTitle("y-coordinate");
    941   if(iabs == 2) chart->setTitle("z-coordinate");
    942   if(iabs == 3) chart->setTitle("xp-divergence");
    943   if(iabs == 4) chart->setTitle("yp-devergence");
    944   if(iabs == 5) chart->setTitle("kinetic energy");
    945  
    946   chart->setModel(model);        // set the model
    947   chart->setXSeriesColumn(0);    // set the column that holds the categories
    948   chart->setLegendEnabled(false); // enable the legend
    949    
    950   // Provide space for the X and Y axis and title.
    951   chart->setPlotAreaPadding(200, Right);
    952   chart->setPlotAreaPadding(80, Left);
    953   chart->setPlotAreaPadding(40, Top | Bottom);
    954    
    955   chart->setType(ScatterPlot);
    956    
    957   WAxis& axis = chart->axis(XAxis);
    958   axis.setLabelFormat("%.3f");
    959   axis.setGridLinesEnabled(true);
    960 
    961   if(iabs == 0) axis.setTitle(WString(" x (mm)"));
    962   if(iabs == 1) axis.setTitle(WString(" y (mm)"));
    963   if(iabs == 2) axis.setTitle(WString(" z (mm)"));
    964   if(iabs == 3) axis.setTitle(WString(" xp (mrad)"));
    965   if(iabs == 4) axis.setTitle(WString(" yp (mrad)"));
    966   if(iabs == 5) axis.setTitle(WString(" dEcin/Ecin (%)"));
    967  
    968   chart->axis(Y1Axis).setGridLinesEnabled(true);
    969   //chart->axis(Y1Axis).setTitle(WString("legende y"));
    970    
    971   WDataSeries s(1, LineSeries);
    972   s.setFillRange(ZeroValueFill);
    973   chart->addSeries(s);
    974    
    975   chart->resize(800, 400);
    976   chart->setMargin(10, Top | Bottom);
    977   chart->setMargin(WLength::Auto, Left | Right);
    978    
    979   LegendLocation location = LegendOutside;
    980   Side side = Right;
    981   AlignmentFlag alignment = AlignMiddle;
    982   chart->setLegendLocation(location, side, alignment);
    983   chart->setLegendStyle(chart->legendFont(), WPen(black), WBrush(WColor(0xFF, 0xFA, 0xE5)));
    984 }
     858
    985859
    986860void PspaApplication::removeBeamLine() {
     
    1076950  toto_->clear();
    1077951 
    1078   GWt_dialog* histoDialog = new GWt_dialog("histogramme",toto_,false);
     952  std::time_t result = std::time(NULL);
     953  GWt_dialog* histoDialog = new GWt_dialog(WString("histogramme&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(")+std::asctime(std::localtime(&result))+")",toto_,false);
    1079954  eDialog_.push_back(histoDialog);
    1080955  histoDialog->setMinimumSize(400,400);
Note: See TracChangeset for help on using the changeset viewer.