Import Geant4 10.7.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2020-06-26 10:23:25 +02:00
parent c02c370437
commit 67ba86d073
1871 changed files with 174422 additions and 131884 deletions
@@ -34,12 +34,20 @@
#include <Inventor/Qt/SoQt.h>
#include "G4SoQt.hh"
#include "G4UIQt.hh"
#include "G4Qt.hh"
#include "G4UImanager.hh"
#include <qobject.h>
//#include "G4Qt.hh"
#include "G4OpenInventorSceneHandler.hh"
#include "G4OpenInventorQtViewer.hh"
#ifndef G4GMAKE
#include "moc_G4OpenInventorQt.cpp"
#endif
G4OpenInventorQt::G4OpenInventorQt()
: G4OpenInventor("OpenInventorQt", "OIQT", G4VGraphicsSystem::threeD),
: G4OpenInventor("OpenInventorQt", "OIQt", G4VGraphicsSystem::threeD),
fInited(false)
{
}
@@ -48,16 +56,20 @@ void G4OpenInventorQt::Initialize()
{
if(fInited) return; //Done
G4cout << "G4OpenInventorQt: SETINTERACTORMANAGER " << G4SoQt::getInstance()
<< G4endl;
// FWJ DEBUG
// G4cout << "G4OpenInventorQt: SETINTERACTORMANAGER " << G4SoQt::getInstance()
// << G4endl;
SetInteractorManager(G4SoQt::getInstance());
G4cout << "G4OpenInventorQt: GETINTERACTORMANAGER " << GetInteractorManager()
<< G4endl;
// FWJ DEBUG
// G4cout << "G4OpenInventorQt: GETINTERACTORMANAGER " << GetInteractorManager()
// << G4endl;
// FWJ from G4OIXt: these have no counterpart in Qt
// GetInteractorManager() ->
// RemoveDispatcher((G4DispatchFunction)XtDispatchEvent);
// GetInteractorManager() ->
// GetInteractorManager() ->
// RemoveDispatcher((G4DispatchFunction)XtDispatchEvent);
// GetInteractorManager() ->
// AddDispatcher((G4DispatchFunction)SoXt::dispatchEvent);
// Widget top = (Widget)GetInteractorManager()->GetMainInteractor();
@@ -83,14 +95,16 @@ void G4OpenInventorQt::Initialize()
// }
// FWJ for now, create an independent main window
// NOW should be done in G4SoQt [public G4VInteractorManager]
//QWidget* mainWin = SoQt::init("Geant4");
// Note that GetMainInteractor() returns G4Interactor [typedef void*]
QWidget* mainWin = (QWidget*)(GetInteractorManager()->GetMainInteractor());
G4cout << "OpenInventorQt: OBTAINED SoQt main window " << mainWin << G4endl;
// G4cout << "OpenInventorQt: CREATED SoQt main window " << mainWin << G4endl;
G4cout << "SoQt::getTopLevelWidget()" << SoQt::getTopLevelWidget() << G4endl;
//QWidget* mainWin = (QWidget*)(GetInteractorManager()->GetMainInteractor());
// FWJ DEBUG
// G4cout << "OpenInventorQt: OBTAINED SoQt main window " << mainWin << G4endl;
// G4cout << "SoQt::getTopLevelWidget()" << SoQt::getTopLevelWidget() << G4endl;
// In parent G4OpenInventor
InitNodes();
@@ -103,12 +117,22 @@ G4OpenInventorQt::~G4OpenInventorQt()
}
G4VViewer* G4OpenInventorQt::CreateViewer(G4VSceneHandler& scene,
const G4String& name)
const G4String& name)
{
G4UImanager* UI = G4UImanager::GetUIpointer();
G4UIQt *uiQt = static_cast<G4UIQt*> (UI->GetG4UIWindow());
if (uiQt) {
if (!((G4Qt*)(GetInteractorManager()->GetMainInteractor()))->IsExternalApp()) {
QWidget* mainWin = (QWidget*)(GetInteractorManager()->GetMainInteractor());
// Trying to get around git by adding this comment 2
uiQt->AddTabWidget((QWidget*)mainWin,QString(name));
}
}
Initialize();
G4OpenInventorSceneHandler* pScene = (G4OpenInventorSceneHandler*)&scene;
return new G4OpenInventorQtViewer(*pScene, name);
}
#endif
@@ -34,7 +34,12 @@
#include <Inventor/Qt/SoQt.h>
#include <Inventor/events/SoKeyboardEvent.h>
#include <QMenuBar>
//#include <QMainWindow>
#ifndef G4GMAKE
#include "moc_G4OpenInventorQtExaminerViewer.cpp"
#endif
G4OpenInventorQtExaminerViewer* G4OpenInventorQtExaminerViewer::viewer = 0;
@@ -42,12 +47,20 @@ G4OpenInventorQtExaminerViewer* G4OpenInventorQtExaminerViewer::viewer = 0;
// Constructor
G4OpenInventorQtExaminerViewer::
G4OpenInventorQtExaminerViewer(QWidget* parent, const char* name, SbBool embed,
SoQtFullViewer::BuildFlag flag,
SoQtFullViewer::BuildFlag flag,
SoQtViewer::Type type)
: SoQtExaminerViewer(parent, name, embed, flag, type)
{
G4cout << "G4OpenInventorQtExaminerViewer CONSTRUCTOR CALLED" << G4endl;
// FWJ DEBUG
// G4cout << "G4OpenInventorQtExaminerViewer CONSTRUCTOR CALLED" << G4endl;
// G4cout << "G4OpenInventorQtExaminerViewer parent=" << parent << G4endl;
// FWJ THIS DOESN'T WORK APPARENTLY NO MAINWINDOW
// QMenuBar* menubar = ((QMainWindow*)parent)->menuBar();
// G4cout << "G4OpenInventorQtExaminerViewer menubar=" << menubar << G4endl;
viewer = this;
construct(TRUE);
}
// Destructor
@@ -70,8 +83,32 @@ G4OpenInventorQtExaminerViewer::~G4OpenInventorQtExaminerViewer()
}
void G4OpenInventorQtExaminerViewer::construct(const SbBool)
{
// setClassName(thisClassName);
buildWidget(getParentWidget());
}
// Adds a menu bar and a few menu items to the viewer.
void G4OpenInventorQtExaminerViewer::buildWidget(QWidget* parent)
{
if (!parent)
SoDebugError::post("G4OpenInventorQtExaminerViewer::buildWidget",
"Error: Parent is null.");
// CONTINUE HERE LATER
// QMenuBar* menubar = new QMenuBar(parent);
// G4cout << "G4OpenInventorQtExaminerViewer: GOT A menubar=" <<
// menubar << G4endl;
// QMenu* filemenu = new QMenu("File");
// menubar->addMenu(filemenu);
//
// filemenu->addAction(newAct);
}
// FWJ try to handle events as in XtExaminerViewer
SbBool
SbBool
G4OpenInventorQtExaminerViewer::processSoEvent(const SoEvent* const ev)
{
@@ -84,7 +121,8 @@ G4OpenInventorQtExaminerViewer::processSoEvent(const SoEvent* const ev)
if (SoKeyboardEvent::isKeyPressEvent(ev, ke->getKey())) {
switch (ke->getKey()) {
case SoKeyboardEvent::E:
G4cout << "E KEY PRESSED, EXITING Qt MAIN LOOP" << G4endl;
G4cout <<
"E KEY PRESSED, EXITING OIQT VIEWER SECONDARY LOOP" << G4endl;
SoQt::exitMainLoop();
break;
default:
@@ -54,6 +54,10 @@
#include "G4VInteractorManager.hh"
#include "G4VisManager.hh"
#ifndef G4GMAKE
#include "moc_G4OpenInventorQtViewer.cpp"
#endif
G4OpenInventorQtViewer::G4OpenInventorQtViewer(
G4OpenInventorSceneHandler& sceneHandler, const G4String& name)
: G4OpenInventorViewer(sceneHandler, name)
@@ -70,8 +74,9 @@ void G4OpenInventorQtViewer::Initialise()
QWidget* parent = SoQt::getTopLevelWidget();
G4cout << "G4OIQtViewer: Creating G4OIQtExaminerViewer with parent " <<
parent << G4endl;
// FWJ DEBUG
// G4cout << "G4OIQtViewer: Creating G4OIQtExaminerViewer with parent " <<
// parent << G4endl;
// fViewer = new SoQtExaminerViewer(parent, "Geant4", TRUE);
fViewer = new G4OpenInventorQtExaminerViewer(parent, "Geant4", TRUE);
@@ -79,8 +84,8 @@ void G4OpenInventorQtViewer::Initialise()
// G4String wName = fName;
//
// QWidget parent = (QWidget)fInteractorManager->GetParentInteractor();
int width = 600;
int height = 600;
int width = fVP.GetWindowSizeHintX();
int height = fVP.GetWindowSizeHintY();
// FWJ not sure what this is for
// fInteractorManager->AddShell(fShell);
@@ -100,10 +105,13 @@ void G4OpenInventorQtViewer::Initialise()
fViewer->setGLRenderAction(fGL2PSAction);
// Else :
G4cout << "G4OpenInventorQtViewer: setting scene graph " <<
fSoSelection << G4endl;
G4cout << "G4OpenInventorQtViewer: getNumChildren " <<
fSoSelection->getNumChildren() << G4endl;
// FWJ DEBUG
// G4cout << "G4OpenInventorQtViewer: setting scene graph " <<
// fSoSelection << G4endl;
// G4cout << "G4OpenInventorQtViewer: getNumChildren " <<
// fSoSelection->getNumChildren() << G4endl;
fViewer->setSceneGraph(fSoSelection);
fViewer->setTransparencyType(SoGLRenderAction::SORTED_OBJECT_ADD);
fViewer->viewAll();
@@ -113,15 +121,21 @@ void G4OpenInventorQtViewer::Initialise()
// This SHOULD invoke the event loop:
// if(fShell) {
QWidget* mainWin = SoQt::getTopLevelWidget();
G4cout << "G4OIQtViewer: calling SoQt::show on mainWin = " << mainWin
<< G4endl;
// FWJ DEBUG
// G4cout << "G4OIQtViewer: calling SoQt::show on mainWin = " << mainWin
// << G4endl;
SoQt::show(mainWin);
fInteractorManager->FlushAndWaitExecution();
// }
fInteractorManager->SetCreatedInteractor(fViewer->getWidget());
}
G4OpenInventorQtViewer::~G4OpenInventorQtViewer()
{
// if(fShell) fInteractorManager->RemoveShell(fShell);
@@ -175,7 +189,7 @@ SoCamera* G4OpenInventorQtViewer::GetCamera () {
// Widget menu = XmCreatePulldownMenu(aMenuBar,(char*)aName.c_str(),NULL,0);
// // Cascade button :
// Arg args[2];
// XmString cps =
// XmString cps =
// XmStringLtoRCreate((char*)aLabel.c_str(),(char*)XmSTRING_DEFAULT_CHARSET);
// XtSetArg (args[0],XmNlabelString,cps);
// XtSetArg (args[1],XmNsubMenuId,menu);
@@ -102,8 +102,8 @@ void G4OpenInventorWinViewer::Initialise() {
G4String wName = fName;
int width = 600;
int height = 600;
int width = fVP.GetWindowSizeHintX();
int height = fVP.GetWindowSizeHintY();;
HWND parent = (HWND)fInteractorManager->GetParentInteractor ();
if(!parent) {
@@ -26,8 +26,7 @@
//
// F.W. Jones 05012018
#if defined(G4VIS_BUILD_OIQT_DRIVER)
//#if defined(G4INTY_BUILD_QT) || defined(G4INTY_USE_QT)
#ifdef G4VIS_BUILD_OIQT_DRIVER
#include <stdlib.h>
#include <string.h>
@@ -39,17 +38,21 @@
//#include "G4UImanager.hh"
#include <Inventor/Qt/SoQt.h>
#include <QMainWindow>
#include <qwidget.h>
#include <qapplication.h>
#ifndef G4GMAKE
#include "moc_G4SoQt.cpp"
#endif
G4SoQt* G4SoQt::instance = NULL;
static G4bool QtInited = FALSE;
/***************************************************************************/
G4SoQt* G4SoQt::getInstance()
G4SoQt* G4SoQt::getInstance()
{
if (instance==NULL) {
instance = new G4SoQt();
@@ -78,20 +81,30 @@ G4SoQt::G4SoQt()
// to the (one and only one) QApplication object:
// new QApplication (*p_argn, args);
// if(!qApp) {
QWidget* mainWin = SoQt::init("Geant4");
// FWJ DEBUG
// G4cout << "G4SoQt: mainWin=" << mainWin << G4endl;
// G4cout << "G4SoQt: toplevelwidget=" << SoQt::getTopLevelWidget() << G4endl;
// FWJ CAN'T GET MENUBAR THIS WAY OR BY CAST
// QWidget* toplevel = SoQt::getTopLevelWidget();
// QMenuBar* menubar = QMainWindow::menuBar();
// G4cout << "G4OpenInventorQtExaminerViewer menubar=" << menubar << G4endl;
// FWJ will this work?
SetMainInteractor(mainWin);
// SetMainInteractor(qApp);
// AddDispatcher ((G4DispatchFunction)XtDispatchEvent);
// FWJ no locale for now (see G4Qt.cc)
}
/***************************************************************************/
G4SoQt::~G4SoQt()
G4SoQt::~G4SoQt()
{
if(this==instance) {
instance = NULL;
@@ -104,7 +117,7 @@ G4bool G4SoQt::Inited()
}
/***************************************************************************/
void* G4SoQt::GetEvent()
void* G4SoQt::GetEvent()
{
return 0;
}
@@ -124,7 +137,10 @@ void G4SoQt::FlushAndWaitExecution()
/***************************************************************************/
void G4SoQt::SecondaryLoop()
{
G4cout << "G4SoQt: SECONDARY LOOP CALLED !!!!!!" << G4endl;
// FWJ DEBUG
G4cout <<
"ENTERING OIQT VIEWER SECONDARY LOOP... PRESS E KEY TO EXIT" << G4endl;
SoQt::mainLoop();
}
@@ -42,12 +42,16 @@ void SoAlternateRepAction::initClass(
//////////////////////////////////////////////////////////////////////////////
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
{
SO_ACTION_INIT_CLASS(SoAlternateRepAction,SoAction);
static bool first = true;
if (first) {
first = false;
SO_ACTION_INIT_CLASS(SoAlternateRepAction,SoAction);
SO_ENABLE(SoAlternateRepAction,SoSwitchElement); //SGI wants that.
SO_ENABLE(SoAlternateRepAction,SoCoordinateElement); //For SoMarkerSet.
SO_ENABLE(SoAlternateRepAction,SoSwitchElement); //SGI wants that.
SO_ENABLE(SoAlternateRepAction,SoCoordinateElement); //For SoMarkerSet.
SO_ACTION_ADD_METHOD(SoNode,nodeAction);
SO_ACTION_ADD_METHOD(SoNode,nodeAction);
}
}
//////////////////////////////////////////////////////////////////////////////
SoAlternateRepAction::SoAlternateRepAction(
@@ -78,7 +78,11 @@ SoBox::~SoBox() {
// initClass
void SoBox::initClass(){
// This statement is required.
SO_NODE_INIT_CLASS(SoBox,SoShape,"Shape");
static bool first = true;
if (first) {
first = false;
SO_NODE_INIT_CLASS(SoBox,SoShape,"Shape");
}
}
@@ -85,7 +85,11 @@ SoCons::~SoCons() {
// initClass
void SoCons::initClass(){
// This statement is required.
SO_NODE_INIT_CLASS(SoCons,SoShape,"Shape");
static bool first = true;
if (first) {
first = false;
SO_NODE_INIT_CLASS(SoCons,SoShape,"Shape");
}
}
@@ -44,11 +44,15 @@
SO_ACTION_SOURCE(SoCounterAction)
void SoCounterAction::initClass(void){
SO_ACTION_INIT_CLASS(SoCounterAction,SoAction);
static bool first = true;
if (first) {
first = false;
SO_ACTION_INIT_CLASS(SoCounterAction,SoAction);
SO_ENABLE(SoCounterAction,SoSwitchElement);
SO_ENABLE(SoCounterAction,SoSwitchElement);
SO_ACTION_ADD_METHOD(SoNode,SoCounterAction::actionMethod);
SO_ACTION_ADD_METHOD(SoNode,SoCounterAction::actionMethod);
}
}
SoCounterAction::SoCounterAction()
:fCount(0),fLookFor(NODE),fType(),fCheckDerived(TRUE) {
@@ -66,7 +66,11 @@ SO_KIT_SOURCE(SoDetectorTreeKit)
// initClass
void SoDetectorTreeKit::initClass(){
SO_KIT_INIT_CLASS(SoDetectorTreeKit,SoBaseKit,"BaseKit");
static bool first = true;
if (first) {
first = false;
SO_KIT_INIT_CLASS(SoDetectorTreeKit,SoBaseKit,"BaseKit");
}
}
// Constructor
@@ -50,7 +50,11 @@ void SoGL2PSAction::initClass(
//////////////////////////////////////////////////////////////////////////////
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
{
SO_ACTION_INIT_CLASS(SoGL2PSAction,SoGLRenderAction);
static bool first = true;
if (first) {
first = false;
SO_ACTION_INIT_CLASS(SoGL2PSAction,SoGLRenderAction);
}
}
//////////////////////////////////////////////////////////////////////////////
SoGL2PSAction::SoGL2PSAction(
@@ -67,7 +67,11 @@ void SoImageWriter::initClass (
//////////////////////////////////////////////////////////////////////////////
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
{
SO_NODE_INIT_CLASS(SoImageWriter,SoNode,"Node");
static bool first = true;
if (first) {
first = false;
SO_NODE_INIT_CLASS(SoImageWriter,SoNode,"Node");
}
}
//////////////////////////////////////////////////////////////////////////////
SoImageWriter::SoImageWriter(
@@ -630,7 +630,11 @@ void HEPVis_SoMarkerSet::initClass (
//////////////////////////////////////////////////////////////////////////////
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
{
SO_NODE_INIT_CLASS(HEPVis_SoMarkerSet,SoPointSet,"PointSet");
static bool first = true;
if (first) {
first = false;
SO_NODE_INIT_CLASS(HEPVis_SoMarkerSet,SoPointSet,"PointSet");
}
}
//////////////////////////////////////////////////////////////////////////////
HEPVis_SoMarkerSet::HEPVis_SoMarkerSet (
@@ -63,7 +63,11 @@ void Geant4_SoPolyhedron::initClass(
//////////////////////////////////////////////////////////////////////////////
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
{
SO_NODE_INIT_CLASS(Geant4_SoPolyhedron,SoShape,"Shape");
static bool first = true;
if (first) {
first = false;
SO_NODE_INIT_CLASS(Geant4_SoPolyhedron,SoShape,"Shape");
}
}
//////////////////////////////////////////////////////////////////////////////
Geant4_SoPolyhedron::Geant4_SoPolyhedron(
@@ -90,7 +90,11 @@ SoTrap::~SoTrap() {
// initClass
void SoTrap::initClass(){
// This statement is required.
SO_NODE_INIT_CLASS(SoTrap,SoShape,"Shape");
static bool first = true;
if (first) {
first = false;
SO_NODE_INIT_CLASS(SoTrap,SoShape,"Shape");
}
}
@@ -59,7 +59,11 @@ SO_NODE_SOURCE(SoTrd)
// initClass
void SoTrd::initClass(){
SO_NODE_INIT_CLASS(SoTrd,SoShape,"Shape");
static bool first = true;
if (first) {
first = false;
SO_NODE_INIT_CLASS(SoTrd,SoShape,"Shape");
}
}
// Constructor
SoTrd::SoTrd() {
@@ -85,7 +85,11 @@ SoTubs::~SoTubs() {
// initClass
void SoTubs::initClass(){
// This statement is required.
SO_NODE_INIT_CLASS(SoTubs,SoShape,"Shape");
static bool first = true;
if (first) {
first = false;
SO_NODE_INIT_CLASS(SoTubs,SoShape,"Shape");
}
}
// generatePrimitives