Import Geant4 9.2.0 source tree
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLBitMapStore.cc,v 1.4 2007/11/15 10:14:23 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// John Allison 6th January 2007
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLFontBaseStore.cc,v 1.3 2006/06/29 21:18:56 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
|
||||
#include "G4OpenGLFontBaseStore.hh"
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateQt.cc,v 1.2 2007/11/15 18:24:28 lgarnier Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4OpenGLImmediateQt.cc,v 1.4 2008/10/24 13:49:19 lgarnier Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// OpenGLImmediateQt graphics system factory.
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
G4OpenGLImmediateQt::G4OpenGLImmediateQt ():
|
||||
G4VGraphicsSystem ("OpenGLImmediateQt",
|
||||
"OGLIQT",
|
||||
"OGLIQt",
|
||||
G4VisFeaturesOfOpenGLIQt (),
|
||||
G4VGraphicsSystem::threeD)
|
||||
{
|
||||
@@ -57,7 +57,7 @@ G4VSceneHandler* G4OpenGLImmediateQt::CreateSceneHandler
|
||||
|
||||
G4VViewer* G4OpenGLImmediateQt::CreateViewer
|
||||
(G4VSceneHandler& scene, const G4String& name) {
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLImmediateQt::CreateViewer \n");
|
||||
#endif
|
||||
G4VViewer* pView =
|
||||
@@ -77,7 +77,7 @@ G4VViewer* G4OpenGLImmediateQt::CreateViewer
|
||||
G4cerr << "G4OpenGLImmediateQt::CreateViewer: null pointer on"
|
||||
" new G4OpenGLImmediateQtViewer." << G4endl;
|
||||
}
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLImmediateQt::CreateViewer END \n");
|
||||
#endif
|
||||
return pView;
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateQtViewer.cc,v 1.3 2007/11/15 18:24:28 lgarnier Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4OpenGLImmediateQtViewer.cc,v 1.7 2008/11/06 13:43:44 lgarnier Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Class G4OpenGLImmediateQtViewer : a class derived from G4OpenGLQtViewer and
|
||||
@@ -34,216 +34,243 @@
|
||||
#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
|
||||
|
||||
#include "G4OpenGLImmediateQtViewer.hh"
|
||||
#include "G4VisManager.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
G4OpenGLImmediateQtViewer::G4OpenGLImmediateQtViewer
|
||||
(G4OpenGLImmediateSceneHandler& sceneHandler,
|
||||
const G4String& name):
|
||||
G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
|
||||
G4OpenGLViewer (sceneHandler),
|
||||
G4OpenGLQtViewer (sceneHandler),
|
||||
G4OpenGLImmediateViewer (sceneHandler),
|
||||
QGLWidget() // FIXME : gerer le pb du parent !
|
||||
{
|
||||
nbPaint =0;
|
||||
G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
|
||||
G4OpenGLViewer (sceneHandler),
|
||||
G4OpenGLQtViewer (sceneHandler),
|
||||
G4OpenGLImmediateViewer (sceneHandler)
|
||||
{
|
||||
|
||||
//set true to picking
|
||||
fVP.SetPicking(true);
|
||||
#if QT_VERSION < 0x040000
|
||||
setFocusPolicy(QWidget::StrongFocus); // enable keybord events
|
||||
#else
|
||||
setFocusPolicy(Qt::StrongFocus); // enable keybord events
|
||||
#endif
|
||||
hasToRepaint =false;
|
||||
|
||||
if (fViewId < 0) return; // In case error in base class instantiation.
|
||||
}
|
||||
|
||||
G4OpenGLImmediateQtViewer::~G4OpenGLImmediateQtViewer() {
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("GLWidget::~GLWidget \n");
|
||||
#endif
|
||||
makeCurrent();
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("GLWidget::~GLWidget END\n");
|
||||
#endif
|
||||
makeCurrent();
|
||||
}
|
||||
|
||||
void G4OpenGLImmediateQtViewer::Initialise() {
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("GLWidget::Initialise \n");
|
||||
#endif
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("readyToPaint = false \n");
|
||||
#endif
|
||||
readyToPaint = false;
|
||||
CreateGLQtContext ();
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLImmediateQtViewer::Initialise () 2\n");
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLImmediateQtViewer::Initialise \n");
|
||||
#endif
|
||||
readyToPaint = false;
|
||||
CreateMainWindow (this,QString(fName));
|
||||
CreateFontLists ();
|
||||
|
||||
CreateMainWindow (this);
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLImmediateQtViewer::Initialise () 3\n");
|
||||
#endif
|
||||
|
||||
CreateFontLists (); // FIXME Does nothing!
|
||||
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("readyToPaint = true \n");
|
||||
#endif
|
||||
readyToPaint = true;
|
||||
|
||||
// First Draw
|
||||
SetView();
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf(" ClearView\n");
|
||||
#endif
|
||||
ClearView (); //ok, put the background correct
|
||||
ShowView();
|
||||
FinishView();
|
||||
}
|
||||
|
||||
void G4OpenGLImmediateQtViewer::initializeGL () {
|
||||
|
||||
InitializeGLView ();
|
||||
InitializeGLView ();
|
||||
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLImmediateQtViewer::InitialiseGL () 1\n");
|
||||
#endif
|
||||
|
||||
// If a double buffer context has been forced upon us, ignore the
|
||||
// back buffer for this OpenGLImmediate view.
|
||||
glDrawBuffer (GL_FRONT); // FIXME : Ne marche pas avec cette ligne, mais affiche le run correctement...
|
||||
// clear the buffers and window.
|
||||
ClearView ();
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
// printf("G4OpenGLImmediateQtViewer::InitialiseGL () 2\n");
|
||||
// If a double buffer context has been forced upon us, ignore the
|
||||
// back buffer for this OpenGLImmediate view.
|
||||
// glDrawBuffer (GL_FRONT); // FIXME : Ne marche pas avec cette ligne, mais affiche le run correctement...
|
||||
// clear the buffers and window.
|
||||
ClearView ();
|
||||
FinishView ();
|
||||
|
||||
glDepthFunc (GL_LEQUAL);
|
||||
glDepthMask (GL_TRUE);
|
||||
|
||||
if (fSceneHandler.GetScene() == 0) {
|
||||
hasToRepaint =false;
|
||||
} else {
|
||||
hasToRepaint =true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/** To ensure compatibility with DrawView method
|
||||
*/
|
||||
void G4OpenGLImmediateQtViewer::DrawView() {
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLImmediateQtViewer::DrawView VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n");
|
||||
#endif
|
||||
FinishView ();
|
||||
// That's no the same logic as Stored Viewer, I don't know why...
|
||||
// see G4OpenGLStoredQtViewer::DrawView for more informations
|
||||
|
||||
updateQWidget();
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLImmediateQtViewer::DrawView ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLImmediateQtViewer::ComputeView () {
|
||||
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLImmediateQtViewer::ComputeView %d %d VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n",WinSize_x, WinSize_y);
|
||||
#endif
|
||||
makeCurrent();
|
||||
// If a double buffer context has been forced upon us, ignore the
|
||||
// back buffer for this OpenGLImmediate view.
|
||||
// glDrawBuffer (GL_FRONT);
|
||||
|
||||
G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
|
||||
|
||||
//Make sure current viewer is attached and clean...
|
||||
//Qt version needed
|
||||
// glViewport (0, 0, WinSize_x, WinSize_y);
|
||||
|
||||
if(style!=G4ViewParameters::hlr &&
|
||||
haloing_enabled) {
|
||||
|
||||
HaloingFirstPass ();
|
||||
NeedKernelVisit ();
|
||||
ProcessView ();
|
||||
glFlush ();
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLImmediateQtViewer::ComputeView First ProcessView ok\n");
|
||||
#endif
|
||||
HaloingSecondPass ();
|
||||
|
||||
}
|
||||
|
||||
NeedKernelVisit (); // Always need to visit G4 kernel.
|
||||
ProcessView ();
|
||||
|
||||
if (isRecording()) {
|
||||
savePPMToTemp();
|
||||
}
|
||||
|
||||
|
||||
|
||||
glDepthFunc (GL_LEQUAL);
|
||||
glDepthMask (GL_TRUE);
|
||||
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLImmediateQtViewer::InitialiseGL -------------------------------------------------------------------------------------\n");
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLImmediateQtViewer::ComputeView %d %d ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n",WinSize_x, WinSize_y);
|
||||
#endif
|
||||
hasToRepaint = true;
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLImmediateQtViewer::DrawView () {
|
||||
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLImmediateQtViewer::DrawView %d %d VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n",WinSize_x, WinSize_y);
|
||||
#endif
|
||||
// If a double buffer context has been forced upon us, ignore the
|
||||
// back buffer for this OpenGLImmediate view.
|
||||
glDrawBuffer (GL_FRONT);
|
||||
|
||||
G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
|
||||
|
||||
//Make sure current viewer is attached and clean...
|
||||
//Qt version needed
|
||||
glViewport (0, 0, WinSize_x, WinSize_y);
|
||||
|
||||
if(style!=G4ViewParameters::hlr &&
|
||||
haloing_enabled) {
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLImmediateQtViewer::DrawView DANS LE IF\n");
|
||||
#endif
|
||||
|
||||
HaloingFirstPass ();
|
||||
NeedKernelVisit ();
|
||||
ProcessView ();
|
||||
glFlush ();
|
||||
|
||||
HaloingSecondPass ();
|
||||
|
||||
}
|
||||
|
||||
NeedKernelVisit (); // Always need to visit G4 kernel.
|
||||
ProcessView ();
|
||||
FinishView ();
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLImmediateQtViewer::DrawView %d %d ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n",WinSize_x, WinSize_y);
|
||||
#endif
|
||||
readyToPaint = false;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void G4OpenGLImmediateQtViewer::FinishView (
|
||||
)
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
|
||||
void G4OpenGLImmediateQtViewer::FinishView()
|
||||
{
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLImmediateQtViewer::FinishView VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n");
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLImmediateQtViewer::FinishView() BEGIN\n");
|
||||
#endif
|
||||
|
||||
glFlush ();
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLImmediateQtViewer::FinishView ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
|
||||
glFlush ();
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLImmediateQtViewer::FinishView() END\n");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
- Lors du resize de la fenetre, on doit non pas redessiner le detecteur, mais aussi les evenements
|
||||
*/
|
||||
- Lors du resize de la fenetre, on doit non pas redessiner le detecteur, mais aussi les evenements
|
||||
*/
|
||||
void G4OpenGLImmediateQtViewer::resizeGL(
|
||||
int width
|
||||
,int height)
|
||||
int aWidth
|
||||
,int aHeight)
|
||||
{
|
||||
int side = width;
|
||||
if (width > height) {
|
||||
side = height;
|
||||
}
|
||||
glViewport((width - side) / 2, (height - side) / 2, side, side);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-0.5, +0.5, +0.5, -0.5, 4.0, 15.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLImmediateQtViewer::resizeGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
|
||||
#endif
|
||||
G4resizeGL(aWidth,aHeight);
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLImmediateQtViewer::paintGL()
|
||||
{
|
||||
if (!readyToPaint) {
|
||||
readyToPaint= true;
|
||||
return;
|
||||
}
|
||||
// DO NOT RESIZE IF SIZE HAS NOT CHANGE
|
||||
if (((WinSize_x == (G4int)width())) &&(WinSize_y == (G4int) height())) {
|
||||
return;
|
||||
}
|
||||
nbPaint++;
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("\n\nG4OpenGLImmediateQtViewer::paintGL VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV %d ready %d\n",nbPaint,readyToPaint);
|
||||
{
|
||||
#ifdef G4DEBUG
|
||||
printf("\n\nG4OpenGLImmediateQtViewer::paintGL ??\n");
|
||||
#endif
|
||||
WinSize_x = (G4int) width();
|
||||
WinSize_y = (G4int) height();
|
||||
if (!readyToPaint) {
|
||||
readyToPaint= true;
|
||||
return;
|
||||
}
|
||||
// DO NOT RESIZE IF SIZE HAS NOT CHANGE
|
||||
if ( !hasToRepaint) {
|
||||
if (((WinSize_x == (G4int)width())) &&(WinSize_y == (G4int) height())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLImmediateQtViewer::paintGL VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV ready %d\n",readyToPaint);
|
||||
#endif
|
||||
WinSize_x = (G4int) width();
|
||||
WinSize_y = (G4int) height();
|
||||
|
||||
glViewport (0, 0, width(), height());
|
||||
setupViewport(width(),height());
|
||||
|
||||
SetView();
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
// // printf("before ClearView\n");
|
||||
#endif
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf(" ClearView\n");
|
||||
#endif
|
||||
SetView();
|
||||
|
||||
ClearView (); //ok, put the background correct
|
||||
DrawView();
|
||||
readyToPaint = true; // could be set to false by DrawView
|
||||
ClearView (); //ok, put the background correct
|
||||
ComputeView();
|
||||
|
||||
hasToRepaint = false; // could be set to false by ComputeView
|
||||
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLImmediateQtViewer::paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ %d ready %d\n\n\n",nbPaint,readyToPaint);
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLImmediateQtViewer::paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ready %d\n\n\n",readyToPaint);
|
||||
#endif
|
||||
}
|
||||
|
||||
void G4OpenGLImmediateQtViewer::updateQWidget() {
|
||||
updateGL();
|
||||
}
|
||||
|
||||
void G4OpenGLImmediateQtViewer::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
G4MousePressEvent(event);
|
||||
}
|
||||
|
||||
void G4OpenGLImmediateQtViewer::keyPressEvent (QKeyEvent * event)
|
||||
{
|
||||
G4keyPressEvent(event);
|
||||
}
|
||||
|
||||
void G4OpenGLImmediateQtViewer::wheelEvent (QWheelEvent * event)
|
||||
{
|
||||
G4wheelEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function was build in order to make a zoom on double clic event.
|
||||
* It was think to build a rubberband on the zoom area, but never work fine
|
||||
*/
|
||||
void G4OpenGLImmediateQtViewer::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
{
|
||||
G4MouseDoubleClickEvent();
|
||||
}
|
||||
|
||||
void G4OpenGLImmediateQtViewer::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
G4MouseReleaseEvent();
|
||||
}
|
||||
|
||||
void G4OpenGLImmediateQtViewer::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
G4MouseMoveEvent(event);
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLImmediateQtViewer::contextMenuEvent(QContextMenuEvent *e)
|
||||
{
|
||||
G4manageContextMenuEvent(e);
|
||||
}
|
||||
|
||||
void G4OpenGLImmediateQtViewer::updateQWidget() {
|
||||
hasToRepaint= true;
|
||||
updateGL();
|
||||
hasToRepaint= false;
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLImmediateQtViewer::ShowView (
|
||||
)
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
|
||||
{
|
||||
#if QT_VERSION < 0x040000
|
||||
setActiveWindow();
|
||||
#else
|
||||
activateWindow();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateSceneHandler.cc,v 1.27 2007/04/04 16:50:26 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4OpenGLImmediateSceneHandler.cc,v 1.30 2008/04/04 13:32:22 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
@@ -129,11 +129,14 @@ void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4NURBS& nurbs)
|
||||
}
|
||||
|
||||
void G4OpenGLImmediateSceneHandler::BeginPrimitives
|
||||
(const G4Transform3D& objectTransformation) {
|
||||
(const G4Transform3D& objectTransformation)
|
||||
{
|
||||
G4OpenGLSceneHandler::BeginPrimitives (objectTransformation);
|
||||
glPushMatrix();
|
||||
|
||||
G4OpenGLTransform3D oglt (objectTransformation);
|
||||
|
||||
glPushMatrix();
|
||||
|
||||
/*************************** Check matrix.
|
||||
const GLdouble* m = oglt.GetGLMatrix ();
|
||||
G4cout << "G4OpenGLTransform3D matrix:";
|
||||
@@ -157,19 +160,22 @@ void G4OpenGLImmediateSceneHandler::EndPrimitives ()
|
||||
G4OpenGLSceneHandler::EndPrimitives ();
|
||||
}
|
||||
|
||||
void G4OpenGLImmediateSceneHandler::BeginPrimitives2D()
|
||||
void G4OpenGLImmediateSceneHandler::BeginPrimitives2D
|
||||
(const G4Transform3D& objectTransformation)
|
||||
{
|
||||
G4OpenGLSceneHandler::BeginPrimitives2D();
|
||||
G4OpenGLSceneHandler::BeginPrimitives2D(objectTransformation);
|
||||
|
||||
// Push current 3D world matrices and load identity to define screen
|
||||
// coordinates...
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho (-1., 1., -1., 1., -G4OPENGL_DBL_MAX, G4OPENGL_DBL_MAX);
|
||||
glOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
G4OpenGLTransform3D oglt (objectTransformation);
|
||||
glMultMatrixd (oglt.GetGLMatrix ());
|
||||
}
|
||||
|
||||
void G4OpenGLImmediateSceneHandler::EndPrimitives2D()
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateViewer.cc,v 1.8 2006/09/04 12:07:59 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 7th February 1997
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateWin32.cc,v 1.11 2006/08/14 12:07:19 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// OpenGLImmediateWin32 graphics system factory.
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateWin32Viewer.cc,v 1.16 2006/07/03 16:38:13 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Class G4OpenGLImmediateWin32Viewer : a class derived from G4OpenGLWin32Viewer and
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateX.cc,v 1.13 2007/08/21 14:05:51 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 27th March 1996
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateXViewer.cc,v 1.16 2006/07/03 16:38:13 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 7th February 1997
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateXm.cc,v 1.13 2006/08/14 12:07:19 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateXmViewer.cc,v 1.17 2006/07/03 16:38:13 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLQtExportDialog.cc,v 1.4 2007/11/13 17:48:51 lgarnier Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4OpenGLQtExportDialog.cc,v 1.9 2008/10/24 14:17:10 lgarnier Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
|
||||
@@ -44,14 +44,16 @@
|
||||
#include <qradiobutton.h>
|
||||
#include <qimage.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qbuttongroup.h>
|
||||
|
||||
G4OpenGLQtExportDialog::G4OpenGLQtExportDialog(
|
||||
QWidget* parent
|
||||
,QString nomFich
|
||||
,QString format
|
||||
,int aHeight
|
||||
,int aWidth
|
||||
)
|
||||
: QDialog( parent )
|
||||
: QDialog( parent ),
|
||||
isChangingSize(false)
|
||||
{
|
||||
#if QT_VERSION < 0x040000
|
||||
setCaption( tr( " Export options" ));
|
||||
@@ -69,33 +71,227 @@ G4OpenGLQtExportDialog::G4OpenGLQtExportDialog(
|
||||
BWButton = NULL;
|
||||
|
||||
// global layout
|
||||
#if QT_VERSION < 0x040000
|
||||
QVBoxLayout* globalVLayout = new QVBoxLayout(this);
|
||||
#else
|
||||
QVBoxLayout* globalVLayout = new QVBoxLayout();
|
||||
#endif
|
||||
|
||||
globalVLayout->setMargin(10);
|
||||
globalVLayout->setSpacing(10);
|
||||
|
||||
if (nomFich.endsWith(".jpg") ||
|
||||
nomFich.endsWith(".jepg")) {
|
||||
|
||||
|
||||
// FIXME : L. Garnier 4/12/07
|
||||
// Not implented. Should deal with alpha channel
|
||||
|
||||
// if((format == "tif") ||
|
||||
// (format == "tiff") ||
|
||||
// (format == "jpg") ||
|
||||
// (format == "jpeg") ||
|
||||
// (format == "png") ||
|
||||
// (format == "xpm")) {
|
||||
|
||||
// QGroupBox *transparencyGroupBox = new QGroupBox(tr("Transparency"),this);
|
||||
// QVBoxLayout *transparencyGroupBoxLayout = new QVBoxLayout(transparencyGroupBox);
|
||||
|
||||
// boxTransparency = new QCheckBox("Save transparency",transparencyGroupBox);
|
||||
// boxTransparency->setChecked( false );
|
||||
|
||||
// transparencyGroupBoxLayout->addWidget(boxTransparency);
|
||||
// #if QT_VERSION >= 0x040000
|
||||
// transparencyGroupBox->setLayout(transparencyGroupBoxLayout);
|
||||
// #endif
|
||||
// globalVLayout->addWidget(transparencyGroupBox);
|
||||
|
||||
// }
|
||||
|
||||
// FIXME : L. Garnier 4/12/07
|
||||
// This is not working for PS and PDF images, it does nothing.
|
||||
// Image is staying in color mode
|
||||
// if ((format == "ps") || (format == "pdf") || (format == "eps")) {
|
||||
|
||||
|
||||
// size box
|
||||
|
||||
QWidget * sizeWidget = new QWidget(this); // widget containing group button
|
||||
QVBoxLayout * sizeWidgetLayout = new QVBoxLayout(sizeWidget);
|
||||
sizeWidgetLayout->setMargin (10);
|
||||
|
||||
// original and modify radiobuttons
|
||||
#if QT_VERSION < 0x040000
|
||||
QButtonGroup * sizeButtonGroupBox = new QButtonGroup ( 2,Qt::Vertical, tr("Size"),this);
|
||||
sizeButtonGroupBox->setInsideMargin (15);
|
||||
|
||||
original = new QRadioButton("Original",sizeButtonGroupBox);
|
||||
modify = new QRadioButton("Modify",sizeButtonGroupBox);
|
||||
|
||||
sizeButtonGroupBox->insert(original);
|
||||
sizeButtonGroupBox->insert(modify);
|
||||
sizeButtonGroupBox->setExclusive(true);
|
||||
sizeWidgetLayout->add(sizeButtonGroupBox);
|
||||
|
||||
connect( sizeButtonGroupBox, SIGNAL( clicked(int) ), this, SLOT( changeSizeBox()) );
|
||||
#else
|
||||
|
||||
sizeGroupBox = new QGroupBox(tr("Size"));
|
||||
QVBoxLayout *sizeGroupBoxLayout = new QVBoxLayout(sizeGroupBox);
|
||||
QButtonGroup * sizeButtonGroupBox = new QButtonGroup();
|
||||
sizeGroupBoxLayout->setMargin (15);
|
||||
|
||||
original = new QRadioButton("Original");
|
||||
modify = new QRadioButton("Modify");
|
||||
|
||||
sizeButtonGroupBox->addButton(original);
|
||||
sizeButtonGroupBox->addButton(modify);
|
||||
sizeButtonGroupBox->setExclusive(true);
|
||||
|
||||
sizeGroupBoxLayout->addWidget(original);
|
||||
sizeGroupBoxLayout->addWidget(modify);
|
||||
|
||||
sizeGroupBox->setLayout(sizeGroupBoxLayout);
|
||||
sizeWidgetLayout->addWidget(sizeGroupBox);
|
||||
|
||||
connect( sizeButtonGroupBox, SIGNAL( buttonClicked(QAbstractButton*) ), this, SLOT( changeSizeBox()) );
|
||||
#endif
|
||||
original->setChecked( true );
|
||||
|
||||
|
||||
// height
|
||||
heightWidget = new QWidget(sizeWidget);
|
||||
|
||||
QHBoxLayout *heightLineLayout = new QHBoxLayout(heightWidget);
|
||||
|
||||
QString tmp;
|
||||
|
||||
heightLineLayout->addWidget(new QLabel("Height",heightWidget));
|
||||
height = new QLineEdit(tmp.setNum(originalHeight),heightWidget);
|
||||
height->setMaxLength(5);
|
||||
#if QT_VERSION < 0x040000
|
||||
heightLineLayout->add(height);
|
||||
#else
|
||||
heightLineLayout->addWidget(height);
|
||||
#endif
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
heightWidget->setLayout(heightLineLayout);
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
sizeWidgetLayout->add(heightWidget);
|
||||
#else
|
||||
sizeWidgetLayout->addWidget(heightWidget);
|
||||
#endif
|
||||
connect( height, SIGNAL( textChanged ( const QString& ) ), this, SLOT( textHeightChanged(const QString &) ) );
|
||||
|
||||
|
||||
// width
|
||||
widthWidget = new QWidget(sizeWidget);
|
||||
|
||||
QHBoxLayout *widthLineLayout = new QHBoxLayout(widthWidget);
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
widthLineLayout->add(new QLabel("Width ",widthWidget));
|
||||
#else
|
||||
widthLineLayout->addWidget(new QLabel("Width ",widthWidget));
|
||||
#endif
|
||||
width = new QLineEdit(tmp.setNum(originalWidth),widthWidget);
|
||||
width->setMaxLength(5);
|
||||
#if QT_VERSION < 0x040000
|
||||
widthLineLayout->add(width);
|
||||
#else
|
||||
widthLineLayout->addWidget(width);
|
||||
#endif
|
||||
#if QT_VERSION >= 0x040000
|
||||
widthWidget->setLayout(widthLineLayout);
|
||||
#endif
|
||||
#if QT_VERSION < 0x040000
|
||||
sizeWidgetLayout->add(widthWidget);
|
||||
#else
|
||||
sizeWidgetLayout->addWidget(widthWidget);
|
||||
#endif
|
||||
connect( width, SIGNAL( textChanged ( const QString& ) ), this, SLOT( textWidthChanged(const QString &) ) );
|
||||
|
||||
|
||||
|
||||
// ratio check box
|
||||
|
||||
ratioCheckBox = new QCheckBox( "Keep ratio",sizeWidget);
|
||||
ratioCheckBox->setChecked( true );
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
sizeWidgetLayout->add(ratioCheckBox);
|
||||
#else
|
||||
sizeWidgetLayout->addWidget(ratioCheckBox);
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
ratioCheckBox->setEnabled ( false );
|
||||
heightWidget->setEnabled ( false );
|
||||
widthWidget->setEnabled ( false );
|
||||
#else
|
||||
ratioCheckBox->hide();
|
||||
heightWidget->hide();
|
||||
widthWidget->hide();
|
||||
#endif
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
sizeWidget->setLayout(sizeWidgetLayout);
|
||||
#endif
|
||||
globalVLayout->addWidget(sizeWidget);
|
||||
|
||||
if (format == "eps") {
|
||||
|
||||
QGroupBox *EPSWidgetGroupBox = new QGroupBox(tr("EPS options"),this); // widget containing group button
|
||||
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
|
||||
EPSWidgetGroupBox->setInsideMargin (15);
|
||||
|
||||
// QButtonGroup * EPSColorButtonGroupBox = new QButtonGroup( 2,Qt::Vertical, tr("EPS options"),this);
|
||||
// EPSGroupBoxLayout = new QVBoxLayout(EPSColorButtonGroupBox);
|
||||
// colorButton = new QRadioButton("Color",EPSColorButtonGroupBox);
|
||||
// BWButton = new QRadioButton("Grayscale",EPSColorButtonGroupBox);
|
||||
// EPSColorButtonGroupBox->setInsideMargin (15);
|
||||
// EPSColorButtonGroupBox->insert(colorButton);
|
||||
// EPSColorButtonGroupBox->insert(BWButton);
|
||||
// EPSColorButtonGroupBox->setExclusive(true);
|
||||
// EPSWidgetGroupBox->add(EPSColorButtonGroupBox);
|
||||
|
||||
vectorEPSCheckBox = new QCheckBox( "Vector EPS File",EPSWidgetGroupBox);
|
||||
|
||||
#else
|
||||
QVBoxLayout * EPSGroupBoxLayout = new QVBoxLayout(EPSWidgetGroupBox);
|
||||
EPSGroupBoxLayout->setMargin (15);
|
||||
|
||||
// colorButton = new QRadioButton("Color",EPSWidgetGroupBox);
|
||||
// BWButton = new QRadioButton("Grayscale",EPSWidgetGroupBox);
|
||||
|
||||
// QButtonGroup * EPSColorButtonGroupBox = new QButtonGroup();
|
||||
// EPSColorButtonGroupBox->addButton(colorButton);
|
||||
// EPSColorButtonGroupBox->addButton(BWButton);
|
||||
// EPSColorButtonGroupBox->setExclusive(true);
|
||||
|
||||
// EPSGroupBoxLayout->addWidget(colorButton);
|
||||
// EPSGroupBoxLayout->addWidget(BWButton);
|
||||
|
||||
vectorEPSCheckBox = new QCheckBox( "Vector EPS File",EPSWidgetGroupBox);
|
||||
EPSGroupBoxLayout->addWidget(vectorEPSCheckBox);
|
||||
|
||||
EPSWidgetGroupBox->setLayout(EPSGroupBoxLayout);
|
||||
#endif
|
||||
// colorButton->setChecked( true );
|
||||
vectorEPSCheckBox->setChecked( true );
|
||||
|
||||
QGroupBox *imageGroupBox = new QGroupBox(tr("Image quality"));
|
||||
#if QT_VERSION < 0x040000
|
||||
QVBoxLayout *imageGroupBoxLayout = new QVBoxLayout(imageGroupBox);
|
||||
#else
|
||||
QVBoxLayout *imageGroupBoxLayout = new QVBoxLayout;
|
||||
#endif
|
||||
QWidget *sliderBox = new QWidget;
|
||||
globalVLayout->addWidget(EPSWidgetGroupBox);
|
||||
connect( vectorEPSCheckBox, SIGNAL( clicked() ), this, SLOT( changeVectorEPS()) );
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
QHBoxLayout *hSlider = new QHBoxLayout(sliderBox);
|
||||
#else
|
||||
QHBoxLayout *hSlider = new QHBoxLayout;
|
||||
#endif
|
||||
}
|
||||
|
||||
// qualityLabel = new QLabel( tr( "Image quality" ) );
|
||||
// imageGroupBoxLayout->addWidget(qualityLabel);
|
||||
qualitySlider= new QSlider(Qt::Horizontal,0);
|
||||
if ((format == "jpg") ||
|
||||
(format == "jpeg")) {
|
||||
|
||||
QGroupBox *imageGroupBox = new QGroupBox(tr("Image quality"),this);
|
||||
QHBoxLayout *hSliderLayout = new QHBoxLayout(imageGroupBox);
|
||||
hSliderLayout->setMargin (15);
|
||||
|
||||
qualitySlider= new QSlider(Qt::Horizontal,imageGroupBox);
|
||||
#if QT_VERSION < 0x040000
|
||||
qualitySlider->setMinValue(0);
|
||||
qualitySlider->setMaxValue(100);
|
||||
@@ -106,185 +302,38 @@ G4OpenGLQtExportDialog::G4OpenGLQtExportDialog(
|
||||
qualitySlider->setTickPosition(QSlider::TicksBelow);
|
||||
#endif
|
||||
qualitySlider->setValue(60);
|
||||
hSlider->addWidget(new QLabel("low",0));
|
||||
hSlider->addWidget(qualitySlider);
|
||||
hSlider->addWidget(new QLabel("Maximum",0));
|
||||
hSliderLayout->addWidget(new QLabel("Low ",imageGroupBox));
|
||||
hSliderLayout->addWidget(qualitySlider);
|
||||
hSliderLayout->addWidget(new QLabel(" Maximum",imageGroupBox));
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
sliderBox->setLayout(hSlider);
|
||||
imageGroupBox->setLayout(hSliderLayout);
|
||||
#endif
|
||||
imageGroupBoxLayout->addWidget(sliderBox);
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
imageGroupBox->setLayout(imageGroupBoxLayout);
|
||||
#endif
|
||||
globalVLayout->addWidget(imageGroupBox);
|
||||
}
|
||||
|
||||
if(nomFich.endsWith(".eps")) {
|
||||
QGroupBox *EPSGroupBox = new QGroupBox(tr("EPS options"));
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
QVBoxLayout *EPSGroupBoxLayout = new QVBoxLayout(EPSGroupBox);
|
||||
#else
|
||||
QVBoxLayout *EPSGroupBoxLayout = new QVBoxLayout;
|
||||
#endif
|
||||
|
||||
// transparencyEPS = new QCheckBox( "transparencyEPS" );
|
||||
// transparencyEPS->setText( "save background" );
|
||||
// transparencyEPS->setChecked( true );
|
||||
|
||||
colorButton = new QRadioButton("Color",0);
|
||||
BWButton = new QRadioButton("Grayscale",0);
|
||||
colorButton->setChecked( true );
|
||||
BWButton->setChecked( false );
|
||||
|
||||
|
||||
// EPSGroupBoxLayout->addWidget(transparencyEPS);
|
||||
EPSGroupBoxLayout->addWidget(colorButton);
|
||||
EPSGroupBoxLayout->addWidget(BWButton);
|
||||
#if QT_VERSION >= 0x040000
|
||||
EPSGroupBox->setLayout(EPSGroupBoxLayout);
|
||||
#endif
|
||||
globalVLayout->addWidget(EPSGroupBox);
|
||||
|
||||
}
|
||||
|
||||
if(nomFich.endsWith(".tif") ||
|
||||
nomFich.endsWith(".tiff") ||
|
||||
nomFich.endsWith(".jpg") ||
|
||||
nomFich.endsWith(".png") ||
|
||||
nomFich.endsWith(".xpm")) {
|
||||
|
||||
QGroupBox *transparencyGroupBox = new QGroupBox(tr("Transparency"));
|
||||
#if QT_VERSION < 0x040000
|
||||
QVBoxLayout *transparencyGroupBoxLayout = new QVBoxLayout(transparencyGroupBox);
|
||||
#else
|
||||
QVBoxLayout *transparencyGroupBoxLayout = new QVBoxLayout;
|
||||
#endif
|
||||
|
||||
boxTransparency = new QCheckBox("Save transparency",0);
|
||||
boxTransparency->setChecked( false );
|
||||
// boxTransparency->setEnabled(false);
|
||||
|
||||
transparencyGroupBoxLayout->addWidget(boxTransparency);
|
||||
#if QT_VERSION >= 0x040000
|
||||
transparencyGroupBox->setLayout(transparencyGroupBoxLayout);
|
||||
#endif
|
||||
globalVLayout->addWidget(transparencyGroupBox);
|
||||
|
||||
}
|
||||
|
||||
// size box
|
||||
QGroupBox *sizeGroupBox = new QGroupBox(tr("Size"));
|
||||
QWidget* modifyAndRatioWidget = new QWidget;
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
QHBoxLayout *modifyAndRatioLayout = new QHBoxLayout(modifyAndRatioWidget);
|
||||
QVBoxLayout *sizeGroupBoxLayout = new QVBoxLayout(sizeGroupBox);
|
||||
#else
|
||||
QHBoxLayout *modifyAndRatioLayout = new QHBoxLayout;
|
||||
QVBoxLayout *sizeGroupBoxLayout = new QVBoxLayout;
|
||||
#endif
|
||||
|
||||
// original button
|
||||
original = new QRadioButton("Original",0);
|
||||
original->setChecked( true );
|
||||
sizeGroupBoxLayout->addWidget(original);
|
||||
|
||||
// modify and ratio
|
||||
modify = new QRadioButton("Modify",0);
|
||||
modify->setChecked( false );
|
||||
|
||||
ratioCheckBox = new QCheckBox( "Keep ratio",0 );
|
||||
ratioCheckBox->setChecked( true );
|
||||
|
||||
modifyAndRatioLayout->addWidget(modify);
|
||||
modifyAndRatioLayout->addWidget(ratioCheckBox);
|
||||
#if QT_VERSION >= 0x040000
|
||||
modifyAndRatioWidget->setLayout(modifyAndRatioLayout);
|
||||
#endif
|
||||
sizeGroupBoxLayout->addWidget(modifyAndRatioWidget);
|
||||
if (modify->isChecked()) {
|
||||
ratioCheckBox->show();
|
||||
} else {
|
||||
ratioCheckBox->hide();
|
||||
}
|
||||
|
||||
connect( original, SIGNAL( clicked(bool) ), this, SLOT( changeSizeBox(true)) );
|
||||
connect( modify, SIGNAL( clicked(bool) ), this, SLOT( changeSizeBox(false) ) );
|
||||
|
||||
// height
|
||||
heightWidget = new QWidget;
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
QHBoxLayout *heightLineLayout = new QHBoxLayout(heightWidget);
|
||||
#else
|
||||
QHBoxLayout *heightLineLayout = new QHBoxLayout;
|
||||
#endif
|
||||
|
||||
QString tmp;
|
||||
|
||||
heightLineLayout->addWidget(new QLabel("Height",0));
|
||||
height = new QLineEdit(tmp.setNum(originalHeight),0);
|
||||
height->setMaxLength(5);
|
||||
heightLineLayout->addWidget(height);
|
||||
#if QT_VERSION >= 0x040000
|
||||
heightWidget->setLayout(heightLineLayout);
|
||||
#endif
|
||||
sizeGroupBoxLayout->addWidget(heightWidget);
|
||||
connect( height, SIGNAL( textChanged ( const QString& ) ), this, SLOT( textHeightChanged(const QString &) ) );
|
||||
|
||||
|
||||
// width
|
||||
widthWidget = new QWidget;
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
QHBoxLayout *widthLineLayout = new QHBoxLayout(widthWidget);
|
||||
#else
|
||||
QHBoxLayout *widthLineLayout = new QHBoxLayout;
|
||||
#endif
|
||||
|
||||
widthLineLayout->addWidget(new QLabel("Width ",0));
|
||||
width = new QLineEdit(tmp.setNum(originalWidth),0);
|
||||
width->setMaxLength(5);
|
||||
widthLineLayout->addWidget(width);
|
||||
#if QT_VERSION >= 0x040000
|
||||
widthWidget->setLayout(widthLineLayout);
|
||||
#endif
|
||||
sizeGroupBoxLayout->addWidget(widthWidget);
|
||||
connect( width, SIGNAL( textChanged ( const QString& ) ), this, SLOT( textWidthChanged(const QString &) ) );
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
sizeGroupBox->setLayout(sizeGroupBoxLayout);
|
||||
#endif
|
||||
globalVLayout->addWidget(sizeGroupBox);
|
||||
|
||||
heightWidget->hide();
|
||||
widthWidget->hide();
|
||||
|
||||
// button ok/cancel box
|
||||
|
||||
QGroupBox *buttonGroupBox = new QGroupBox();
|
||||
QWidget *buttonBox = new QWidget(this);
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
QHBoxLayout *buttonGroupBoxLayout = new QHBoxLayout(buttonGroupBox);
|
||||
#else
|
||||
QHBoxLayout *buttonGroupBoxLayout = new QHBoxLayout;
|
||||
#endif
|
||||
QHBoxLayout *buttonBoxLayout = new QHBoxLayout(buttonBox);
|
||||
|
||||
buttonOk = new QPushButton( tr( "&OK" ),0 );
|
||||
buttonOk = new QPushButton( tr( "&OK" ),buttonBox );
|
||||
buttonOk->setAutoDefault( TRUE );
|
||||
buttonOk->setDefault( TRUE );
|
||||
buttonGroupBoxLayout->addWidget(buttonOk);
|
||||
buttonBoxLayout->addWidget(buttonOk);
|
||||
|
||||
buttonCancel = new QPushButton( tr( "&Cancel" ),0 );
|
||||
buttonCancel = new QPushButton( tr( "&Cancel" ),buttonBox );
|
||||
buttonCancel->setAutoDefault( TRUE );
|
||||
buttonGroupBoxLayout->addWidget(buttonCancel);
|
||||
buttonBoxLayout->addWidget(buttonCancel);
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
buttonGroupBox->setLayout(buttonGroupBoxLayout);
|
||||
buttonBox->setLayout(buttonBoxLayout);
|
||||
#endif
|
||||
globalVLayout->addWidget(buttonGroupBox);
|
||||
globalVLayout->addWidget(buttonBox);
|
||||
|
||||
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
@@ -306,17 +355,17 @@ int G4OpenGLQtExportDialog::getSliderValue()
|
||||
|
||||
int G4OpenGLQtExportDialog::getHeight()
|
||||
{
|
||||
if (!height) return -1;
|
||||
if (!height) return originalHeight;
|
||||
return height->text().toInt();
|
||||
}
|
||||
|
||||
int G4OpenGLQtExportDialog::getWidth()
|
||||
{
|
||||
if (!width) return -1;
|
||||
if (!width) return originalWidth;
|
||||
return width->text().toInt();
|
||||
}
|
||||
|
||||
bool G4OpenGLQtExportDialog::getTransparency()
|
||||
int G4OpenGLQtExportDialog::getTransparency()
|
||||
{
|
||||
if (!boxTransparency) return -1;
|
||||
return boxTransparency->isChecked();
|
||||
@@ -324,6 +373,7 @@ bool G4OpenGLQtExportDialog::getTransparency()
|
||||
|
||||
int G4OpenGLQtExportDialog::getNbColor()
|
||||
{
|
||||
if (!colorButton) return -1;
|
||||
// Black and white
|
||||
if (!colorButton->isChecked())
|
||||
return 1;
|
||||
@@ -331,32 +381,89 @@ int G4OpenGLQtExportDialog::getNbColor()
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLQtExportDialog::changeSizeBox(bool aClick)
|
||||
bool G4OpenGLQtExportDialog::getVectorEPS()
|
||||
{
|
||||
if (aClick) {
|
||||
modify->toggle();
|
||||
if (!vectorEPSCheckBox) return 0;
|
||||
return vectorEPSCheckBox->isChecked();
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLQtExportDialog::changeVectorEPS()
|
||||
{
|
||||
if (!vectorEPSCheckBox) return;
|
||||
if (vectorEPSCheckBox->isChecked()) {
|
||||
#if QT_VERSION < 0x040000
|
||||
original->setEnabled ( true );
|
||||
modify->setEnabled ( true );
|
||||
#else
|
||||
sizeGroupBox->show();
|
||||
original->show();
|
||||
modify->show();
|
||||
#endif
|
||||
changeSizeBox();
|
||||
} else {
|
||||
original->toggle();
|
||||
}
|
||||
if ( original->isChecked()) {
|
||||
#if QT_VERSION < 0x040000
|
||||
original->setEnabled ( false );
|
||||
modify->setEnabled ( false );
|
||||
ratioCheckBox->setEnabled ( false );
|
||||
heightWidget->setEnabled ( false );
|
||||
widthWidget->setEnabled ( false );
|
||||
#else
|
||||
sizeGroupBox->hide();
|
||||
original->hide();
|
||||
modify->hide();
|
||||
ratioCheckBox->hide();
|
||||
heightWidget->hide();
|
||||
widthWidget->hide();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLQtExportDialog::changeSizeBox()
|
||||
{
|
||||
if (!original) return;
|
||||
if (!heightWidget) return;
|
||||
if (!widthWidget) return;
|
||||
if (!ratioCheckBox) return;
|
||||
|
||||
if ( original->isChecked()) {
|
||||
#if QT_VERSION < 0x040000
|
||||
ratioCheckBox->setEnabled ( false );
|
||||
heightWidget->setEnabled ( false );
|
||||
widthWidget->setEnabled ( false );
|
||||
#else
|
||||
ratioCheckBox->hide();
|
||||
heightWidget->hide();
|
||||
widthWidget->hide();
|
||||
#endif
|
||||
} else {
|
||||
#if QT_VERSION < 0x040000
|
||||
ratioCheckBox->setEnabled ( true );
|
||||
heightWidget->setEnabled ( true );
|
||||
widthWidget->setEnabled ( true );
|
||||
#else
|
||||
heightWidget->show();
|
||||
widthWidget->show();
|
||||
ratioCheckBox->show();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLQtExportDialog::textWidthChanged(
|
||||
const QString & s
|
||||
)
|
||||
{
|
||||
if (!ratioCheckBox) return;
|
||||
if (!width) return;
|
||||
if (isChangingSize == true) return; // exclusive slot
|
||||
|
||||
if (ratioCheckBox->isChecked()){
|
||||
isChangingSize = true;
|
||||
QString tmp;
|
||||
width->setText(tmp.setNum(s.toInt()*originalHeight/originalHeight));
|
||||
height->setText(tmp.setNum((int)(s.toInt()*(double)((double)originalHeight/(double)originalWidth))));
|
||||
isChangingSize = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,9 +471,15 @@ void G4OpenGLQtExportDialog:: textHeightChanged(
|
||||
const QString & s
|
||||
)
|
||||
{
|
||||
if (!ratioCheckBox) return;
|
||||
if (!width) return;
|
||||
if (isChangingSize == true) return; // exclusive slot
|
||||
|
||||
if (ratioCheckBox->isChecked()){
|
||||
isChangingSize = true;
|
||||
QString tmp;
|
||||
width->setText(tmp.setNum(s.toInt()*originalWidth/originalWidth));
|
||||
width->setText(tmp.setNum(s.toInt()*originalWidth/originalHeight));
|
||||
isChangingSize = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,206 +0,0 @@
|
||||
/****************************************************************************
|
||||
** G4OpenGLQtExportDialog meta object code from reading C++ file 'G4OpenGLQtExportDialog.hh'
|
||||
**
|
||||
** Created: Mon Nov 12 10:36:59 2007
|
||||
** by: The Qt MOC ($Id: G4OpenGLQtExportDialog_moc.cc,v 1.5 2007/11/14 11:49:00 lgarnier Exp $)
|
||||
**
|
||||
** WARNING! All changes made in this file will be lost!
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
|
||||
|
||||
#undef QT_NO_COMPAT
|
||||
#include "../include/G4OpenGLQtExportDialog.hh"
|
||||
#include <qmetaobject.h>
|
||||
#include <qapplication.h>
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
|
||||
#include <private/qucomextra_p.h>
|
||||
#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26)
|
||||
#error "This file was generated using the moc from 3.3.5. It"
|
||||
#error "cannot be used with the include files from this version of Qt."
|
||||
#error "(The moc has changed too much.)"
|
||||
#endif
|
||||
|
||||
const char *G4OpenGLQtExportDialog::className() const
|
||||
{
|
||||
return "G4OpenGLQtExportDialog";
|
||||
}
|
||||
|
||||
QMetaObject *G4OpenGLQtExportDialog::metaObj = 0;
|
||||
static QMetaObjectCleanUp cleanUp_G4OpenGLQtExportDialog( "G4OpenGLQtExportDialog", &G4OpenGLQtExportDialog::staticMetaObject );
|
||||
|
||||
#ifndef QT_NO_TRANSLATION
|
||||
QString G4OpenGLQtExportDialog::tr( const char *s, const char *c )
|
||||
{
|
||||
if ( qApp )
|
||||
return qApp->translate( "G4OpenGLQtExportDialog", s, c, QApplication::DefaultCodec );
|
||||
else
|
||||
return QString::fromLatin1( s );
|
||||
}
|
||||
#ifndef QT_NO_TRANSLATION_UTF8
|
||||
QString G4OpenGLQtExportDialog::trUtf8( const char *s, const char *c )
|
||||
{
|
||||
if ( qApp )
|
||||
return qApp->translate( "G4OpenGLQtExportDialog", s, c, QApplication::UnicodeUTF8 );
|
||||
else
|
||||
return QString::fromUtf8( s );
|
||||
}
|
||||
#endif // QT_NO_TRANSLATION_UTF8
|
||||
|
||||
#endif // QT_NO_TRANSLATION
|
||||
|
||||
QMetaObject* G4OpenGLQtExportDialog::staticMetaObject()
|
||||
{
|
||||
if ( metaObj )
|
||||
return metaObj;
|
||||
QMetaObject* parentObject = QDialog::staticMetaObject();
|
||||
static const QUParameter param_slot_0[] = {
|
||||
{ 0, &static_QUType_bool, 0, QUParameter::In }
|
||||
};
|
||||
static const QUMethod slot_0 = {"changeSizeBox", 1, param_slot_0 };
|
||||
static const QUParameter param_slot_1[] = {
|
||||
{ 0, &static_QUType_QString, 0, QUParameter::In }
|
||||
};
|
||||
static const QUMethod slot_1 = {"textWidthChanged", 1, param_slot_1 };
|
||||
static const QUParameter param_slot_2[] = {
|
||||
{ 0, &static_QUType_QString, 0, QUParameter::In }
|
||||
};
|
||||
static const QUMethod slot_2 = {"textHeightChanged", 1, param_slot_2 };
|
||||
static const QMetaData slot_tbl[] = {
|
||||
{ "changeSizeBox(bool)", &slot_0, QMetaData::Public },
|
||||
{ "textWidthChanged(const QString&)", &slot_1, QMetaData::Public },
|
||||
{ "textHeightChanged(const QString&)", &slot_2, QMetaData::Public }
|
||||
};
|
||||
metaObj = QMetaObject::new_metaobject(
|
||||
"G4OpenGLQtExportDialog", parentObject,
|
||||
slot_tbl, 3,
|
||||
0, 0,
|
||||
#ifndef QT_NO_PROPERTIES
|
||||
0, 0,
|
||||
0, 0,
|
||||
#endif // QT_NO_PROPERTIES
|
||||
0, 0 );
|
||||
cleanUp_G4OpenGLQtExportDialog.setMetaObject( metaObj );
|
||||
return metaObj;
|
||||
}
|
||||
|
||||
void* G4OpenGLQtExportDialog::qt_cast( const char* clname )
|
||||
{
|
||||
if ( !qstrcmp( clname, "G4OpenGLQtExportDialog" ) )
|
||||
return this;
|
||||
return QDialog::qt_cast( clname );
|
||||
}
|
||||
|
||||
bool G4OpenGLQtExportDialog::qt_invoke( int _id, QUObject* _o )
|
||||
{
|
||||
switch ( _id - staticMetaObject()->slotOffset() ) {
|
||||
case 0: changeSizeBox((bool)static_QUType_bool.get(_o+1)); break;
|
||||
case 1: textWidthChanged((const QString&)static_QUType_QString.get(_o+1)); break;
|
||||
case 2: textHeightChanged((const QString&)static_QUType_QString.get(_o+1)); break;
|
||||
default:
|
||||
return QDialog::qt_invoke( _id, _o );
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool G4OpenGLQtExportDialog::qt_emit( int _id, QUObject* _o )
|
||||
{
|
||||
return QDialog::qt_emit(_id,_o);
|
||||
}
|
||||
#ifndef QT_NO_PROPERTIES
|
||||
|
||||
bool G4OpenGLQtExportDialog::qt_property( int id, int f, QVariant* v)
|
||||
{
|
||||
return QDialog::qt_property( id, f, v);
|
||||
}
|
||||
|
||||
bool G4OpenGLQtExportDialog::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; }
|
||||
#endif // QT_NO_PROPERTIES
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
** Meta object code from reading C++ file 'G4OpenGLQtExportDialog.hh'
|
||||
**
|
||||
** Created: Fri Sep 28 12:35:41 2007
|
||||
** by: The Qt Meta Object Compiler version 59 (Qt 4.2.2)
|
||||
**
|
||||
** WARNING! All changes made in this file will be lost!
|
||||
*****************************************************************************/
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
|
||||
#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
|
||||
|
||||
#include "../include/G4OpenGLQtExportDialog.hh"
|
||||
#if !defined(Q_MOC_OUTPUT_REVISION)
|
||||
#error "The header file 'G4OpenGLQtExportDialog.hh' doesn't include <QObject>."
|
||||
#elif Q_MOC_OUTPUT_REVISION != 59
|
||||
#error "This file was generated using the moc from 4.2.2. It"
|
||||
#error "cannot be used with the include files from this version of Qt."
|
||||
#error "(The moc has changed too much.)"
|
||||
#endif
|
||||
|
||||
static const uint qt_meta_data_G4OpenGLQtExportDialog[] = {
|
||||
|
||||
// content:
|
||||
1, // revision
|
||||
0, // classname
|
||||
0, 0, // classinfo
|
||||
3, 10, // methods
|
||||
0, 0, // properties
|
||||
0, 0, // enums/sets
|
||||
|
||||
// slots: signature, parameters, type, tag, flags
|
||||
23, 43, 43, 43, 0x0a,
|
||||
44, 43, 43, 43, 0x0a,
|
||||
70, 43, 43, 43, 0x0a,
|
||||
|
||||
0 // eod
|
||||
};
|
||||
|
||||
static const char qt_meta_stringdata_G4OpenGLQtExportDialog[] = {
|
||||
"G4OpenGLQtExportDialog\0changeSizeBox(bool)\0"
|
||||
"\0textWidthChanged(QString)\0"
|
||||
"textHeightChanged(QString)\0"
|
||||
};
|
||||
|
||||
const QMetaObject G4OpenGLQtExportDialog::staticMetaObject = {
|
||||
{ &QDialog::staticMetaObject, qt_meta_stringdata_G4OpenGLQtExportDialog,
|
||||
qt_meta_data_G4OpenGLQtExportDialog, 0 }
|
||||
};
|
||||
|
||||
const QMetaObject *G4OpenGLQtExportDialog::metaObject() const
|
||||
{
|
||||
return &staticMetaObject;
|
||||
}
|
||||
|
||||
void *G4OpenGLQtExportDialog::qt_metacast(const char *_clname)
|
||||
{
|
||||
if (!_clname) return 0;
|
||||
if (!strcmp(_clname, qt_meta_stringdata_G4OpenGLQtExportDialog))
|
||||
return static_cast<void*>(const_cast<G4OpenGLQtExportDialog*>(this));
|
||||
return QDialog::qt_metacast(_clname);
|
||||
}
|
||||
|
||||
int G4OpenGLQtExportDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
||||
{
|
||||
_id = QDialog::qt_metacall(_c, _id, _a);
|
||||
if (_id < 0)
|
||||
return _id;
|
||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
switch (_id) {
|
||||
case 0: changeSizeBox((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 1: textWidthChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
|
||||
case 2: textHeightChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
|
||||
}
|
||||
_id -= 3;
|
||||
}
|
||||
return _id;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,594 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLQtMovieDialog.cc,v 1.8 2008/10/24 13:49:19 lgarnier Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
|
||||
#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
|
||||
|
||||
#include "G4OpenGLQtMovieDialog.hh"
|
||||
#include "G4OpenGLQtViewer.hh"
|
||||
|
||||
#include <qpushbutton.h>
|
||||
#include <qpalette.h>
|
||||
#include <qlabel.h>
|
||||
#include <qgroupbox.h>
|
||||
#include <qlayout.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qfiledialog.h>
|
||||
#include <qprocess.h>
|
||||
|
||||
|
||||
// +---------------------------------------+
|
||||
// + Path for encoder +
|
||||
// + _______ +
|
||||
// + | select| ____________________ +
|
||||
// + ------- +
|
||||
// + Temp path +
|
||||
// + _______ +
|
||||
// + | select| ____________________ +
|
||||
// + ------- +
|
||||
// + +
|
||||
// + max number of frames ________ +
|
||||
// + .... +
|
||||
// + +
|
||||
// + Label : X frames Saves/Encoding +
|
||||
// + Cancel Encode +
|
||||
// +---------------------------------------+
|
||||
|
||||
G4OpenGLQtMovieDialog::G4OpenGLQtMovieDialog(
|
||||
G4OpenGLQtViewer* parentViewer,
|
||||
QWidget* parentWidget
|
||||
)
|
||||
: QDialog( parentWidget ),
|
||||
fParentViewer(parentViewer)
|
||||
{
|
||||
#if QT_VERSION > 0x030200
|
||||
setModal(false);
|
||||
#endif
|
||||
#if QT_VERSION < 0x040000
|
||||
setCaption( tr( " Movie parameters" ));
|
||||
#else
|
||||
setWindowTitle( tr( " Movie parameters" ));
|
||||
#endif
|
||||
|
||||
|
||||
// global layout
|
||||
QVBoxLayout* globalVLayout = new QVBoxLayout(this);
|
||||
globalVLayout->setMargin(10);
|
||||
globalVLayout->setSpacing(10);
|
||||
|
||||
// Encoder group box
|
||||
QGroupBox *encoderGroupBox = new QGroupBox(tr("Encoder path"),this);
|
||||
QVBoxLayout *encoderVGroupBoxLayout = new QVBoxLayout(encoderGroupBox);
|
||||
|
||||
// Encoder Path
|
||||
QWidget *encoderHBox = new QWidget(encoderGroupBox);
|
||||
QHBoxLayout *encoderHBoxLayout = new QHBoxLayout(encoderHBox);
|
||||
fEncoderPath = new QLineEdit("",encoderHBox);
|
||||
|
||||
QPushButton *encoderButton = new QPushButton(tr("..."),encoderHBox);
|
||||
encoderButton->setMaximumWidth (30);
|
||||
|
||||
fEncoderStatus = new QLabel(encoderGroupBox);
|
||||
|
||||
#if QT_VERSION > 0x040000
|
||||
fEncoderStatus->setWordWrap(true);
|
||||
encoderVGroupBoxLayout->setMargin(15);
|
||||
#else
|
||||
fEncoderStatus->setAlignment ( Qt::AlignAuto |Qt::WordBreak );
|
||||
encoderGroupBox->setInsideMargin(15);
|
||||
#endif
|
||||
|
||||
fEncoderStatus->setText("");
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
encoderHBoxLayout->add(fEncoderPath);
|
||||
encoderHBoxLayout->add(encoderButton);
|
||||
encoderVGroupBoxLayout->add(encoderHBox);
|
||||
encoderVGroupBoxLayout->add(fEncoderStatus);
|
||||
|
||||
globalVLayout->add(encoderGroupBox);
|
||||
#else
|
||||
encoderHBoxLayout->addWidget(fEncoderPath);
|
||||
encoderHBoxLayout->addWidget(encoderButton);
|
||||
encoderVGroupBoxLayout->addWidget(encoderHBox);
|
||||
encoderVGroupBoxLayout->addWidget(fEncoderStatus);
|
||||
|
||||
encoderGroupBox->setLayout(encoderVGroupBoxLayout);
|
||||
globalVLayout->addWidget(encoderGroupBox);
|
||||
#endif
|
||||
|
||||
connect( encoderButton, SIGNAL( clicked( ) ), this, SLOT(selectEncoderPathAction() ) );
|
||||
|
||||
|
||||
// temp folder group box
|
||||
QGroupBox *tempFolderGroupBox = new QGroupBox(tr("Temporary folder path"),this);
|
||||
QVBoxLayout *tempFolderVGroupBoxLayout = new QVBoxLayout(tempFolderGroupBox);
|
||||
|
||||
// temp folder Path
|
||||
QWidget *tempFolderHBox = new QWidget(tempFolderGroupBox);
|
||||
QHBoxLayout *tempFolderHBoxLayout = new QHBoxLayout(tempFolderHBox);
|
||||
|
||||
fTempFolderPath = new QLineEdit("",tempFolderHBox);
|
||||
|
||||
QPushButton *tempButton = new QPushButton(tr("..."),tempFolderHBox);
|
||||
tempButton->setMaximumWidth (30);
|
||||
|
||||
fTempFolderStatus = new QLabel(tempFolderGroupBox);
|
||||
#if QT_VERSION > 0x040000
|
||||
fTempFolderStatus->setWordWrap(true);
|
||||
tempFolderVGroupBoxLayout->setMargin(15);
|
||||
#else
|
||||
fTempFolderStatus->setAlignment ( Qt::AlignAuto |Qt::WordBreak );
|
||||
tempFolderGroupBox->setInsideMargin(15);
|
||||
#endif
|
||||
fTempFolderStatus->setText("");
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
tempFolderHBoxLayout->add(fTempFolderPath);
|
||||
tempFolderHBoxLayout->add(tempButton);
|
||||
tempFolderVGroupBoxLayout->add(tempFolderHBox);
|
||||
tempFolderVGroupBoxLayout->add(fTempFolderStatus);
|
||||
|
||||
globalVLayout->add(tempFolderGroupBox);
|
||||
#else
|
||||
tempFolderHBoxLayout->addWidget(fTempFolderPath);
|
||||
tempFolderHBoxLayout->addWidget(tempButton);
|
||||
tempFolderVGroupBoxLayout->addWidget(tempFolderHBox);
|
||||
tempFolderVGroupBoxLayout->addWidget(fTempFolderStatus);
|
||||
|
||||
tempFolderGroupBox->setLayout(tempFolderVGroupBoxLayout);
|
||||
globalVLayout->addWidget(tempFolderGroupBox);
|
||||
#endif
|
||||
|
||||
connect( tempButton, SIGNAL( clicked( ) ), this, SLOT(selectTempPathAction() ) );
|
||||
|
||||
|
||||
|
||||
|
||||
// save file group box
|
||||
QGroupBox *saveFileGroupBox = new QGroupBox(tr("Save as"),this);
|
||||
QVBoxLayout *saveFileVGroupBoxLayout = new QVBoxLayout(saveFileGroupBox);
|
||||
|
||||
// save file
|
||||
QWidget *saveFileHBox = new QWidget(saveFileGroupBox);
|
||||
QHBoxLayout *saveFileHBoxLayout = new QHBoxLayout(saveFileHBox);
|
||||
|
||||
fSaveFileName = new QLineEdit("G4Movie.mpeg",saveFileHBox);
|
||||
|
||||
QPushButton *saveButton = new QPushButton(tr("..."),saveFileHBox);
|
||||
saveButton->setMaximumWidth (30);
|
||||
|
||||
fSaveFileStatus = new QLabel(saveFileGroupBox);
|
||||
#if QT_VERSION > 0x040000
|
||||
fSaveFileStatus->setWordWrap(true);
|
||||
saveFileVGroupBoxLayout->setMargin(15);
|
||||
#else
|
||||
fSaveFileStatus->setAlignment ( Qt::AlignAuto |Qt::WordBreak );
|
||||
saveFileGroupBox->setInsideMargin(15);
|
||||
#endif
|
||||
fSaveFileStatus->setText("");
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
saveFileHBoxLayout->add(fSaveFileName);
|
||||
saveFileHBoxLayout->add(saveButton);
|
||||
saveFileVGroupBoxLayout->add(saveFileHBox);
|
||||
saveFileVGroupBoxLayout->add(fSaveFileStatus);
|
||||
|
||||
globalVLayout->add(saveFileGroupBox);
|
||||
#else
|
||||
saveFileHBoxLayout->addWidget(fSaveFileName);
|
||||
saveFileHBoxLayout->addWidget(saveButton);
|
||||
saveFileVGroupBoxLayout->addWidget(saveFileHBox);
|
||||
saveFileVGroupBoxLayout->addWidget(fSaveFileStatus);
|
||||
|
||||
saveFileGroupBox->setLayout(saveFileVGroupBoxLayout);
|
||||
globalVLayout->addWidget(saveFileGroupBox);
|
||||
#endif
|
||||
|
||||
connect( saveButton, SIGNAL( clicked( ) ), this, SLOT(selectSaveFileNameAction() ) );
|
||||
|
||||
|
||||
|
||||
// label
|
||||
|
||||
QLabel *infoLabel = new QLabel(" Press SPACE to Start/Pause video recording \n Press RETURN to Stop video recording",this);
|
||||
|
||||
// global status
|
||||
QGroupBox *statusGroupBox = new QGroupBox(tr("Status"),this);
|
||||
QVBoxLayout *statusVGroupBoxLayout = new QVBoxLayout(statusGroupBox);
|
||||
|
||||
fRecordingStatus = new QLabel(statusGroupBox);
|
||||
#if QT_VERSION > 0x040000
|
||||
statusVGroupBoxLayout->setMargin(15);
|
||||
fRecordingStatus->setWordWrap(true);
|
||||
#else
|
||||
statusGroupBox->setInsideMargin(15);
|
||||
fRecordingStatus->setAlignment ( Qt::AlignAuto |Qt::WordBreak );
|
||||
#endif
|
||||
QPalette palette( fRecordingStatus->palette() );
|
||||
#if QT_VERSION > 0x040000
|
||||
palette.setColor( QPalette::Text, Qt::green);
|
||||
#else
|
||||
palette.setColor( QColorGroup::Text, Qt::green);
|
||||
#endif
|
||||
fRecordingStatus->setPalette(palette);
|
||||
|
||||
fRecordingInfos = new QLabel(statusGroupBox);
|
||||
#if QT_VERSION > 0x040000
|
||||
fRecordingInfos->setWordWrap(true);
|
||||
#else
|
||||
fRecordingInfos->setAlignment ( Qt::AlignAuto |Qt::WordBreak );
|
||||
#endif
|
||||
setRecordingInfos("");
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
statusVGroupBoxLayout->add(fRecordingStatus);
|
||||
statusVGroupBoxLayout->add(fRecordingInfos);
|
||||
|
||||
globalVLayout->add(infoLabel);
|
||||
globalVLayout->add(statusGroupBox);
|
||||
#else
|
||||
statusVGroupBoxLayout->addWidget(fRecordingStatus);
|
||||
statusVGroupBoxLayout->addWidget(fRecordingInfos);
|
||||
|
||||
statusGroupBox->setLayout(statusVGroupBoxLayout);
|
||||
globalVLayout->addWidget(infoLabel);
|
||||
globalVLayout->addWidget(statusGroupBox);
|
||||
#endif
|
||||
|
||||
// buttons
|
||||
QWidget *buttonBox = new QWidget(this);
|
||||
|
||||
QHBoxLayout *buttonBoxLayout = new QHBoxLayout(buttonBox);
|
||||
|
||||
QPushButton *buttonReset = new QPushButton( tr( "&Reset" ),buttonBox );
|
||||
buttonReset->setAutoDefault( TRUE );
|
||||
buttonBoxLayout->addWidget(buttonReset);
|
||||
|
||||
fButtonStartPause = new QPushButton( tr( " &Start " ),buttonBox );
|
||||
fButtonStartPause->setEnabled(true);
|
||||
fButtonStartPause->setAutoDefault( TRUE );
|
||||
buttonBoxLayout->addWidget(fButtonStartPause);
|
||||
|
||||
fButtonStopFinishClose = new QPushButton( tr( "&Stop" ),buttonBox );
|
||||
fButtonStopFinishClose->setEnabled(false);
|
||||
fButtonStopFinishClose->setAutoDefault( TRUE );
|
||||
buttonBoxLayout->addWidget(fButtonStopFinishClose);
|
||||
|
||||
fButtonSave = new QPushButton( tr( "&Save" ),buttonBox );
|
||||
fButtonSave->setEnabled(false);
|
||||
fButtonSave->setAutoDefault( TRUE );
|
||||
buttonBoxLayout->addWidget(fButtonSave);
|
||||
|
||||
QPushButton *buttonCancel = new QPushButton( tr( "&Cancel" ),buttonBox );
|
||||
buttonCancel->setAutoDefault( TRUE );
|
||||
buttonBoxLayout->addWidget(buttonCancel);
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
buttonBox->setLayout(buttonBoxLayout);
|
||||
#endif
|
||||
globalVLayout->addWidget(buttonBox);
|
||||
|
||||
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
setLayout(globalVLayout);
|
||||
#endif
|
||||
|
||||
// signals and slots connections
|
||||
connect( fButtonStartPause, SIGNAL( clicked() ), fParentViewer, SLOT( startPauseVideo() ) );
|
||||
connect( buttonReset, SIGNAL( clicked() ), this, SLOT( resetRecording() ) );
|
||||
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
|
||||
connect( fButtonStopFinishClose, SIGNAL( clicked() ), this, SLOT( stopFinishClose() ) );
|
||||
connect( fButtonSave, SIGNAL( clicked() ), this, SLOT( save() ) );
|
||||
|
||||
// fill
|
||||
setRecordingStatus("");
|
||||
fEncoderPath->setText(fParentViewer->getEncoderPath());
|
||||
fTempFolderPath->setText(fParentViewer->getTempFolderPath());
|
||||
|
||||
// connect line edit signals
|
||||
connect (fEncoderPath,SIGNAL(textChanged ( const QString&)),this,SLOT(checkEncoderSwParameters()));
|
||||
connect (fTempFolderPath,SIGNAL(textChanged ( const QString&)),this,SLOT(checkTempFolderParameters()));
|
||||
connect (fSaveFileName,SIGNAL(textChanged ( const QString&)),this,SLOT(checkSaveFileNameParameters()));
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
connect (fEncoderPath,SIGNAL(editingFinished ()),this,SLOT(checkEncoderSwParameters()));
|
||||
connect (fTempFolderPath,SIGNAL(editingFinished ()),this,SLOT(checkTempFolderParameters()));
|
||||
connect (fSaveFileName,SIGNAL(editingFinished ()),this,SLOT(checkSaveFileNameParameters()));
|
||||
#else
|
||||
connect (fEncoderPath,SIGNAL(lostFocus ()),this,SLOT(checkEncoderSwParameters()));
|
||||
connect (fTempFolderPath,SIGNAL(lostFocus ()),this,SLOT(checkTempFolderParameters()));
|
||||
connect (fSaveFileName,SIGNAL(lostFocus ()),this,SLOT(checkSaveFileNameParameters()));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
G4OpenGLQtMovieDialog::~G4OpenGLQtMovieDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void G4OpenGLQtMovieDialog::selectEncoderPathAction()
|
||||
{
|
||||
#if QT_VERSION < 0x040000
|
||||
QString nomFich = QFileDialog::getOpenFileName ( ".",
|
||||
NULL,
|
||||
this,
|
||||
"Select your encoder",
|
||||
tr("Select your encoder ..."));
|
||||
#else
|
||||
QString nomFich = QFileDialog::getOpenFileName ( this,
|
||||
"Select your encoder",
|
||||
tr("Select your encoder ..."));
|
||||
|
||||
#endif
|
||||
|
||||
if (nomFich == "") {
|
||||
return;
|
||||
}
|
||||
fEncoderPath->setText(nomFich);
|
||||
checkEncoderSwParameters();
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLQtMovieDialog::selectTempPathAction()
|
||||
{
|
||||
#if QT_VERSION < 0x040000
|
||||
QString nomFich = QFileDialog::getExistingDirectory (NULL,
|
||||
this,
|
||||
"Select temporary folder",
|
||||
tr("Select temporary folder ..."));
|
||||
#else
|
||||
QString nomFich = QFileDialog::getExistingDirectory ( this,
|
||||
"Select temporary folder",
|
||||
tr("Select temporary folder ..."));
|
||||
|
||||
#endif
|
||||
if (nomFich == "") {
|
||||
return;
|
||||
}
|
||||
fTempFolderPath->setText(nomFich);
|
||||
checkTempFolderParameters();
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLQtMovieDialog::selectSaveFileNameAction()
|
||||
{
|
||||
#if QT_VERSION < 0x040000
|
||||
QString nomFich = QFileDialog::getSaveFileName ( ".",
|
||||
NULL,
|
||||
this,
|
||||
"Select saved file",
|
||||
tr("Select saved file ..."));
|
||||
#else
|
||||
QString nomFich = QFileDialog::getSaveFileName ( this,
|
||||
"Select saved file",
|
||||
tr("Select saved file ..."));
|
||||
|
||||
#endif
|
||||
if (nomFich == "") {
|
||||
return;
|
||||
}
|
||||
fSaveFileName->setText(nomFich);
|
||||
checkSaveFileNameParameters();
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLQtMovieDialog::stopFinishClose() {
|
||||
fParentViewer->stopVideo();
|
||||
}
|
||||
|
||||
void G4OpenGLQtMovieDialog::save() {
|
||||
if (((fParentViewer->isPaused()) || fParentViewer->isRecording() || fParentViewer->isStopped())) {
|
||||
fParentViewer->saveVideo();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If one of parameter is incorrect, put it in red and don't valid it
|
||||
* If valid, save it
|
||||
*/
|
||||
bool G4OpenGLQtMovieDialog::checkEncoderSwParameters() {
|
||||
|
||||
bool status = true;
|
||||
QPalette palette( fEncoderPath->palette() );
|
||||
|
||||
QString temp = fParentViewer->setEncoderPath(fEncoderPath->text());
|
||||
setRecordingInfos("");
|
||||
fEncoderStatus->setText(temp);
|
||||
if (temp != "") {
|
||||
#if QT_VERSION > 0x040000
|
||||
palette.setColor( QPalette::Base, Qt::red);
|
||||
#else
|
||||
palette.setColor( QColorGroup::Base, Qt::red);
|
||||
#endif
|
||||
if (fParentViewer->isReadyToEncode()) {
|
||||
setRecordingInfos("No valid encode defined, screen capture had been saved in the temp folder in ppm format.\nPlease define a encoder and clic on Apply button");
|
||||
}
|
||||
status = false;
|
||||
} else {
|
||||
#if QT_VERSION > 0x040000
|
||||
palette.setColor( QPalette::Base, Qt::white);
|
||||
#else
|
||||
palette.setColor( QColorGroup::Base, Qt::white);
|
||||
#endif
|
||||
fEncoderPath->setText(fParentViewer->getEncoderPath());
|
||||
}
|
||||
fEncoderPath->setPalette(palette);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If one of parameter is incorrect, put it in red and don't valid it
|
||||
* If valid, save it
|
||||
*/
|
||||
bool G4OpenGLQtMovieDialog::checkTempFolderParameters() {
|
||||
|
||||
bool status = true;
|
||||
QPalette palette( fTempFolderPath->palette() );
|
||||
|
||||
QString temp = fParentViewer->setTempFolderPath(fTempFolderPath->text());
|
||||
fTempFolderStatus->setText(temp);
|
||||
if (temp != "") {
|
||||
#if QT_VERSION > 0x040000
|
||||
palette.setColor( QPalette::Base, Qt::red);
|
||||
#else
|
||||
palette.setColor( QColorGroup::Base, Qt::red);
|
||||
#endif
|
||||
status = false;
|
||||
} else {
|
||||
#if QT_VERSION > 0x040000
|
||||
palette.setColor( QPalette::Base, Qt::white);
|
||||
#else
|
||||
palette.setColor( QColorGroup::Base, Qt::white);
|
||||
#endif
|
||||
fTempFolderPath->setText(fParentViewer->getTempFolderPath());
|
||||
}
|
||||
fTempFolderPath->setPalette(palette);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If one of parameter is incorrect, put it in red and don't valid it
|
||||
* If valid, save it
|
||||
*/
|
||||
bool G4OpenGLQtMovieDialog::checkSaveFileNameParameters() {
|
||||
|
||||
bool status = true;
|
||||
QPalette palette( fSaveFileName->palette() );
|
||||
|
||||
QString temp = fParentViewer->setSaveFileName(fSaveFileName->text());
|
||||
fSaveFileStatus->setText(temp);
|
||||
if (temp != "") {
|
||||
#if QT_VERSION > 0x040000
|
||||
palette.setColor( QPalette::Base, Qt::red);
|
||||
#else
|
||||
palette.setColor( QColorGroup::Base, Qt::red);
|
||||
#endif
|
||||
status = false;
|
||||
} else {
|
||||
#if QT_VERSION > 0x040000
|
||||
palette.setColor( QPalette::Base, Qt::white);
|
||||
#else
|
||||
palette.setColor( QColorGroup::Base, Qt::white);
|
||||
#endif
|
||||
fSaveFileName->setText(fParentViewer->getSaveFileName());
|
||||
}
|
||||
fSaveFileName->setPalette(palette);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLQtMovieDialog::resetRecording() {
|
||||
fParentViewer->resetRecording();
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLQtMovieDialog::setRecordingStatus(QString txt) {
|
||||
fRecordingStatus->setText(txt);
|
||||
if (fParentViewer->isWaiting()) {
|
||||
fButtonStartPause->setText(" &Start ");
|
||||
fButtonStartPause->setEnabled(true);
|
||||
fButtonStopFinishClose->setEnabled(false);
|
||||
fButtonSave->setEnabled(false);
|
||||
|
||||
} else if (fParentViewer->isPaused()) {
|
||||
|
||||
fButtonStartPause->setText(" &Continue ");
|
||||
fButtonStartPause->setEnabled(true);
|
||||
fButtonStopFinishClose->setEnabled(true);
|
||||
fButtonSave->setEnabled(false);
|
||||
|
||||
} else if (fParentViewer->isRecording()) {
|
||||
|
||||
fButtonStartPause->setText(" &Pause ");
|
||||
fButtonStartPause->setEnabled(true);
|
||||
fButtonStopFinishClose->setEnabled(true);
|
||||
fButtonSave->setEnabled(false);
|
||||
|
||||
} else if (fParentViewer->isBadOutput()) {
|
||||
|
||||
fButtonStartPause->setText(" &Start ");
|
||||
fButtonStartPause->setEnabled(true);
|
||||
fButtonStopFinishClose->setEnabled(false);
|
||||
fButtonSave->setEnabled(false);
|
||||
|
||||
} else if (fParentViewer->isBadTmp()) {
|
||||
|
||||
fButtonStartPause->setText(" &Start ");
|
||||
fButtonStartPause->setEnabled(false);
|
||||
fButtonStopFinishClose->setEnabled(false);
|
||||
fButtonSave->setEnabled(false);
|
||||
|
||||
} else if (fParentViewer->isBadEncoder()) {
|
||||
|
||||
fButtonStartPause->setText(" &Start ");
|
||||
fButtonStartPause->setEnabled(true);
|
||||
fButtonStopFinishClose->setEnabled(false);
|
||||
fButtonSave->setEnabled(false);
|
||||
|
||||
} else if (fParentViewer->isSuccess()) {
|
||||
|
||||
fButtonStartPause->setText(" &Start ");
|
||||
fButtonStartPause->setEnabled(false);
|
||||
fButtonStopFinishClose->setEnabled(false);
|
||||
fButtonSave->setEnabled(false);
|
||||
|
||||
} else if (fParentViewer->isFailed()) {
|
||||
|
||||
fButtonStartPause->setText(" &Start ");
|
||||
fButtonStartPause->setEnabled(false);
|
||||
fButtonStopFinishClose->setEnabled(false);
|
||||
fButtonSave->setEnabled(false);
|
||||
|
||||
} else if (fParentViewer->isStopped()) {
|
||||
|
||||
fButtonStartPause->setText(" &Start ");
|
||||
fButtonStartPause->setEnabled(false);
|
||||
fButtonStopFinishClose->setEnabled(false);
|
||||
fButtonSave->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLQtMovieDialog::setRecordingInfos(QString txt) {
|
||||
fRecordingInfos->setText(txt);
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLQtMovieDialog::enabledApplyButton() {
|
||||
fButtonStartPause->setEnabled(true);
|
||||
}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,308 +0,0 @@
|
||||
/****************************************************************************
|
||||
** G4OpenGLQtViewer meta object code from reading C++ file 'G4OpenGLQtViewer.hh'
|
||||
**
|
||||
** Created: Mon Nov 12 10:34:24 2007
|
||||
** by: The Qt MOC ($Id: G4OpenGLQtViewer_moc.cc,v 1.5 2007/11/14 11:49:00 lgarnier Exp $)
|
||||
**
|
||||
** WARNING! All changes made in this file will be lost!
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
|
||||
|
||||
#undef QT_NO_COMPAT
|
||||
#include "../include/G4OpenGLQtViewer.hh"
|
||||
#include <qmetaobject.h>
|
||||
#include <qapplication.h>
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
|
||||
#include <private/qucomextra_p.h>
|
||||
#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26)
|
||||
#error "This file was generated using the moc from 3.3.5. It"
|
||||
#error "cannot be used with the include files from this version of Qt."
|
||||
#error "(The moc has changed too much.)"
|
||||
#endif
|
||||
|
||||
const char *G4OpenGLQtViewer::className() const
|
||||
{
|
||||
return "G4OpenGLQtViewer";
|
||||
}
|
||||
|
||||
QMetaObject *G4OpenGLQtViewer::metaObj = 0;
|
||||
static QMetaObjectCleanUp cleanUp_G4OpenGLQtViewer( "G4OpenGLQtViewer", &G4OpenGLQtViewer::staticMetaObject );
|
||||
|
||||
#ifndef QT_NO_TRANSLATION
|
||||
QString G4OpenGLQtViewer::tr( const char *s, const char *c )
|
||||
{
|
||||
if ( qApp )
|
||||
return qApp->translate( "G4OpenGLQtViewer", s, c, QApplication::DefaultCodec );
|
||||
else
|
||||
return QString::fromLatin1( s );
|
||||
}
|
||||
#ifndef QT_NO_TRANSLATION_UTF8
|
||||
QString G4OpenGLQtViewer::trUtf8( const char *s, const char *c )
|
||||
{
|
||||
if ( qApp )
|
||||
return qApp->translate( "G4OpenGLQtViewer", s, c, QApplication::UnicodeUTF8 );
|
||||
else
|
||||
return QString::fromUtf8( s );
|
||||
}
|
||||
#endif // QT_NO_TRANSLATION_UTF8
|
||||
|
||||
#endif // QT_NO_TRANSLATION
|
||||
|
||||
QMetaObject* G4OpenGLQtViewer::staticMetaObject()
|
||||
{
|
||||
if ( metaObj )
|
||||
return metaObj;
|
||||
QMetaObject* parentObject = QObject::staticMetaObject();
|
||||
static const QUMethod slot_0 = {"actionDrawingWireframe", 0, 0 };
|
||||
static const QUMethod slot_1 = {"actionDrawingLineRemoval", 0, 0 };
|
||||
static const QUMethod slot_2 = {"actionDrawingSurfaceRemoval", 0, 0 };
|
||||
static const QUMethod slot_3 = {"actionDrawingLineSurfaceRemoval", 0, 0 };
|
||||
static const QUMethod slot_4 = {"actionControlPanels", 0, 0 };
|
||||
static const QUMethod slot_5 = {"actionExitG4", 0, 0 };
|
||||
static const QUMethod slot_6 = {"actionCreateEPS", 0, 0 };
|
||||
static const QUParameter param_slot_7[] = {
|
||||
{ 0, &static_QUType_int, 0, QUParameter::In }
|
||||
};
|
||||
static const QUMethod slot_7 = {"toggleDrawingAction", 1, param_slot_7 };
|
||||
static const QUParameter param_slot_8[] = {
|
||||
{ 0, &static_QUType_bool, 0, QUParameter::In }
|
||||
};
|
||||
static const QUMethod slot_8 = {"toggleMouseAction", 1, param_slot_8 };
|
||||
static const QUParameter param_slot_9[] = {
|
||||
{ 0, &static_QUType_bool, 0, QUParameter::In }
|
||||
};
|
||||
static const QUMethod slot_9 = {"toggleRepresentation", 1, param_slot_9 };
|
||||
static const QUParameter param_slot_10[] = {
|
||||
{ 0, &static_QUType_bool, 0, QUParameter::In }
|
||||
};
|
||||
static const QUMethod slot_10 = {"toggleBackground", 1, param_slot_10 };
|
||||
static const QUParameter param_slot_11[] = {
|
||||
{ 0, &static_QUType_bool, 0, QUParameter::In }
|
||||
};
|
||||
static const QUMethod slot_11 = {"toggleTransparency", 1, param_slot_11 };
|
||||
static const QUParameter param_slot_12[] = {
|
||||
{ 0, &static_QUType_bool, 0, QUParameter::In }
|
||||
};
|
||||
static const QUMethod slot_12 = {"toggleAntialiasing", 1, param_slot_12 };
|
||||
static const QUParameter param_slot_13[] = {
|
||||
{ 0, &static_QUType_bool, 0, QUParameter::In }
|
||||
};
|
||||
static const QUMethod slot_13 = {"toggleHaloing", 1, param_slot_13 };
|
||||
static const QUParameter param_slot_14[] = {
|
||||
{ 0, &static_QUType_bool, 0, QUParameter::In }
|
||||
};
|
||||
static const QUMethod slot_14 = {"toggleAux", 1, param_slot_14 };
|
||||
static const QUParameter param_slot_15[] = {
|
||||
{ 0, &static_QUType_bool, 0, QUParameter::In }
|
||||
};
|
||||
static const QUMethod slot_15 = {"toggleFullScreen", 1, param_slot_15 };
|
||||
static const QUMethod slot_16 = {"dialogClosed", 0, 0 };
|
||||
static const QMetaData slot_tbl[] = {
|
||||
{ "actionDrawingWireframe()", &slot_0, QMetaData::Private },
|
||||
{ "actionDrawingLineRemoval()", &slot_1, QMetaData::Private },
|
||||
{ "actionDrawingSurfaceRemoval()", &slot_2, QMetaData::Private },
|
||||
{ "actionDrawingLineSurfaceRemoval()", &slot_3, QMetaData::Private },
|
||||
{ "actionControlPanels()", &slot_4, QMetaData::Private },
|
||||
{ "actionExitG4()", &slot_5, QMetaData::Private },
|
||||
{ "actionCreateEPS()", &slot_6, QMetaData::Private },
|
||||
{ "toggleDrawingAction(int)", &slot_7, QMetaData::Private },
|
||||
{ "toggleMouseAction(bool)", &slot_8, QMetaData::Private },
|
||||
{ "toggleRepresentation(bool)", &slot_9, QMetaData::Private },
|
||||
{ "toggleBackground(bool)", &slot_10, QMetaData::Private },
|
||||
{ "toggleTransparency(bool)", &slot_11, QMetaData::Private },
|
||||
{ "toggleAntialiasing(bool)", &slot_12, QMetaData::Private },
|
||||
{ "toggleHaloing(bool)", &slot_13, QMetaData::Private },
|
||||
{ "toggleAux(bool)", &slot_14, QMetaData::Private },
|
||||
{ "toggleFullScreen(bool)", &slot_15, QMetaData::Private },
|
||||
{ "dialogClosed()", &slot_16, QMetaData::Private }
|
||||
};
|
||||
metaObj = QMetaObject::new_metaobject(
|
||||
"G4OpenGLQtViewer", parentObject,
|
||||
slot_tbl, 17,
|
||||
0, 0,
|
||||
#ifndef QT_NO_PROPERTIES
|
||||
0, 0,
|
||||
0, 0,
|
||||
#endif // QT_NO_PROPERTIES
|
||||
0, 0 );
|
||||
cleanUp_G4OpenGLQtViewer.setMetaObject( metaObj );
|
||||
return metaObj;
|
||||
}
|
||||
|
||||
void* G4OpenGLQtViewer::qt_cast( const char* clname )
|
||||
{
|
||||
if ( !qstrcmp( clname, "G4OpenGLQtViewer" ) )
|
||||
return this;
|
||||
if ( !qstrcmp( clname, "G4OpenGLViewer" ) )
|
||||
return (G4OpenGLViewer*)this;
|
||||
return QObject::qt_cast( clname );
|
||||
}
|
||||
|
||||
bool G4OpenGLQtViewer::qt_invoke( int _id, QUObject* _o )
|
||||
{
|
||||
switch ( _id - staticMetaObject()->slotOffset() ) {
|
||||
case 0: actionDrawingWireframe(); break;
|
||||
case 1: actionDrawingLineRemoval(); break;
|
||||
case 2: actionDrawingSurfaceRemoval(); break;
|
||||
case 3: actionDrawingLineSurfaceRemoval(); break;
|
||||
case 4: actionControlPanels(); break;
|
||||
case 5: actionExitG4(); break;
|
||||
case 6: actionCreateEPS(); break;
|
||||
case 7: toggleDrawingAction((int)static_QUType_int.get(_o+1)); break;
|
||||
case 8: toggleMouseAction((bool)static_QUType_bool.get(_o+1)); break;
|
||||
case 9: toggleRepresentation((bool)static_QUType_bool.get(_o+1)); break;
|
||||
case 10: toggleBackground((bool)static_QUType_bool.get(_o+1)); break;
|
||||
case 11: toggleTransparency((bool)static_QUType_bool.get(_o+1)); break;
|
||||
case 12: toggleAntialiasing((bool)static_QUType_bool.get(_o+1)); break;
|
||||
case 13: toggleHaloing((bool)static_QUType_bool.get(_o+1)); break;
|
||||
case 14: toggleAux((bool)static_QUType_bool.get(_o+1)); break;
|
||||
case 15: toggleFullScreen((bool)static_QUType_bool.get(_o+1)); break;
|
||||
case 16: dialogClosed(); break;
|
||||
default:
|
||||
return QObject::qt_invoke( _id, _o );
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool G4OpenGLQtViewer::qt_emit( int _id, QUObject* _o )
|
||||
{
|
||||
return QObject::qt_emit(_id,_o);
|
||||
}
|
||||
#ifndef QT_NO_PROPERTIES
|
||||
|
||||
bool G4OpenGLQtViewer::qt_property( int id, int f, QVariant* v)
|
||||
{
|
||||
return QObject::qt_property( id, f, v);
|
||||
}
|
||||
|
||||
bool G4OpenGLQtViewer::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; }
|
||||
#endif // QT_NO_PROPERTIES
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
** Meta object code from reading C++ file 'G4OpenGLQtViewer.hh'
|
||||
**
|
||||
** Created: Tue Sep 18 17:43:43 2007
|
||||
** by: The Qt Meta Object Compiler version 59 (Qt 4.2.2)
|
||||
**
|
||||
** WARNING! All changes made in this file will be lost!
|
||||
*****************************************************************************/
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
|
||||
#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
|
||||
|
||||
#include "../include/G4OpenGLQtViewer.hh"
|
||||
#if !defined(Q_MOC_OUTPUT_REVISION)
|
||||
#error "The header file 'G4OpenGLQtViewer.hh' doesn't include <QObject>."
|
||||
#elif Q_MOC_OUTPUT_REVISION != 59
|
||||
#error "This file was generated using the moc from 4.2.2. It"
|
||||
#error "cannot be used with the include files from this version of Qt."
|
||||
#error "(The moc has changed too much.)"
|
||||
#endif
|
||||
|
||||
static const uint qt_meta_data_G4OpenGLQtViewer[] = {
|
||||
|
||||
// content:
|
||||
1, // revision
|
||||
0, // classname
|
||||
0, 0, // classinfo
|
||||
17, 10, // methods
|
||||
0, 0, // properties
|
||||
0, 0, // enums/sets
|
||||
|
||||
// slots: signature, parameters, type, tag, flags
|
||||
17, 42, 42, 42, 0x08,
|
||||
43, 42, 42, 42, 0x08,
|
||||
70, 42, 42, 42, 0x08,
|
||||
100, 42, 42, 42, 0x08,
|
||||
134, 42, 42, 42, 0x08,
|
||||
156, 42, 42, 42, 0x08,
|
||||
171, 42, 42, 42, 0x08,
|
||||
189, 42, 42, 42, 0x08,
|
||||
214, 42, 42, 42, 0x08,
|
||||
238, 42, 42, 42, 0x08,
|
||||
265, 42, 42, 42, 0x08,
|
||||
288, 42, 42, 42, 0x08,
|
||||
313, 42, 42, 42, 0x08,
|
||||
338, 42, 42, 42, 0x08,
|
||||
358, 42, 42, 42, 0x08,
|
||||
374, 42, 42, 42, 0x08,
|
||||
397, 42, 42, 42, 0x08,
|
||||
|
||||
0 // eod
|
||||
};
|
||||
|
||||
static const char qt_meta_stringdata_G4OpenGLQtViewer[] = {
|
||||
"G4OpenGLQtViewer\0actionDrawingWireframe()\0"
|
||||
"\0actionDrawingLineRemoval()\0"
|
||||
"actionDrawingSurfaceRemoval()\0"
|
||||
"actionDrawingLineSurfaceRemoval()\0"
|
||||
"actionControlPanels()\0actionExitG4()\0"
|
||||
"actionCreateEPS()\0toggleDrawingAction(int)\0"
|
||||
"toggleMouseAction(bool)\0"
|
||||
"toggleRepresentation(bool)\0"
|
||||
"toggleBackground(bool)\0toggleTransparency(bool)\0"
|
||||
"toggleAntialiasing(bool)\0toggleHaloing(bool)\0"
|
||||
"toggleAux(bool)\0toggleFullScreen(bool)\0"
|
||||
"dialogClosed()\0"
|
||||
};
|
||||
|
||||
const QMetaObject G4OpenGLQtViewer::staticMetaObject = {
|
||||
{ &QObject::staticMetaObject, qt_meta_stringdata_G4OpenGLQtViewer,
|
||||
qt_meta_data_G4OpenGLQtViewer, 0 }
|
||||
};
|
||||
|
||||
const QMetaObject *G4OpenGLQtViewer::metaObject() const
|
||||
{
|
||||
return &staticMetaObject;
|
||||
}
|
||||
|
||||
void *G4OpenGLQtViewer::qt_metacast(const char *_clname)
|
||||
{
|
||||
if (!_clname) return 0;
|
||||
if (!strcmp(_clname, qt_meta_stringdata_G4OpenGLQtViewer))
|
||||
return static_cast<void*>(const_cast<G4OpenGLQtViewer*>(this));
|
||||
if (!strcmp(_clname, "G4OpenGLViewer"))
|
||||
return static_cast<G4OpenGLViewer*>(const_cast<G4OpenGLQtViewer*>(this));
|
||||
return QObject::qt_metacast(_clname);
|
||||
}
|
||||
|
||||
int G4OpenGLQtViewer::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
||||
{
|
||||
_id = QObject::qt_metacall(_c, _id, _a);
|
||||
if (_id < 0)
|
||||
return _id;
|
||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
switch (_id) {
|
||||
case 0: actionDrawingWireframe(); break;
|
||||
case 1: actionDrawingLineRemoval(); break;
|
||||
case 2: actionDrawingSurfaceRemoval(); break;
|
||||
case 3: actionDrawingLineSurfaceRemoval(); break;
|
||||
case 4: actionControlPanels(); break;
|
||||
case 5: actionExitG4(); break;
|
||||
case 6: actionCreateEPS(); break;
|
||||
case 7: toggleDrawingAction((*reinterpret_cast< int(*)>(_a[1]))); break;
|
||||
case 8: toggleMouseAction((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 9: toggleRepresentation((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 10: toggleBackground((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 11: toggleTransparency((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 12: toggleAntialiasing((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 13: toggleHaloing((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 14: toggleAux((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 15: toggleFullScreen((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 16: dialogClosed(); break;
|
||||
}
|
||||
_id -= 17;
|
||||
}
|
||||
return _id;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLSceneHandler.cc,v 1.51 2007/05/25 15:41:38 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4OpenGLSceneHandler.cc,v 1.54 2008/04/04 13:32:22 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 27th March 1996
|
||||
@@ -71,6 +71,7 @@ G4OpenGLSceneHandler::G4OpenGLSceneHandler (G4VGraphicsSystem& system,
|
||||
const G4String& name):
|
||||
G4VSceneHandler (system, id, name),
|
||||
fPickName(0),
|
||||
fProcessing2D (false),
|
||||
fProcessingPolymarker(false)
|
||||
{}
|
||||
|
||||
@@ -123,13 +124,16 @@ void G4OpenGLSceneHandler::EndPrimitives ()
|
||||
G4VSceneHandler::EndPrimitives ();
|
||||
}
|
||||
|
||||
void G4OpenGLSceneHandler::BeginPrimitives2D ()
|
||||
void G4OpenGLSceneHandler::BeginPrimitives2D
|
||||
(const G4Transform3D& objectTransformation)
|
||||
{
|
||||
G4VSceneHandler::BeginPrimitives2D ();
|
||||
G4VSceneHandler::BeginPrimitives2D (objectTransformation);
|
||||
fProcessing2D = true;
|
||||
}
|
||||
|
||||
void G4OpenGLSceneHandler::EndPrimitives2D ()
|
||||
{
|
||||
fProcessing2D = false;
|
||||
G4VSceneHandler::EndPrimitives2D ();
|
||||
}
|
||||
|
||||
@@ -463,6 +467,9 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
|
||||
|
||||
G4bool clipping = pViewer->fVP.IsSection() || pViewer->fVP.IsCutaway();
|
||||
|
||||
// Lighting disabled unless otherwise requested
|
||||
glDisable (GL_LIGHTING);
|
||||
|
||||
switch (drawing_style) {
|
||||
case (G4ViewParameters::hlhsr):
|
||||
// Set up as for hidden line removal but paint polygon faces later...
|
||||
@@ -489,7 +496,6 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
|
||||
glPolygonMode (GL_FRONT, GL_LINE);
|
||||
}
|
||||
}
|
||||
glDisable (GL_LIGHTING);
|
||||
glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
|
||||
break;
|
||||
case (G4ViewParameters::hsr):
|
||||
@@ -514,14 +520,13 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
|
||||
}
|
||||
glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, materialColour);
|
||||
}
|
||||
glEnable (GL_LIGHTING);
|
||||
if (!fProcessing2D) glEnable (GL_LIGHTING);
|
||||
break;
|
||||
case (G4ViewParameters::wireframe):
|
||||
default:
|
||||
glEnable (GL_DEPTH_TEST);
|
||||
glDepthFunc (GL_LEQUAL); //??? was GL_ALWAYS
|
||||
glDisable (GL_CULL_FACE);
|
||||
glDisable (GL_LIGHTING);
|
||||
glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
|
||||
glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
|
||||
break;
|
||||
@@ -600,11 +605,14 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
|
||||
// having glBegin/End pairs *inside* loop in the more
|
||||
// usual case of no hidden line removal.
|
||||
|
||||
// Lighting disabled unless otherwise requested
|
||||
glDisable (GL_LIGHTING);
|
||||
|
||||
// Draw through stencil...
|
||||
glStencilFunc (GL_EQUAL, 0, 1);
|
||||
glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP);
|
||||
if (drawing_style == G4ViewParameters::hlhsr) {
|
||||
glEnable (GL_LIGHTING);
|
||||
if (!fProcessing2D) glEnable (GL_LIGHTING);
|
||||
}
|
||||
glEnable (GL_DEPTH_TEST);
|
||||
glDepthFunc (GL_LEQUAL);
|
||||
@@ -707,6 +715,7 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
|
||||
glEnd ();
|
||||
glDisable (GL_STENCIL_TEST); // Revert to default for next primitive.
|
||||
glDepthMask (1); // Revert to default for next primitive.
|
||||
glDisable (GL_LIGHTING); // Revert to default for next primitive.
|
||||
}
|
||||
|
||||
//Method for handling G4NURBS objects for drawing solids.
|
||||
@@ -726,18 +735,18 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4NURBS& nurb) {
|
||||
GLfloat *u_knot_array, *u_knot_array_ptr;
|
||||
u_knot_array = u_knot_array_ptr = new GLfloat [nurb.GetnbrKnots(G4NURBS::U)];
|
||||
G4NURBS::KnotsIterator u_iterator (nurb, G4NURBS::U);
|
||||
while (u_iterator.pick (u_knot_array_ptr++));
|
||||
while (u_iterator.pick (u_knot_array_ptr++)){}
|
||||
|
||||
GLfloat *v_knot_array, *v_knot_array_ptr;
|
||||
v_knot_array = v_knot_array_ptr = new GLfloat [nurb.GetnbrKnots(G4NURBS::V)];
|
||||
G4NURBS::KnotsIterator v_iterator (nurb, G4NURBS::V);
|
||||
while (v_iterator.pick (v_knot_array_ptr++));
|
||||
while (v_iterator.pick (v_knot_array_ptr++)){}
|
||||
|
||||
GLfloat *ctrl_pnt_array, *ctrl_pnt_array_ptr;
|
||||
ctrl_pnt_array = ctrl_pnt_array_ptr =
|
||||
new GLfloat [nurb.GettotalnbrCtrlPts () * G4NURBS::NofC];
|
||||
G4NURBS::CtrlPtsCoordsIterator c_p_iterator (nurb);
|
||||
while (c_p_iterator.pick (ctrl_pnt_array_ptr++));
|
||||
while (c_p_iterator.pick (ctrl_pnt_array_ptr++)){}
|
||||
|
||||
// Get vis attributes - pick up defaults if none.
|
||||
const G4VisAttributes* pVA =
|
||||
@@ -758,7 +767,7 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4NURBS& nurb) {
|
||||
// << "Using hidden surface removal." << G4endl;
|
||||
case (G4ViewParameters::hsr):
|
||||
{
|
||||
glEnable (GL_LIGHTING);
|
||||
if (!fProcessing2D) glEnable (GL_LIGHTING);
|
||||
glEnable (GL_DEPTH_TEST);
|
||||
glEnable (GL_AUTO_NORMAL);
|
||||
glEnable (GL_NORMALIZE);
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredQt.cc,v 1.3 2007/11/15 18:24:28 lgarnier Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4OpenGLStoredQt.cc,v 1.9 2008/10/24 14:21:34 lgarnier Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// OpenGLStoredQt graphics system factory.
|
||||
@@ -42,14 +42,11 @@
|
||||
|
||||
G4OpenGLStoredQt::G4OpenGLStoredQt ():
|
||||
G4VGraphicsSystem ("OpenGLStoredQt",
|
||||
"OGLSQT",
|
||||
G4VisFeaturesOfOpenGLIQt (),
|
||||
"OGLSQt",
|
||||
G4VisFeaturesOfOpenGLSQt (),
|
||||
G4VGraphicsSystem::threeD)
|
||||
{
|
||||
G4OpenGLViewerMessenger::GetInstance();
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLStoredQt::Create \n");
|
||||
#endif
|
||||
}
|
||||
|
||||
G4VSceneHandler* G4OpenGLStoredQt::CreateSceneHandler
|
||||
@@ -60,7 +57,7 @@ G4VSceneHandler* G4OpenGLStoredQt::CreateSceneHandler
|
||||
|
||||
G4VViewer* G4OpenGLStoredQt::CreateViewer
|
||||
(G4VSceneHandler& scene, const G4String& name) {
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLStoredQt::CreateViewer \n");
|
||||
#endif
|
||||
G4VViewer* pView =
|
||||
@@ -80,7 +77,7 @@ G4VViewer* G4OpenGLStoredQt::CreateViewer
|
||||
G4cerr << "G4OpenGLStoredQt::CreateViewer: null pointer on"
|
||||
" new G4OpenGLStoredQtViewer." << G4endl;
|
||||
}
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLStoredQt::CreateViewer END \n");
|
||||
#endif
|
||||
return pView;
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredQtViewer.cc,v 1.6 2007/11/15 18:24:28 lgarnier Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4OpenGLStoredQtViewer.cc,v 1.20 2008/11/06 13:43:44 lgarnier Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Class G4OpenGLStoredQtViewer : a class derived from G4OpenGLQtViewer and
|
||||
@@ -34,7 +34,6 @@
|
||||
#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
|
||||
|
||||
#include "G4OpenGLStoredQtViewer.hh"
|
||||
#include "G4VisManager.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
@@ -44,280 +43,249 @@
|
||||
G4OpenGLStoredQtViewer::G4OpenGLStoredQtViewer
|
||||
(G4OpenGLStoredSceneHandler& sceneHandler,
|
||||
const G4String& name):
|
||||
G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
|
||||
G4OpenGLViewer (sceneHandler),
|
||||
G4OpenGLQtViewer (sceneHandler),
|
||||
G4OpenGLStoredViewer (sceneHandler),
|
||||
QGLWidget() // FIXME : gerer le pb du parent !
|
||||
{
|
||||
nbPaint =0;
|
||||
hasToRepaint =false;
|
||||
G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
|
||||
G4OpenGLViewer (sceneHandler),
|
||||
G4OpenGLQtViewer (sceneHandler),
|
||||
G4OpenGLStoredViewer (sceneHandler) // FIXME : gerer le pb du parent !
|
||||
{
|
||||
|
||||
//set true to picking
|
||||
fVP.SetPicking(true);
|
||||
#if QT_VERSION < 0x040000
|
||||
setFocusPolicy(QWidget::StrongFocus); // enable keybord events
|
||||
#else
|
||||
setFocusPolicy(Qt::StrongFocus); // enable keybord events
|
||||
#endif
|
||||
hasToRepaint =false;
|
||||
|
||||
if (fViewId < 0) return; // In case error in base class instantiation.
|
||||
}
|
||||
|
||||
G4OpenGLStoredQtViewer::~G4OpenGLStoredQtViewer() {
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("GLWidget::~GLWidget \n");
|
||||
#endif
|
||||
makeCurrent();
|
||||
// this is connect to the Dialog for deleting it properly
|
||||
// when close event.
|
||||
// ((QDialog*)window())->reject();
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("GLWidget::~GLWidget END\n");
|
||||
#endif
|
||||
makeCurrent();
|
||||
// this is connect to the Dialog for deleting it properly
|
||||
// when close event.
|
||||
// ((QDialog*)window())->reject();
|
||||
}
|
||||
|
||||
void G4OpenGLStoredQtViewer::Initialise() {
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("GLWidget::Initialise \n");
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::Initialise 1\n");
|
||||
#endif
|
||||
readyToPaint = false;
|
||||
CreateGLQtContext ();
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::Initialise () 2\n");
|
||||
#endif
|
||||
CreateMainWindow (this);
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::Initialise () 3\n");
|
||||
#endif
|
||||
CreateFontLists (); // FIXME Does nothing!
|
||||
readyToPaint = false;
|
||||
CreateMainWindow (this,QString(fName));
|
||||
CreateFontLists ();
|
||||
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("readyToPaint = true \n");
|
||||
#endif
|
||||
readyToPaint = true;
|
||||
|
||||
// First Draw
|
||||
SetView();
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf(" ClearView\n");
|
||||
#endif
|
||||
ClearView (); //ok, put the background correct
|
||||
ShowView();
|
||||
FinishView();
|
||||
}
|
||||
|
||||
void G4OpenGLStoredQtViewer::initializeGL () {
|
||||
|
||||
InitializeGLView ();
|
||||
InitializeGLView ();
|
||||
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::InitialiseGL () 1\n");
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::InitialiseGL () 1\n");
|
||||
#endif
|
||||
|
||||
// clear the buffers and window.
|
||||
ClearView ();
|
||||
// printf("G4OpenGLStoredQtViewer::InitialiseGL () 2\n");
|
||||
FinishView ();
|
||||
// clear the buffers and window.
|
||||
ClearView ();
|
||||
FinishView ();
|
||||
|
||||
glDepthFunc (GL_LEQUAL);
|
||||
glDepthMask (GL_TRUE);
|
||||
glDepthFunc (GL_LEQUAL);
|
||||
glDepthMask (GL_TRUE);
|
||||
|
||||
hasToRepaint =true;
|
||||
if (fSceneHandler.GetScene() == 0) {
|
||||
hasToRepaint =false;
|
||||
} else {
|
||||
hasToRepaint =true;
|
||||
}
|
||||
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::InitialiseGL -------------------------------------------------------------------------------------\n");
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::InitialiseGL END\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLStoredQtViewer::DrawView () {
|
||||
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::DrawView %d %d VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n",WinSize_x, WinSize_y);
|
||||
printf("G4OpenGLStoredQtViewer::DrawView Dialog adress : %d\n",GLWindow);
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::DrawView VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n");
|
||||
#endif
|
||||
G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
|
||||
|
||||
//Make sure current viewer is attached and clean...
|
||||
//Qt version needed
|
||||
glViewport (0, 0, WinSize_x, WinSize_y);
|
||||
|
||||
//See if things have changed from last time and remake if necessary...
|
||||
// The fNeedKernelVisit flag might have been set by the user in
|
||||
// /vis/viewer/rebuild, but if not, make decision and set flag only
|
||||
// if necessary...
|
||||
if (!fNeedKernelVisit)
|
||||
|
||||
if (!fNeedKernelVisit) KernelVisitDecision ();
|
||||
|
||||
G4bool kernelVisitWasNeeded = fNeedKernelVisit; // Keep (ProcessView resets).
|
||||
ProcessView ();
|
||||
|
||||
|
||||
if(style!=G4ViewParameters::hlr &&
|
||||
haloing_enabled) {
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::DrawView DANS LE IF\n");
|
||||
// That's no the same logic as Immediate Viewer, I don't know why...
|
||||
// But if I send updateGL here, we go here :
|
||||
// updateQWidget -> paintGL -> ComputeView
|
||||
// whih is not the same as ComputeView Directly
|
||||
// And we loose the redraw of things !
|
||||
|
||||
ComputeView();
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::DrawView ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
|
||||
#endif
|
||||
|
||||
HaloingFirstPass ();
|
||||
DrawDisplayLists ();
|
||||
glFlush ();
|
||||
|
||||
HaloingSecondPass ();
|
||||
|
||||
DrawDisplayLists ();
|
||||
FinishView ();
|
||||
|
||||
} else {
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("*************************** CASE 1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
|
||||
#endif
|
||||
|
||||
// If kernel visit was needed, drawing and FinishView will already
|
||||
// have been done, so...
|
||||
if (!kernelVisitWasNeeded) {
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("*************************** CASE 2 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
|
||||
#endif
|
||||
DrawDisplayLists ();
|
||||
FinishView ();
|
||||
} else {
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("*************************** CASE 3 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
|
||||
#endif
|
||||
// However, union cutaways are implemented in DrawDisplayLists, so make
|
||||
// an extra pass...
|
||||
if (fVP.IsCutaway() &&
|
||||
fVP.GetCutawayMode() == G4ViewParameters::cutawayUnion) {
|
||||
ClearView();
|
||||
DrawDisplayLists ();
|
||||
FinishView ();
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("*************************** CASE 4 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
|
||||
#endif
|
||||
} else { // ADD TO AVOID KernelVisit=1 and nothing to display
|
||||
DrawDisplayLists ();
|
||||
FinishView ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::DrawView %d %d ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n",WinSize_x, WinSize_y);
|
||||
#endif
|
||||
hasToRepaint =true;
|
||||
}
|
||||
|
||||
void G4OpenGLStoredQtViewer::ComputeView () {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void G4OpenGLStoredQtViewer::FinishView (
|
||||
)
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
|
||||
{
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::FinishView VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n");
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::ComputeView %d %d VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n",WinSize_x, WinSize_y);
|
||||
#endif
|
||||
makeCurrent();
|
||||
G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
|
||||
|
||||
//Make sure current viewer is attached and clean...
|
||||
|
||||
//See if things have changed from last time and remake if necessary...
|
||||
// The fNeedKernelVisit flag might have been set by the user in
|
||||
// /vis/viewer/rebuild, but if not, make decision and set flag only
|
||||
// if necessary...
|
||||
if (!fNeedKernelVisit) {
|
||||
KernelVisitDecision ();
|
||||
}
|
||||
G4bool kernelVisitWasNeeded = fNeedKernelVisit; // Keep (ProcessView resets).
|
||||
ProcessView ();
|
||||
|
||||
|
||||
if(style!=G4ViewParameters::hlr &&
|
||||
haloing_enabled) {
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::ComputeView DANS LE IF\n");
|
||||
#endif
|
||||
|
||||
glFlush ();
|
||||
swapBuffers ();
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::FinishView ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
|
||||
#endif
|
||||
HaloingFirstPass ();
|
||||
DrawDisplayLists ();
|
||||
glFlush ();
|
||||
|
||||
HaloingSecondPass ();
|
||||
|
||||
DrawDisplayLists ();
|
||||
FinishView ();
|
||||
|
||||
} else {
|
||||
|
||||
// If kernel visit was needed, drawing and FinishView will already
|
||||
// have been done, so...
|
||||
if (!kernelVisitWasNeeded) {
|
||||
#ifdef G4DEBUG
|
||||
printf("************************** G4OpenGLStoredQtViewer::ComputeView Don't need kernel Visit \n");
|
||||
#endif
|
||||
DrawDisplayLists ();
|
||||
FinishView ();
|
||||
} else {
|
||||
#ifdef G4DEBUG
|
||||
printf("************************** G4OpenGLStoredQtViewer::ComputeView need kernel Visit \n");
|
||||
#endif
|
||||
// However, union cutaways are implemented in DrawDisplayLists, so make
|
||||
// an extra pass...
|
||||
if (fVP.IsCutaway() &&
|
||||
fVP.GetCutawayMode() == G4ViewParameters::cutawayUnion) {
|
||||
ClearView();
|
||||
DrawDisplayLists ();
|
||||
FinishView ();
|
||||
#ifdef G4DEBUG
|
||||
printf("*************************** CASE 4 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
|
||||
#endif
|
||||
} else { // ADD TO AVOID KernelVisit=1 and nothing to display
|
||||
DrawDisplayLists ();
|
||||
FinishView ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isRecording()) {
|
||||
savePPMToTemp();
|
||||
}
|
||||
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::ComputeView %d %d ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n",WinSize_x, WinSize_y);
|
||||
#endif
|
||||
hasToRepaint =true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
- Lors du resize de la fenetre, on doit non pas redessiner le detecteur, mais aussi les evenements
|
||||
*/
|
||||
- Lors du resize de la fenetre, on doit non pas redessiner le detecteur, mais aussi les evenements
|
||||
*/
|
||||
void G4OpenGLStoredQtViewer::resizeGL(
|
||||
int aWidth
|
||||
,int aHeight)
|
||||
int aWidth
|
||||
,int aHeight)
|
||||
{
|
||||
glViewport(0, 0, aWidth, aHeight);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
if (((WinSize_x != (G4int)aWidth)) || (WinSize_y != (G4int) aHeight)) {
|
||||
hasToRepaint =true;
|
||||
}
|
||||
WinSize_x = (G4int) aWidth;
|
||||
WinSize_y = (G4int) aHeight;
|
||||
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::resizeGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ %d %d=%d %d=%d\n",hasToRepaint,width(),aWidth,height(),aHeight);
|
||||
#endif
|
||||
G4resizeGL(aWidth,aHeight);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void G4OpenGLStoredQtViewer::paintGL()
|
||||
{
|
||||
if (!readyToPaint) {
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::paintGL ============ Not ready %d\n",readyToPaint);
|
||||
{
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::paintGL ??\n");
|
||||
#endif
|
||||
readyToPaint= true;
|
||||
return;
|
||||
}
|
||||
// DO NOT RESIZE IF SIZE HAS NOT CHANGE :
|
||||
// WHEN CLICK ON THE FRAME FOR EXAMPLE
|
||||
// EXECEPT WHEN MOUSE MOVE EVENT
|
||||
if ( !hasToRepaint) {
|
||||
if (((WinSize_x == (G4int)width())) &&(WinSize_y == (G4int) height())) {
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::paintGL ============ Dont repaint\n");
|
||||
if (!readyToPaint) {
|
||||
readyToPaint= true;
|
||||
return;
|
||||
}
|
||||
// DO NOT RESIZE IF SIZE HAS NOT CHANGE :
|
||||
// WHEN CLICK ON THE FRAME FOR EXAMPLE
|
||||
// EXECEPT WHEN MOUSE MOVE EVENT
|
||||
if ( !hasToRepaint) {
|
||||
if (((WinSize_x == (G4int)width())) &&(WinSize_y == (G4int) height())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::paintGL VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV ready %d\n",readyToPaint);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
nbPaint++;
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::paintGL VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV %d ready %d\n",nbPaint,readyToPaint);
|
||||
#endif
|
||||
WinSize_x = (G4int) width();
|
||||
WinSize_y = (G4int) height();
|
||||
|
||||
glViewport (0, 0, width(), height());
|
||||
// glLoadIdentity();
|
||||
|
||||
WinSize_x = (G4int) width();
|
||||
WinSize_y = (G4int) height();
|
||||
|
||||
SetView();
|
||||
setupViewport(width(),height());
|
||||
|
||||
// // printf("before ClearView\n");
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf(" ClearView\n");
|
||||
SetView();
|
||||
|
||||
ClearView (); //ok, put the background correct
|
||||
ComputeView();
|
||||
|
||||
hasToRepaint =false;
|
||||
|
||||
#ifdef G4DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ready %d\n",readyToPaint);
|
||||
#endif
|
||||
|
||||
ClearView (); //ok, put the background correct
|
||||
DrawView();
|
||||
|
||||
hasToRepaint =false;
|
||||
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ %d ready %d\n",nbPaint,readyToPaint);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void G4OpenGLStoredQtViewer::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::mousePressEvent\n");
|
||||
#endif
|
||||
G4MousePressEvent(event->pos());
|
||||
G4MousePressEvent(event);
|
||||
}
|
||||
|
||||
void G4OpenGLStoredQtViewer::keyPressEvent (QKeyEvent * event)
|
||||
{
|
||||
G4keyPressEvent(event);
|
||||
}
|
||||
|
||||
void G4OpenGLStoredQtViewer::wheelEvent (QWheelEvent * event)
|
||||
{
|
||||
G4wheelEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function was build in order to make a zoom on double clic event.
|
||||
* It was think to build a rubberband on the zoom area, but never work fine
|
||||
*/
|
||||
void G4OpenGLStoredQtViewer::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
{
|
||||
G4MouseDoubleClickEvent();
|
||||
}
|
||||
|
||||
void G4OpenGLStoredQtViewer::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
G4MouseReleaseEvent();
|
||||
}
|
||||
|
||||
void G4OpenGLStoredQtViewer::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
#ifdef GEANT4_QT_DEBUG
|
||||
printf("G4OpenGLStoredQtViewer::mouseMoveEvent\n");
|
||||
#endif
|
||||
#if QT_VERSION < 0x040000
|
||||
G4MouseMoveEvent(event->x(),event->y(),event->button());
|
||||
#else
|
||||
G4MouseMoveEvent(event->x(),event->y(),event->buttons());
|
||||
#endif
|
||||
// DrawView();
|
||||
G4MouseMoveEvent(event);
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLStoredQtViewer::contextMenuEvent(QContextMenuEvent *e)
|
||||
{
|
||||
manageContextMenuEvent(e);
|
||||
G4manageContextMenuEvent(e);
|
||||
}
|
||||
|
||||
void G4OpenGLStoredQtViewer::updateQWidget() {
|
||||
@@ -326,4 +294,17 @@ void G4OpenGLStoredQtViewer::updateQWidget() {
|
||||
hasToRepaint= false;
|
||||
}
|
||||
|
||||
void G4OpenGLStoredQtViewer::ShowView (
|
||||
)
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
|
||||
{
|
||||
#if QT_VERSION < 0x040000
|
||||
setActiveWindow();
|
||||
#else
|
||||
activateWindow();
|
||||
#endif
|
||||
updateQWidget();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredSceneHandler.cc,v 1.34 2007/04/04 16:50:27 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4OpenGLStoredSceneHandler.cc,v 1.39 2008/11/06 13:43:44 lgarnier Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
@@ -54,13 +54,31 @@
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4AttHolder.hh"
|
||||
|
||||
G4OpenGLStoredSceneHandler::G4OpenGLStoredSceneHandler (G4VGraphicsSystem& system,
|
||||
const G4String& name):
|
||||
G4OpenGLStoredSceneHandler::PO::PO
|
||||
(G4int id,
|
||||
const G4Transform3D& tr):
|
||||
fDisplayListId(id),
|
||||
fTransform(tr),
|
||||
fPickName(0)
|
||||
{}
|
||||
|
||||
G4OpenGLStoredSceneHandler::TO::TO
|
||||
(G4int id,
|
||||
const G4Transform3D& tr):
|
||||
fDisplayListId(id),
|
||||
fTransform(tr),
|
||||
fPickName(0),
|
||||
fStartTime(-DBL_MAX),
|
||||
fEndTime(DBL_MAX)
|
||||
{}
|
||||
|
||||
G4OpenGLStoredSceneHandler::G4OpenGLStoredSceneHandler
|
||||
(G4VGraphicsSystem& system,
|
||||
const G4String& name):
|
||||
G4OpenGLSceneHandler (system, fSceneIdCount++, name),
|
||||
fMemoryForDisplayLists (true),
|
||||
fAddPrimitivePreambleNestingDepth (0),
|
||||
fTopPODL (0),
|
||||
fProcessing2D (false)
|
||||
fTopPODL (0)
|
||||
{}
|
||||
|
||||
G4OpenGLStoredSceneHandler::~G4OpenGLStoredSceneHandler ()
|
||||
@@ -85,7 +103,7 @@ void G4OpenGLStoredSceneHandler::AddPrimitivePreamble(const G4Visible& visible)
|
||||
|
||||
if (fMemoryForDisplayLists) {
|
||||
fDisplayListId = glGenLists (1);
|
||||
if (!fDisplayListId) { // Could pre-allocate?
|
||||
if (glGetError() == GL_OUT_OF_MEMORY) { // Could pre-allocate?
|
||||
G4cout <<
|
||||
"********************* WARNING! ********************"
|
||||
"\nUnable to allocate any more display lists in OpenGL."
|
||||
@@ -133,10 +151,13 @@ void G4OpenGLStoredSceneHandler::AddPrimitivePreamble(const G4Visible& visible)
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho (-1., 1., -1., 1., -G4OPENGL_DBL_MAX, G4OPENGL_DBL_MAX);
|
||||
glOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
G4OpenGLTransform3D oglt (*fpObjectTransformation);
|
||||
glMultMatrixd (oglt.GetGLMatrix ());
|
||||
glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,8 +171,21 @@ void G4OpenGLStoredSceneHandler::AddPrimitivePostamble()
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
// if ((glGetError() == GL_TABLE_TOO_LARGE) || (glGetError() == GL_OUT_OF_MEMORY)) { // Could close?
|
||||
if (glGetError() == GL_OUT_OF_MEMORY) { // Could close?
|
||||
G4cout <<
|
||||
"ERROR: G4OpenGLStoredSceneHandler::EndModeling: Failure to allocate"
|
||||
" display List for fTopPODL - try OpenGL Immediated mode."
|
||||
<< G4endl;
|
||||
}
|
||||
if (fMemoryForDisplayLists) {
|
||||
glEndList();
|
||||
if (glGetError() == GL_OUT_OF_MEMORY) { // Could close?
|
||||
G4cout <<
|
||||
"ERROR: G4OpenGLStoredSceneHandler::EndModeling: Failure to allocate"
|
||||
" display List for fTopPODL - try OpenGL Immediated mode."
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
if (fReadyForTransients || !fMemoryForDisplayLists) {
|
||||
glPopMatrix();
|
||||
@@ -238,15 +272,14 @@ void G4OpenGLStoredSceneHandler::EndPrimitives ()
|
||||
G4OpenGLSceneHandler::EndPrimitives ();
|
||||
}
|
||||
|
||||
void G4OpenGLStoredSceneHandler::BeginPrimitives2D()
|
||||
void G4OpenGLStoredSceneHandler::BeginPrimitives2D
|
||||
(const G4Transform3D& objectTransformation)
|
||||
{
|
||||
G4OpenGLSceneHandler::BeginPrimitives2D();
|
||||
fProcessing2D = true;
|
||||
G4OpenGLSceneHandler::BeginPrimitives2D(objectTransformation);
|
||||
}
|
||||
|
||||
void G4OpenGLStoredSceneHandler::EndPrimitives2D ()
|
||||
{
|
||||
fProcessing2D = false;
|
||||
G4OpenGLSceneHandler::EndPrimitives2D ();
|
||||
}
|
||||
|
||||
@@ -262,7 +295,7 @@ void G4OpenGLStoredSceneHandler::BeginModeling () {
|
||||
void G4OpenGLStoredSceneHandler::EndModeling () {
|
||||
// Make a List which calls the other lists.
|
||||
fTopPODL = glGenLists (1);
|
||||
if (!fTopPODL) {
|
||||
if (glGetError() == GL_OUT_OF_MEMORY) { // Could pre-allocate?
|
||||
G4cout <<
|
||||
"ERROR: G4OpenGLStoredSceneHandler::EndModeling: Failure to allocate"
|
||||
" display List for fTopPODL - try OpenGL Immediated mode."
|
||||
@@ -280,6 +313,12 @@ void G4OpenGLStoredSceneHandler::EndModeling () {
|
||||
}
|
||||
}
|
||||
glEndList ();
|
||||
if (glGetError() == GL_OUT_OF_MEMORY) { // Could close?
|
||||
G4cout <<
|
||||
"ERROR: G4OpenGLStoredSceneHandler::EndModeling: Failure to allocate"
|
||||
" display List for fTopPODL - try OpenGL Immediated mode."
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
G4VSceneHandler::EndModeling ();
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredViewer.cc,v 1.23 2007/04/04 16:50:27 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4OpenGLStoredViewer.cc,v 1.24 2008/04/04 13:32:22 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 7th February 1997
|
||||
@@ -167,11 +167,11 @@ void G4OpenGLStoredViewer::DrawDisplayLists () {
|
||||
}
|
||||
|
||||
// Display time at "head" of time range, which is fEndTime...
|
||||
if (fDisplayHeadTime && fEndTime < G4OPENGL_DBL_MAX) {
|
||||
if (fDisplayHeadTime && fEndTime < DBL_MAX) {
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho (-1., 1., -1., 1., -G4OPENGL_DBL_MAX, G4OPENGL_DBL_MAX);
|
||||
glOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
@@ -192,7 +192,7 @@ void G4OpenGLStoredViewer::DrawDisplayLists () {
|
||||
}
|
||||
|
||||
// Display light front...
|
||||
if (fDisplayLightFront && fEndTime < G4OPENGL_DBL_MAX) {
|
||||
if (fDisplayLightFront && fEndTime < DBL_MAX) {
|
||||
G4double lightFrontRadius = (fEndTime - fDisplayLightFrontT) * c_light;
|
||||
if (lightFrontRadius > 0.) {
|
||||
G4Point3D lightFrontCentre(fDisplayLightFrontX, fDisplayLightFrontY, fDisplayLightFrontZ);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredWin32.cc,v 1.14 2006/08/14 12:07:19 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// OpenGLStoredWin32 graphics system factory.
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredWin32Viewer.cc,v 1.19 2007/04/04 16:50:27 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Class G4OpenGLStoredWin32Viewer : a class derived from G4OpenGLWin32Viewer and
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredX.cc,v 1.14 2007/08/21 14:05:51 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredXViewer.cc,v 1.22 2007/04/04 16:50:27 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 7th February 1997
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredXm.cc,v 1.11 2006/08/14 12:07:19 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredXmViewer.cc,v 1.22 2007/04/04 16:50:27 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLTransform3D.cc,v 1.8 2006/06/29 21:19:32 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 24th October 1996
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLViewer.cc,v 1.34 2007/05/24 18:27:13 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4OpenGLViewer.cc,v 1.41 2008/10/24 13:49:19 lgarnier Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 27th March 1996
|
||||
@@ -89,8 +89,8 @@ background (G4Colour(0.,0.,0.)),
|
||||
transparency_enabled (true),
|
||||
antialiasing_enabled (false),
|
||||
haloing_enabled (false),
|
||||
fStartTime(-G4OPENGL_DBL_MAX),
|
||||
fEndTime(G4OPENGL_DBL_MAX),
|
||||
fStartTime(-DBL_MAX),
|
||||
fEndTime(DBL_MAX),
|
||||
fFadeFactor(0.),
|
||||
fDisplayHeadTime(false),
|
||||
fDisplayHeadTimeX(-0.9),
|
||||
@@ -147,7 +147,12 @@ void G4OpenGLViewer::ClearView () {
|
||||
}
|
||||
|
||||
void G4OpenGLViewer::SetView () {
|
||||
|
||||
|
||||
if (!fSceneHandler.GetScene()) {
|
||||
G4cerr << "G4OpenGLStoredQtViewer: Creating a Viewer without a scene is not allowed. \nPlease use /vis/scene/create before /vis/open/.... "
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
// Calculates view representation based on extent of object being
|
||||
// viewed and (initial) viewpoint. (Note: it can change later due
|
||||
// to user interaction via visualization system's GUI.)
|
||||
@@ -371,18 +376,16 @@ void G4OpenGLViewer::print() {
|
||||
// Print vectored PostScript
|
||||
|
||||
G4int size = 5000000;
|
||||
|
||||
GLfloat* feedback_buffer;
|
||||
GLint returned;
|
||||
FILE* file;
|
||||
|
||||
feedback_buffer = new GLfloat[size];
|
||||
GLfloat* feedback_buffer = new GLfloat[size];
|
||||
glFeedbackBuffer (size, GL_3D_COLOR, feedback_buffer);
|
||||
glRenderMode (GL_FEEDBACK);
|
||||
|
||||
DrawView();
|
||||
|
||||
GLint returned;
|
||||
returned = glRenderMode (GL_RENDER);
|
||||
|
||||
FILE* file;
|
||||
if (print_string) {
|
||||
file = fopen (print_string, "w");
|
||||
if (file) {
|
||||
@@ -723,6 +726,45 @@ extern "C" {
|
||||
}
|
||||
}
|
||||
|
||||
GLdouble G4OpenGLViewer::getSceneNearWidth()
|
||||
{
|
||||
const G4Point3D targetPoint
|
||||
= fSceneHandler.GetScene()->GetStandardTargetPoint()
|
||||
+ fVP.GetCurrentTargetPoint ();
|
||||
G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
|
||||
if(radius<=0.) radius = 1.;
|
||||
const G4double cameraDistance = fVP.GetCameraDistance (radius);
|
||||
const GLdouble pnear = fVP.GetNearDistance (cameraDistance, radius);
|
||||
return 2 * fVP.GetFrontHalfHeight (pnear, radius);
|
||||
}
|
||||
|
||||
GLdouble G4OpenGLViewer::getSceneFarWidth()
|
||||
{
|
||||
const G4Point3D targetPoint
|
||||
= fSceneHandler.GetScene()->GetStandardTargetPoint()
|
||||
+ fVP.GetCurrentTargetPoint ();
|
||||
G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
|
||||
if(radius<=0.) radius = 1.;
|
||||
const G4double cameraDistance = fVP.GetCameraDistance (radius);
|
||||
const GLdouble pnear = fVP.GetNearDistance (cameraDistance, radius);
|
||||
const GLdouble pfar = fVP.GetFarDistance (cameraDistance, pnear, radius);
|
||||
return 2 * fVP.GetFrontHalfHeight (pfar, radius);
|
||||
}
|
||||
|
||||
|
||||
GLdouble G4OpenGLViewer::getSceneDepth()
|
||||
{
|
||||
const G4Point3D targetPoint
|
||||
= fSceneHandler.GetScene()->GetStandardTargetPoint()
|
||||
+ fVP.GetCurrentTargetPoint ();
|
||||
G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
|
||||
if(radius<=0.) radius = 1.;
|
||||
const G4double cameraDistance = fVP.GetCameraDistance (radius);
|
||||
const GLdouble pnear = fVP.GetNearDistance (cameraDistance, radius);
|
||||
return fVP.GetFarDistance (cameraDistance, pnear, radius)- pnear;
|
||||
}
|
||||
|
||||
|
||||
void G4OpenGLViewer::spewSortedFeedback(FILE * file, GLint size, GLfloat * buffer)
|
||||
{
|
||||
int token;
|
||||
@@ -839,4 +881,93 @@ void G4OpenGLViewer::spewSortedFeedback(FILE * file, GLint size, GLfloat * buffe
|
||||
free(prims);
|
||||
}
|
||||
|
||||
void G4OpenGLViewer::rotateScene(G4double dx, G4double dy,G4double deltaRotation)
|
||||
{
|
||||
|
||||
G4Vector3D vp;
|
||||
G4Vector3D up;
|
||||
|
||||
G4Vector3D xprime;
|
||||
G4Vector3D yprime;
|
||||
G4Vector3D zprime;
|
||||
|
||||
G4double delta_alpha;
|
||||
G4double delta_theta;
|
||||
|
||||
G4Vector3D new_vp;
|
||||
G4Vector3D new_up;
|
||||
|
||||
G4double cosalpha;
|
||||
G4double sinalpha;
|
||||
|
||||
G4Vector3D a1;
|
||||
G4Vector3D a2;
|
||||
G4Vector3D delta;
|
||||
G4Vector3D viewPoint;
|
||||
|
||||
|
||||
//phi spin stuff here
|
||||
|
||||
vp = fVP.GetViewpointDirection ().unit ();
|
||||
up = fVP.GetUpVector ().unit ();
|
||||
|
||||
yprime = (up.cross(vp)).unit();
|
||||
zprime = (vp.cross(yprime)).unit();
|
||||
|
||||
if (fVP.GetLightsMoveWithCamera()) {
|
||||
delta_alpha = dy * deltaRotation;
|
||||
delta_theta = -dx * deltaRotation;
|
||||
} else {
|
||||
delta_alpha = -dy * deltaRotation;
|
||||
delta_theta = dx * deltaRotation;
|
||||
}
|
||||
|
||||
delta_alpha *= deg;
|
||||
delta_theta *= deg;
|
||||
|
||||
new_vp = std::cos(delta_alpha) * vp + std::sin(delta_alpha) * zprime;
|
||||
|
||||
// to avoid z rotation flipping
|
||||
// to allow more than 360° rotation
|
||||
|
||||
const G4Point3D targetPoint
|
||||
= fSceneHandler.GetScene()->GetStandardTargetPoint()
|
||||
+ fVP.GetCurrentTargetPoint ();
|
||||
G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
|
||||
if(radius<=0.) radius = 1.;
|
||||
const G4double cameraDistance = fVP.GetCameraDistance (radius);
|
||||
const G4Point3D cameraPosition =
|
||||
targetPoint + cameraDistance * fVP.GetViewpointDirection().unit();
|
||||
|
||||
if (fVP.GetLightsMoveWithCamera()) {
|
||||
new_up = (new_vp.cross(yprime)).unit();
|
||||
if (new_vp.z()*vp.z() <0) {
|
||||
new_up.set(new_up.x(),-new_up.y(),new_up.z());
|
||||
}
|
||||
} else {
|
||||
new_up = up;
|
||||
if (new_vp.z()*vp.z() <0) {
|
||||
new_up.set(new_up.x(),-new_up.y(),new_up.z());
|
||||
}
|
||||
}
|
||||
fVP.SetUpVector(new_up);
|
||||
////////////////
|
||||
// Rotates by fixed azimuthal angle delta_theta.
|
||||
|
||||
cosalpha = new_up.dot (new_vp.unit());
|
||||
sinalpha = std::sqrt (1. - std::pow (cosalpha, 2));
|
||||
yprime = (new_up.cross (new_vp.unit())).unit ();
|
||||
xprime = yprime.cross (new_up);
|
||||
// Projection of vp on plane perpendicular to up...
|
||||
a1 = sinalpha * xprime;
|
||||
// Required new projection...
|
||||
a2 = sinalpha * (std::cos (delta_theta) * xprime + std::sin (delta_theta) * yprime);
|
||||
// Required Increment vector...
|
||||
delta = a2 - a1;
|
||||
// So new viewpoint is...
|
||||
viewPoint = new_vp.unit() + delta;
|
||||
|
||||
fVP.SetViewAndLights (viewPoint);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLViewerMessenger.cc,v 1.11 2007/11/15 10:14:23 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4OpenGLViewerMessenger.cc,v 1.12 2008/04/04 13:32:22 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
|
||||
#ifdef G4VIS_BUILD_OPENGL_DRIVER
|
||||
|
||||
@@ -157,7 +157,7 @@ G4OpenGLViewerMessenger::G4OpenGLViewerMessenger()
|
||||
new G4UIcommand("/vis/ogl/set/endTime", this);
|
||||
fpCommandEndTime->SetGuidance("Set end and range of track time.");
|
||||
parameter = new G4UIparameter ("end-time", 'd', omitable = false);
|
||||
parameter->SetDefaultValue(G4OPENGL_DBL_MAX);
|
||||
parameter->SetDefaultValue(DBL_MAX);
|
||||
fpCommandEndTime->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("end-time-unit", 's', omitable = false);
|
||||
parameter->SetDefaultValue("ns");
|
||||
@@ -187,7 +187,7 @@ G4OpenGLViewerMessenger::G4OpenGLViewerMessenger()
|
||||
new G4UIcommand("/vis/ogl/set/startTime", this);
|
||||
fpCommandStartTime->SetGuidance("Set start and range of track time.");
|
||||
parameter = new G4UIparameter ("start-time", 'd', omitable = false);
|
||||
parameter->SetDefaultValue(-G4OPENGL_DBL_MAX);
|
||||
parameter->SetDefaultValue(-DBL_MAX);
|
||||
fpCommandStartTime->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("start-time-unit", 's', omitable = false);
|
||||
parameter->SetDefaultValue("ns");
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLWin32Viewer.cc,v 1.17 2006/06/29 21:19:36 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// G4OpenGLWin32Viewer : Class to provide WindowsNT specific
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXViewer.cc,v 1.42 2007/05/25 10:47:17 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 7th February 1997
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmBox.cc,v 1.6 2006/06/29 21:19:40 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//Box container class
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmConvenienceRoutines.cc,v 1.11 2006/06/29 21:19:42 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 16th April 1997
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmFourArrowButtons.cc,v 1.5 2006/06/29 21:19:44 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//Four arrow buttons class. Inherits from G4OpenGLXmVWidgetComponent
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmFramedBox.cc,v 1.6 2006/06/29 21:19:46 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//Framed box container class
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmMainMenubarCallbacks.cc,v 1.13 2006/06/29 21:19:48 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 16th April 1997
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmPanningCallbacks.cc,v 1.8 2006/06/29 21:19:50 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 16th April 1997
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmPushButton.cc,v 1.6 2006/06/29 21:19:52 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//Push button class. Inherits from G4OpenGLXmVWidgetComponent
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmRadioButton.cc,v 1.6 2006/06/29 21:19:54 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//Radio button class. Inherits from G4OpenGLXmVWidgetComponent
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmRotationCallbacks.cc,v 1.14 2006/06/29 21:19:56 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4OpenGLXmRotationCallbacks.cc,v 1.16 2008/07/28 15:36:45 lgarnier Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 16th April 1997
|
||||
@@ -63,6 +63,13 @@ void G4OpenGLXmViewer::rotate_in_theta (XtPointer clientData,
|
||||
{
|
||||
//theta spin stuff here
|
||||
G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
|
||||
|
||||
if (pView->rotate_right) {
|
||||
pView->rotateScene((G4double)pView->rot_sens,0,1);
|
||||
} else {
|
||||
pView->rotateScene(-(G4double)pView->rot_sens,0,1);
|
||||
}
|
||||
/*
|
||||
G4double delta_theta;
|
||||
|
||||
if (pView->fVP.GetLightsMoveWithCamera()) {
|
||||
@@ -99,6 +106,7 @@ void G4OpenGLXmViewer::rotate_in_theta (XtPointer clientData,
|
||||
G4Vector3D viewPoint = vp + delta;
|
||||
|
||||
pView->fVP.SetViewAndLights (viewPoint);
|
||||
*/
|
||||
|
||||
pView->SetView ();
|
||||
pView->ClearView ();
|
||||
@@ -131,9 +139,15 @@ void G4OpenGLXmViewer::rotate_in_phi (XtPointer clientData,
|
||||
XtIntervalId* timer_id)
|
||||
{
|
||||
//phi spin stuff here
|
||||
G4double delta_alpha;
|
||||
// G4double delta_alpha;
|
||||
G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
|
||||
|
||||
if (pView -> rotate_up) {
|
||||
pView->rotateScene(0,-(G4double)pView->rot_sens,1);
|
||||
} else {
|
||||
pView->rotateScene(0,(G4double)pView->rot_sens,1);
|
||||
}
|
||||
/*
|
||||
if (pView->fVP.GetLightsMoveWithCamera()) {
|
||||
if (pView -> rotate_up) {
|
||||
delta_alpha = -((G4double)pView->rot_sens);
|
||||
@@ -166,6 +180,7 @@ void G4OpenGLXmViewer::rotate_in_phi (XtPointer clientData,
|
||||
pView->fVP.SetUpVector(new_up);
|
||||
}
|
||||
|
||||
*/
|
||||
pView->SetView ();
|
||||
pView->ClearView ();
|
||||
pView->DrawView ();
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmSeparator.cc,v 1.5 2006/06/29 21:19:58 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//Separator class. Inherits from G4OpenGLXmVWidgetComponent
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmSliderBar.cc,v 1.7 2006/06/29 21:20:00 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//Slider bar class. Inherits from G4OpenGLXmVWidgetComponent
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmStyleCallbacks.cc,v 1.14 2006/06/29 21:20:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 16th April 1997
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmTextField.cc,v 1.7 2006/06/29 21:20:04 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//Text field class. Inherits from G4OpenGLXmVWidgetComponent
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmTopLevelShell.cc,v 1.5 2006/06/29 21:20:06 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//Top level shell class
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmVWidgetComponent.cc,v 1.5 2006/06/29 21:20:08 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//Base class for all Motif component widgets
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmVWidgetContainer.cc,v 1.5 2006/06/29 21:20:10 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//Base class for all Motif container widgets
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmVWidgetObject.cc,v 1.5 2006/06/29 21:20:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//Virtual base class for all Motif widgets.
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmVWidgetShell.cc,v 1.5 2006/06/29 21:20:14 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//Base class for all Motif shell widgets
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmViewer.cc,v 1.24 2007/08/21 14:05:51 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmViewerMessenger.cc,v 1.4 2006/06/29 21:20:18 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
|
||||
#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXmWindowHandlingCallbacks.cc,v 1.6 2006/06/29 21:20:20 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 16th June 1997
|
||||
|
||||
Reference in New Issue
Block a user