source: PSPA/Interface_Web/trunk/pspaWT/src/GWt_pspaApplication.cc @ 161

Last change on this file since 161 was 161, checked in by garnier, 12 years ago

mise a jour du veuillez patienter

File size: 19.9 KB
RevLine 
[41]1#include <stdio.h>
2#include <string.h>
[56]3#include <vector>
[41]4
5#include <Wt/WLineEdit>
6#include <Wt/WText>
7#include <Wt/WGridLayout>
8#include <Wt/WVBoxLayout>
[54]9#include <Wt/WHBoxLayout>
[41]10#include <Wt/WImage>
[93]11#include <Wt/WMenu>
12#include <Wt/WStackedWidget>
[45]13#include <Wt/WBreak>
[140]14#include <Wt/WDialog>
[54]15#include <Wt/WStandardItemModel>
16#include <Wt/Chart/WCartesianChart>
[41]17
18#include "GWt_pspaApplication.h"
[48]19#include "GWt_LigneFaisceau.h"
[41]20#include "GWt_globalParameters.h"
[143]21#include "GWt_dialog.h"
[138]22#include "particleBeam.h"
[56]23#include "bareParticle.h"
[58]24#include "nomDeLogiciel.h"
25#include "mixedTools.h"
[152]26#include "nomdElements.h"
[41]27
[54]28using namespace Wt::Chart;
[41]29
30/*
31 * The env argument contains information about the new session, and
32 * the initial request. It must be passed to the WApplication
33 * constructor so it is typically also an argument for your custom
34 * application constructor.
35*/
36
[106]37PspaApplication::PspaApplication(const WEnvironment& env) : WApplication(env)
38{
39  setTitle("portail PSPA");                               // application title
40 
41  if (!wApp->environment().javaScript()) {
42    new WText("<i>This examples requires that javascript support is enabled.</i>",root());
43  }
44 
45  WContainerWidget *w = root();
46  w->setStyleClass("PSPA");
47  dtmanage_ = new dataManager();
[41]48
[106]49  /*
50   * The main layout is a 3x2 grid layout.
51   */
52  WGridLayout *layout = new WGridLayout();
53  layout->addWidget(createTitle("Menu (In future)"), 0, 0, 1, 2);
54
55  WHBoxLayout *toolbarLayout = new WHBoxLayout();
56  WPushButton* boutonSauve = new WPushButton(" sauvegarder la config");
57  WPushButton* boutonRestaure = new WPushButton(" restaurer la config");
58  boutonSauve->setMinimumSize(30,30);
59  boutonRestaure->setMinimumSize(30,30);
60 
61  toolbarLayout->addWidget(boutonSauve , 1);
62  toolbarLayout->addWidget(boutonRestaure , 1);
63  boutonSauve->clicked().connect(this, &PspaApplication::sauver);
64  boutonRestaure->clicked().connect(this, &PspaApplication::restaurer);
65  layout->addLayout(toolbarLayout, 1, 0, 1, 2);
66  layout->addWidget(createPalette(), 2, 0, 4, 1);
67 
68  beamLine_ = createBeamLine();
69  layout->addWidget(beamLine_, 2, 1, 1, 1);
70 
71  console_ = new WTextArea();
72  console_->setMaximumSize(600,200);
73  layout->addWidget(console_, 3, 1);
74  console_->setMinimumSize(300,100);
75 
76  //-----------
77  // A supprimer et a mettre en fenetre
78  globalParam_ = createGlobalParamWidget();
[114]79  //  leDessin_ = new WContainerWidget();
80  leDessin_ = createDrawingWidget();
81
82
83
[106]84  WWidget* executeWidget = createExecuteWidget();
[114]85
[106]86  layout->addWidget( globalParam_, 4, 1);
[111]87  layout->addWidget( leDessin_, 3, 2);
[106]88  layout->addWidget( executeWidget , 5, 1);
89  //-----------
90 
91  layout->setColumnResizable(1);
92  layout->setRowResizable(2);
93  /*
94   * Let row 2 and column 1 take the excess space.
95   */
96  layout->setRowStretch(2, 1);
97  layout->setColumnStretch(1, 1);
98 
99  w->setLayout(layout); 
100}
101
[41]102WWidget* PspaApplication::createPalette()
103{
104  WContainerWidget* palette=new WContainerWidget();
105  //  palette->setLayout(new WVBoxLayout());
106
[152]107  // nomdElements *e= new nomdElements();
108  // int nElts= e->getNumberOfElements();
109  // delete e;
110  //  nomdElements bidon;
111  int nElts= nomdElements::getNumberOfElements(); 
[41]112
[152]113  for(int k = 0; k < nElts; k++) {
114    typedElement eType= (typedElement)k;
[160]115    string image = nomdElements::getImageFromType(eType);
[152]116    createDragImage(image.c_str(),
[160]117                    image.c_str(),image.c_str(), palette,nomdElements::getLabelFromType(eType));
[45]118  new WBreak(palette);
[152]119  }
[41]120
121
122  palette->setMinimumSize(100,300);
123  return palette;
124}
125
[106]126void PspaApplication::createDragImage(const char *url,const char *smallurl,const char *mimeType,WContainerWidget *p,WString name)
127{
128  WImage *result = new WImage(url,p);
129  WImage *dragImage = new WImage(smallurl,p);
130
131  /*
132   * Set the image to be draggable, showing the other image (dragImage)
133   * to be used as the widget that is visually dragged.
134   */
135  result->setDraggable(mimeType,dragImage,true);
136}
137
[41]138WWidget* PspaApplication::createBeamLine()
139{
[106]140  WContainerWidget* beamLine = new GWt_LigneFaisceau(this);
[93]141  beamLine->setMinimumSize(300,100);
[41]142  return beamLine;
143}
144
145WWidget* PspaApplication::createGlobalParamWidget()
146{
[106]147  WContainerWidget* globalParam = new GWt_globalParameters(this);
[58]148  globalParam->setMaximumSize(600,150);
149  globalParam->setMinimumSize(600,150);
[41]150  return globalParam;
151}
152
[58]153WWidget* PspaApplication::createExecuteWidget()
154{
[112]155
[106]156  WContainerWidget* executeW = new WContainerWidget();
[58]157  executeW->setMaximumSize(600,150);
158  executeW->setMinimumSize(600,150);
159
160  // bouton execute
[106]161  exec_go_ = new WPushButton("execute!");
162  //    exec_go_->setMinimumSize(300,300);
163  exec_go_->setDisabled(true);
164  exec_go_->clicked().connect(this, &PspaApplication::executer);
[112]165
[58]166  // preparation du bouton add
[59]167  WPushButton* exec_add = new WPushButton("add");
168  exec_add->clicked().connect(this, &PspaApplication::addSectionToExecuteW);
[106]169 
[59]170  // preparation du bouton delete
171  WPushButton* exec_delete = new WPushButton("delete");
172  exec_delete->clicked().connect(this, &PspaApplication::deleteSectionToExecuteW);
173
174  // preparation du bouton push_ok
175  WPushButton* exec_ok = new WPushButton("check/ok");
176  exec_ok->clicked().connect(this, &PspaApplication::checkSectionSelection);
[106]177 
[58]178  // le panel
179  WPanel *panelLogiciels = new WPanel(executeW);
180  panelLogiciels->setTitle(" sections of beam Line for executing softwares ");
181
[112]182  contenuSections_ = new WContainerWidget(); 
183  contenuSections_->addWidget(exec_add);
184  contenuSections_->addWidget(exec_delete);
185  contenuSections_->addWidget(exec_ok);
[106]186  contenuSections_->addWidget(exec_go_);
[59]187  contenuSections_->addWidget(new WBreak());
188  contenuSections_->addWidget(new WBreak());
[106]189  addSectionToExecuteW();
190 
[58]191  panelLogiciels->setCentralWidget(contenuSections_);
192  return executeW;
193}
194
[114]195
[138]196WContainerWidget* PspaApplication::createDrawingWidget()
[114]197{
198  WContainerWidget* dessin = new WContainerWidget();
199
[138]200  dessin->addWidget(new WText(" graphic analysis :  "));
201  dessin->addWidget(new WBreak());
[114]202  dessin->addWidget(new WText(" drawing after element :  "));
[138]203
204
205  choixElementDessin_ = new WComboBox();
[149]206
207  choixTypeDessinFaisceau_ = new WComboBox();
208  choixTypeDessinFaisceau_->addItem("courant_snyder");
209  choixTypeDessinFaisceau_->addItem("macroparticles");
210
[138]211  dessin->addWidget(choixElementDessin_);
[149]212  dessin->addWidget(choixTypeDessinFaisceau_);
[138]213  WPushButton* caroule = new WPushButton("dessiner");
214 dessin->addWidget(caroule);
215 caroule->clicked().connect(this, &PspaApplication::dessiner);
216  dessin->addWidget(new WBreak());
217
[149]218  WPushButton* okEnv = new WPushButton("draw enveloppe");
219
220  dessin->addWidget(new WText(" drawing enveloppe :  "));
221  choixEnveloppeDessin_ = new WComboBox();
222  choixEnveloppeDessin_->addItem("x");
223  choixEnveloppeDessin_->addItem("y");
224
225  dessin->addWidget(okEnv);
226 okEnv->clicked().connect(this, &PspaApplication::dessinerEnveloppe);
227
[138]228  toto_ = new WContainerWidget();
229  dessin->addWidget(toto_);
[114]230  return dessin;
231}
232
[58]233void PspaApplication::addSectionToExecuteW()
234{
[59]235
236  disableSectionExecute();
237
[112]238  string premierText, dernierText;
239  if(selectedSections_.size() == 0)
[58]240    {
[118]241      premierText = dtmanage_->getLabelFromElementNumero(1);
242
243      dernierText = dtmanage_->getLabelFromElementNumero(dtmanage_->beamLineSize());
[58]244    }
245  else 
246    {
[85]247      dernierText = selectedSections_.back()->fin->text().toUTF8();
[118]248      int dernierNumero = dtmanage_->getCollection()->getNumeroFromLabel(dernierText);
[85]249      dernierNumero++;
250      if ( dernierNumero <= dtmanage_->beamLineSize() )
251        {
[118]252          premierText = dtmanage_->getLabelFromElementNumero(dernierNumero);
[85]253        }
254      else 
255        {
[118]256          premierText = dtmanage_->getLabelFromElementNumero(dtmanage_->beamLineSize());
[85]257        }
[118]258      dernierText = premierText;
[58]259    }
[112]260 
[118]261  //  cout << "PspaApplication::addSectionToExecute() : " << premierText << " à  " << dernierText << endl;
[58]262
[59]263  WContainerWidget* newSection = new WContainerWidget;
264
[58]265  selectedSections_.push_back(new GWt_sectionToExecute);
266  selectedSections_.back()->debut = new WLineEdit();
[59]267  selectedSections_.back()->debut->setDisabled(true);
[58]268  selectedSections_.back()->debut->setText(premierText);
269  selectedSections_.back()->fin = new WLineEdit();
[112]270  selectedSections_.back()->fin->changed().connect(this,&PspaApplication::disableSectionExecute);
[58]271  selectedSections_.back()->fin->setText(dernierText);
272  selectedSections_.back()->selection = new WComboBox();
[59]273  selectedSections_.back()->ligneDeWidget = newSection;
274  newSection->addWidget(new WText(" from : "));
275  newSection->addWidget(selectedSections_.back()->debut);
276  newSection->addWidget(new WText(" to : "));
277  newSection->addWidget(selectedSections_.back()->fin);
278  newSection->addWidget(selectedSections_.back()->selection);
[58]279
[112]280  contenuSections_->addWidget(newSection);
[59]281  unsigned nb = nomDeLogiciel::getNumberOfSoftwares();
[112]282  unsigned k;
283  for(k = 0; k < nb; k++) {
284    selectedSections_.back()->selection->addItem(nomDeLogiciel(k).getString());
285  }
[58]286}
287
[59]288void PspaApplication::disableSectionExecute()
289{
[112]290  exec_go_->setDisabled(true);
[59]291}
[58]292
[59]293void PspaApplication::checkSectionSelection()
294{
295  if ( selectedSections_.empty() ) return;
[85]296
297  // traitement de la premiere ligne
[118]298  // on impose le depart du calcul au premier element
299  string premier = dtmanage_->getLabelFromElementNumero(1);
300  (*selectedSections_.begin())->debut->setText(premier);
301
[59]302  string currentString =  (*selectedSections_.begin())->fin->text().toUTF8();
[118]303  int current = dtmanage_->getCollection()->getNumeroFromLabel( currentString);
304
305  cout << " numero " << current << endl;
306  // si la fin est mal definie on prend toute la config par defaut
307  if ( current <= 0 || current > dtmanage_->beamLineSize() ) 
[59]308    {
[118]309      current = dtmanage_->beamLineSize();
310      currentString =  dtmanage_->getLabelFromElementNumero(current);
311      (*selectedSections_.begin())->fin->setText(currentString);
[59]312    }
[85]313  current++;
[118]314  currentString = dtmanage_->getLabelFromElementNumero(current);
[85]315   
316  // traitement des suivantes (on avance d'un cran dans la liste)
[59]317  list<GWt_sectionToExecute*>::iterator itr, itr0;
[112]318  itr0 = selectedSections_.begin();
[59]319  itr0++;
[112]320  for (itr = itr0; itr != selectedSections_.end(); itr++)
[59]321    {
[85]322      // debut
[118]323      if ( current >= dtmanage_->beamLineSize() ) 
324        {
325          addConsoleMessage(" bad section definition !  \n ");
[147]326          GWt_dialog warningDialog("PSPA : Vérification des sections", " bad section definition !", GWt_dialog::Error,true,true);
[143]327          warningDialog.exec();
[118]328          return;
329        }
330
[112]331      (*itr)->debut->setText(currentString);
[85]332      // fin
333      string finString =  (*itr)->fin->text().toUTF8();
[118]334
335      int numeroFin = dtmanage_->getCollection()->getNumeroFromLabel( finString);
336
337      if ( numeroFin <= current || numeroFin > dtmanage_->beamLineSize())
[59]338        {
[118]339          addConsoleMessage(" bad section definition !  \n ");
[147]340          GWt_dialog warningDialog("PSPA : Vérification des sections", " bad section definition !", GWt_dialog::Error, true,true);
[143]341          warningDialog.exec();
[118]342          return;
[59]343        }
344
[85]345      // preparation de la ligne suivante
[118]346      current = numeroFin +1;
347      currentString = dtmanage_->getLabelFromElementNumero(current);
[59]348    }
[112]349
[143]350  if (!areDataCoherent()) {
[147]351    GWt_dialog warningDialog("PSPA : Vérification des sections", " données incohérentes !", GWt_dialog::Error,true,true);
[143]352    warningDialog.exec();
353  }
[105]354  else 
355    {
356      exec_go_->setDisabled(false);
357    }
[59]358}
[112]359
[105]360bool PspaApplication::areDataCoherent() 
361{
[112]362  bool caMarche = true;
[105]363  dtmanage_->initializeExecution();
[112]364 
[105]365  list<GWt_sectionToExecute*>::iterator itr;
[112]366  for(itr = selectedSections_.begin(); itr != selectedSections_.end(); itr++)
[105]367    {
368      string debString = (*itr)->debut->text().toUTF8();
369      string finString = (*itr)->fin->text().toUTF8();
[118]370
371
372      int debut = dtmanage_->getCollection()->getNumeroFromLabel(debString);
373      int fin = dtmanage_->getCollection()->getNumeroFromLabel(finString);
[112]374      nomDeLogiciel prog = nomDeLogiciel ( (*itr)->selection->currentIndex() );
375      dtmanage_->addSectionToExecute(debut,fin,prog);
[105]376    }
[112]377
[105]378  string diagnostic = dtmanage_->checkExecute();
379  if ( !diagnostic.empty() )
380    {   
381      caMarche = false; 
382      addConsoleMessage(diagnostic.c_str());
[147]383      GWt_dialog calculDialog("PSPA : Erreur lors de check execute", diagnostic , GWt_dialog::Error,true,true);
[143]384      calculDialog.exec();
[105]385    }
386
387  return caMarche;
388}
389
[59]390void PspaApplication::deleteSectionToExecuteW()
391{
392  if ( selectedSections_.empty() ) return;
393  disableSectionExecute();
394  selectedSections_.back()->ligneDeWidget->clear();
395  delete selectedSections_.back()->ligneDeWidget;
396  selectedSections_.pop_back();
397}
398
[105]399void PspaApplication::executer()
400{
401  addConsoleMessage(string("on va peut etre y arriver"));
402  static_cast<GWt_globalParameters*>(globalParam_)->updateGlobals();
[139]403
[161]404  GWt_dialog calculDialog("Calcul en cours", "Veuillez patienter...", GWt_dialog::Wait, true,false);
[140]405  calculDialog.show();
406
[141]407  processEvents();     
408
[105]409  string resultat;
[143]410  if ( !dtmanage_->executeAll(resultat)) {
[147]411    GWt_dialog warningDialog("PSPA : Echec", " echec lors de l'exécution !", GWt_dialog::Error, true,true);
[143]412    warningDialog.exec();
413  }
[111]414  //  cout << " PspaApplication : retour d'execution resultat =  " << resultat << endl;
[105]415  addConsoleMessage(resultat);
[111]416  //  cout << " PspaApplication : affichage console termine  " << endl;
[138]417
[139]418  exec_go_->setDisabled(true);
419
[140]420  calculDialog.hide();
421
[105]422  faireDessin();
423}
424
[50]425void PspaApplication::sauver()
426{
427  cout << " on sauve " << endl;
[59]428  addConsoleMessage("sauvegarde");
[50]429  GWt_globalParameters* bibi = static_cast<GWt_globalParameters*>(globalParam_);
430  bibi->updateGlobals();
431  dtmanage_->saveAll();
[41]432
[50]433}
[41]434
[50]435void PspaApplication::restaurer()
436{
[59]437  addConsoleMessage(string("restauration..."));
438
[111]439  dtmanage_->restoreElements();
[50]440
441  GWt_globalParameters* bibi = static_cast<GWt_globalParameters*>(globalParam_);
442  bibi->renew();
443
444  GWt_LigneFaisceau* bobo = static_cast<GWt_LigneFaisceau*>(beamLine_);
[112]445  bobo->restoreElementCollection();
[50]446
[59]447  addConsoleMessage(string("...terminee"));
[50]448}
449
[56]450void PspaApplication::faireDessin()
451{
[138]452  choixElementDessin_->clear();
453  int nombre = dtmanage_->beamLineSize();
454  for ( int numero =1; numero <= nombre; numero++)
455    {
456      choixElementDessin_->addItem(dtmanage_->getLabelFromElementNumero(numero));
457    }
[114]458
[138]459}
[114]460
[138]461void PspaApplication::dessiner()
462{
463 
464  toto_->clear();
[114]465
[149]466  int typeFaisceau = choixTypeDessinFaisceau_->currentIndex();
467
[138]468  int index = choixElementDessin_->currentIndex();
469  particleBeam* beam = dtmanage_->getDiagnosticBeam(index);
[149]470  if ( typeFaisceau == 0 ) 
471    {
472      if ( !beam->momentRepresentationOk() ) beam->buildMomentRepresentation();
473      faireDessinTransport(toto_, beam);
474    }
475  else if ( typeFaisceau == 1 ) 
476    {
477      if ( beam->particleRepresentationOk() ) faireDessinParmela(toto_, beam);
478      else addConsoleMessage("the beam state does not allow providing a drawing"); 
479    }
480  else addConsoleMessage("type of  drawing not programmed");
481  //////////////////////////////////////////
482}
[138]483
[149]484void PspaApplication::dessinerEnveloppe()
485{
486 
487  toto_->clear();
488
489  int typeEnveloppe = choixEnveloppeDessin_->currentIndex();
490  if ( typeEnveloppe == 0 ) 
491    {
492      faireDessinEnveloppe(toto_, "x");
493    }
494  else addConsoleMessage("type of enveloppe drawing not programmed");
[138]495  //////////////////////////////////////////
[105]496}
497
[149]498void PspaApplication::faireDessinEnveloppe(WContainerWidget* toto, string type)
499{
500       new WText("enveloppe", toto);
501       unsigned nbel = dtmanage_->beamLineSize();
[138]502
[149]503
504  vector<double> xcor;
505  vector<double> ycor;
506
507
508  dtmanage_->donneesRmsEnveloppe(type,1, nbel, xcor,ycor);
509
510    scatterPlot1D(toto,xcor,ycor);
511
512}
513
[138]514void PspaApplication::faireDessinParmela(WContainerWidget* toto, particleBeam* beam)
[105]515{
[138]516  // WContainerWidget* toto = static_cast<WContainerWidget*>(leDessin_);
517  // //  toto->clear();
518  //      new WText("emittance", toto);
519  // vector<bareParticle>& partic = dtmanage_->getCurrentBeam()->getParticleVector();
520       new WText("emittance parmela", toto);
521  vector<bareParticle>& partic = beam->getParticleVector();
[56]522  WStandardItemModel *model = new WStandardItemModel(partic.size(), 3, toto);
523  //    model->setHeaderData(0, WString("X"));
524  //   model->setHeaderData(1, WString("Y = sin(X)"));
525
526
527  for (unsigned i = 0; i < partic.size(); ++i) {
528    double x= partic.at(i).getPosition().getComponent(0);
529    double begamz = partic.at(i).getBetaGamma().getComponent(2);
530    double xp = partic.at(i).getBetaGamma().getComponent(0)/begamz;
531    //    cout << "x = " << x << " xp= " << xp << endl;
532    model->setData(i, 0, 10*x);
533    model->setData(i, 1,1.e3*xp);
534    model->setData(i, 2,2.e3*xp);
535  }
536
537  WCartesianChart *chart = new WCartesianChart(toto);
538  chart->setModel(model);        // set the model
539  chart->setXSeriesColumn(0);    // set the column that holds the X data
540  chart->setLegendEnabled(true); // enable the legend
541
542  chart->setType(ScatterPlot);   // set type to ScatterPlot
543
544  // Typically, for mathematical functions, you want the axes to cross
545  // at the 0 mark:
546   chart->axis(XAxis).setLocation(ZeroValue);
547   chart->axis(YAxis).setLocation(ZeroValue);
548
549  // Provide space for the X and Y axis and title.
550  chart->setPlotAreaPadding(80, Left);
551  chart->setPlotAreaPadding(40, Top | Bottom);
552  // Add the curves
553  WDataSeries s(1, PointSeries, Y1Axis);
554  //  s.setShadow(WShadow(3, 3, WColor(0, 0, 0, 127), 3));
[58]555  //    s.setMarker(SquareMarker);
[56]556  //  s.setMarkerSize(600.);
[59]557  //  cout << "le marker est : " << s.marker() << endl;
[56]558     chart->addSeries(s);
559
560  chart->resize(300, 300); // WPaintedWidget must be given explicit size
561
562  //  chart->setMargin(10, Top | Bottom);            // add margin vertically
563  //  chart->setMargin(WLength::Auto, Left | Right); // center horizontally
564}
565
566
[58]567// void PspaApplication::addElemToGlobals()
568// {
569//   static_cast<GWt_globalParameters*>(globalParam_)->addElem();
570// }
571
[138]572void PspaApplication::faireDessinTransport(WContainerWidget* toto, particleBeam* beam)
[86]573{
[138]574  //  WContainerWidget* toto = static_cast<WContainerWidget*>(leDessin_);
[114]575  //  toto->clear();
[86]576  new WText("emittance transport", toto);
577  vector<double> xcor;
578  vector<double> ycor;
[138]579  //  dtmanage_->getCurrentBeam()->donneesDessinEllipseXxp(xcor,ycor);
580  beam->donneesDessinEllipseXxp(xcor,ycor);
[149]581    scatterPlot1D(toto,xcor,ycor);
582
583}
584
585void PspaApplication::scatterPlot1D(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor)
586{
[86]587  int nbpts = xcor.size();
[149]588  cout << " PspaApplication::scatterPlot1D nbpts = " << nbpts << endl;
[86]589  WStandardItemModel *model = new WStandardItemModel(nbpts, 2, toto);
590  for (int i = 0; i < nbpts; ++i) {
591    model->setData(i, 0, xcor.at(i));
592    model->setData(i, 1, ycor.at(i));
[149]593    cout << " PspaApplication::scatterPlot1D el= " << i+1 << " x= " << xcor.at(i) << " y= " << ycor.at(i) << endl;
[86]594  }
595
596  WCartesianChart *chart = new WCartesianChart(toto);
597  chart->setModel(model);        // set the model
598  chart->setXSeriesColumn(0);    // set the column that holds the X data
599  chart->setLegendEnabled(true); // enable the legend
600
601  chart->setType(ScatterPlot);   // set type to ScatterPlot
602
603  // Typically, for mathematical functions, you want the axes to cross
604  // at the 0 mark:
605   chart->axis(XAxis).setLocation(ZeroValue);
606   chart->axis(YAxis).setLocation(ZeroValue);
607
608  // Provide space for the X and Y axis and title.
609  chart->setPlotAreaPadding(80, Left);
610  chart->setPlotAreaPadding(40, Top | Bottom);
611  // Add the curves
612  WDataSeries s(1, CurveSeries, Y1Axis);
613     chart->addSeries(s);
614
615  chart->resize(300, 300); // WPaintedWidget must be given explicit size
616}
617
[58]618void PspaApplication::updateSelections()
619{
620  string premierText, dernierText;
621  if ( selectedSections_.size() > 0 )
622    {
[118]623      premierText = dtmanage_->getLabelFromElementNumero(1);
624      dernierText = dtmanage_->getLabelFromElementNumero( dtmanage_->beamLineSize() );
[58]625      (*selectedSections_.begin())->debut->setText(premierText);
626      (*selectedSections_.begin())->fin->setText(dernierText);
627    }
[112]628
[118]629  cout << "PspaApplication::updateSelections(): " << premierText << " à  " << dernierText << endl;
[106]630}
[58]631
[106]632string PspaApplication::getSelection()
633{
634  list<GWt_sectionToExecute*>::iterator itr = selectedSections_.begin();
635  string str = (*itr)->fin->text().toUTF8();
636  return str;
[58]637}
[93]638
[106]639WText* PspaApplication::createTitle(const WString& title) 
640{
[93]641  WText *result = new WText(title);
642  result->setInline(false);
643  result->setStyleClass("title");
644  result->setMinimumSize(30,30);
645 
646  return result;
647}
Note: See TracBrowser for help on using the repository browser.