Import Geant4 11.1.0.beta source tree
This commit is contained in:
@@ -1,7 +1,3 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# Module : G4ToolsSG
|
||||
# Package: Geant4.src.G4visualization.G4ToolsSG
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
geant4_global_library_target(COMPONENTS sources.cmake)
|
||||
|
||||
# - G4ToolsSG category build
|
||||
include(sources.cmake)
|
||||
geant4_add_category(G4ToolsSG MODULES G4ToolsSG)
|
||||
|
||||
@@ -1,24 +1,88 @@
|
||||
-------------------------------------------------------------------
|
||||
# Category vis_toolssg History
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
|
||||
which **must** added in reverse chronological order (newest at the top). It must **not**
|
||||
be used as a substitute for writing good git commit messages!
|
||||
|
||||
Category History file
|
||||
---------------------
|
||||
This file should be used by G4 developers and category coordinators
|
||||
to briefly summarize all major modifications introduced in the code
|
||||
and keep track of all category-tags.
|
||||
It DOES NOT substitute the CVS log-message one should put at every
|
||||
committal in the CVS repository !
|
||||
## 2022-05-18 Guy Barrand (vis_toolssg-V11-00-11)
|
||||
- have "toolx" namespace for g4tools code related to "externals", then:
|
||||
- tools::[Qt,Windows,X11,Xt,sg::text_freetype] become toolx::[Qt,Windows,X11,Xt,sg::text_freetype].
|
||||
- and corresponding includes #include <tools/...> become #include <toolx/...>
|
||||
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
## 2022-05-03 Ben Morgan (vis_toolssg-V11-00-10)
|
||||
- Preliminary build support for Qt5 and Qt6
|
||||
|
||||
History file for visualization ToolsSG category - a vis driver based on
|
||||
g4tools scene graph logic. See geant4/source/analysis/g4tools/tools.license
|
||||
------------------------------------------------
|
||||
## 2022-04-13 Ben Morgan (vis_toolssg-V11-00-09)
|
||||
- Add needed dependencies
|
||||
|
||||
## 2022-04-06 John Allison (vis_toolssg-V11-00-08)
|
||||
- `G4ToolsSGSceneHandler.cc`:
|
||||
- void G4ToolsSGSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron):
|
||||
- Comment out common line elimination - too expensive for a large
|
||||
polyhedron.
|
||||
- Maybe eliminate altogether in future?
|
||||
- Allow the graphics-reps utilities to optimise things like this.
|
||||
- Use StandardSpecialMeshRendering(mesh).
|
||||
- Of course, only if special mesh rendering is requested.
|
||||
|
||||
## 2022-03-22 Ben Morgan (vis_toolssg-V11-00-07)
|
||||
- Use geant4_module_sources to add optional sources
|
||||
|
||||
## 2022-03-07 John Allison (vis_toolssg-V11-00-06)
|
||||
- `G4ToolsSGSceneHandler`:
|
||||
- `AddPrimitive (const G4Polymarker& a_polymarker)`:
|
||||
- Define dots as a single pixel.
|
||||
- Use `GetMarkerSize(...)` for circles and squares.
|
||||
- `AddCompound(const G4Mesh& mesh)`:
|
||||
- For parameterised tetrahedron mesh, call default
|
||||
G4VSceneHandler::DrawTetMeshAsDots(mesh).
|
||||
- Tested on "ICRP145", a Geant4 application that we hope can become
|
||||
a Geant4 advanced example, downloaded from the supplementary material
|
||||
of Kim et al, ICRP, 2020. Adult mesh-type reference computational
|
||||
phantoms, ICRP Publication 145, Ann. ICRP 49(3).
|
||||
|
||||
## 2022-03-05 John Allison (vis_toolssg-V11-00-05)
|
||||
- `G4ToolsSGSceneHandler::SetPlotterHistograms`:
|
||||
- Suppress /control/verbose messages for /analysis/*/get* commands.
|
||||
|
||||
## 2022-02-08 Ben Morgan (vis_toolssg-V11-00-04)
|
||||
- Access G4VVisCommand::G4VisManager pointer through static function GetVisManager
|
||||
to prevent DLL issues on Windows.
|
||||
|
||||
## 2022-01-30 John Allison (vis_toolssg-V11-00-03)
|
||||
- Co-works with visman-V11-00-05.
|
||||
- G4ToolsSGViewer.hh:
|
||||
- G4ToolsSGViewer::SwitchToMasterThread:
|
||||
- At the moment, the ToolsSG viewer cannot draw trajectories *during* a run
|
||||
so in multithreading mode, so in this function we draw any events that
|
||||
have been kept by the vis manager. But we only need to do it if there are
|
||||
end-of-event models in the scene - this tag fixes that.
|
||||
- It fixes an issue where plots were being drawn twice.
|
||||
- G4ToolsSGSceneHandler.cc:
|
||||
- G4ToolsSGSceneHandler::SetPlotterHistograms:
|
||||
- Add warning message if plot cannot be found:
|
||||
```
|
||||
G4ToolsSGSceneHandler::SetPlotterHistograms: cannot get histogram - maybe doesn't exist?
|
||||
Maybe this app does not do analysis at all?
|
||||
```
|
||||
|
||||
## 2022-01-28 Ben Morgan (vis_toolssg-V11-00-02)
|
||||
- Replace `geant4_global_library_target` with direct file inclusion and
|
||||
call to `geant4_add_category` to define library build from source modules.
|
||||
|
||||
## 2022-01-16 John Allison (vis_toolssg-V11-00-01)
|
||||
- G4ToolsSGViewer::wheel_rotate:
|
||||
- Re-program wheel_rotate for perspective projection:
|
||||
- Takes into account the extent of the scene.
|
||||
- Reactivate G4ToolsSGQtGLES::IsUISessionCompatible
|
||||
- Paves way for permitted instantiation of multiple TSG drivers.
|
||||
|
||||
## 2021-12-10 Ben Morgan (vis_toolssg-V11-00-00)
|
||||
- Change to new Markdown History format
|
||||
|
||||
---
|
||||
|
||||
# History entries prior to 11.0
|
||||
|
||||
13 November 2021 - John Allison (vis_toolssg-V10-07-16)
|
||||
- G4ToolsSGSceneHandler.cc: Bug fix:
|
||||
@@ -154,4 +218,4 @@ g4tools scene graph logic. See geant4/source/analysis/g4tools/tools.license
|
||||
. TOOLSSG_X11_GLES
|
||||
. TOOLSSG_WINDOWS_GLES
|
||||
. TOOLSSG_XT_GLES
|
||||
. TOOLSSG_QT_GLES
|
||||
. TOOLSSG_QT_GLES
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
|
||||
namespace tools {namespace Qt {class session;}}
|
||||
namespace toolx {namespace Qt {class session;}}
|
||||
|
||||
class G4ToolsSGQtGLES: public G4VGraphicsSystem {
|
||||
typedef G4VGraphicsSystem parent;
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
protected:
|
||||
void Initialise();
|
||||
protected:
|
||||
tools::Qt::session* fSGSession;
|
||||
toolx::Qt::session* fSGSession;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "G4UIQt.hh"
|
||||
#include "G4UImanager.hh"
|
||||
|
||||
#include <tools/Qt/sg_viewer>
|
||||
#include <toolx/Qt/sg_viewer>
|
||||
|
||||
#include <qmainwindow.h>
|
||||
|
||||
@@ -55,10 +55,10 @@ private:
|
||||
G4VViewer* fViewer;
|
||||
};
|
||||
|
||||
class G4ToolsSGQtViewer : public G4ToolsSGViewer<tools::Qt::session,tools::Qt::sg_viewer> {
|
||||
typedef G4ToolsSGViewer<tools::Qt::session,tools::Qt::sg_viewer> parent;
|
||||
class G4ToolsSGQtViewer : public G4ToolsSGViewer<toolx::Qt::session,toolx::Qt::sg_viewer> {
|
||||
typedef G4ToolsSGViewer<toolx::Qt::session,toolx::Qt::sg_viewer> parent;
|
||||
public:
|
||||
G4ToolsSGQtViewer(tools::Qt::session& a_session,G4ToolsSGSceneHandler& a_scene_handler, const G4String& a_name)
|
||||
G4ToolsSGQtViewer(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)
|
||||
@@ -76,12 +76,12 @@ public:
|
||||
if(fSGQWidget) return; //done.
|
||||
parent::Initialise();
|
||||
if(!fSGViewer) {
|
||||
G4cerr << "G4ToolsSGQtViewer::Initialise: ERROR: G4ToolsSGQtViewer has no tools::Qt::sg_viewer." << G4endl;
|
||||
G4cerr << "G4ToolsSGQtViewer::Initialise: ERROR: G4ToolsSGQtViewer has no toolx::Qt::sg_viewer." << G4endl;
|
||||
return;
|
||||
}
|
||||
fSGQWidget = fSGViewer->shell();
|
||||
if (!fSGQWidget) {
|
||||
G4cerr << "G4ToolsSGQtViewer::Initialise: ERROR: tools::Qt::sg_viewer has no QWidget shell." << G4endl;
|
||||
G4cerr << "G4ToolsSGQtViewer::Initialise: ERROR: toolx::Qt::sg_viewer has no QWidget shell." << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,10 @@ public:
|
||||
virtual void AddPrimitive(const G4Polymarker&);
|
||||
virtual void AddPrimitive(const G4Polyhedron&);
|
||||
virtual void AddPrimitive(const G4Plotter&);
|
||||
|
||||
|
||||
using G4VSceneHandler::AddCompound;
|
||||
virtual void AddCompound(const G4Mesh&);
|
||||
|
||||
virtual void ClearStore ();
|
||||
virtual void ClearTransientStore ();
|
||||
|
||||
|
||||
@@ -109,8 +109,8 @@ public: //tools::sg::device_interactor interface.
|
||||
const G4double scale = 500; // Empirically chosen
|
||||
fVP.MultiplyZoomFactor(1.+angleY/scale);
|
||||
} else { // Perspective projection
|
||||
const G4double scale = fVP.GetFieldHalfAngle()/(10.*CLHEP::deg); // Empirical
|
||||
fVP.SetDolly(fVP.GetDolly()+angleY/scale);
|
||||
const G4double delta = fSceneHandler.GetExtent().GetExtentRadius()/200.; // Empirical
|
||||
fVP.SetDolly(fVP.GetDolly()+angleY*delta);
|
||||
}
|
||||
SetView();
|
||||
DrawView();
|
||||
@@ -309,8 +309,13 @@ public:
|
||||
//
|
||||
// Also, strictly, there is no need to rebuid run-duration models (detector),
|
||||
// but a complete rebuild is the easiest way (already imeplemented).
|
||||
fNeedKernelVisit = true;
|
||||
DrawView(); // Draw trajectories, etc., from kept events
|
||||
//
|
||||
// Only do this if there are end-of-event models (e.g., trajectories) that
|
||||
// may require it.
|
||||
if (fSceneHandler.GetScene()->GetEndOfEventModelList().size()) {
|
||||
fNeedKernelVisit = true;
|
||||
DrawView(); // Draw trajectories, etc., from kept events
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -463,8 +468,8 @@ protected:
|
||||
}
|
||||
public:
|
||||
virtual void SetNewValue(G4UIcommand* a_cmd,G4String a_value) {
|
||||
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
|
||||
G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
|
||||
G4VisManager::Verbosity verbosity = GetVisManager()->GetVerbosity();
|
||||
G4VViewer* viewer = GetVisManager()->GetCurrentViewer();
|
||||
if (!viewer) {
|
||||
if (verbosity >= G4VisManager::errors) G4cerr << "ERROR: No current viewer." << G4endl;
|
||||
return;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
|
||||
namespace tools {namespace Windows {class session;}}
|
||||
namespace toolx {namespace Windows {class session;}}
|
||||
|
||||
class G4ToolsSGWindowsGLES: public G4VGraphicsSystem {
|
||||
typedef G4VGraphicsSystem parent;
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
protected:
|
||||
void Initialise();
|
||||
protected:
|
||||
tools::Windows::session* fSGSession;
|
||||
toolx::Windows::session* fSGSession;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
|
||||
namespace tools {namespace X11 {class session;}}
|
||||
namespace toolx {namespace X11 {class session;}}
|
||||
|
||||
class G4ToolsSGX11GLES: public G4VGraphicsSystem {
|
||||
typedef G4VGraphicsSystem parent;
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
protected:
|
||||
void Initialise();
|
||||
protected:
|
||||
tools::X11::session* fSGSession;
|
||||
toolx::X11::session* fSGSession;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
|
||||
namespace tools {namespace Xt {class session;}}
|
||||
namespace toolx {namespace Xt {class session;}}
|
||||
|
||||
class G4ToolsSGXtGLES: public G4VGraphicsSystem {
|
||||
typedef G4VGraphicsSystem parent;
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
protected:
|
||||
void Initialise();
|
||||
protected:
|
||||
tools::Xt::session* fSGSession;
|
||||
toolx::Xt::session* fSGSession;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,105 +1,71 @@
|
||||
# - G4ToolsSG module build definition
|
||||
# Define the Geant4 Module.
|
||||
geant4_add_module(G4ToolsSG
|
||||
PUBLIC_HEADERS
|
||||
G4ToolsSGNode.hh
|
||||
G4ToolsSGSceneHandler.hh
|
||||
G4ToolsSGViewer.hh
|
||||
SOURCES
|
||||
G4ToolsSGSceneHandler.cc)
|
||||
|
||||
# Module has optional sources
|
||||
# List those always built
|
||||
set(G4VIS_MODULE_TOOLSSG_HEADERS
|
||||
G4ToolsSGNode.hh
|
||||
G4ToolsSGSceneHandler.hh
|
||||
G4ToolsSGViewer.hh
|
||||
)
|
||||
geant4_module_link_libraries(G4ToolsSG
|
||||
PUBLIC
|
||||
G4UIbasic
|
||||
G4UIcommon
|
||||
G4intercoms
|
||||
G4modeling
|
||||
G4vis_management
|
||||
G4tools
|
||||
PRIVATE
|
||||
G4graphics_reps
|
||||
G4navigation)
|
||||
|
||||
set(G4VIS_MODULE_TOOLSSG_SOURCES
|
||||
G4ToolsSGSceneHandler.cc
|
||||
)
|
||||
|
||||
# X11 sources/links if selected
|
||||
if(GEANT4_USE_TOOLSSG_X11_GLES)
|
||||
list(APPEND G4VIS_MODULE_TOOLSSG_HEADERS
|
||||
G4ToolsSGX11GLES.hh
|
||||
)
|
||||
|
||||
list(APPEND G4VIS_MODULE_TOOLSSG_SOURCES
|
||||
G4ToolsSGX11GLES.cc
|
||||
)
|
||||
|
||||
list(APPEND G4VIS_MODULE_TOOLSSG_LINK_LIBRARIES X11::SM X11::ICE X11::X11 X11::Xext X11::Xmu)
|
||||
if(APPLE)
|
||||
list(APPEND G4VIS_MODULE_TOOLSSG_LINK_LIBRARIES XQuartzGL::GL)
|
||||
else()
|
||||
list(APPEND G4VIS_MODULE_TOOLSSG_LINK_LIBRARIES OpenGL::GL)
|
||||
endif()
|
||||
# Freetype support if selected
|
||||
if(GEANT4_USE_FREETYPE)
|
||||
geant4_module_compile_definitions(G4ToolsSG PRIVATE TOOLS_USE_FREETYPE)
|
||||
geant4_module_link_libraries(G4ToolsSG PUBLIC Freetype::Freetype)
|
||||
endif()
|
||||
|
||||
# Xt sources/links if selected
|
||||
# X11 sources if selected
|
||||
if(GEANT4_USE_TOOLSSG_X11_GLES)
|
||||
geant4_module_sources(G4ToolsSG PUBLIC_HEADERS G4ToolsSGX11GLES.hh SOURCES G4ToolsSGX11GLES.cc)
|
||||
endif()
|
||||
|
||||
# Xt sources if selected
|
||||
if(GEANT4_USE_TOOLSSG_XT_GLES)
|
||||
list(APPEND G4VIS_MODULE_TOOLSSG_HEADERS
|
||||
G4ToolsSGXtGLES.hh
|
||||
)
|
||||
geant4_module_sources(G4ToolsSG PUBLIC_HEADERS G4ToolsSGXtGLES.hh SOURCES G4ToolsSGXtGLES.cc)
|
||||
geant4_module_compile_definitions(G4ToolsSG PRIVATE TOOLS_USE_GL_GL_H)
|
||||
endif()
|
||||
|
||||
list(APPEND G4VIS_MODULE_TOOLSSG_SOURCES
|
||||
G4ToolsSGXtGLES.cc
|
||||
)
|
||||
|
||||
add_definitions(-DTOOLS_USE_GL_GL_H)
|
||||
|
||||
list(APPEND G4VIS_MODULE_TOOLSSG_LINK_LIBRARIES X11::SM X11::ICE X11::X11 X11::Xext X11::Xmu ${G4VIS_MODULE_TOOLSSG_LINK_LIBRARIES})
|
||||
# X11/Xt links if selected
|
||||
if(GEANT4_USE_TOOLSSG_X11_GLES OR GEANT4_USE_TOOLSSG_XT_GLES)
|
||||
geant4_module_link_libraries(G4ToolsSG PUBLIC X11::SM X11::ICE X11::X11 X11::Xext X11::Xmu)
|
||||
if(APPLE)
|
||||
list(APPEND G4VIS_MODULE_TOOLSSG_LINK_LIBRARIES XQuartzGL::GL)
|
||||
geant4_module_link_libraries(G4ToolsSG PUBLIC XQuartzGL::GL)
|
||||
else()
|
||||
list(APPEND G4VIS_MODULE_TOOLSSG_LINK_LIBRARIES OpenGL::GL)
|
||||
geant4_module_link_libraries(G4ToolsSG PUBLIC OpenGL::GL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Qt sources/links if selected
|
||||
if(GEANT4_USE_TOOLSSG_QT_GLES)
|
||||
list(APPEND G4VIS_MODULE_TOOLSSG_HEADERS
|
||||
G4ToolsSGQtViewer.hh
|
||||
G4ToolsSGQtGLES.hh
|
||||
)
|
||||
geant4_module_sources(G4ToolsSG
|
||||
PUBLIC_HEADERS
|
||||
G4ToolsSGQtViewer.hh
|
||||
G4ToolsSGQtGLES.hh
|
||||
SOURCES
|
||||
G4ToolsSGQtGLES.cc
|
||||
G4ToolsSGQtViewer.cc)
|
||||
|
||||
list(APPEND G4VIS_MODULE_TOOLSSG_SOURCES
|
||||
G4ToolsSGQtGLES.cc
|
||||
G4ToolsSGQtViewer.cc
|
||||
)
|
||||
|
||||
list(APPEND G4VIS_MODULE_TOOLSSG_LINK_LIBRARIES Qt5::OpenGL Qt5::Gui Qt5::PrintSupport Qt5::Widgets OpenGL::GL)
|
||||
geant4_module_link_libraries(G4ToolsSG PUBLIC Qt${QT_VERSION_MAJOR}::OpenGL Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::PrintSupport Qt${QT_VERSION_MAJOR}::Widgets OpenGL::GL)
|
||||
endif()
|
||||
|
||||
|
||||
# Windows sources if selected
|
||||
if(GEANT4_USE_TOOLSSG_WINDOWS_GLES)
|
||||
list(APPEND G4VIS_MODULE_TOOLSSG_HEADERS
|
||||
G4ToolsSGWindowsGLES.hh
|
||||
)
|
||||
|
||||
list(APPEND G4VIS_MODULE_TOOLSSG_SOURCES
|
||||
G4ToolsSGWindowsGLES.cc
|
||||
)
|
||||
|
||||
list(APPEND G4VIS_MODULE_TOOLSSG_LINK_LIBRARIES OpenGL::GL)
|
||||
geant4_module_sources(G4ToolsSG PUBLIC_HEADERS G4ToolsSGWindowsGLES.hh SOURCES G4ToolsSGWindowsGLES.cc)
|
||||
geant4_module_link_libraries(G4ToolsSG PUBLIC OpenGL::GL)
|
||||
endif()
|
||||
|
||||
|
||||
# Freetype support if selected
|
||||
if(GEANT4_USE_FREETYPE)
|
||||
add_definitions(-DTOOLS_USE_FREETYPE)
|
||||
list(APPEND G4VIS_MODULE_TOOLSSG_LINK_LIBRARIES Freetype::Freetype)
|
||||
endif()
|
||||
|
||||
list(REMOVE_DUPLICATES G4VIS_MODULE_TOOLSSG_LINK_LIBRARIES)
|
||||
|
||||
# Define the Geant4 Module.
|
||||
geant4_add_module(G4ToolsSG
|
||||
PUBLIC_HEADERS ${G4VIS_MODULE_TOOLSSG_HEADERS}
|
||||
SOURCES ${G4VIS_MODULE_TOOLSSG_SOURCES})
|
||||
|
||||
geant4_module_link_libraries(G4ToolsSG
|
||||
PUBLIC
|
||||
G4intercoms
|
||||
G4interfaces
|
||||
G4modeling
|
||||
G4vis_management
|
||||
G4tools
|
||||
${G4VIS_MODULE_TOOLSSG_LINK_LIBRARIES}
|
||||
PRIVATE
|
||||
G4navigation)
|
||||
|
||||
@@ -27,16 +27,17 @@
|
||||
|
||||
#include "G4ToolsSGQtGLES.hh"
|
||||
|
||||
//
|
||||
#define G4TOOLSSG_QT_VIEWER_IN_TAB
|
||||
|
||||
#ifdef G4TOOLSSG_QT_VIEWER_IN_TAB
|
||||
#include "G4ToolsSGQtViewer.hh"
|
||||
#else
|
||||
#include "G4ToolsSGViewer.hh"
|
||||
#include <tools/Qt/sg_viewer>
|
||||
#include <toolx/Qt/sg_viewer>
|
||||
#endif
|
||||
|
||||
#include "G4UIbatch.hh"
|
||||
|
||||
#include <tools/argcv>
|
||||
|
||||
G4ToolsSGQtGLES::G4ToolsSGQtGLES():
|
||||
@@ -59,7 +60,7 @@ void G4ToolsSGQtGLES::Initialise() {
|
||||
char** argv = nullptr;
|
||||
std::vector<std::string> args;args.push_back("");
|
||||
tools::new_argcv(args,*argc,argv);
|
||||
fSGSession = new tools::Qt::session(G4cout,*argc,argv);
|
||||
fSGSession = new toolx::Qt::session(G4cout,*argc,argv);
|
||||
if(!fSGSession->is_valid()) {
|
||||
G4cerr << "G4ToolsSGQtGLES::Initialise : session::is_valid() failed." << G4endl;
|
||||
delete fSGSession;
|
||||
@@ -80,7 +81,7 @@ G4VViewer* G4ToolsSGQtGLES::CreateViewer(G4VSceneHandler& a_scene,const G4String
|
||||
#ifdef G4TOOLSSG_QT_VIEWER_IN_TAB
|
||||
new G4ToolsSGQtViewer(*fSGSession,(G4ToolsSGSceneHandler&)a_scene,a_name);
|
||||
#else
|
||||
new G4ToolsSGViewer<tools::Qt::session,tools::Qt::sg_viewer>(*fSGSession,(G4ToolsSGSceneHandler&)a_scene,a_name);
|
||||
new G4ToolsSGViewer<toolx::Qt::session,toolx::Qt::sg_viewer>(*fSGSession,(G4ToolsSGSceneHandler&)a_scene,a_name);
|
||||
#endif
|
||||
if (pView) {
|
||||
if (pView->GetViewId() < 0) {
|
||||
@@ -101,27 +102,27 @@ G4VViewer* G4ToolsSGQtGLES::CreateViewer(G4VSceneHandler& a_scene,const G4String
|
||||
G4bool G4ToolsSGQtGLES::IsUISessionCompatible () const
|
||||
{
|
||||
G4bool isCompatible = false;
|
||||
// G4UImanager* ui = G4UImanager::GetUIpointer();
|
||||
// G4UIsession* session = ui->GetSession();
|
||||
//
|
||||
// // If session is a batch session, it may be:
|
||||
// // a) this is a batch job (the user has not instantiated any UI session);
|
||||
// // b) we are currently processing a UI command, in which case the UI
|
||||
// // manager creates a temporary batch session and to find out if there is
|
||||
// // a genuine UI session that the user has instantiated we must drill
|
||||
// // down through previous sessions to a possible non-batch session.
|
||||
// while (G4UIbatch* batch = dynamic_cast<G4UIbatch*>(session)) {
|
||||
// session = batch->GetPreviousSession();
|
||||
// }
|
||||
//
|
||||
// // Qt windows are only appropriate in a Qt session.
|
||||
// if (session) {
|
||||
// // If non-zero, this is the originating non-batch session
|
||||
// // The user has instantiated a UI session...
|
||||
// if (dynamic_cast<G4UIQt*>(session)) {
|
||||
// // ...and it's a G4UIQt session, which is OK.
|
||||
G4UImanager* ui = G4UImanager::GetUIpointer();
|
||||
G4UIsession* session = ui->GetSession();
|
||||
|
||||
// If session is a batch session, it may be:
|
||||
// a) this is a batch job (the user has not instantiated any UI session);
|
||||
// b) we are currently processing a UI command, in which case the UI
|
||||
// manager creates a temporary batch session and to find out if there is
|
||||
// a genuine UI session that the user has instantiated we must drill
|
||||
// down through previous sessions to a possible non-batch session.
|
||||
while (G4UIbatch* batch = dynamic_cast<G4UIbatch*>(session)) {
|
||||
session = batch->GetPreviousSession();
|
||||
}
|
||||
|
||||
// Qt windows are only appropriate in a Qt session.
|
||||
if (session) {
|
||||
// If non-zero, this is the originating non-batch session
|
||||
// The user has instantiated a UI session...
|
||||
if (dynamic_cast<G4UIQt*>(session)) {
|
||||
// ...and it's a G4UIQt session, which is OK.
|
||||
isCompatible = true;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
return isCompatible;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,28 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
|
||||
#include "G4ToolsSGQtViewer.hh"
|
||||
#include "moc_G4ToolsSGQtViewer.cpp"
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "G4Square.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4Text.hh"
|
||||
#include "G4Mesh.hh"
|
||||
#include "G4PlotterManager.hh"
|
||||
|
||||
#include <tools/sg/separator>
|
||||
@@ -45,11 +46,11 @@
|
||||
#include <tools/sg/atb_vertices>
|
||||
#include <tools/sg/markers>
|
||||
#ifdef TOOLS_USE_FREETYPE
|
||||
#include <tools/sg/text_freetype>
|
||||
#include <toolx/sg/text_freetype>
|
||||
#include <tools/sg/strings>
|
||||
#include <tools/font/lato_regular_ttf>
|
||||
#include <tools/font/roboto_bold_ttf>
|
||||
#include <tools/sg/text_freetype_marker>
|
||||
#include <toolx/sg/text_freetype_marker>
|
||||
#else
|
||||
#include <tools/sg/dummy_freetype>
|
||||
#include <tools/sg/text_hershey_marker>
|
||||
@@ -80,7 +81,7 @@ G4ToolsSGSceneHandler::G4ToolsSGSceneHandler
|
||||
//::printf("debug : G4ToolsSGSceneHandler : %lu, %s\n",this,name.c_str());
|
||||
EstablishBaseNodes();
|
||||
#if defined(TOOLS_USE_FREETYPE)
|
||||
fFreetypeNode = new tools::sg::text_freetype();
|
||||
fFreetypeNode = new toolx::sg::text_freetype();
|
||||
fFreetypeNode->add_embedded_font(tools::sg::font_lato_regular_ttf(),tools::font::lato_regular_ttf);
|
||||
fFreetypeNode->add_embedded_font(tools::sg::font_roboto_bold_ttf(),tools::font::roboto_bold_ttf);
|
||||
#else
|
||||
@@ -286,15 +287,17 @@ void G4ToolsSGSceneHandler::AddPrimitive (const G4Polymarker& a_polymarker)
|
||||
float(colour.GetAlpha()));
|
||||
currentNode->add(mat);}
|
||||
|
||||
MarkerSizeType markerSizeType;
|
||||
G4double markerSize = GetMarkerSize(a_polymarker, markerSizeType);
|
||||
|
||||
switch (a_polymarker.GetMarkerType()) {
|
||||
default:
|
||||
case G4Polymarker::dots:{
|
||||
//::printf("debug : GB : Add Markers : +++++++++++++++++++++++++++++++++++++++++++ : dots\n");
|
||||
tools::sg::draw_style* ds = new tools::sg::draw_style;
|
||||
ds->style = tools::sg::draw_points;
|
||||
ds->point_size = 10;
|
||||
ds->point_size = 1;
|
||||
currentNode->add(ds);
|
||||
|
||||
tools::sg::vertices* vtxs = new tools::sg::vertices;
|
||||
vtxs->mode = tools::gl::points();
|
||||
{for (size_t i = 0; i < a_polymarker.size(); ++i) {
|
||||
@@ -305,7 +308,12 @@ void G4ToolsSGSceneHandler::AddPrimitive (const G4Polymarker& a_polymarker)
|
||||
case G4Polymarker::circles:{
|
||||
//::printf("debug : GB : Add Markers : +++++++++++++++++++++++++++++++++++++++++++ : circles\n");
|
||||
{tools::sg::markers* markers = new tools::sg::markers;
|
||||
markers->size = 10;
|
||||
G4double diameter = markerSize; // OK for "screen-size" (the usual case)
|
||||
if (markerSizeType == G4VSceneHandler::world ) {
|
||||
const G4double scale = 200.; // Roughly pixels per scene
|
||||
diameter *= fpScene->GetExtent().GetExtentRadius()/scale;
|
||||
}
|
||||
markers->size = diameter;
|
||||
markers->style = tools::sg::marker_circle_line;
|
||||
for (size_t i = 0; i < a_polymarker.size(); ++i) {
|
||||
markers->add(float(a_polymarker[i].x()),float(a_polymarker[i].y()),float(a_polymarker[i].z()));
|
||||
@@ -315,7 +323,12 @@ void G4ToolsSGSceneHandler::AddPrimitive (const G4Polymarker& a_polymarker)
|
||||
case G4Polymarker::squares:{
|
||||
//::printf("debug : GB : Add Markers : +++++++++++++++++++++++++++++++++++++++++++ : square\n");
|
||||
{tools::sg::markers* markers = new tools::sg::markers;
|
||||
markers->size = 10;
|
||||
G4double side = markerSize; // OK for "screen-size" (the usual case)
|
||||
if (markerSizeType == G4VSceneHandler::world ) {
|
||||
const G4double scale = 200.; // Roughly pixels per scene
|
||||
side *= fpScene->GetExtent().GetExtentRadius()/scale;
|
||||
}
|
||||
markers->size = side;
|
||||
markers->style = tools::sg::marker_square_line;
|
||||
for (size_t i = 0; i < a_polymarker.size(); ++i) {
|
||||
markers->add(float(a_polymarker[i].x()),float(a_polymarker[i].y()),float(a_polymarker[i].z()));
|
||||
@@ -371,7 +384,7 @@ void G4ToolsSGSceneHandler::AddPrimitive(const G4Text& a_text)
|
||||
parentNode->add(mat);}
|
||||
|
||||
#ifdef TOOLS_USE_FREETYPE
|
||||
tools::sg::text_freetype_marker* text = new tools::sg::text_freetype_marker;
|
||||
toolx::sg::text_freetype_marker* text = new toolx::sg::text_freetype_marker;
|
||||
text->add_embedded_font(tools::sg::font_lato_regular_ttf(),tools::font::lato_regular_ttf);
|
||||
text->font = tools::sg::font_lato_regular_ttf();
|
||||
text->front_face = tools::sg::winding_cw;
|
||||
@@ -440,11 +453,11 @@ void G4ToolsSGSceneHandler::AddPrimitive(const G4Polyhedron& a_polyhedron)
|
||||
typedef std::pair<G4Point3D,G4Point3D> Line;
|
||||
std::vector<Line> lines;
|
||||
auto insertIfNew = [&lines](const Line& newLine) {
|
||||
for (const auto& line: lines) {
|
||||
if ((newLine.first==line.first && newLine.second==line.second) ||
|
||||
(newLine.first==line.second && newLine.second==line.first))
|
||||
return;
|
||||
}
|
||||
// for (const auto& line: lines) {
|
||||
// if ((newLine.first==line.first && newLine.second==line.second) ||
|
||||
// (newLine.first==line.second && newLine.second==line.first))
|
||||
// return;
|
||||
// }
|
||||
lines.push_back(newLine);
|
||||
};
|
||||
|
||||
@@ -570,6 +583,11 @@ void G4ToolsSGSceneHandler::AddPrimitive(const G4Polyhedron& a_polyhedron)
|
||||
}
|
||||
}
|
||||
|
||||
void G4ToolsSGSceneHandler::AddCompound(const G4Mesh& mesh)
|
||||
{
|
||||
StandardSpecialMeshRendering(mesh);
|
||||
}
|
||||
|
||||
//plotting:
|
||||
inline void SetRegionStyles(tools::xml::styles& a_styles,
|
||||
tools::sg::plots& a_plots,
|
||||
@@ -699,7 +717,10 @@ void G4ToolsSGSceneHandler::SetPlotterHistograms(tools::sg::plots& a_plots) {
|
||||
os << hid;
|
||||
std::string cmd("/analysis/h1/get ");
|
||||
cmd += std::string(os.str());
|
||||
auto keepControlVerbose = UI->GetVerboseLevel();
|
||||
UI->SetVerboseLevel(0);
|
||||
G4int status = UI->ApplyCommand(cmd.c_str());
|
||||
UI->SetVerboseLevel(keepControlVerbose);
|
||||
if(status==G4UIcommandStatus::fCommandSucceeded) {
|
||||
G4String hexString = UI->GetCurrentValues("/analysis/h1/get");
|
||||
if(hexString.size()) {
|
||||
@@ -710,6 +731,11 @@ void G4ToolsSGSceneHandler::SetPlotterHistograms(tools::sg::plots& a_plots) {
|
||||
tools::sg::plottable* p = new tools::sg::h1d2plot_cp(*_h);
|
||||
_plotter->add_plottable(p); //give ownership of p to sg::plotter.
|
||||
}
|
||||
} else {
|
||||
G4cerr <<
|
||||
"G4ToolsSGSceneHandler::SetPlotterHistograms: cannot get histogram - maybe doesn't exist?"
|
||||
"\n Maybe this app does not do analysis at all?"
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
}}
|
||||
@@ -721,7 +747,10 @@ void G4ToolsSGSceneHandler::SetPlotterHistograms(tools::sg::plots& a_plots) {
|
||||
os << hid;
|
||||
std::string cmd("/analysis/h2/get ");
|
||||
cmd += std::string(os.str());
|
||||
auto keepControlVerbose = UI->GetVerboseLevel();
|
||||
UI->SetVerboseLevel(0);
|
||||
G4int status = UI->ApplyCommand(cmd.c_str());
|
||||
UI->SetVerboseLevel(keepControlVerbose);
|
||||
if(status==G4UIcommandStatus::fCommandSucceeded) {
|
||||
G4String hexString = UI->GetCurrentValues("/analysis/h2/get");
|
||||
if(hexString.size()) {
|
||||
@@ -732,6 +761,11 @@ void G4ToolsSGSceneHandler::SetPlotterHistograms(tools::sg::plots& a_plots) {
|
||||
tools::sg::plottable* p = new tools::sg::h2d2plot_cp(*_h);
|
||||
_plotter->add_plottable(p); //give ownership of p to sg::plotter.
|
||||
}
|
||||
} else {
|
||||
G4cerr <<
|
||||
"G4ToolsSGSceneHandler::SetPlotterHistograms: cannot get histogram - maybe doesn't exist?"
|
||||
"\n Maybe this app does not do analysis at all?"
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
}}
|
||||
@@ -813,7 +847,7 @@ void G4ToolsSGSceneHandler::AddPrimitive(const G4Plotter& a_plotter)
|
||||
}
|
||||
|
||||
void G4ToolsSGSceneHandler::Messenger::SetNewValue(G4UIcommand* a_cmd,G4String) {
|
||||
G4VSceneHandler* pSceneHandler = fpVisManager->GetCurrentSceneHandler();
|
||||
G4VSceneHandler* pSceneHandler = GetVisManager()->GetCurrentSceneHandler();
|
||||
if (!pSceneHandler) {
|
||||
G4cout << "G4ToolsSGSceneHandler::Messenger::SetNewValue: no current sceneHandler. Please create one." << G4endl;
|
||||
return;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "G4ToolsSGWindowsGLES.hh"
|
||||
|
||||
#include "G4ToolsSGViewer.hh"
|
||||
#include <tools/Windows/sg_viewer>
|
||||
#include <toolx/Windows/sg_viewer>
|
||||
|
||||
G4ToolsSGWindowsGLES::G4ToolsSGWindowsGLES():
|
||||
parent
|
||||
@@ -47,7 +47,7 @@ G4ToolsSGWindowsGLES::~G4ToolsSGWindowsGLES() {
|
||||
|
||||
void G4ToolsSGWindowsGLES::Initialise() {
|
||||
if(fSGSession) return; //done.
|
||||
fSGSession = new tools::Windows::session(G4cout);
|
||||
fSGSession = new toolx::Windows::session(G4cout);
|
||||
if(!fSGSession->is_valid()) {
|
||||
G4cerr << "G4ToolsSGWindowsGLES::Initialise : session::is_valid() failed." << G4endl;
|
||||
delete fSGSession;
|
||||
@@ -65,7 +65,7 @@ G4VViewer* G4ToolsSGWindowsGLES::CreateViewer(G4VSceneHandler& a_scene,const G4S
|
||||
if(!fSGSession) Initialise();
|
||||
if(!fSGSession) return nullptr;
|
||||
G4VViewer* pView =
|
||||
new G4ToolsSGViewer<tools::Windows::session,tools::Windows::sg_viewer>(*fSGSession,(G4ToolsSGSceneHandler&)a_scene,a_name);
|
||||
new G4ToolsSGViewer<toolx::Windows::session,toolx::Windows::sg_viewer>(*fSGSession,(G4ToolsSGSceneHandler&)a_scene,a_name);
|
||||
if (pView) {
|
||||
if (pView->GetViewId() < 0) {
|
||||
G4cerr <<
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "G4ToolsSGViewer.hh"
|
||||
|
||||
#include <tools/X11/sg_viewer>
|
||||
#include <toolx/X11/sg_viewer>
|
||||
|
||||
G4ToolsSGX11GLES::G4ToolsSGX11GLES():
|
||||
parent
|
||||
@@ -47,7 +47,7 @@ G4ToolsSGX11GLES::~G4ToolsSGX11GLES() {
|
||||
|
||||
void G4ToolsSGX11GLES::Initialise() {
|
||||
if(fSGSession) return; //done.
|
||||
fSGSession = new tools::X11::session(G4cout);
|
||||
fSGSession = new toolx::X11::session(G4cout);
|
||||
if(!fSGSession->is_valid()) {
|
||||
G4cerr << "G4ToolsSGX11GLES::Initialise : session::is_valid() failed." << G4endl;
|
||||
delete fSGSession;
|
||||
@@ -65,7 +65,7 @@ G4VViewer* G4ToolsSGX11GLES::CreateViewer(G4VSceneHandler& a_scene,const G4Strin
|
||||
if(!fSGSession) Initialise();
|
||||
if(!fSGSession) return nullptr;
|
||||
G4VViewer* pView =
|
||||
new G4ToolsSGViewer<tools::X11::session,tools::X11::sg_viewer>
|
||||
new G4ToolsSGViewer<toolx::X11::session,toolx::X11::sg_viewer>
|
||||
(*fSGSession,(G4ToolsSGSceneHandler&)a_scene,a_name);
|
||||
if (pView) {
|
||||
if (pView->GetViewId() < 0) {
|
||||
|
||||
@@ -28,12 +28,12 @@
|
||||
#include "G4ToolsSGXtGLES.hh"
|
||||
|
||||
#include "G4ToolsSGViewer.hh"
|
||||
#include <tools/Xt/sg_viewer>
|
||||
#include <toolx/Xt/sg_viewer>
|
||||
|
||||
#include "G4Xt.hh"
|
||||
|
||||
class session : public tools::Xt::session {
|
||||
typedef tools::Xt::session parent;
|
||||
class session : public toolx::Xt::session {
|
||||
typedef toolx::Xt::session parent;
|
||||
public:
|
||||
session(std::ostream& a_out,int a_argc,char** a_argv)
|
||||
:parent(a_out,a_argc,a_argv)
|
||||
@@ -88,7 +88,7 @@ G4VViewer* G4ToolsSGXtGLES::CreateViewer(G4VSceneHandler& a_scene,const G4String
|
||||
if(!fSGSession) Initialise();
|
||||
if(!fSGSession) return nullptr;
|
||||
G4VViewer* pView =
|
||||
new G4ToolsSGViewer<tools::Xt::session,tools::Xt::sg_viewer>(*fSGSession,(G4ToolsSGSceneHandler&)a_scene,a_name);
|
||||
new G4ToolsSGViewer<toolx::Xt::session,toolx::Xt::sg_viewer>(*fSGSession,(G4ToolsSGSceneHandler&)a_scene,a_name);
|
||||
if (pView) {
|
||||
if (pView->GetViewId() < 0) {
|
||||
G4cerr <<
|
||||
|
||||
Reference in New Issue
Block a user