Changeset 341 in PSPA
- Timestamp:
- Feb 22, 2013, 10:07:46 AM (12 years ago)
- Location:
- Interface_Web/trunk/pspaWT
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/History
r336 r341 5 5 PSPA - Plateforme de simulation en physique des accélérateurs 6 6 ========================================================= 7 8 22 février 2013 Guy Le Meur 9 - complété le tracé des espaces de phases pour le généraliser aux couples (y,yp), (x,y) etc. 10 _ corrigé un bug concernant la sauvegarde de la configuration : l'attribut nameOfCase_ de la classe PspaApplication contient le 'nom du cas de calcul' sans extension ni chemin. Donc, pour le cas test, nameOfCase_ vaut 'pspa'. 7 11 8 12 20 Février 2013 Laurent Garnier -
Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h
r316 r341 51 51 trivaluedBool checkElementsForExec(nomDeLogiciel logiciel, unsigned indexDeb, unsigned indexFin, string& diagnostic); 52 52 bool executeAll(); 53 void saveConfiguration(string nameOf File);53 void saveConfiguration(string nameOfCase); 54 54 bool restoreElements(string inputFileName); 55 55 void donneesRmsEnveloppe( string type, unsigned int numeroDeb, unsigned int numeroFin, vector<double>& xcor, vector<double>& ycor); 56 inline void setWorkingDir(string wd) {57 workingDir_ = wd;58 }56 /* inline void setWorkingDir(string wd) { */ 57 /* workingDir_ = wd; */ 58 /* } */ 59 59 60 60 private: … … 69 69 void clearSectionToExecute(); 70 70 71 string workingDir_;71 // string workingDir_; 72 72 PspaApplication* pspa_; 73 73 }; -
Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h
r324 r341 81 81 82 82 void donneesDessinEllipseXxp(vector<double>& xcor, vector<double>& ycor); 83 83 void donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, unsigned indexAbs, unsigned indexOrd); 84 84 85 85 virtual string FileOutputFlow() const; -
Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc
r336 r341 16 16 dataManager::dataManager(PspaApplication* pspa) : 17 17 currentBeam_(NULL) 18 ,workingDir_("")19 18 ,pspa_ ( pspa) 20 19 { 20 // workingDir_ = pspa_->getWorkingDir(); 21 21 } 22 22 … … 145 145 void dataManager::initializeExecution() 146 146 { 147 if (workingDir_ == "") { 147 string workingDir = pspa_->getWorkingDir(); 148 if (workingDir == "") { 148 149 return; 149 150 } 150 removeFile(workingDir _+ "parmdesz");151 removeFile(workingDir _+ "parmin");152 removeFile(workingDir _+ "parin.input0");153 removeFile(workingDir _+ "transport.input");154 removeFile(workingDir _+ "transport.output");155 removeFile(workingDir _+ "generator.in");156 removeFile(workingDir _+ "faisceau.ini");157 removeFile(workingDir _+ "generator.output");151 removeFile(workingDir + "parmdesz"); 152 removeFile(workingDir + "parmin"); 153 removeFile(workingDir + "parin.input0"); 154 removeFile(workingDir + "transport.input"); 155 removeFile(workingDir + "transport.output"); 156 removeFile(workingDir + "generator.in"); 157 removeFile(workingDir + "faisceau.ini"); 158 removeFile(workingDir + "generator.output"); 158 159 diagnosticBeam_.clear(); 159 160 currentBeam_ = NULL; … … 178 179 unsigned k; 179 180 abstractSoftware* softw =NULL; 180 181 string workingDir = pspa_->getWorkingDir(); 181 182 for(k = 0; k < jobList_.size(); k++) 182 183 { … … 194 195 } 195 196 196 success = softw->createInputFile(currentBeam_, debut, fin, workingDir _);197 success = softw->createInputFile(currentBeam_, debut, fin, workingDir); 197 198 if ( success ) { 198 success = softw->execute(debut,fin,workingDir _);199 success = softw->execute(debut,fin,workingDir); 199 200 if ( success ) { 200 success = softw->buildBeamAfterElements(debut, fin, diagnosticBeam_, workingDir _);201 success = softw->buildBeamAfterElements(debut, fin, diagnosticBeam_, workingDir); 201 202 } 202 203 } … … 215 216 216 217 217 void dataManager::saveConfiguration( string nameOf File)218 void dataManager::saveConfiguration( string nameOfCase) 218 219 { 219 220 ofstream outfile; 220 string name = workingDir_ + nameOfFile + ".save";221 string name = pspa_->getWorkingDir() + nameOfCase + ".save"; 221 222 outfile.open(name.c_str(), ios::out); 222 223 if (!outfile) { -
Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc
r336 r341 426 426 } 427 427 428 429 430 void particleBeam::donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, unsigned indexAbs, unsigned indexOrd) { 431 int k; 432 double x,y; 433 434 if ( !momentRepresentationOk_ ) return; 435 436 if ( indexAbs > 5 || indexOrd > 5 ) return; 437 438 xcor.clear(); 439 ycor.clear(); 440 // les index sont dans l'ordre x,y,z,xp,yp, de/E 441 // on traduit en TRANSPORT 442 if ( indexAbs == 1 ) indexAbs = 2; // y 443 if ( indexAbs == 2 ) indexAbs = 4; // z -> l 444 if ( indexAbs == 3 ) indexAbs = 1; // xp 445 if ( indexAbs == 4 ) indexAbs = 3; // yp 446 447 if ( indexOrd == 1 ) indexOrd = 2; // y 448 if ( indexOrd == 2 ) indexOrd = 4; // z -> l 449 if ( indexOrd == 3 ) indexOrd = 1; // xp 450 if ( indexOrd == 4 ) indexOrd = 3; // yp 451 452 cout << " index x" << indexAbs << " index y " << indexOrd << endl; 453 454 double xm = ( rij_.getMatrix().at(indexAbs) ).at(indexAbs); 455 double ym = ( rij_.getMatrix().at(indexOrd) ).at(indexOrd); 456 double r; 457 if ( indexOrd > indexAbs ) { 458 r = ( rij_.getMatrix().at(indexOrd) ).at(indexAbs); 459 } else { 460 r = ( rij_.getMatrix().at(indexAbs) ).at(indexOrd); 461 } 462 463 cout << " racs11= " << xm << " racs22= " << ym << " r12= " << r << endl; 464 465 466 int nbintv = 50; 467 if ( xm == 0.0 ) return; 468 double pas = 2.0 * xm / nbintv; 469 470 // cout << " r= " << r << endl; 471 double rac = (1 - r*r); 472 if ( rac > 0.0 ) 473 { 474 cout << " cas rac > " << endl; 475 rac = sqrt(1 - r*r); 476 double alpha = -r / rac; 477 double beta = xm / ( ym * rac); 478 // double gamma = ym / ( xm * rac ); 479 double epsil = xm * ym * rac; 480 double fac1 = -1.0 / ( beta * beta); 481 double fac2 = epsil/beta; 482 double fac3 = -alpha/beta; 483 double aux; 484 for ( k=0; k < nbintv; k++) 485 { 486 x = -xm + k*pas; 487 aux = fac1 * x * x + fac2; 488 // cout << " aux2= " << aux << endl; 489 if ( aux <= 0.0 ) 490 { 491 aux = 0.0; 492 } 493 else aux = sqrt(aux); 494 495 // y = fac3*x; 496 y = fac3*x + aux; 497 xcor.push_back(x); 498 ycor.push_back(y); 499 } 500 501 for ( k=0; k <= nbintv; k++) 502 { 503 x = xm - k*pas; 504 aux = fac1 * x * x + fac2; 505 if ( aux <= 0.0 ) 506 { 507 aux = 0.0; 508 } 509 else aux = sqrt(aux); 510 // y = fac3*x; 511 y = fac3*x - aux; 512 xcor.push_back(x); 513 ycor.push_back(y); 514 } 515 } 516 else 517 // cas degenere 518 { 519 cout << " cas degenere " << endl; 520 double fac = ym/xm; 521 for ( k=0; k < nbintv; k++) 522 { 523 x = -xm + k*pas; 524 y = fac*x; 525 xcor.push_back(x); 526 ycor.push_back(y); 527 } 528 529 } 530 } 531 428 532 void particleBeam::histogramme(vector<double>&xcor,vector<int>& hist,int& cnts,double out[3]) 429 533 { -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h
r340 r341 78 78 79 79 void dialogOnGraphics(); 80 void faireDessinParmela(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd ); 81 void faireDessinTransport(WContainerWidget* toto, particleBeam* beam); 80 void setModelComponentForPhaseSpace(WStandardItemModel* model, vector<bareParticle>& partic, unsigned indexParticleComponent, unsigned modelComponent); 81 void faireDessinParmela(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd, string namex, string namey ); 82 void faireDessinTransport(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd, string namex, string namey); 82 83 void faireDessinEnveloppe(WContainerWidget* toto, string type); 83 84 void scatterPlot1D(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor); 84 85 86 bool removePathFromConfigName(string& config); 85 87 bool removeExtensionFromConfigName(string& config); 86 88 … … 116 118 return abstractElementFactory_; 117 119 } 120 121 inline string getWorkingDir() const { 122 return workingDir_; 123 } 124 118 125 }; 119 126 #endif -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc
r340 r341 70 70 useStyleSheet ("htdocs/pspa.css"); 71 71 dtmanage_ = new dataManager(this); 72 dtmanage_->setWorkingDir(workingDir_);72 // dtmanage_->setWorkingDir(workingDir_); 73 73 /* 74 74 * The main layout is a 3x2 grid layout. … … 346 346 else { console_->addConsoleMessage("sauvegarde sur repertoire : " + workingDir_);} 347 347 nameOfCase_ = saveNameEdit_->text().toUTF8(); 348 cout << " PspaApplication::dialogSaveDone() nameOfCase_= " << nameOfCase_ << endl;348 cout << " PspaApplication::dialogSaveDone() sur fichier = " << nameOfCase_ << endl; 349 349 delete dialogSave_; 350 350 dialogSave_ = NULL; … … 359 359 { 360 360 GWt_serverFileSelector * fs = new GWt_serverFileSelector("Select a configuration file",workingDir_); 361 nameOfCase_ = fs->exec(); 362 361 string fileName = fs->exec(); 362 nameOfCase_ = fileName; 363 364 removePathFromConfigName(nameOfCase_ ); 365 cout << " nom sans path " << nameOfCase_ << endl; 366 removeExtensionFromConfigName(nameOfCase_); 367 cout << " nom sans extension " << nameOfCase_ << endl; 363 368 if (nameOfCase_ == "") 364 369 return; 365 370 cout << " je restaure le fichier " << fileName << endl; 366 371 dialogSave_ = NULL; 367 372 368 bool test = dtmanage_->restoreElements( nameOfCase_);373 bool test = dtmanage_->restoreElements(fileName); 369 374 if ( !test ) { 370 GWt_dialog restoreWarning(" element restoring", "failure in restoring elements !", GWt_dialog::Error, false,true);375 GWt_dialog restoreWarning(" element restoring", "failure in restoring elements from file : " + fileName , GWt_dialog::Error, false,true); 371 376 restoreWarning.exec(); 372 377 } … … 466 471 void PspaApplication::dessinerPhaseSpace() 467 472 { 468 toto_->clear();469 473 470 474 int typeFaisceau = choixTypeDessinFaisceau_->currentIndex(); … … 472 476 unsigned xabs = choixAbsPhase_->currentIndex(); 473 477 unsigned yord = choixOrdPhase_->currentIndex(); 474 478 if ( xabs == yord ) { 479 GWt_dialog phaseSpaceError(" graphical analysis", "the beam coordinates must be different !", GWt_dialog::Error, false,true); 480 phaseSpaceError.exec(); 481 return; 482 } 483 string nameAbs = choixAbsPhase_->currentText().toUTF8(); 484 string nameOrd = choixOrdPhase_->currentText().toUTF8(); 485 475 486 particleBeam* beam = dtmanage_->getDiagnosticBeam(index); 476 487 … … 481 492 } 482 493 483 494 toto_->clear(); 495 484 496 if ( typeFaisceau == 0 ) 485 497 { 486 498 if ( !beam->momentRepresentationOk() ) beam->buildMomentRepresentation(); 487 faireDessinTransport(toto_, beam );499 faireDessinTransport(toto_, beam, xabs, yord, nameAbs, nameOrd ); 488 500 } 489 501 else if ( typeFaisceau == 1 ) 490 502 { 491 if ( beam->particleRepresentationOk() ) faireDessinParmela(toto_, beam, xabs, yord );503 if ( beam->particleRepresentationOk() ) faireDessinParmela(toto_, beam, xabs, yord, nameAbs, nameOrd ); 492 504 else { 493 505 GWt_dialog warningBeamState(" graphical analysis", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true); … … 533 545 } 534 546 535 536 void PspaApplication::faireDessinParmela(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd ) 547 void PspaApplication::setModelComponentForPhaseSpace(WStandardItemModel* model, vector<bareParticle>& partic, unsigned indexParticleComponent, unsigned modelComponent) { 548 double valeur; 549 if ( indexParticleComponent > 5 ) return; 550 551 if ( indexParticleComponent <= 2 ) { 552 for (unsigned i = 0; i < partic.size(); ++i) { 553 valeur = partic.at(i).getPosition().getComponent(indexParticleComponent); 554 model->setData(i, modelComponent, valeur); 555 } 556 } else { 557 if ( indexParticleComponent == 5 ) { 558 cout << " PspaApplication::faireDessinParmela : deltap non programme " << endl; 559 return; 560 } else { 561 for (unsigned i = 0; i < partic.size(); ++i) { 562 double begamz = partic.at(i).getBetaGamma().getComponent(2); 563 if ( begamz != 0.0) { 564 valeur = 1.e3*partic.at(i).getBetaGamma().getComponent(indexParticleComponent-3)/begamz; 565 } else { 566 valeur = 0.0; 567 } 568 model->setData(i, modelComponent, valeur); 569 } 570 } 571 } 572 } 573 574 void PspaApplication::faireDessinParmela(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd, string namex, string namey ) 537 575 { 538 576 cout << " faireDessinParmela " << endl; … … 542 580 pointsDialog->setClosable(true); 543 581 // pointsDialog->show(); 544 545 546 547 vector<bareParticle>& partic = beam->getParticleVector();548 new WText(nameOfCase_ + " : espace de phase x,x' "+ " nb partic. "+ mixedTools::intToString(partic.size()), pointsDialog->contents());549 WStandardItemModel *model = new WStandardItemModel(partic.size(), 2, pointsDialog->contents());550 // model->setHeaderData(0, WString("X"));551 // model->setHeaderData(1, WString("Y = sin(X)"));552 553 if ( indexAbs > 5 || indexOrd > 5 ) return;554 555 for (unsigned i = 0; i < partic.size(); ++i) {556 double valAbs, valOrd;557 double begamz = partic.at(i).getBetaGamma().getComponent(2);558 if ( indexAbs <= 2 ) {559 valAbs = partic.at(i).getPosition().getComponent(indexAbs);560 cout << " i= " << i << " valabs = " << valAbs << endl;561 } else {562 if ( indexAbs == 5 ) {563 cout << " PspaApplication::faireDessinParmela : deltap non programme " << endl;564 return;565 } else {566 if ( begamz != 0.0) {567 valAbs = 1.e3*partic.at(i).getBetaGamma().getComponent(indexAbs-3)/begamz;568 } else {569 valAbs = 0.0;570 }571 }572 }573 574 if ( indexOrd <= 2 ) {575 valOrd = partic.at(i).getPosition().getComponent(indexOrd);576 } else {577 if ( indexOrd == 5 ) {578 cout << " PspaApplication::faireDessinParmela : deltap non programme " << endl;579 return;580 } else {581 582 583 if ( begamz != 0.0) {584 valOrd = 1.e3*partic.at(i).getBetaGamma().getComponent(indexOrd-3)/begamz;585 } else {586 valOrd = 0.0;587 }588 cout << " i= " << i << " valord = " << valOrd << endl;589 }590 }591 582 592 593 // double x= partic.at(i).getPosition().getComponent(0); 594 // double begamz = partic.at(i).getBetaGamma().getComponent(2); 595 // double xp; 596 // if ( begamz != 0.0) { 597 // xp = partic.at(i).getBetaGamma().getComponent(0)/begamz; 598 // } else { 599 // xp = 0.0; 600 // } 601 // // cout << "x = " << x << " xp= " << xp << endl; 602 // model->setData(i, 0, x); 603 // model->setData(i, 1,1.e3*xp); 604 // model->setData(i, 2,2.e3*xp); 605 model->setData(i, 0, valAbs); 606 model->setData(i, 1, valOrd); 607 } 608 cout << " faireDessinParmela : FAISCEAU VU " << endl; 609 610 WCartesianChart *chart = new WCartesianChart(pointsDialog->contents()); 611 chart->setModel(model); // set the model 612 chart->setXSeriesColumn(0); // set the column that holds the X data 613 chart->setLegendEnabled(true); // enable the legend 614 615 chart->setType(ScatterPlot); // set type to ScatterPlot 616 617 // Typically, for mathematical functions, you want the axes to cross 618 // at the 0 mark: 619 chart->axis(XAxis).setLocation(ZeroValue); 620 chart->axis(YAxis).setLocation(ZeroValue); 621 622 // Provide space for the X and Y axis and title. 623 chart->setPlotAreaPadding(80, Left); 624 chart->setPlotAreaPadding(40, Top | Bottom); 625 // Add the curves 626 WDataSeries s(1, PointSeries, Y1Axis); 627 // s.setShadow(WShadow(3, 3, WColor(0, 0, 0, 127), 3)); 628 // s.setMarker(SquareMarker); 629 // s.setMarkerSize(600.); 630 // cout << "le marker est : " << s.marker() << endl; 631 chart->addSeries(s); 632 633 chart->resize(400, 400); // WPaintedWidget must be given explicit size 583 vector<bareParticle>& partic = beam->getParticleVector(); 584 new WText(nameOfCase_ + " : phase space " + namex + " ," + namey + " ; particle number : "+ mixedTools::intToString(partic.size()), pointsDialog->contents()); 585 586 WStandardItemModel *model = new WStandardItemModel(partic.size(), 2, pointsDialog->contents()); 587 588 589 setModelComponentForPhaseSpace(model, partic, indexAbs, 0); 590 setModelComponentForPhaseSpace(model, partic, indexOrd, 1); 591 592 cout << " faireDessinParmela : FAISCEAU VU " << endl; 593 594 WCartesianChart *chart = new WCartesianChart(pointsDialog->contents()); 595 chart->setModel(model); // set the model 596 chart->setXSeriesColumn(0); // set the column that holds the X data 597 chart->setLegendEnabled(true); // enable the legend 598 599 chart->setType(ScatterPlot); // set type to ScatterPlot 600 601 // Typically, for mathematical functions, you want the axes to cross 602 // at the 0 mark: 603 chart->axis(XAxis).setLocation(ZeroValue); 604 chart->axis(YAxis).setLocation(ZeroValue); 605 606 // Provide space for the X and Y axis and title. 607 chart->setPlotAreaPadding(80, Left); 608 chart->setPlotAreaPadding(40, Top | Bottom); 609 // Add the curves 610 WDataSeries s(1, PointSeries, Y1Axis); 611 // s.setShadow(WShadow(3, 3, WColor(0, 0, 0, 127), 3)); 612 // s.setMarker(SquareMarker); 613 // s.setMarkerSize(600.); 614 // cout << "le marker est : " << s.marker() << endl; 615 chart->addSeries(s); 616 617 chart->resize(400, 400); // WPaintedWidget must be given explicit size 634 618 635 619 636 620 #ifdef HAS_IMAGEMAGIC 637 638 639 640 641 642 643 644 621 Wt::WRasterImage pngImage("png", 600, 600); 622 Wt::WPainter p(&pngImage); 623 chart->paint(p); 624 std::string name; 625 name = workingDir_ + "/chart-"+sessionId ()+".png"; 626 std::ofstream f(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary); 627 pngImage.write(f); 628 new WText("<a href='workingArea/chart-"+sessionId ()+".png' target='_blank'>Afficher l'image</a>",toto); 645 629 #endif 646 630 647 648 649 650 651 } 652 653 void PspaApplication::faireDessinTransport(WContainerWidget* toto, particleBeam* beam )631 pointsDialog->show(); 632 633 // chart->setMargin(10, Top | Bottom); // add margin vertically 634 // chart->setMargin(WLength::Auto, Left | Right); // center horizontally 635 } 636 637 void PspaApplication::faireDessinTransport(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd, string namex, string namey) 654 638 { 655 639 GWt_dialog* ellipseDialog = new GWt_dialog("ellipse",toto,false); … … 659 643 ellipseDialog->show(); 660 644 661 new WText(nameOfCase_ + " : emittance x,x'" + mixedTools::doubleToString(beam->getUnnormalizedEmittanceX()) + " pi.mm.mrad" , ellipseDialog->contents());645 new WText(nameOfCase_ + " : emittance " + namex + " , " + namey + " : " + mixedTools::doubleToString(beam->getUnnormalizedEmittanceX()) + " pi.mm.mrad" , ellipseDialog->contents()); 662 646 new WBreak(ellipseDialog->contents()); 663 647 new WText(" xmax = " + mixedTools::doubleToString(beam->getSigmaTransportij(1,1)) + " cm ", ellipseDialog->contents()); … … 669 653 vector<double> xcor; 670 654 vector<double> ycor; 671 // dtmanage_->getCurrentBeam()->donneesDessinEllipseXxp(xcor,ycor);672 beam->donneesDessinEllipseXxp(xcor,ycor);655 beam->donneesDessinEllipse(xcor,ycor,indexAbs, indexOrd); 656 // beam->donneesDessinEllipseXxp(xcor,ycor); 673 657 scatterPlot1D(ellipseDialog->contents(),xcor,ycor); 674 658 } 675 659 676 // void PspaApplication::scatterPlot1D(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor)677 // {678 // int nbpts = xcor.size();679 // cout << " PspaApplication::scatterPlot1D nbpts = " << nbpts << endl;680 // WStandardItemModel *model = new WStandardItemModel(nbpts, 2, toto);681 // for (int i = 0; i < nbpts; ++i) {682 // model->setData(i, 0, xcor.at(i));683 // model->setData(i, 1, ycor.at(i));684 // // cout << " PspaApplication::scatterPlot1D el= " << i+1 << " x= " << xcor.at(i) << " y= " << ycor.at(i) << endl;685 // }686 687 // WCartesianChart *chart = new WCartesianChart(toto);688 689 // chart->initLayout();690 691 // chart->setModel(model); // set the model692 // chart->setXSeriesColumn(0); // set the column that holds the X data693 // chart->setLegendEnabled(true); // enable the legend694 695 // chart->setType(ScatterPlot); // set type to ScatterPlot696 697 // // Typically, for mathematical functions, you want the axes to cross698 // // at the 0 mark:699 // chart->axis(XAxis).setLocation(ZeroValue);700 // chart->axis(YAxis).setLocation(ZeroValue);701 702 // // Provide space for the X and Y axis and title.703 // // chart->setPlotAreaPadding(80, Left);704 // // chart->setPlotAreaPadding(40, Top | Bottom);705 // // Add the curves706 // WDataSeries s(1, CurveSeries, Y1Axis);707 // chart->addSeries(s);708 709 // // chart->setBackground (WBrush(WColor("blue")));710 // chart->resize(300, 300); // WPaintedWidget must be given explicit size711 712 // #ifdef HAS_IMAGEMAGIC713 // Wt::WRasterImage pngImage("png", 600, 600);714 // Wt::WPainter p(&pngImage);715 716 // chart->paint(p);717 // std::string name;718 // name = workingDir_ + "/chart-"+sessionId ()+".png";719 // std::ofstream f(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary);720 // pngImage.write(f);721 722 // new WText("<a href='workingArea/chart-"+sessionId ()+".png' target='_blank'>Afficher l'image</a>",toto);723 724 // /*725 // Wt::WPdfImage pdfImage("30cm", "30cm");726 // Wt::WPainter p1(&pdfImage);727 // chart->paint(p1);728 // std::ofstream f1("chart.pdf", std::ios::out | std::ios::binary);729 // pdfImage.write(f1);730 // */731 // #endif732 // }733 660 734 661 … … 818 745 819 746 // } 747 748 bool PspaApplication::removePathFromConfigName(string& config) { 749 string toExtract = workingDir_ + "/"; 750 string::size_type nn = config.find(toExtract); 751 if ( nn == string::npos ) { 752 GWt_dialog checkremovePath(" checking config file name", " failed to recognize path name for file " + config, GWt_dialog::Error,true,true); 753 checkremovePath.exec(); 754 return false; 755 } 756 config.replace(nn, toExtract.size(), ""); 757 return true; 758 } 820 759 821 760 bool PspaApplication::removeExtensionFromConfigName(string& config)
Note: See TracChangeset
for help on using the changeset viewer.