Changeset 585 for trunk/geant4/visualization/OpenGL
- Timestamp:
- Sep 26, 2007, 12:17:26 PM (17 years ago)
- Location:
- trunk/geant4/visualization/OpenGL
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/geant4/visualization/OpenGL/include/G4OpenGLQtExportDialog.hh
r584 r585 56 56 57 57 int getSliderValue(); 58 int getWidth(); 59 int getHeight(); 58 60 59 61 public slots: -
trunk/geant4/visualization/OpenGL/include/G4OpenGLQtViewer.hh
r579 r585 78 78 void createPopupMenu(); 79 79 void createRadioAction(QAction *,QAction *, const std::string&,unsigned int a=1); 80 void rescaleImage(int, int); 80 81 81 82 QMenu *fContextMenu; -
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtExportDialog.cc
r584 r585 57 57 originalWidth = aWidth; 58 58 originalHeight = aHeight; 59 printf("height %d width %d\n",aHeight,aWidth);60 59 61 60 // global layout … … 63 62 64 63 65 if(nomFich.endsWith(".jpg")) { 64 if (nomFich.endsWith(".jpg") || 65 nomFich.endsWith(".jepg")) { 66 66 67 67 QGroupBox *imageGroupBox = new QGroupBox(tr("Image quality")); … … 101 101 BW->setChecked( false ); 102 102 103 connect( color, SIGNAL( clicked() ), BW, SLOT( toggle() ) );104 connect( BW, SIGNAL( clicked() ), color, SLOT( toggle() ) );103 connect( color, SIGNAL( toggled(bool) ), BW, SLOT( setChecked(bool) ) ); 104 connect( BW, SIGNAL( toggled(bool) ), color, SLOT( setChecked(bool) ) ); 105 105 106 106 … … 157 157 ratioCheckBox->setVisible(modify->isChecked()); 158 158 159 connect( original, SIGNAL( clicked() ), modify, SLOT( toogle() ) );160 connect( modify, SIGNAL( clicked() ), original, SLOT( toogle() ) );159 connect( original, SIGNAL( toggled(bool) ), modify, SLOT( setChecked(bool) ) ); 160 connect( modify, SIGNAL( toggled(bool) ), original, SLOT( setChecked(bool) ) ); 161 161 connect( modify, SIGNAL( toggled(bool) ), this, SLOT( changeSizeBox(bool) ) ); 162 162 … … 179 179 widthWidget = new QWidget; 180 180 181 widthLineLayout->addWidget(new QLabel("Width "));181 widthLineLayout->addWidget(new QLabel("Width ")); 182 182 width = new QLineEdit(tmp.setNum(originalWidth)); 183 183 width->setMaxLength(5); … … 225 225 } 226 226 227 int G4OpenGLQtExportDialog::getHeight() 228 { 229 return height->text().toInt(); 230 } 231 232 int G4OpenGLQtExportDialog::getWidth() 233 { 234 return width->text().toInt(); 235 } 236 237 227 238 void G4OpenGLQtExportDialog::changeSizeBox(bool aChange) 228 239 { … … 236 247 ) 237 248 { 238 printf("new Width : %s\n",s.toStdString().c_str());239 249 if (ratioCheckBox->isChecked()){ 240 250 QString tmp; … … 247 257 ) 248 258 { 249 printf("new Height : %s\n",s.toStdString().c_str());250 259 if (ratioCheckBox->isChecked()){ 251 260 QString tmp; -
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc
r583 r585 116 116 ////////////////////////////////////////////////////////////////////////////// 117 117 void G4OpenGLQtViewer::CreateMainWindow ( 118 119 118 QGLWidget* glWidget 119 ) 120 120 ////////////////////////////////////////////////////////////////////////////// 121 121 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// … … 676 676 nomFich += "."+selectedFilter->toLower(); 677 677 printf("G4OpenGLQtViewer::name %s\n",nomFich.toStdString().c_str()); 678 if(nomFich.endsWith(".eps")) { 679 G4cerr << "This version of G4UI Could not generate EPS." << G4endl; 680 } else if(nomFich.endsWith(".jpg") || nomFich.endsWith(".jpeg")) { 681 G4OpenGLQtExportDialog* exportDialog= new G4OpenGLQtExportDialog(GLWindow,nomFich,fWindow->height(),fWindow->width()); 682 int res = exportDialog->exec(); 683 printf("G4OpenGLQtViewer::actionCreateEPS() --%d-- quality:\n",res); 684 fWindow->grabFrameBuffer().save(nomFich); 685 } else { 686 fWindow->grabFrameBuffer().save(nomFich); 687 // grabFrameBuffer() :: Returns an image of the frame buffer. If withAlpha is true the alpha channel is included. 678 G4OpenGLQtExportDialog* exportDialog= new G4OpenGLQtExportDialog(GLWindow,nomFich,fWindow->height(),fWindow->width()); 679 if( exportDialog->exec()) { 680 681 printf("rescaling before\n"); 682 QPixmap * pixmap = new QPixmap(fWindow->renderPixmap (exportDialog->getWidth(),exportDialog->getHeight() )) ;//fWindow->grabFrameBuffer(); 683 printf("rescaling after\n"); 684 685 if ((exportDialog->getWidth() !=fWindow->width()) || 686 (exportDialog->getWidth() !=fWindow->width())) { 687 688 // rescaleImage(exportDialog->getWidth(),exportDialog->getHeight());// re-scale image 689 printf("rescaling\n"); 690 } 691 692 // jpeg format 693 if (nomFich.endsWith(".jpg") || 694 nomFich.endsWith(".jpeg")) { 695 // grabFrameBuffer() :: Returns an image of the frame buffer. If withAlpha is true the alpha channel is included. 696 pixmap->save(nomFich,0,exportDialog->getSliderValue()); 697 printf("saving jpeg quality : %d\n",exportDialog->getSliderValue()); 698 } else if (nomFich.endsWith(".eps")) { 699 printf("saving EPS\n"); 700 } else if (nomFich.endsWith(".tif") || 701 nomFich.endsWith(".tiff") || 702 nomFich.endsWith(".jpg") || 703 nomFich.endsWith(".png") || 704 nomFich.endsWith(".bmp") || 705 nomFich.endsWith(".xpm")) { 706 pixmap->save(nomFich,0,exportDialog->getSliderValue()); 707 printf("saving ELSE\n"); 708 } else { 709 G4cerr << "This version of G4UI Could not generate the selected format" << G4endl; 710 } 711 712 } else { // cancel selected 713 return; 688 714 } 689 715 … … 910 936 } 911 937 912 938 void G4OpenGLQtViewer::rescaleImage( 939 int aWidth 940 ,int aHeight 941 ){ 942 printf(""); 943 } 913 944 #endif
Note: See TracChangeset
for help on using the changeset viewer.