Ignore:
Timestamp:
Dec 4, 2007, 6:46:23 PM (17 years ago)
Author:
garnier
Message:

modif pour les formats d export

Location:
trunk/geant4/visualization/OpenGL/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLQtExportDialog.cc

    r633 r635  
    8080    QGroupBox *imageGroupBox = new QGroupBox(tr("Image quality"),this);
    8181    QVBoxLayout *imageGroupBoxLayout = new QVBoxLayout(imageGroupBox);
    82     QWidget *sliderBox = new QWidget;
    83 
    84     QHBoxLayout *hSlider = new QHBoxLayout(sliderBox);
     82    QWidget *sliderBox = new QWidget();
     83
     84    QHBoxLayout *hSliderLayout = new QHBoxLayout(sliderBox);
    8585
    8686    //    qualityLabel =  new QLabel( tr( "Image quality" ) );
    8787    //    imageGroupBoxLayout->addWidget(qualityLabel);
    88     qualitySlider= new QSlider(Qt::Horizontal,this);
     88    qualitySlider= new QSlider(Qt::Horizontal,sliderBox);
    8989#if QT_VERSION < 0x040000
    9090    qualitySlider->setMinValue(0);
     
    9797#endif
    9898    qualitySlider->setValue(60);
    99     hSlider->addWidget(new QLabel("low",this));
    100     hSlider->addWidget(qualitySlider);
    101     hSlider->addWidget(new QLabel("Maximum",this));
    102 #if QT_VERSION >= 0x040000
    103     sliderBox->setLayout(hSlider);
     99    hSliderLayout->addWidget(new QLabel("low",sliderBox));
     100    hSliderLayout->addWidget(qualitySlider);
     101    hSliderLayout->addWidget(new QLabel("Maximum",sliderBox));
     102#if QT_VERSION >= 0x040000
     103    sliderBox->setLayout(hSliderLayout);
    104104#endif
    105105    imageGroupBoxLayout->addWidget(sliderBox);
     
    117117    //    transparencyEPS->setChecked( true );
    118118
    119     colorButton = new QRadioButton("Color",this);
    120     BWButton = new QRadioButton("Grayscale",this);
    121 
    122119    QWidget * EPSWidgetGroupBox; // widget containing group button
    123120    QButtonGroup * EPSButtonGroupBox; // group button
    124 #if QT_VERSION < 0x040000
     121
     122
     123#if QT_VERSION < 0x040000
     124    colorButton = new QRadioButton("Color",EPSWidgetGroupBox);
     125    BWButton = new QRadioButton("Grayscale",EPSWidgetGroupBox);
    125126    EPSButtonGroupBox = new QButtonGroup( 2,Qt::Vertical, tr("EPS options"),this);
    126127    EPSButtonGroupBox->insert(colorButton);
    127128    EPSButtonGroupBox->insert(BWButton);
    128129    EPSButtonGroupBox->setExclusive(true);
    129     colorButton->setChecked( true );
    130130    EPSWidgetGroupBox = EPSButtonGroupBox;
    131131
     
    133133    EPSWidgetGroupBox = new QGroupBox(tr("EPS options"));
    134134    QVBoxLayout *EPSGroupBoxLayout = new QVBoxLayout(EPSWidgetGroupBox);
     135
     136    colorButton = new QRadioButton("Color",EPSWidgetGroupBox);
     137    BWButton = new QRadioButton("Grayscale",EPSWidgetGroupBox);
     138
    135139    EPSButtonGroupBox = new QButtonGroup();
    136     colorButton->setChecked( true );
    137140    EPSButtonGroupBox->addButton(colorButton);
    138141    EPSButtonGroupBox->addButton(BWButton);
     
    144147
    145148#endif
     149    colorButton->setChecked( true );
    146150
    147151    //    EPSGroupBoxLayout->addWidget(transparencyEPS);   
     
    159163    QVBoxLayout *transparencyGroupBoxLayout = new QVBoxLayout(transparencyGroupBox);
    160164
    161     boxTransparency = new QCheckBox("Save transparency",this);
     165    boxTransparency = new QCheckBox("Save transparency",transparencyGroupBox);
    162166    boxTransparency->setChecked( false );
    163167    //    boxTransparency->setEnabled(false);
     
    172176
    173177  // size box
    174   QWidget* modifyAndRatioWidget = new QWidget;
     178  QWidget* modifyAndRatioWidget = new QWidget();
    175179
    176180  QHBoxLayout *modifyAndRatioLayout = new QHBoxLayout(modifyAndRatioWidget);
    177 
    178   // original button
    179   original = new QRadioButton("Original",this);
    180   // modify and ratio
    181   modify = new QRadioButton("Modify",this);
    182181
    183182  QWidget * sizeWidgetGroupBox; // widget containing group button
     
    193192  sizeButtonGroupBox->insert(modify);
    194193  sizeButtonGroupBox->setExclusive(true);
    195   original->setChecked( true );
    196194  sizeWidgetGroupBox = sizeButtonGroupBox;
    197195  sizeGroupBoxLayout = sizeWidgetGroupBox->layout();
     
    202200  sizeGroupBoxLayout = new QVBoxLayout(sizeWidgetGroupBox);
    203201  sizeButtonGroupBox = new QButtonGroup();
    204   original->setChecked( true );
    205202
    206203  original = new QRadioButton("Original");
     
    216213  sizeWidgetGroupBox->setLayout(sizeGroupBoxLayout);
    217214#endif
     215  original->setChecked( true );
    218216
    219217
     
    244242
    245243  // height
    246   heightWidget = new QWidget;
     244  heightWidget = new QWidget();
    247245
    248246  QHBoxLayout *heightLineLayout = new QHBoxLayout(heightWidget);
     
    250248  QString tmp;
    251249 
    252   heightLineLayout->addWidget(new QLabel("Height",this));
    253   height = new QLineEdit(tmp.setNum(originalHeight),this);
     250  heightLineLayout->addWidget(new QLabel("Height",heightWidget));
     251  height = new QLineEdit(tmp.setNum(originalHeight),heightWidget);
    254252  height->setMaxLength(5);
    255253#if QT_VERSION < 0x040000
     
    270268
    271269  // width
    272   widthWidget = new QWidget;
     270  widthWidget = new QWidget();
    273271
    274272  QHBoxLayout *widthLineLayout = new QHBoxLayout(widthWidget);
     
    279277  widthLineLayout->addWidget(new QLabel("Width ",widthWidget));
    280278#endif
    281   width = new QLineEdit(tmp.setNum(originalWidth),this);
     279  width = new QLineEdit(tmp.setNum(originalWidth),widthWidget);
    282280  width->setMaxLength(5);
    283281#if QT_VERSION < 0x040000
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc

    r633 r635  
    3636#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
    3737
    38 //#define GEANT4_QT_DEBUG
     38#define GEANT4_QT_DEBUG
    3939
    4040#include "G4OpenGLQtViewer.hh"
     
    10961096
    10971097    QImage image;
    1098     //    if ((exportDialog->getWidth() !=fWindow->width()) ||
    1099     //        (exportDialog->getHeight() !=fWindow->height())) {
     1098    if ((exportDialog->getWidth() !=fWindow->width()) ||
     1099        (exportDialog->getHeight() !=fWindow->height())) {
     1100      G4cerr << "Export->Change Size : This function is not implemented, to export in another size, please resize your frame to what you need" << G4endl;
    11001101     
    1101       //      rescaleImage(exportDialog->getWidth(),exportDialog->getHeight());// re-scale image
    1102 #ifdef GEANT4_QT_DEBUG
    1103       printf("rescaling\n");
    1104 #endif
    1105       QGLWidget* glResized = fWindow;
    1106       fWindow->renderPixmap (exportDialog->getWidth()*2,exportDialog->getHeight()*2 ).save("/Users/laurentgarnier/Desktop/zzz.jpg","jpg");
    1107       QPixmap * pixmap = new QPixmap(fWindow->renderPixmap (exportDialog->getWidth(),exportDialog->getHeight() )) ;
    1108       //      image = pixmap.toImage();
     1102      //    rescaleImage(exportDialog->getWidth(),exportDialog->getHeight());// re-scale image
     1103      //      QGLWidget* glResized = fWindow;
     1104
     1105      // FIXME :
     1106      // L.Garnier : I've try to implement change size function, but the problem is
     1107      // the renderPixmap function call the QGLWidget to resize and it doesn't draw
     1108      // the content of this widget... It only draw the background.
     1109
     1110      //      fWindow->renderPixmap (exportDialog->getWidth()*2,exportDialog->getHeight()*2,true );
     1111
     1112      //      QPixmap pixmap = fWindow->renderPixmap ();
     1113     
     1114      //      image = pixmap->toImage();
    11091115      //      glResized->resize(exportDialog->getWidth()*2,exportDialog->getHeight()*2);
    1110 #ifdef GEANT4_QT_DEBUG
    1111       printf("rescaling after\n");
    1112 #endif
    11131116      //      image = glResized->grabFrameBuffer();
    11141117     
    1115       //    } else {
    1116       // image = fWindow->grabFrameBuffer();
    1117       //  }   
     1118    } else {
     1119      image = fWindow->grabFrameBuffer();
     1120    }   
    11181121    // jpeg format
    11191122    if (nomFich.endsWith(".jpg") ||
     
    11341137               nomFich.endsWith(".bmp") ||
    11351138               nomFich.endsWith(".xpm")) {
    1136       image.save(nomFich,0,exportDialog->getSliderValue());
    1137 #ifdef GEANT4_QT_DEBUG
    1138       printf("saving ELSE\n");
     1139      bool res = image.save(nomFich,0,exportDialog->getSliderValue());
     1140      if (res == false) {
     1141        G4cerr << "Error while saving file..." << G4endl;
     1142      }
     1143#ifdef GEANT4_QT_DEBUG
     1144      printf("saving ELSE %d\n",res);
    11391145#endif
    11401146    } else {
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredQtViewer.cc

    r632 r635  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredQtViewer.cc,v 1.7 2007/11/30 14:47:30 lgarnier Exp $
     27// $Id: G4OpenGLStoredQtViewer.cc,v 1.6 2007/11/15 18:24:28 lgarnier Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    3434#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
    3535
    36 //#define GEANT4_QT_DEBUG
     36#define GEANT4_QT_DEBUG
    3737
    3838#include "G4OpenGLStoredQtViewer.hh"
     39#include "G4VisManager.hh"
    3940
    4041#include "G4ios.hh"
     
    304305void G4OpenGLStoredQtViewer::mouseMoveEvent(QMouseEvent *event)
    305306{
    306 #ifdef GEANT4_QT_DEBUG
    307   printf("G4OpenGLStoredQtViewer::mouseMoveEvent\n");
    308 #endif
    309307#if QT_VERSION < 0x040000
    310308  G4MouseMoveEvent(event->x(),event->y(),event->state());
     
    318316void G4OpenGLStoredQtViewer::contextMenuEvent(QContextMenuEvent *e)
    319317{
     318#ifdef GEANT4_QT_DEBUG
     319  printf("G4OpenGLStoredQtViewer::contextMenuEvent\n");
     320#endif
    320321  manageContextMenuEvent(e);
    321322}
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredViewer.cc

    r631 r635  
    126126void G4OpenGLStoredViewer::DrawDisplayLists () {
    127127
     128  printf("***************************  CASE AA ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
    128129  const G4Planes& cutaways = fVP.GetCutawayPlanes();
    129130  G4bool cutawayUnion = fVP.IsCutaway() &&
     
    131132  size_t nPasses = cutawayUnion? cutaways.size(): 1;
    132133  for (size_t i = 0; i < nPasses; ++i) {
     134    printf("***************************  CASE A ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
    133135
    134136    if (cutawayUnion) {
     
    142144    }
    143145
    144     if (fG4OpenGLStoredSceneHandler.fTopPODL)
     146    if (fG4OpenGLStoredSceneHandler.fTopPODL) {
    145147      glCallList (fG4OpenGLStoredSceneHandler.fTopPODL);
    146 
     148    printf("***************************  CASE A1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
     149    }
    147150    for (size_t i = 0; i < fG4OpenGLStoredSceneHandler.fTOList.size(); ++i) {
     151    printf("***************************  CASE B1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
    148152      G4OpenGLStoredSceneHandler::TO& to =
    149153        fG4OpenGLStoredSceneHandler.fTOList[i];
    150154      if (to.fEndTime >= fStartTime && to.fStartTime <= fEndTime) {
     155    printf("***************************  CASE B2 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
    151156        glPushMatrix();
    152157        G4OpenGLTransform3D oglt (to.fTransform);
     
    161166        glCallList (to.fDisplayListId);
    162167        glPopMatrix();
     168    printf("***************************  CASE B3 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
    163169      }
    164170    }
Note: See TracChangeset for help on using the changeset viewer.