Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4OpenGLWtViewer.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4OpenGLWtViewer.cc 86360 2014-11-10 08:34:16Z gcosmo $
28 //
29 //
30 // G4OpenGLWtViewer : Class to provide Wt specific
31 // functionality for OpenGL in GEANT4
32 //
33 // 27/06/2003 : G.Barrand : implementation (at last !).
34 
35 #ifdef G4VIS_BUILD_OPENGLWT_DRIVER
36 
37 #include "G4OpenGLWtViewer.hh"
38 #include "G4VViewer.hh"
39 #include "G4VSceneHandler.hh"
40 #include "G4OpenGLSceneHandler.hh"
41 
42 #include "G4ios.hh"
43 #include "G4VisExtent.hh"
44 #include "G4LogicalVolume.hh"
45 #include "G4VSolid.hh"
46 #include "G4Point3D.hh"
47 #include "G4Normal3D.hh"
48 #include "G4Scene.hh"
49 //#include "G4OpenGLWtExportDialog.hh"
50 //#include "G4OpenGLWtMovieDialog.hh"
51 #include "G4UnitsTable.hh"
52 #include "G4Wt.hh"
53 #include "G4UIWt.hh"
54 #include "G4UImanager.hh"
55 #include "G4UIcommandTree.hh"
56 #include <Wt/WHBoxLayout>
57 #include <Wt/WApplication>
58 #include <Wt/WTime>
59 
60 
61 
62 
64 void G4OpenGLWtViewer::CreateMainWindow (
65  Wt::WGLWidget* glWidget
66  ,Wt::WString name
67 )
68 {
71 #ifdef G4DEBUG_VIS_OGL
72  printf("G4OpenGLWtViewer::CreateMainWindow \n");
73 #endif
74 
75  if(fWindow) return; //Done.
76 
77  fWindow = glWidget ;
78  // fWindow->makeCurrent();
79 
80 // G4Wt* interactorManager = G4Wt::getInstance ();
81  // return false if G4UIWt was not launch
82 
84  if (UI == NULL) return;
85 
86  if (! static_cast<G4UIWt*> (UI->GetG4UIWindow())) {
87  // NO UI, should be batch mode
88  fBatchMode = true;
89  return;
90  }
91  fUiWt = static_cast<G4UIWt*> (UI->GetG4UIWindow());
92 
93  bool isTabbedView = false;
94  if ( fUiWt) {
95  if (!fBatchMode) {
96 // if (!interactorManager->IsExternalApp()) {
97 
98  // resize window to get the good size at the beginning
99  ResizeWindow(fVP.GetWindowSizeHintX(),fVP.GetWindowSizeHintY());
100 
101  isTabbedView = fUiWt->AddTabWidget(fWindow->parent(),name,getWinWidth(),getWinHeight());
102  // change color
103  fWindow->parent()->decorationStyle().setBackgroundColor (Wt::WColor("blue"));
104 
105  // Have to resize !
106 #ifdef G4DEBUG_VIS_OGL
107  printf("G4OpenGLWtViewer::CreateMainWindow :: resize :%d %d\n",getWinWidth(),getWinHeight());
108 #endif
109  fWindow->resize(getWinWidth(),getWinHeight());
110 
111  fUISceneTreeComponentsTBWidget = fUiWt->GetSceneTreeComponentsTBWidget();
112  fWindow->resize(fWindow->parent()->width(),fWindow->parent()->height());
113  isTabbedView = true;
114  // }
115  }
116  }
117 #ifdef G4DEBUG_VIS_OGL
118  else {
119  printf("G4OpenGLWtViewer::CreateMainWindow :: UIWt NOt found \n");
120  }
121 #endif
122 
123 
124 /* if (!isTabbedView) { // we have to do a dialog
125 
126  Wt::WWidget *myParent = getParentWidget();
127 #ifdef G4DEBUG_VIS_OGL
128  printf("G4OpenGLWtViewer::CreateMainWindow :: getParent OK \n");
129 #endif
130  if (myParent != NULL) {
131  glWidget->setParent(myParent);
132  }
133  Wt::WHBoxLayout *mainLayout = new Wt::WHBoxLayout(fGLWindow);
134 
135  mainLayout->setMargin(0);
136  mainLayout->setSpacing(0);
137  mainLayout->addWidget(fWindow);
138  if (fGLWindow->inherits("Wt::WContainerWidget")) {
139  fGLWindow->setWindowTitle( name);
140  }
141  fGLWindow->setLayout(mainLayout);
142 
143  */
144 /*
145  //useful for MACOSX, we have to compt the menuBar height
146  int offset = QApplication::desktop()->height()
147  - QApplication::desktop()->availableGeometry().height();
148 
149  G4int YPos= fVP.GetWindowAbsoluteLocationHintY(QApplication::desktop()->height());
150  if (fVP.GetWindowAbsoluteLocationHintY(QApplication::desktop()->height())< offset) {
151  YPos = offset;
152  }
153 #ifdef G4DEBUG_VIS_OGL
154  printf("G4OpenGLQtViewer::CreateMainWindow :: resizing to %d %d \n",getWinWidth(), getWinHeight());
155 #endif
156  fGLWindow->move(fVP.GetWindowAbsoluteLocationHintX(QApplication::desktop()->width()),YPos);
157 */
158 // fGLWindow->show();
159 // } else {
160 
161  fGLWindow = fWindow;
162 // }
163 
164  if(!fWindow) return;
165 
166 #ifdef _A_FINIR_FIXME
167  if (!fContextMenu)
168  createPopupMenu();
169 #endif
170 
171 }
172 
175 // void G4OpenGLWtViewer::dialogClosed() {
176 // // fGLWindow = NULL;
177 // }
178 
180 G4OpenGLWtViewer::G4OpenGLWtViewer (
181  G4OpenGLSceneHandler& scene
182  )
183  :G4VViewer (scene, -1)
184  ,G4OpenGLViewer (scene)
185  ,fWindow(0)
186  ,fRecordFrameNumber(0)
187  //#ifdef _A_FINIR_FIXME ,fContextMenu(0)
188  ,fMouseAction(STYLE1)
189  ,fDeltaRotation(1)
190  ,fDeltaSceneTranslation(0.01)
191  ,fDeltaDepth(0.01)
192  ,fDeltaZoom(0.05)
193  ,fDeltaMove(0.05)
194  ,fHoldKeyEvent(false)
195  ,fHoldMoveEvent(false)
196  ,fHoldRotateEvent(false)
197  ,fAutoMove(false)
198  ,fEncoderPath("")
199  ,fTempFolderPath("")
200  ,fMovieTempFolderPath("")
201  ,fSaveFileName("")
202  ,fParameterFileName("mpeg_encode_parameter_file.par")
203  ,fMovieParametersDialog(NULL)
204  ,fRecordingStep(WAIT)
205  ,fProcess(NULL)
206  ,fNbMaxFramesPerSec(100)
207  ,fNbMaxAnglePerSec(360)
208  ,fLaunchSpinDelay(100)
209  ,fXRot(0)
210  ,fYRot(0)
211  ,fNoKeyPress(true)
212  ,fAltKeyPress(false)
213  ,fControlKeyPress(false)
214  ,fShiftKeyPress(false)
215  ,fBatchMode(false)
216  ,fUiWt(NULL)
217 {
218 
219  // launch Wt if not
220  G4Wt::getInstance ();
221 
222 // FIXME : all stuff with G4VIS_BUILD_OPENGL_ES_DRIVER
223  // G4OpenGLViewer::SetView(this);
224 
225 #ifdef G4DEBUG_VIS_OGL
226  printf("G4OpenGLWtViewer::Create \n");
227 #endif
228  fLastPos3 = Wt::WPoint(-1,-1);
229  fLastPos2 = Wt::WPoint(-1,-1);
230  fLastPos1 = Wt::WPoint(-1,-1);
231 
232  mMatrix.setToIdentity();
233 
234 #ifdef _A_FINIR_FIXME
235  initMovieParameters();
236 #endif
237 
238  fLastEventTime = new Wt::WTime();
239 
240 #ifdef G4DEBUG_VIS_OGL
241  printf("G4OpenGLWtViewer::G4OpenGLWtViewer END\n");
242 #endif
243 
244 }
245 
246 
247 
248 
249 
250 void G4OpenGLWtViewer::resizeGL(int width, int height)
251  {
252 #ifdef G4DEBUG_VIS_OGL
253  printf("G4OpenGLWtViewer resizeGL %d %d\n",width,height);
254 #endif
255 
256  }
257 
258 
259 
260 
262 G4OpenGLWtViewer::~G4OpenGLWtViewer (
263 )
264 {
267 #ifdef _A_FINIR_FIXME
268  G4cout <<removeTempFolder().toUTF8().c_str() <<G4endl;
269 #endif
270 }
271 
272 
273 
274 
275 
276 #ifdef _A_FINIR_FIXME
277 
280 void G4OpenGLWtViewer::createPopupMenu() {
281 
282  fContextMenu = new WMenu("All");
283 
284  WMenu *mMouseAction = fContextMenu->addMenu("&Mouse actions");
285 
286  fRotateAction = mMouseAction->addAction("Rotate");
287  fMoveAction = mMouseAction->addAction("Move");
288  fPickAction = mMouseAction->addAction("Pick");
289  WAction *shortcutsAction = mMouseAction->addAction("Show shortcuts");
290 
291  fRotateAction->setCheckable(true);
292  fMoveAction->setCheckable(false);
293  fPickAction->setCheckable(false);
294  shortcutsAction->setCheckable(false);
295 
296  fRotateAction->setChecked(true);
297  fMoveAction->setChecked(false);
298  fPickAction->setChecked(false);
299  shortcutsAction->setChecked(false);
300 
301  WObject ::connect(fRotateAction,
302  SIGNAL(triggered(bool)),
303  this,
304  SLOT(actionMouseRotate()));
305 
306  WObject ::connect(fMoveAction,
307  SIGNAL(triggered(bool)),
308  this,
309  SLOT(actionMouseMove()));
310 
311  WObject ::connect(fPickAction,
312  SIGNAL(triggered(bool)),
313  this,
314  SLOT(actionMousePick()));
315 
316  WObject ::connect(shortcutsAction,
317  SIGNAL(triggered(bool)),
318  this,
319  SLOT(showShortcuts()));
320 
321  // === Style Menu ===
322  WMenu *mStyle = fContextMenu->addMenu("&Style");
323 
324  WMenu *mRepresentation = mStyle->addMenu("&Representation");
325  WMenu *mProjection = mStyle->addMenu("&Projection");
326  WAction *polyhedron = mRepresentation->addAction("Polyhedron");
327  WAction *nurbs = mRepresentation->addAction("NURBS");
328 
329  WAction *ortho = mProjection->addAction("Orthographic");
330  WAction *perspective = mProjection->addAction("Persepective");
331 
332  // INIT mRepresentation
333  G4ViewParameters::RepStyle style;
334  style = fVP.GetRepStyle();
335  if (style == G4ViewParameters::polyhedron) {
336  createRadioAction(polyhedron,nurbs,SLOT(toggleRepresentation(bool)),1);
337  } else if (style == G4ViewParameters::nurbs) {
338  createRadioAction(polyhedron,nurbs,SLOT(toggleRepresentation(bool)),2);
339  } else {
340  mRepresentation->clear();
341  }
342 
343  // INIT mProjection
344  if (fVP.GetFieldHalfAngle() == 0) {
345  createRadioAction(ortho, perspective,SLOT(toggleProjection(bool)),1);
346  } else {
347  createRadioAction(ortho, perspective,SLOT(toggleProjection(bool)),2);
348  }
349 
350  // === Drawing Menu ===
351  WMenu *mDrawing = mStyle->addMenu("&Drawing");
352 
353  fDrawingWireframe = mDrawing->addAction("Wireframe");
354  fDrawingWireframe->setCheckable(true);
355 
356  fDrawingLineRemoval = mDrawing->addAction("Hidden line removal");
357  fDrawingLineRemoval->setCheckable(true);
358 
359  fDrawingSurfaceRemoval = mDrawing->addAction("Hidden Surface removal");
360  fDrawingSurfaceRemoval->setCheckable(true);
361 
362  fDrawingLineSurfaceRemoval = mDrawing->addAction("Hidden line and surface removal");
363  fDrawingLineSurfaceRemoval->setCheckable(true);
364 
365  // INIT Drawing
367  d_style = fVP.GetDrawingStyle();
368 
369  if (d_style == G4ViewParameters::wireframe) {
370  fDrawingWireframe->setChecked(true);
371  } else if (d_style == G4ViewParameters::hlr) {
372  fDrawingLineRemoval->setChecked(true);
373  } else if (d_style == G4ViewParameters::hsr) {
374  fDrawingSurfaceRemoval->setChecked(true);
375  } else if (d_style == G4ViewParameters::hlhsr) {
376  fDrawingLineSurfaceRemoval->setChecked(true);
377  } else {
378  mDrawing->clear();
379  }
380  WObject ::connect(fDrawingWireframe,
381  SIGNAL(triggered(bool)),
382  this,
383  SLOT(actionDrawingWireframe()));
384  WObject ::connect(fDrawingLineRemoval,
385  SIGNAL(triggered(bool)),
386  this,
387  SLOT(actionDrawingLineRemoval()));
388  WObject ::connect(fDrawingSurfaceRemoval,
389  SIGNAL(triggered(bool)),
390  this,
391  SLOT(actionDrawingSurfaceRemoval()));
392  WObject ::connect(fDrawingLineSurfaceRemoval,
393  SIGNAL(triggered(bool)),
394  this,
395  SLOT(actionDrawingLineSurfaceRemoval()));
396 
397  // Background Color
398 
399  WAction *backgroundColorChooser ;
400 
401  // === Action Menu ===
402  backgroundColorChooser = mStyle->addAction("Background color");
403  WObject ::connect(backgroundColorChooser,
404  SIGNAL(triggered()),
405  this,
406  SLOT(actionChangeBackgroundColor()));
407 
408  // Text Color
409 
410  WAction *textColorChooser ;
411  // === Action Menu ===
412  textColorChooser = mStyle->addAction("Text color");
413  WObject ::connect(textColorChooser,
414  SIGNAL(triggered()),
415  this,
416  SLOT(actionChangeTextColor()));
417 
418  // Default Color
419 
420  WAction *defaultColorChooser ;
421  // === Action Menu ===
422  defaultColorChooser = mStyle->addAction("Default color");
423  WObject ::connect(defaultColorChooser,
424  SIGNAL(triggered()),
425  this,
426  SLOT(actionChangeDefaultColor()));
427 
428 
429  // === Action Menu ===
430  WMenu *mActions = fContextMenu->addMenu("&Actions");
431  WAction *createEPS = mActions->addAction("Save as ...");
432  WObject ::connect(createEPS,
433  SIGNAL(triggered()),
434  this,
435  SLOT(actionSaveImage()));
436 
437  // === Action Menu ===
438  WAction *movieParameters = mActions->addAction("Movie parameters...");
439  WObject ::connect(movieParameters,
440  SIGNAL(triggered()),
441  this,
442  SLOT(actionMovieParameters()));
443 
444 
445 
446 
447  // === Special Menu ===
448  WMenu *mSpecial = fContextMenu->addMenu("S&pecial");
449  WMenu *mTransparency = mSpecial->addMenu("Transparency");
450  WAction *transparencyOn = mTransparency->addAction("On");
451  WAction *transparencyOff = mTransparency->addAction("Off");
452 
453  if (transparency_enabled == false) {
454  createRadioAction(transparencyOn,transparencyOff,SLOT(toggleTransparency(bool)),2);
455  } else if (transparency_enabled == true) {
456  createRadioAction(transparencyOn,transparencyOff,SLOT(toggleTransparency(bool)),1);
457  } else {
458  mSpecial->clear();
459  }
460 
461 
462  WMenu *mAntialiasing = mSpecial->addMenu("Antialiasing");
463  WAction *antialiasingOn = mAntialiasing->addAction("On");
464  WAction *antialiasingOff = mAntialiasing->addAction("Off");
465 
466  if (antialiasing_enabled == false) {
467  createRadioAction(antialiasingOn,antialiasingOff,SLOT(toggleAntialiasing(bool)),2);
468  } else if (antialiasing_enabled == true) {
469  createRadioAction(antialiasingOn,antialiasingOff,SLOT(toggleAntialiasing(bool)),1);
470  } else {
471  mAntialiasing->clear();
472  }
473 
474  WMenu *mHaloing = mSpecial->addMenu("Haloing");
475  WAction *haloingOn = mHaloing->addAction("On");
476  WAction *haloingOff = mHaloing->addAction("Off");
477 
478  if (haloing_enabled == false) {
479  createRadioAction(haloingOn,haloingOff,SLOT(toggleHaloing(bool)),2);
480  } else if (haloing_enabled == true) {
481  createRadioAction(haloingOn,haloingOff,SLOT(toggleHaloing(bool)),1);
482  } else {
483  mHaloing->clear();
484  }
485 
486  WMenu *mAux = mSpecial->addMenu("Auxiliary edges");
487  WAction *auxOn = mAux->addAction("On");
488  WAction *auxOff = mAux->addAction("Off");
489  if (!fVP.IsAuxEdgeVisible()) {
490  createRadioAction(auxOn,auxOff,SLOT(toggleAux(bool)),1);
491  } else {
492  createRadioAction(auxOn,auxOff,SLOT(toggleAux(bool)),2);
493  }
494 
495 
496 
497  WMenu *mFullScreen = mSpecial->addMenu("&Full screen");
498  fFullScreenOn = mFullScreen->addAction("On");
499  fFullScreenOff = mFullScreen->addAction("Off");
500  createRadioAction(fFullScreenOn,fFullScreenOff,SLOT(toggleFullScreen(bool)),2);
501 
502 }
503 
504 
505 void G4OpenGLWtViewer::G4manageContextMenuEvent(WContextMenuEvent *e)
506 {
507  if (!fGLWindow) {
508  G4cerr << "Visualization window not defined, please choose one before" << G4endl;
509  } else {
510 
511  if (!fContextMenu)
512  createPopupMenu();
513 
514  // launch menu
515  if ( fContextMenu ) {
516  fContextMenu->exec( e->globalPos() );
517  // delete fContextMenu;
518  }
519  }
520  e->accept();
521 }
522 
523 
532 void G4OpenGLWtViewer::createRadioAction(WAction *action1,WAction *action2, const std::string& method,unsigned int nCheck) {
533 
534  action1->setCheckable(true);
535  action2->setCheckable(true);
536 
537  if (nCheck ==1)
538  action1->setChecked (true);
539  else
540  action2->setChecked (true);
541 
542  WObject ::connect(action1, SIGNAL(triggered(bool)),action2, SLOT(toggle()));
543  WObject ::connect(action2, SIGNAL(triggered(bool)),action1, SLOT(toggle()));
544 
545  WObject ::connect(action1, SIGNAL(toggled(bool)),this, method.c_str());
546 
547 }
548 
552 void G4OpenGLWtViewer::actionMouseRotate() {
553  emit toggleMouseAction(STYLE1);
554 }
555 
556 
560 void G4OpenGLWtViewer::actionMouseMove() {
561  emit toggleMouseAction(STYLE2);
562 }
563 
564 
568 void G4OpenGLWtViewer::actionMousePick() {
569  emit toggleMouseAction(STYLE3);
570 }
571 
572 
576 void G4OpenGLWtViewer::actionDrawingWireframe() {
577  emit toggleDrawingAction(1);
578 }
579 
583 void G4OpenGLWtViewer::actionDrawingLineRemoval() {
584  emit toggleDrawingAction(2);
585 }
586 
590 void G4OpenGLWtViewer::actionDrawingSurfaceRemoval() {
591  emit toggleDrawingAction(3);
592 }
593 
597 void G4OpenGLWtViewer::actionDrawingLineSurfaceRemoval() {
598  emit toggleDrawingAction(4);
599 }
600 
601 
606 void G4OpenGLWtViewer::toggleMouseAction(mouseActions aAction) {
607 
608  if ((aAction == STYLE1) || //initialize all
609  (aAction == STYLE2) ||
610  (aAction == STYLE3)) {
611  fRotateAction->setChecked (false);
612  fMoveAction->setChecked (false);
613  fPickAction->setChecked (false);
614  fVP.SetPicking(false);
615  fMouseAction = aAction;
616  }
617  // rotate
618  if (aAction == STYLE1) { // rotate
619  showShortcuts();
620  fRotateAction->setChecked (true);
621  } else if (aAction == STYLE2) { //move
622  fMoveAction->setChecked (true);
623  } else if (aAction == STYLE3) { //pick
624  fPickAction->setChecked (true);
625  fVP.SetPicking(true);
626  }
627 }
628 
629 #endif
630 
633 void G4OpenGLWtViewer::showShortcuts() {
634  G4cout << "========= Mouse Shortcuts =========" << G4endl;
635  if (fMouseAction == STYLE1) { // rotate
636  G4cout << "Click and move mouse to rotate volume " << G4endl;
637  G4cout << "ALT + Click and move mouse to rotate volume (View Direction)" << G4endl;
638  G4cout << "CTRL + Click and zoom mouse to zoom in/out" << G4endl;
639  G4cout << "SHIFT + Click and zoommove camera point of view" << G4endl;
640  } else if (fMouseAction == STYLE2) { //move
641  G4cout << "Move camera point of view with mouse" << G4endl;
642  } else if (fMouseAction == STYLE3) { //pick
643  G4cout << "Click and pick " << G4endl;
644  }
645  G4cout << "========= Move Shortcuts =========" << G4endl;
646  G4cout << "Press left/right arrows to move volume left/right" << G4endl;
647  G4cout << "Press up/down arrows to move volume up/down" << G4endl;
648  G4cout << "Press '+'/'-' to move volume toward/forward" << G4endl;
649  G4cout << G4endl;
650  G4cout << "========= Rotation (Theta/Phi) Shortcuts =========" << G4endl;
651  G4cout << "Press SHIFT + left/right arrows to rotate volume left/right" << G4endl;
652  G4cout << "Press SHIFT + up/down arrows to rotate volume up/down" << G4endl;
653  G4cout << G4endl;
654  G4cout << "========= Rotation (View Direction) Shortcuts =========" << G4endl;
655  G4cout << "Press ALT + left/right to rotate volume around vertical direction" << G4endl;
656  G4cout << "Press ALT + up/down to rotate volume around horizontal direction" << G4endl;
657  G4cout << G4endl;
658  G4cout << "========= Zoom View =========" << G4endl;
659  G4cout << "Press CTRL + '+'/'-' to zoom into volume" << G4endl;
660  G4cout << G4endl;
661  G4cout << "========= Misc =========" << G4endl;
662  G4cout << "Press ALT +/- to slow/speed rotation/move" << G4endl;
663  G4cout << "Press H to reset view" << G4endl;
664  G4cout << "Press Esc to exit FullScreen" << G4endl;
665  G4cout << G4endl;
666  G4cout << "========= Video =========" << G4endl;
667  G4cout << "In video mode : " << G4endl;
668  G4cout << " Press SPACE to Start/Pause video recording " << G4endl;
669  G4cout << " Press RETURN to Stop video recording " << G4endl;
670  G4cout << G4endl;
671 }
672 
673 
674 
675 #ifdef _A_FINIR_FIXME
676 
687 void G4OpenGLWtViewer::toggleDrawingAction(int aAction) {
688 
690 
691 
692  // initialize
693  if ((aAction >0) && (aAction <5)) {
694  fDrawingWireframe->setChecked (false);
695  fDrawingLineRemoval->setChecked (false);
696  fDrawingSurfaceRemoval->setChecked (false);
697  fDrawingLineSurfaceRemoval->setChecked (false);
698  }
699  if (aAction ==1) {
700  fDrawingWireframe->setChecked (true);
701 
702  d_style = G4ViewParameters::wireframe;
703 
704  } else if (aAction ==2) {
705  fDrawingLineRemoval->setChecked (true);
706 
707  d_style = G4ViewParameters::hlr;
708 
709  } else if (aAction ==3) {
710  fDrawingSurfaceRemoval->setChecked (true);
711 
712  d_style = G4ViewParameters::hsr;
713 
714  } else if (aAction ==4) {
715  fDrawingLineSurfaceRemoval->setChecked (true);
716  d_style = G4ViewParameters::hlhsr;
717  }
718  fVP.SetDrawingStyle(d_style);
719 
720  updateWWidget();
721 }
722 
723 
734 void G4OpenGLWtViewer::toggleRepresentation(bool check) {
735 
736  G4ViewParameters::RepStyle style;
737  if (check == 1) {
738  style = G4ViewParameters::polyhedron;
739  } else {
740  style = G4ViewParameters::nurbs;
741  }
742  fVP.SetRepStyle (style);
743 
744  updateWWidget();
745 }
746 
757 void G4OpenGLWtViewer::toggleProjection(bool check) {
758 
759  if (check == 1) {
760  G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/set/projection o");
761  } else {
762  G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/set/projection p");
763  }
764  updateWWidget();
765 }
766 
767 
772 void G4OpenGLWtViewer::toggleTransparency(bool check) {
773 
774  if (check) {
775  transparency_enabled = false;
776  } else {
777  transparency_enabled = true;
778  }
779  SetNeedKernelVisit (true);
780  updateWWidget();
781 }
782 
787 void G4OpenGLWtViewer::toggleAntialiasing(bool check) {
788 
789  if (!check) {
790  antialiasing_enabled = false;
791  glDisable (GL_LINE_SMOOTH);
792  glDisable (GL_POLYGON_SMOOTH);
793  } else {
794  antialiasing_enabled = true;
795  glEnable (GL_LINE_SMOOTH);
796  glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);
797  glEnable (GL_POLYGON_SMOOTH);
798  glHint (GL_POLYGON_SMOOTH_HINT, GL_NICEST);
799  }
800 
801  updateWWidget();
802 }
803 
808 //FIXME : I SEE NOTHING...
809 void G4OpenGLWtViewer::toggleHaloing(bool check) {
810  if (check) {
811  haloing_enabled = false;
812  } else {
813  haloing_enabled = true;
814  }
815 
816  updateWWidget();
817 
818 }
819 
824 void G4OpenGLWtViewer::toggleAux(bool check) {
825  if (check) {
826  fVP.SetAuxEdgeVisible(true);
827  } else {
828  fVP.SetAuxEdgeVisible(false);
829  }
830  SetNeedKernelVisit (true);
831  updateWWidget();
832 }
833 
837 void G4OpenGLWtViewer::toggleFullScreen(bool check) {
838  if (check != fGLWindow->isFullScreen()) { //toggle
839  fGLWindow->setWindowState(fGLWindow->windowState() ^ Wt::WindowFullScreen);
840  G4cerr << "This version of Wt could not do fullScreen. Resizing the widget is the only solution available." << G4endl;
841  }
842 }
843 #endif
844 
845 #ifdef _A_FINIR_FIXME
846 void G4OpenGLWtViewer::savePPMToTemp() {
847  if (fMovieTempFolderPath == "") {
848  return;
849  }
850  Wt::WString fileName ="Test"+Wt::WString::number(fRecordFrameNumber)+".ppm";
851  Wt::WString filePath =fMovieTempFolderPath+fileName;
852 
853  WImage image;
854  image = fWindow->grabFrameBuffer();
855  bool res = false;
856 
857  res = image.save(filePath,0);
858  if (res == false) {
859  resetRecording();
860  setRecordingInfos("Can't save tmp file "+filePath);
861  return;
862  }
863 
864  setRecordingInfos("File "+fileName+" saved");
865  fRecordFrameNumber++;
866 }
867 
868 
869 
870 void G4OpenGLWtViewer::actionSaveImage() {
871  Wt::WString filters;
872  WList<WByteArray> formats = WImageWriter::supportedImageFormats ();
873  for (int i = 0; i < formats.size(); ++i) {
874  filters +=formats.at(i) + ";;";
875  }
876  filters += "eps;;";
877  filters += "ps;;";
878  filters += "pdf";
879  Wt::WString* selectedFormat = new Wt::WString();
880  std::string name;
881  name = WFileDialog::getSaveFileName ( fGLWindow,
882  tr("Save as ..."),
883  ".",
884  filters,
885  selectedFormat ).toUTF8().c_str();
886  // bmp jpg jpeg png ppm xbm xpm
887  if (name.empty()) {
888  return;
889  }
890  name += "." + selectedFormat->toUTF8();
891  Wt::WString format = selectedFormat->toLower();
892  setPrintFilename(name.c_str(),0);
893  G4OpenGLWtExportDialog* exportDialog= new G4OpenGLWtExportDialog(fGLWindow,format,fWindow->height(),fWindow->width());
894  if( exportDialog->exec()) {
895 
896  WImage image;
897  bool res = false;
898  if ((exportDialog->getWidth() !=fWindow->width()) ||
899  (exportDialog->getHeight() !=fWindow->height())) {
900  setPrintSize(exportDialog->getWidth(),exportDialog->getHeight());
901  if ((format != Wt::WString("eps")) && (format != Wt::WString("ps"))) {
902  G4cerr << "Export->Change Size : This function is not implemented, to export in another size, please resize your frame to what you need" << G4endl;
903 
904  // rescaleImage(exportDialog->getWidth(),exportDialog->getHeight());// re-scale image
905  // WGLWidget* glResized = fWindow;
906 
907  // FIXME :
908  // L.Garnier : I've try to implement change size function, but the problem is
909  // the renderPixmap function call the WGLWidget to resize and it doesn't draw
910  // the content of this widget... It only draw the background.
911 
912  // fWindow->renderPixmap (exportDialog->getWidth()*2,exportDialog->getHeight()*2,true );
913 
914  // WPixmap pixmap = fWindow->renderPixmap ();
915 
916  // image = pixmap->toImage();
917  // glResized->resize(exportDialog->getWidth()*2,exportDialog->getHeight()*2);
918  // image = glResized->grabFrameBuffer();
919  }
920  } else {
921  image = fWindow->grabFrameBuffer();
922  }
923  if (format == Wt::WString("eps")) {
924  fVectoredPs = exportDialog->getVectorEPS();
925  printEPS();
926  } else if (format == "ps") {
927  fVectoredPs = true;
928  printEPS();
929  } else if (format == "pdf") {
930 
931  res = printPDF(name,exportDialog->getNbColor(),image);
932 
933  } else if ((format == "tif") ||
934  (format == "tiff") ||
935  (format == "jpg") ||
936  (format == "jpeg") ||
937  (format == "png") ||
938  (format == "pbm") ||
939  (format == "pgm") ||
940  (format == "ppm") ||
941  (format == "bmp") ||
942  (format == "xbm") ||
943  (format == "xpm")) {
944  res = image.save(Wt::WString(name.c_str()),0,exportDialog->getSliderValue());
945  } else {
946  G4cerr << "This version of G4UI Could not generate the selected format" << G4endl;
947  }
948  if ((format == Wt::WString("eps")) && (format == Wt::WString("ps"))) {
949  if (res == false) {
950  G4cerr << "Error while saving file... "<<name.c_str()<< G4endl;
951  } else {
952  G4cout << "File "<<name.c_str()<<" has been saved " << G4endl;
953  }
954  }
955 
956  } else { // cancel selected
957  return;
958  }
959 
960 }
961 #endif
962 
963 
964 #ifdef _A_FINIR_FIXME
965 void G4OpenGLWtViewer::actionChangeBackgroundColor() {
966 
967  // //I need to revisit the kernel if the background colour changes and
968  // //hidden line removal is enabled, because hlr drawing utilises the
969  // //background colour in its drawing...
970  // // (Note added by JA 13/9/2005) Background now handled in view
971  // // parameters. A kernel visit is triggered on change of background.
972 
973  WColor color;
974  color = WColorDialog::getColor(Wt::black, fGLWindow);
975  if (color.isValid()) {
976  Wt::WString com = "/vis/viewer/set/background ";
977  Wt::WString num;
978  com += num.setNum(((float)color.red())/256)+" ";
979  com += num.setNum(((float)color.green())/256)+" ";
980  com += num.setNum(((float)color.blue())/256)+" ";
981  G4UImanager::GetUIpointer()->ApplyCommand(com.toUTF8().c_str());
982  updateWWidget();
983  }
984 }
985 
986 void G4OpenGLWtViewer::actionChangeTextColor() {
987 
988  WColor color;
989  color = WColorDialog::getColor(Wt::yellow, fGLWindow);
990  if (color.isValid()) {
991  Wt::WString com = "/vis/viewer/set/defaultTextColour ";
992  Wt::WString num;
993  com += num.setNum(((float)color.red())/256)+" ";
994  com += num.setNum(((float)color.green())/256)+" ";
995  com += num.setNum(((float)color.blue())/256)+" ";
996  G4UImanager::GetUIpointer()->ApplyCommand(com.toUTF8().c_str());
997  updateWWidget();
998  }
999 }
1000 
1001 void G4OpenGLWtViewer::actionChangeDefaultColor() {
1002 
1003  WColor color;
1004  color = WColorDialog::getColor(Wt::white, fGLWindow);
1005  printf("actionChangeDefaultColor\n");
1006  if (color.isValid()) {
1007  Wt::WString com = "/vis/viewer/set/defaultColour ";
1008  Wt::WString num;
1009  com += num.setNum(((float)color.red())/256)+" ";
1010  com += num.setNum(((float)color.green())/256)+" ";
1011  com += num.setNum(((float)color.blue())/256)+" ";
1012  G4UImanager::GetUIpointer()->ApplyCommand(com.toUTF8().c_str());
1013  updateWWidget();
1014  }
1015 }
1016 
1017 
1018 void G4OpenGLWtViewer::actionMovieParameters() {
1019  showMovieParametersDialog();
1020 }
1021 
1022 
1023 void G4OpenGLWtViewer::showMovieParametersDialog() {
1024  if (!fMovieParametersDialog) {
1025  fMovieParametersDialog= new G4OpenGLWtMovieDialog(this,fGLWindow);
1026  displayRecordingStatus();
1027  fMovieParametersDialog->checkEncoderSwParameters();
1028  fMovieParametersDialog->checkSaveFileNameParameters();
1029  fMovieParametersDialog->checkTempFolderParameters();
1030  if (getEncoderPath() == "") {
1031  setRecordingInfos("mpeg_encode is needed to encode in video format. It is available here: http://bmrc.berkeley.edu/frame/research/mpeg/");
1032  }
1033  }
1034  fMovieParametersDialog->show();
1035 }
1036 #endif
1037 
1038 /*
1039 // http://www.google.com/codesearch?hl=en&q=+jpg+Wt+quality+WDialog+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
1040 
1041 void Graph::exportToSVG(const Wt::WString& fname)
1042 {
1043  // enable workaround for Wt3 misalignments
1044  WwtPainter::setSVGMode(true);
1045  WPicture picture;
1046  WPainter p(&picture);
1047  d_plot->print(&p, d_plot->rect());
1048  p.end();
1049 
1050  picture.save(fname, "svg");
1051 }
1052 */
1053 
1054 
1055 
1060 void G4OpenGLWtViewer::G4MousePressEvent(Wt::WMouseEvent *event)
1061 {
1062  if (event->button() & Wt::WMouseEvent::LeftButton) {
1063 #ifdef _A_FINIR_FIXME
1064  fWindow->setMouseTracking(true);
1065 #endif
1066  fAutoMove = false; // stop automove
1067  fLastPos1 = Wt::WPoint(event->widget().x,event->widget().y);
1068  fLastPos2 = fLastPos1;
1069  fLastPos3 = fLastPos2;
1070 // fLastEventTime->start();
1071  if (fMouseAction == STYLE3){ // pick
1072  Pick(event->widget().x,event->widget().y);
1073  }
1074  }
1075 }
1076 
1079 void G4OpenGLWtViewer::G4MouseReleaseEvent()
1080 {
1081  fSpinningDelay = 1;//fLastEventTime->elapsed();
1082  Wt::WPoint delta = Wt::WPoint(fLastPos3.x()-fLastPos1.x(),fLastPos3.y()-fLastPos1.y());
1083  if ((delta.x() == 0) && (delta.y() == 0)) {
1084  return;
1085  }
1086  if (fSpinningDelay < fLaunchSpinDelay ) {
1087  fAutoMove = true;
1088  Wt::WTime lastMoveTime;
1089 // lastMoveTime.start();
1090  // try to addapt speed move/rotate looking to drawing speed
1091  float correctionFactor = 5;
1092  while (fAutoMove) {
1093 // if ( lastMoveTime.elapsed () >= (int)(1000/fNbMaxFramesPerSec)) {
1094  if ( 1 >= (int)(1000/fNbMaxFramesPerSec)) {
1095  float lTime = 1000/((float)1);
1096  if (((((float)delta.x())/correctionFactor)*lTime > fNbMaxAnglePerSec) ||
1097  ((((float)delta.x())/correctionFactor)*lTime < -fNbMaxAnglePerSec) ) {
1098  correctionFactor = (float)delta.x()*(lTime/fNbMaxAnglePerSec);
1099  if (delta.x() <0 ) {
1100  correctionFactor = -correctionFactor;
1101  }
1102  }
1103  if (((((float)delta.y())/correctionFactor)*lTime > fNbMaxAnglePerSec) ||
1104  ((((float)delta.y())/correctionFactor)*lTime < -fNbMaxAnglePerSec) ) {
1105  correctionFactor = (float)delta.y()*(lTime/fNbMaxAnglePerSec);
1106  if (delta.y() <0 ) {
1107  correctionFactor = -correctionFactor;
1108  }
1109  }
1110 
1111  // Check Wt Versions for META Keys
1112 
1113  // Click and move mouse to rotate volume
1114  // ALT + Click and move mouse to rotate volume (View Direction)
1115  // SHIFT + Click and move camera point of view
1116  // CTRL + Click and zoom mouse to zoom in/out
1117 
1118  if (fMouseAction == STYLE1) { // rotate
1119  if (fNoKeyPress) {
1120  rotateWtScene(((float)delta.x())/correctionFactor,((float)delta.y())/correctionFactor);
1121  } else if (fAltKeyPress) {
1122  rotateWtSceneToggle(((float)delta.x())/correctionFactor,((float)delta.y())/correctionFactor);
1123  }
1124 
1125  } else if (fMouseAction == STYLE2) { // move
1126  moveScene(-((float)delta.x())/correctionFactor,-((float)delta.y())/correctionFactor,0,true);
1127  }
1128 // lastMoveTime.start();
1129  }
1130 #ifdef _A_FINIR_FIXME
1131  ((Wt::WApplication*)G4Wt::getInstance ())->processEvents();
1132 #endif
1133  }
1134  }
1135 #ifdef _A_FINIR_FIXME
1136  fWindow->setMouseTracking(false);
1137 #endif
1138 }
1139 
1140 
1141 void G4OpenGLWtViewer::G4MouseDoubleClickEvent()
1142 {
1143 #ifdef _A_FINIR_FIXME
1144  fWindow->setMouseTracking(true);
1145 #endif
1146 }
1147 
1148 
1156  void G4OpenGLWtViewer::G4MouseMoveEvent(Wt::WMouseEvent *event)
1157 {
1158 
1159  Wt::WMouseEvent::Button mButtons = event->button();
1160 
1161 #ifdef _A_FINIR_FIXME
1162  updateKeyModifierState(event->modifiers());
1163 #endif
1164 
1165  if (fAutoMove) {
1166  return;
1167  }
1168 
1169  fLastPos3 = fLastPos2;
1170  fLastPos2 = fLastPos1;
1171  fLastPos1 = Wt::WPoint(event->widget().x, event->widget().y);
1172 
1173  printf("G4OpenGLWtViewer move :%d %d\n",event->widget().x, event->widget().y);
1174  int deltaX = fLastPos2.x()-fLastPos1.x();
1175  int deltaY = fLastPos2.y()-fLastPos1.y();
1176 
1177  if (fMouseAction == STYLE1) { // rotate
1178  if (mButtons & Wt::WMouseEvent::LeftButton) {
1179  if (fNoKeyPress) {
1180  rotateWtScene(((float)deltaX),((float)deltaY));
1181  } else if (fAltKeyPress) {
1182  rotateWtSceneToggle(((float)deltaX),((float)deltaY));
1183  } else if (fShiftKeyPress) {
1184  unsigned int sizeWin;
1185  sizeWin = getWinWidth();
1186  if (getWinHeight() < getWinWidth()) {
1187  sizeWin = getWinHeight();
1188  }
1189 
1190  // L.Garnier : 08/2010 100 is the good value, but don't ask me why !
1191  float factor = ((float)100/(float)sizeWin) ;
1192  moveScene(-(float)deltaX*factor,-(float)deltaY*factor,0,false);
1193  } else if (fControlKeyPress) {
1194  fVP.SetZoomFactor(fVP.GetZoomFactor()*(1+((float)deltaY)));
1195  }
1196  }
1197  } else if (fMouseAction == STYLE2) { // move
1198  if (mButtons & Wt::WMouseEvent::LeftButton) {
1199  moveScene(-deltaX,-deltaY,0,true);
1200  }
1201  }
1202 
1203 // fLastEventTime->start();
1204 }
1205 
1206 
1214 void G4OpenGLWtViewer::moveScene(float dx,float dy, float dz,bool mouseMove)
1215 {
1216  if (fHoldMoveEvent)
1217  return;
1218  fHoldMoveEvent = true;
1219 
1220  G4double coefTrans = 0;
1221  GLdouble coefDepth = 0;
1222  if(mouseMove) {
1223  coefTrans = ((G4double)getSceneNearWidth())/((G4double)getWinWidth());
1224  if (getWinHeight() <getWinWidth()) {
1225  coefTrans = ((G4double)getSceneNearWidth())/((G4double)getWinHeight());
1226  }
1227  } else {
1228  coefTrans = getSceneNearWidth()*fDeltaSceneTranslation;
1229  coefDepth = getSceneDepth()*fDeltaDepth;
1230  }
1231  fVP.IncrementPan(-dx*coefTrans,dy*coefTrans,dz*coefDepth);
1232  updateWWidget();
1233  if (fAutoMove)
1234 #ifdef _A_FINIR_FIXME
1235  ((WApplication*)G4Wt::getInstance ())->processEvents();
1236 #endif
1237 
1238  fHoldMoveEvent = false;
1239 }
1240 
1241 
1247 void G4OpenGLWtViewer::rotateWtScene(float dx, float dy)
1248 {
1249  if (fHoldRotateEvent)
1250  return;
1251  fHoldRotateEvent = true;
1252 
1253  if( dx != 0) {
1254  rotateScene(dx,0);
1255  }
1256  if( dy != 0) {
1257  rotateScene(0,dy);
1258  }
1259  updateWWidget();
1260 
1261  fHoldRotateEvent = false;
1262 }
1263 
1269 void G4OpenGLWtViewer::rotateWtSceneToggle(float dx, float dy)
1270 {
1271  if (fHoldRotateEvent)
1272  return;
1273  fHoldRotateEvent = true;
1274 
1275  rotateSceneToggle(dx,dy);
1276 
1277  updateWWidget();
1278 
1279  fHoldRotateEvent = false;
1280 }
1281 
1294 void G4OpenGLWtViewer::rescaleImage(
1295  int /* aWidth */
1296 ,int /* aHeight */
1297 ){
1298  // GLfloat* feedback_buffer;
1299  // GLint returned;
1300  // FILE* file;
1301 
1302 // feedback_buffer = new GLfloat[size];
1303 // glFeedbackBuffer (size, GL_3D_COLOR, feedback_buffer);
1304 // glRenderMode (GL_FEEDBACK);
1305 
1306 // DrawView();
1307 // returned = glRenderMode (GL_RENDER);
1308 
1309 }
1310 
1311 
1312 
1313 #ifdef _A_FINIR_FIXME
1314 
1320 bool G4OpenGLWtViewer::printPDF (
1321  const std::string aFilename
1322 ,int aInColor
1323 ,WImage aImage
1324 )
1325 {
1326 
1327  WPrinter printer;
1328  // printer.setPageSize(pageSize);
1329 
1330  // FIXME : L. Garnier 4/12/07
1331  // This is not working, it does nothing. Image is staying in color mode
1332  // So I have desactivate the B/W button in GUI
1333  if ((!aImage.isGrayscale ()) &&(aInColor ==1 )) {
1334  aImage = aImage.convertToFormat ( aImage.format(), Wt::MonoOnly);
1335  }
1336 
1337 
1338  if (aFilename.substr(aFilename.size()-3) == ".ps") {
1339 #if WT_VERSION > 0x040200
1340  printer.setOutputFormat(WPrinter::PostScriptFormat);
1341 #endif
1342  } else {
1343 #if WT_VERSION > 0x040100
1344  printer.setOutputFormat(WPrinter::PdfFormat);
1345 #endif
1346  }
1347 #if WT_VERSION > 0x040100
1348  printer.setOutputFileName(Wt::WString(aFilename.c_str()));
1349 #endif
1350  // printer.setFullPage ( true);
1351  WPainter paint(&printer);
1352  paint.drawImage (0,0,aImage);
1353  paint.end();
1354  return true;
1355 }
1356 
1357 
1358 
1359 void G4OpenGLWtViewer::G4wheelEvent (Wt::WWheelEvent * event)
1360 {
1361  fVP.SetZoomFactor(fVP.GetZoomFactor()+(fVP.GetZoomFactor()*(event->delta())/1200));
1362  updateWWidget();
1363 }
1364 #endif
1365 
1366  void G4OpenGLWtViewer::G4keyPressEvent (Wt::WKeyEvent * event)
1367 {
1368  if (fHoldKeyEvent)
1369  return;
1370 
1371  fHoldKeyEvent = true;
1372 
1373 
1374  // with no modifiers
1375 #ifdef _A_FINIR_FIXME
1376  updateKeyModifierState(event->modifiers());
1377 #endif
1378  if ((fNoKeyPress)) { // || (event->modifiers() == Wt::KeyboardModifier )) {
1379  if (event->key() == Wt::Key_Down) { // go down
1380  moveScene(0,1,0,false);
1381  }
1382  else if (event->key() == Wt::Key_Up) { // go up
1383  moveScene(0,-1,0,false);
1384  }
1385  if (event->key() == Wt::Key_Left) { // go left
1386  moveScene(-1,0,0,false);
1387  }
1388  else if (event->key() == Wt::Key_Right) { // go right
1389  moveScene(1,0,0,false);
1390  }
1391  if (event->text() == Wt::WString("-") ) { // go backward
1392  moveScene(0,0,1,false);
1393  }
1394  else if (event->text() == Wt::WString("+")) { // go forward
1395  moveScene(0,0,-1,false);
1396  }
1397 
1398  // escaped from full screen
1399  if (event->key() == Wt::Key_Escape) {
1400 #ifdef _A_FINIR_FIXME
1401  toggleFullScreen(false);
1402 #endif
1403  }
1404  }
1405  // several case here : If return is pressed, in every case -> display the movie parameters dialog
1406  // If one parameter is wrong -> put it in red (only save filenam could be wrong..)
1407  // If encoder not found-> does nothing.Only display a message in status box
1408  // If all ok-> generate parameter file
1409  // If ok -> put encoder button enabled
1410 
1411 #ifdef _A_FINIR_FIXME
1412  if ( (event->key() == Wt::Key_Enter)){ // end of video
1413  stopVideo();
1414  }
1415  if (event->key() == Wt::Key_Space){ // start/pause of video
1416  startPauseVideo();
1417  }
1418 #endif
1419 
1420  // H : Return Home view
1421  if (event->key() == Wt::Key_H){ // go Home
1422  fDeltaRotation = 1;
1423  fDeltaSceneTranslation = 0.01;
1424  fDeltaDepth = 0.01;
1425  fDeltaZoom = 0.05;
1426  fDeltaMove = 0.05;
1427 
1428  fVP.SetZoomFactor(1.);
1429  fVP.SetUpVector(G4Vector3D (0., 1., 0.));
1430  fVP.SetViewAndLights (G4Vector3D (0., 0., 1.));
1431 
1432  updateWWidget();
1433  }
1434 
1435  // Shift Modifier
1436  if (fShiftKeyPress) {
1437  if (event->key() == Wt::Key_Down) { // rotate phi
1438  rotateWtScene(0,-fDeltaRotation);
1439  }
1440  else if (event->key() == Wt::Key_Up) { // rotate phi
1441  rotateWtScene(0,fDeltaRotation);
1442  }
1443  if (event->key() == Wt::Key_Left) { // rotate theta
1444  rotateWtScene(fDeltaRotation,0);
1445  }
1446  else if (event->key() == Wt::Key_Right) { // rotate theta
1447  rotateWtScene(-fDeltaRotation,0);
1448  }
1449 
1450  // Alt Modifier
1451  }
1452  if ((fAltKeyPress)) {
1453  if (event->key() == Wt::Key_Down) { // rotate phi
1454  rotateWtSceneToggle(0,-fDeltaRotation);
1455  }
1456  else if (event->key() == Wt::Key_Up) { // rotate phi
1457  rotateWtSceneToggle(0,fDeltaRotation);
1458  }
1459  if (event->key() == Wt::Key_Left) { // rotate theta
1460  rotateWtSceneToggle(fDeltaRotation,0);
1461  }
1462  else if (event->key() == Wt::Key_Right) { // rotate theta
1463  rotateWtSceneToggle(-fDeltaRotation,0);
1464  }
1465 
1466  // Rotatio +/-
1467  if (event->text() == Wt::WString("+")) {
1468  fDeltaRotation = fDeltaRotation/0.7;
1469  G4cout << "Auto-rotation set to : " << fDeltaRotation << G4endl;
1470  }
1471  else if (event->text() == Wt::WString("-")) {
1472  fDeltaRotation = fDeltaRotation*0.7;
1473  G4cout << "Auto-rotation set to : " << fDeltaRotation << G4endl;
1474  }
1475 
1476  // Control Modifier OR Command on MAC
1477  }
1478  if ((fControlKeyPress)) {
1479  if (event->text() == Wt::WString("+")) {
1480  fVP.SetZoomFactor(fVP.GetZoomFactor()*(1+fDeltaZoom));
1481  updateWWidget();
1482  }
1483  else if (event->text() == Wt::WString("-")) {
1484  fVP.SetZoomFactor(fVP.GetZoomFactor()*(1-fDeltaZoom));
1485  updateWWidget();
1486  }
1487  }
1488 
1489  fHoldKeyEvent = false;
1490 }
1491 
1492 
1493 #ifdef _A_FINIR_FIXME
1494 void G4OpenGLWtViewer::updateKeyModifierState(Wt::KeyboardModifiers modifier) {
1495  // Check Wt Versions for META Keys
1496 
1497  fNoKeyPress = true;
1498  fAltKeyPress = false;
1499  fShiftKeyPress = false;
1500  fControlKeyPress = false;
1501 
1502  if (modifier & Wt::AltModifier ) {
1503  fAltKeyPress = true;
1504  fNoKeyPress = false;
1505  }
1506  if (modifier & Wt::ShiftModifier ) {
1507  fShiftKeyPress = true;
1508  fNoKeyPress = false;
1509  }
1510  if (modifier & Wt::ControlModifier ) {
1511  fControlKeyPress = true;
1512  fNoKeyPress = false;
1513  }
1514 }
1515 
1518 void G4OpenGLWtViewer::stopVideo() {
1519 
1520  // if encoder parameter is wrong, display parameters dialog and return
1521  if (!fMovieParametersDialog) {
1522  showMovieParametersDialog();
1523  }
1524  setRecordingStatus(STOP);
1525 
1526  if (fRecordFrameNumber >0) {
1527  // check parameters if they were modified (Re APPLY them...)
1528  if (!(fMovieParametersDialog->checkEncoderSwParameters())) {
1529  setRecordingStatus(BAD_ENCODER);
1530  } else if (!(fMovieParametersDialog->checkSaveFileNameParameters())) {
1531  setRecordingStatus(BAD_OUTPUT);
1532  }
1533  } else {
1534  resetRecording();
1535  setRecordingInfos("No frame to encode.");
1536  }
1537 }
1538 
1541 void G4OpenGLWtViewer::saveVideo() {
1542 
1543  // if encoder parameter is wrong, display parameters dialog and return
1544  if (!fMovieParametersDialog) {
1545  showMovieParametersDialog();
1546  }
1547 
1548  fMovieParametersDialog->checkEncoderSwParameters();
1549  fMovieParametersDialog->checkSaveFileNameParameters();
1550 
1551  if (fRecordingStep == STOP) {
1552  setRecordingStatus(SAVE);
1553  generateMpegEncoderParameters();
1554  encodeVideo();
1555  }
1556 }
1557 
1558 
1561 void G4OpenGLWtViewer::startPauseVideo() {
1562 
1563  // first time, if temp parameter is wrong, display parameters dialog and return
1564 
1565  if (( fRecordingStep == WAIT)) {
1566  if ( fRecordFrameNumber == 0) {
1567  if (getTempFolderPath() == "") { // BAD_OUTPUT
1568  showMovieParametersDialog();
1569  setRecordingInfos("You should specified the temp folder in order to make movie");
1570  return;
1571  } else {
1572  // remove temp folder if it was create
1573  Wt::WString tmp = removeTempFolder();
1574  if (tmp !="") {
1575  setRecordingInfos(tmp);
1576  return;
1577  }
1578  tmp = createTempFolder();
1579  if (tmp != "") {
1580  setRecordingInfos("Can't create temp folder."+tmp);
1581  return;
1582  }
1583  }
1584  }
1585  }
1586  if ((fRecordingStep == WAIT)) {
1587  setRecordingStatus(START);
1588  } else if (fRecordingStep == START) {
1589  setRecordingStatus(PAUSE);
1590  } else if (fRecordingStep == PAUSE) {
1591  setRecordingStatus(CONTINUE);
1592  } else if (fRecordingStep == CONTINUE) {
1593  setRecordingStatus(PAUSE);
1594  }
1595 }
1596 
1597 void G4OpenGLWtViewer::setRecordingStatus(RECORDING_STEP step) {
1598 
1599  fRecordingStep = step;
1600  displayRecordingStatus();
1601 }
1602 
1603 
1604 void G4OpenGLWtViewer::displayRecordingStatus() {
1605 
1606  Wt::WString txtStatus = "";
1607  if (fRecordingStep == WAIT) {
1608  txtStatus = "Waiting to start...";
1609  fRecordFrameNumber = 0; // reset the frame number
1610  } else if (fRecordingStep == START) {
1611  txtStatus = "Start Recording...";
1612  } else if (fRecordingStep == PAUSE) {
1613  txtStatus = "Pause Recording...";
1614  } else if (fRecordingStep == CONTINUE) {
1615  txtStatus = "Continue Recording...";
1616  } else if (fRecordingStep == STOP) {
1617  txtStatus = "Stop Recording...";
1618  } else if (fRecordingStep == READY_TO_ENCODE) {
1619  txtStatus = "Ready to Encode...";
1620  } else if (fRecordingStep == ENCODING) {
1621  txtStatus = "Encoding...";
1622  } else if (fRecordingStep == FAILED) {
1623  txtStatus = "Failed to encode...";
1624  } else if ((fRecordingStep == BAD_ENCODER)
1625  || (fRecordingStep == BAD_OUTPUT)
1626  || (fRecordingStep == BAD_TMP)) {
1627  txtStatus = "Correct above errors first";
1628  } else if (fRecordingStep == SUCCESS) {
1629  txtStatus = "File encoded successfully";
1630  } else {
1631  }
1632 
1633  if (fMovieParametersDialog) {
1634  fMovieParametersDialog->setRecordingStatus(txtStatus);
1635  } else {
1636  G4cout << txtStatus.toUTF8().c_str() << G4endl;
1637  }
1638  setRecordingInfos("");
1639 }
1640 
1641 
1642 void G4OpenGLWtViewer::setRecordingInfos(Wt::WString txt) {
1643  if (fMovieParametersDialog) {
1644  fMovieParametersDialog->setRecordingInfos(txt);
1645  } else {
1646  G4cout << txt.toUTF8().c_str() << G4endl;
1647  }
1648 }
1649 
1652 void G4OpenGLWtViewer::initMovieParameters() {
1653  //init encoder
1654 
1655  //look for encoderPath
1656  fProcess = new WProcess();
1657 
1658  WObject ::connect(fProcess,SIGNAL(finished ( int)),
1659  this,SLOT(processLookForFinished()));
1660  fProcess->setReadChannelMode(WProcess::MergedChannels);
1661  fProcess->start ("which mpeg_encode");
1662 
1663 }
1664 
1667 Wt::WString G4OpenGLWtViewer::getEncoderPath() {
1668  return fEncoderPath;
1669 }
1670 
1671 
1676 Wt::WString G4OpenGLWtViewer::setEncoderPath(Wt::WString path) {
1677  if (path == "") {
1678  return "File does not exist";
1679  }
1680 
1681  path = WDir::cleanPath(path);
1682  WFileInfo *f = new WFileInfo(path);
1683  if (!f->exists()) {
1684  return "File does not exist";
1685  } else if (f->isDir()) {
1686  return "This is a directory";
1687  } else if (!f->isExecutable()) {
1688  return "File exist but is not executable";
1689  } else if (!f->isFile()) {
1690  return "This is not a file";
1691  }
1692  fEncoderPath = path;
1693 
1694  if ((fRecordingStep == BAD_ENCODER)) {
1695  setRecordingStatus(STOP);
1696  }
1697  return "";
1698 }
1699 
1700 
1701 bool G4OpenGLWtViewer::isRecording(){
1702  if ((fRecordingStep == START) || (fRecordingStep == CONTINUE)) {
1703  return true;
1704  }
1705  return false;
1706 }
1707 
1708 bool G4OpenGLWtViewer::isPaused(){
1709  if (fRecordingStep == PAUSE) {
1710  return true;
1711  }
1712  return false;
1713 }
1714 
1715 bool G4OpenGLWtViewer::isEncoding(){
1716  if (fRecordingStep == ENCODING) {
1717  return true;
1718  }
1719  return false;
1720 }
1721 
1722 bool G4OpenGLWtViewer::isWaiting(){
1723  if (fRecordingStep == WAIT) {
1724  return true;
1725  }
1726  return false;
1727 }
1728 
1729 bool G4OpenGLWtViewer::isStopped(){
1730  if (fRecordingStep == STOP) {
1731  return true;
1732  }
1733  return false;
1734 }
1735 
1736 bool G4OpenGLWtViewer::isFailed(){
1737  if (fRecordingStep == FAILED) {
1738  return true;
1739  }
1740  return false;
1741 }
1742 
1743 bool G4OpenGLWtViewer::isSuccess(){
1744  if (fRecordingStep == SUCCESS) {
1745  return true;
1746  }
1747  return false;
1748 }
1749 
1750 bool G4OpenGLWtViewer::isBadEncoder(){
1751  if (fRecordingStep == BAD_ENCODER) {
1752  return true;
1753  }
1754  return false;
1755 }
1756 bool G4OpenGLWtViewer::isBadTmp(){
1757  if (fRecordingStep == BAD_TMP) {
1758  return true;
1759  }
1760  return false;
1761 }
1762 bool G4OpenGLWtViewer::isBadOutput(){
1763  if (fRecordingStep == BAD_OUTPUT) {
1764  return true;
1765  }
1766  return false;
1767 }
1768 
1769 void G4OpenGLWtViewer::setBadEncoder(){
1770  fRecordingStep = BAD_ENCODER;
1771  displayRecordingStatus();
1772 }
1773 void G4OpenGLWtViewer::setBadTmp(){
1774  fRecordingStep = BAD_TMP;
1775  displayRecordingStatus();
1776 }
1777 void G4OpenGLWtViewer::setBadOutput(){
1778  fRecordingStep = BAD_OUTPUT;
1779  displayRecordingStatus();
1780 }
1781 
1782 void G4OpenGLWtViewer::setWaiting(){
1783  fRecordingStep = WAIT;
1784  displayRecordingStatus();
1785 }
1786 
1787 
1788 bool G4OpenGLWtViewer::isReadyToEncode(){
1789  if (fRecordingStep == READY_TO_ENCODE) {
1790  return true;
1791  }
1792  return false;
1793 }
1794 
1795 void G4OpenGLWtViewer::resetRecording() {
1796  setRecordingStatus(WAIT);
1797 }
1798 
1803 Wt::WString G4OpenGLWtViewer::setTempFolderPath(Wt::WString path) {
1804 
1805  if (path == "") {
1806  return "Path does not exist";
1807  }
1808  path = WDir::cleanPath(path);
1809  WFileInfo *d = new WFileInfo(path);
1810  if (!d->exists()) {
1811  return "Path does not exist";
1812  } else if (!d->isDir()) {
1813  return "This is not a directory";
1814  } else if (!d->isReadable()) {
1815  return path +" is read protected";
1816  } else if (!d->isWritable()) {
1817  return path +" is write protected";
1818  }
1819 
1820  if ((fRecordingStep == BAD_TMP)) {
1821  setRecordingStatus(WAIT);
1822  }
1823  fTempFolderPath = path;
1824  return "";
1825 }
1826 
1829 Wt::WString G4OpenGLWtViewer::getTempFolderPath() {
1830  return fTempFolderPath;
1831 }
1832 
1837 Wt::WString G4OpenGLWtViewer::setSaveFileName(Wt::WString path) {
1838 
1839  if (path == "") {
1840  return "Path does not exist";
1841  }
1842 
1843  WFileInfo *file = new WFileInfo(path);
1844  WDir dir = file->dir();
1845  path = WDir::cleanPath(path);
1846  if (file->exists()) {
1847  return "File already exist, please choose a new one";
1848  } else if (!dir.exists()) {
1849  return "Dir does not exist";
1850  } else if (!dir.isReadable()) {
1851  return path +" is read protected";
1852  }
1853 
1854  if ((fRecordingStep == BAD_OUTPUT)) {
1855  setRecordingStatus(STOP);
1856  }
1857  fSaveFileName = path;
1858  return "";
1859 }
1860 
1863 Wt::WString G4OpenGLWtViewer::getSaveFileName() {
1864  return fSaveFileName ;
1865 }
1866 
1871 Wt::WString G4OpenGLWtViewer::createTempFolder() {
1872  fMovieTempFolderPath = "";
1873  //check
1874  Wt::WString tmp = setTempFolderPath(fTempFolderPath);
1875  if (tmp != "") {
1876  return tmp;
1877  }
1878  Wt::WString sep = Wt::WString(WDir::separator());
1879  Wt::WString path = sep+"WtMovie_"+WDateTime::currentDateTime ().toString("dd-MM-yyyy_hh-mm-ss")+sep;
1880  WDir *d = new WDir(WDir::cleanPath(fTempFolderPath));
1881  // check if it is already present
1882  if (d->exists(path)) {
1883  return "Folder "+path+" already exists.Please remove it first";
1884  }
1885  if (d->mkdir(fTempFolderPath+path)) {
1886  fMovieTempFolderPath = fTempFolderPath+path;
1887  return "";
1888  } else {
1889  return "Can't create "+fTempFolderPath+path;
1890  }
1891  return "-";
1892 }
1893 
1896 Wt::WString G4OpenGLWtViewer::removeTempFolder() {
1897  // remove files in Wt_temp folder
1898  if (fMovieTempFolderPath == "") {
1899  return "";
1900  }
1901  WDir *d = new WDir(WDir::cleanPath(fMovieTempFolderPath));
1902  if (!d->exists()) {
1903  return ""; // already remove
1904  }
1905 
1906  d->setFilter( WDir::Files );
1907  Wt::WStringList subDirList = d->entryList();
1908  int res = true;
1909  Wt::WString error = "";
1910  for (Wt::WStringList::ConstIterator it = subDirList.begin() ;(it != subDirList.end()) ; it++) {
1911  const Wt::WString currentFile = *it;
1912  if (!d->remove(currentFile)) {
1913  res = false;
1914  Wt::WString file = fMovieTempFolderPath+currentFile;
1915  error +="Removing file failed : "+file;
1916  } else {
1917  }
1918  }
1919  if (res) {
1920  if (d->rmdir(fMovieTempFolderPath)) {
1921  fMovieTempFolderPath = "";
1922  return "";
1923  } else {
1924  return "Dir "+fMovieTempFolderPath+" should be empty, but could not remove it";
1925  }
1926 
1927  }
1928  return "Could not remove "+fMovieTempFolderPath+" because of the following errors :"+error;
1929 }
1930 
1931 
1932 
1933 bool G4OpenGLWtViewer::hasPendingEvents () {
1934 #ifdef _A_FINIR_FIXME
1935  return ((WApplication*)G4Wt::getInstance ())->hasPendingEvents ();
1936 #endif
1937  return false;
1938 }
1939 
1940 bool G4OpenGLWtViewer::generateMpegEncoderParameters () {
1941 
1942  // save the parameter file
1943  FILE* fp;
1944  fp = fopen (Wt::WString(fMovieTempFolderPath+fParameterFileName).toUTF8().c_str(), "w");
1945 
1946  if (fp == NULL) {
1947  setRecordingInfos("Generation of parameter file failed");
1948  return false;
1949  }
1950 
1951  fprintf (fp,"# parameter file template with lots of comments to assist you\n");
1952  fprintf (fp,"#\n");
1953  fprintf (fp,"# you can use this as a template, copying it to a separate file then modifying\n");
1954  fprintf (fp,"# the copy\n");
1955  fprintf (fp,"#\n");
1956  fprintf (fp,"#\n");
1957  fprintf (fp,"# any line beginning with '#' is a comment\n");
1958  fprintf (fp,"#\n");
1959  fprintf (fp,"# no line should be longer than 255 characters\n");
1960  fprintf (fp,"#\n");
1961  fprintf (fp,"#\n");
1962  fprintf (fp,"# general format of each line is:\n");
1963  fprintf (fp,"# \n");
1964  fprintf (fp,"#\n");
1965  fprintf (fp,"# lines can generally be in any order\n");
1966  fprintf (fp,"#\n");
1967  fprintf (fp,"# an exception is the option 'INPUT' which must be followed by input\n");
1968  fprintf (fp,"# files in the order in which they must appear, followed by 'END_INPUT'\n");
1969  fprintf (fp,"#\n");
1970  fprintf (fp,"# Also, if you use the `command` method of generating input file names,\n");
1971  fprintf (fp,"# the command will only be executed in the INPUT_DIR if INPUT_DIR preceeds\n");
1972  fprintf (fp,"# the INPUT parameter.\n");
1973  fprintf (fp,"#\n");
1974  fprintf (fp,"# MUST be in UPPER CASE\n");
1975  fprintf (fp,"#\n");
1976  fprintf (fp,"\n");
1977  fprintf (fp,"# Pattern affects speed, quality and compression. See the User's Guide\n");
1978  fprintf (fp,"# for more info.\n");
1979  fprintf (fp,"\n");
1980  fprintf (fp,"PATTERN IBBPBBPBBPBBPBBP\n");
1981  fprintf (fp,"OUTPUT %s\n",getSaveFileName().toUTF8().c_str());
1982  fprintf (fp,"\n");
1983  fprintf (fp,"# mpeg_encode really only accepts 3 different file formats, but using a\n");
1984  fprintf (fp,"# conversion statement it can effectively handle ANY file format\n");
1985  fprintf (fp,"#\n");
1986  fprintf (fp,"# You must specify the type of the input files. The choices are:\n");
1987  fprintf (fp,"# YUV, PPM, JMOVIE, Y, JPEG, PNM\n");
1988  fprintf (fp,"# (must be upper case)\n");
1989  fprintf (fp,"#\n");
1990  fprintf (fp,"BASE_FILE_FORMAT PPM\n");
1991  fprintf (fp,"\n");
1992  fprintf (fp,"#\n");
1993  fprintf (fp,"# if YUV format (or using parallel version), must provide width and height\n");
1994  fprintf (fp,"# YUV_SIZE widthxheight\n");
1995  fprintf (fp,"# this option is ignored if BASE_FILE_FORMAT is not YUV and you're running\n");
1996  fprintf (fp,"# on just one machine\n");
1997  fprintf (fp,"#\n");
1998  fprintf (fp,"YUV_SIZE 352x240\n");
1999  fprintf (fp,"\n");
2000  fprintf (fp,"# If you are using YUV, there are different supported file formats.\n");
2001  fprintf (fp,"# EYUV or UCB are the same as previous versions of this encoder.\n");
2002  fprintf (fp,"# (All the Y's, then U's then V's, in 4:2:0 subsampling.)\n");
2003  fprintf (fp,"# Other formats, such as Abekas, Phillips, or a general format are\n");
2004  fprintf (fp,"# permissible, the general format is a string of Y's, U's, and V's\n");
2005  fprintf (fp,"# to specify the file order.\n");
2006  fprintf (fp,"\n");
2007  fprintf (fp,"INPUT_FORMAT UCB\n");
2008  fprintf (fp,"\n");
2009  fprintf (fp,"# the conversion statement\n");
2010  fprintf (fp,"#\n");
2011  fprintf (fp,"# Each occurrence of '*' will be replaced by the input file\n");
2012  fprintf (fp,"#\n");
2013  fprintf (fp,"# e.g., if you have a bunch of GIF files, then this might be:\n");
2014  fprintf (fp,"# INPUT_CONVERT giftoppm *\n");
2015  fprintf (fp,"#\n");
2016  fprintf (fp,"# e.g., if you have a bunch of files like a.Y a.U a.V, etc., then:\n");
2017  fprintf (fp,"# INPUT_CONVERT cat *.Y *.U *.V\n");
2018  fprintf (fp,"#\n");
2019  fprintf (fp,"# e.g., if you are grabbing from laser disc you might have something like\n");
2020  fprintf (fp,"# INPUT_CONVERT goto frame *; grabppm\n");
2021  fprintf (fp,"# 'INPUT_CONVERT *' means the files are already in the base file format\n");
2022  fprintf (fp,"#\n");
2023  fprintf (fp,"INPUT_CONVERT * \n");
2024  fprintf (fp,"\n");
2025  fprintf (fp,"# number of frames in a GOP.\n");
2026  fprintf (fp,"#\n");
2027  fprintf (fp,"# since each GOP must have at least one I-frame, the encoder will find the\n");
2028  fprintf (fp,"# the first I-frame after GOP_SIZE frames to start the next GOP\n");
2029  fprintf (fp,"#\n");
2030  fprintf (fp,"# later, will add more flexible GOP signalling\n");
2031  fprintf (fp,"#\n");
2032  fprintf (fp,"GOP_SIZE 16\n");
2033  fprintf (fp,"\n");
2034  fprintf (fp,"# number of slices in a frame\n");
2035  fprintf (fp,"#\n");
2036  fprintf (fp,"# 1 is a good number. another possibility is the number of macroblock rows\n");
2037  fprintf (fp,"# (which is the height divided by 16)\n");
2038  fprintf (fp,"#\n");
2039  fprintf (fp,"SLICES_PER_FRAME 1\n");
2040  fprintf (fp,"\n");
2041  fprintf (fp,"# directory to get all input files from (makes this file easier to read)\n");
2042  fprintf (fp,"INPUT_DIR %s\n",fMovieTempFolderPath.toUTF8().c_str());
2043  fprintf (fp,"\n");
2044  fprintf (fp,"# There are a bunch of ways to specify the input files.\n");
2045  fprintf (fp,"# from a simple one-per-line listing, to the following \n");
2046  fprintf (fp,"# way of numbering them. See the manual for more information.\n");
2047  fprintf (fp,"INPUT\n");
2048  fprintf (fp,"# '*' is replaced by the numbers 01, 02, 03, 04\n");
2049  fprintf (fp,"# if I instead do [01-11], it would be 01, 02, ..., 09, 10, 11\n");
2050  fprintf (fp,"# if I instead do [1-11], it would be 1, 2, 3, ..., 9, 10, 11\n");
2051  fprintf (fp,"# if I instead do [1-11+3], it would be 1, 4, 7, 10\n");
2052  fprintf (fp,"# the program assumes none of your input files has a name ending in ']'\n");
2053  fprintf (fp,"# if you do, too bad!!!\n");
2054  fprintf (fp,"#\n");
2055  fprintf (fp,"#\n");
2056  fprintf (fp,"Test*.ppm [0-%d]\n",fRecordFrameNumber-1);
2057  fprintf (fp,"# can have more files here if you want...there is no limit on the number\n");
2058  fprintf (fp,"# of files\n");
2059  fprintf (fp,"END_INPUT\n");
2060  fprintf (fp,"\n");
2061  fprintf (fp,"\n");
2062  fprintf (fp,"\n");
2063  fprintf (fp,"# Many of the remaining options have to do with the motion search and qscale\n");
2064  fprintf (fp,"\n");
2065  fprintf (fp,"# FULL or HALF -- must be upper case\n");
2066  fprintf (fp,"# Should be FULL for computer generated images\n");
2067  fprintf (fp,"PIXEL FULL\n");
2068  fprintf (fp,"\n");
2069  fprintf (fp,"# means +/- this many pixels for both P and B frame searches\n");
2070  fprintf (fp,"# specify two numbers if you wish to serc different ranges in the two.\n");
2071  fprintf (fp,"RANGE 10\n");
2072  fprintf (fp,"\n");
2073  fprintf (fp,"# The two search algorithm parameters below mostly affect speed,\n");
2074  fprintf (fp,"# with some affect on compression and almost none on quality.\n");
2075  fprintf (fp,"\n");
2076  fprintf (fp,"# this must be one of {EXHAUSTIVE, SUBSAMPLE, LOGARITHMIC}\n");
2077  fprintf (fp,"PSEARCH_ALG LOGARITHMIC\n");
2078  fprintf (fp,"\n");
2079  fprintf (fp,"# this must be one of {SIMPLE, CROSS2, EXHAUSTIVE}\n");
2080  fprintf (fp,"#\n");
2081  fprintf (fp,"# note that EXHAUSTIVE is really, really, really slow\n");
2082  fprintf (fp,"#\n");
2083  fprintf (fp,"BSEARCH_ALG SIMPLE\n");
2084  fprintf (fp,"\n");
2085  fprintf (fp,"#\n");
2086  fprintf (fp,"# these specify the q-scale for I, P, and B frames\n");
2087  fprintf (fp,"# (values must be between 1 and 31)\n");
2088  fprintf (fp,"# These are the Wscale values for the entire frame in variable bit-rate\n");
2089  fprintf (fp,"# mode, and starting points (but not important) for constant bit rate\n");
2090  fprintf (fp,"#\n");
2091  fprintf (fp,"\n");
2092  fprintf (fp,"# Wscale (Wuantization scale) affects quality and compression,\n");
2093  fprintf (fp,"# but has very little effect on speed.\n");
2094  fprintf (fp,"\n");
2095  fprintf (fp,"IWSCALE 4\n");
2096  fprintf (fp,"PWSCALE 5\n");
2097  fprintf (fp,"BWSCALE 12\n");
2098  fprintf (fp,"\n");
2099  fprintf (fp,"# this must be ORIGINAL or DECODED\n");
2100  fprintf (fp,"REFERENCE_FRAME ORIGINAL\n");
2101  fprintf (fp,"\n");
2102  fprintf (fp,"# for parallel parameters see parallel.param in the exmaples subdirectory\n");
2103  fprintf (fp,"\n");
2104  fprintf (fp,"# if you want constant bit-rate mode, specify it as follows (number is bits/sec):\n");
2105  fprintf (fp,"#BIT_RATE 1000000\n");
2106  fprintf (fp,"\n");
2107  fprintf (fp,"# To specify the buffer size (327680 is default, measused in bits, for 16bit words)\n");
2108  fprintf (fp,"BUFFER_SIZE 327680\n");
2109  fprintf (fp,"\n");
2110  fprintf (fp,"# The frame rate is the number of frames/second (legal values:\n");
2111  fprintf (fp,"# 23.976, 24, 25, 29.97, 30, 50 ,59.94, 60\n");
2112  fprintf (fp,"FRAME_RATE 30\n");
2113  fprintf (fp,"\n");
2114  fprintf (fp,"# There are many more options, see the users manual for examples....\n");
2115  fprintf (fp,"# ASPECT_RATIO, USER_DATA, GAMMA, IWTABLE, etc.\n");
2116  fprintf (fp,"\n");
2117  fprintf (fp,"\n");
2118  fclose (fp);
2119 
2120  setRecordingInfos("Parameter file "+fParameterFileName+" generated in "+fMovieTempFolderPath);
2121  setRecordingStatus(READY_TO_ENCODE);
2122  return true;
2123 }
2124 
2125 void G4OpenGLWtViewer::encodeVideo()
2126 {
2127  if ((getEncoderPath() != "") && (getSaveFileName() != "")) {
2128  setRecordingStatus(ENCODING);
2129 
2130  fProcess = new WProcess();
2131  WObject ::connect(fProcess,SIGNAL(finished ( int)),
2132  this,SLOT(processEncodeFinished()));
2133  WObject ::connect(fProcess,SIGNAL(readyReadStandardOutput ()),
2134  this,SLOT(processEncodeStdout()));
2135  fProcess->setReadChannelMode(WProcess::MergedChannels);
2136  fProcess->start (fEncoderPath, Wt::WStringList(fMovieTempFolderPath+fParameterFileName));
2137  }
2138 }
2139 
2140 
2141 // FIXME : does not work on Wt3
2142 void G4OpenGLWtViewer::processEncodeStdout()
2143 {
2144  Wt::WString tmp = fProcess->readStdout ().data();
2145  int start = tmp.findRev("ESTIMATED TIME");
2146  tmp = tmp.mid(start,tmp.find("\n",start)-start);
2147  setRecordingInfos(tmp);
2148 }
2149 
2150 
2151 void G4OpenGLWtViewer::processEncodeFinished()
2152 {
2153 
2154  Wt::WString txt = "";
2155  txt = getProcessErrorMsg();
2156  if (txt == "") {
2157  setRecordingStatus(SUCCESS);
2158  } else {
2159  setRecordingStatus(FAILED);
2160  }
2161  // setRecordingInfos(txt+removeTempFolder());
2162 }
2163 
2164 
2165 void G4OpenGLWtViewer::processLookForFinished()
2166  {
2167 
2168  Wt::WString txt = getProcessErrorMsg();
2169  if (txt != "") {
2170  fEncoderPath = "";
2171  } else {
2172  fEncoderPath = Wt::WString(fProcess->readAllStandardOutput ().data()).trimmed();
2173  // if not found, return "not found"
2174  if (fEncoderPath.contains(" ")) {
2175  fEncoderPath = "";
2176  } else if (!fEncoderPath.contains("mpeg_encode")) {
2177  fEncoderPath = "";
2178  }
2179  setEncoderPath(fEncoderPath);
2180  }
2181  // init temp folder
2182  setTempFolderPath(WDir::temp ().absolutePath ());
2183 }
2184 
2185 
2186 Wt::WString G4OpenGLWtViewer::getProcessErrorMsg()
2187 {
2188  Wt::WString txt = "";
2189  if (fProcess->exitCode() != 0) {
2190  switch (fProcess->error()) {
2191  case WProcess::FailedToStart:
2192  txt = "The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program.\n";
2193  break;
2194  case WProcess::Crashed:
2195  txt = "The process crashed some time after starting successfully.\n";
2196  break;
2197  case WProcess::Timedout:
2198  txt = "The last waitFor...() function timed out. The state of WProcess is unchanged, and you can try calling waitFor...() again.\n";
2199  break;
2200  case WProcess::WriteError:
2201  txt = "An error occurred when attempting to write to the process. For example, the process may not be running, or it may have closed its input channel.\n";
2202  break;
2203  case WProcess::ReadError:
2204  txt = "An error occurred when attempting to read from the process. For example, the process may not be running.\n";
2205  break;
2206  case WProcess::UnknownError:
2207  txt = "An unknown error occurred. This is the default return value of error().\n";
2208  break;
2209  }
2210  }
2211  return txt;
2212 }
2213 #endif
2214 
2215 
2216 //
2217 // Matrix utility functions
2218 //
2219 
2220 /*
2221 function mvTranslate(v) {
2222  multMatrix(Matrix.Translation($V([v[0], v[1], v[2]])).ensure4x4());
2223 }
2224 
2225 
2226 var mvMatrixStack = [];
2227 
2228 function mvPushMatrix(m) {
2229  if (m) {
2230  mvMatrixStack.push(m.dup());
2231  mvMatrix = m.dup();
2232  } else {
2233  mvMatrixStack.push(mvMatrix.dup());
2234  }
2235 }
2236 
2237 function mvPopMatrix() {
2238  if (!mvMatrixStack.length) {
2239  throw("Can't pop from an empty matrix stack.");
2240  }
2241 
2242  mvMatrix = mvMatrixStack.pop();
2243  return mvMatrix;
2244 }
2245 
2246 function mvRotate(angle, v) {
2247  var inRadians = angle * Math.PI / 180.0;
2248 
2249  var m = Matrix.Rotation(inRadians, $V([v[0], v[1], v[2]])).ensure4x4();
2250  multMatrix(m);
2251 }
2252 */
2253 
2254 
2255 
2256 /*
2257 
2258 void MultiLayer::exportToSVG(const Wt::WString& fname)
2259 {
2260  WPicture picture;
2261  WPainter p(&picture);
2262  for (int i=0;i<(int)graphsList->count();i++)
2263  {
2264  Graph *gr=(Graph *)graphsList->at(i);
2265  Plot *myPlot= (Plot *)gr->plotWidget();
2266 
2267  Wt::WPoint pos=gr->pos();
2268 
2269  int width=int(myPlot->frameGeometry().width());
2270  int height=int(myPlot->frameGeometry().height());
2271 
2272  myPlot->print(&p, WRect(pos,WSize(width,height)));
2273  }
2274 
2275  p.end();
2276  picture.save(fname, "svg");
2277 }
2278 */
2279 #endif
2280 
2281 
2282 
2283 
2284  /*
2285 G4UIWt::CommandEnteredCallback
2286 G4UIWt::CommandEnteredCallback 1
2287 G4UIWt::CommandEnteredCallback 2
2288 G4UIWt::CommandEnteredCallback 3
2289 G4UIWt::CommandEnteredCallback 4
2290 G4VisCommandViewerCreate::SetNewValue Before CreateViewer
2291 G4VisManager::CreateViewer Before CreateViewer
2292 G4OpenGLImmediateWt::CreateViewer
2293 G4OpenGLImmediateWt::CreateViewer after Get Pointer
2294 G4OpenGLImmediateWt::CreateViewer uiWt
2295 G4UIWt::AddTabWidget 50 50
2296 G4UIWt::AddTabWidget 4
2297 G4UIWt::AddTabWidget 5
2298 G4UIWt::AddTabWidget 5a
2299 G4UIWt::AddTabWidget 5a2 69882928 69985360
2300 G4UIWt::AddTabWidget 5b
2301 G4UIWt::AddTabWidget 5c
2302 G4UIWt::AddTabWidget 6
2303 G4UIWt::AddTabWidget ADD 50 50 + 23 1880279432---------------------------------------------------
2304 G4UIWt::AddTabWidget 7
2305 G4UIWt::AddTabWidget 8
2306 G4UIWt::AddTabWidget 9
2307 G4UIWt::AddTabWidget END
2308 G4OpenGLViewer:: Creation
2309 G4OpenGLWtViewer::Create
2310 G4OpenGLWtViewer::G4OpenGLWtViewer END
2311 G4OpenGLImmediateWtViewer INIT
2312 G4OpenGLImmediateWt::CreateViewer lastInsert :68536784
2313 G4OpenGLImmediateWt::CreateViewer END
2314 G4VisManager::CreateViewer After 1 CreateViewer
2315 G4VisManager::CreateViewer After 1 CreateViewer
2316 G4VisManager::CreateViewer After 2 CreateViewer
2317 G4VisManager::CreateViewer After 3 CreateViewer
2318 G4VisManager::CreateViewer After 4 CreateViewer
2319 G4OpenGLImmediateWtViewer::Initialise
2320 G4OpenGLWtViewer::CreateMainWindow
2321 G4OpenGLViewer::ResizeWindow 600 600
2322 G4OpenGLViewer::SetWinSize 600 600
2323 G4VisManager::CreateViewer After 5 CreateViewer
2324 G4VisManager::CreateViewer After 5 CreateViewer
2325 G4VisManager::CreateViewer After 6 CreateViewer
2326 G4VisManager::CreateViewer After 7 CreateViewer
2327 G4VisManager::CreateViewer After 8 CreateViewer
2328 G4VisManager::CreateViewer After 9 CreateViewer
2329 G4VisManager::CreateViewer After END CreateViewer
2330 G4VisCommandViewerCreate::SetNewValue After CreateViewer 1
2331 G4VisCommandViewerCreate::SetNewValue After CreateViewer 2
2332 G4VisCommandViewerCreate::SetNewValue After CreateViewer 3
2333 G4OpenGLViewer::SetView
2334 G4OpenGLViewer::ResizeGLView 600 600 0x104857b40
2335 G4OpenGLViewer::ClearView
2336 G4OpenGLViewer::ClearView set Background :0.040000 .4 .9: 1.000000
2337 G4OpenGLViewer::ClearView flush
2338 G4OpenGLImmediateWtViewer DrawView
2339 G4OpenGLImmediateWtViewer updateWWidget
2340 G4OpenGLImmediateWtViewer paintGL vvvvvvvvvvvvvvvvvvvv
2341  G4OpenGLWtViewer paintGL VVVVVVVVVVVVVVVVVVVVVVVVVV
2342  G4OpenGLViewer::SetView
2343  G4OpenGLViewer::ResizeGLView 600 600 0x104857b40
2344  G4OpenGLViewer::ClearView
2345  G4OpenGLViewer::ClearView set Background :0.080000 .4 .9: 0.000000
2346  G4OpenGLViewer::ClearView flush
2347 #0 G4OpenGLViewer::ClearView (this=0x1049f1540) at src/G4OpenGLViewer.cc:195
2348 #1 0x0000000100353e1d in G4OpenGLWtViewer::paintGL (this=0x1049f0e00) at src/G4OpenGLWtViewer.cc:508
2349 #2 0x000000010030e2bd in G4OpenGLImmediateWtViewer::paintGL (this=0x1049f0e00) at src/G4OpenGLImmediateWtViewer.cc:117
2350 #3 0x000000010030e1b9 in G4OpenGLImmediateWtViewer::updateWWidget (this=0x1049f0e00) at src/G4OpenGLImmediateWtViewer.cc:314
2351 #4 0x000000010030e28e in G4OpenGLImmediateWtViewer::DrawView (this=0x1049f0e00) at src/G4OpenGLImmediateWtViewer.cc:206
2352 #5 0x00000001005fed54 in G4VisCommandViewerRefresh::SetNewValue (this=0x104240e30, newValue=@0x1045436f0) at src/G4VisCommandsViewer.cc:1189
2353 #6 0x0000000101612e04 in ~G4String [inlined] () at src/G4UIcommand.cc:211
2354 #7 0x0000000101612e04 in ~G4String [inlined] () at /Users/garnier/Work/geant4/source/global/management/include/G4String.hh:122
2355 #8 0x0000000101612e04 in G4UIcommand::DoIt (this=<value temporarily unavailable, due to optimizations>, parameterList=<value temporarily unavailable, due to optimizations>) at src/G4UIcommand.cc:211
2356 
2357  G4OpenGLWtViewer drawScene vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
2358  G4OpenGLWtViewer drawArrays
2359  G4OpenGLWtViewer drawArrays
2360  G4OpenGLWtViewer drawArrays
2361  G4OpenGLWtViewer drawArrays
2362  G4OpenGLWtViewer drawScene Call ComputeView
2363  G4OpenGLWtViewer::ComputeView 600 600 VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
2364  G4OpenGLWtViewer drawArrays
2365  G4OpenGLWtViewer::ComputeView NeedKernelVisit
2366  G4OpenGLWtViewer::ComputeView ProcessView
2367  G4VViewer::ProcessView need ? 1
2368  G4VSceneHandler::ProcessScene
2369  G4OpenGLWtViewer::FinishView()
2370  G4VSceneHandler::ProcessScene END
2371  G4VViewer::ProcessView END
2372  G4OpenGLWtViewer::FinishView()
2373  G4OpenGLWtViewer::ComputeView 600 600 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2374  G4OpenGLWtViewer drawScene END Call ComputeView
2375  G4OpenGLWtViewer drawScene END ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2376  G4OpenGLImmediateWtViewer resizeGL
2377  G4OpenGLWtViewer resizeGL 600 600
2378  G4OpenGLWtViewer paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2379 G4OpenGLImmediateWtViewer paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2380 G4OpenGLImmediateWtViewer updateWWidget END
2381 G4OpenGLImmediateWtViewer DrawView END
2382 G4VisCommandViewerCreate::SetNewValue After CreateViewer 4
2383 G4UIWt::CommandEnteredCallback 5
2384 G4UIWt::CommandEnteredCallback 6
2385 G4UIWt::CommandEnteredCallback END
2386 G4UIWt::CommandLineSlot
2387 G4OpenGLWtViewer initializeGL
2388 G4OpenGLWtViewer centerpoint END
2389 G4OpenGLWtViewer initializeGL END
2390 G4OpenGLImmediateWtViewer updateWWidget
2391 G4OpenGLImmediateWtViewer paintGL vvvvvvvvvvvvvvvvvvvv
2392  G4OpenGLWtViewer paintGL VVVVVVVVVVVVVVVVVVVVVVVVVV
2393  G4OpenGLViewer::SetView
2394  G4OpenGLViewer::ResizeGLView 600 600 0x104857b40
2395  G4OpenGLViewer::ClearView
2396  G4OpenGLViewer::ClearView set Background :0.120000 .4 .9: 0.000000
2397  G4OpenGLViewer::ClearView flush
2398 #0 G4OpenGLViewer::ClearView (this=0x1049f1540) at src/G4OpenGLViewer.cc:195
2399 #1 0x0000000100353e1d in G4OpenGLWtViewer::paintGL (this=0x1049f0e00) at src/G4OpenGLWtViewer.cc:508
2400 #2 0x000000010030e2bd in G4OpenGLImmediateWtViewer::paintGL (this=0x1049f0e00) at src/G4OpenGLImmediateWtViewer.cc:117
2401 #3 0x000000010030e1b9 in G4OpenGLImmediateWtViewer::updateWWidget (this=0x1049f0e00) at src/G4OpenGLImmediateWtViewer.cc:314
2402 #4 0x0000000100354e82 in G4OpenGLWtViewer::initializeGL (this=0x1049f0e00) at src/G4OpenGLWtViewer.cc:446
2403 #5 0x000000010283b785 in basic_string [inlined] () at /usr/include/c++/4.2.1/bits/basic_string.h:451
2404 #6 0x000000010283b785 in _Alloc_hider [inlined] () at /Users/garnier/Work/Devel/wt-3.2.0/src/Wt/WGLWidget.C:2067
2405 #7 0x000000010283b785 in basic_string [inlined] () at /Users/garnier/Work/Devel/wt-3.2.0/src/Wt/WGLWidget.C:262
2406 #8 0x000000010283b785 in std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str () at /Users/garnier/Work/Devel/wt-3.2.0/src/Wt/WGLWidget.C:130
2407 #9 std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::str () at /usr/include/c++/4.2.1/sstream:572
2408 
2409 
2410  G4OpenGLWtViewer drawScene vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
2411  G4OpenGLWtViewer drawArrays
2412  G4OpenGLWtViewer drawArrays
2413  G4OpenGLWtViewer drawArrays
2414  G4OpenGLWtViewer drawArrays
2415  G4OpenGLWtViewer drawScene Call ComputeView
2416  G4OpenGLWtViewer::ComputeView 600 600 VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
2417  G4OpenGLWtViewer drawArrays
2418  G4OpenGLWtViewer::ComputeView NeedKernelVisit
2419  G4OpenGLWtViewer::ComputeView ProcessView
2420  G4VViewer::ProcessView need ? 1
2421  G4VSceneHandler::ProcessScene
2422  G4OpenGLWtViewer::FinishView()
2423  G4VSceneHandler::ProcessScene END
2424  G4VViewer::ProcessView END
2425  G4OpenGLWtViewer::FinishView()
2426  G4OpenGLWtViewer::ComputeView 600 600 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2427  G4OpenGLWtViewer drawScene END Call ComputeView
2428  G4OpenGLWtViewer drawScene END ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2429  G4OpenGLImmediateWtViewer resizeGL
2430  G4OpenGLWtViewer resizeGL 600 600
2431  G4OpenGLWtViewer paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2432 G4OpenGLImmediateWtViewer paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2433 G4OpenGLImmediateWtViewer updateWWidget END
2434 G4OpenGLImmediateWtViewer resizeGL
2435 G4OpenGLWtViewer resizeGL 600 600
2436 G4OpenGLImmediateWtViewer paintGL vvvvvvvvvvvvvvvvvvvv
2437  G4OpenGLWtViewer paintGL VVVVVVVVVVVVVVVVVVVVVVVVVV
2438  G4OpenGLViewer::SetView
2439  G4OpenGLViewer::ResizeGLView 600 600 0x104857b40
2440  G4OpenGLViewer::ClearView
2441  G4OpenGLViewer::ClearView set Background :0.160000 .4 .9: 0.000000
2442  G4OpenGLViewer::ClearView flush
2443 #0 G4OpenGLViewer::ClearView (this=0x1049f1540) at src/G4OpenGLViewer.cc:195
2444 #1 0x0000000100353e1d in G4OpenGLWtViewer::paintGL (this=0x1049f0e00) at src/G4OpenGLWtViewer.cc:508
2445 #2 0x000000010030e2bd in G4OpenGLImmediateWtViewer::paintGL (this=0x1049f0e00) at src/G4OpenGLImmediateWtViewer.cc:117
2446 #3 0x000000010283955b in std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::str () at /usr/include/c++/4.2.1/sstream:527
2447 #4 0x000000010283955b in Wt::WGLWidget::updateDom (this=<value temporarily unavailable, due to optimizations>, element=@0x1049e1800, all=true) at /Users/garnier/Work/Devel/wt-3.2.0/src/Wt/WGLWidget.C:531
2448 #5 0x000000010283ba3c in Wt::WGLWidget::createDomElement (this=0x1049f0e00, app=<value temporarily unavailable, due to optimizations>) at /Users/garnier/Work/Devel/wt-3.2.0/src/Wt/WGLWidget.C:473
2449 #6 0x0000000102993cfa in Wt::WWidget::createSDomElement (this=0x1049f0e00, app=0x105021e00) at /Users/garnier/Work/Devel/wt-3.2.0/src/Wt/WWidget.C:326
2450 #7 0x00000001027ebf16 in Wt::WContainerWidget::createDomChildren (this=0x1041c1b50, parent=@0x1049e0c00, app=0x105021e00) at /Users/garnier/Work/Devel/wt-3.2.0/src/Wt/WContainerWidget.C:720
2451 #8 0x00000001027ec5a6 in Wt::WContainerWidget::createDomElement (this=0x1041c1b50, app=0x105021e00, addChildren=true) at /Users/garnier/Work/Devel/wt-3.2.0/src/Wt/WContainerWidget.C:653
2452 #9 0x0000000102993cfa in Wt::WWidget::createSDomElement (this=0x1041c1b50, app=0x105021e00) at /Users/garnier/Work/Devel/wt-3.2.0/src/Wt/WWidget.C:326
2453 #10 0x00000001027ebf16 in Wt::WContainerWidget::createDomChildren (this=0x1041c1cf0, parent=@0x1049f5200, app=0x105021e00) at /Users/garnier/Work/Devel/wt-3.2.0/src/Wt/WContainerWidget.C:720
2454 #11 0x00000001027ec5a6 in Wt::WContainerWidget::createDomElement (this=0x1041c1cf0, app=0x105021e00, addChildren=true) at /Users/garnier/Work/Devel/wt-3.2.0/src/Wt/WContainerWidget.C:653
2455 #12 0x0000000102993cfa in Wt::WWidget::createSDomElement (this=0x1041c1cf0, app=0x105021e00) at /Users/garnier/Work/Devel/wt-3.2.0/src/Wt/WWidget.C:326
2456 #13 0x00000001027eb5a2 in Wt::WContainerWidget::updateDomChildren (this=0x104278560, parent=@0x1049f4600, app=0x105021e00) at /Users/garnier/Work/Devel/wt-3.2.0/src/Wt/WContainerWidget.C:748
2457 #14 0x00000001027ec62d in Wt::WContainerWidget::getDomChanges (this=0x104278560, result=@0x1045449b0, app=0x105021e00) at /Users/garnier/Work/Devel/wt-3.2.0/src/Wt/WContainerWidget.C:632
2458 #15 0x0000000102976c93 in Wt::WWebWidget::getSDomChanges (this=0x104278560, result=@0x1045449b0, app=0x105021e00) at /Users/garnier/Work/Devel/wt-3.2.0/src/Wt/WWebWidget.C:1788
2459 
2460 
2461  G4OpenGLWtViewer drawScene vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
2462  G4OpenGLWtViewer drawArrays
2463  G4OpenGLWtViewer drawArrays
2464  G4OpenGLWtViewer drawArrays
2465  G4OpenGLWtViewer drawArrays
2466  G4OpenGLWtViewer drawScene Call ComputeView
2467  G4OpenGLWtViewer::ComputeView 600 600 VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
2468  G4OpenGLWtViewer drawArrays
2469  G4OpenGLWtViewer::ComputeView NeedKernelVisit
2470  G4OpenGLWtViewer::ComputeView ProcessView
2471  G4VViewer::ProcessView need ? 1
2472  G4VSceneHandler::ProcessScene
2473  G4OpenGLWtViewer::FinishView()
2474  G4VSceneHandler::ProcessScene END
2475  G4VViewer::ProcessView END
2476  G4OpenGLWtViewer::FinishView()
2477  G4OpenGLWtViewer::ComputeView 600 600 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2478  G4OpenGLWtViewer drawScene END Call ComputeView
2479  G4OpenGLWtViewer drawScene END ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2480  G4OpenGLImmediateWtViewer resizeGL
2481  G4OpenGLWtViewer resizeGL 600 600
2482  G4OpenGLWtViewer paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2483 G4OpenGLImmediateWtViewer paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2484  */
const XML_Char * name
Definition: expat.h:151
if(nIso!=0)
#define width
Definition: test07.cc:36
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
G4GLOB_DLL std::ostream G4cout
G4UIsession * GetG4UIWindow() const
Definition: G4UImanager.hh:210
#define G4endl
Definition: G4ios.hh:61
static PROLOG_HANDLER error
Definition: xmlrole.cc:112
double G4double
Definition: G4Types.hh:76
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447
G4GLOB_DLL std::ostream G4cerr