Changeset 580 for trunk


Ignore:
Timestamp:
Sep 20, 2007, 5:24:46 PM (17 years ago)
Author:
garnier
Message:

r601@mac-90108: laurentgarnier | 2007-09-20 15:47:27 +0200
passage du fileSave en natif mac

Location:
trunk/geant4/visualization
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/geant4/visualization/G4History.macro

    r579 r580  
    5959/gui/addButton viewer "Update scene" "/vis/scene/notifyHandlers"
    6060/N03/event/printModulo 100
    61 /run/beamOn 1
    62 /control/execute visTutor/exN03Vis14.mac
    63 /vis/open OGLSQT
    64 /vis/sceneHandler/create OGLSQT
    65 /vis/sceneHandler/attach
    66 /vis/viewer/create ! ! 600
    67 /vis/viewer/refresh
    68 /vis/viewer/reset
    69 /vis/viewer/refresh
    70 /vis/viewer/set/viewpointThetaPhi  20 70
    71 /vis/viewer/refresh
    72 /vis/viewer/zoom               0.8
    73 /vis/viewer/refresh
    74 /vis/drawVolume
    75 /vis/scene/create
    76 /vis/scene/add/volume world
    77 /vis/scene/notifyHandlers
    78 /vis/sceneHandler/attach
    79 /vis/viewer/flush
    80 /vis/viewer/refresh viewer-2
    81 /vis/viewer/update viewer-2
    82 /vis/open DAWNFILE
    83 /vis/sceneHandler/create DAWNFILE
    84 /vis/sceneHandler/attach
    85 /vis/viewer/create ! ! 600
    86 /vis/viewer/reset
    87 /vis/viewer/zoom               1.1
    88 /vis/viewer/set/viewpointThetaPhi  35 35
    89 /vis/drawVolume           Absorber
    90 /vis/scene/create
    91 /vis/scene/add/volume Absorber
    92 /vis/sceneHandler/attach
    93 /vis/scene/add/axes      0 0 0 500 mm
    94 /vis/scene/notifyHandlers
    95 /vis/scene/add/text      0 0 0 mm  40 -100 -140   Absorber
    96 /vis/scene/notifyHandlers
    97 /vis/scene/add/scale     10 cm z 1 0 0 manual -2.5 -5 0  cm
    98 /vis/scene/notifyHandlers
    99 /vis/scene/notifyHandlers
    100 /vis/viewer/update
    101 /vis/viewer/reset
    102 /vis/viewer/zoom               1.1
    103 /vis/viewer/set/viewpointThetaPhi  35 35
    104 /vis/drawVolume                Gap
    105 /vis/scene/create
    106 /vis/scene/add/volume Gap
    107 /vis/sceneHandler/attach
    108 /vis/scene/add/axes       0 0 0 500 mm
    109 /vis/scene/notifyHandlers
    110 /vis/scene/add/text       0 0 0 mm  50 -100 -140   Gap
    111 /vis/scene/notifyHandlers
    112 /vis/scene/add/scale      10 cm z 1 0 0 manual -2.5 -5  0 cm
    113 /vis/scene/notifyHandlers
    114 /vis/scene/notifyHandlers
    115 /vis/viewer/update
    116 /vis/viewer/reset
    117 /vis/viewer/zoom               1.1
    118 /vis/viewer/set/viewpointThetaPhi  35 35
    119 /vis/viewer/set/culling         global false
    120 /vis/drawVolume
    121 /vis/scene/create
    122 /vis/scene/add/volume world
    123 /vis/scene/notifyHandlers
    124 /vis/sceneHandler/attach
    125 /vis/scene/add/axes      0 0 0 500 mm
    126 /vis/scene/notifyHandlers
    127 /vis/scene/add/text      0 0 0 mm 50 -100 -240   World
    128 /vis/scene/notifyHandlers
    129 /vis/scene/add/scale     10 cm x 1 0 0
    130 /vis/scene/notifyHandlers
    131 /vis/scene/notifyHandlers
    132 /vis/viewer/update
    133 /vis/viewer/set/culling       global true
    134 /run/beamOn 1
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc

    r579 r580  
    4545#include "G4Normal3D.hh"
    4646#include "G4Scene.hh"
     47#include "G4OpenGLQtExportDialog.h"
    4748
    4849#include "G4Qt.hh"
     
    5253#include <QtGui/qdialog.h>
    5354#include <QtGui/qmenu.h>
     55#include <QImageWriter>
     56#include <QMessageBox>
    5457#include <QFileDialog.h>
    5558
     
    653656
    654657void 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);
    667677    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 
    669683  printf("G4OpenGLQtViewer::actionCreateEPS() \n");
    670684}
     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
     688void 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
     786void 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
    671799
    672800
  • trunk/geant4/visualization/currentEvent.rndm

    r579 r580  
    221878463799
    330
    4 1180857998
    5 122938492
     49876
     554321
Note: See TracChangeset for help on using the changeset viewer.