Changeset 407 in PSPA for Interface_Web
- Timestamp:
- Mar 28, 2013, 4:32:42 PM (11 years ago)
- Location:
- Interface_Web/trunk/pspaWT/sources
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc
r401 r407 83 83 if (a<0) return; 84 84 if (a>= jobList_.size()) return; 85 delete jobList_[a];85 jobList_.erase (jobList_.begin()+a); 86 86 } 87 87 -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h
r401 r407 103 103 void dessinerPhaseSpace(); 104 104 105 void old_dessinerHistogramme();106 105 void dessinerHistogramme(); 107 106 -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sectionToExecute.h
r401 r407 11 11 { 12 12 public : 13 GWt_sectionToExecute(Wt::WComboBox*,Wt::WComboBox*,Wt::WComboBox*, GWt_softwarePanel* sPanel);13 GWt_sectionToExecute(Wt::WComboBox*,Wt::WComboBox*,Wt::WComboBox*,Wt::WContainerWidget* buttonPanel,GWt_softwarePanel* sPanel); 14 14 15 15 ~GWt_sectionToExecute() {;} -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_softwarePanel.h
r405 r407 34 34 // void checkSectionSelection(); 35 35 bool updateSectionSelection(); 36 void deleteSectionToExecuteW( );36 void deleteSectionToExecuteW(int section); 37 37 string getSelection(); 38 38 void executer(); … … 40 40 void fillComboWithElements(Wt::WComboBox* cBox); 41 41 void fillComboWithSoftwares(Wt::WComboBox* cBox); 42 Wt::WContainerWidget* createAddDeletePushButtons( );42 Wt::WContainerWidget* createAddDeletePushButtons(int sectionIndex); 43 43 44 44 dataManager* dtmanage_; -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc
r404 r407 2 2 #include <string.h> 3 3 #include <vector> 4 #include <ctime> 4 5 5 6 #include "GWt_pspaApplication.h" … … 575 576 { 576 577 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 (")+std::asctime(std::localtime(&result))+")",toto,false); 578 581 eDialog_.push_back(envDialog); 579 582 envDialog->setMinimumSize(400,400); … … 618 621 return; 619 622 } 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 (")+std::asctime(std::localtime(&result))+")",toto,false); 622 626 eDialog_.push_back(phaseSpaceDialog); 623 627 phaseSpaceDialog->setMinimumSize(400,400); … … 852 856 } 853 857 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 985 859 986 860 void PspaApplication::removeBeamLine() { … … 1076 950 toto_->clear(); 1077 951 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 (")+std::asctime(std::localtime(&result))+")",toto_,false); 1079 954 eDialog_.push_back(histoDialog); 1080 955 histoDialog->setMinimumSize(400,400); -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sectionToExecute.cc
r405 r407 9 9 #include "GWt_softwarePanel.h" 10 10 11 GWt_sectionToExecute::GWt_sectionToExecute(Wt::WComboBox* first,Wt::WComboBox* last,Wt::WComboBox* soft, GWt_softwarePanel* sPanel)11 GWt_sectionToExecute::GWt_sectionToExecute(Wt::WComboBox* first,Wt::WComboBox* last,Wt::WComboBox* soft,Wt::WContainerWidget* buttonPanel, GWt_softwarePanel* sPanel) 12 12 :WContainerWidget(), 13 13 firstElement(first), … … 32 32 labelAndComboInsideContainerLayout->addWidget(last); 33 33 labelAndComboInsideContainerLayout->addWidget(soft); 34 35 // add buttons 36 labelAndComboInsideContainerLayout->addWidget(buttonPanel); 34 37 35 38 labelAndComboInsideContainer->setLayout(labelAndComboInsideContainerLayout); … … 89 92 lastElement->setMinimumSize(80,12); 90 93 software->setMinimumSize(80,12); 91 94 92 95 firstElement->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections); 93 96 lastElement->activated().connect(softwarePanel,&GWt_softwarePanel::updateSections); -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc
r406 r407 129 129 fillComboWithSoftwares(softCombo); 130 130 131 GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFromCombo, lineToCombo, softCombo,this); 131 GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFromCombo, lineToCombo, softCombo,createAddDeletePushButtons(sections_.size()),this); 132 133 stringstream st; 134 st << sections_.size(); 135 136 // this is the mean to identify this section! 137 newSection->setObjectName(st.str()); 132 138 133 139 // push back on sections vector 134 140 sections_.push_back(newSection); 135 141 136 Wt::WContainerWidget* container = new Wt::WContainerWidget();142 /* Wt::WContainerWidget* container = new Wt::WContainerWidget(); 137 143 Wt::WGridLayout* containerLayout = new Wt::WGridLayout(); 138 144 containerLayout->setContentsMargins(0,0,0,0); … … 142 148 143 149 // add buttons 144 containerLayout->addWidget(createAddDeletePushButtons( ),0,1);150 containerLayout->addWidget(createAddDeletePushButtons(sections_.size()-1),0,1); 145 151 146 152 container->setLayout(containerLayout); 153 */ 147 154 148 155 // add to sections 149 contenuSections_->addWidget(container); 156 // contenuSections_->addWidget(container); 157 contenuSections_->addWidget(newSection); 150 158 } 151 159 … … 374 382 } 375 383 376 void GWt_softwarePanel::deleteSectionToExecuteW() 377 { 378 /* if ( dtmanage_->getJobListSize() == 0 ) return; 379 // delete from dataManager 380 dtmanage_->clearSectionToExecute(dtmanage_->getJobListSize()-1); 381 382 // delete from User Interface 383 sections_.pop_back(); 384 */ 384 void GWt_softwarePanel::deleteSectionToExecuteW(int sectionLabel) 385 { 386 stringstream st; 387 st << sectionLabel; 388 std::string sectionName = st.str(); 389 390 if ( dtmanage_->getJobListSize() == 0 ) return; 391 for (unsigned int sectionIndex = 0; sectionIndex< sections_.size(); sectionIndex++) { 392 if (sections_[sectionIndex]->objectName() == sectionName) { 393 394 // delete from dataManager 395 dtmanage_->clearSectionToExecute(sectionIndex); 396 397 // delete from User Interface 398 contenuSections_->removeWidget(sections_[sectionIndex]); 399 delete sections_[sectionIndex]; 400 sections_.erase (sections_.begin()+sectionIndex); 401 } 402 } 385 403 } 386 404 … … 494 512 495 513 496 Wt::WContainerWidget* GWt_softwarePanel::createAddDeletePushButtons( ) {514 Wt::WContainerWidget* GWt_softwarePanel::createAddDeletePushButtons(int sectionNumber) { 497 515 498 516 WContainerWidget* buttonContainer= new WContainerWidget(); … … 510 528 WPushButton* exec_delete = new WPushButton("-"); 511 529 // warningsContainer_->setStyleClass("warningsContainer"); 512 exec_delete->clicked().connect(this, &GWt_softwarePanel::deleteSectionToExecuteW); 530 531 exec_delete->clicked().connect(boost::bind(&GWt_softwarePanel::deleteSectionToExecuteW, this, sectionNumber)); 513 532 exec_delete->setStyleClass("roundButton"); 514 533 exec_delete->setMaximumSize(20,20);
Note: See TracChangeset
for help on using the changeset viewer.