Changeset 580
- Timestamp:
- Sep 20, 2007, 5:24:46 PM (17 years ago)
- Location:
- trunk/geant4/visualization
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/geant4/visualization/G4History.macro
r579 r580 59 59 /gui/addButton viewer "Update scene" "/vis/scene/notifyHandlers" 60 60 /N03/event/printModulo 100 61 /run/beamOn 162 /control/execute visTutor/exN03Vis14.mac63 /vis/open OGLSQT64 /vis/sceneHandler/create OGLSQT65 /vis/sceneHandler/attach66 /vis/viewer/create ! ! 60067 /vis/viewer/refresh68 /vis/viewer/reset69 /vis/viewer/refresh70 /vis/viewer/set/viewpointThetaPhi 20 7071 /vis/viewer/refresh72 /vis/viewer/zoom 0.873 /vis/viewer/refresh74 /vis/drawVolume75 /vis/scene/create76 /vis/scene/add/volume world77 /vis/scene/notifyHandlers78 /vis/sceneHandler/attach79 /vis/viewer/flush80 /vis/viewer/refresh viewer-281 /vis/viewer/update viewer-282 /vis/open DAWNFILE83 /vis/sceneHandler/create DAWNFILE84 /vis/sceneHandler/attach85 /vis/viewer/create ! ! 60086 /vis/viewer/reset87 /vis/viewer/zoom 1.188 /vis/viewer/set/viewpointThetaPhi 35 3589 /vis/drawVolume Absorber90 /vis/scene/create91 /vis/scene/add/volume Absorber92 /vis/sceneHandler/attach93 /vis/scene/add/axes 0 0 0 500 mm94 /vis/scene/notifyHandlers95 /vis/scene/add/text 0 0 0 mm 40 -100 -140 Absorber96 /vis/scene/notifyHandlers97 /vis/scene/add/scale 10 cm z 1 0 0 manual -2.5 -5 0 cm98 /vis/scene/notifyHandlers99 /vis/scene/notifyHandlers100 /vis/viewer/update101 /vis/viewer/reset102 /vis/viewer/zoom 1.1103 /vis/viewer/set/viewpointThetaPhi 35 35104 /vis/drawVolume Gap105 /vis/scene/create106 /vis/scene/add/volume Gap107 /vis/sceneHandler/attach108 /vis/scene/add/axes 0 0 0 500 mm109 /vis/scene/notifyHandlers110 /vis/scene/add/text 0 0 0 mm 50 -100 -140 Gap111 /vis/scene/notifyHandlers112 /vis/scene/add/scale 10 cm z 1 0 0 manual -2.5 -5 0 cm113 /vis/scene/notifyHandlers114 /vis/scene/notifyHandlers115 /vis/viewer/update116 /vis/viewer/reset117 /vis/viewer/zoom 1.1118 /vis/viewer/set/viewpointThetaPhi 35 35119 /vis/viewer/set/culling global false120 /vis/drawVolume121 /vis/scene/create122 /vis/scene/add/volume world123 /vis/scene/notifyHandlers124 /vis/sceneHandler/attach125 /vis/scene/add/axes 0 0 0 500 mm126 /vis/scene/notifyHandlers127 /vis/scene/add/text 0 0 0 mm 50 -100 -240 World128 /vis/scene/notifyHandlers129 /vis/scene/add/scale 10 cm x 1 0 0130 /vis/scene/notifyHandlers131 /vis/scene/notifyHandlers132 /vis/viewer/update133 /vis/viewer/set/culling global true134 /run/beamOn 1 -
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc
r579 r580 45 45 #include "G4Normal3D.hh" 46 46 #include "G4Scene.hh" 47 #include "G4OpenGLQtExportDialog.h" 47 48 48 49 #include "G4Qt.hh" … … 52 53 #include <QtGui/qdialog.h> 53 54 #include <QtGui/qmenu.h> 55 #include <QImageWriter> 56 #include <QMessageBox> 54 57 #include <QFileDialog.h> 55 58 … … 653 656 654 657 void G4OpenGLQtViewer::actionCreateEPS() { 655 //QString QFileDialog::getSaveFileName ( QWidget * parent = 0, 656 // const QString & caption = QString(), 657 // const QString & dir = QString(), 658 // const QString & filter = QString(), 659 // QString * selectedFilter = 0, Options options = 0 ) 660 QString nomFich = QFileDialog::getSaveFileName(GLWindow, 661 "Choose a file", 662 ".", tr("Images (*.BMP *.GIF *.JPG *.JPEG *.PNG *.PBM *.PGM *.PPM *.TIFF *.XBM *.XPM)") ); 663 664 if(!nomFich.endsWith(".eps")) { 665 printf("G4OpenGLQtViewer::actionCreateEPS() COULD NOT GENERATE EPS FOR THE MOMENT\n"); 666 } else { 658 QString filters; 659 QList<QByteArray> formats = QImageWriter::supportedImageFormats (); 660 for (int i = 0; i < formats.size(); ++i) { 661 filters +="."+formats.at(i); 662 if ((i+1) <formats.size()) { 663 filters += ";;"; 664 } 665 } 666 667 QString nomFich = QFileDialog::getSaveFileName ( GLWindow, 668 tr("Save as ..."), 669 ".", 670 filters ); 671 // bmp jpg jpeg png ppm xbm xpm 672 if(nomFich.endsWith(".eps")) { 673 G4cerr << "This version of G4UI Could not generate EPS." << G4endl; 674 } else if(nomFich.endsWith(".jpg") || nomFich.endsWith(".jpeg")) { 675 G4cerr << "Should display a quality selector" << G4endl; 676 G4OpenGLQtExportDialog* exportDialog= new G4OpenGLQtExportDialog(false, this,"exportDialog",TRUE,WStyle_Tool|WDestructiveClose); 667 677 fWindow->grabFrameBuffer().save(nomFich); 668 } 678 } else { 679 fWindow->grabFrameBuffer().save(nomFich); 680 // grabFrameBuffer() :: Returns an image of the frame buffer. If withAlpha is true the alpha channel is included. 681 } 682 669 683 printf("G4OpenGLQtViewer::actionCreateEPS() \n"); 670 684 } 685 686 /* 687 // http://www.google.com/codesearch?hl=en&q=+jpg+Qt+quality+QDialog+show:FZkUoth8oiw:TONpW2mR-_c:tyTfrKMO-xI&sa=N&cd=2&ct=rc&cs_p=http://soft.proindependent.com/src/qtiplot-0.8.9.zip&cs_f=qtiplot-0.8.9/qtiplot/src/application.cpp#a0 688 void ApplicationWindow::exportLayer() 689 { 690 QWidget *w=ws->activeWindow(); 691 if (!w || !w->isA("MultiLayer")) 692 return; 693 694 Graph* g = ((MultiLayer*)w)->activeGraph(); 695 if (!g) 696 return; 697 698 ImageExportDialog *ied = new ImageExportDialog(this, 0); 699 ied->setDir(workingDir); 700 if ( ied->exec() == QDialog::Accepted ) 701 { 702 workingDir = ied->dirPath(); 703 QString fname = ied->selectedFile(); 704 QString selectedFilter = ied->selectedFilter(); 705 706 QFileInfo fi(fname); 707 QString baseName = fi.fileName(); 708 709 if (baseName.contains(".")==0) 710 fname.append(selectedFilter.remove("*")); 711 712 if ( QFile::exists(fname) && 713 QMessageBox::question(0, tr("QtiPlot - Overwrite File?"), 714 tr("A file called: <p><b>%1</b><p>already exists. " 715 "Do you want to overwrite it?") 716 .arg(fname), 717 tr("&Yes"), tr("&No"), 718 QString::null, 0, 1 ) ) 719 return ; 720 else 721 { 722 QFile f(fname); 723 if ( !f.open( IO_WriteOnly ) ) 724 { 725 QMessageBox::critical(0, tr("QtiPlot - Export Error"), 726 tr("Could not write to file: <br><h4> %1 </h4><p>Please verify that you have the right to write to this location!").arg(fname)); 727 return; 728 } 729 730 if (selectedFilter.contains(".eps")) 731 { 732 if (ied->showExportOptions()) 733 { 734 epsExportDialog *ed= new epsExportDialog (fname, this, "exportDialog", TRUE, WStyle_Tool|WDestructiveClose); 735 connect (ed, SIGNAL(exportToEPS(const QString&, int, QPrinter::Orientation, QPrinter::PageSize, QPrinter::ColorMode)), 736 g, SLOT(exportToEPS(const QString&, int, QPrinter::Orientation, QPrinter::PageSize, QPrinter::ColorMode))); 737 738 ed->showNormal(); 739 ed->setActiveWindow(); 740 } 741 else 742 g->exportToEPS(fname); 743 744 if (((MultiLayer*)w)->hasOverlapingLayers()) 745 ((MultiLayer*)w)->updateTransparency(); 746 return; 747 } 748 else if (selectedFilter.contains(".svg")) 749 { 750 g->exportToSVG(fname); 751 return; 752 } 753 // else if (selectedFilter.contains(".wmf")) 754 // { 755 // g->exportToWmf(fname); 756 // return; 757 } 758 QStringList list=QImage::outputFormatList (); 759 for (int i=0; i<(int)list.count(); i++) 760 { 761 if (selectedFilter.contains("."+(list[i]).lower())) 762 { 763 if (ied->showExportOptions()) 764 { 765 imageExportDialog* ed= new imageExportDialog(false, this,"exportDialog",TRUE,WStyle_Tool|WDestructiveClose); 766 connect (ed, SIGNAL(options(const QString&, const QString&, int, bool)), 767 g, SLOT(exportImage(const QString&, const QString&, int, bool))); 768 769 ed->setExportPath(fname, list[i]); 770 ed->enableTransparency(); 771 ed->showNormal(); 772 ed->setActiveWindow(); 773 } 774 else 775 g->exportImage(fname, list[i], 100, true); 776 777 if (((MultiLayer*)w)->hasOverlapingLayers()) 778 ((MultiLayer*)w)->updateTransparency(); 779 return; 780 } 781 } 782 } 783 } 784 } 785 786 void Graph::exportToSVG(const QString& fname) 787 { 788 // enable workaround for Qt3 misalignments 789 QwtPainter::setSVGMode(true); 790 QPicture picture; 791 QPainter p(&picture); 792 d_plot->print(&p, d_plot->rect()); 793 p.end(); 794 795 picture.save(fname, "svg"); 796 } 797 */ 798 671 799 672 800 -
trunk/geant4/visualization/currentEvent.rndm
r579 r580 2 2 1878463799 3 3 0 4 1180857998 5 122938492 4 9876 5 54321
Note: See TracChangeset
for help on using the changeset viewer.