Import Geant4 11.2.0.beta source tree
This commit is contained in:
@@ -43,7 +43,6 @@ protected:
|
||||
public:
|
||||
G4VSceneHandler* CreateSceneHandler(const G4String& name = "");
|
||||
G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name = "");
|
||||
G4bool IsUISessionCompatible () const;
|
||||
protected:
|
||||
void Initialise();
|
||||
protected:
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Guy Barrand 13th April 2023
|
||||
|
||||
#ifndef G4TOOLSSGQTZB_HH
|
||||
#define G4TOOLSSGQTZB_HH
|
||||
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
|
||||
namespace toolx {namespace Qt {class session;}}
|
||||
|
||||
class G4ToolsSGQtZB: public G4VGraphicsSystem {
|
||||
using parent = G4VGraphicsSystem;
|
||||
public:
|
||||
G4ToolsSGQtZB();
|
||||
virtual ~G4ToolsSGQtZB();
|
||||
protected:
|
||||
G4ToolsSGQtZB(const G4ToolsSGQtZB& a_from):parent(a_from){}
|
||||
G4ToolsSGQtZB& operator=(const G4ToolsSGQtZB&) {return *this;}
|
||||
public:
|
||||
G4VSceneHandler* CreateSceneHandler(const G4String& name = "");
|
||||
G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name = "");
|
||||
G4bool IsUISessionCompatible () const;
|
||||
protected:
|
||||
void Initialise();
|
||||
protected:
|
||||
toolx::Qt::session* fSGSession;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -43,7 +43,6 @@ protected:
|
||||
public:
|
||||
G4VSceneHandler* CreateSceneHandler(const G4String& name = "");
|
||||
G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name = "");
|
||||
G4bool IsUISessionCompatible () const;
|
||||
protected:
|
||||
void Initialise();
|
||||
protected:
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Guy Barrand 17th April 2023
|
||||
|
||||
#ifndef G4TOOLSSGWINDOWSZB_HH
|
||||
#define G4TOOLSSGWINDOWSZB_HH
|
||||
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
|
||||
namespace toolx {namespace Windows {class session;}}
|
||||
|
||||
class G4ToolsSGWindowsZB: public G4VGraphicsSystem {
|
||||
using parent = G4VGraphicsSystem;
|
||||
public:
|
||||
G4ToolsSGWindowsZB();
|
||||
virtual ~G4ToolsSGWindowsZB();
|
||||
protected:
|
||||
G4ToolsSGWindowsZB(const G4ToolsSGWindowsZB& a_from):parent(a_from){}
|
||||
G4ToolsSGWindowsZB& operator=(const G4ToolsSGWindowsZB&) {return *this;}
|
||||
public:
|
||||
G4VSceneHandler* CreateSceneHandler(const G4String& name = "");
|
||||
G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name = "");
|
||||
protected:
|
||||
void Initialise();
|
||||
protected:
|
||||
toolx::Windows::session* fSGSession;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -43,7 +43,6 @@ protected:
|
||||
public:
|
||||
G4VSceneHandler* CreateSceneHandler(const G4String& name = "");
|
||||
G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name = "");
|
||||
G4bool IsUISessionCompatible () const;
|
||||
protected:
|
||||
void Initialise();
|
||||
protected:
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Guy Barrand 14th April 2023
|
||||
|
||||
#ifndef G4TOOLSSGX11ZB_HH
|
||||
#define G4TOOLSSGX11ZB_HH
|
||||
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
|
||||
namespace toolx {namespace X11 {class base_session;}}
|
||||
|
||||
class G4ToolsSGX11ZB: public G4VGraphicsSystem {
|
||||
using parent = G4VGraphicsSystem;
|
||||
public:
|
||||
G4ToolsSGX11ZB();
|
||||
virtual ~G4ToolsSGX11ZB();
|
||||
protected:
|
||||
G4ToolsSGX11ZB(const G4ToolsSGX11ZB& a_from):parent(a_from){}
|
||||
G4ToolsSGX11ZB& operator=(const G4ToolsSGX11ZB&) {return *this;}
|
||||
public:
|
||||
G4VSceneHandler* CreateSceneHandler(const G4String& name = "");
|
||||
G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name = "");
|
||||
protected:
|
||||
void Initialise();
|
||||
protected:
|
||||
toolx::X11::base_session* fSGSession;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -43,7 +43,6 @@ protected:
|
||||
public:
|
||||
G4VSceneHandler* CreateSceneHandler(const G4String& name = "");
|
||||
G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name = "");
|
||||
G4bool IsUISessionCompatible () const;
|
||||
protected:
|
||||
void Initialise();
|
||||
protected:
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Guy Barrand 14th April 2023
|
||||
|
||||
#ifndef G4TOOLSSGXTZB_HH
|
||||
#define G4TOOLSSGXTZB_HH
|
||||
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
|
||||
namespace toolx {namespace Xt {class session;}}
|
||||
|
||||
class G4ToolsSGXtZB: public G4VGraphicsSystem {
|
||||
using parent = G4VGraphicsSystem;
|
||||
public:
|
||||
G4ToolsSGXtZB();
|
||||
virtual ~G4ToolsSGXtZB();
|
||||
protected:
|
||||
G4ToolsSGXtZB(const G4ToolsSGXtZB& a_from):parent(a_from){}
|
||||
G4ToolsSGXtZB& operator=(const G4ToolsSGXtZB&) {return *this;}
|
||||
public:
|
||||
G4VSceneHandler* CreateSceneHandler(const G4String& name = "");
|
||||
G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name = "");
|
||||
protected:
|
||||
void Initialise();
|
||||
protected:
|
||||
toolx::Xt::session* fSGSession;
|
||||
};
|
||||
|
||||
#endif
|
||||
+10
-5
@@ -87,15 +87,15 @@ public:
|
||||
|
||||
{G4UImanager* ui = G4UImanager::GetUIpointer();
|
||||
G4UIsession* session = ui->GetG4UIWindow();
|
||||
G4UIQt* uiQt = session? dynamic_cast<G4UIQt*>(session) :nullptr;
|
||||
if(uiQt) {
|
||||
fUIQt = session? dynamic_cast<G4UIQt*>(session) :nullptr;
|
||||
if(fUIQt) {
|
||||
G4Qt* interactorManager = G4Qt::getInstance ();
|
||||
if (!interactorManager->IsExternalApp()) {
|
||||
fSGViewer->set_own_shell(false);
|
||||
uiQt->AddTabWidget(fSGQWidget,QString(GetName()));
|
||||
fUIQt->AddTabWidget(fSGQWidget,QString(GetName()));
|
||||
QObject::connect(fSGQWidget,SIGNAL(destroyed()),fDestroyCallback,SLOT(execute()));
|
||||
|
||||
QMainWindow* main_window = uiQt->GetMainWindow();
|
||||
QMainWindow* main_window = fUIQt->GetMainWindow();
|
||||
if(main_window) {
|
||||
main_window->show();
|
||||
interactorManager->FlushAndWaitExecution();
|
||||
@@ -122,8 +122,13 @@ public:
|
||||
#endif
|
||||
parent::SetView();
|
||||
}
|
||||
|
||||
|
||||
virtual void UpdateGUISceneTree() {
|
||||
if (fUIQt) fUIQt->UpdateSceneTree(fSceneTree);
|
||||
}
|
||||
|
||||
protected:
|
||||
G4UIQt* fUIQt = nullptr;
|
||||
QWidget* fSGQWidget;
|
||||
G4ToolsSGQtDestroyCallback* fDestroyCallback;
|
||||
};
|
||||
@@ -0,0 +1,135 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Guy Barrand 13th April 2023
|
||||
|
||||
#ifndef G4TOOLSSGQTZBVIEWER_HH
|
||||
#define G4TOOLSSGQTZBVIEWER_HH
|
||||
|
||||
#include "G4ToolsSGViewer.hh"
|
||||
|
||||
#include "G4Qt.hh"
|
||||
#include "G4UIQt.hh"
|
||||
#include "G4UImanager.hh"
|
||||
|
||||
#include <toolx/Qt/zb_viewer>
|
||||
|
||||
#include <qmainwindow.h>
|
||||
|
||||
class G4ToolsSGQtZBDestroyCallback : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
G4ToolsSGQtZBDestroyCallback(G4VViewer* a_viewer):fViewer(a_viewer) {}
|
||||
virtual ~G4ToolsSGQtZBDestroyCallback() {}
|
||||
private:
|
||||
G4ToolsSGQtZBDestroyCallback(const G4ToolsSGQtZBDestroyCallback&);
|
||||
G4ToolsSGQtZBDestroyCallback& operator=(const G4ToolsSGQtZBDestroyCallback&);
|
||||
public slots:
|
||||
void execute(){
|
||||
delete fViewer;
|
||||
}
|
||||
private:
|
||||
G4VViewer* fViewer;
|
||||
};
|
||||
|
||||
class G4ToolsSGQtZBViewer : public G4ToolsSGViewer<toolx::Qt::session,toolx::Qt::zb_viewer> {
|
||||
using parent = G4ToolsSGViewer<toolx::Qt::session,toolx::Qt::zb_viewer>;
|
||||
public:
|
||||
G4ToolsSGQtZBViewer(toolx::Qt::session& a_session,G4ToolsSGSceneHandler& a_scene_handler, const G4String& a_name)
|
||||
:parent(a_session,a_scene_handler,a_name)
|
||||
,fSGQWidget(nullptr)
|
||||
,fDestroyCallback(0)
|
||||
{
|
||||
fDestroyCallback = new G4ToolsSGQtZBDestroyCallback(this);
|
||||
}
|
||||
virtual ~G4ToolsSGQtZBViewer() {
|
||||
delete fDestroyCallback; //it will remove the below signal/slot connection.
|
||||
}
|
||||
protected:
|
||||
G4ToolsSGQtZBViewer(const G4ToolsSGQtZBViewer& a_from):parent(a_from){}
|
||||
G4ToolsSGQtZBViewer& operator=(const G4ToolsSGQtZBViewer&) {return *this;}
|
||||
public:
|
||||
virtual void Initialise() {
|
||||
if(fSGQWidget) return; //done.
|
||||
parent::Initialise();
|
||||
if(!fSGViewer) {
|
||||
G4cerr << "G4ToolsSGQtZBViewer::Initialise: ERROR: G4ToolsSGQtZBViewer has no toolx::Qt::zb_viewer." << G4endl;
|
||||
return;
|
||||
}
|
||||
fSGQWidget = fSGViewer->shell();
|
||||
if (!fSGQWidget) {
|
||||
G4cerr << "G4ToolsSGQtZBViewer::Initialise: ERROR: toolx::Qt::zb_viewer has no QWidget shell." << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
{G4UImanager* ui = G4UImanager::GetUIpointer();
|
||||
G4UIsession* session = ui->GetG4UIWindow();
|
||||
fUIQt = session? dynamic_cast<G4UIQt*>(session) :nullptr;
|
||||
if(fUIQt) {
|
||||
G4Qt* interactorManager = G4Qt::getInstance ();
|
||||
if (!interactorManager->IsExternalApp()) {
|
||||
fSGViewer->set_own_shell(false);
|
||||
fUIQt->AddTabWidget(fSGQWidget,QString(GetName()));
|
||||
QObject::connect(fSGQWidget,SIGNAL(destroyed()),fDestroyCallback,SLOT(execute()));
|
||||
|
||||
QMainWindow* main_window = fUIQt->GetMainWindow();
|
||||
if(main_window) {
|
||||
main_window->show();
|
||||
interactorManager->FlushAndWaitExecution();
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
fSGViewer->enable_keyboard_focus();
|
||||
}
|
||||
|
||||
virtual void SetView() {
|
||||
#ifdef __APPLE__
|
||||
if(fSGQWidget && fSGViewer) {
|
||||
if( (2*fSGQWidget->width() == int(fSGViewer->width())) &&
|
||||
(2*fSGQWidget->height() == int(fSGViewer->height())) ){
|
||||
// With Qt/Cocoa, the received size in
|
||||
// tools::sg::glarea::resizeGL is twice the QWidget::[width(),height()]!
|
||||
// In general it does not pose problem, except when rendering 2D texts.
|
||||
// In order to have similar sizes than other platforms, we have to double
|
||||
// their pixel heights.
|
||||
fVP.SetGlobalMarkerScale(2);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
parent::SetView();
|
||||
}
|
||||
|
||||
virtual void UpdateGUISceneTree() {
|
||||
if (fUIQt) fUIQt->UpdateSceneTree(fSceneTree);
|
||||
}
|
||||
|
||||
protected:
|
||||
G4UIQt* fUIQt = nullptr;
|
||||
QWidget* fSGQWidget;
|
||||
G4ToolsSGQtZBDestroyCallback* fDestroyCallback;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user