Import Geant4 11.1.0 source tree
This commit is contained in:
@@ -4,10 +4,10 @@ add_subdirectory(HepRep)
|
||||
add_subdirectory(RayTracer)
|
||||
add_subdirectory(Tree)
|
||||
add_subdirectory(VRML)
|
||||
add_subdirectory(externals)
|
||||
add_subdirectory(gMocren)
|
||||
add_subdirectory(management)
|
||||
add_subdirectory(modeling)
|
||||
add_subdirectory(ToolsSG)
|
||||
|
||||
# OpenGL is optional depending on user selection
|
||||
if(GEANT4_USE_OPENGL)
|
||||
@@ -24,11 +24,6 @@ if(GEANT4_USE_QT3D)
|
||||
add_subdirectory(Qt3D)
|
||||
endif()
|
||||
|
||||
# ToolsSG is optional depending on user selection
|
||||
if(GEANT4_USE_TOOLSSG)
|
||||
add_subdirectory(ToolsSG)
|
||||
endif()
|
||||
|
||||
# VTK is optional depending on user selection
|
||||
if(GEANT4_USE_VTK)
|
||||
add_subdirectory(Vtk)
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
# Category DAWN History
|
||||
|
||||
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!
|
||||
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!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2022-11-25 Gabriele Cosmo (DAWN-V11-00-03)
|
||||
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
|
||||
|
||||
## 2022-10-13 Gabriele Cosmo (DAWN-V11-00-02)
|
||||
- Replaced use of sprintf() with snprintf(), to fix deprecation compilation
|
||||
warnings on macOS-13 SDK.
|
||||
|
||||
## 2022-01-28 Ben Morgan (DAWN-V11-00-01)
|
||||
- Replace `geant4_global_library_target` with direct file inclusion and
|
||||
|
||||
@@ -57,7 +57,7 @@ void G4FRSCENEHANDLER::AddPrimitive(const G4Polyline& polyline)
|
||||
FRBeginModeling();
|
||||
|
||||
//----- local working variables
|
||||
G4int nPoints = polyline.size();
|
||||
G4int nPoints = (G4int)polyline.size();
|
||||
G4int i;
|
||||
const G4VisAttributes* pVA =
|
||||
fpViewer->GetApplicableVisAttributes(polyline.GetVisAttributes());
|
||||
@@ -127,10 +127,10 @@ void G4FRSCENEHANDLER::AddPrimitive(const G4Text& text)
|
||||
|
||||
//----- get string to be visualized and Calc its length
|
||||
const char* vis_text = text.GetText();
|
||||
const int STR_LENGTH = strlen(vis_text);
|
||||
const G4int STR_LENGTH = (G4int)strlen(vis_text);
|
||||
|
||||
//----- create buffer and copy the string there
|
||||
int MAX_STR_LENGTH = COMMAND_BUF_SIZE - 100;
|
||||
G4int MAX_STR_LENGTH = COMMAND_BUF_SIZE - 100;
|
||||
if(MAX_STR_LENGTH <= 0)
|
||||
{
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
@@ -1140,7 +1140,7 @@ void G4FRSCENEHANDLER::SendStrInt(const char* char_string, G4int ival)
|
||||
G4int num_char;
|
||||
char* command = new char[COMMAND_BUF_SIZE];
|
||||
|
||||
num_char = sprintf(command, "%s %d", char_string, ival);
|
||||
num_char = snprintf(command, COMMAND_BUF_SIZE, "%s %d", char_string, ival);
|
||||
if(num_char < 0)
|
||||
{
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
@@ -1158,8 +1158,8 @@ void G4FRSCENEHANDLER::SendStrInt3(const char* char_string, G4int ival1,
|
||||
G4int num_char;
|
||||
char* command = new char[COMMAND_BUF_SIZE];
|
||||
|
||||
num_char =
|
||||
sprintf(command, "%s %d %d %d", char_string, ival1, ival2, ival3);
|
||||
num_char = snprintf(command, COMMAND_BUF_SIZE, "%s %d %d %d",
|
||||
char_string, ival1, ival2, ival3);
|
||||
|
||||
if(num_char < 0)
|
||||
{
|
||||
@@ -1179,8 +1179,8 @@ void G4FRSCENEHANDLER::SendStrInt4(const char* char_string, G4int ival1,
|
||||
G4int num_char;
|
||||
char* command = new char[COMMAND_BUF_SIZE];
|
||||
|
||||
num_char = sprintf(command, "%s %d %d %d %d", char_string, ival1, ival2,
|
||||
ival3, ival4);
|
||||
num_char = snprintf(command, COMMAND_BUF_SIZE, "%s %d %d %d %d",
|
||||
char_string, ival1, ival2, ival3, ival4);
|
||||
|
||||
if(num_char < 0)
|
||||
{
|
||||
@@ -1199,7 +1199,8 @@ void G4FRSCENEHANDLER::SendStrDouble(const char* char_string, G4double dval)
|
||||
G4int num_char;
|
||||
char* command = new char[COMMAND_BUF_SIZE];
|
||||
|
||||
num_char = sprintf(command, "%s %*.*g", char_string, fPrec2, fPrec, dval);
|
||||
num_char = snprintf(command, COMMAND_BUF_SIZE, "%s %*.*g",
|
||||
char_string, fPrec2, fPrec, dval);
|
||||
if(num_char < 0)
|
||||
{
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
@@ -1218,8 +1219,8 @@ void G4FRSCENEHANDLER::SendStrDouble2(const char* char_string, G4double dval1,
|
||||
G4int num_char;
|
||||
char* command = new char[COMMAND_BUF_SIZE];
|
||||
|
||||
num_char = sprintf(command, "%s %*.*g %*.*g", char_string, fPrec2, fPrec,
|
||||
dval1, fPrec2, fPrec, dval2);
|
||||
num_char = snprintf(command, COMMAND_BUF_SIZE, "%s %*.*g %*.*g",
|
||||
char_string, fPrec2, fPrec, dval1, fPrec2, fPrec, dval2);
|
||||
if(num_char < 0)
|
||||
{
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
@@ -1238,8 +1239,9 @@ void G4FRSCENEHANDLER::SendStrDouble3(const char* char_string, G4double dval1,
|
||||
G4int num_char;
|
||||
char* command = new char[COMMAND_BUF_SIZE];
|
||||
|
||||
num_char = sprintf(command, "%s %*.*g %*.*g %*.*g", char_string, fPrec2,
|
||||
fPrec, dval1, fPrec2, fPrec, dval2, fPrec2, fPrec, dval3);
|
||||
num_char = snprintf(command, COMMAND_BUF_SIZE, "%s %*.*g %*.*g %*.*g",
|
||||
char_string, fPrec2, fPrec, dval1, fPrec2,
|
||||
fPrec, dval2, fPrec2, fPrec, dval3);
|
||||
if(num_char < 0)
|
||||
{
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
@@ -1259,9 +1261,10 @@ void G4FRSCENEHANDLER::SendStrDouble4(const char* char_string, G4double dval1,
|
||||
G4int num_char;
|
||||
char* command = new char[COMMAND_BUF_SIZE];
|
||||
|
||||
num_char = sprintf(command, "%s %*.*g %*.*g %*.*g %*.*g", char_string,
|
||||
fPrec2, fPrec, dval1, fPrec2, fPrec, dval2, fPrec2, fPrec,
|
||||
dval3, fPrec2, fPrec, dval4);
|
||||
num_char = snprintf(command, COMMAND_BUF_SIZE,
|
||||
"%s %*.*g %*.*g %*.*g %*.*g", char_string,
|
||||
fPrec2, fPrec, dval1, fPrec2, fPrec, dval2,
|
||||
fPrec2, fPrec, dval3, fPrec2, fPrec, dval4);
|
||||
if(num_char < 0)
|
||||
{
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
@@ -1281,10 +1284,10 @@ void G4FRSCENEHANDLER::SendStrDouble5(const char* char_string, G4double dval1,
|
||||
G4int num_char;
|
||||
char* command = new char[COMMAND_BUF_SIZE];
|
||||
|
||||
num_char =
|
||||
sprintf(command, "%s %*.*g %*.*g %*.*g %*.*g %*.*g", char_string,
|
||||
fPrec2, fPrec, dval1, fPrec2, fPrec, dval2, fPrec2, fPrec, dval3,
|
||||
fPrec2, fPrec, dval4, fPrec2, fPrec, dval5);
|
||||
num_char = snprintf(command, COMMAND_BUF_SIZE,
|
||||
"%s %*.*g %*.*g %*.*g %*.*g %*.*g", char_string,
|
||||
fPrec2, fPrec, dval1, fPrec2, fPrec, dval2, fPrec2,
|
||||
fPrec, dval3, fPrec2, fPrec, dval4, fPrec2, fPrec, dval5);
|
||||
if(num_char < 0)
|
||||
{
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
@@ -1305,10 +1308,11 @@ void G4FRSCENEHANDLER::SendStrDouble6(const char* char_string, G4double dval1,
|
||||
G4int num_char;
|
||||
char* command = new char[COMMAND_BUF_SIZE];
|
||||
|
||||
num_char = sprintf(command, "%s %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g",
|
||||
char_string, fPrec2, fPrec, dval1, fPrec2, fPrec, dval2,
|
||||
fPrec2, fPrec, dval3, fPrec2, fPrec, dval4, fPrec2, fPrec,
|
||||
dval5, fPrec2, fPrec, dval6);
|
||||
num_char = snprintf(command, COMMAND_BUF_SIZE,
|
||||
"%s %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g",
|
||||
char_string, fPrec2, fPrec, dval1, fPrec2, fPrec, dval2,
|
||||
fPrec2, fPrec, dval3, fPrec2, fPrec, dval4, fPrec2, fPrec,
|
||||
dval5, fPrec2, fPrec, dval6);
|
||||
if(num_char < 0)
|
||||
{
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
@@ -1329,10 +1333,11 @@ void G4FRSCENEHANDLER::SendStrDouble7(const char* char_string, G4double dval1,
|
||||
G4int num_char;
|
||||
char* command = new char[COMMAND_BUF_SIZE];
|
||||
|
||||
num_char = sprintf(command, "%s %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g",
|
||||
char_string, fPrec2, fPrec, dval1, fPrec2, fPrec, dval2,
|
||||
fPrec2, fPrec, dval3, fPrec2, fPrec, dval4, fPrec2, fPrec,
|
||||
dval5, fPrec2, fPrec, dval6, fPrec2, fPrec, dval7);
|
||||
num_char = snprintf(command, COMMAND_BUF_SIZE,
|
||||
"%s %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g",
|
||||
char_string, fPrec2, fPrec, dval1, fPrec2, fPrec, dval2,
|
||||
fPrec2, fPrec, dval3, fPrec2, fPrec, dval4, fPrec2, fPrec,
|
||||
dval5, fPrec2, fPrec, dval6, fPrec2, fPrec, dval7);
|
||||
if(num_char < 0)
|
||||
{
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
@@ -1355,8 +1360,7 @@ void G4FRSCENEHANDLER::SendStrDouble11(const char* char_string, G4double dval1,
|
||||
G4int num_char;
|
||||
char* command = new char[COMMAND_BUF_SIZE];
|
||||
|
||||
num_char = sprintf(
|
||||
command,
|
||||
num_char = snprintf(command, COMMAND_BUF_SIZE,
|
||||
"%s %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g",
|
||||
char_string, fPrec2, fPrec, dval1, fPrec2, fPrec, dval2, fPrec2, fPrec,
|
||||
dval3, fPrec2, fPrec, dval4, fPrec2, fPrec, dval5, fPrec2, fPrec, dval6,
|
||||
@@ -1380,8 +1384,9 @@ void G4FRSCENEHANDLER::SendIntDouble3(G4int ival, G4double dval1,
|
||||
G4int num_char;
|
||||
char* command = new char[COMMAND_BUF_SIZE];
|
||||
|
||||
num_char = sprintf(command, "%d %*.*g %*.*g %*.*g", ival, fPrec2, fPrec,
|
||||
dval1, fPrec2, fPrec, dval2, fPrec2, fPrec, dval3);
|
||||
num_char = snprintf(command, COMMAND_BUF_SIZE, "%d %*.*g %*.*g %*.*g",
|
||||
ival, fPrec2, fPrec, dval1, fPrec2, fPrec, dval2,
|
||||
fPrec2, fPrec, dval3);
|
||||
if(num_char < 0)
|
||||
{
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
@@ -1399,7 +1404,8 @@ void G4FRSCENEHANDLER::SendInt3Str(G4int ival1, G4int ival2, G4int ival3,
|
||||
G4int num_char;
|
||||
char* command = new char[COMMAND_BUF_SIZE];
|
||||
|
||||
num_char = sprintf(command, "%d %d %d %s", ival1, ival2, ival3, char_string);
|
||||
num_char = snprintf(command, COMMAND_BUF_SIZE, "%d %d %d %s",
|
||||
ival1, ival2, ival3, char_string);
|
||||
if(num_char < 0)
|
||||
{
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
@@ -1417,8 +1423,8 @@ void G4FRSCENEHANDLER::SendInt4Str(G4int ival1, G4int ival2, G4int ival3,
|
||||
G4int num_char;
|
||||
char* command = new char[COMMAND_BUF_SIZE];
|
||||
|
||||
num_char =
|
||||
sprintf(command, "%d %d %d %d %s", ival1, ival2, ival3, ival4, char_string);
|
||||
num_char = snprintf(command, COMMAND_BUF_SIZE, "%d %d %d %d %s",
|
||||
ival1, ival2, ival3, ival4, char_string);
|
||||
if(num_char < 0)
|
||||
{
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
@@ -1438,9 +1444,9 @@ void G4FRSCENEHANDLER::SendStrDouble3Str(const char* char_string1,
|
||||
G4int num_char;
|
||||
char* command = new char[COMMAND_BUF_SIZE];
|
||||
|
||||
num_char =
|
||||
sprintf(command, "%s %*.*g %*.*g %*.*g %s", char_string1, fPrec2, fPrec,
|
||||
dval1, fPrec2, fPrec, dval2, fPrec2, fPrec, dval3, char_string2);
|
||||
num_char = snprintf(command, COMMAND_BUF_SIZE, "%s %*.*g %*.*g %*.*g %s",
|
||||
char_string1, fPrec2, fPrec, dval1, fPrec2, fPrec, dval2,
|
||||
fPrec2, fPrec, dval3, char_string2);
|
||||
if(num_char < 0)
|
||||
{
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
@@ -1461,10 +1467,11 @@ void G4FRSCENEHANDLER::SendStrDouble6Str(const char* char_string1,
|
||||
G4int num_char;
|
||||
char* command = new char[COMMAND_BUF_SIZE];
|
||||
|
||||
num_char = sprintf(command, "%s %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %s",
|
||||
char_string1, fPrec2, fPrec, dval1, fPrec2, fPrec, dval2,
|
||||
fPrec2, fPrec, dval3, fPrec2, fPrec, dval4, fPrec2, fPrec,
|
||||
dval5, fPrec2, fPrec, dval6, char_string2);
|
||||
num_char = snprintf(command, COMMAND_BUF_SIZE,
|
||||
"%s %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %s",
|
||||
char_string1, fPrec2, fPrec, dval1, fPrec2, fPrec, dval2,
|
||||
fPrec2, fPrec, dval3, fPrec2, fPrec, dval4, fPrec2, fPrec,
|
||||
dval5, fPrec2, fPrec, dval6, char_string2);
|
||||
if(num_char < 0)
|
||||
{
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
@@ -1481,7 +1488,7 @@ void G4FRSCENEHANDLER::SendInt(G4int val)
|
||||
G4int num_char;
|
||||
char* command = new char[COMMAND_BUF_SIZE];
|
||||
|
||||
num_char = sprintf(command, "%d", val);
|
||||
num_char = snprintf(command, COMMAND_BUF_SIZE, "%d", val);
|
||||
if(num_char < 0)
|
||||
{
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
@@ -1498,7 +1505,7 @@ void G4FRSCENEHANDLER::SendDouble(G4double val)
|
||||
G4int num_char;
|
||||
char* command = new char[COMMAND_BUF_SIZE];
|
||||
|
||||
num_char = sprintf(command, "%*.*g", fPrec2, fPrec, val);
|
||||
num_char = snprintf(command, COMMAND_BUF_SIZE, "%*.*g", fPrec2, fPrec, val);
|
||||
if(num_char < 0)
|
||||
{
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
|
||||
@@ -39,27 +39,21 @@ ifdef G4VIS_BUILD
|
||||
SUBLIBS += G4Tree
|
||||
SUBDIRS += gMocren
|
||||
SUBLIBS += G4GMocren
|
||||
SUBDIRS += ToolsSG
|
||||
SUBLIBS += G4ToolsSG
|
||||
# Drivers needing external libraries...
|
||||
ifdef G4VIS_BUILD_OPENGL_DRIVER
|
||||
SUBDIRS += externals/gl2ps
|
||||
SUBDIRS += OpenGL
|
||||
SUBLIBS += G4OpenGL
|
||||
SUBLIBS += G4gl2ps
|
||||
endif
|
||||
ifdef G4VIS_BUILD_OI_DRIVER
|
||||
SUBDIRS += externals/gl2ps
|
||||
SUBDIRS += OpenInventor
|
||||
SUBLIBS += G4OpenInventor
|
||||
SUBLIBS += G4gl2ps
|
||||
endif
|
||||
ifdef G4VIS_BUILD_QT3D_DRIVER
|
||||
SUBDIRS += Qt3D
|
||||
SUBLIBS += G4visQt3D
|
||||
endif
|
||||
ifdef G4VIS_BUILD_TOOLSSG_DRIVER
|
||||
SUBDIRS += ToolsSG
|
||||
SUBLIBS += G4ToolsSG
|
||||
endif
|
||||
endif #G4VIS_BUILD
|
||||
|
||||
.PHONY: granular obj glob global clean
|
||||
|
||||
@@ -4,6 +4,9 @@ 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!
|
||||
|
||||
## 2022-09-03 Ben Morgan (vis-HepRep-V11-00-02)
|
||||
- Make dependencies consistent.
|
||||
|
||||
## 2022-01-28 Ben Morgan (vis-HepRep-V11-00-01)
|
||||
- Replace `geant4_global_library_target` with direct file inclusion and
|
||||
call to `geant4_add_category` to define library build from source modules.
|
||||
|
||||
@@ -18,16 +18,16 @@ geant4_add_module(G4visHepRep
|
||||
geant4_module_link_libraries(G4visHepRep
|
||||
PUBLIC
|
||||
G4csg
|
||||
G4geometrymng
|
||||
G4materials
|
||||
G4modeling
|
||||
G4specsolids
|
||||
G4globman
|
||||
G4intercoms
|
||||
G4vis_management
|
||||
G4graphics_reps
|
||||
PRIVATE
|
||||
G4hepgeometry
|
||||
G4geometrymng
|
||||
G4graphics_reps
|
||||
G4hits
|
||||
G4materials
|
||||
G4modeling
|
||||
G4tracking)
|
||||
|
||||
# List any source specific properties here
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
# Category vis History
|
||||
|
||||
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!
|
||||
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!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2022-11-28 John Allison (vis-V11-00-04)
|
||||
- Numerous tags for 11.1 in vis sub-categories - see History files therein.
|
||||
|
||||
## 2022-11-25 Gabriele Cosmo (vis-V11-00-03)
|
||||
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
|
||||
|
||||
## 2022-07-14 Ben Morgan (vis-V11-00-02)
|
||||
- Remove obsolete externals gl2ps subcategory
|
||||
|
||||
## 2022-03-25 Ben Morgan (vis-V11-00-01)
|
||||
- Remove retired G4tasking library as link dependency of vis libraries
|
||||
|
||||
@@ -6,6 +6,42 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2022-11-25 Gabriele Cosmo (opengl-V11-00-21)
|
||||
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
|
||||
|
||||
## 2022-11-21 Ben Morgan (opengl-V11-00-20)
|
||||
- Revert link support for Qt6 until code is ready.
|
||||
|
||||
## 2022-10-28 John Allison (opengl-V11-00-19)
|
||||
- Update a comment about requesting a kernel visit when cutaway mode
|
||||
changes - noted but not relevant because OGL does its own cutaways:
|
||||
- G4OpenGLStoredQtViewer.cc
|
||||
- G4OpenGLStoredViewer.cc
|
||||
- Minor tidy - speed cutaway check:
|
||||
- G4OpenGLViewer::SetView
|
||||
|
||||
## 2022-10-17 Gabriele Cosmo (opengl-V11-00-18)
|
||||
- Replaced use of sprintf() with snprintf(), to fix deprecation compilation
|
||||
warnings on macOS-13 SDK.
|
||||
|
||||
## 2022-10-11 Ben Morgan (opengl-V11-00-17)
|
||||
- Link to Qt OpenGLWidgets target for Qt6 only.
|
||||
|
||||
## 2022-10-07 Gabriele Cosmo (opengl-V11-00-16)
|
||||
- Fixed compilation warnings on Intel/icc compiler for deprecated conversion
|
||||
of string literal to char* in G4OpenGLXmConvenienceRoutines and
|
||||
G4OpenGLXmViewer.
|
||||
|
||||
## 2022-09-14 John Allison (opengl-V11-00-15)
|
||||
- G4OpenGLStoredViewer.cc, G4OpenGLStoredQtViewer.cc:
|
||||
- Add check on special mesh rendering option in CompareForKernelVisit.
|
||||
|
||||
## 2022-09-06 Ben Morgan (opengl-V11-00-14)
|
||||
- Address dependency inconsistencies reported by geant4_module_check
|
||||
|
||||
## 2022-07-13 Ben Morgan (opengl-V11-00-13)
|
||||
- Fix compiler warnings in the use of G4OpenGLQtViewer::toggleProjection.
|
||||
|
||||
## 2022-05-03 Ben Morgan (opengl-V11-00-12)
|
||||
- Preliminary build support for Qt5 and Qt6
|
||||
|
||||
|
||||
@@ -60,130 +60,149 @@ protected:
|
||||
void GetXmConnection ();
|
||||
virtual void CreateMainWindow ();
|
||||
|
||||
XtAppContext app;
|
||||
XtWorkProcId workId;
|
||||
Widget toplevel,
|
||||
shell,
|
||||
main_win,
|
||||
menubar,
|
||||
style_cascade,
|
||||
actions_cascade,
|
||||
misc_cascade,
|
||||
spec_cascade,
|
||||
drawing_style_pullright,
|
||||
background_color_pullright,
|
||||
transparency_pullright,
|
||||
antialias_pullright,
|
||||
haloing_pullright,
|
||||
aux_edge_pullright,
|
||||
frame,
|
||||
glxarea;
|
||||
XtAppContext app;
|
||||
XtWorkProcId workId;
|
||||
Widget toplevel,
|
||||
shell,
|
||||
main_win,
|
||||
menubar,
|
||||
style_cascade,
|
||||
actions_cascade,
|
||||
misc_cascade,
|
||||
spec_cascade,
|
||||
drawing_style_pullright,
|
||||
background_color_pullright,
|
||||
transparency_pullright,
|
||||
antialias_pullright,
|
||||
haloing_pullright,
|
||||
aux_edge_pullright,
|
||||
frame,
|
||||
glxarea;
|
||||
|
||||
XmString style_str,
|
||||
actions_str,
|
||||
misc_str,
|
||||
spec_str,
|
||||
draw_str,
|
||||
polyhedron_str,
|
||||
wireframe_str,
|
||||
hlr_str,
|
||||
hsr_str,
|
||||
hlhsr_str,
|
||||
set_str,
|
||||
rot_str,
|
||||
pan_str,
|
||||
exit_str,
|
||||
quit_str,
|
||||
print_str,
|
||||
white_str,
|
||||
black_str,
|
||||
anti_str,
|
||||
trans_str,
|
||||
halo_str,
|
||||
aux_edge_str,
|
||||
bgnd_str,
|
||||
off_str,
|
||||
on_str;
|
||||
XmString style_str,
|
||||
actions_str,
|
||||
misc_str,
|
||||
spec_str,
|
||||
draw_str,
|
||||
polyhedron_str,
|
||||
wireframe_str,
|
||||
hlr_str,
|
||||
hsr_str,
|
||||
hlhsr_str,
|
||||
set_str,
|
||||
rot_str,
|
||||
pan_str,
|
||||
exit_str,
|
||||
quit_str,
|
||||
print_str,
|
||||
white_str,
|
||||
black_str,
|
||||
anti_str,
|
||||
trans_str,
|
||||
halo_str,
|
||||
aux_edge_str,
|
||||
bgnd_str,
|
||||
off_str,
|
||||
on_str;
|
||||
|
||||
G4double zoom_high,
|
||||
zoom_low,
|
||||
pan_low,
|
||||
pan_high,
|
||||
dolly_low,
|
||||
dolly_high,
|
||||
fov,
|
||||
rot_sens_limit,
|
||||
pan_sens_limit,
|
||||
wob_high,
|
||||
wob_low,
|
||||
wob_sens;
|
||||
G4double zoom_high,
|
||||
zoom_low,
|
||||
pan_low,
|
||||
pan_high,
|
||||
dolly_low,
|
||||
dolly_high,
|
||||
fov,
|
||||
rot_sens_limit,
|
||||
pan_sens_limit,
|
||||
wob_high,
|
||||
wob_low,
|
||||
wob_sens;
|
||||
|
||||
Pixel bgnd,
|
||||
borcol;
|
||||
Pixel bgnd,
|
||||
borcol;
|
||||
|
||||
G4bool pan_right,
|
||||
rotate_right,
|
||||
pan_up,
|
||||
rotate_up;
|
||||
G4bool pan_right,
|
||||
rotate_right,
|
||||
pan_up,
|
||||
rotate_up;
|
||||
|
||||
XtIntervalId rotation_timer,
|
||||
pan_timer,
|
||||
wobble_timer;
|
||||
XtIntervalId rotation_timer,
|
||||
pan_timer,
|
||||
wobble_timer;
|
||||
|
||||
G4Vector3D original_vp;
|
||||
G4Vector3D original_vp;
|
||||
|
||||
G4int frameNo;
|
||||
G4int frameNo;
|
||||
static const G4String e_str;
|
||||
G4String menu_str[37] = { "Style", "style",
|
||||
"Actions", "actions",
|
||||
"Miscellany", "miscellany",
|
||||
"Special", "special",
|
||||
"menubar", "Drawing",
|
||||
"Background color", "Wireframe",
|
||||
"Hidden line removal", "Hidden surface removal",
|
||||
"Hidden line and surface removal", "drawing_style",
|
||||
"White", "Black",
|
||||
"background_color", "Rotation control panel",
|
||||
"Panning control panel", "Set control panel limits",
|
||||
"Miscellany control panel",
|
||||
"Exit to G4Vis>", "Create .eps file",
|
||||
"Transparency", "transparency",
|
||||
"Antialiasing", "antialias",
|
||||
"Haloing", "haloing",
|
||||
"Auxiliary edges", "aux_edge",
|
||||
"Off", "On", "frame", "glxarea" };
|
||||
|
||||
G4OpenGLXmTopLevelShell* fprotation_top;
|
||||
G4OpenGLXmBox* fprotation_button_box;
|
||||
G4OpenGLXmRadioButton* fprotation_button1;
|
||||
G4OpenGLXmRadioButton* fprotation_button2;
|
||||
G4OpenGLXmBox* fprotation_slider_box;
|
||||
G4OpenGLXmSliderBar* fprotation_slider;
|
||||
G4OpenGLXmBox* fprotation_arrow_box;
|
||||
G4OpenGLXmFourArrowButtons* fprotation_arrow;
|
||||
G4OpenGLXmTopLevelShell* fprotation_top;
|
||||
G4OpenGLXmBox* fprotation_button_box;
|
||||
G4OpenGLXmRadioButton* fprotation_button1;
|
||||
G4OpenGLXmRadioButton* fprotation_button2;
|
||||
G4OpenGLXmBox* fprotation_slider_box;
|
||||
G4OpenGLXmSliderBar* fprotation_slider;
|
||||
G4OpenGLXmBox* fprotation_arrow_box;
|
||||
G4OpenGLXmFourArrowButtons* fprotation_arrow;
|
||||
|
||||
G4OpenGLXmTopLevelShell* fppanning_top;
|
||||
G4OpenGLXmFramedBox* fppanning_box;
|
||||
G4OpenGLXmFourArrowButtons* fppanning_arrows;
|
||||
G4OpenGLXmSliderBar* fppanning_slider;
|
||||
G4OpenGLXmFramedBox* fpzoom_box;
|
||||
G4OpenGLXmSliderBar* fpzoom_slider;
|
||||
G4OpenGLXmFramedBox* fpdolly_box;
|
||||
G4OpenGLXmSliderBar* fpdolly_slider;
|
||||
G4OpenGLXmTopLevelShell* fppanning_top;
|
||||
G4OpenGLXmFramedBox* fppanning_box;
|
||||
G4OpenGLXmFourArrowButtons* fppanning_arrows;
|
||||
G4OpenGLXmSliderBar* fppanning_slider;
|
||||
G4OpenGLXmFramedBox* fpzoom_box;
|
||||
G4OpenGLXmSliderBar* fpzoom_slider;
|
||||
G4OpenGLXmFramedBox* fpdolly_box;
|
||||
G4OpenGLXmSliderBar* fpdolly_slider;
|
||||
|
||||
G4OpenGLXmTopLevelShell* fpsetting_top;
|
||||
G4OpenGLXmFramedBox* fpsetting_box;
|
||||
G4OpenGLXmTextField* fppan_set;
|
||||
G4OpenGLXmTextField* fprot_set;
|
||||
G4OpenGLXmTextField* fpzoom_upper;
|
||||
G4OpenGLXmTextField* fpzoom_lower;
|
||||
G4OpenGLXmTextField* fpdolly_upper;
|
||||
G4OpenGLXmTextField* fpdolly_lower;
|
||||
G4OpenGLXmPushButton* fpok_button;
|
||||
G4OpenGLXmTopLevelShell* fpsetting_top;
|
||||
G4OpenGLXmFramedBox* fpsetting_box;
|
||||
G4OpenGLXmTextField* fppan_set;
|
||||
G4OpenGLXmTextField* fprot_set;
|
||||
G4OpenGLXmTextField* fpzoom_upper;
|
||||
G4OpenGLXmTextField* fpzoom_lower;
|
||||
G4OpenGLXmTextField* fpdolly_upper;
|
||||
G4OpenGLXmTextField* fpdolly_lower;
|
||||
G4OpenGLXmPushButton* fpok_button;
|
||||
|
||||
G4OpenGLXmTopLevelShell* fpmiscellany_top;
|
||||
G4OpenGLXmFramedBox* fpwobble_box;
|
||||
G4OpenGLXmPushButton* fpwobble_button;
|
||||
G4OpenGLXmSliderBar* fpwobble_slider;
|
||||
G4OpenGLXmFramedBox* fpreset_box;
|
||||
G4OpenGLXmPushButton* fpreset_button;
|
||||
G4OpenGLXmFramedBox* fpproj_style_box;
|
||||
G4OpenGLXmRadioButton* fporthogonal_button;
|
||||
G4OpenGLXmRadioButton* fpperspective_button;
|
||||
G4OpenGLXmTextField* fpfov_text;
|
||||
G4OpenGLXmTopLevelShell* fpmiscellany_top;
|
||||
G4OpenGLXmFramedBox* fpwobble_box;
|
||||
G4OpenGLXmPushButton* fpwobble_button;
|
||||
G4OpenGLXmSliderBar* fpwobble_slider;
|
||||
G4OpenGLXmFramedBox* fpreset_box;
|
||||
G4OpenGLXmPushButton* fpreset_button;
|
||||
G4OpenGLXmFramedBox* fpproj_style_box;
|
||||
G4OpenGLXmRadioButton* fporthogonal_button;
|
||||
G4OpenGLXmRadioButton* fpperspective_button;
|
||||
G4OpenGLXmTextField* fpfov_text;
|
||||
|
||||
G4OpenGLXmTopLevelShell* fpprint_top;
|
||||
G4OpenGLXmFramedBox* fpprint_box;
|
||||
G4OpenGLXmFramedBox* fpprint_col_box;
|
||||
G4OpenGLXmFramedBox* fpprint_style_box;
|
||||
G4OpenGLXmTextField* fpprint_text;
|
||||
G4OpenGLXmPushButton* fpprint_button;
|
||||
G4OpenGLXmSeparator* fpprint_line;
|
||||
G4OpenGLXmRadioButton* fpprint_col_radio1;
|
||||
G4OpenGLXmRadioButton* fpprint_col_radio2;
|
||||
G4OpenGLXmRadioButton* fpprint_style_radio1;
|
||||
G4OpenGLXmRadioButton* fpprint_style_radio2;
|
||||
G4OpenGLXmTopLevelShell* fpprint_top;
|
||||
G4OpenGLXmFramedBox* fpprint_box;
|
||||
G4OpenGLXmFramedBox* fpprint_col_box;
|
||||
G4OpenGLXmFramedBox* fpprint_style_box;
|
||||
G4OpenGLXmTextField* fpprint_text;
|
||||
G4OpenGLXmPushButton* fpprint_button;
|
||||
G4OpenGLXmSeparator* fpprint_line;
|
||||
G4OpenGLXmRadioButton* fpprint_col_radio1;
|
||||
G4OpenGLXmRadioButton* fpprint_col_radio2;
|
||||
G4OpenGLXmRadioButton* fpprint_style_radio1;
|
||||
G4OpenGLXmRadioButton* fpprint_style_radio2;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -39,10 +39,7 @@ geant4_module_link_libraries(G4OpenGL
|
||||
G4vis_management
|
||||
PRIVATE
|
||||
G4geometrymng
|
||||
G4UIcommon
|
||||
G4UIbasic
|
||||
G4run
|
||||
G4gl2ps)
|
||||
G4run)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add X11 OpenGL Support if requested
|
||||
@@ -128,8 +125,8 @@ if(GEANT4_USE_XM)
|
||||
# Add the compile definitions needed for the Xm component (G4OpenGL.hh, G4OpenGLViewer.cc)
|
||||
geant4_module_compile_definitions(G4OpenGL PRIVATE G4VIS_BUILD_OPENGLXM_DRIVER)
|
||||
|
||||
# Add in Xm
|
||||
geant4_module_link_libraries(G4OpenGL PUBLIC Motif::Xm)
|
||||
# Add in Xm and needed modules
|
||||
geant4_module_link_libraries(G4OpenGL PUBLIC Motif::Xm PRIVATE G4UIcommon)
|
||||
endif()
|
||||
|
||||
# Common X11/Xm link libraries
|
||||
@@ -172,8 +169,10 @@ if(GEANT4_USE_QT)
|
||||
# Add the definitions (G4OpenGL.hh, G4OpenGLViewer.cc)
|
||||
geant4_module_compile_definitions(G4OpenGL PRIVATE G4VIS_BUILD_OPENGLQT_DRIVER)
|
||||
|
||||
# Add in Qt libraries
|
||||
geant4_module_link_libraries(G4OpenGL PUBLIC Qt${QT_VERSION_MAJOR}::OpenGL Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::PrintSupport Qt${QT_VERSION_MAJOR}::Widgets OpenGL::GL)
|
||||
# Add in Qt libraries and geant4 modules
|
||||
geant4_module_link_libraries(G4OpenGL
|
||||
PUBLIC Qt${QT_VERSION_MAJOR}::OpenGL Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::PrintSupport Qt${QT_VERSION_MAJOR}::Widgets OpenGL::GL
|
||||
PRIVATE G4UIbasic G4UIcommon)
|
||||
endif()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
@@ -600,8 +600,8 @@ void G4OpenGLQtViewer::createPopupMenu() {
|
||||
}
|
||||
#else
|
||||
// no more radioAction, not realy useful and could be confusing to use context menu and icon at the same time
|
||||
fProjectionOrtho = mProjection->addAction("Orthographic", this, [this](){ this->toggleProjection(1); });
|
||||
fProjectionPerspective = mProjection->addAction("Perspective", this, [this](){ this->toggleProjection(2); });
|
||||
fProjectionOrtho = mProjection->addAction("Orthographic", this, [this](){ this->toggleProjection(true); });
|
||||
fProjectionPerspective = mProjection->addAction("Perspective", this, [this](){ this->toggleProjection(false); });
|
||||
#endif
|
||||
// === Drawing Menu ===
|
||||
QMenu *mDrawing = mStyle->addMenu("&Drawing");
|
||||
@@ -935,7 +935,7 @@ void G4OpenGLQtViewer::toggleSurfaceAction(int aAction) {
|
||||
*/
|
||||
void G4OpenGLQtViewer::toggleProjection(bool check) {
|
||||
|
||||
if (check == 1) {
|
||||
if (check) {
|
||||
fVP.SetOrthogonalProjection ();
|
||||
} else {
|
||||
fVP.SetPerspectiveProjection();
|
||||
@@ -1343,7 +1343,7 @@ void G4OpenGLQtViewer::G4MouseReleaseEvent(QMouseEvent *evnt)
|
||||
// factorX == factorY
|
||||
double factorX = ((double)viewport[2]/fGLWidget->width());
|
||||
double factorY = ((double)viewport[3]/fGLWidget->height());
|
||||
fSpinningDelay = fLastEventTime->elapsed();
|
||||
fSpinningDelay = (int)fLastEventTime->elapsed();
|
||||
QPoint delta = (fLastPos3-fLastPos1)*factorX;
|
||||
|
||||
// reset cursor state
|
||||
@@ -2934,7 +2934,7 @@ QTreeWidgetItem* G4OpenGLQtViewer::createTreeWidgetItem(
|
||||
|
||||
// Set depth
|
||||
if (fullPath.size() > fSceneTreeDepth) {
|
||||
fSceneTreeDepth = fullPath.size();
|
||||
fSceneTreeDepth = (unsigned int)fullPath.size();
|
||||
// Change slider value
|
||||
if (fSceneTreeDepthSlider) {
|
||||
fSceneTreeDepthSlider->setTickInterval(1000/(fSceneTreeDepth+1));
|
||||
@@ -3195,24 +3195,24 @@ void G4OpenGLQtViewer::changeOpenCloseVisibleHiddenSelectedColorSceneTreeElement
|
||||
|
||||
// POindex > 0
|
||||
std::map <int, QTreeWidgetItem*>::const_iterator i;
|
||||
i = fOldPositivePoIndexSceneTreeWidgetQuickMap.begin();
|
||||
while (i != fOldPositivePoIndexSceneTreeWidgetQuickMap.end()) {
|
||||
i = fOldPositivePoIndexSceneTreeWidgetQuickMap.cbegin();
|
||||
while (i != fOldPositivePoIndexSceneTreeWidgetQuickMap.cend()) {
|
||||
if (isSameSceneTreeElement(i->second,subItem)) {
|
||||
oldItem = i->second;
|
||||
i = fOldPositivePoIndexSceneTreeWidgetQuickMap.end();
|
||||
i = fOldPositivePoIndexSceneTreeWidgetQuickMap.cend();
|
||||
} else {
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
// POindex == 0 ?
|
||||
if (oldItem == NULL) {
|
||||
unsigned int a = 0;
|
||||
std::size_t a = 0;
|
||||
while (a < fOldNullPoIndexSceneTreeWidgetQuickVector.size()) {
|
||||
if (isSameSceneTreeElement(fOldNullPoIndexSceneTreeWidgetQuickVector[a],subItem)) {
|
||||
oldItem = fOldNullPoIndexSceneTreeWidgetQuickVector[a];
|
||||
a = fOldNullPoIndexSceneTreeWidgetQuickVector.size();
|
||||
} else {
|
||||
a++;
|
||||
++a;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4470,7 +4470,7 @@ void G4OpenGLQtViewer::updateViewerPropertiesTableWidget() {
|
||||
|
||||
// Set Guidance
|
||||
QString guidance;
|
||||
G4int n_guidanceEntry = commandTmp->GetGuidanceEntries();
|
||||
G4int n_guidanceEntry = (G4int)commandTmp->GetGuidanceEntries();
|
||||
for( G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ ) {
|
||||
guidance += QString((char*)(commandTmp->GetGuidanceLine(i_thGuidance)).data()) + "\n";
|
||||
}
|
||||
@@ -4756,7 +4756,7 @@ QString G4OpenGLQtViewer::GetCommandParameterList (
|
||||
const G4UIcommand *aCommand
|
||||
)
|
||||
{
|
||||
G4int n_parameterEntry = aCommand->GetParameterEntries();
|
||||
G4int n_parameterEntry = (G4int)aCommand->GetParameterEntries();
|
||||
QString txt;
|
||||
|
||||
if( n_parameterEntry > 0 ) {
|
||||
|
||||
@@ -344,7 +344,7 @@ G4DisplacedSolid* G4OpenGLSceneHandler::CreateCutawaySolid ()
|
||||
|
||||
void G4OpenGLSceneHandler::AddPrimitive (const G4Polyline& line)
|
||||
{
|
||||
G4int nPoints = line.size ();
|
||||
std::size_t nPoints = line.size ();
|
||||
if (nPoints <= 0) return;
|
||||
|
||||
// Note: colour and depth test treated in sub-class.
|
||||
@@ -368,7 +368,7 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyline& line)
|
||||
// Boundary and nonboundary edge flags on vertices are significant only if GL_POLYGON_MODE is set to GL_POINT or GL_LINE. See glPolygonMode.
|
||||
|
||||
// glEdgeFlag (GL_TRUE);
|
||||
for (G4int iPoint = 0; iPoint < nPoints; iPoint++) {
|
||||
for (std::size_t iPoint = 0; iPoint < nPoints; ++iPoint) {
|
||||
G4double x, y, z;
|
||||
x = line[iPoint].x();
|
||||
y = line[iPoint].y();
|
||||
@@ -379,7 +379,7 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyline& line)
|
||||
#else
|
||||
glBeginVBO(GL_LINE_STRIP);
|
||||
|
||||
for (G4int iPoint = 0; iPoint < nPoints; iPoint++) {
|
||||
for (std::size_t iPoint = 0; iPoint < nPoints; ++iPoint) {
|
||||
fOglVertex.push_back(line[iPoint].x());
|
||||
fOglVertex.push_back(line[iPoint].y());
|
||||
fOglVertex.push_back(line[iPoint].z());
|
||||
|
||||
@@ -93,7 +93,7 @@ G4bool G4OpenGLStoredQtSceneHandler::ExtraPOProcessing
|
||||
// build a path for tree viewer
|
||||
G4OpenGLQtViewer* pGLViewer = dynamic_cast<G4OpenGLQtViewer*>(fpViewer);
|
||||
if ( pGLViewer ) {
|
||||
pGLViewer->addPVSceneTreeElement(fpModel->GetCurrentDescription(),pPVModel,currentPOListIndex);
|
||||
pGLViewer->addPVSceneTreeElement(fpModel->GetCurrentDescription(),pPVModel,(G4int)currentPOListIndex);
|
||||
}
|
||||
|
||||
} else { // Not from a G4PhysicalVolumeModel.
|
||||
@@ -104,7 +104,7 @@ G4bool G4OpenGLStoredQtSceneHandler::ExtraPOProcessing
|
||||
// build a path for tree viewer
|
||||
G4OpenGLQtViewer* pGLViewer = dynamic_cast<G4OpenGLQtViewer*>(fpViewer);
|
||||
if ( pGLViewer ) {
|
||||
pGLViewer->addNonPVSceneTreeElement(fpModel->GetType(),currentPOListIndex,fpModel->GetCurrentDescription().data(),visible);
|
||||
pGLViewer->addNonPVSceneTreeElement(fpModel->GetType(),(G4int)currentPOListIndex,fpModel->GetCurrentDescription().data(),visible);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +141,8 @@ G4bool G4OpenGLStoredQtViewer::CompareForKernelVisit(G4ViewParameters& lastVP)
|
||||
fVP.GetDefaultTextVisAttributes()->GetColour()) ||
|
||||
(lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())||
|
||||
(lastVP.IsPicking () != fVP.IsPicking ()) ||
|
||||
(lastVP.IsSpecialMeshRendering() != fVP.IsSpecialMeshRendering()))
|
||||
(lastVP.IsSpecialMeshRendering() != fVP.IsSpecialMeshRendering()) ||
|
||||
(lastVP.GetSpecialMeshRenderingOption() != fVP.GetSpecialMeshRenderingOption()))
|
||||
return true;
|
||||
|
||||
// Don't check VisAttributesModifiers if this comparison has been
|
||||
@@ -170,6 +171,7 @@ G4bool G4OpenGLStoredQtViewer::CompareForKernelVisit(G4ViewParameters& lastVP)
|
||||
/**************************************************************
|
||||
If cutaways are implemented locally, comment this out.
|
||||
if (lastVP.IsCutaway ()) {
|
||||
if (vp.GetCutawayMode() != fVP.GetCutawayMode()) return true;
|
||||
if (lastVP.GetCutawayPlanes ().size () !=
|
||||
fVP.GetCutawayPlanes ().size ()) return true;
|
||||
for (size_t i = 0; i < lastVP.GetCutawayPlanes().size(); ++i)
|
||||
@@ -196,7 +198,7 @@ G4bool G4OpenGLStoredQtViewer::CompareForKernelVisit(G4ViewParameters& lastVP)
|
||||
|
||||
G4bool G4OpenGLStoredQtViewer::POSelected(size_t POListIndex)
|
||||
{
|
||||
return isTouchableVisible(POListIndex);
|
||||
return isTouchableVisible((int)POListIndex);
|
||||
}
|
||||
|
||||
G4bool G4OpenGLStoredQtViewer::TOSelected(size_t)
|
||||
@@ -451,5 +453,5 @@ void G4OpenGLStoredQtViewer::ShowView (
|
||||
void G4OpenGLStoredQtViewer::DisplayTimePOColourModification (
|
||||
G4Colour& c,
|
||||
size_t poIndex) {
|
||||
c = getColorForPoIndex(poIndex);
|
||||
c = getColorForPoIndex((int)poIndex);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,9 @@ G4bool G4OpenGLStoredViewer::CompareForKernelVisit(G4ViewParameters& lastVP) {
|
||||
(lastVP.GetVisAttributesModifiers() !=
|
||||
fVP.GetVisAttributesModifiers()) ||
|
||||
(lastVP.IsSpecialMeshRendering() !=
|
||||
fVP.IsSpecialMeshRendering())
|
||||
fVP.IsSpecialMeshRendering()) ||
|
||||
(lastVP.GetSpecialMeshRenderingOption() !=
|
||||
fVP.GetSpecialMeshRenderingOption())
|
||||
)
|
||||
return true;
|
||||
|
||||
@@ -117,6 +119,7 @@ G4bool G4OpenGLStoredViewer::CompareForKernelVisit(G4ViewParameters& lastVP) {
|
||||
/**************************************************************
|
||||
If cutaways are implemented locally, comment this out.
|
||||
if (lastVP.IsCutaway ()) {
|
||||
if (vp.GetCutawayMode() != fVP.GetCutawayMode()) return true;
|
||||
if (lastVP.GetCutawayPlanes ().size () !=
|
||||
fVP.GetCutawayPlanes ().size ()) return true;
|
||||
for (size_t i = 0; i < lastVP.GetCutawayPlanes().size(); ++i)
|
||||
|
||||
@@ -31,13 +31,14 @@
|
||||
// from G4Transform3D.
|
||||
|
||||
#include "G4OpenGLTransform3D.hh"
|
||||
#include "G4Types.hh"
|
||||
|
||||
G4OpenGLTransform3D::G4OpenGLTransform3D (const G4Transform3D &t)
|
||||
{
|
||||
GLdouble *p = m;
|
||||
for (size_t i=0; i<4; i++)
|
||||
for (G4int i=0; i<4; ++i)
|
||||
{
|
||||
for (size_t k=0; k<3; k++)
|
||||
for (G4int k=0; k<3; ++k)
|
||||
{
|
||||
*p++ = t(k,i);
|
||||
}
|
||||
|
||||
@@ -409,8 +409,7 @@ void G4OpenGLViewer::SetView () {
|
||||
const G4Planes& cutaways = fVP.GetCutawayPlanes();
|
||||
size_t nPlanes = cutaways.size();
|
||||
if (fVP.IsCutaway() &&
|
||||
fVP.GetCutawayMode() == G4ViewParameters::cutawayIntersection &&
|
||||
nPlanes > 0) {
|
||||
fVP.GetCutawayMode() == G4ViewParameters::cutawayIntersection) {
|
||||
double a[4];
|
||||
a[0] = cutaways[0].a();
|
||||
a[1] = cutaways[0].b();
|
||||
@@ -1229,7 +1228,7 @@ void G4OpenGLViewer::rotateSceneThetaPhi(G4double dx, G4double dy)
|
||||
new_vp = std::cos(delta_alpha) * vp + std::sin(delta_alpha) * zprime;
|
||||
|
||||
// to avoid z rotation flipping
|
||||
// to allow more than 360∞ rotation
|
||||
// to allow more than 360° rotation
|
||||
|
||||
if (fVP.GetLightsMoveWithCamera()) {
|
||||
new_up = (new_vp.cross(yprime)).unit();
|
||||
|
||||
@@ -452,7 +452,7 @@ void G4OpenGLXViewer::DrawText(const G4Text& g4text)
|
||||
|
||||
// Write characters
|
||||
glListBase(fontInfo.fFontBase);
|
||||
glCallLists(strlen(textCString),GL_UNSIGNED_BYTE,(GLubyte*)textCString);
|
||||
glCallLists((G4int)strlen(textCString),GL_UNSIGNED_BYTE,(GLubyte*)textCString);
|
||||
glPopAttrib();
|
||||
}
|
||||
}
|
||||
@@ -550,4 +550,4 @@ G4OpenGLXViewer::~G4OpenGLXViewer () {
|
||||
XFlush (dpy);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
// Collection of routines to facilitate
|
||||
// the addition of simple push button boxes,
|
||||
// and slider bars to the control panel.
|
||||
//
|
||||
// See G4OpenGLXmConvenienceRoutines.hh for more information.
|
||||
|
||||
#include "G4OpenGLXmViewer.hh"
|
||||
|
||||
@@ -46,6 +44,8 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
const G4String G4OpenGLXmViewer::e_str = "";
|
||||
|
||||
void G4OpenGLXmViewer::Add_four_arrow_buttons (G4OpenGLXmViewer* pView,
|
||||
XtCallbackRec** arrow_callbacks,
|
||||
Widget* parent_widget) {
|
||||
@@ -199,7 +199,7 @@ void G4OpenGLXmViewer::Add_radio_box (char* label_string,
|
||||
char** button_names,
|
||||
G4OpenGLXmViewer* pView)
|
||||
{
|
||||
XmString button_str = XmStringCreateLocalized((char*) ""); // ...to
|
||||
XmString button_str = XmStringCreateLocalized((char*) e_str.c_str());
|
||||
// initialise to something to avoid pedantic warning.
|
||||
Arg** args;
|
||||
args = new Arg* [num_buttons];
|
||||
@@ -320,7 +320,7 @@ void G4OpenGLXmViewer::Add_set_field (char* w_name,
|
||||
XmStringFree (local_text);
|
||||
|
||||
char initial[50];
|
||||
sprintf (initial, "%6.2f", *val);
|
||||
snprintf (initial, sizeof initial, "%6.2f", *val);
|
||||
|
||||
*wid = XtVaCreateManagedWidget (text_field_name,
|
||||
xmTextFieldWidgetClass,
|
||||
@@ -392,7 +392,7 @@ void G4OpenGLXmViewer::Add_slider_box (char* label_string,
|
||||
XtCallbackRec** slider_box_callbacks,
|
||||
Widget* parent_widget)
|
||||
{
|
||||
XmString slider_name_str = XmStringCreateLocalized((char*) ""); // ...to
|
||||
XmString slider_name_str = XmStringCreateLocalized((char*) e_str.c_str());
|
||||
// initialise to something to avoid pedantic warning.
|
||||
Arg** slider_args;
|
||||
slider_args = new Arg*[num_sliders];
|
||||
|
||||
@@ -46,7 +46,7 @@ G4OpenGLXmTextField::G4OpenGLXmTextField (const char* n,
|
||||
{
|
||||
name = n;
|
||||
initial = new char[50];
|
||||
sprintf (initial, "%6.2f", *val);
|
||||
snprintf (initial, 50, "%6.2f", *val);
|
||||
value = (void*)val;
|
||||
text=false;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ G4OpenGLXmTextField::G4OpenGLXmTextField (const char* n,
|
||||
{
|
||||
name = n;
|
||||
initial = new char[50];
|
||||
sprintf (initial, "%s", val);
|
||||
snprintf (initial, 50, "%s", val);
|
||||
value = (void*)val;
|
||||
text=true;
|
||||
// strcpy (initial, val);
|
||||
@@ -87,7 +87,7 @@ const char* G4OpenGLXmTextField::GetName ()
|
||||
|
||||
void G4OpenGLXmTextField::SetValue (G4double val)
|
||||
{
|
||||
sprintf (initial, "%6.2f", val);
|
||||
snprintf (initial, 50, "%6.2f", val);
|
||||
|
||||
XtVaSetValues (text_field,
|
||||
XmNvalue, (String)initial,
|
||||
@@ -97,7 +97,7 @@ void G4OpenGLXmTextField::SetValue (G4double val)
|
||||
|
||||
void G4OpenGLXmTextField::SetValue (const char* val)
|
||||
{
|
||||
sprintf (initial, "%s", val);
|
||||
snprintf (initial, 50, "%s", val);
|
||||
// strcpy (initial, val);
|
||||
|
||||
XtVaSetValues (text_field,
|
||||
|
||||
@@ -241,13 +241,13 @@ void G4OpenGLXmViewer::CreateMainWindow () {
|
||||
NULL);
|
||||
|
||||
//*********Create a menu bar for the window********
|
||||
style_str = XmStringCreateLocalized ((char*)"Style");
|
||||
actions_str = XmStringCreateLocalized ((char*)"Actions");
|
||||
misc_str = XmStringCreateLocalized ((char*)"Miscellany");
|
||||
spec_str = XmStringCreateLocalized ((char*)"Special");
|
||||
style_str = XmStringCreateLocalized ((char*)menu_str[0].c_str());
|
||||
actions_str = XmStringCreateLocalized ((char*)menu_str[2].c_str());
|
||||
misc_str = XmStringCreateLocalized ((char*)menu_str[4].c_str());
|
||||
spec_str = XmStringCreateLocalized ((char*)menu_str[6].c_str());
|
||||
|
||||
menubar = XmVaCreateSimpleMenuBar (main_win,
|
||||
(char*)"menubar",
|
||||
(char*)menu_str[8].c_str(),
|
||||
XmVaCASCADEBUTTON, style_str, (KeySym)XK_S, /*G.Barrand : cast to KeySym and use XK_*/
|
||||
XmVaCASCADEBUTTON, actions_str, (KeySym)XK_A,
|
||||
XmVaCASCADEBUTTON, misc_str, (KeySym)XK_M,
|
||||
@@ -268,12 +268,12 @@ void G4OpenGLXmViewer::CreateMainWindow () {
|
||||
|
||||
|
||||
//*********Create style pulldown menu on menubar*********
|
||||
draw_str = XmStringCreateLocalized ((char*)"Drawing");
|
||||
bgnd_str = XmStringCreateLocalized ((char*)"Background color");
|
||||
draw_str = XmStringCreateLocalized ((char*)menu_str[9].c_str());
|
||||
bgnd_str = XmStringCreateLocalized ((char*)menu_str[10].c_str());
|
||||
|
||||
style_cascade = XmVaCreateSimplePulldownMenu
|
||||
(menubar,
|
||||
(char*)"style",
|
||||
(char*)menu_str[1].c_str(),
|
||||
0,
|
||||
NULL,
|
||||
XmVaCASCADEBUTTON, draw_str, (KeySym)XK_D,
|
||||
@@ -291,14 +291,14 @@ void G4OpenGLXmViewer::CreateMainWindow () {
|
||||
// G4cout << "Created Style pulldown menu" << G4endl;
|
||||
|
||||
//Add Drawing pullright menu to style cascade...
|
||||
wireframe_str = XmStringCreateLocalized ((char*)"Wireframe");
|
||||
hlr_str = XmStringCreateLocalized ((char*)"Hidden line removal");
|
||||
hsr_str = XmStringCreateLocalized ((char*)"Hidden surface removal");
|
||||
hlhsr_str = XmStringCreateLocalized ((char*)"Hidden line and surface removal");
|
||||
wireframe_str = XmStringCreateLocalized ((char*)menu_str[11].c_str());
|
||||
hlr_str = XmStringCreateLocalized ((char*)menu_str[12].c_str());
|
||||
hsr_str = XmStringCreateLocalized ((char*)menu_str[13].c_str());
|
||||
hlhsr_str = XmStringCreateLocalized ((char*)menu_str[14].c_str());
|
||||
|
||||
drawing_style_pullright = XmVaCreateSimplePulldownMenu
|
||||
(style_cascade,
|
||||
(char*)"drawing_style",
|
||||
(char*)menu_str[15].c_str(),
|
||||
1,
|
||||
drawing_style_callback,
|
||||
XmVaRADIOBUTTON, wireframe_str, (KeySym)XK_W, NULL, NULL,
|
||||
@@ -355,12 +355,12 @@ void G4OpenGLXmViewer::CreateMainWindow () {
|
||||
// G4cout << "Created Drawing pullright menu" << G4endl;
|
||||
|
||||
//Add Drawing pullright menu to style cascade...
|
||||
white_str = XmStringCreateLocalized ((char*)"White");
|
||||
black_str = XmStringCreateLocalized ((char*)"Black");
|
||||
white_str = XmStringCreateLocalized ((char*)menu_str[16].c_str());
|
||||
black_str = XmStringCreateLocalized ((char*)menu_str[17].c_str());
|
||||
|
||||
background_color_pullright = XmVaCreateSimplePulldownMenu
|
||||
(style_cascade,
|
||||
(char*)"background_color",
|
||||
(char*)menu_str[18].c_str(),
|
||||
2,
|
||||
background_color_callback,
|
||||
XmVaRADIOBUTTON, white_str, (KeySym)XK_W, NULL, NULL,
|
||||
@@ -395,13 +395,13 @@ void G4OpenGLXmViewer::CreateMainWindow () {
|
||||
// G4cout << "Created Background color pullright menu" << G4endl;
|
||||
|
||||
//*********Create actions pulldown menu on menubar*********
|
||||
rot_str = XmStringCreateLocalized ((char*)"Rotation control panel");
|
||||
pan_str = XmStringCreateLocalized ((char*)"Panning control panel");
|
||||
set_str = XmStringCreateLocalized ((char*)"Set control panel limits");
|
||||
rot_str = XmStringCreateLocalized ((char*)menu_str[19].c_str());
|
||||
pan_str = XmStringCreateLocalized ((char*)menu_str[20].c_str());
|
||||
set_str = XmStringCreateLocalized ((char*)menu_str[21].c_str());
|
||||
|
||||
actions_cascade = XmVaCreateSimplePulldownMenu
|
||||
(menubar,
|
||||
(char*)"actions",
|
||||
(char*)menu_str[3].c_str(),
|
||||
1,
|
||||
actions_callback,
|
||||
XmVaPUSHBUTTON, rot_str, (KeySym)XK_R, NULL, NULL,
|
||||
@@ -420,14 +420,14 @@ void G4OpenGLXmViewer::CreateMainWindow () {
|
||||
XmStringFree (set_str);
|
||||
G4cout << "Created Actions pulldown menu" << G4endl;
|
||||
|
||||
misc_str = XmStringCreateLocalized ((char*)"Miscellany control panel");
|
||||
exit_str = XmStringCreateLocalized ((char*)"Exit to G4Vis>");
|
||||
print_str = XmStringCreateLocalized ((char*)"Create .eps file");
|
||||
misc_str = XmStringCreateLocalized ((char*)menu_str[22].c_str());
|
||||
exit_str = XmStringCreateLocalized ((char*)menu_str[23].c_str());
|
||||
print_str = XmStringCreateLocalized ((char*)menu_str[24].c_str());
|
||||
|
||||
//*********Create miscellany pulldown menu on menubar*********
|
||||
misc_cascade = XmVaCreateSimplePulldownMenu
|
||||
(menubar,
|
||||
(char*)"miscellany",
|
||||
(char*)menu_str[5].c_str(),
|
||||
2,
|
||||
misc_callback,
|
||||
XmVaPUSHBUTTON, misc_str, (KeySym)XK_M, NULL, NULL,
|
||||
@@ -446,15 +446,15 @@ void G4OpenGLXmViewer::CreateMainWindow () {
|
||||
XmStringFree (print_str);
|
||||
G4cout << "Created Miscellany pulldown menu" << G4endl;
|
||||
|
||||
trans_str = XmStringCreateLocalized ((char*)"Transparency");
|
||||
anti_str = XmStringCreateLocalized ((char*)"Antialiasing");
|
||||
halo_str = XmStringCreateLocalized ((char*)"Haloing");
|
||||
aux_edge_str = XmStringCreateLocalized ((char*)"Auxiliary edges");
|
||||
trans_str = XmStringCreateLocalized ((char*)menu_str[25].c_str());
|
||||
anti_str = XmStringCreateLocalized ((char*)menu_str[27].c_str());
|
||||
halo_str = XmStringCreateLocalized ((char*)menu_str[29].c_str());
|
||||
aux_edge_str = XmStringCreateLocalized ((char*)menu_str[31].c_str());
|
||||
|
||||
//*********Create special pulldown menu on menubar*********
|
||||
spec_cascade = XmVaCreateSimplePulldownMenu
|
||||
(menubar,
|
||||
(char*)"special",
|
||||
(char*)menu_str[7].c_str(),
|
||||
3,
|
||||
NULL,
|
||||
XmVaCASCADEBUTTON, trans_str, (KeySym)XK_T,
|
||||
@@ -476,12 +476,12 @@ void G4OpenGLXmViewer::CreateMainWindow () {
|
||||
// G4cout << "Created Special pulldown menu" << G4endl;
|
||||
|
||||
//Add Transparency pullright menu to special cascade...
|
||||
off_str = XmStringCreateLocalized ((char*)"Off");
|
||||
on_str = XmStringCreateLocalized ((char*)"On");
|
||||
off_str = XmStringCreateLocalized ((char*)menu_str[33].c_str());
|
||||
on_str = XmStringCreateLocalized ((char*)menu_str[34].c_str());
|
||||
|
||||
transparency_pullright = XmVaCreateSimplePulldownMenu
|
||||
(spec_cascade,
|
||||
(char*)"transparency",
|
||||
(char*)menu_str[26].c_str(),
|
||||
0,
|
||||
transparency_callback,
|
||||
XmVaRADIOBUTTON, off_str, (KeySym)XK_f, NULL, NULL,
|
||||
@@ -516,7 +516,7 @@ void G4OpenGLXmViewer::CreateMainWindow () {
|
||||
//Add antialias pullright menu to special cascade...
|
||||
antialias_pullright = XmVaCreateSimplePulldownMenu
|
||||
(spec_cascade,
|
||||
(char*)"antialias",
|
||||
(char*)menu_str[28].c_str(),
|
||||
1,
|
||||
antialias_callback,
|
||||
XmVaRADIOBUTTON, off_str, (KeySym)XK_f, NULL, NULL,
|
||||
@@ -551,7 +551,7 @@ void G4OpenGLXmViewer::CreateMainWindow () {
|
||||
//Add Haloing pullright menu to special cascade...
|
||||
haloing_pullright = XmVaCreateSimplePulldownMenu
|
||||
(spec_cascade,
|
||||
(char*)"haloing",
|
||||
(char*)menu_str[30].c_str(),
|
||||
2,
|
||||
haloing_callback,
|
||||
XmVaRADIOBUTTON, off_str, (KeySym)XK_f, NULL, NULL,
|
||||
@@ -586,7 +586,7 @@ void G4OpenGLXmViewer::CreateMainWindow () {
|
||||
//Add Aux_Edge pullright menu to special cascade...
|
||||
aux_edge_pullright = XmVaCreateSimplePulldownMenu
|
||||
(spec_cascade,
|
||||
(char*)"aux_edge",
|
||||
(char*)menu_str[32].c_str(),
|
||||
3,
|
||||
aux_edge_callback,
|
||||
XmVaRADIOBUTTON, off_str, (KeySym)XK_f, NULL, NULL,
|
||||
@@ -614,7 +614,7 @@ void G4OpenGLXmViewer::CreateMainWindow () {
|
||||
}
|
||||
|
||||
XtManageChild (menubar);
|
||||
frame = XtVaCreateManagedWidget ((char*)"frame",
|
||||
frame = XtVaCreateManagedWidget ((char*)menu_str[35].c_str(),
|
||||
xmFrameWidgetClass, main_win,
|
||||
XtNvisual, vi -> visual,
|
||||
XtNdepth, vi -> depth,
|
||||
@@ -623,7 +623,7 @@ void G4OpenGLXmViewer::CreateMainWindow () {
|
||||
XtNbackground, bgnd,
|
||||
NULL);
|
||||
|
||||
glxarea = XtVaCreateManagedWidget ((char*)"glxarea",
|
||||
glxarea = XtVaCreateManagedWidget ((char*)menu_str[36].c_str(),
|
||||
xmDrawingAreaWidgetClass,
|
||||
frame,
|
||||
XtNvisual, vi -> visual,
|
||||
|
||||
@@ -1,11 +1,60 @@
|
||||
# Category openinventor History
|
||||
|
||||
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!
|
||||
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!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2022-11-25 Gabriele Cosmo (openinventor-V11-00-18)
|
||||
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
|
||||
|
||||
## 2022-11-06 John Allison (openinventor-V11-00-17)
|
||||
- Eliminate G4cerr and introduce G4warn.
|
||||
- `#define G4warn G4cout`
|
||||
- The above is temporary until a genuine G4warn output stream is
|
||||
implemented.
|
||||
- Change G4cerr to G4warn in all cases.
|
||||
- In all except the Xt files, which, I understand are scheduled for
|
||||
removal, change G4cout to G4warn in those cases where it is clearly
|
||||
an error report or a warning.
|
||||
|
||||
## 2022-10-28 John Allison (openinventor-V11-00-16)
|
||||
- Request kernel visit when cutaway mode changes:
|
||||
- G4OpenInventorViewer.cc
|
||||
|
||||
## 2022-10-24 Frederick Jones (openinventor-V11-00-15)
|
||||
- G4OpenInventorQtExaminerViewer.cc: For MacOS only, disabled the mouse
|
||||
wheel event handler to fix the trackpad zoom direction issue.
|
||||
- G4OpenInventorXtExtendedViewer.cc: replaced sprintf by snprintf.
|
||||
|
||||
## 2022-10-18 Gabriele Cosmo (openinventor-V11-00-14)
|
||||
- Fixed compilation warning on gcc-12.
|
||||
|
||||
## 2022-10-14 Gabriele Cosmo (openinventor-V11-00-13)
|
||||
- Replaced use of sprintf() and vsprintf() with snprintf() and vsnprintf()
|
||||
respectively, to fix deprecation compilation warnings on macOS-13 SDK.
|
||||
|
||||
## 2022-10-07 Gabriele Cosmo (openinventor-V11-00-12)
|
||||
- Fixed compilation warnings on Intel/icc compiler for deprecated conversion
|
||||
of string literal to char* in G4OpenInventorQtExaminerViewer.
|
||||
|
||||
## 2022-09-14 John Allison (openinventor-V11-00-11)
|
||||
- G4OpenInventorViewer.cc:
|
||||
- Add check on special mesh rendering option in CompareForKernelVisit.
|
||||
|
||||
## 2022-09-03 John Allison (openinventor-V11-00-10)
|
||||
- Implement special mesh rendering:
|
||||
- Use base class `StandardSpecialMeshRendering`.
|
||||
|
||||
## 2022-08-31 Gabriele Cosmo (openinventor-V11-00-09)
|
||||
- Fixed reported Coverity defects for potentially uninitialised variables.
|
||||
|
||||
## 2022-07-05 Gabriele Cosmo (openinventor-V11-00-08)
|
||||
- Fixed compilation error for missing inclusion of G4Types.hh
|
||||
in G4OpenInventorTransform3D.hh, induced by recent changes in "global"
|
||||
category.
|
||||
|
||||
## 2022-05-03 Ben Morgan (openinventor-V11-00-07)
|
||||
- Preliminary build support for Qt5 and Qt6
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#include "G4Types.hh"
|
||||
#include "G4String.hh"
|
||||
|
||||
//#include "G4OpenInventorViewer.hh"
|
||||
|
||||
@@ -182,6 +182,7 @@ private:
|
||||
int uiQtTabIndex;
|
||||
|
||||
int processSoEventCount;
|
||||
G4String empty = "";
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -63,6 +63,9 @@ public:
|
||||
void AddPrimitive (const G4Polyhedron& p);
|
||||
void AddPrimitive (const G4Polymarker&);
|
||||
|
||||
using G4VSceneHandler::AddCompound;
|
||||
void AddCompound (const G4Mesh&);
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Other inherited functions.
|
||||
void ClearStore ();
|
||||
|
||||
@@ -33,16 +33,21 @@
|
||||
#ifndef G4OPENINVENTORTRANSFORM3D_HH
|
||||
#define G4OPENINVENTORTRANSFORM3D_HH
|
||||
|
||||
#include "G4Types.hh"
|
||||
#include "G4Transform3D.hh"
|
||||
|
||||
class SbMatrix;
|
||||
|
||||
class G4OpenInventorTransform3D : public G4Transform3D {
|
||||
public:
|
||||
G4OpenInventorTransform3D (const G4Transform3D &t);
|
||||
SbMatrix* GetSbMatrix () const;
|
||||
private:
|
||||
G4float m[16];
|
||||
class G4OpenInventorTransform3D : public G4Transform3D
|
||||
{
|
||||
public:
|
||||
|
||||
G4OpenInventorTransform3D (const G4Transform3D &t);
|
||||
SbMatrix* GetSbMatrix () const;
|
||||
|
||||
private:
|
||||
|
||||
G4float m[16];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#include "moc_G4OpenInventorQt.cpp"
|
||||
#endif
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
G4OpenInventorQt::G4OpenInventorQt()
|
||||
: G4OpenInventor("OpenInventorQt", "OIQt", G4VGraphicsSystem::threeD),
|
||||
fInited(false)
|
||||
@@ -78,7 +80,7 @@ G4VViewer* G4OpenInventorQt::CreateViewer(G4VSceneHandler& scene,
|
||||
|
||||
if (pView) {
|
||||
if (pView->GetViewId() < 0) {
|
||||
G4cerr <<
|
||||
G4warn <<
|
||||
"G4OpenInventorQt::CreateViewer: ERROR flagged by negative"
|
||||
" view id in G4OpenInventorQtViewer creation."
|
||||
"\n Destroying view and returning null pointer."
|
||||
@@ -88,7 +90,7 @@ G4VViewer* G4OpenInventorQt::CreateViewer(G4VSceneHandler& scene,
|
||||
}
|
||||
}
|
||||
if (!pView) {
|
||||
G4cerr <<
|
||||
G4warn <<
|
||||
"G4OpenInventorQt::CreateViewer: ERROR: null pointer on new G4OpenInventorQtViewer."
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
@@ -102,6 +102,8 @@
|
||||
#include "moc_G4OpenInventorQtExaminerViewer.cpp"
|
||||
#endif
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
G4OpenInventorQtExaminerViewer* G4OpenInventorQtExaminerViewer::viewer = 0;
|
||||
|
||||
#define MIN_SPEED 2.1 // Lower number means faster
|
||||
@@ -896,8 +898,7 @@ void G4OpenInventorQtExaminerViewer::superimpositionEvent(SoAction * action)
|
||||
curInfoFont->name.setValue("defaultFont:Bold");
|
||||
char zPos[20];
|
||||
// FWJ need a better format here
|
||||
sprintf(zPos, "%-7.2f [m]", refZPositions[refParticleIdx] / 1000);
|
||||
// sprintf(zPos, "%7.2f [m]", refZPositions[refParticleIdx] / 1000);
|
||||
snprintf(zPos, sizeof zPos, "%-7.2f [m]", refZPositions[refParticleIdx] / 1000);
|
||||
curInfoText->string.setValue(SbString(zPos));
|
||||
}
|
||||
}
|
||||
@@ -922,7 +923,7 @@ bool G4OpenInventorQtExaminerViewer::loadViewPts()
|
||||
// Converts data from string type into necessary types
|
||||
while (getline(fileIn, token)) {
|
||||
|
||||
int end = token.find_last_not_of(' '); // Remove padded spaces
|
||||
std::size_t end = token.find_last_not_of(' '); // Remove padded spaces
|
||||
token = token.substr(0, end + 1);
|
||||
|
||||
char *vpName = new char[token.size() + 1];
|
||||
@@ -1043,7 +1044,7 @@ void G4OpenInventorQtExaminerViewer::moveCamera(float dist, bool lookdown)
|
||||
if (refParticleIdx < 0) {
|
||||
prevPt = refParticleTrajectory[refParticleIdx + step];
|
||||
dist = (prevPt - cam->position.getValue()).length();
|
||||
refParticleIdx = refParticleTrajectory.size() - 2;
|
||||
refParticleIdx = (int) refParticleTrajectory.size() - 2;
|
||||
}
|
||||
|
||||
// Set start and end points
|
||||
@@ -1178,9 +1179,9 @@ void G4OpenInventorQtExaminerViewer::pickingCB(void *aThis,
|
||||
}
|
||||
|
||||
if(coords == NULL) {
|
||||
G4cout << "Could not find the coordinates node"
|
||||
G4warn << "Could not find the coordinates node"
|
||||
" for the picked trajectory." << G4endl;
|
||||
G4cout << " Reference trajectory not set" << G4endl;
|
||||
G4warn << " Reference trajectory not set" << G4endl;
|
||||
return;
|
||||
}
|
||||
// FWJ DEBUG
|
||||
@@ -1202,7 +1203,7 @@ void G4OpenInventorQtExaminerViewer::pickingCB(void *aThis,
|
||||
|
||||
std::string strTrajPoint = "G4TrajectoryPoint:";
|
||||
std::ostringstream oss;
|
||||
for (size_t i = 0; i < attHolder->GetAttDefs().size(); ++i) {
|
||||
for (std::size_t i = 0; i < attHolder->GetAttDefs().size(); ++i) {
|
||||
G4cout << G4AttCheck(attHolder->GetAttValues()[i],
|
||||
attHolder->GetAttDefs()[i]);
|
||||
oss << G4AttCheck(attHolder->GetAttValues()[i],
|
||||
@@ -1223,11 +1224,11 @@ void G4OpenInventorQtExaminerViewer::pickingCB(void *aThis,
|
||||
} else {
|
||||
G4String name((char*)node->getName().getString());
|
||||
G4String cls((char*)node->getTypeId().getName().getString());
|
||||
G4cout << "SoNode : " << node
|
||||
G4warn << "SoNode : " << node
|
||||
<< " SoType : " << cls
|
||||
<< " name : " << name
|
||||
<< G4endl;
|
||||
G4cout << "No attributes attached." << G4endl;
|
||||
G4warn << "No attributes attached." << G4endl;
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -1243,18 +1244,18 @@ void G4OpenInventorQtExaminerViewer::pickingCB(void *aThis,
|
||||
// Default behavior in G4OpenInventorViewer::SelectionCB
|
||||
G4AttHolder* attHolder = dynamic_cast<G4AttHolder*>(node);
|
||||
if(attHolder && attHolder->GetAttDefs().size()) {
|
||||
for (size_t i = 0; i < attHolder->GetAttDefs().size(); ++i) {
|
||||
for (std::size_t i = 0; i < attHolder->GetAttDefs().size(); ++i) {
|
||||
G4cout << G4AttCheck(attHolder->GetAttValues()[i],
|
||||
attHolder->GetAttDefs()[i]);
|
||||
}
|
||||
} else {
|
||||
G4String name((char*)node->getName().getString());
|
||||
G4String cls((char*)node->getTypeId().getName().getString());
|
||||
G4cout << "SoNode : " << node
|
||||
G4warn << "SoNode : " << node
|
||||
<< " SoType : " << cls
|
||||
<< " name : " << name
|
||||
<< G4endl;
|
||||
G4cout << "No attributes attached." << G4endl;
|
||||
G4warn << "No attributes attached." << G4endl;
|
||||
}
|
||||
|
||||
//Suppress other event handlers
|
||||
@@ -1303,7 +1304,7 @@ void G4OpenInventorQtExaminerViewer::mouseoverCB(void *aThis, SoEventCallback *e
|
||||
attHolder->GetAttDefs();
|
||||
std::vector<const std::vector<G4AttValue>*> vecVals =
|
||||
attHolder->GetAttValues();
|
||||
for (size_t i = 0; i < vecDefs.size(); ++i) {
|
||||
for (std::size_t i = 0; i < vecDefs.size(); ++i) {
|
||||
const std::vector<G4AttValue> * vals = vecVals[i];
|
||||
|
||||
std::vector<G4AttValue>::const_iterator iValue;
|
||||
@@ -1337,7 +1338,7 @@ void G4OpenInventorQtExaminerViewer::mouseoverCB(void *aThis, SoEventCallback *e
|
||||
std::string strTrajPoint = "G4TrajectoryPoint:";
|
||||
std::ostringstream oss;
|
||||
G4String t1, t1Ch, t2, t3, t4;
|
||||
for (size_t i = 0; i < attHolder->GetAttDefs().size(); ++i) {
|
||||
for (std::size_t i = 0; i < attHolder->GetAttDefs().size(); ++i) {
|
||||
// G4cout << "Getting index " << i << " from attHolder" << G4endl;
|
||||
// No, returns a vector!
|
||||
// G4AttValue* attValue = attHolder->GetAttValues()[i];
|
||||
@@ -1375,7 +1376,7 @@ void G4OpenInventorQtExaminerViewer::mouseoverCB(void *aThis, SoEventCallback *e
|
||||
if (valueName == "IKE") t3 = "KE " + value;
|
||||
if (valueName == "IMom") {
|
||||
// Remove units
|
||||
unsigned ipos = value.rfind(" ");
|
||||
std::size_t ipos = value.rfind(" ");
|
||||
G4String value1 = value;
|
||||
value1.erase(ipos);
|
||||
t3 += " P (" + value1 + ")";
|
||||
@@ -1476,7 +1477,7 @@ void G4OpenInventorQtExaminerViewer::incSpeed() {
|
||||
animateBtwPtsPeriod = 0.0;
|
||||
|
||||
if (currentState != PAUSED_ANIMATION) {
|
||||
int lastIdx = refParticleTrajectory.size() - 1;
|
||||
int lastIdx = (int) refParticleTrajectory.size() - 1;
|
||||
if (refParticleIdx < lastIdx && !animateSensor->isScheduled())
|
||||
animateRefParticle();
|
||||
}
|
||||
@@ -1604,14 +1605,14 @@ void G4OpenInventorQtExaminerViewer::findAndSetRefPath()
|
||||
SoFullPath *path = (SoFullPath *)pathList[i];
|
||||
|
||||
G4AttHolder* attHolder = dynamic_cast<G4AttHolder*>(path->getTail());
|
||||
for (size_t j = 0; j < attHolder->GetAttDefs().size(); ++j) {
|
||||
for (std::size_t j = 0; j < attHolder->GetAttDefs().size(); ++j) {
|
||||
std::ostringstream oss;
|
||||
oss << G4AttCheck(attHolder->GetAttValues()[j],
|
||||
attHolder->GetAttDefs()[j]);
|
||||
|
||||
std::string findStr = "Type of trajectory (Type): ";
|
||||
std::string compareValue = "REFERENCE";
|
||||
size_t idx = oss.str().find(findStr);
|
||||
std::size_t idx = oss.str().find(findStr);
|
||||
|
||||
if(idx != std::string::npos) {
|
||||
if(oss.str().substr(idx + findStr.size(),
|
||||
@@ -1847,7 +1848,7 @@ void G4OpenInventorQtExaminerViewer::distanceToTrajectory(const SbVec3f &q,
|
||||
//
|
||||
// --PLG
|
||||
|
||||
const size_t count = refParticleTrajectory.size();
|
||||
const std::size_t count = refParticleTrajectory.size();
|
||||
assert(count>0);
|
||||
|
||||
SbVec3f b = refParticleTrajectory[0];
|
||||
@@ -1855,7 +1856,7 @@ void G4OpenInventorQtExaminerViewer::distanceToTrajectory(const SbVec3f &q,
|
||||
float sqrDist = sqrlen(dbq);
|
||||
closestPoint = b;
|
||||
index = 0;
|
||||
for (size_t i = 1; i < count; ++i) {
|
||||
for (std::size_t i = 1; i < count; ++i) {
|
||||
const SbVec3f a = b;
|
||||
const SbVec3f daq = dbq;
|
||||
b = refParticleTrajectory[i];
|
||||
@@ -1894,7 +1895,7 @@ void G4OpenInventorQtExaminerViewer::distanceToTrajectory(const SbVec3f &q,
|
||||
if (current_dist < sqrDist) {
|
||||
sqrDist = current_dist;
|
||||
closestPoint = a + t*(b-a);
|
||||
index = i;
|
||||
index = (int) i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2030,8 +2031,8 @@ G4OpenInventorQtExaminerViewer::LookAtSceneElementCB(QListWidgetItem* item)
|
||||
|
||||
elementField = value;
|
||||
|
||||
int idx = elementField.find_last_of("[");
|
||||
if(idx == -1)
|
||||
std::size_t idx = elementField.find_last_of("[");
|
||||
if(idx == std::string::npos)
|
||||
idx = elementField.size(); //if "[" not found for whatever reason (list not sorted)
|
||||
else
|
||||
idx--; // To get rid of the space that is between the name and '['
|
||||
@@ -2040,7 +2041,8 @@ G4OpenInventorQtExaminerViewer::LookAtSceneElementCB(QListWidgetItem* item)
|
||||
SoFullPath *path;
|
||||
SoSearchAction search;
|
||||
SoNode *root = getSceneManager()->getSceneGraph();
|
||||
int counter, idxUnderscore = elementField.find_last_of("_");
|
||||
int counter;
|
||||
std::size_t idxUnderscore = elementField.find_last_of("_");
|
||||
|
||||
parseString<int>(counter,
|
||||
elementField.substr(idxUnderscore + 1, idx), error);
|
||||
@@ -2085,7 +2087,7 @@ G4OpenInventorQtExaminerViewer::LookAtSceneElementCB(QListWidgetItem* item)
|
||||
SbVec3f p;
|
||||
|
||||
float absLengthNow, absLengthMin;
|
||||
int maxIdx = refParticleTrajectory.size() - 2;
|
||||
int maxIdx = (int) refParticleTrajectory.size() - 2;
|
||||
int targetIdx = 0;
|
||||
SbVec3f dir;
|
||||
|
||||
@@ -2255,9 +2257,9 @@ void G4OpenInventorQtExaminerViewer::evenOutRefParticlePts()
|
||||
float totalDistBtwPts = 0;
|
||||
std::vector<SbVec3f> newRefParticleTrajectory;
|
||||
SbVec3f refPoint;
|
||||
int size = refParticleTrajectory.size() - 1;
|
||||
std::size_t size = refParticleTrajectory.size() - 1;
|
||||
int numOfPts = 0;
|
||||
for (int i = 0; i < size; i++) {
|
||||
for (std::size_t i = 0; i < size; ++i) {
|
||||
p1 = refParticleTrajectory[i];
|
||||
p2 = refParticleTrajectory[i + 1];
|
||||
if (p1 == p2)
|
||||
@@ -2273,7 +2275,7 @@ void G4OpenInventorQtExaminerViewer::evenOutRefParticlePts()
|
||||
// float maxDistAllowed = 1.25 * avgDistBtwPts; // Pts tend to be close not far
|
||||
|
||||
float x, y, z;
|
||||
int i = 0, j = 0;
|
||||
std::size_t i = 0, j = 0;
|
||||
while (i < size) {
|
||||
p1 = refParticleTrajectory[i];
|
||||
p2 = refParticleTrajectory[i + 1];
|
||||
@@ -2615,10 +2617,10 @@ void G4OpenInventorQtExaminerViewer::sceneChangeCB(void* userData, SoSensor*)
|
||||
|
||||
void G4OpenInventorQtExaminerViewer::addViewPoints()
|
||||
{
|
||||
int size = viewPtList.size();
|
||||
std::size_t size = viewPtList.size();
|
||||
if (!size) return;
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
for (std::size_t i = 0; i < size; ++i) {
|
||||
new QListWidgetItem(viewPtList[i].viewPtName,
|
||||
AuxWindowDialog->listWidget);
|
||||
}
|
||||
@@ -2752,7 +2754,7 @@ G4OpenInventorQtExaminerViewer::ToolsAnimateRefParticleCB()
|
||||
// G4cout << "Tools: Animate Ref Particle CALLBACK" << G4endl;
|
||||
if (!refParticleTrajectory.size()) {
|
||||
returnToAnim = true;
|
||||
G4cout << "No Reference Trajectory" << G4endl;
|
||||
G4warn << "No Reference Trajectory" << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3005,7 +3007,7 @@ void G4OpenInventorQtExaminerViewer::setViewPt()
|
||||
|
||||
SoCamera * camera = getCamera();
|
||||
if (camera == NULL) {
|
||||
G4cout << "setViewPt: Camera is null. Unable to set the viewpoint." <<
|
||||
G4warn << "setViewPt: Camera is null. Unable to set the viewpoint." <<
|
||||
G4endl;
|
||||
// String dialogName = (char *) "Missing Camera Node";
|
||||
// std::string msg = "Camera is null. Unable to set the viewpoint.";
|
||||
@@ -3014,7 +3016,7 @@ void G4OpenInventorQtExaminerViewer::setViewPt()
|
||||
}
|
||||
|
||||
if (!viewPtList.size()) {
|
||||
G4cout << "setViewPt: There are no viewpoints to load." << G4endl;
|
||||
G4warn << "setViewPt: There are no viewpoints to load." << G4endl;
|
||||
// String dialogName = (char *) "Missing Viewpoints";
|
||||
// std::string msg = "There are no viewpoints to load.";
|
||||
// warningMsgDialog(msg, dialogName, NULL);
|
||||
@@ -3095,7 +3097,7 @@ void G4OpenInventorQtExaminerViewer::PrevViewPtCB()
|
||||
|
||||
if (!viewPtList.size()) return;
|
||||
if (viewPtIdx == 0)
|
||||
viewPtIdx = viewPtList.size() - 1;
|
||||
viewPtIdx = (int) viewPtList.size() - 1;
|
||||
else
|
||||
viewPtIdx--;
|
||||
|
||||
@@ -3197,7 +3199,7 @@ void G4OpenInventorQtExaminerViewer::DeleteBookmarkCB()
|
||||
void G4OpenInventorQtExaminerViewer::deleteViewPt(char *vpName)
|
||||
{
|
||||
std::string line;
|
||||
int end;
|
||||
std::size_t end;
|
||||
fileIn.open(fileName.c_str());
|
||||
std::ofstream out("temporaryFile.txt");
|
||||
|
||||
@@ -3226,8 +3228,8 @@ void G4OpenInventorQtExaminerViewer::deleteViewPt(char *vpName)
|
||||
}
|
||||
}
|
||||
|
||||
int idx = 0; // Remove viewpoint from the vector
|
||||
int size = viewPtList.size();
|
||||
std::size_t idx = 0; // Remove viewpoint from the vector
|
||||
std::size_t size = viewPtList.size();
|
||||
while (idx < size) {
|
||||
if (!strcmp(viewPtList[idx].viewPtName, vpName)) {
|
||||
viewPtList.erase(viewPtList.begin() + idx);
|
||||
@@ -3266,7 +3268,7 @@ void G4OpenInventorQtExaminerViewer::deleteViewPt(char *vpName)
|
||||
fileOut.seekp(0, std::ios::end);
|
||||
|
||||
if (!viewPtList.size()) { // viewPtList is empty
|
||||
curViewPtName = (char *) "";
|
||||
curViewPtName = (char *) empty.c_str();
|
||||
scheduleRedraw();
|
||||
} else {
|
||||
if (viewPtIdx >= (int) viewPtList.size())
|
||||
@@ -3308,8 +3310,8 @@ void G4OpenInventorQtExaminerViewer::RenameBookmarkCB()
|
||||
char* newname = new char[nVPName];
|
||||
newname = strdup(qPrintable(newnamein));
|
||||
|
||||
int size = viewPtList.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
std::size_t size = viewPtList.size();
|
||||
for (std::size_t i = 0; i < size; ++i) {
|
||||
if (!strcmp(newname, viewPtList[i].viewPtName)) {
|
||||
QMessageBox msgbox;
|
||||
msgbox.setFont(*font);
|
||||
@@ -3332,8 +3334,8 @@ void G4OpenInventorQtExaminerViewer::RenameBookmarkCB()
|
||||
|
||||
void G4OpenInventorQtExaminerViewer::renameViewPt(char *vpName)
|
||||
{
|
||||
int idx = 0, end, pos;
|
||||
int size = viewPtList.size();
|
||||
std::size_t idx = 0, end, pos;
|
||||
std::size_t size = viewPtList.size();
|
||||
std::string line, newName;
|
||||
fileIn.open(fileName.c_str());
|
||||
|
||||
@@ -3416,7 +3418,7 @@ void G4OpenInventorQtExaminerViewer::sortViewPts(std::vector<std::string> sorted
|
||||
{
|
||||
SbVec3f axis;
|
||||
float x, y, z, angle;
|
||||
int sortIdx = 0, unsortIdx = 0;
|
||||
std::size_t sortIdx = 0, unsortIdx = 0;
|
||||
|
||||
if (fileOut.is_open())
|
||||
fileOut.close();
|
||||
@@ -3425,7 +3427,7 @@ void G4OpenInventorQtExaminerViewer::sortViewPts(std::vector<std::string> sorted
|
||||
|
||||
writeViewPtIdx();
|
||||
|
||||
int size = sortedViewPts.size();
|
||||
std::size_t size = sortedViewPts.size();
|
||||
while (sortIdx < size) {
|
||||
while (strcmp(sortedViewPts[sortIdx].c_str(),
|
||||
viewPtList[unsortIdx].viewPtName))
|
||||
@@ -3461,8 +3463,10 @@ void G4OpenInventorQtExaminerViewer::sortViewPts(std::vector<std::string> sorted
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Needed to implement mouse wheel zoom direction change.
|
||||
// Does not work with MacOS trackpad: use Coin3d default handler.
|
||||
// Emulating private method SoGuiFullViewerP::zoom()
|
||||
#ifndef __APPLE__
|
||||
void
|
||||
G4OpenInventorQtExaminerViewer::zoom(const float diffvalue)
|
||||
{
|
||||
@@ -3485,7 +3489,7 @@ G4OpenInventorQtExaminerViewer::zoom(const float diffvalue)
|
||||
oc->height = oc->height.getValue() * multiplicator;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Handling mouse and keyboard events
|
||||
|
||||
@@ -3499,6 +3503,9 @@ G4OpenInventorQtExaminerViewer::processSoEvent(const SoEvent* const ev)
|
||||
SoCamera *cam = getCamera();
|
||||
const SoType type(ev->getTypeId());
|
||||
|
||||
// Needed to implement mouse wheel zoom direction change.
|
||||
// Does not work with MacOS trackpad: use Coin3d default handler.
|
||||
#ifndef __APPLE__
|
||||
if (type.isDerivedFrom(SoMouseButtonEvent::getClassTypeId())) {
|
||||
SoMouseButtonEvent * me = (SoMouseButtonEvent *) ev;
|
||||
|
||||
@@ -3522,15 +3529,16 @@ G4OpenInventorQtExaminerViewer::processSoEvent(const SoEvent* const ev)
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
// }
|
||||
if (currentState == GENERAL) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (type.isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
|
||||
SoKeyboardEvent* ke = (SoKeyboardEvent*)ev;
|
||||
|
||||
@@ -63,7 +63,9 @@
|
||||
#include "HEPVis/nodes/SoTrap.h"
|
||||
#endif
|
||||
#include "HEPVis/nodes/SoMarkerSet.h"
|
||||
typedef HEPVis_SoMarkerSet SoMarkerSet;
|
||||
|
||||
using SoMarkerSet = HEPVis_SoMarkerSet;
|
||||
|
||||
#include "HEPVis/nodekits/SoDetectorTreeKit.h"
|
||||
#include "HEPVis/misc/SoStyleCache.h"
|
||||
|
||||
@@ -95,6 +97,8 @@ typedef HEPVis_SoMarkerSet SoMarkerSet;
|
||||
#include "G4Material.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
G4int G4OpenInventorSceneHandler::fSceneIdCount = 0;
|
||||
|
||||
G4OpenInventorSceneHandler::G4OpenInventorSceneHandler (G4OpenInventor& system,
|
||||
@@ -198,13 +202,13 @@ void G4OpenInventorSceneHandler::AddPrimitive (const G4Polyline& line)
|
||||
AddProperties(pVA); // Colour, etc.
|
||||
AddTransform(); // Transformation
|
||||
|
||||
G4int nPoints = line.size();
|
||||
G4int nPoints = (G4int)line.size();
|
||||
SbVec3f* pCoords = new SbVec3f[nPoints];
|
||||
|
||||
for (G4int iPoint = 0; iPoint < nPoints ; iPoint++) {
|
||||
pCoords[iPoint].setValue((float)line[iPoint].x(),
|
||||
(float)line[iPoint].y(),
|
||||
(float)line[iPoint].z());
|
||||
for (G4int iPoint = 0; iPoint < nPoints ; ++iPoint) {
|
||||
pCoords[iPoint].setValue((G4float)line[iPoint].x(),
|
||||
(G4float)line[iPoint].y(),
|
||||
(G4float)line[iPoint].z());
|
||||
}
|
||||
|
||||
//
|
||||
@@ -226,7 +230,7 @@ void G4OpenInventorSceneHandler::AddPrimitive (const G4Polyline& line)
|
||||
if (fpViewer->GetViewParameters().IsPicking()) LoadAtts(line, pLine);
|
||||
|
||||
#ifdef INVENTOR2_0
|
||||
pLine->numVertices.setValues(0,1,(const long *)&nPoints);
|
||||
pLine->numVertices.setValues(0,1,(const G4long *)&nPoints);
|
||||
#else
|
||||
pLine->numVertices.setValues(0,1,&nPoints);
|
||||
#endif
|
||||
@@ -257,14 +261,14 @@ void G4OpenInventorSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
|
||||
AddProperties(pVA); // Colour, etc.
|
||||
AddTransform(); // Transformation
|
||||
|
||||
G4int pointn = polymarker.size();
|
||||
G4int pointn = (G4int)polymarker.size();
|
||||
if(pointn<=0) return;
|
||||
|
||||
SbVec3f* points = new SbVec3f[pointn];
|
||||
for (G4int iPoint = 0; iPoint < pointn ; iPoint++) {
|
||||
points[iPoint].setValue((float)polymarker[iPoint].x(),
|
||||
(float)polymarker[iPoint].y(),
|
||||
(float)polymarker[iPoint].z());
|
||||
for (G4int iPoint = 0; iPoint < pointn ; ++iPoint) {
|
||||
points[iPoint].setValue((G4float)polymarker[iPoint].x(),
|
||||
(G4float)polymarker[iPoint].y(),
|
||||
(G4float)polymarker[iPoint].z());
|
||||
}
|
||||
|
||||
SoCoordinate3* coordinate3 = new SoCoordinate3;
|
||||
@@ -376,10 +380,10 @@ void G4OpenInventorSceneHandler::AddPrimitive (const G4Text& text)
|
||||
//
|
||||
const G4Colour& c = GetTextColour (text);
|
||||
SoMaterial* material =
|
||||
fStyleCache->getMaterial((float)c.GetRed(),
|
||||
(float)c.GetGreen(),
|
||||
(float)c.GetBlue(),
|
||||
(float)(1-c.GetAlpha()));
|
||||
fStyleCache->getMaterial((G4float)c.GetRed(),
|
||||
(G4float)c.GetGreen(),
|
||||
(G4float)c.GetBlue(),
|
||||
(G4float)(1-c.GetAlpha()));
|
||||
fCurrentSeparator->addChild(material);
|
||||
|
||||
MarkerSizeType sizeType;
|
||||
@@ -473,9 +477,9 @@ void G4OpenInventorSceneHandler::AddCircleSquare
|
||||
|
||||
// Borrowed from AddPrimitive(G4Polymarker) - inefficient? JA
|
||||
SbVec3f* points = new SbVec3f[1];
|
||||
points[0].setValue((float)centre.x(),
|
||||
(float)centre.y(),
|
||||
(float)centre.z());
|
||||
points[0].setValue((G4float)centre.x(),
|
||||
(G4float)centre.y(),
|
||||
(G4float)centre.z());
|
||||
SoCoordinate3* coordinate3 = new SoCoordinate3;
|
||||
coordinate3->point.setValues(0,1,points);
|
||||
fCurrentSeparator->addChild(coordinate3);
|
||||
@@ -581,6 +585,10 @@ void G4OpenInventorSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron)
|
||||
fCurrentSeparator->addChild(soPolyhedron);
|
||||
}
|
||||
|
||||
void G4OpenInventorSceneHandler::AddCompound(const G4Mesh& mesh) {
|
||||
StandardSpecialMeshRendering(mesh);
|
||||
}
|
||||
|
||||
void G4OpenInventorSceneHandler::GeneratePrerequisites()
|
||||
{
|
||||
// Utility for PreAddSolid and BeginPrimitives.
|
||||
@@ -611,8 +619,8 @@ void G4OpenInventorSceneHandler::GeneratePrerequisites()
|
||||
// PVNodeID object, which is a physical volume and copy number. It
|
||||
// is a vector of PVNodeIDs corresponding to the geometry hierarchy
|
||||
// actually selected, i.e., not culled.
|
||||
typedef G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID;
|
||||
typedef std::vector<PVNodeID> PVPath;
|
||||
using PVNodeID = G4PhysicalVolumeModel::G4PhysicalVolumeNodeID;
|
||||
using PVPath = std::vector<PVNodeID>;
|
||||
const PVPath& drawnPVPath = pPVModel->GetDrawnPVPath();
|
||||
//G4int currentDepth = pPVModel->GetCurrentDepth();
|
||||
G4VPhysicalVolume* pCurrentPV = pPVModel->GetCurrentPV();
|
||||
@@ -664,10 +672,10 @@ void G4OpenInventorSceneHandler::GeneratePrerequisites()
|
||||
|
||||
// First find the color attributes...
|
||||
const G4Colour& g4Col = pApplicableVisAttribs->GetColour ();
|
||||
const double red = g4Col.GetRed ();
|
||||
const double green = g4Col.GetGreen ();
|
||||
const double blue = g4Col.GetBlue ();
|
||||
double transparency = 1 - g4Col.GetAlpha();
|
||||
const G4double red = g4Col.GetRed ();
|
||||
const G4double green = g4Col.GetGreen ();
|
||||
const G4double blue = g4Col.GetBlue ();
|
||||
G4double transparency = 1 - g4Col.GetAlpha();
|
||||
|
||||
// Drawing style...
|
||||
G4ViewParameters::DrawingStyle drawing_style =
|
||||
@@ -687,10 +695,10 @@ void G4OpenInventorSceneHandler::GeneratePrerequisites()
|
||||
}
|
||||
|
||||
SoMaterial* material =
|
||||
fStyleCache->getMaterial((float)red,
|
||||
(float)green,
|
||||
(float)blue,
|
||||
(float)transparency);
|
||||
fStyleCache->getMaterial((G4float)red,
|
||||
(G4float)green,
|
||||
(G4float)blue,
|
||||
(G4float)transparency);
|
||||
detectorTreeKit->setPart("appearance.material",material);
|
||||
|
||||
SoLightModel* lightModel =
|
||||
@@ -714,7 +722,7 @@ void G4OpenInventorSceneHandler::GeneratePrerequisites()
|
||||
// G4PhysicalVolumeModel sends volumes as it encounters them,
|
||||
// i.e., mothers before daughters, in its descent of the
|
||||
// geometry tree. Error!
|
||||
G4cout <<
|
||||
G4warn <<
|
||||
"ERROR: G4OpenInventorSceneHandler::GeneratePrerequisites: Mother "
|
||||
<< ri->GetPhysicalVolume()->GetName()
|
||||
<< ':' << ri->GetCopyNo()
|
||||
@@ -744,7 +752,7 @@ void G4OpenInventorSceneHandler::GeneratePrerequisites()
|
||||
// G4PhysicalVolumeModel sends volumes as it encounters them,
|
||||
// i.e., mothers before daughters, in its descent of the
|
||||
// geometry tree. Error!
|
||||
G4cout << "ERROR: G4OpenInventorSceneHandler::PreAddSolid: Mother "
|
||||
G4warn << "ERROR: G4OpenInventorSceneHandler::PreAddSolid: Mother "
|
||||
<< ri->GetPhysicalVolume()->GetName()
|
||||
<< ':' << ri->GetCopyNo()
|
||||
<< " not previously encountered."
|
||||
@@ -777,10 +785,10 @@ void G4OpenInventorSceneHandler::AddProperties(const G4VisAttributes* visAtts)
|
||||
|
||||
// First find the color attributes...
|
||||
const G4Colour& g4Col = pApplicableVisAttribs->GetColour ();
|
||||
const double red = g4Col.GetRed ();
|
||||
const double green = g4Col.GetGreen ();
|
||||
const double blue = g4Col.GetBlue ();
|
||||
double transparency = 1 - g4Col.GetAlpha();
|
||||
const G4double red = g4Col.GetRed ();
|
||||
const G4double green = g4Col.GetGreen ();
|
||||
const G4double blue = g4Col.GetBlue ();
|
||||
G4double transparency = 1 - g4Col.GetAlpha();
|
||||
|
||||
// Drawing style...
|
||||
G4ViewParameters::DrawingStyle drawing_style =
|
||||
@@ -804,10 +812,10 @@ void G4OpenInventorSceneHandler::AddProperties(const G4VisAttributes* visAtts)
|
||||
fReducedWireFrame = !isAuxEdgeVisible;
|
||||
|
||||
SoMaterial* material =
|
||||
fStyleCache->getMaterial((float)red,
|
||||
(float)green,
|
||||
(float)blue,
|
||||
(float)transparency);
|
||||
fStyleCache->getMaterial((G4float)red,
|
||||
(G4float)green,
|
||||
(G4float)blue,
|
||||
(G4float)transparency);
|
||||
fCurrentSeparator->addChild(material);
|
||||
|
||||
SoLightModel* lightModel =
|
||||
@@ -830,7 +838,7 @@ void G4OpenInventorSceneHandler::AddTransform(const G4Point3D& translation)
|
||||
const G4Vector3D scale = fpViewer->GetViewParameters().GetScaleFactor();
|
||||
SbMatrix sbScale;
|
||||
sbScale.setScale
|
||||
(SbVec3f((float)scale.x(),(float)scale.y(),(float)scale.z()));
|
||||
(SbVec3f((G4float)scale.x(),(G4float)scale.y(),(G4float)scale.z()));
|
||||
sbMatrix->multRight(sbScale);
|
||||
|
||||
matrixTransform->matrix.setValue(*sbMatrix);
|
||||
|
||||
@@ -192,7 +192,9 @@ G4bool G4OpenInventorViewer::CompareForKernelVisit(G4ViewParameters& vp) {
|
||||
(vp.GetVisAttributesModifiers() !=
|
||||
fVP.GetVisAttributesModifiers()) ||
|
||||
(vp.IsSpecialMeshRendering() !=
|
||||
fVP.IsSpecialMeshRendering())
|
||||
fVP.IsSpecialMeshRendering()) ||
|
||||
(vp.GetSpecialMeshRenderingOption() !=
|
||||
fVP.GetSpecialMeshRenderingOption())
|
||||
)
|
||||
return true;
|
||||
|
||||
@@ -210,6 +212,7 @@ G4bool G4OpenInventorViewer::CompareForKernelVisit(G4ViewParameters& vp) {
|
||||
return true;
|
||||
|
||||
if (vp.IsCutaway ()) {
|
||||
if (vp.GetCutawayMode() != fVP.GetCutawayMode()) return true;
|
||||
if (vp.GetCutawayPlanes ().size () !=
|
||||
fVP.GetCutawayPlanes ().size ()) return true;
|
||||
for (size_t i = 0; i < vp.GetCutawayPlanes().size(); ++i)
|
||||
|
||||
@@ -576,7 +576,7 @@ void G4OpenInventorXtExaminerViewer::superimpositionEvent(SoAction * action)
|
||||
this->curInfoFont->size.setValue(16);
|
||||
this->curInfoFont->name.setValue("defaultFont:Bold");
|
||||
char zPos[20];
|
||||
sprintf(zPos, "%7.2f [m]", refZPositions[refParticleIdx] / 1000);
|
||||
snprintf(zPos, sizeof zPos, "%7.2f [m]", refZPositions[refParticleIdx] / 1000);
|
||||
this->curInfoText->string.setValue(SbString(zPos));
|
||||
}
|
||||
}
|
||||
@@ -925,9 +925,9 @@ void G4OpenInventorXtExaminerViewer::moveCamera(float dist, bool lookdown)
|
||||
{
|
||||
|
||||
SoCamera *cam = getCamera();
|
||||
SbVec3f p1, p2; // The particle moves from p1 to p2
|
||||
SbVec3f particleDir; // Direction vector from p1 to p2
|
||||
SbVec3f camPosNew; // New position of the camera
|
||||
SbVec3f p1(0), p2(0); // The particle moves from p1 to p2
|
||||
SbVec3f particleDir; // Direction vector from p1 to p2
|
||||
SbVec3f camPosNew(0); // New position of the camera
|
||||
|
||||
if(refParticleTrajectory.size() == 0) {
|
||||
//refParticleTrajectory hasn't been set yet
|
||||
@@ -1006,7 +1006,7 @@ void G4OpenInventorXtExaminerViewer::moveCamera(float dist, bool lookdown)
|
||||
// }
|
||||
|
||||
|
||||
float x,y,z;
|
||||
float x(0.),y(0.),z(0.);
|
||||
prevPt.getValue(x,y,z);
|
||||
|
||||
|
||||
@@ -2769,7 +2769,7 @@ void G4OpenInventorXtExaminerViewer::lookAtSceneElementCB(Widget,
|
||||
SoFullPath *path;
|
||||
SoSearchAction search;
|
||||
SoNode *root = This->getSceneManager()->getSceneGraph();
|
||||
int counter, idxUnderscore = elementField.find_last_of("_");
|
||||
int counter(1), idxUnderscore = elementField.find_last_of("_");
|
||||
|
||||
This->parseString<int>(counter, elementField.substr(idxUnderscore + 1, idx), error);
|
||||
|
||||
@@ -3495,7 +3495,7 @@ bool G4OpenInventorXtExaminerViewer::loadViewPts()
|
||||
std::string token;
|
||||
SbVec3f axis;
|
||||
SbRotation orient;
|
||||
float x, y, z, angle;
|
||||
float x(0.), y(0.), z(0.), angle(0.);
|
||||
|
||||
// Gets the last view point accessed, stored in the first line of the data file.
|
||||
fileIn >> token;
|
||||
@@ -3531,7 +3531,7 @@ bool G4OpenInventorXtExaminerViewer::loadViewPts()
|
||||
orient.setValue(axis.setValue(x, y, z), angle);
|
||||
tmp.orientation = orient.getValue();
|
||||
|
||||
int camType;
|
||||
int camType(0);
|
||||
parseString<int>(camType, token, error);
|
||||
fileIn >> token;
|
||||
tmp.camType = (CameraType) camType;
|
||||
@@ -4683,8 +4683,8 @@ void G4OpenInventorXtExaminerViewer::setStartingPtForAnimation()
|
||||
stopAnimating();
|
||||
|
||||
SbRotation rot;
|
||||
SbVec3f p1, p2, p2_tmp, camUpV, camD, camD_tmp, leftRightAxis;
|
||||
float x1, y1, z1, x2, y2, z2;
|
||||
SbVec3f p1(0), p2(0), p2_tmp(0), camUpV(0), camD, camD_tmp, leftRightAxis;
|
||||
float x1(0.), y1(0.), z1(0.), x2(0.), y2(0.), z2(0.);
|
||||
|
||||
if (currentState == ANIMATION) {
|
||||
p1 = refParticleTrajectory[refParticleIdx];
|
||||
|
||||
@@ -103,7 +103,7 @@ void G4OpenInventorXtExtendedViewer::Initialise() {
|
||||
<< G4endl;
|
||||
width = 600;
|
||||
height = 600;
|
||||
sprintf(s,"%dx%d",width,height);
|
||||
snprintf(s,32,"%dx%d",width,height);
|
||||
sgeometry = s;
|
||||
} else {
|
||||
width = fVP.GetWindowSizeHintX();
|
||||
|
||||
@@ -96,7 +96,7 @@ void G4OpenInventorXtViewer::Initialise() {
|
||||
<< G4endl;
|
||||
width = 600;
|
||||
height = 600;
|
||||
sprintf(str,"%dx%d",width,height);
|
||||
snprintf(str,sizeof str,"%dx%d",width,height);
|
||||
sgeometry = str;
|
||||
} else {
|
||||
width = fVP.GetWindowSizeHintX();
|
||||
|
||||
@@ -45,6 +45,8 @@
|
||||
#include "moc_G4SoQt.cpp"
|
||||
#endif
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
G4SoQt* G4SoQt::instance = NULL;
|
||||
|
||||
static G4bool QtInited = FALSE;
|
||||
@@ -142,7 +144,7 @@ void G4SoQt::SecondaryLoop()
|
||||
// "ENTERING OIQT VIEWER SECONDARY LOOP" << G4endl;
|
||||
// else
|
||||
|
||||
G4cout <<
|
||||
G4warn <<
|
||||
"ENTERING OIQT VIEWER SECONDARY LOOP... PRESS E KEY TO EXIT" << G4endl;
|
||||
|
||||
SoQt::mainLoop();
|
||||
|
||||
@@ -465,7 +465,7 @@ void SbPainterPS::putInStreamF(
|
||||
va_start(args,aFormat);
|
||||
printV(aFormat,args);
|
||||
va_end(args);
|
||||
int length = ::strlen(fBufferString);
|
||||
int length = (int)strlen(fBufferString);
|
||||
if(length>METAFILE_RECORD_LENGTH) {
|
||||
::printf("SoPostScript::putInStreamF overflow\n");
|
||||
return;
|
||||
@@ -523,7 +523,7 @@ void SbPainterPS::printV(
|
||||
if(fBufferString==NULL) return;
|
||||
}
|
||||
fBufferString[MAX_STR-1] = '\0';
|
||||
::vsprintf(fBufferString,This,aArgs);
|
||||
::vsnprintf(fBufferString,MAX_STR-1, This,aArgs);
|
||||
if(fBufferString[MAX_STR-1]!='\0') {
|
||||
::printf("SbPainterPS::printV overflow\n");
|
||||
fBufferString[0] = '\0';
|
||||
|
||||
@@ -1,8 +1,33 @@
|
||||
# Category visQt3D History
|
||||
|
||||
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!
|
||||
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!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2022-11-25 Gabriele Cosmo (visQt3D-V11-00-12)
|
||||
- Fixed compilation warning for implicit type conversions on macOS/XCode 14.1.
|
||||
|
||||
## 2022-11-06 John Allison (visQt3D-V11-00-11)
|
||||
- Eliminate G4cerr and introduce G4warn.
|
||||
- `#define G4warn G4cout`
|
||||
- The above is temporary until a genuine G4warn output stream is
|
||||
implemented.
|
||||
- Change G4cerr to G4warn in all cases.
|
||||
- Change G4cout to G4warn in those cases where it is clearly
|
||||
an error report or a warning.
|
||||
|
||||
## 2022-10-28 John Allison (visQt3D-V11-00-10)
|
||||
- Request kernel visit when cutaway mode changes:
|
||||
- G4Qt3DViewer.cc
|
||||
|
||||
## 2022-09-14 John Allison (visQt3D-V11-00-09)
|
||||
- G4Qt3DViewer.cc:
|
||||
- Add check on special mesh rendering option in CompareForKernelVisit.
|
||||
|
||||
## 2022-09-03 Ben Morgan (visQt3D-V11-00-08)
|
||||
- Remove unused header from G4heprandom to resolve consistency test
|
||||
|
||||
## 2022-04-06 John Allison (visQt3D-V11-00-07)
|
||||
- Fix compiler warnings:
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UIbatch.hh"
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
G4Qt3D::G4Qt3D():
|
||||
G4VGraphicsSystem
|
||||
("Qt3D",
|
||||
@@ -53,7 +55,7 @@ G4VViewer* G4Qt3D::CreateViewer(G4VSceneHandler& scene,
|
||||
new G4Qt3DViewer((G4Qt3DSceneHandler&) scene, name);
|
||||
if (pView) {
|
||||
if (pView->GetViewId() < 0) {
|
||||
G4cerr <<
|
||||
G4warn <<
|
||||
"G4Qt3D::CreateViewer: ERROR flagged by negative"
|
||||
" view id in G4Qt3DViewer creation."
|
||||
"\n Destroying view and returning null pointer."
|
||||
@@ -63,7 +65,7 @@ G4VViewer* G4Qt3D::CreateViewer(G4VSceneHandler& scene,
|
||||
}
|
||||
}
|
||||
if (!pView) {
|
||||
G4cerr <<
|
||||
G4warn <<
|
||||
"G4Qt3D::CreateViewer: ERROR: null pointer on new G4Qt3DViewer."
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
#include "G4Mesh.hh"
|
||||
#include "G4PseudoScene.hh"
|
||||
#include "G4VisManager.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include "G4Qt3DViewer.hh"
|
||||
#include "G4Qt3DUtils.hh"
|
||||
@@ -56,6 +55,8 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
// Qt3D seems to offer a choice of type - float or double. It would be nice
|
||||
// to use double since it offers the prospect of higher precision, hopefully
|
||||
// avoiding some issues that we see at high zoom. But it currently gives the
|
||||
@@ -105,11 +106,11 @@ void G4Qt3DSceneHandler::EstablishG4Qt3DQEntities()
|
||||
// Physical volume objects for each world hang from POs
|
||||
G4TransportationManager* transportationManager
|
||||
= G4TransportationManager::GetTransportationManager ();
|
||||
size_t nWorlds = transportationManager->GetNoWorlds();
|
||||
std::size_t nWorlds = transportationManager->GetNoWorlds();
|
||||
std::vector<G4VPhysicalVolume*>::iterator iterWorld
|
||||
= transportationManager->GetWorldsIterator();
|
||||
fpPhysicalVolumeObjects.resize(nWorlds);
|
||||
for (size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
|
||||
for (std::size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
|
||||
G4VPhysicalVolume* wrld = (*iterWorld);
|
||||
auto entity = new G4Qt3DQEntity(fpPersistentObjects);
|
||||
entity->setObjectName("G4Qt3DPORoot_"+QString(wrld->GetName()));
|
||||
@@ -157,8 +158,8 @@ G4Qt3DQEntity* G4Qt3DSceneHandler::CreateNewNode()
|
||||
#endif
|
||||
|
||||
// Find appropriate root
|
||||
const size_t nWorlds = fpPhysicalVolumeObjects.size();
|
||||
size_t iWorld = 0;
|
||||
const std::size_t nWorlds = fpPhysicalVolumeObjects.size();
|
||||
std::size_t iWorld = 0;
|
||||
for (; iWorld < nWorlds; ++iWorld) {
|
||||
if (fullPVPath[0].GetPhysicalVolume() ==
|
||||
fpPhysicalVolumeObjects[iWorld]->GetPVNodeID().GetPhysicalVolume()) break;
|
||||
@@ -175,8 +176,8 @@ G4Qt3DQEntity* G4Qt3DSceneHandler::CreateNewNode()
|
||||
// Create nodes as required
|
||||
G4Qt3DQEntity* node = wrld;
|
||||
newNode = node;
|
||||
const size_t depth = fullPVPath.size();
|
||||
size_t iDepth = 1;
|
||||
const std::size_t depth = fullPVPath.size();
|
||||
std::size_t iDepth = 1;
|
||||
while (iDepth < depth) {
|
||||
const auto& children = node->children();
|
||||
const G4int nChildren = children.size(); // int size() (Qt covention?)
|
||||
@@ -287,13 +288,13 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyline& polyline)
|
||||
|
||||
const auto vertexByteSize = 3*sizeof(PRECISION);
|
||||
|
||||
const size_t nLines = polyline.size() - 1;
|
||||
const std::size_t nLines = polyline.size() - 1;
|
||||
QByteArray polylineByteArray;
|
||||
const auto polylineBufferByteSize = 2*nLines*vertexByteSize;
|
||||
polylineByteArray.resize(polylineBufferByteSize);
|
||||
polylineByteArray.resize((G4int)polylineBufferByteSize);
|
||||
auto polylineBufferArray = reinterpret_cast<PRECISION*>(polylineByteArray.data());
|
||||
G4int iLine = 0;
|
||||
for (size_t i = 0; i < nLines; ++i) {
|
||||
for (std::size_t i = 0; i < nLines; ++i) {
|
||||
polylineBufferArray[iLine++] = polyline[i].x();
|
||||
polylineBufferArray[iLine++] = polyline[i].y();
|
||||
polylineBufferArray[iLine++] = polyline[i].z();
|
||||
@@ -314,7 +315,7 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyline& polyline)
|
||||
polylineAtt->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
|
||||
polylineAtt->setVertexBaseType(BASETYPE);
|
||||
polylineAtt->setVertexSize(3);
|
||||
polylineAtt->setCount(nLines);
|
||||
polylineAtt->setCount((G4int)nLines);
|
||||
polylineAtt->setByteOffset(0);
|
||||
polylineAtt->setByteStride(vertexByteSize);
|
||||
|
||||
@@ -332,7 +333,7 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyline& polyline)
|
||||
auto renderer = new Qt3DRender::QGeometryRenderer;
|
||||
renderer->setObjectName("polylineWireframeRenderer");
|
||||
renderer->setGeometry(polylineGeometry);
|
||||
renderer->setVertexCount(2*nLines);
|
||||
renderer->setVertexCount(2*(G4int)nLines);
|
||||
renderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Lines);
|
||||
polylineEntity->addComponent(renderer);
|
||||
}
|
||||
@@ -362,7 +363,7 @@ void G4Qt3DSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
|
||||
default:
|
||||
case G4Polymarker::dots:
|
||||
{
|
||||
const size_t nDots = polymarker.size();
|
||||
const std::size_t nDots = polymarker.size();
|
||||
|
||||
auto transform = G4Qt3DUtils::CreateQTransformFrom(fObjectTransformation);
|
||||
transform->setObjectName("transform");
|
||||
@@ -374,10 +375,10 @@ void G4Qt3DSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
|
||||
|
||||
QByteArray polymarkerByteArray;
|
||||
const auto polymarkerBufferByteSize = nDots*vertexByteSize;
|
||||
polymarkerByteArray.resize(polymarkerBufferByteSize);
|
||||
polymarkerByteArray.resize((G4int)polymarkerBufferByteSize);
|
||||
auto polymarkerBufferArray = reinterpret_cast<PRECISION*>(polymarkerByteArray.data());
|
||||
G4int iMarker = 0;
|
||||
for (size_t i = 0; i < polymarker.size(); ++i) {
|
||||
for (std::size_t i = 0; i < polymarker.size(); ++i) {
|
||||
polymarkerBufferArray[iMarker++] = polymarker[i].x();
|
||||
polymarkerBufferArray[iMarker++] = polymarker[i].y();
|
||||
polymarkerBufferArray[iMarker++] = polymarker[i].z();
|
||||
@@ -395,7 +396,7 @@ void G4Qt3DSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
|
||||
polymarkerAtt->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
|
||||
polymarkerAtt->setVertexBaseType(BASETYPE);
|
||||
polymarkerAtt->setVertexSize(3);
|
||||
polymarkerAtt->setCount(nDots);
|
||||
polymarkerAtt->setCount((G4int)nDots);
|
||||
polymarkerAtt->setByteOffset(0);
|
||||
polymarkerAtt->setByteStride(vertexByteSize);
|
||||
|
||||
@@ -413,7 +414,7 @@ void G4Qt3DSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
|
||||
auto renderer = new Qt3DRender::QGeometryRenderer;
|
||||
renderer->setObjectName("polymarkerWireframeRenderer");
|
||||
renderer->setGeometry(polymarkerGeometry);
|
||||
renderer->setVertexCount(nDots);
|
||||
renderer->setVertexCount((G4int)nDots);
|
||||
renderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Points);
|
||||
polymarkerEntity->addComponent(renderer);
|
||||
}
|
||||
@@ -440,7 +441,7 @@ void G4Qt3DSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
|
||||
// sphereMesh->setInstanceCount(polymarker.size()); // Not undertood instancing yet
|
||||
|
||||
// auto currentEntity = new Qt3DCore::QEntity(currentNode); // Not undertood instancing yet
|
||||
for (size_t iPoint = 0; iPoint < polymarker.size(); iPoint++) {
|
||||
for (std::size_t iPoint = 0; iPoint < polymarker.size(); ++iPoint) {
|
||||
auto position = fObjectTransformation*G4Translate3D(polymarker[iPoint]);
|
||||
auto transform = G4Qt3DUtils::CreateQTransformFrom(position);
|
||||
auto currentEntity = new Qt3DCore::QEntity(currentNode); // Not undertood instancing yet
|
||||
@@ -472,7 +473,7 @@ void G4Qt3DSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
|
||||
boxMesh->setYExtent(side);
|
||||
boxMesh->setZExtent(side);
|
||||
|
||||
for (size_t iPoint = 0; iPoint < polymarker.size(); iPoint++) {
|
||||
for (std::size_t iPoint = 0; iPoint < polymarker.size(); ++iPoint) {
|
||||
auto position = fObjectTransformation*G4Translate3D(polymarker[iPoint]);
|
||||
auto transform = G4Qt3DUtils::CreateQTransformFrom(position);
|
||||
auto currentEntity = new Qt3DCore::QEntity(currentNode);
|
||||
@@ -768,7 +769,7 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
|
||||
if(isAuxilaryEdgeVisible||edgeFlag[2]>0)insertIfNew(Line(vertex[2],vertex[3]));
|
||||
if(isAuxilaryEdgeVisible||edgeFlag[3]>0)insertIfNew(Line(vertex[3],vertex[0]));
|
||||
} else {
|
||||
G4cerr
|
||||
G4warn
|
||||
<< "ERROR: polyhedron face with unexpected number of edges (" << nEdges << ')'
|
||||
<< "\n Tag: " << fpModel->GetCurrentTag()
|
||||
<< G4endl;
|
||||
@@ -812,7 +813,7 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
|
||||
// Shouldn't happen in this function (it's a polyhedron!)
|
||||
if (errorCount == 0) {
|
||||
++errorCount;
|
||||
G4cerr << "WARNING: Qt3D: cloud drawing not implemented" << G4endl;
|
||||
G4warn << "WARNING: Qt3D: cloud drawing not implemented" << G4endl;
|
||||
}
|
||||
return;
|
||||
break;
|
||||
@@ -836,10 +837,10 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
|
||||
// Accomodates both vertices and normals - hence 2*
|
||||
QByteArray vertexByteArray;
|
||||
const auto vertexBufferByteSize = 2*nVerts*vertexByteSize;
|
||||
vertexByteArray.resize(vertexBufferByteSize);
|
||||
vertexByteArray.resize((G4int)vertexBufferByteSize);
|
||||
auto vertexBufferArray = reinterpret_cast<PRECISION*>(vertexByteArray.data());
|
||||
G4int i1 = 0;
|
||||
for (size_t i = 0; i < nVerts; i++) {
|
||||
for (std::size_t i = 0; i < nVerts; ++i) {
|
||||
vertexBufferArray[i1++] = vertices[i].x();
|
||||
vertexBufferArray[i1++] = vertices[i].y();
|
||||
vertexBufferArray[i1++] = vertices[i].z();
|
||||
@@ -862,7 +863,7 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
|
||||
positionAtt->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
|
||||
positionAtt->setVertexBaseType(BASETYPE);
|
||||
positionAtt->setVertexSize(3);
|
||||
positionAtt->setCount(nVerts);
|
||||
positionAtt->setCount((G4int)nVerts);
|
||||
positionAtt->setByteOffset(0);
|
||||
positionAtt->setByteStride(2*vertexByteSize);
|
||||
|
||||
@@ -874,7 +875,7 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
|
||||
normalAtt->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
|
||||
normalAtt->setVertexBaseType(BASETYPE);
|
||||
normalAtt->setVertexSize(3);
|
||||
normalAtt->setCount(nVerts);
|
||||
normalAtt->setCount((G4int)nVerts);
|
||||
normalAtt->setByteOffset(vertexByteSize);
|
||||
normalAtt->setByteStride(2*vertexByteSize);
|
||||
}
|
||||
@@ -887,7 +888,7 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
|
||||
// Put lines into a QByteArray
|
||||
QByteArray lineByteArray;
|
||||
const auto lineBufferByteSize = 2*nLines*vertexByteSize;
|
||||
lineByteArray.resize(lineBufferByteSize);
|
||||
lineByteArray.resize((G4int)lineBufferByteSize);
|
||||
auto lineBufferArray = reinterpret_cast<PRECISION*>(lineByteArray.data());
|
||||
G4int i2 = 0;
|
||||
for (const auto& line: lines) {
|
||||
@@ -913,7 +914,7 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
|
||||
lineAtt->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
|
||||
lineAtt->setVertexBaseType(BASETYPE);
|
||||
lineAtt->setVertexSize(3);
|
||||
lineAtt->setCount(nLines);
|
||||
lineAtt->setCount((G4int)nLines);
|
||||
lineAtt->setByteOffset(0);
|
||||
lineAtt->setByteStride(vertexByteSize);
|
||||
}
|
||||
@@ -939,7 +940,7 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
|
||||
renderer = new Qt3DRender::QGeometryRenderer;
|
||||
renderer->setObjectName("polyhedronWireframeRenderer");
|
||||
renderer->setGeometry(lineGeometry);
|
||||
renderer->setVertexCount(2*nLines);
|
||||
renderer->setVertexCount(2*(G4int)nLines);
|
||||
renderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Lines);
|
||||
wireframeEntity->addComponent(renderer);
|
||||
|
||||
@@ -962,7 +963,7 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
|
||||
renderer = new Qt3DRender::QGeometryRenderer;
|
||||
renderer->setObjectName("polyhedronSurfaceRenderer");
|
||||
renderer->setGeometry(vertexGeometry);
|
||||
renderer->setVertexCount(nVerts);
|
||||
renderer->setVertexCount((G4int)nVerts);
|
||||
renderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Triangles);
|
||||
surfaceEntity->addComponent(renderer);
|
||||
|
||||
@@ -980,7 +981,7 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
|
||||
renderer = new Qt3DRender::QGeometryRenderer;
|
||||
renderer->setObjectName("polyhedronWireframeRenderer");
|
||||
renderer->setGeometry(lineGeometry);
|
||||
renderer->setVertexCount(2*nLines);
|
||||
renderer->setVertexCount(2*(G4int)nLines);
|
||||
renderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Lines);
|
||||
wireframeEntity->addComponent(renderer);
|
||||
|
||||
@@ -1000,7 +1001,7 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
|
||||
renderer = new Qt3DRender::QGeometryRenderer;
|
||||
renderer->setObjectName("polyhedronSurfaceRenderer");
|
||||
renderer->setGeometry(vertexGeometry);
|
||||
renderer->setVertexCount(nVerts);
|
||||
renderer->setVertexCount((G4int)nVerts);
|
||||
renderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Triangles);
|
||||
surfaceEntity->addComponent(renderer);
|
||||
|
||||
@@ -1022,7 +1023,7 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
|
||||
renderer = new Qt3DRender::QGeometryRenderer;
|
||||
renderer->setObjectName("polyhedronSurfaceRenderer");
|
||||
renderer->setGeometry(vertexGeometry);
|
||||
renderer->setVertexCount(nVerts);
|
||||
renderer->setVertexCount((G4int)nVerts);
|
||||
renderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Triangles);
|
||||
surfaceEntity->addComponent(renderer);
|
||||
|
||||
@@ -1040,7 +1041,7 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
|
||||
renderer = new Qt3DRender::QGeometryRenderer;
|
||||
renderer->setObjectName("polyhedronSurfaceRenderer");
|
||||
renderer->setGeometry(lineGeometry);
|
||||
renderer->setVertexCount(2*nLines);
|
||||
renderer->setVertexCount(2*(G4int)nLines);
|
||||
renderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Lines);
|
||||
wireframeEntity->addComponent(renderer);
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
#include "G4UIQt.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
G4Qt3DViewer::G4Qt3DViewer
|
||||
(G4Qt3DSceneHandler& sceneHandler, const G4String& name)
|
||||
: G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name)
|
||||
@@ -56,7 +58,7 @@ void G4Qt3DViewer::Initialise()
|
||||
auto uiQt = dynamic_cast<G4UIQt*>(UI->GetG4UIWindow());
|
||||
if (!uiQt) {
|
||||
fViewId = -1; // This flags an error.
|
||||
G4cerr << "G4Qt3DViewer::G4Qt3DViewer requires G4UIQt"
|
||||
G4warn << "G4Qt3DViewer::G4Qt3DViewer requires G4UIQt"
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
@@ -237,55 +239,78 @@ void G4Qt3DViewer::KernelVisitDecision () {
|
||||
}
|
||||
}
|
||||
|
||||
G4bool G4Qt3DViewer::CompareForKernelVisit(G4ViewParameters& lastVP)
|
||||
G4bool G4Qt3DViewer::CompareForKernelVisit(G4ViewParameters& vp)
|
||||
{
|
||||
// Typical comparison. Taken from OpenGL.
|
||||
// Typical comparison. Taken from OpenInventor.
|
||||
if (
|
||||
(lastVP.GetDrawingStyle () != fVP.GetDrawingStyle ()) ||
|
||||
(lastVP.GetNumberOfCloudPoints() != fVP.GetNumberOfCloudPoints()) ||
|
||||
(lastVP.IsAuxEdgeVisible () != fVP.IsAuxEdgeVisible ()) ||
|
||||
(lastVP.IsCulling () != fVP.IsCulling ()) ||
|
||||
(lastVP.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
|
||||
(lastVP.IsDensityCulling () != fVP.IsDensityCulling ()) ||
|
||||
(lastVP.IsCullingCovered () != fVP.IsCullingCovered ()) ||
|
||||
(lastVP.GetCBDAlgorithmNumber() !=
|
||||
fVP.GetCBDAlgorithmNumber()) ||
|
||||
(lastVP.IsSection () != fVP.IsSection ()) ||
|
||||
(lastVP.IsCutaway () != fVP.IsCutaway ()) ||
|
||||
(lastVP.IsExplode () != fVP.IsExplode ()) ||
|
||||
(lastVP.GetNoOfSides () != fVP.GetNoOfSides ()) ||
|
||||
(lastVP.GetGlobalMarkerScale() != fVP.GetGlobalMarkerScale()) ||
|
||||
(lastVP.GetGlobalLineWidthScale() != fVP.GetGlobalLineWidthScale()) ||
|
||||
(lastVP.IsMarkerNotHidden () != fVP.IsMarkerNotHidden ()) ||
|
||||
(lastVP.GetDefaultVisAttributes()->GetColour() !=
|
||||
fVP.GetDefaultVisAttributes()->GetColour()) ||
|
||||
(lastVP.GetDefaultTextVisAttributes()->GetColour() !=
|
||||
fVP.GetDefaultTextVisAttributes()->GetColour()) ||
|
||||
(lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())||
|
||||
(lastVP.IsPicking () != fVP.IsPicking ()) ||
|
||||
(lastVP.GetVisAttributesModifiers() !=
|
||||
fVP.GetVisAttributesModifiers()) ||
|
||||
(lastVP.IsSpecialMeshRendering() !=
|
||||
fVP.IsSpecialMeshRendering())
|
||||
) {
|
||||
(vp.GetDrawingStyle () != fVP.GetDrawingStyle ()) ||
|
||||
(vp.GetNumberOfCloudPoints() != fVP.GetNumberOfCloudPoints()) ||
|
||||
(vp.IsAuxEdgeVisible () != fVP.IsAuxEdgeVisible ()) ||
|
||||
(vp.IsCulling () != fVP.IsCulling ()) ||
|
||||
(vp.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
|
||||
(vp.IsDensityCulling () != fVP.IsDensityCulling ()) ||
|
||||
(vp.IsCullingCovered () != fVP.IsCullingCovered ()) ||
|
||||
(vp.GetCBDAlgorithmNumber() !=
|
||||
fVP.GetCBDAlgorithmNumber()) ||
|
||||
(vp.IsSection () != fVP.IsSection ()) ||
|
||||
(vp.IsCutaway () != fVP.IsCutaway ()) ||
|
||||
// This assumes use of generic clipping (sectioning, slicing,
|
||||
// DCUT, cutaway). If a decision is made to implement locally,
|
||||
// this will need changing. See G4OpenGLViewer::SetView,
|
||||
// G4OpenGLStoredViewer.cc::CompareForKernelVisit and
|
||||
// G4OpenGLStoredSceneHander::CreateSection/CutawayPolyhedron.
|
||||
(vp.IsExplode () != fVP.IsExplode ()) ||
|
||||
(vp.GetNoOfSides () != fVP.GetNoOfSides ()) ||
|
||||
(vp.GetGlobalMarkerScale() != fVP.GetGlobalMarkerScale()) ||
|
||||
(vp.GetGlobalLineWidthScale() != fVP.GetGlobalLineWidthScale()) ||
|
||||
(vp.IsMarkerNotHidden () != fVP.IsMarkerNotHidden ()) ||
|
||||
(vp.GetDefaultVisAttributes()->GetColour() !=
|
||||
fVP.GetDefaultVisAttributes()->GetColour()) ||
|
||||
(vp.GetDefaultTextVisAttributes()->GetColour() !=
|
||||
fVP.GetDefaultTextVisAttributes()->GetColour()) ||
|
||||
(vp.GetBackgroundColour ()!= fVP.GetBackgroundColour ())||
|
||||
(vp.IsPicking () != fVP.IsPicking ()) ||
|
||||
// Scaling for Open Inventor is done by the scene handler so it
|
||||
// needs a kernel visit. (In this respect, it differs from the
|
||||
// OpenGL drivers, where it's done in SetView.)
|
||||
(vp.GetScaleFactor () != fVP.GetScaleFactor ()) ||
|
||||
(vp.GetVisAttributesModifiers() !=
|
||||
fVP.GetVisAttributesModifiers()) ||
|
||||
(vp.IsSpecialMeshRendering() !=
|
||||
fVP.IsSpecialMeshRendering()) ||
|
||||
(vp.GetSpecialMeshRenderingOption() !=
|
||||
fVP.GetSpecialMeshRenderingOption())
|
||||
)
|
||||
return true;
|
||||
|
||||
if (vp.IsDensityCulling () &&
|
||||
(vp.GetVisibleDensity () != fVP.GetVisibleDensity ()))
|
||||
return true;
|
||||
|
||||
if (vp.GetCBDAlgorithmNumber() > 0) {
|
||||
if (vp.GetCBDParameters().size() != fVP.GetCBDParameters().size()) return true;
|
||||
else if (vp.GetCBDParameters() != fVP.GetCBDParameters()) return true;
|
||||
}
|
||||
|
||||
if (lastVP.IsDensityCulling () &&
|
||||
(lastVP.GetVisibleDensity () != fVP.GetVisibleDensity ()))
|
||||
if (vp.IsSection () &&
|
||||
(vp.GetSectionPlane () != fVP.GetSectionPlane ()))
|
||||
return true;
|
||||
|
||||
if (lastVP.GetCBDAlgorithmNumber() > 0) {
|
||||
if (lastVP.GetCBDParameters().size() != fVP.GetCBDParameters().size()) return true;
|
||||
else if (lastVP.GetCBDParameters() != fVP.GetCBDParameters()) return true;
|
||||
if (vp.IsCutaway ()) {
|
||||
if (vp.GetCutawayMode() != fVP.GetCutawayMode()) return true;
|
||||
if (vp.GetCutawayPlanes ().size () !=
|
||||
fVP.GetCutawayPlanes ().size ()) return true;
|
||||
for (size_t i = 0; i < vp.GetCutawayPlanes().size(); ++i)
|
||||
if (vp.GetCutawayPlanes()[i] != fVP.GetCutawayPlanes()[i])
|
||||
return true;
|
||||
}
|
||||
|
||||
if (lastVP.IsExplode () &&
|
||||
(lastVP.GetExplodeFactor () != fVP.GetExplodeFactor ()))
|
||||
if (vp.IsExplode () &&
|
||||
(vp.GetExplodeFactor () != fVP.GetExplodeFactor ()))
|
||||
return true;
|
||||
|
||||
if (lastVP.IsSpecialMeshRendering() &&
|
||||
(lastVP.GetSpecialMeshVolumes() != fVP.GetSpecialMeshVolumes()))
|
||||
if (vp.IsSpecialMeshRendering() &&
|
||||
(vp.GetSpecialMeshVolumes() != fVP.GetSpecialMeshVolumes()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
@@ -6,6 +6,24 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2022-11-25 Gabriele Cosmo (raytracer-V11-00-06)
|
||||
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
|
||||
|
||||
## 2022-11-06 John Allison (raytracer-V11-00-05)
|
||||
- Eliminate G4cerr and introduce G4warn.
|
||||
- `#define G4warn G4cout`
|
||||
- The above is temporary until a genuine G4warn output stream is
|
||||
implemented.
|
||||
- Change G4cerr to G4warn in all cases.
|
||||
- Change G4cout to G4warn in those cases where it is clearly
|
||||
an error report or a warning.
|
||||
|
||||
## 2022-09-03 Ben Morgan (raytracer-V11-00-04)
|
||||
- Resolve inconsistencies in dependencies
|
||||
- Remove inclusion of headers for unused interfaces
|
||||
- Remove unused dependencies
|
||||
- Add needed G4geometrymg dependency
|
||||
|
||||
## 2022-04-07 Gabriele Cosmo (raytracer-V11-00-03)
|
||||
- Fixed GNUmakefile and source.cmake to add required granular dependencies on
|
||||
"geometry/solids/CSG" and "geometry/solids/specific" modules, introduced
|
||||
|
||||
@@ -51,7 +51,7 @@ class G4OutBitStream
|
||||
void CopyByte(const char* src, int n);
|
||||
|
||||
u_char* GetStreamAddress(void){return mHeadOfBuf;};
|
||||
int GetStreamSize(void){return mBuf - mHeadOfBuf;};
|
||||
int GetStreamSize(void){return int(mBuf - mHeadOfBuf);};
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
@@ -67,14 +67,14 @@ class G4RayTrajectory : public G4VTrajectory
|
||||
|
||||
public:
|
||||
|
||||
inline void* operator new(size_t);
|
||||
inline void* operator new(std::size_t);
|
||||
inline void operator delete(void*);
|
||||
// inline int operator == (const G4RayTrajectory& right){return (this==&right);}
|
||||
|
||||
virtual void AppendStep(const G4Step*);
|
||||
virtual void ShowTrajectory(std::ostream&) const;
|
||||
virtual void DrawTrajectory() const {;}
|
||||
virtual int GetPointEntries() const {return positionRecord->size();}
|
||||
virtual G4int GetPointEntries() const {return (G4int)positionRecord->size();}
|
||||
virtual G4VTrajectoryPoint* GetPoint(G4int i) const
|
||||
{ return (*positionRecord)[i]; }
|
||||
G4RayTrajectoryPoint* GetPointC(G4int i) const
|
||||
@@ -100,7 +100,7 @@ class G4RayTrajectory : public G4VTrajectory
|
||||
extern G4DLLIMPORT G4Allocator<G4RayTrajectory>*& rayTrajectoryAllocator();
|
||||
#endif
|
||||
|
||||
inline void* G4RayTrajectory::operator new(size_t)
|
||||
inline void* G4RayTrajectory::operator new(std::size_t)
|
||||
{
|
||||
if(!rayTrajectoryAllocator())
|
||||
{ rayTrajectoryAllocator() = new G4Allocator<G4RayTrajectory>; }
|
||||
|
||||
@@ -64,13 +64,12 @@ geant4_module_link_libraries(G4RayTracer
|
||||
PRIVATE
|
||||
G4event
|
||||
G4bosons
|
||||
G4geometrymng
|
||||
G4scoring
|
||||
G4partman
|
||||
G4procman
|
||||
G4cuts
|
||||
G4detector
|
||||
G4csg
|
||||
G4specsolids
|
||||
G4navigation)
|
||||
|
||||
# X11 RayTracer only if selected
|
||||
|
||||
@@ -294,7 +294,7 @@ G4JpegCoder::WriteHeader( void )
|
||||
if( mProperty.Comment != 0 ){
|
||||
mOBSP->SetByte( M_Marker ); //FF
|
||||
mOBSP->SetByte( M_COM ); //comment
|
||||
int length = strlen( mProperty.Comment ) + 1;
|
||||
int length = (int)strlen( mProperty.Comment ) + 1;
|
||||
mOBSP->SetWord( length + 2 );
|
||||
mOBSP->CopyByte( mProperty.Comment, length );
|
||||
}
|
||||
|
||||
@@ -44,6 +44,8 @@
|
||||
#include "G4RayTracerViewer.hh"
|
||||
#include "G4TheRayTracer.hh"
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
G4RTMessenger* G4RTMessenger::fpInstance = 0;
|
||||
|
||||
G4RTMessenger* G4RTMessenger::GetInstance
|
||||
@@ -193,7 +195,7 @@ void G4RTMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
if (pViewer) {
|
||||
theTracer = pViewer->GetTracer();
|
||||
} else {
|
||||
G4cout <<
|
||||
G4warn <<
|
||||
"G4RTMessenger::SetNewValue: Current viewer is not of type RayTracer."
|
||||
"\n Use \"/vis/viewer/select\" or \"/vis/open\"."
|
||||
<< G4endl;
|
||||
@@ -201,7 +203,7 @@ void G4RTMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
}
|
||||
|
||||
if (theTracer == theDefaultTracer) {
|
||||
G4cout <<
|
||||
G4warn <<
|
||||
"G4RTMessenger::SetNewValue: No valid current viewer. Using default RayTracer."
|
||||
<< G4endl;
|
||||
}
|
||||
@@ -226,7 +228,7 @@ void G4RTMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
{ theTracer->SetDistortion(distCmd->GetNewBoolValue(newValue)); }
|
||||
else if(command==bkgColCmd)
|
||||
{
|
||||
G4cout << "WARNING: /vis/rayTracer/backgroundColour has been deprecated."
|
||||
G4warn << "WARNING: /vis/rayTracer/backgroundColour has been deprecated."
|
||||
"\n Use \"/vis/viewer/set/background\" instead."
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
@@ -29,9 +29,7 @@
|
||||
#include "G4RTPrimaryGeneratorAction.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4GeometryManager.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4PrimaryVertex.hh"
|
||||
#include "G4PrimaryParticle.hh"
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
extern "C" {
|
||||
Bool G4RayTracerXScannerWaitForNotify (Display*, XEvent* e, char* arg) {
|
||||
return (e->type == MapNotify) && (e->xmap.window == (Window) arg);
|
||||
@@ -110,7 +112,7 @@ G4bool G4RTXScanner::GetXWindow(const G4String& name, G4ViewParameters& vp)
|
||||
{
|
||||
display = XOpenDisplay(0); // Use display defined by DISPLAY environment.
|
||||
if (!display) {
|
||||
G4cerr << "G4RTXScanner::Initialize(): cannot get display."
|
||||
G4warn << "G4RTXScanner::Initialize(): cannot get display."
|
||||
<< G4endl;
|
||||
return false;
|
||||
}
|
||||
@@ -142,7 +144,7 @@ G4bool G4RTXScanner::GetXWindow(const G4String& name, G4ViewParameters& vp)
|
||||
size_hints->y = yOffset;
|
||||
}
|
||||
} else {
|
||||
G4cout << "ERROR: Geometry string \""
|
||||
G4warn << "ERROR: Geometry string \""
|
||||
<< XGeometryString
|
||||
<< "\" invalid. Using \"600x600\"."
|
||||
<< G4endl;
|
||||
@@ -150,7 +152,7 @@ G4bool G4RTXScanner::GetXWindow(const G4String& name, G4ViewParameters& vp)
|
||||
height = 600;
|
||||
}
|
||||
} else {
|
||||
G4cout << "ERROR: Geometry string \""
|
||||
G4warn << "ERROR: Geometry string \""
|
||||
<< XGeometryString
|
||||
<< "\" is empty. Using \"600x600\"."
|
||||
<< G4endl;
|
||||
@@ -181,7 +183,7 @@ G4bool G4RTXScanner::GetXWindow(const G4String& name, G4ViewParameters& vp)
|
||||
(display, RootWindow(display, screen_num),
|
||||
&scmap, &nMaps, XA_RGB_BEST_MAP);
|
||||
if (!status) {
|
||||
G4cerr <<
|
||||
G4warn <<
|
||||
"G4RTXScanner::Initialize(): cannot get color map."
|
||||
"\n Perhaps your system does not support XA_RGB_BEST_MAP."
|
||||
<< G4endl;
|
||||
@@ -189,7 +191,7 @@ G4bool G4RTXScanner::GetXWindow(const G4String& name, G4ViewParameters& vp)
|
||||
}
|
||||
}
|
||||
if (!scmap->colormap) {
|
||||
G4cerr << "G4RTXScanner::Initialize(): color map empty."
|
||||
G4warn << "G4RTXScanner::Initialize(): color map empty."
|
||||
<< G4endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#include "G4RayTracerSceneHandler.hh"
|
||||
#include "G4RayTracerViewer.hh"
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
G4RayTracer::G4RayTracer():
|
||||
G4VGraphicsSystem("RayTracer",
|
||||
"RayTracer",
|
||||
@@ -53,7 +55,7 @@ G4VViewer* G4RayTracer::CreateViewer (G4VSceneHandler& sceneHandler,
|
||||
(sceneHandler, name, theRayTracer);
|
||||
if (pViewer) {
|
||||
if (pViewer->GetViewId() < 0) {
|
||||
G4cout <<
|
||||
G4warn <<
|
||||
"G4RayTracer::CreateViewer: ERROR flagged by negative"
|
||||
" view id in G4RayTracerViewer creation."
|
||||
"\n Destroying view and returning null pointer."
|
||||
@@ -63,7 +65,7 @@ G4VViewer* G4RayTracer::CreateViewer (G4VSceneHandler& sceneHandler,
|
||||
}
|
||||
}
|
||||
else {
|
||||
G4cout <<
|
||||
G4warn <<
|
||||
"G4RayTracer::CreateViewer: ERROR: null pointer on new G4RayTracerViewer."
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
#include "G4RayTracerSceneHandler.hh"
|
||||
|
||||
#include "G4VisManager.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
G4int G4RayTracerSceneHandler::fSceneIdCount = 0;
|
||||
|
||||
@@ -99,7 +100,7 @@ void G4RayTracerSceneHandler::BuildVisAttsMap (const G4VSolid&)
|
||||
if (!pVisAtts) {
|
||||
// Shouldn't happen.
|
||||
if (G4VisManager::GetInstance()->GetVerbosity() >= G4VisManager::warnings) {
|
||||
G4cout <<
|
||||
G4warn <<
|
||||
"WARNING: G4RayTracerSceneHandler::BuildVisAttsMap: null vis atts pointer."
|
||||
"\n Using a default vis atts."
|
||||
<< G4endl;
|
||||
|
||||
@@ -44,6 +44,8 @@
|
||||
#include "G4RTSimpleScanner.hh"
|
||||
#include "G4UImanager.hh"
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
G4RayTracerViewer::G4RayTracerViewer
|
||||
(G4VSceneHandler& sceneHandler,
|
||||
const G4String& name,
|
||||
@@ -58,7 +60,7 @@ G4RayTracerViewer::G4RayTracerViewer
|
||||
#endif
|
||||
{
|
||||
if (!theTracer) {
|
||||
G4cerr << "G4RayTracerViewer::Initialise: No tracer" << G4endl;
|
||||
G4warn << "G4RayTracerViewer::Initialise: No tracer" << G4endl;
|
||||
fViewId = -1; // This flags an error.
|
||||
return;
|
||||
}
|
||||
@@ -114,7 +116,7 @@ void G4RayTracerViewer::DrawView()
|
||||
if (fVP.GetFieldHalfAngle() == 0.) { // Orthogonal (parallel) projection.
|
||||
G4double fieldHalfAngle = perMillion;
|
||||
fVP.SetFieldHalfAngle(fieldHalfAngle);
|
||||
G4cout <<
|
||||
G4warn <<
|
||||
"WARNING: G4RayTracerViewer::DrawView: true orthogonal projection"
|
||||
"\n not yet implemented. Doing a \"long shot\", i.e., a perspective"
|
||||
"\n projection with a half field angle of "
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#include "G4RayTracerSceneHandler.hh"
|
||||
#include "G4RayTracerXViewer.hh"
|
||||
|
||||
#define G4warn G4cerr
|
||||
|
||||
G4RayTracerX::G4RayTracerX():
|
||||
G4VGraphicsSystem("RayTracerX",
|
||||
"RayTracerX",
|
||||
@@ -53,7 +55,7 @@ G4VViewer* G4RayTracerX::CreateViewer (G4VSceneHandler& sceneHandler,
|
||||
G4VViewer* pViewer = new G4RayTracerXViewer (sceneHandler, name);
|
||||
if (pViewer) {
|
||||
if (pViewer->GetViewId() < 0) {
|
||||
G4cout <<
|
||||
G4warn <<
|
||||
"G4RayTracerX::CreateViewer: ERROR flagged by negative"
|
||||
" view id in G4RayTracerXViewer creation."
|
||||
"\n Destroying view and returning null pointer."
|
||||
@@ -63,7 +65,7 @@ G4VViewer* G4RayTracerX::CreateViewer (G4VSceneHandler& sceneHandler,
|
||||
}
|
||||
}
|
||||
else {
|
||||
G4cout <<
|
||||
G4warn <<
|
||||
"G4RayTracerX::CreateViewer: ERROR: null pointer on new G4RayTracerXViewer."
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include "G4RayTrajectoryPoint.hh"
|
||||
#include "G4RayTracerSceneHandler.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4VisManager.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Colour.hh"
|
||||
|
||||
@@ -46,6 +46,8 @@
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4RunManagerFactory.hh"
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
G4TheMTRayTracer* G4TheMTRayTracer::theInstance = nullptr;
|
||||
|
||||
G4TheMTRayTracer::G4TheMTRayTracer(G4VFigureFileMaker* figMaker,
|
||||
@@ -100,14 +102,14 @@ void G4TheMTRayTracer::Trace(const G4String& fileName)
|
||||
G4ApplicationState currentState = theStateMan->GetCurrentState();
|
||||
if(currentState!=G4State_Idle)
|
||||
{
|
||||
G4cerr << "Illegal application state <" << theStateMan->GetStateString(currentState)
|
||||
G4warn << "Illegal application state <" << theStateMan->GetStateString(currentState)
|
||||
<< "> - Trace() ignored. " << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if(!theFigMaker)
|
||||
{
|
||||
G4cerr << "Figure file maker class is not specified - Trace() ignored." << G4endl;
|
||||
G4warn << "Figure file maker class is not specified - Trace() ignored." << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -135,8 +137,8 @@ void G4TheMTRayTracer::Trace(const G4String& fileName)
|
||||
if(succeeded)
|
||||
{ CreateFigureFile(fileName); }
|
||||
else
|
||||
{ G4cerr << "Could not create figure file" << G4endl;
|
||||
G4cerr << "You might set the eye position outside of the world volume" << G4endl; }
|
||||
{ G4warn << "Could not create figure file" << G4endl;
|
||||
G4warn << "You might set the eye position outside of the world volume" << G4endl; }
|
||||
|
||||
G4String str = "/tracking/storeTrajectory " + G4UIcommand::ConvertToString(storeTrajectory);
|
||||
UI->ApplyCommand(str);
|
||||
|
||||
@@ -54,6 +54,8 @@
|
||||
#include "G4ProductionCutsTable.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
G4VFigureFileMaker * G4TheRayTracer::theFigMaker = 0;
|
||||
G4VRTScanner * G4TheRayTracer::theScanner = 0;
|
||||
|
||||
@@ -113,13 +115,13 @@ void G4TheRayTracer::Trace(const G4String& fileName)
|
||||
G4ApplicationState currentState = theStateMan->GetCurrentState();
|
||||
if(currentState!=G4State_Idle)
|
||||
{
|
||||
G4cerr << "Illegal application state - Trace() ignored." << G4endl;
|
||||
G4warn << "Illegal application state - Trace() ignored." << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if(!theFigMaker)
|
||||
{
|
||||
G4cerr << "Figure file maker class is not specified - Trace() ignored." << G4endl;
|
||||
G4warn << "Figure file maker class is not specified - Trace() ignored." << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -139,8 +141,8 @@ void G4TheRayTracer::Trace(const G4String& fileName)
|
||||
if(succeeded)
|
||||
{ CreateFigureFile(fileName); }
|
||||
else
|
||||
{ G4cerr << "Could not create figure file" << G4endl;
|
||||
G4cerr << "You might set the eye position outside of the world volume" << G4endl; }
|
||||
{ G4warn << "Could not create figure file" << G4endl;
|
||||
G4warn << "You might set the eye position outside of the world volume" << G4endl; }
|
||||
RestoreUserActions();
|
||||
|
||||
if(storeTrajectory==0) UI->ApplyCommand("/tracking/storeTrajectory 0");
|
||||
@@ -209,7 +211,7 @@ G4bool G4TheRayTracer::CreateBitMap()
|
||||
G4ProductionCutsTable::GetProductionCutsTable()->UpdateCoupleTable(pWorld);
|
||||
G4ProcessVector* pVector
|
||||
= G4Geantino::GeantinoDefinition()->GetProcessManager()->GetProcessList();
|
||||
for (std::size_t j=0; j < pVector->size(); ++j) {
|
||||
for (G4int j=0; j < (G4int)pVector->size(); ++j) {
|
||||
(*pVector)[j]->BuildPhysicsTable(*(G4Geantino::GeantinoDefinition()));
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ GLOBLIBS += libG4materials.lib libG4graphics_reps.lib
|
||||
GLOBLIBS += libG4intercoms.lib libG4global.lib
|
||||
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
# include $(G4INSTALL)/config/G4VIS_BUILD.gmk
|
||||
include $(G4INSTALL)/config/interactivity.gmk
|
||||
|
||||
CPPFLAGS += -I$(G4BASE)/visualization/management/include
|
||||
@@ -23,14 +22,19 @@ CPPFLAGS += -I$(G4BASE)/global/HEPGeometry/include
|
||||
CPPFLAGS += -I$(G4BASE)/graphics_reps/include
|
||||
CPPFLAGS += -I$(G4BASE)/intercoms/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/management/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/navigation/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/solids/CSG/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/solids/specific/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/volumes/include
|
||||
CPPFLAGS += -I$(G4BASE)/tracking/include
|
||||
CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include
|
||||
|
||||
# Locally adjust source list before including common.gmk
|
||||
sources := src/G4ToolsSGSceneHandler.cc
|
||||
|
||||
CPPFLAGS += -I$(G4BASE)/externals/g4tools/include
|
||||
sources += src/G4ToolsSGOffscreen.cc
|
||||
|
||||
ifdef G4VIS_BUILD_TOOLSSG_X11_GLES_DRIVER
|
||||
sources += src/G4ToolsSGX11GLES.cc
|
||||
endif
|
||||
|
||||
@@ -1,8 +1,28 @@
|
||||
# Category vis_toolssg History
|
||||
|
||||
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!
|
||||
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!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2022-11-25 Gabriele Cosmo (vis_toolssg-V11-00-15)
|
||||
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
|
||||
|
||||
## 2022-10-28 John Allison (vis_toolssg-V11-00-14)
|
||||
- Request kernel visit when cutaway mode changes:
|
||||
- G4ToolsSGViewer.hh
|
||||
|
||||
## 2022-10-13 Guy Barrand (vis_toolssg-V11-00-13)
|
||||
- new offscreen sub-driver.
|
||||
- new files: include/G4ToolsSGOffscreen.hh, include/G4ToolsSGOffscreenViewer.hh and src/G4ToolsSGOffscreen.cc.
|
||||
- sources.cmake, GNUmakefile: G4ToolsSGOffscreen .hh and .cc files.
|
||||
- G4ToolsSGViewer.hh: handle ambient lightening.
|
||||
- G4ToolsSGViewer.hh: for "write paper", handle zb_png, zb_jpeg formats.
|
||||
- G4ToolsSGViewer.hh: correct fSGViewer->set_clear_color(). The passed "green" was... blue.
|
||||
|
||||
## 2022-09-06 Ben Morgan (vis_toolssg-V11-00-12)
|
||||
- Address dependency inconsistencies reported by geant4_module_check
|
||||
|
||||
## 2022-05-18 Guy Barrand (vis_toolssg-V11-00-11)
|
||||
- have "toolx" namespace for g4tools code related to "externals", then:
|
||||
|
||||
+19
-33
@@ -23,45 +23,31 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// Guy Barrand 09th June 2022
|
||||
|
||||
#ifndef G4OpenGL2PSAction_h
|
||||
#define G4OpenGL2PSAction_h
|
||||
#ifndef G4TOOLSSOFFSCREEN_HH
|
||||
#define G4TOOLSSOFFSCREEN_HH
|
||||
|
||||
#include "globals.hh"
|
||||
#include "Geant4_gl2ps.h"
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
|
||||
class G4OpenGL2PSAction {
|
||||
namespace tools {namespace offscreen {class session;}}
|
||||
|
||||
class G4ToolsSGOffscreen: public G4VGraphicsSystem {
|
||||
typedef G4VGraphicsSystem parent;
|
||||
public:
|
||||
G4OpenGL2PSAction();
|
||||
|
||||
void setFileName(const char*);
|
||||
void setExportImageFormat(unsigned int);
|
||||
bool enableFileWriting();
|
||||
// return true if ok, false is an error occured
|
||||
|
||||
bool disableFileWriting();
|
||||
// return true when OK, false if errror
|
||||
|
||||
bool fileWritingEnabled() const;
|
||||
void setLineWidth(int);
|
||||
void setPointSize(int);
|
||||
void setViewport(int,int,int,int);
|
||||
bool extendBufferSize();
|
||||
void resetBufferSizeParameters();
|
||||
void setBufferSize(int);
|
||||
|
||||
G4ToolsSGOffscreen();
|
||||
virtual ~G4ToolsSGOffscreen();
|
||||
protected:
|
||||
G4ToolsSGOffscreen(const G4ToolsSGOffscreen& a_from):parent(a_from){}
|
||||
G4ToolsSGOffscreen& operator=(const G4ToolsSGOffscreen&) {return *this;}
|
||||
public:
|
||||
G4VSceneHandler* CreateSceneHandler(const G4String& name = "");
|
||||
G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name = "");
|
||||
G4bool IsUISessionCompatible () const;
|
||||
protected:
|
||||
void Initialise();
|
||||
protected:
|
||||
bool G4gl2psBegin();
|
||||
G4String fFileName;
|
||||
FILE* fFile;
|
||||
GLint fViewport[4];
|
||||
GLint fBufferSize;
|
||||
GLint fBufferSizeLimit;
|
||||
private:
|
||||
unsigned int fExportImageFormat;
|
||||
tools::offscreen::session* fSGSession;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,404 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 09th June 2022
|
||||
|
||||
#ifndef G4TOOLSSGOFFSCREENVIEWER_HH
|
||||
#define G4TOOLSSGOFFSCREENVIEWER_HH
|
||||
|
||||
#include "G4ToolsSGViewer.hh"
|
||||
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
|
||||
#include <tools/fpng>
|
||||
#include <tools/toojpeg>
|
||||
|
||||
#include <tools/offscreen/sg_viewer>
|
||||
#include <tools/tos>
|
||||
#include <tools/sto>
|
||||
|
||||
class G4ToolsSGOffscreenViewer : public G4ToolsSGViewer<tools::offscreen::session,tools::offscreen::sg_viewer> {
|
||||
typedef G4ToolsSGViewer<tools::offscreen::session,tools::offscreen::sg_viewer> parent;
|
||||
public:
|
||||
G4ToolsSGOffscreenViewer(tools::offscreen::session& a_session,G4ToolsSGSceneHandler& a_scene_handler, const G4String& a_name)
|
||||
:parent(a_session,a_scene_handler,a_name)
|
||||
,fFileName("auto")
|
||||
,fFilePrefix("auto")
|
||||
,fFileIndex(0)
|
||||
,fResetFileIndex(false)
|
||||
{
|
||||
Messenger::Create();
|
||||
}
|
||||
virtual ~G4ToolsSGOffscreenViewer() = default;
|
||||
protected:
|
||||
G4ToolsSGOffscreenViewer(const G4ToolsSGOffscreenViewer& a_from):parent(a_from){}
|
||||
G4ToolsSGOffscreenViewer& operator=(const G4ToolsSGOffscreenViewer&) {return *this;}
|
||||
public:
|
||||
virtual void Initialise() {
|
||||
if(fSGViewer) return; //done.
|
||||
//::printf("debug : G4ToolsSGOffscreenViewer::Initialize\n");
|
||||
// auto refresh true produces too much files.
|
||||
fVP.SetAutoRefresh(false);
|
||||
fDefaultVP.SetAutoRefresh(false);
|
||||
fSGViewer = new tools::offscreen::sg_viewer(fSGSession
|
||||
,fVP.GetWindowAbsoluteLocationHintX(1440)
|
||||
,fVP.GetWindowAbsoluteLocationHintY(900)
|
||||
,fVP.GetWindowSizeHintX()
|
||||
,fVP.GetWindowSizeHintY()
|
||||
,fName);
|
||||
fSGViewer->set_file_format("zb_png");
|
||||
fSGViewer->set_file_name("out.png");
|
||||
fSGViewer->set_png_writer(tools::fpng::write);
|
||||
fSGViewer->set_jpeg_writer(tools::toojpeg::write);
|
||||
fSGViewer->set_do_transparency(true);
|
||||
fSGViewer->set_top_to_bottom(false); //if using tools::fpng, tools::toojpeg.
|
||||
}
|
||||
virtual void SetView() {
|
||||
//::printf("debug : G4ToolsSGOffscreenViewer::SetView\n");
|
||||
fVP.SetGlobalMarkerScale(1); //WARNING: for __APPLE__, the G4ToolsSGQtViewer set it to 2.
|
||||
parent::SetView();
|
||||
}
|
||||
|
||||
virtual void DrawView() {
|
||||
if (!fNeedKernelVisit) KernelVisitDecision();
|
||||
fLastVP = fVP;
|
||||
ProcessView(); // Clears store and processes scene only if necessary.
|
||||
//::printf("debug : G4ToolsSGOffscreenViewer::DrawView %s\n",fName.c_str());
|
||||
if(fSGViewer) {
|
||||
fSGSceneHandler.TouchPlotters(fSGViewer->sg());
|
||||
if(fFileName=="auto") {
|
||||
std::string prefix;
|
||||
if(fFilePrefix=="auto") {
|
||||
prefix = "g4tsg_offscreen_"+fSGViewer->file_format()+"_";
|
||||
} else {
|
||||
prefix = fFilePrefix;
|
||||
}
|
||||
std::string suffix;
|
||||
if(G4ToolsSGOffscreenViewer::GetFormatExtension(fSGViewer->file_format(),suffix)) {
|
||||
std::string file_name = prefix+tools::tos(GetFileIndex())+"."+suffix;
|
||||
fSGViewer->set_file_name(file_name);
|
||||
}
|
||||
} else {
|
||||
fSGViewer->set_file_name(fFileName);
|
||||
}
|
||||
if(fSGViewer->write_paper()) {
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::confirmations) {
|
||||
G4cout << "File " << fSGViewer->file_name() << " produced." << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void ClearView() {
|
||||
//::printf("debug : G4ToolsSGOffscreenViewer::ClearView %s\n",fName.c_str());
|
||||
}
|
||||
virtual void ShowView() {
|
||||
//::printf("debug : G4ToolsSGOffscreenViewer::ShowView %s\n",fName.c_str());
|
||||
}
|
||||
virtual void FinishView() {
|
||||
//::printf("debug : G4ToolsSGOffscreenViewer::FinishView %s\n",fName.c_str());
|
||||
if(fSGViewer) {
|
||||
fSGSceneHandler.TouchPlotters(fSGViewer->sg());
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
void SetSize(unsigned int a_w,unsigned int a_h) {
|
||||
if(!fSGViewer) return;
|
||||
if(!a_w || !a_h) {
|
||||
fSGViewer->set_size(fVP.GetWindowSizeHintX(),fVP.GetWindowSizeHintY());
|
||||
} else {
|
||||
fSGViewer->set_size(a_w,a_h);
|
||||
}
|
||||
}
|
||||
|
||||
void SetFileFormat(const G4String& a_format) {
|
||||
if(!fSGViewer) return;
|
||||
fSGViewer->set_file_format(a_format);
|
||||
}
|
||||
|
||||
void SetDoTransparency(bool a_value) {
|
||||
if(!fSGViewer) return;
|
||||
fSGViewer->set_do_transparency(a_value);
|
||||
}
|
||||
|
||||
void SetFileName(const G4String& a_file,const G4String& a_prefix,bool a_reset_index) {
|
||||
fFileName = a_file;
|
||||
fFilePrefix = a_prefix;
|
||||
fResetFileIndex = a_reset_index;
|
||||
}
|
||||
|
||||
void SetGL2PSSort(const G4String& a_sort) {
|
||||
if(!fSGViewer) return;
|
||||
fSGViewer->set_opts_1(a_sort);
|
||||
}
|
||||
|
||||
void SetGL2PSOptions(const G4String& a_opts) {
|
||||
if(!fSGViewer) return;
|
||||
fSGViewer->set_opts_2(a_opts);
|
||||
}
|
||||
|
||||
class Messenger: public G4VVisCommand {
|
||||
public:
|
||||
static void Create() {static Messenger s_messenger;}
|
||||
private:
|
||||
Messenger() {
|
||||
G4UIparameter* parameter;
|
||||
//////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////
|
||||
cmd_format = new G4UIcommand("/vis/tsg/offscreen/set/format", this);
|
||||
cmd_format->SetGuidance("Set file format.");
|
||||
cmd_format->SetGuidance("Available formats are:");
|
||||
cmd_format->SetGuidance("- zb_png: tools::sg offscreen zbuffer put in a png file.");
|
||||
cmd_format->SetGuidance("- zb_jpeg: tools::sg offscreen zbuffer put in a jpeg file.");
|
||||
cmd_format->SetGuidance("- zb_ps: tools::sg offscreen zbuffer put in a PostScript file.");
|
||||
cmd_format->SetGuidance("- gl2ps_eps: gl2ps producing eps");
|
||||
cmd_format->SetGuidance("- gl2ps_ps: gl2ps producing ps");
|
||||
cmd_format->SetGuidance("- gl2ps_pdf: gl2ps producing pdf");
|
||||
cmd_format->SetGuidance("- gl2ps_svg: gl2ps producing svg");
|
||||
cmd_format->SetGuidance("- gl2ps_tex: gl2ps producing tex");
|
||||
cmd_format->SetGuidance("- gl2ps_pgf: gl2ps producing pgf");
|
||||
|
||||
parameter = new G4UIparameter("format",'s',true);
|
||||
parameter->SetDefaultValue("gl2ps_eps");
|
||||
cmd_format->SetParameter (parameter);
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////
|
||||
cmd_file = new G4UIcommand("/vis/tsg/offscreen/set/file", this);
|
||||
cmd_file->SetGuidance("Set file name.");
|
||||
cmd_file->SetGuidance("Default file name is \"auto\" and default format is zb_png.");
|
||||
cmd_file->SetGuidance("If file name is \"auto\", the output file name is built from");
|
||||
cmd_file->SetGuidance("a viewer index counter with the form:");
|
||||
cmd_file->SetGuidance(" g4tsg_offscreen_<format>_<index>.<format extension>");
|
||||
cmd_file->SetGuidance("For example:");
|
||||
cmd_file->SetGuidance(" g4tsg_offscreen_zb_png_1.png");
|
||||
cmd_file->SetGuidance(" g4tsg_offscreen_zb_png_2.png");
|
||||
cmd_file->SetGuidance(" ...");
|
||||
cmd_file->SetGuidance("or if format is changed to \"gl2ps_pdf\":");
|
||||
cmd_file->SetGuidance(" g4tsg_offscreen_gl2ps_pdf_3.pdf");
|
||||
cmd_file->SetGuidance("If a prefix parameter is given, the output file name is built from");
|
||||
cmd_file->SetGuidance("a global index counter with the form:");
|
||||
cmd_file->SetGuidance(" <prefix><index>.<format extension>");
|
||||
cmd_file->SetGuidance("For example:");
|
||||
cmd_file->SetGuidance(" /vis/tsg/offscreen/set/file auto my_prefix_");
|
||||
cmd_file->SetGuidance("will produce:");
|
||||
cmd_file->SetGuidance(" my_prefix_1.png");
|
||||
cmd_file->SetGuidance(" my_prefix_2.png");
|
||||
cmd_file->SetGuidance(" ...");
|
||||
cmd_file->SetGuidance("You can reset the index by specifying true as last argument:");
|
||||
cmd_file->SetGuidance(" /vis/tsg/offscreen/set/file auto other_prefix_ true");
|
||||
cmd_file->SetGuidance("will produce:");
|
||||
cmd_file->SetGuidance(" other_prefix_1.png");
|
||||
cmd_file->SetGuidance(" other_prefix_2.png");
|
||||
cmd_file->SetGuidance(" ...");
|
||||
|
||||
parameter = new G4UIparameter("file",'s',true);
|
||||
parameter->SetDefaultValue("auto");
|
||||
cmd_file->SetParameter (parameter);
|
||||
|
||||
parameter = new G4UIparameter("prefix",'s',true);
|
||||
parameter->SetDefaultValue("auto");
|
||||
cmd_file->SetParameter (parameter);
|
||||
|
||||
parameter = new G4UIparameter("reset_index",'b',true);
|
||||
parameter->SetDefaultValue("false");
|
||||
cmd_file->SetParameter (parameter);
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////
|
||||
cmd_size = new G4UIcommand("/vis/tsg/offscreen/set/size", this);
|
||||
cmd_size->SetGuidance("Set viewer size in pixels.");
|
||||
cmd_size->SetGuidance
|
||||
("If width and/or height is set to zero, the viewer size specified with /vis/viewer/create (/vis/open) is taken.");
|
||||
cmd_size->SetGuidance(" About the picture size, note that the gl2ps files will grow with the number of primitives");
|
||||
cmd_size->SetGuidance("(gl2ps does not have a zbuffer logic). The \"zb\" files will not grow with the number of");
|
||||
cmd_size->SetGuidance("primitives, but with the size of the viewer. It should be preferred for scenes with");
|
||||
cmd_size->SetGuidance("a lot of objects to render. With zb, to have a better rendering, do not hesitate to");
|
||||
cmd_size->SetGuidance("have a large viewer size.");
|
||||
|
||||
parameter = new G4UIparameter("width",'i',false);
|
||||
parameter->SetDefaultValue("0");
|
||||
cmd_size->SetParameter (parameter);
|
||||
|
||||
parameter = new G4UIparameter("height",'i',false);
|
||||
parameter->SetDefaultValue("0");
|
||||
cmd_size->SetParameter (parameter);
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////
|
||||
cmd_do_transparency = new G4UIcmdWithABool("/vis/tsg/offscreen/set/transparency", this);
|
||||
cmd_do_transparency->SetGuidance("True/false to enable/disable rendering of transparent objects.");
|
||||
cmd_do_transparency->SetGuidance("This may be usefull if using file formats, as the gl2ps ones, unable to handle transparency.");
|
||||
cmd_do_transparency->SetParameterName("transparency-enabled",true);
|
||||
cmd_do_transparency->SetDefaultValue(true);
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////
|
||||
cmd_gl2ps_sort = new G4UIcommand("/vis/tsg/offscreen/gl2ps/set/sort", this);
|
||||
cmd_gl2ps_sort->SetGuidance("Set gl2ps sort algorithm when creating the file.");
|
||||
|
||||
cmd_gl2ps_sort->SetGuidance("The sort argument could be:");
|
||||
cmd_gl2ps_sort->SetGuidance(" NO_SORT");
|
||||
cmd_gl2ps_sort->SetGuidance(" SIMPLE_SORT");
|
||||
cmd_gl2ps_sort->SetGuidance(" BSP_SORT");
|
||||
cmd_gl2ps_sort->SetGuidance("The default being BSP_SORT");
|
||||
|
||||
parameter = new G4UIparameter("sort",'s',true);
|
||||
parameter->SetDefaultValue("BSP_SORT");
|
||||
cmd_gl2ps_sort->SetParameter (parameter);
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////
|
||||
cmd_gl2ps_opts = new G4UIcommand("/vis/tsg/offscreen/gl2ps/set/options", this);
|
||||
cmd_gl2ps_opts->SetGuidance("Set gl2ps options passed when creating the file.");
|
||||
|
||||
cmd_gl2ps_opts->SetGuidance("Options is a list of items separated by |. An item can be:");
|
||||
cmd_gl2ps_opts->SetGuidance(" NONE");
|
||||
cmd_gl2ps_opts->SetGuidance(" DRAW_BACKGROUND");
|
||||
cmd_gl2ps_opts->SetGuidance(" SIMPLE_LINE_OFFSET");
|
||||
cmd_gl2ps_opts->SetGuidance(" SILENT");
|
||||
cmd_gl2ps_opts->SetGuidance(" BEST_ROOT");
|
||||
cmd_gl2ps_opts->SetGuidance(" OCCLUSION_CULL");
|
||||
cmd_gl2ps_opts->SetGuidance(" NO_TEXT");
|
||||
cmd_gl2ps_opts->SetGuidance(" LANDSCAPE");
|
||||
cmd_gl2ps_opts->SetGuidance(" NO_PS3_SHADING");
|
||||
cmd_gl2ps_opts->SetGuidance(" NO_PIXMAP");
|
||||
cmd_gl2ps_opts->SetGuidance(" USE_CURRENT_VIEWPORT");
|
||||
cmd_gl2ps_opts->SetGuidance(" COMPRESS");
|
||||
cmd_gl2ps_opts->SetGuidance(" NO_BLENDING");
|
||||
cmd_gl2ps_opts->SetGuidance(" TIGHT_BOUNDING_BOX");
|
||||
cmd_gl2ps_opts->SetGuidance(" NO_OPENGL_CONTEXT");
|
||||
cmd_gl2ps_opts->SetGuidance(" NO_TEX_FONTSIZE");
|
||||
cmd_gl2ps_opts->SetGuidance(" PORTABLE_SORT");
|
||||
cmd_gl2ps_opts->SetGuidance("The default (typical) list of options is:");
|
||||
cmd_gl2ps_opts->SetGuidance(" SILENT|OCCLUSION_CULL|BEST_ROOT|DRAW_BACKGROUND");
|
||||
|
||||
parameter = new G4UIparameter("options",'s',true);
|
||||
parameter->SetDefaultValue("SILENT|OCCLUSION_CULL|BEST_ROOT|DRAW_BACKGROUND");
|
||||
cmd_gl2ps_opts->SetParameter (parameter);
|
||||
|
||||
|
||||
}
|
||||
virtual ~Messenger() {
|
||||
delete cmd_format;
|
||||
delete cmd_file;
|
||||
delete cmd_size;
|
||||
delete cmd_do_transparency;
|
||||
delete cmd_gl2ps_sort;
|
||||
delete cmd_gl2ps_opts;
|
||||
}
|
||||
public:
|
||||
virtual void SetNewValue(G4UIcommand* a_cmd,G4String a_value) {
|
||||
G4VisManager::Verbosity verbosity = GetVisManager()->GetVerbosity();
|
||||
G4VViewer* viewer = GetVisManager()->GetCurrentViewer();
|
||||
if (!viewer) {
|
||||
if (verbosity >= G4VisManager::errors) G4cerr << "ERROR: No current viewer." << G4endl;
|
||||
return;
|
||||
}
|
||||
G4ToolsSGOffscreenViewer* tsg_viewer = dynamic_cast<G4ToolsSGOffscreenViewer*>(viewer);
|
||||
if(!tsg_viewer) {
|
||||
G4cout << "G4ToolsSGOffscreenViewer::Messenger::SetNewValue:"
|
||||
<< " current viewer is not a G4ToolsSGOffscreenViewer." << G4endl;
|
||||
return;
|
||||
}
|
||||
std::vector<std::string> args;
|
||||
tools::double_quotes_tokenize(a_value,args);
|
||||
if(args.size()!=a_cmd->GetParameterEntries()) return;
|
||||
if(a_cmd==cmd_format) {
|
||||
if(!IsKnownFormat(args[0])) {
|
||||
G4cout << "G4ToolsSGOffscreenViewer::Messenger::SetNewValue:"
|
||||
<< " unknown file format " << args[0] << "." << G4endl;
|
||||
return;
|
||||
}
|
||||
tsg_viewer->SetFileFormat(args[0]);
|
||||
} else if(a_cmd==cmd_file) {
|
||||
G4bool reset_index = G4UIcommand::ConvertToBool(args[2].c_str());
|
||||
tsg_viewer->SetFileName(args[0],args[1],reset_index);
|
||||
} else if(a_cmd==cmd_size) {
|
||||
unsigned int w,h;
|
||||
if(!tools::to(args[0],w)) w = 0;
|
||||
if(!tools::to(args[1],h)) h = 0;
|
||||
tsg_viewer->SetSize(w,h);
|
||||
} else if(a_cmd==cmd_do_transparency) {
|
||||
G4bool _do = a_cmd->ConvertToBool(args[0].c_str());
|
||||
tsg_viewer->SetDoTransparency(_do);
|
||||
} else if(a_cmd==cmd_gl2ps_sort) {
|
||||
tsg_viewer->SetGL2PSSort(args[0]);
|
||||
} else if(a_cmd==cmd_gl2ps_opts) {
|
||||
tsg_viewer->SetGL2PSOptions(args[0]);
|
||||
}
|
||||
}
|
||||
private:
|
||||
G4UIcommand* cmd_format;
|
||||
G4UIcommand* cmd_file;
|
||||
G4UIcommand* cmd_size;
|
||||
G4UIcmdWithABool* cmd_do_transparency;
|
||||
G4UIcommand* cmd_gl2ps_sort;
|
||||
G4UIcommand* cmd_gl2ps_opts;
|
||||
};
|
||||
|
||||
protected:
|
||||
unsigned int GetFileIndex() {
|
||||
if(fResetFileIndex) {fFileIndex = 0;fResetFileIndex = false;}
|
||||
fFileIndex++;
|
||||
return fFileIndex;
|
||||
}
|
||||
|
||||
static bool IsKnownFormat(const std::string& a_format) {
|
||||
if(a_format=="gl2ps_eps") return true;
|
||||
if(a_format=="gl2ps_ps") return true;
|
||||
if(a_format=="gl2ps_pdf") return true;
|
||||
if(a_format=="gl2ps_svg") return true;
|
||||
if(a_format=="gl2ps_tex") return true;
|
||||
if(a_format=="gl2ps_pgf") return true;
|
||||
if(a_format=="zb_ps") return true;
|
||||
if(a_format=="zb_png") return true;
|
||||
if(a_format=="zb_jpeg") return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool GetFormatExtension(const std::string& a_format,std::string& a_ext) {
|
||||
if(a_format=="gl2ps_eps") {a_ext = "eps";return true;}
|
||||
if(a_format=="gl2ps_ps") {a_ext = "ps";return true;}
|
||||
if(a_format=="gl2ps_pdf") {a_ext = "pdf";return true;}
|
||||
if(a_format=="gl2ps_svg") {a_ext = "svg";return true;}
|
||||
if(a_format=="gl2ps_tex") {a_ext = "tex";return true;}
|
||||
if(a_format=="gl2ps_pgf") {a_ext = "pgf";return true;}
|
||||
if(a_format=="zb_ps") {a_ext = "ps";return true;}
|
||||
if(a_format=="zb_png") {a_ext = "png";return true;}
|
||||
if(a_format=="zb_jpeg") {a_ext = "jpeg";return true;}
|
||||
a_ext.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
std::string fFileName;
|
||||
std::string fFilePrefix;
|
||||
unsigned int fFileIndex;
|
||||
bool fResetFileIndex;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -34,6 +34,9 @@
|
||||
#include "G4Scene.hh"
|
||||
#include "G4VVisCommand.hh"
|
||||
|
||||
#include <tools/fpng>
|
||||
#include <tools/toojpeg>
|
||||
|
||||
#include <tools/sg/device_interactor>
|
||||
#include <tools/sg/separator>
|
||||
#include <tools/sg/ortho>
|
||||
@@ -265,7 +268,7 @@ public:
|
||||
CreateSG(_camera,fVP.GetActualLightpointDirection());
|
||||
|
||||
{G4Color background = fVP.GetBackgroundColour ();
|
||||
fSGViewer->set_clear_color(float(background.GetRed()),float(background.GetBlue()),float(background.GetBlue()),1);}
|
||||
fSGViewer->set_clear_color(float(background.GetRed()),float(background.GetGreen()),float(background.GetBlue()),1);}
|
||||
}
|
||||
|
||||
virtual void ClearView() {}
|
||||
@@ -328,58 +331,81 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
G4bool CompareForKernelVisit(G4ViewParameters& lastVP) {
|
||||
// Typical comparison. Taken from OpenGL.
|
||||
G4bool CompareForKernelVisit(G4ViewParameters& vp) {
|
||||
// Typical comparison. Taken from OpenInventor.
|
||||
if (
|
||||
(lastVP.GetDrawingStyle () != fVP.GetDrawingStyle ()) ||
|
||||
(lastVP.GetNumberOfCloudPoints() != fVP.GetNumberOfCloudPoints()) ||
|
||||
(lastVP.IsAuxEdgeVisible () != fVP.IsAuxEdgeVisible ()) ||
|
||||
(lastVP.IsCulling () != fVP.IsCulling ()) ||
|
||||
(lastVP.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
|
||||
(lastVP.IsDensityCulling () != fVP.IsDensityCulling ()) ||
|
||||
(lastVP.IsCullingCovered () != fVP.IsCullingCovered ()) ||
|
||||
(lastVP.GetCBDAlgorithmNumber() !=
|
||||
fVP.GetCBDAlgorithmNumber()) ||
|
||||
(lastVP.IsSection () != fVP.IsSection ()) ||
|
||||
(lastVP.IsCutaway () != fVP.IsCutaway ()) ||
|
||||
(lastVP.IsExplode () != fVP.IsExplode ()) ||
|
||||
(lastVP.GetNoOfSides () != fVP.GetNoOfSides ()) ||
|
||||
(lastVP.GetGlobalMarkerScale() != fVP.GetGlobalMarkerScale()) ||
|
||||
(lastVP.GetGlobalLineWidthScale() != fVP.GetGlobalLineWidthScale()) ||
|
||||
(lastVP.IsMarkerNotHidden () != fVP.IsMarkerNotHidden ()) ||
|
||||
(lastVP.GetDefaultVisAttributes()->GetColour() !=
|
||||
fVP.GetDefaultVisAttributes()->GetColour()) ||
|
||||
(lastVP.GetDefaultTextVisAttributes()->GetColour() !=
|
||||
fVP.GetDefaultTextVisAttributes()->GetColour()) ||
|
||||
(lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())||
|
||||
(lastVP.IsPicking () != fVP.IsPicking ()) ||
|
||||
(lastVP.GetVisAttributesModifiers() !=
|
||||
fVP.GetVisAttributesModifiers()) ||
|
||||
(lastVP.IsSpecialMeshRendering() !=
|
||||
fVP.IsSpecialMeshRendering())
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
(vp.GetDrawingStyle () != fVP.GetDrawingStyle ()) ||
|
||||
(vp.GetNumberOfCloudPoints() != fVP.GetNumberOfCloudPoints()) ||
|
||||
(vp.IsAuxEdgeVisible () != fVP.IsAuxEdgeVisible ()) ||
|
||||
(vp.IsCulling () != fVP.IsCulling ()) ||
|
||||
(vp.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
|
||||
(vp.IsDensityCulling () != fVP.IsDensityCulling ()) ||
|
||||
(vp.IsCullingCovered () != fVP.IsCullingCovered ()) ||
|
||||
(vp.GetCBDAlgorithmNumber() !=
|
||||
fVP.GetCBDAlgorithmNumber()) ||
|
||||
(vp.IsSection () != fVP.IsSection ()) ||
|
||||
(vp.IsCutaway () != fVP.IsCutaway ()) ||
|
||||
// This assumes use of generic clipping (sectioning, slicing,
|
||||
// DCUT, cutaway). If a decision is made to implement locally,
|
||||
// this will need changing. See G4OpenGLViewer::SetView,
|
||||
// G4OpenGLStoredViewer.cc::CompareForKernelVisit and
|
||||
// G4OpenGLStoredSceneHander::CreateSection/CutawayPolyhedron.
|
||||
(vp.IsExplode () != fVP.IsExplode ()) ||
|
||||
(vp.GetNoOfSides () != fVP.GetNoOfSides ()) ||
|
||||
(vp.GetGlobalMarkerScale() != fVP.GetGlobalMarkerScale()) ||
|
||||
(vp.GetGlobalLineWidthScale() != fVP.GetGlobalLineWidthScale()) ||
|
||||
(vp.IsMarkerNotHidden () != fVP.IsMarkerNotHidden ()) ||
|
||||
(vp.GetDefaultVisAttributes()->GetColour() !=
|
||||
fVP.GetDefaultVisAttributes()->GetColour()) ||
|
||||
(vp.GetDefaultTextVisAttributes()->GetColour() !=
|
||||
fVP.GetDefaultTextVisAttributes()->GetColour()) ||
|
||||
(vp.GetBackgroundColour ()!= fVP.GetBackgroundColour ())||
|
||||
(vp.IsPicking () != fVP.IsPicking ()) ||
|
||||
// Scaling for Open Inventor is done by the scene handler so it
|
||||
// needs a kernel visit. (In this respect, it differs from the
|
||||
// OpenGL drivers, where it's done in SetView.)
|
||||
(vp.GetScaleFactor () != fVP.GetScaleFactor ()) ||
|
||||
(vp.GetVisAttributesModifiers() !=
|
||||
fVP.GetVisAttributesModifiers()) ||
|
||||
(vp.IsSpecialMeshRendering() !=
|
||||
fVP.IsSpecialMeshRendering()) ||
|
||||
(vp.GetSpecialMeshRenderingOption() !=
|
||||
fVP.GetSpecialMeshRenderingOption())
|
||||
)
|
||||
return true;
|
||||
|
||||
if (lastVP.IsDensityCulling () &&
|
||||
(lastVP.GetVisibleDensity () != fVP.GetVisibleDensity ())) return true;
|
||||
|
||||
if (lastVP.GetCBDAlgorithmNumber() > 0) {
|
||||
if (lastVP.GetCBDParameters().size() != fVP.GetCBDParameters().size()) return true;
|
||||
else if (lastVP.GetCBDParameters() != fVP.GetCBDParameters()) return true;
|
||||
}
|
||||
|
||||
if (lastVP.IsExplode () &&
|
||||
(lastVP.GetExplodeFactor () != fVP.GetExplodeFactor ()))
|
||||
if (vp.IsDensityCulling () &&
|
||||
(vp.GetVisibleDensity () != fVP.GetVisibleDensity ()))
|
||||
return true;
|
||||
|
||||
if (lastVP.IsSpecialMeshRendering() &&
|
||||
(lastVP.GetSpecialMeshVolumes() != fVP.GetSpecialMeshVolumes()))
|
||||
if (vp.GetCBDAlgorithmNumber() > 0) {
|
||||
if (vp.GetCBDParameters().size() != fVP.GetCBDParameters().size()) return true;
|
||||
else if (vp.GetCBDParameters() != fVP.GetCBDParameters()) return true;
|
||||
}
|
||||
|
||||
if (vp.IsSection () &&
|
||||
(vp.GetSectionPlane () != fVP.GetSectionPlane ()))
|
||||
return true;
|
||||
|
||||
if (vp.IsCutaway ()) {
|
||||
if (vp.GetCutawayMode() != fVP.GetCutawayMode()) return true;
|
||||
if (vp.GetCutawayPlanes ().size () !=
|
||||
fVP.GetCutawayPlanes ().size ()) return true;
|
||||
for (size_t i = 0; i < vp.GetCutawayPlanes().size(); ++i)
|
||||
if (vp.GetCutawayPlanes()[i] != fVP.GetCutawayPlanes()[i])
|
||||
return true;
|
||||
}
|
||||
|
||||
if (vp.IsExplode () &&
|
||||
(vp.GetExplodeFactor () != fVP.GetExplodeFactor ()))
|
||||
return true;
|
||||
|
||||
if (vp.IsSpecialMeshRendering() &&
|
||||
(vp.GetSpecialMeshVolumes() != fVP.GetSpecialMeshVolumes()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// void keyPressEvent (KeyEvent*);
|
||||
// void keyReleaseEvent (KeyEvent*);
|
||||
// void mouseDoubleClickEvent(MouseEvent*);
|
||||
@@ -412,6 +438,8 @@ protected:
|
||||
{tools::sg::torche* light = new tools::sg::torche;
|
||||
light->on = true;
|
||||
light->direction = tools::vec3f(-a_light_dir.x(),-a_light_dir.y(),-a_light_dir.z());
|
||||
light->ambient = tools::colorf(0.2f,0.2f,0.2f,1.0f); //same as in G4OpenGLViewer.cc glLight(GL_LIGHT0,GL_AMBIENT and GL_DIFFUSE).
|
||||
light->color = tools::colorf(0.8f,0.8f,0.8f,1.0f); //idem.
|
||||
scene_3D->add(light);}
|
||||
|
||||
{tools::sg::blend* blend = new tools::sg::blend;
|
||||
@@ -422,13 +450,15 @@ protected:
|
||||
scene_3D->add(new tools::sg::noderef(fSGSceneHandler.GetPersistent3DObjects()));
|
||||
}
|
||||
|
||||
void Export(const G4String& a_format,const G4String& a_file) {
|
||||
void Export(const G4String& a_format,const G4String& a_file,G4bool a_do_transparency) {
|
||||
if(!fSGViewer) return;
|
||||
const G4Colour& back_color = fVP.GetBackgroundColour();
|
||||
if(!write_paper(G4cout,f_gl2ps_mgr,f_zb_mgr,0,0,
|
||||
bool top_to_bottom = false; //if using tools::fpng, tools::toojpeg.
|
||||
if(!tools::sg::write_paper(G4cout,f_gl2ps_mgr,f_zb_mgr,
|
||||
tools::fpng::write,tools::toojpeg::write,
|
||||
float(back_color.GetRed()),float(back_color.GetGreen()),float(back_color.GetBlue()),float(back_color.GetAlpha()),
|
||||
fSGViewer->sg(),
|
||||
fSGViewer->width(),fSGViewer->height(),a_file,a_format)) {
|
||||
fSGViewer->sg(),fSGViewer->width(),fSGViewer->height(),
|
||||
a_file,a_format,a_do_transparency,top_to_bottom,std::string(),std::string())) {
|
||||
G4cout << "G4ToolsSGViewer::Export: write_paper() failed." << G4endl;
|
||||
return;
|
||||
}
|
||||
@@ -454,6 +484,8 @@ protected:
|
||||
write_scene->SetGuidance("- gl2ps_tex: gl2ps producing tex");
|
||||
write_scene->SetGuidance("- gl2ps_pgf: gl2ps producing pgf");
|
||||
write_scene->SetGuidance("- zb_ps: tools::sg offscreen zbuffer put in a PostScript file.");
|
||||
write_scene->SetGuidance("- zb_png: tools::sg offscreen zbuffer put in a png file.");
|
||||
write_scene->SetGuidance("- zb_jpeg: tools::sg offscreen zbuffer put in a jpeg file.");
|
||||
|
||||
parameter = new G4UIparameter("format",'s',true);
|
||||
parameter->SetDefaultValue("gl2ps_eps");
|
||||
@@ -462,6 +494,11 @@ protected:
|
||||
parameter = new G4UIparameter("file",'s',true);
|
||||
parameter->SetDefaultValue("out.eps");
|
||||
write_scene->SetParameter (parameter);
|
||||
|
||||
parameter = new G4UIparameter ("do_transparency", 'b', true);
|
||||
parameter->SetDefaultValue ("true");
|
||||
write_scene->SetParameter (parameter);
|
||||
|
||||
}
|
||||
virtual ~Messenger() {
|
||||
delete write_scene;
|
||||
@@ -484,7 +521,8 @@ protected:
|
||||
tools::double_quotes_tokenize(a_value,args);
|
||||
if(args.size()!=a_cmd->GetParameterEntries()) return;
|
||||
if(a_cmd==write_scene) {
|
||||
tsg_viewer->Export(args[0],args[1]);
|
||||
G4bool do_transparency = G4UIcommand::ConvertToBool(args[2].c_str());
|
||||
tsg_viewer->Export(args[0],args[1],do_transparency);
|
||||
}
|
||||
}
|
||||
private:
|
||||
|
||||
@@ -5,13 +5,14 @@ geant4_add_module(G4ToolsSG
|
||||
G4ToolsSGNode.hh
|
||||
G4ToolsSGSceneHandler.hh
|
||||
G4ToolsSGViewer.hh
|
||||
G4ToolsSGOffscreen.hh
|
||||
G4ToolsSGOffscreenViewer.hh
|
||||
SOURCES
|
||||
G4ToolsSGSceneHandler.cc)
|
||||
G4ToolsSGSceneHandler.cc
|
||||
G4ToolsSGOffscreen.cc)
|
||||
|
||||
geant4_module_link_libraries(G4ToolsSG
|
||||
PUBLIC
|
||||
G4UIbasic
|
||||
G4UIcommon
|
||||
G4intercoms
|
||||
G4modeling
|
||||
G4vis_management
|
||||
@@ -35,6 +36,18 @@ endif()
|
||||
if(GEANT4_USE_TOOLSSG_XT_GLES)
|
||||
geant4_module_sources(G4ToolsSG PUBLIC_HEADERS G4ToolsSGXtGLES.hh SOURCES G4ToolsSGXtGLES.cc)
|
||||
geant4_module_compile_definitions(G4ToolsSG PRIVATE TOOLS_USE_GL_GL_H)
|
||||
|
||||
# A minor hack around a likely issue in geant4_module_link_libraries
|
||||
# When Qt is activated, G4UIcommon is a public dependency. CMake will deduplicate
|
||||
# this (in favour of PUBLIC at final library link time, but geant4_module_link_libraries
|
||||
# does not do this internally yet (To be checked). We then get validation
|
||||
# warnings on duplicated deps. NB: Also demonstrates awkward vis system of more than
|
||||
# one driver per library...
|
||||
if(GEANT4_USE_TOOLSSG_QT_GLES)
|
||||
geant4_module_link_libraries(G4ToolsSG PUBLIC G4UIcommon)
|
||||
else()
|
||||
geant4_module_link_libraries(G4ToolsSG PRIVATE G4UIcommon)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# X11/Xt links if selected
|
||||
@@ -57,7 +70,15 @@ if(GEANT4_USE_TOOLSSG_QT_GLES)
|
||||
G4ToolsSGQtGLES.cc
|
||||
G4ToolsSGQtViewer.cc)
|
||||
|
||||
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)
|
||||
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
|
||||
G4UIbasic
|
||||
G4UIcommon)
|
||||
endif()
|
||||
|
||||
# Windows sources if selected
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 09th June 2022
|
||||
|
||||
#include "G4ToolsSGOffscreen.hh"
|
||||
|
||||
#include "G4ToolsSGOffscreenViewer.hh"
|
||||
|
||||
#include <tools/offscreen/sg_viewer>
|
||||
|
||||
G4ToolsSGOffscreen::G4ToolsSGOffscreen():
|
||||
parent
|
||||
("TOOLSSG_OFFSCREEN",
|
||||
"TSG_OFFSCREEN",
|
||||
"TOOLSSG_OFFSCREEN is a graphics driver based on the g4tools tools/sg scene graph logic where\n\
|
||||
the rendering is done by using various offscreen library as tools/sg/zb, gl2ps, png, jpeg.",
|
||||
parent::threeDInteractive)
|
||||
,fSGSession(nullptr)
|
||||
{}
|
||||
|
||||
G4ToolsSGOffscreen::~G4ToolsSGOffscreen() {
|
||||
delete fSGSession;
|
||||
}
|
||||
|
||||
void G4ToolsSGOffscreen::Initialise() {
|
||||
if(fSGSession) return; //done.
|
||||
fSGSession = new tools::offscreen::session(G4cout);
|
||||
if(!fSGSession->is_valid()) {
|
||||
G4cerr << "G4ToolsSGOffscreen::Initialise : session::is_valid() failed." << G4endl;
|
||||
delete fSGSession;
|
||||
fSGSession = nullptr;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
G4VSceneHandler* G4ToolsSGOffscreen::CreateSceneHandler(const G4String& a_name) {
|
||||
G4VSceneHandler* pScene = new G4ToolsSGSceneHandler(*this,a_name);
|
||||
return pScene;
|
||||
}
|
||||
|
||||
G4VViewer* G4ToolsSGOffscreen::CreateViewer(G4VSceneHandler& a_scene,const G4String& a_name) {
|
||||
if(!fSGSession) Initialise();
|
||||
if(!fSGSession) return nullptr;
|
||||
G4VViewer* pView = new G4ToolsSGOffscreenViewer(*fSGSession,(G4ToolsSGSceneHandler&)a_scene,a_name);
|
||||
if (pView) {
|
||||
if (pView->GetViewId() < 0) {
|
||||
G4cerr <<
|
||||
"G4ToolsSGOffscreen::CreateViewer: ERROR flagged by negative"
|
||||
" view id in G4ToolsSGViewer creation."
|
||||
"\n Destroying view and returning null pointer."
|
||||
<< G4endl;
|
||||
delete pView;
|
||||
pView = nullptr;
|
||||
}
|
||||
}
|
||||
if (!pView) {
|
||||
G4cerr <<
|
||||
"G4ToolsSGOffscreen::CreateViewer: ERROR: null pointer on new G4ToolsSGViewer."
|
||||
<< G4endl;
|
||||
}
|
||||
return pView;
|
||||
}
|
||||
|
||||
G4bool G4ToolsSGOffscreen::IsUISessionCompatible () const
|
||||
{
|
||||
//G4bool isCompatible = true;
|
||||
//return isCompatible;
|
||||
return true;
|
||||
}
|
||||
@@ -174,7 +174,7 @@ tools::sg::separator* G4ToolsSGSceneHandler::GetOrCreateNode()
|
||||
size_t iDepth = 1;
|
||||
while (iDepth < depth) {
|
||||
const auto& children = node->children();
|
||||
const G4int nChildren = children.size();
|
||||
const G4int nChildren = (G4int)children.size();
|
||||
G4int iChild = 0;
|
||||
G4ToolsSGNode* child = nullptr;
|
||||
for (; iChild < nChildren; ++iChild) {
|
||||
|
||||
@@ -4,6 +4,17 @@ 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!
|
||||
|
||||
--------------------------------------------------------------------
|
||||
|
||||
## 2022-11-06 John Allison (vistree-V11-00-02)
|
||||
- Eliminate G4cerr and introduce G4warn.
|
||||
- `#define G4warn G4cout`
|
||||
- The above is temporary until a genuine G4warn output stream is
|
||||
implemented.
|
||||
- Change G4cerr to G4warn in all cases.
|
||||
- Change G4cout to G4warn in those cases where it is clearly
|
||||
an error report or a warning.
|
||||
|
||||
## 2022-01-28 Ben Morgan (vistree-V11-00-01)
|
||||
- Replace `geant4_global_library_target` with direct file inclusion and
|
||||
call to `geant4_add_category` to define library build from source modules.
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include "G4ASCIITreeViewer.hh"
|
||||
#include "G4ASCIITreeMessenger.hh"
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
G4ASCIITree::G4ASCIITree ():
|
||||
G4VTree ("ASCIITree",
|
||||
"ATree",
|
||||
@@ -61,7 +63,7 @@ G4VViewer* G4ASCIITree::CreateViewer (G4VSceneHandler& scene,
|
||||
new G4ASCIITreeViewer ((G4ASCIITreeSceneHandler&) scene, name);
|
||||
if (pView) {
|
||||
if (pView -> GetViewId () < 0) {
|
||||
G4cout << "G4ASCIITree::CreateViewer: ERROR flagged by negative"
|
||||
G4warn << "G4ASCIITree::CreateViewer: ERROR flagged by negative"
|
||||
" view id in G4ASCIITreeViewer creation."
|
||||
"\n Destroying view and returning null pointer."
|
||||
<< G4endl;
|
||||
@@ -70,7 +72,7 @@ G4VViewer* G4ASCIITree::CreateViewer (G4VSceneHandler& scene,
|
||||
}
|
||||
}
|
||||
else {
|
||||
G4cout << "G4ASCIITree::CreateViewer: ERROR: null pointer on"
|
||||
G4warn << "G4ASCIITree::CreateViewer: ERROR: null pointer on"
|
||||
" new G4ASCIITreeViewer." << G4endl;
|
||||
}
|
||||
return pView;
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
G4int G4VTreeSceneHandler::fSceneIdCount = 0;
|
||||
// Counter for Tree scene handlers.
|
||||
|
||||
@@ -100,7 +102,7 @@ void G4VTreeSceneHandler::PreAddSolid
|
||||
// G4PhysicalVolumeModel sends volumes as it encounters them,
|
||||
// i.e., mothers before daughters, in its descent of the
|
||||
// geometry tree. Error!
|
||||
G4cerr << "ERROR: G4VTreeSceneHandler::PreAddSolid: Mother "
|
||||
G4warn << "ERROR: G4VTreeSceneHandler::PreAddSolid: Mother "
|
||||
<< ri->GetPhysicalVolume()->GetName()
|
||||
<< ':' << ri->GetCopyNo()
|
||||
<< " not previously encountered."
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
# Category VRML History
|
||||
|
||||
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!
|
||||
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!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2022-11-25 Gabriele Cosmo (VRML-V11-00-03)
|
||||
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
|
||||
|
||||
## 2022-09-03 Ben Morgan (VRML-V11-00-02)
|
||||
- Remove unused header from G4hepgeometry to make module consistent.
|
||||
|
||||
## 2022-01-28 Ben Morgan (VRML-V11-00-01)
|
||||
- Replace `geant4_global_library_target` with direct file inclusion and
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VisManager.hh"
|
||||
#include "G4Point3D.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4VModel.hh"
|
||||
#include "G4Scene.hh"
|
||||
|
||||
@@ -175,7 +175,7 @@ void G4VRML2SCENEHANDLER::AddPrimitive(const G4Polyline& polyline)
|
||||
fDest << "\t\t\t"
|
||||
<< "point ["
|
||||
<< "\n";
|
||||
G4int e, i;
|
||||
std::size_t e, i;
|
||||
for(i = 0, e = polyline.size(); e; i++, e--)
|
||||
{
|
||||
G4Point3D point = polyline[i];
|
||||
|
||||
@@ -6,6 +6,18 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2022-11-25 Gabriele Cosmo (visVtk-V11-00-07)
|
||||
- Fixed compilation warning for implicit type conversions on macOS/XCode 14.1.
|
||||
|
||||
## 2022-11-14 I. Hrivnacova (visVtk-V11-00-06)
|
||||
- Replaced reinterpret_cast with static_cast where possible
|
||||
|
||||
## 2022-10-10 Igor Semeniouk (visVtk-V11-00-05)
|
||||
- G4VtkViewer.hh : replaced sprintf by snprintf.
|
||||
|
||||
## 2022-09-06 Ben Morgan (visVtk-V11-00-04)
|
||||
- Resolve inconsistencies in module dependencies
|
||||
|
||||
## 2022-03-22 Ben Morgan (visVtk-V11-00-03)
|
||||
- Use geant4_module_sources to add optional sources
|
||||
- Move setting of G4VIS_USE_VTK_QT flag on G4UIcommon module to that module's
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
}
|
||||
virtual void Execute(vtkObject *caller, unsigned long, void*)
|
||||
{
|
||||
vtkRenderer *ren = reinterpret_cast<vtkRenderer *>(caller);
|
||||
vtkRenderer *ren = static_cast<vtkRenderer *>(caller);
|
||||
vtkCamera *cam = ren->GetActiveCamera();
|
||||
//G4cout << cam->GetFocalPoint()[0] << " " << cam->GetFocalPoint()[1] << " " << cam->GetFocalPoint()[2] << G4endl;
|
||||
//
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
|
||||
virtual void Execute(vtkObject *caller, unsigned long, void*)
|
||||
{
|
||||
vtkRenderer *ren = reinterpret_cast<vtkRenderer *>(caller);
|
||||
vtkRenderer *ren = static_cast<vtkRenderer *>(caller);
|
||||
int nActors = ren->GetActors()->GetNumberOfItems();
|
||||
vtkCamera *cam = ren->GetActiveCamera();
|
||||
if(!cam) return;
|
||||
@@ -136,7 +136,8 @@ public:
|
||||
float fps = 1.0/tdiff.count();
|
||||
|
||||
// String for display
|
||||
sprintf(this->TextBuff,"camera position : %.1f %.1f %.1f \n"
|
||||
snprintf(this->TextBuff,sizeof this->TextBuff,
|
||||
"camera position : %.1f %.1f %.1f \n"
|
||||
"camera focal point : %.1f %.1f %.1f \n"
|
||||
"view angle : %.1f\n"
|
||||
"distance : %.1f\n"
|
||||
|
||||
@@ -16,15 +16,16 @@ geant4_add_module(G4visVtk
|
||||
|
||||
geant4_module_link_libraries(G4visVtk
|
||||
PUBLIC
|
||||
G4modeling
|
||||
G4globman
|
||||
G4hepgeometry
|
||||
G4intercoms
|
||||
G4vis_management
|
||||
${VTK_LIBRARIES}
|
||||
PRIVATE
|
||||
G4csg
|
||||
G4geometrymng
|
||||
G4globman
|
||||
G4graphics_reps
|
||||
G4UIbasic
|
||||
G4UIcommon)
|
||||
G4materials
|
||||
G4modeling)
|
||||
|
||||
# - VTK-Qt if Qt enabled
|
||||
if(GEANT4_USE_QT)
|
||||
@@ -37,5 +38,7 @@ if(GEANT4_USE_QT)
|
||||
G4VtkQt.cc
|
||||
G4VtkQtSceneHandler.cc
|
||||
G4VtkQtViewer.cc)
|
||||
|
||||
geant4_module_link_libraries(G4visVtk PRIVATE G4UIbasic G4UIcommon)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ int vtkTensorGlyphColor::RequestData(
|
||||
{
|
||||
cell = this->GetSource()->GetCell(cellId);
|
||||
cellPts = cell->GetPointIds();
|
||||
npts = cellPts->GetNumberOfIds();
|
||||
npts = (int)cellPts->GetNumberOfIds();
|
||||
for (dir=0; dir < numDirs; dir++)
|
||||
{
|
||||
// This variable may be removed, but that
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
# - gl2ps only needed if OGL drivers enabled
|
||||
if(GEANT4_USE_OPENGL OR GEANT4_USE_INVENTOR)
|
||||
add_subdirectory(gl2ps)
|
||||
endif()
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
# --------------------------------------------------------------
|
||||
# GNUmakefile for externals library.
|
||||
# --------------------------------------------------------------
|
||||
|
||||
include $(G4INSTALL)/config/globlib.gmk
|
||||
-51
@@ -1,51 +0,0 @@
|
||||
# Category visexternals History
|
||||
|
||||
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!
|
||||
|
||||
|
||||
## 2022-02-01 John Allison (visexternals-V11-00-01)
|
||||
- gl2ps.cc: Fix Coverity warnings.
|
||||
|
||||
## 2021-12-10 Ben Morgan (visexternals-V11-00-00)
|
||||
- Change to new Markdown History format
|
||||
|
||||
---
|
||||
|
||||
# History entries prior to 11.0
|
||||
|
||||
18 August 2021 Laurent Garnier (visexternals-V10-07-04)
|
||||
- Fix issues with GL lib when building X11 AND Qt. GL libs should be include only once
|
||||
|
||||
18 August 2021 Laurent Garnier (visexternals-V10-07-03)
|
||||
- Fix issues in PDF generation due to remplacement by DBL_MAX introduced in visexternals-V10-07-02
|
||||
|
||||
06 August 2021 Laurent Garnier (visexternals-V10-07-02)
|
||||
- Migrate gl2ps to 1.4.2
|
||||
- Patch lines:
|
||||
4452-4495-4520: Replace ~1UL by DBL_MAX
|
||||
4133: Add break statement
|
||||
|
||||
14 April 2021 Ben Morgan (visexternals-V10-07-01)
|
||||
- Migrate gl2ps build to modular CMake system
|
||||
|
||||
05 March 20201 John Allison (visexternals-V10-07-00)
|
||||
- gl2ps.h: Allow use of non-APPLE OpenGL on APPLE.
|
||||
o To use this, build with cpp macro GL2PS_USE_GL_GL_H.
|
||||
|
||||
01 July 2020 John Allison (visexternals-V10-06-01)
|
||||
- gl2ps.cc: Fix Coverity warning.
|
||||
|
||||
12th December 2019 Ben Morgan (visexternals-V10-06-00)
|
||||
- visexternalgl2ps-V10-06-00: Remove no longer required dependence on OpenGLU
|
||||
|
||||
20 February 2019 Ben Morgan (visexternals-V10-05-00)
|
||||
- visexternalgl2ps-V10-05-00: Add include path for generated G4GlobalConfig.hh
|
||||
|
||||
28 May 2018 Gabriele Cosmo (visexternals-V10-04-01)
|
||||
- visexternalgl2ps-V10-04-01: Corrected GNUmakefile, now requiring dependency
|
||||
on global module.
|
||||
|
||||
26 May 2018 John Allison (visexternals-V10-04-00)
|
||||
- visexternalgl2ps-V10-04-00: Fix gcc-8 warnings.
|
||||
@@ -1,3 +0,0 @@
|
||||
# - G4gl2ps category build
|
||||
include(sources.cmake)
|
||||
geant4_add_category(G4gl2ps MODULES G4gl2ps)
|
||||
@@ -1,31 +0,0 @@
|
||||
# -------------------------------------------------------------
|
||||
# GNUmakefile for gl2ps. Laurent Garnier, 6/2/09.
|
||||
|
||||
name := G4gl2ps
|
||||
|
||||
# For debug mode
|
||||
# CPPFLAGS += -DG4DEBUG_VIS_GL2PS
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../../..
|
||||
endif
|
||||
|
||||
ifdef G4LIB_BUILD_ZLIB
|
||||
GLOBLIBS = libG4zlib.lib
|
||||
endif
|
||||
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
include $(G4INSTALL)/config/G4VIS_BUILD.gmk
|
||||
include $(G4INSTALL)/config/interactivity.gmk
|
||||
|
||||
# NO need QT, then reset QTGLAGS
|
||||
QTFLAGS =
|
||||
QTLIBS =
|
||||
GLQTLIBS =
|
||||
|
||||
CPPFLAGS += -I$(G4BASE)/global/management/include
|
||||
ifdef G4LIB_BUILD_ZLIB
|
||||
CPPFLAGS += -I$(G4BASE)/externals/zlib/include
|
||||
endif
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
-212
@@ -1,212 +0,0 @@
|
||||
# Category visexternalsgl2ps History
|
||||
|
||||
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!
|
||||
|
||||
## 2022-01-28 Ben Morgan (visexternalsgl2ps-V11-00-01))
|
||||
- Replace `geant4_global_library_target` with direct file inclusion and
|
||||
call to `geant4_add_category` to define library build from source modules.
|
||||
|
||||
## 2021-12-10 Ben Morgan (visexternalsgl2ps-V11-00-00)
|
||||
- Change to new Markdown History format
|
||||
|
||||
---
|
||||
|
||||
# History entries prior to 11.0
|
||||
|
||||
12 November 2021 Ben Morgan (visexternalsgl2ps-V10-07-01)
|
||||
- Retire G4VIS_... preprocessor symbols in toolkit build, only required
|
||||
by obsolete GNUmake system
|
||||
|
||||
15 July 2021 Laurent Garnier (visexternalsgl2ps-V10-07-00)
|
||||
- Migrate gl2ps to 1.4.2
|
||||
|
||||
23 September 2020 Ben Morgan (visexternalsgl2ps-V10-06-03)
|
||||
- Remove remianing include_directories
|
||||
|
||||
28 August 2020 Ben Morgan (visexternalsgl2ps-V10-06-02)
|
||||
- Link to XQuartz GL when we are on macOS and building X11 drivers
|
||||
|
||||
29 April 2020 Gunter Folger (visexternalgl2ps-V10-06-01)
|
||||
- (trivial) fix for clang10. Affects src/gl2ps.cc
|
||||
|
||||
12th December 2019 Ben Morgan (visexternalgl2ps-V10-06-00)
|
||||
- Remove no longer required dependence on OpenGLU
|
||||
|
||||
23rd October 2019 Ben Morgan (visexternalgl2ps-V10-05-03)
|
||||
- Only link to imported targets for OpenGL
|
||||
- Explicitly link to G4globman/G4global to use/propagate usage requirements.
|
||||
|
||||
17 September 2019 Laurent Garnier (visexternalgl2ps-V10-05-02)
|
||||
- gl2ps.cc: fix Continous warnings
|
||||
|
||||
17 September 2019 Laurent Garnier (visexternalgl2ps-V10-05-01)
|
||||
- gl2ps.cc gl2ps.h: Update library to 1.4.0 applying Geant4 patches
|
||||
|
||||
20 February 2019 Ben Morgan (visexternalgl2ps-V10-05-00)
|
||||
- Add include path for generated G4GlobalConfig.hh
|
||||
|
||||
28 May 2018 Gabriele Cosmo (visexternalgl2ps-V10-04-01)
|
||||
- Corrected GNUmakefile, now requiring dependency on global module.
|
||||
|
||||
26 May 2018 John Allison (visexternalgl2ps-V10-04-00)
|
||||
- Fix gcc-8 warnings.
|
||||
|
||||
23rd May 2017 John Allison (visexternal-V10-03-00)
|
||||
- Fix gcc-7.1 warning.
|
||||
|
||||
6th November 2016 Laurent Garnier (visexternal-V10-02-03)
|
||||
- Fix a CDash warning in gl2ps
|
||||
|
||||
3 February 2015 John Allison (visexternal-V10-01-02)
|
||||
- Corrected cast to GLint in G4OpenGLAction for compilation on Windows.
|
||||
|
||||
19 December 2014 John Allison (visexternal-V10-01-01)
|
||||
- Tagged.
|
||||
|
||||
18 December 2014 Frederick Jones
|
||||
- G4OpenGL2PSAction: added method setBufferSize()
|
||||
|
||||
30th October 2014 Laurent Garnier (visexternal-V10-00-03)
|
||||
- Tagged
|
||||
|
||||
1st October 2014 Laurent Garnier
|
||||
- Geant4_gl2ps : Minor change for OpenGL2
|
||||
|
||||
2nd July 2014 Laurent Garnier (visexternal-V10-00-02)
|
||||
- Retagged
|
||||
|
||||
2nd July 2014 Laurent Garnier (visexternal-V10-00-01)
|
||||
- add setExportImageFormat(format) method
|
||||
- change default options for generation gl2ps files
|
||||
o allow transparency on volumes (for pdf)
|
||||
|
||||
8th April 2014 Laurent Garnier (visexternal-V10-00-00)
|
||||
- Fix a bad text in G4OpenGL2PSAction
|
||||
|
||||
20th Sept 2013 Laurent Garnier
|
||||
- add #ifdef statement in in gl2ps.h to prevent having gl2ps AND Wt driver
|
||||
|
||||
3rd June 2013 John Allison (visexternal-V09-06-04)
|
||||
- G4OpenGL2PSAction.cc: One more try at compiling on WindowsâŠ
|
||||
o Added brackets to prevent possible macro expansion of "max":
|
||||
fBufferSizeLimit = (std::numeric_limits<GLint>::max)();
|
||||
|
||||
2nd June 2013 John Allison (visexternal-V09-06-03)
|
||||
- G4OpenGL2PSAction.cc: Added #include <cstdlib> and <cstring>.
|
||||
|
||||
30th May 2013 John Allison (visexternal-V09-06-02)
|
||||
- G4OpenGL2PSAction.cc: Added #include <limits>.
|
||||
|
||||
22nd May 2013 Laurent Garnier
|
||||
- sources.cmake: Add missing include for "global/management"
|
||||
- G4OpenGL2PSAction.cc :
|
||||
o Fix another memory leak for aFileName, perhaps the same as
|
||||
bugzilla #1469 ? It happens on big scenes when extendBufferSize was called.
|
||||
o replace the use of INT_MAX by std::numeric_limits<GLint>::max()
|
||||
|
||||
21st May 2013 Laurent Garnier
|
||||
- G4OpenGL2PSAction.cc : Replace "limits.h" by "global.hh"
|
||||
|
||||
17th May 2013 Laurent Garnier
|
||||
- G4OpenGL2PSAction.cc : Try to fix bugzilla #1469
|
||||
replace the flushing output by a immediate I/O File :
|
||||
setvbuf ( fFile , NULL , _IONBF , 2048 );
|
||||
|
||||
26th March 2013 Ben Morgan (visexternal-V09-06-01)
|
||||
- source.cmake : Update include paths/library links to use new ZLIB
|
||||
variables for transparent use of internal/external zlib.
|
||||
|
||||
21st October 2013 Gabriele Cosmo (visexternal-V09-06-00)
|
||||
- Moved G4zlib package to source/externals; updated configuration
|
||||
accordingly.
|
||||
|
||||
26th October 2012 Laurent Garnier (visexternal-V09-04-04 and visexternal-V09-04-05)
|
||||
- gl2ps.cc : Remove create date in eps files (very useful to be able to compare them)
|
||||
|
||||
10th November 2011 Laurent Garnier (visexternal-V09-04-03)
|
||||
- G4OpenGL2PSAction : Back to old buffer size (cause sometime problems
|
||||
on Qt viewer)
|
||||
|
||||
9th November 2011 Laurent Garnier
|
||||
- G4OpenGL2PSAction : Best control on G4gl2psBeginPage
|
||||
|
||||
21st October 2011 John Allison (visexternal-V09-04-02)
|
||||
- Tagged.
|
||||
|
||||
21th October 2011 Laurent Garnier
|
||||
- G4OpenGL2PSAction : Reset fFile after use, force wb writing
|
||||
|
||||
20th October 2011 L.Garnier
|
||||
- Add methods to extend buffer size up to a limit if needed
|
||||
|
||||
27th January 2011 L.Garnier
|
||||
- Restored GNUmakefile and fix the bug introduce the 23th december
|
||||
|
||||
26th January 2011 Gabriele Cosmo (visexternal-V09-04-01)
|
||||
- Restored GNUmakefile as it was in tag "visexternal-V09-03-03", as it
|
||||
breaks compilation !
|
||||
|
||||
27th December 2010 John Allison (visexternal-V09-04-00)
|
||||
- Tagged.
|
||||
|
||||
23, December L. Garnier
|
||||
- GNUmakefile : Remove Qt stuff from Makefile
|
||||
|
||||
13th November 2010, John Allison (visexternal-V09-03-03)
|
||||
- Geant4_gl2ps.h: Added #ifdef _WIN32, #define _USE_MATH_DEFINE.
|
||||
|
||||
5th November 2010, John Allison (visexternal-V09-03-02)
|
||||
- Fixed Linux warnings.
|
||||
|
||||
5th November 2010, John Allison (visexternal-V09-03-01)
|
||||
- Tagged.
|
||||
|
||||
3rd November 2010, Laurent Garnier
|
||||
- Update gl2ps to 1.3.5 (before it was 1.3.3)
|
||||
|
||||
6th October 2010, John Allison (visexternal-V09-03-00)
|
||||
- Tagged.
|
||||
|
||||
26th April 2010, Laurent Garnier
|
||||
- G4OpenGL2PSAction : add new method to set viewport
|
||||
|
||||
18 Nov 2009, Gabriele Cosmo (visexternal-V09-02-06)
|
||||
- Added GLOBLIBS dependencies to GNUmakefile to allow for building
|
||||
DLLs on Windows. Removed redundant CPPFLAGS addition.
|
||||
- Re-instated fix to gl2ps.cc.
|
||||
|
||||
17 Nov 2009, John Allison, Gabriele Cosmo (visexternal-V09-02-05)
|
||||
- Added dependency on zlib if G4LIB_BUILD_ZLIB is set and corrected
|
||||
inclusion of zlib.h in gl2ps.cc
|
||||
|
||||
2 Nov 2009, Laurent Garnier
|
||||
- Add debug flag in GNUMakefile
|
||||
|
||||
29 April 2009, Laurent Garnier (visexternal-V09-02-04)
|
||||
- G4OpenGL2PSAction : Fix a circular dependency to G4OpenGL on Linux
|
||||
|
||||
27 April 2009, Laurent Garnier (visexternal-V09-02-03)
|
||||
- gl2ps/src/gl2ps.cc : Fix some warnings on Linux
|
||||
|
||||
8 April 2009, Laurent Garnier
|
||||
- gl2ps/include/G4OpenGL2PSAction.hh : Add missing header methods(forgot
|
||||
in visexternal-V09-02-02 tag
|
||||
- gl2ps/include/G4OpenGL2PSAction.hh : Add cvsID at head of file
|
||||
|
||||
6 April 2009, Laurent Garnier (visexternal-V09-02-02)
|
||||
- Adjustments to point and line size
|
||||
|
||||
19 March 2009, Laurent Garnier (visexternal-V09-02-01)
|
||||
- Add methods to change GL_Point and GL_Line size
|
||||
|
||||
4 March 2009, Laurent Garnier
|
||||
- Update gl2ps to 1.3.3 version (before it was 0.8)
|
||||
|
||||
16 February 2009, Laurent Garnier
|
||||
- Creation of this library in order to have a gl2ps for all viewers.
|
||||
- Copying gl2ps.cc and gl2ps.h files form OpenInventor/src
|
||||
- Add a new file G4OpenGL2PSAction.cc to be on the top of gl2ps
|
||||
external package. This file will be heritate/used by viewers
|
||||
in order to have gl2ps render.
|
||||
@@ -1,240 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#ifndef Geant4_gl2ps_h
|
||||
#define Geant4_gl2ps_h
|
||||
|
||||
// gl2ps-1.3.5
|
||||
// The gl2ps code is prefixed by Geant4_ in order
|
||||
// to avoid clashes with other gl2ps code that may come at link
|
||||
// time from other channels.
|
||||
|
||||
#define gl2psBeginPage Geant4_gl2psBeginPage
|
||||
#define gl2psEndPage Geant4_gl2psEndPage
|
||||
#define gl2psText Geant4_gl2psText
|
||||
#define gl2psEnable Geant4_gl2psEnable
|
||||
#define gl2psDisable Geant4_gl2psDisable
|
||||
#define gl2psPointSize Geant4_gl2psPointSize
|
||||
#define gl2psLineWidth Geant4_gl2psLineWidth
|
||||
#define gl2psDrawPixels Geant4_gl2psDrawPixels
|
||||
#define gl2psBeginViewport Geant4_gl2psBeginViewport
|
||||
#define gl2psEndViewport Geant4_gl2psEndViewport
|
||||
#define gl2psTextOpt Geant4_gl2psTextOpt
|
||||
#define gl2psSetOptions Geant4_gl2psSetOptions
|
||||
#define gl2psGetOptions Geant4_gl2psGetOptions
|
||||
#define gl2psSpecial Geant4_gl2psSpecial
|
||||
#define gl2psBlendFunc Geant4_gl2psBlendFunc
|
||||
#define gl2psDrawImageMap Geant4_gl2psDrawImageMap
|
||||
#define gl2psGetFileExtension Geant4_gl2psGetFileExtension
|
||||
#define gl2psGetFormatDescription Geant4_gl2psGetFormatDescription
|
||||
|
||||
#define gl2psMsg Geant4_gl2psMsg
|
||||
#define gl2psMalloc Geant4_gl2psMalloc
|
||||
#define gl2psRealloc Geant4_gl2psRealloc
|
||||
#define gl2psFree Geant4_gl2psFree
|
||||
#define gl2psWriteBigEndian Geant4_gl2psWriteBigEndian
|
||||
#define gl2psSetupCompress Geant4_gl2psSetupCompress
|
||||
#define gl2psFreeCompress Geant4_gl2psFreeCompress
|
||||
#define gl2psAllocCompress Geant4_gl2psAllocCompress
|
||||
#define gl2psReallocCompress Geant4_gl2psReallocCompress
|
||||
#define gl2psWriteBigEndianCompress Geant4_gl2psWriteBigEndianCompress
|
||||
#define gl2psDeflate Geant4_gl2psDeflate
|
||||
#define gl2psPrintf Geant4_gl2psPrintf
|
||||
#define gl2psPrintGzipHeader Geant4_gl2psPrintGzipHeader
|
||||
#define gl2psPrintGzipFooter Geant4_gl2psPrintGzipFooter
|
||||
#define gl2psListReset Geant4_gl2psListReset
|
||||
#define gl2psListRealloc Geant4_gl2psListRealloc
|
||||
#define gl2psListCreate Geant4_gl2psListCreate
|
||||
#define gl2psListDelete Geant4_gl2psListDelete
|
||||
#define gl2psListAdd Geant4_gl2psListAdd
|
||||
#define gl2psListNbr Geant4_gl2psListNbr
|
||||
#define gl2psListPointer Geant4_gl2psListPointer
|
||||
#define gl2psListSort Geant4_gl2psListSort
|
||||
#define gl2psListAction Geant4_gl2psListAction
|
||||
#define gl2psListActionInverse Geant4_gl2psListActionInverse
|
||||
#define gl2psListRead Geant4_gl2psListRead
|
||||
#define gl2psEncodeBase64Block Geant4_gl2psEncodeBase64Block
|
||||
#define gl2psListEncodeBase64 Geant4_gl2psListEncodeBase64
|
||||
#define gl2psSameColor Geant4_gl2psSameColor
|
||||
#define gl2psVertsSameColor Geant4_gl2psVertsSameColor
|
||||
#define gl2psSameColorThreshold Geant4_gl2psSameColorThreshold
|
||||
#define gl2psSetLastColor Geant4_gl2psSetLastColor
|
||||
#define gl2psGetRGB Geant4_gl2psGetRGB
|
||||
#define gl2psCopyPixmap Geant4_gl2psCopyPixmap
|
||||
#define gl2psFreePixmap Geant4_gl2psFreePixmap
|
||||
#define gl2psUserWritePNG Geant4_gl2psUserWritePNG
|
||||
#define gl2psUserFlushPNG Geant4_gl2psUserFlushPNG
|
||||
#define gl2psConvertPixmapToPNG Geant4_gl2psConvertPixmapToPNG
|
||||
#define gl2psAddText Geant4_gl2psAddText
|
||||
#define gl2psCopyText Geant4_gl2psCopyText
|
||||
#define gl2psFreeText Geant4_gl2psFreeText
|
||||
#define gl2psSupportedBlendMode Geant4_gl2psSupportedBlendMode
|
||||
#define gl2psAdaptVertexForBlending Geant4_gl2psAdaptVertexForBlending
|
||||
#define gl2psAssignTriangleProperties Geant4_gl2psAssignTriangleProperties
|
||||
#define gl2psFillTriangleFromPrimitive Geant4_gl2psFillTriangleFromPrimitive
|
||||
#define gl2psInitTriangle Geant4_gl2psInitTriangle
|
||||
#define gl2psCopyPrimitive Geant4_gl2psCopyPrimitive
|
||||
#define gl2psSamePosition Geant4_gl2psSamePosition
|
||||
#define gl2psComparePointPlane Geant4_gl2psComparePointPlane
|
||||
#define gl2psPsca Geant4_gl2psPsca
|
||||
#define gl2psPvec Geant4_gl2psPvec
|
||||
#define gl2psNorm Geant4_gl2psNorm
|
||||
#define gl2psGetNormal Geant4_gl2psGetNormal
|
||||
#define gl2psGetPlane Geant4_gl2psGetPlane
|
||||
#define gl2psCutEdge Geant4_gl2psCutEdge
|
||||
#define gl2psCreateSplitPrimitive Geant4_gl2psCreateSplitPrimitive
|
||||
#define gl2psAddIndex Geant4_gl2psAddIndex
|
||||
#define gl2psGetIndex Geant4_gl2psGetIndex
|
||||
#define gl2psTestSplitPrimitive Geant4_gl2psTestSplitPrimitive
|
||||
#define gl2psSplitPrimitive Geant4_gl2psSplitPrimitive
|
||||
#define gl2psDivideQuad Geant4_gl2psDivideQuad
|
||||
#define gl2psCompareDepth Geant4_gl2psCompareDepth
|
||||
#define gl2psTrianglesFirst Geant4_gl2psTrianglesFirst
|
||||
#define gl2psFindRoot Geant4_gl2psFindRoot
|
||||
#define gl2psFreeImagemap Geant4_gl2psFreeImagemap
|
||||
#define gl2psFreePrimitive Geant4_gl2psFreePrimitive
|
||||
#define gl2psAddPrimitiveInList Geant4_gl2psAddPrimitiveInList
|
||||
#define gl2psFreeBspTree Geant4_gl2psFreeBspTree
|
||||
#define gl2psGreater Geant4_gl2psGreater
|
||||
#define gl2psLess Geant4_gl2psLess
|
||||
#define gl2psBuildBspTree Geant4_gl2psBuildBspTree
|
||||
#define gl2psTraverseBspTree Geant4_gl2psTraverseBspTree
|
||||
#define gl2psRescaleAndOffset Geant4_gl2psRescaleAndOffset
|
||||
#define gl2psGetPlaneFromPoints Geant4_gl2psGetPlaneFromPoints
|
||||
#define gl2psFreeBspImageTree Geant4_gl2psFreeBspImageTree
|
||||
#define gl2psCheckPoint Geant4_gl2psCheckPoint
|
||||
#define gl2psAddPlanesInBspTreeImage Geant4_gl2psAddPlanesInBspTreeImage
|
||||
#define gl2psCheckPrimitive Geant4_gl2psCheckPrimitive
|
||||
#define gl2psCreateSplitPrimitive2D Geant4_gl2psCreateSplitPrimitive2D
|
||||
#define gl2psSplitPrimitive2D Geant4_gl2psSplitPrimitive2D
|
||||
#define gl2psAddInImageTree Geant4_gl2psAddInImageTree
|
||||
#define gl2psAddInBspImageTree Geant4_gl2psAddInBspImageTree
|
||||
#define gl2psAddBoundaryInList Geant4_gl2psAddBoundaryInList
|
||||
#define gl2psBuildPolygonBoundary Geant4_gl2psBuildPolygonBoundary
|
||||
#define gl2psAddPolyPrimitive Geant4_gl2psAddPolyPrimitive
|
||||
#define gl2psGetVertex Geant4_gl2psGetVertex
|
||||
#define gl2psParseFeedbackBuffer Geant4_gl2psParseFeedbackBuffer
|
||||
#define gl2psWriteByte Geant4_gl2psWriteByte
|
||||
#define gl2psPrintPostScriptPixmap Geant4_gl2psPrintPostScriptPixmap
|
||||
#define gl2psPrintPostScriptImagemap Geant4_gl2psPrintPostScriptImagemap
|
||||
#define gl2psPrintPostScriptHeader Geant4_gl2psPrintPostScriptHeader
|
||||
#define gl2psPrintPostScriptColor Geant4_gl2psPrintPostScriptColor
|
||||
#define gl2psResetPostScriptColor Geant4_gl2psResetPostScriptColor
|
||||
#define gl2psEndPostScriptLine Geant4_gl2psEndPostScriptLine
|
||||
#define gl2psParseStipplePattern Geant4_gl2psParseStipplePattern
|
||||
#define gl2psPrintPostScriptDash Geant4_gl2psPrintPostScriptDash
|
||||
#define gl2psPrintPostScriptPrimitive Geant4_gl2psPrintPostScriptPrimitive
|
||||
#define gl2psPrintPostScriptFooter Geant4_gl2psPrintPostScriptFooter
|
||||
#define gl2psPrintTeXHeader Geant4_gl2psPrintTeXHeader
|
||||
#define gl2psPrintTeXPrimitive Geant4_gl2psPrintTeXPrimitive
|
||||
#define gl2psPrintTeXFooter Geant4_gl2psPrintTeXFooter
|
||||
|
||||
#define gl2psPrintPostScriptBeginViewport Geant4_gl2psPrintPostScriptBeginViewport
|
||||
#define gl2psPrintPostScriptEndViewport Geant4_gl2psPrintPostScriptEndViewport
|
||||
|
||||
#define gl2psPrintPostScriptFinalPrimitive Geant4_gl2psPrintPostScriptFinalPrimitive
|
||||
#define gl2psPrintPrimitives Geant4_gl2psPrintPrimitives
|
||||
#define gl2psPrintTeXBeginViewport Geant4_gl2psPrintTeXBeginViewport
|
||||
#define gl2psPrintTeXEndViewport Geant4_gl2psPrintTeXEndViewport
|
||||
#define gl2psPrintTeXFinalPrimitive Geant4_gl2psPrintTeXFinalPrimitive
|
||||
#define gl2psPrintPDFCompressorType Geant4_gl2psPrintPDFCompressorType
|
||||
#define gl2psPrintPDFStrokeColor Geant4_gl2psPrintPDFStrokeColor
|
||||
#define gl2psPrintPDFFillColor Geant4_gl2psPrintPDFFillColor
|
||||
#define gl2psPrintPDFLineWidth Geant4_gl2psPrintPDFLineWidth
|
||||
#define gl2psPutPDFText Geant4_gl2psPutPDFText
|
||||
#define gl2psPutPDFImage Geant4_gl2psPutPDFImage
|
||||
#define gl2psPDFstacksInit Geant4_gl2psPDFstacksInit
|
||||
#define gl2psPDFgroupObjectInit Geant4_gl2psPDFgroupObjectInit
|
||||
#define gl2psPDFgroupListInit Geant4_gl2psPDFgroupListInit
|
||||
#define gl2psSortOutTrianglePDFgroup Geant4_gl2psSortOutTrianglePDFgroup
|
||||
#define gl2psPDFgroupListWriteMainStream Geant4_gl2psPDFgroupListWriteMainStream
|
||||
#define gl2psPDFgroupListWriteGStateResources Geant4_gl2psPDFgroupListWriteGStateResources
|
||||
#define gl2psPDFgroupListWriteShaderResources Geant4_gl2psPDFgroupListWriteShaderResources
|
||||
#define gl2psPDFgroupListWriteXObjectResources Geant4_gl2psPDFgroupListWriteXObjectResources
|
||||
#define gl2psPDFgroupListWriteFontResources Geant4_gl2psPDFgroupListWriteFontResources
|
||||
#define gl2psPDFgroupListDelete Geant4_gl2psPDFgroupListDelete
|
||||
#define gl2psPrintPDFInfo Geant4_gl2psPrintPDFInfo
|
||||
#define gl2psPrintPDFCatalog Geant4_gl2psPrintPDFCatalog
|
||||
#define gl2psPrintPDFPages Geant4_gl2psPrintPDFPages
|
||||
#define gl2psOpenPDFDataStream Geant4_gl2psOpenPDFDataStream
|
||||
#define gl2psOpenPDFDataStreamWritePreface Geant4_gl2psOpenPDFDataStreamWritePreface
|
||||
#define gl2psPrintPDFHeader Geant4_gl2psPrintPDFHeader
|
||||
#define gl2psPrintPDFPrimitive Geant4_gl2psPrintPDFPrimitive
|
||||
#define gl2psClosePDFDataStream Geant4_gl2psClosePDFDataStream
|
||||
#define gl2psPrintPDFDataStreamLength Geant4_gl2psPrintPDFDataStreamLength
|
||||
#define gl2psPrintPDFOpenPage Geant4_gl2psPrintPDFOpenPage
|
||||
#define gl2psPDFgroupListWriteVariableResources Geant4_gl2psPDFgroupListWriteVariableResources
|
||||
#define gl2psPrintPDFGSObject Geant4_gl2psPrintPDFGSObject
|
||||
#define gl2psPrintPDFShaderStreamDataCoord Geant4_gl2psPrintPDFShaderStreamDataCoord
|
||||
#define gl2psPrintPDFShaderStreamDataRGB Geant4_gl2psPrintPDFShaderStreamDataRGB
|
||||
#define gl2psPrintPDFShaderStreamDataAlpha Geant4_gl2psPrintPDFShaderStreamDataAlpha
|
||||
#define gl2psPrintPDFShaderStreamData Geant4_gl2psPrintPDFShaderStreamData
|
||||
#define gl2psPDFRectHull Geant4_gl2psPDFRectHull
|
||||
#define gl2psPrintPDFShader Geant4_gl2psPrintPDFShader
|
||||
#define gl2psPrintPDFShaderMask Geant4_gl2psPrintPDFShaderMask
|
||||
#define gl2psPrintPDFShaderExtGS Geant4_gl2psPrintPDFShaderExtGS
|
||||
#define gl2psPrintPDFShaderSimpleExtGS Geant4_gl2psPrintPDFShaderSimpleExtGS
|
||||
#define gl2psPrintPDFPixmapStreamData Geant4_gl2psPrintPDFPixmapStreamData
|
||||
#define gl2psPrintPDFPixmap Geant4_gl2psPrintPDFPixmap
|
||||
#define gl2psPrintPDFText Geant4_gl2psPrintPDFText
|
||||
#define gl2psPDFgroupListWriteObjects Geant4_gl2psPDFgroupListWriteObjects
|
||||
#define gl2psPrintPDFFooter Geant4_gl2psPrintPDFFooter
|
||||
#define gl2psPrintPDFBeginViewport Geant4_gl2psPrintPDFBeginViewport
|
||||
#define gl2psPrintPDFEndViewport Geant4_gl2psPrintPDFEndViewport
|
||||
#define gl2psPrintPDFFinalPrimitive Geant4_gl2psPrintPDFFinalPrimitive
|
||||
#define gl2psSVGGetCoordsAndColors Geant4_gl2psSVGGetCoordsAndColors
|
||||
#define gl2psSVGGetColorString Geant4_gl2psSVGGetColorString
|
||||
#define gl2psPrintSVGHeader Geant4_gl2psPrintSVGHeader
|
||||
#define gl2psPrintSVGSmoothTriangle Geant4_gl2psPrintSVGSmoothTriangle
|
||||
#define gl2psPrintSVGDash Geant4_gl2psPrintSVGDash
|
||||
#define gl2psEndSVGLine Geant4_gl2psEndSVGLine
|
||||
#define gl2psPrintSVGPixmap Geant4_gl2psPrintSVGPixmap
|
||||
#define gl2psPrintSVGPrimitive Geant4_gl2psPrintSVGPrimitive
|
||||
#define gl2psPrintSVGFooter Geant4_gl2psPrintSVGFooter
|
||||
#define gl2psPrintSVGBeginViewport Geant4_gl2psPrintSVGBeginViewport
|
||||
#define gl2psPrintSVGEndViewport Geant4_gl2psPrintSVGEndViewport
|
||||
#define gl2psPrintSVGFinalPrimitive Geant4_gl2psPrintSVGFinalPrimitive
|
||||
#define gl2psPrintPGFColor Geant4_gl2psPrintPGFColor
|
||||
#define gl2psPrintPGFHeader Geant4_gl2psPrintPGFHeader
|
||||
#define gl2psPrintPGFDash Geant4_gl2psPrintPGFDash
|
||||
#define gl2psPGFTextAlignment Geant4_gl2psPGFTextAlignment
|
||||
#define gl2psPrintPGFPrimitive Geant4_gl2psPrintPGFPrimitive
|
||||
#define gl2psPrintPGFFooter Geant4_gl2psPrintPGFFooter
|
||||
#define gl2psPrintPGFBeginViewport Geant4_gl2psPrintPGFBeginViewport
|
||||
#define gl2psPrintPGFEndViewport Geant4_gl2psPrintPGFEndViewport
|
||||
#define gl2psPrintPGFFinalPrimitive Geant4_gl2psPrintPGFFinalPrimitive
|
||||
#define gl2psComputeTightBoundingBox Geant4_gl2psComputeTightBoundingBox
|
||||
|
||||
#define gl2ps Geant4_gl2ps
|
||||
|
||||
#ifndef G4OPENGL_VERSION_2
|
||||
#include "gl2ps.h"
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define _USE_MATH_DEFINES
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,287 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
|
||||
/*
|
||||
* GL2PS, an OpenGL to PostScript Printing Library
|
||||
* Copyright (C) 1999-2020 C. Geuzaine
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of either:
|
||||
*
|
||||
* a) the GNU Library General Public License as published by the Free
|
||||
* Software Foundation, either version 2 of the License, or (at your
|
||||
* option) any later version; or
|
||||
*
|
||||
* b) the GL2PS License as published by Christophe Geuzaine, either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either
|
||||
* the GNU Library General Public License or the GL2PS License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library in the file named "COPYING.LGPL";
|
||||
* if not, write to the Free Software Foundation, Inc., 51 Franklin
|
||||
* Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* You should have received a copy of the GL2PS License with this
|
||||
* library in the file named "COPYING.GL2PS"; if not, I will be glad
|
||||
* to provide one.
|
||||
*
|
||||
* For the latest info about gl2ps and a full list of contributors,
|
||||
* see http://www.geuz.org/gl2ps/.
|
||||
*
|
||||
* Please report all bugs and problems to <gl2ps@geuz.org>.
|
||||
*/
|
||||
|
||||
#ifndef GL2PS_H
|
||||
#define GL2PS_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Define GL2PSDLL at compile time to build a Windows DLL */
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
|
||||
# if defined(_MSC_VER)
|
||||
# pragma warning(disable:4115)
|
||||
# pragma warning(disable:4127)
|
||||
# pragma warning(disable:4996)
|
||||
# endif
|
||||
# if !defined(NOMINMAX)
|
||||
# define NOMINMAX
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# undef NOMINMAX
|
||||
# if defined(GL2PSDLL)
|
||||
# if defined(GL2PSDLL_EXPORTS)
|
||||
# define GL2PSDLL_API __declspec(dllexport)
|
||||
# else
|
||||
# define GL2PSDLL_API __declspec(dllimport)
|
||||
# endif
|
||||
# else
|
||||
# define GL2PSDLL_API
|
||||
# endif
|
||||
#else
|
||||
# define GL2PSDLL_API
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) || defined(HAVE_OPENGL_GL_H)
|
||||
# include <OpenGL/gl.h>
|
||||
#else
|
||||
# include <GL/gl.h>
|
||||
#endif
|
||||
|
||||
/* Support for compressed PostScript/PDF/SVG and for embedded PNG
|
||||
images in SVG */
|
||||
|
||||
#if defined(HAVE_ZLIB) || defined(HAVE_LIBZ)
|
||||
# define GL2PS_HAVE_ZLIB
|
||||
# if defined(HAVE_LIBPNG) || defined(HAVE_PNG)
|
||||
# define GL2PS_HAVE_LIBPNG
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_NO_VSNPRINTF)
|
||||
# define GL2PS_HAVE_NO_VSNPRINTF
|
||||
#endif
|
||||
|
||||
/* Version number */
|
||||
|
||||
#define GL2PS_MAJOR_VERSION 1
|
||||
#define GL2PS_MINOR_VERSION 4
|
||||
#define GL2PS_PATCH_VERSION 2
|
||||
#define GL2PS_EXTRA_VERSION ""
|
||||
|
||||
#define GL2PS_VERSION (GL2PS_MAJOR_VERSION + \
|
||||
0.01 * GL2PS_MINOR_VERSION + \
|
||||
0.0001 * GL2PS_PATCH_VERSION)
|
||||
|
||||
#define GL2PS_COPYRIGHT "(C) 1999-2020 C. Geuzaine"
|
||||
|
||||
/* Output file formats (the values and the ordering are important!) */
|
||||
|
||||
#define GL2PS_PS 0
|
||||
#define GL2PS_EPS 1
|
||||
#define GL2PS_TEX 2
|
||||
#define GL2PS_PDF 3
|
||||
#define GL2PS_SVG 4
|
||||
#define GL2PS_PGF 5
|
||||
|
||||
/* Sorting algorithms */
|
||||
|
||||
#define GL2PS_NO_SORT 1
|
||||
#define GL2PS_SIMPLE_SORT 2
|
||||
#define GL2PS_BSP_SORT 3
|
||||
|
||||
/* Message levels and error codes */
|
||||
|
||||
#define GL2PS_SUCCESS 0
|
||||
#define GL2PS_INFO 1
|
||||
#define GL2PS_WARNING 2
|
||||
#define GL2PS_ERROR 3
|
||||
#define GL2PS_NO_FEEDBACK 4
|
||||
#define GL2PS_OVERFLOW 5
|
||||
#define GL2PS_UNINITIALIZED 6
|
||||
|
||||
/* Options for gl2psBeginPage */
|
||||
|
||||
#define GL2PS_NONE 0
|
||||
#define GL2PS_DRAW_BACKGROUND (1<<0)
|
||||
#define GL2PS_SIMPLE_LINE_OFFSET (1<<1)
|
||||
#define GL2PS_SILENT (1<<2)
|
||||
#define GL2PS_BEST_ROOT (1<<3)
|
||||
#define GL2PS_OCCLUSION_CULL (1<<4)
|
||||
#define GL2PS_NO_TEXT (1<<5)
|
||||
#define GL2PS_LANDSCAPE (1<<6)
|
||||
#define GL2PS_NO_PS3_SHADING (1<<7)
|
||||
#define GL2PS_NO_PIXMAP (1<<8)
|
||||
#define GL2PS_USE_CURRENT_VIEWPORT (1<<9)
|
||||
#define GL2PS_COMPRESS (1<<10)
|
||||
#define GL2PS_NO_BLENDING (1<<11)
|
||||
#define GL2PS_TIGHT_BOUNDING_BOX (1<<12)
|
||||
#define GL2PS_NO_OPENGL_CONTEXT (1<<13)
|
||||
#define GL2PS_NO_TEX_FONTSIZE (1<<14)
|
||||
|
||||
/* Arguments for gl2psEnable/gl2psDisable */
|
||||
|
||||
#define GL2PS_POLYGON_OFFSET_FILL 1
|
||||
#define GL2PS_POLYGON_BOUNDARY 2
|
||||
#define GL2PS_LINE_STIPPLE 3
|
||||
#define GL2PS_BLEND 4
|
||||
|
||||
/* Arguments for gl2psLineCap/Join */
|
||||
|
||||
#define GL2PS_LINE_CAP_BUTT 0
|
||||
#define GL2PS_LINE_CAP_ROUND 1
|
||||
#define GL2PS_LINE_CAP_SQUARE 2
|
||||
|
||||
#define GL2PS_LINE_JOIN_MITER 0
|
||||
#define GL2PS_LINE_JOIN_ROUND 1
|
||||
#define GL2PS_LINE_JOIN_BEVEL 2
|
||||
|
||||
/* Text alignment (o=raster position; default mode is BL):
|
||||
+---+ +---+ +---+ +---+ +---+ +---+ +-o-+ o---+ +---o
|
||||
| o | o | | o | | | | | | | | | | | |
|
||||
+---+ +---+ +---+ +-o-+ o---+ +---o +---+ +---+ +---+
|
||||
C CL CR B BL BR T TL TR */
|
||||
|
||||
#define GL2PS_TEXT_C 1
|
||||
#define GL2PS_TEXT_CL 2
|
||||
#define GL2PS_TEXT_CR 3
|
||||
#define GL2PS_TEXT_B 4
|
||||
#define GL2PS_TEXT_BL 5
|
||||
#define GL2PS_TEXT_BR 6
|
||||
#define GL2PS_TEXT_T 7
|
||||
#define GL2PS_TEXT_TL 8
|
||||
#define GL2PS_TEXT_TR 9
|
||||
|
||||
typedef GLfloat GL2PSrgba[4];
|
||||
typedef GLfloat GL2PSxyz[3];
|
||||
|
||||
typedef struct {
|
||||
GL2PSxyz xyz;
|
||||
GL2PSrgba rgba;
|
||||
} GL2PSvertex;
|
||||
|
||||
/* Primitive types */
|
||||
#define GL2PS_NO_TYPE -1
|
||||
#define GL2PS_TEXT 1
|
||||
#define GL2PS_POINT 2
|
||||
#define GL2PS_LINE 3
|
||||
#define GL2PS_QUADRANGLE 4
|
||||
#define GL2PS_TRIANGLE 5
|
||||
#define GL2PS_PIXMAP 6
|
||||
#define GL2PS_IMAGEMAP 7
|
||||
#define GL2PS_IMAGEMAP_WRITTEN 8
|
||||
#define GL2PS_IMAGEMAP_VISIBLE 9
|
||||
#define GL2PS_SPECIAL 10
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer,
|
||||
GLint viewport[4], GLint format, GLint sort,
|
||||
GLint options, GLint colormode,
|
||||
GLint colorsize, GL2PSrgba *colormap,
|
||||
GLint nr, GLint ng, GLint nb, GLint buffersize,
|
||||
FILE *stream, const char *filename);
|
||||
GL2PSDLL_API GLint gl2psEndPage(void);
|
||||
GL2PSDLL_API GLint gl2psSetOptions(GLint options);
|
||||
GL2PSDLL_API GLint gl2psGetOptions(GLint *options);
|
||||
GL2PSDLL_API GLint gl2psBeginViewport(GLint viewport[4]);
|
||||
GL2PSDLL_API GLint gl2psEndViewport(void);
|
||||
GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname,
|
||||
GLshort fontsize);
|
||||
GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname,
|
||||
GLshort fontsize, GLint align, GLfloat angle);
|
||||
GL2PSDLL_API GLint gl2psTextOptColor(const char *str, const char *fontname,
|
||||
GLshort fontsize, GLint align, GLfloat angle,
|
||||
GL2PSrgba color);
|
||||
GL2PSDLL_API GLint gl2psTextOptColorBL(const char *str, const char *fontname,
|
||||
GLshort fontsize, GLint align, GLfloat angle,
|
||||
GL2PSrgba color, GLfloat blx, GLfloat bly);
|
||||
GL2PSDLL_API GLint gl2psSpecial(GLint format, const char *str);
|
||||
GL2PSDLL_API GLint gl2psSpecialColor(GLint format, const char *str, GL2PSrgba rgba);
|
||||
GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height,
|
||||
GLint xorig, GLint yorig,
|
||||
GLenum format, GLenum type, const void *pixels);
|
||||
GL2PSDLL_API GLint gl2psEnable(GLint mode);
|
||||
GL2PSDLL_API GLint gl2psDisable(GLint mode);
|
||||
GL2PSDLL_API GLint gl2psPointSize(GLfloat value);
|
||||
GL2PSDLL_API GLint gl2psLineCap(GLint value);
|
||||
GL2PSDLL_API GLint gl2psLineJoin(GLint value);
|
||||
GL2PSDLL_API GLint gl2psLineWidth(GLfloat value);
|
||||
GL2PSDLL_API GLint gl2psBlendFunc(GLenum sfactor, GLenum dfactor);
|
||||
GL2PSDLL_API GLint gl2psSorting(GLint mode);
|
||||
|
||||
/* referenced in the documentation, but not fully documented */
|
||||
GL2PSDLL_API GLint gl2psForceRasterPos(GL2PSvertex *vert);
|
||||
GL2PSDLL_API void gl2psAddPolyPrimitive(GLshort type, GLshort numverts,
|
||||
GL2PSvertex *verts, GLint offset,
|
||||
GLfloat ofactor, GLfloat ounits,
|
||||
GLushort pattern, GLint factor,
|
||||
GLfloat width, GLint linecap,
|
||||
GLint linejoin, char boundary);
|
||||
|
||||
/* undocumented */
|
||||
GL2PSDLL_API GLint gl2psDrawImageMap(GLsizei width, GLsizei height,
|
||||
const GLfloat position[3],
|
||||
const unsigned char *imagemap);
|
||||
GL2PSDLL_API const char *gl2psGetFileExtension(GLint format);
|
||||
GL2PSDLL_API const char *gl2psGetFormatDescription(GLint format);
|
||||
GL2PSDLL_API GLint gl2psGetFileFormat();
|
||||
GL2PSDLL_API GLint gl2psSetTexScaling(GLfloat scaling);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
# - G4gl2ps module build definition
|
||||
|
||||
# Link to appropriate GL library for the platform/drivers being built
|
||||
set(G4GL2PS_GL_LIBRARIES OpenGL::GL)
|
||||
if(APPLE AND (GEANT4_USE_OPENGL_X11 OR GEANT4_USE_INVENTOR_XT OR GEANT4_USE_XM))
|
||||
if(NOT GEANT4_USE_QT)
|
||||
set(G4GL2PS_GL_LIBRARIES XQuartzGL::GL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Define the Geant module
|
||||
geant4_add_module(G4gl2ps
|
||||
PUBLIC_HEADERS
|
||||
G4OpenGL2PSAction.hh
|
||||
Geant4_gl2ps.h
|
||||
gl2ps.h
|
||||
SOURCES
|
||||
G4OpenGL2PSAction.cc
|
||||
gl2ps.cc)
|
||||
|
||||
geant4_module_link_libraries(G4gl2ps
|
||||
PUBLIC
|
||||
G4globman
|
||||
${ZLIB_LIBRARIES}
|
||||
${G4GL2PS_GL_LIBRARIES})
|
||||
|
||||
@@ -1,200 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 "G4OpenGL2PSAction.hh"
|
||||
|
||||
#include <limits>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
G4OpenGL2PSAction::G4OpenGL2PSAction(
|
||||
)
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
|
||||
{
|
||||
fFile = 0;
|
||||
fViewport[0] = 0;
|
||||
fViewport[1] = 0;
|
||||
fViewport[2] = 0;
|
||||
fViewport[3] = 0;
|
||||
fBufferSize = 2048;
|
||||
fBufferSizeLimit = (std::numeric_limits<GLint>::max)();
|
||||
fExportImageFormat = GL2PS_PDF;
|
||||
resetBufferSizeParameters();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void G4OpenGL2PSAction::resetBufferSizeParameters(
|
||||
)
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
|
||||
{
|
||||
fBufferSize = 2048;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void G4OpenGL2PSAction::setLineWidth(
|
||||
int width
|
||||
)
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
|
||||
{
|
||||
gl2psLineWidth( width );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void G4OpenGL2PSAction::setPointSize(
|
||||
int size
|
||||
)
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
|
||||
{
|
||||
gl2psPointSize( size );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void G4OpenGL2PSAction::setViewport(
|
||||
int a
|
||||
,int b
|
||||
,int winSizeX
|
||||
,int winSizeY
|
||||
)
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
|
||||
{
|
||||
fViewport[0] = a;
|
||||
fViewport[1] = b;
|
||||
fViewport[2] = winSizeX;
|
||||
fViewport[3] = winSizeY;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
void G4OpenGL2PSAction::setFileName(
|
||||
const char* aFileName
|
||||
)
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
|
||||
{
|
||||
fFileName = aFileName;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
bool G4OpenGL2PSAction::enableFileWriting(
|
||||
)
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
|
||||
{
|
||||
fFile = ::fopen(fFileName,"wb");
|
||||
if(!fFile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// No buffering for output file
|
||||
setvbuf ( fFile , NULL , _IONBF , 2048 );
|
||||
return G4gl2psBegin();
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
bool G4OpenGL2PSAction::disableFileWriting(
|
||||
)
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
|
||||
{
|
||||
int state = gl2psEndPage();
|
||||
::fclose(fFile);
|
||||
if (state == GL2PS_OVERFLOW) {
|
||||
return false;
|
||||
}
|
||||
fFile = 0;
|
||||
return true;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
bool G4OpenGL2PSAction::extendBufferSize(
|
||||
)
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
|
||||
{
|
||||
// extend buffer size *2
|
||||
if (fBufferSize < (fBufferSizeLimit/2)) {
|
||||
fBufferSize = fBufferSize*2;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// FWJ
|
||||
void G4OpenGL2PSAction::setBufferSize(int newSize)
|
||||
{
|
||||
fBufferSize = (newSize < int(fBufferSizeLimit))
|
||||
? GLint(newSize) : fBufferSizeLimit;
|
||||
}
|
||||
|
||||
|
||||
bool G4OpenGL2PSAction::fileWritingEnabled(
|
||||
) const
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
|
||||
{
|
||||
return (fFile?true:false);
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
bool G4OpenGL2PSAction::G4gl2psBegin(
|
||||
)
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
|
||||
{
|
||||
if(!fFile) return false;
|
||||
int options =
|
||||
GL2PS_BEST_ROOT | GL2PS_DRAW_BACKGROUND |GL2PS_USE_CURRENT_VIEWPORT;
|
||||
int sort = GL2PS_BSP_SORT;
|
||||
|
||||
glGetIntegerv(GL_VIEWPORT,fViewport);
|
||||
GLint res = gl2psBeginPage("Geant4 output","Geant4",
|
||||
fViewport,
|
||||
fExportImageFormat,
|
||||
sort,
|
||||
options,
|
||||
GL_RGBA,0, NULL,0,0,0,
|
||||
fBufferSize,
|
||||
fFile,fFileName.c_str());
|
||||
if (res == GL2PS_ERROR) {
|
||||
return false;
|
||||
}
|
||||
// enable blending for all
|
||||
gl2psEnable(GL2PS_BLEND);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void G4OpenGL2PSAction::setExportImageFormat(unsigned int type){
|
||||
if(!fFile) {
|
||||
fExportImageFormat = type;
|
||||
} else {
|
||||
// Could not change the file type at this step. Please change it before enableFileWriting()
|
||||
}
|
||||
}
|
||||
-6645
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,13 @@
|
||||
# Category gMocren History
|
||||
|
||||
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!
|
||||
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!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2022-11-25 Gabriele Cosmo (gMocren-V11-00-03)
|
||||
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
|
||||
|
||||
## 2022-04-16 John Allison (gMocren-V11-00-02)
|
||||
- G4GMocrenFileSceneHandler.cc:
|
||||
|
||||
@@ -141,7 +141,7 @@ G4GMocrenFileSceneHandler::G4GMocrenFileSceneHandler(G4GMocrenFile& system,
|
||||
std::strlen(DEFAULT_GDD_FILE_NAME)+1); // filename
|
||||
} else {
|
||||
const char * env = std::getenv("G4GMocrenFile_DEST_DIR");
|
||||
int len = std::strlen(env);
|
||||
G4int len = (G4int)std::strlen(env);
|
||||
if(len > 256) {
|
||||
G4Exception("G4GMocrenFileSceneHandler::G4GMocrenFileSceneHandler(*)",
|
||||
"gMocren1000", FatalException,
|
||||
@@ -1193,9 +1193,9 @@ void G4GMocrenFileSceneHandler::AddSolid( const G4Box& box )
|
||||
;
|
||||
}
|
||||
|
||||
kNestedVolumeDimension[0] = phantomPara->GetNoVoxelsX();
|
||||
kNestedVolumeDimension[1] = phantomPara->GetNoVoxelsY();
|
||||
kNestedVolumeDimension[2] = phantomPara->GetNoVoxelsZ();
|
||||
kNestedVolumeDimension[0] = (G4int)phantomPara->GetNoVoxelsX();
|
||||
kNestedVolumeDimension[1] = (G4int)phantomPara->GetNoVoxelsY();
|
||||
kNestedVolumeDimension[2] = (G4int)phantomPara->GetNoVoxelsZ();
|
||||
kNestedVolumeDirAxis[0] = 0;
|
||||
kNestedVolumeDirAxis[1] = 1;
|
||||
kNestedVolumeDirAxis[2] = 2;
|
||||
|
||||
@@ -67,7 +67,7 @@ G4GMocrenFileViewer::G4GMocrenFileViewer (G4GMocrenFileSceneHandler& sceneHandle
|
||||
std::strncpy( kG4GddViewer, "gMocren", 8);
|
||||
if( std::getenv( "G4GMocrenFile_VIEWER" ) != NULL ) {
|
||||
char * env = std::getenv( "G4GMocrenFile_VIEWER" );
|
||||
G4int len = std::strlen(env);
|
||||
G4int len = (G4int)std::strlen(env);
|
||||
if(len >= 32) {
|
||||
G4Exception("G4GMocrenFileViewer::G4GMocrenFileViewer(*)",
|
||||
"gMocren1000", FatalException,
|
||||
@@ -89,17 +89,17 @@ G4GMocrenFileViewer::G4GMocrenFileViewer (G4GMocrenFileSceneHandler& sceneHandle
|
||||
sizeof(kG4GddViewerInvocation) - 1);
|
||||
kG4GddViewerInvocation[sizeof(kG4GddViewerInvocation) - 1] = '\0';
|
||||
G4int n = sizeof(kG4GddViewerInvocation)
|
||||
- std::strlen(kG4GddViewerInvocation) - 1;
|
||||
- (G4int)std::strlen(kG4GddViewerInvocation) - 1;
|
||||
std::strncat( kG4GddViewerInvocation, " ", n);
|
||||
const char * gddfname = kSceneHandler.GetGddFileName();
|
||||
G4int len = std::strlen(gddfname);
|
||||
G4int len = (G4int)std::strlen(gddfname);
|
||||
if(len >= 64) {
|
||||
G4Exception("G4GMocrenFileViewer::G4GMocrenFileViewer(*)",
|
||||
"gMocren1001", FatalException,
|
||||
"Invalid length of the GDD file name");
|
||||
}
|
||||
n = sizeof(kG4GddViewerInvocation)
|
||||
- std::strlen(kG4GddViewerInvocation) - 1;
|
||||
- (G4int)std::strlen(kG4GddViewerInvocation) - 1;
|
||||
std::strncat( kG4GddViewerInvocation, gddfname, n);
|
||||
}
|
||||
|
||||
@@ -188,17 +188,17 @@ void G4GMocrenFileViewer::ShowView( void )
|
||||
sizeof(kG4GddViewerInvocation) - 1);
|
||||
kG4GddViewerInvocation[sizeof(kG4GddViewerInvocation) - 1] = '\0';
|
||||
G4int n = sizeof(kG4GddViewerInvocation)
|
||||
- std::strlen(kG4GddViewerInvocation) - 1;
|
||||
- (G4int)std::strlen(kG4GddViewerInvocation) - 1;
|
||||
std::strncat( kG4GddViewerInvocation, " ", n);
|
||||
const char * gddfname = kSceneHandler.GetGddFileName();
|
||||
G4int len = std::strlen(gddfname);
|
||||
G4int len = (G4int)std::strlen(gddfname);
|
||||
if(len >= 64) {
|
||||
G4Exception("G4GMocrenFileViewer::ShowView()",
|
||||
"gMocren1002", FatalException,
|
||||
"Invalid length of the GDD file name");
|
||||
}
|
||||
n = sizeof(kG4GddViewerInvocation)
|
||||
- std::strlen(kG4GddViewerInvocation) - 1;
|
||||
- (G4int)std::strlen(kG4GddViewerInvocation) - 1;
|
||||
std::strncat( kG4GddViewerInvocation, gddfname, n);
|
||||
}
|
||||
|
||||
|
||||
@@ -894,7 +894,7 @@ bool G4GMocrenIO::storeData4() {
|
||||
// number of track
|
||||
if(kPointerToTrackData > 0) {
|
||||
|
||||
int ntrk = kTracks.size();
|
||||
int ntrk = (int)kTracks.size();
|
||||
if(kLittleEndianOutput) {
|
||||
ofile.write((char *)&ntrk, sizeof(int));
|
||||
} else {
|
||||
@@ -946,7 +946,7 @@ bool G4GMocrenIO::storeData4() {
|
||||
//----- detector information -----//
|
||||
// number of detectors
|
||||
if(kPointerToDetectorData > 0) {
|
||||
int ndet = kDetectors.size();
|
||||
int ndet = (int)kDetectors.size();
|
||||
if(kLittleEndianOutput) {
|
||||
ofile.write((char *)&ndet, sizeof(int));
|
||||
} else {
|
||||
@@ -1287,7 +1287,7 @@ bool G4GMocrenIO::storeData3() {
|
||||
|
||||
//----- track information -----//
|
||||
// number of track
|
||||
int ntrk = kSteps.size();
|
||||
int ntrk = (int)kSteps.size();
|
||||
ofile.write((char *)&ntrk, sizeof(int));
|
||||
if(DEBUG || kVerbose > 0) {
|
||||
G4cout << "# of tracks : "
|
||||
@@ -1566,7 +1566,7 @@ bool G4GMocrenIO::storeData2() {
|
||||
|
||||
//----- track information -----//
|
||||
// track
|
||||
int ntrk = kSteps.size();
|
||||
int ntrk = (int)kSteps.size();
|
||||
ofile.write((char *)&ntrk, sizeof(int));
|
||||
if(DEBUG || kVerbose > 0) {
|
||||
G4cout << "# of tracks : "
|
||||
@@ -2088,7 +2088,7 @@ bool G4GMocrenIO::retrieveData4() {
|
||||
if(i < 5) {
|
||||
G4cout << i << ": " ;
|
||||
for(int j = 0; j < 3; j++) G4cout << steps[0][j] << " ";
|
||||
int nstp = steps.size();
|
||||
int nstp = (int)steps.size();
|
||||
G4cout << "<-> ";
|
||||
for(int j = 3; j < 6; j++) G4cout << steps[nstp-1][j] << " ";
|
||||
G4cout << " rgb( ";
|
||||
@@ -3223,7 +3223,7 @@ void G4GMocrenIO::calcPointers4() {
|
||||
}
|
||||
|
||||
// pointer to track data
|
||||
int ntrk = kTracks.size();
|
||||
int ntrk = (int)kTracks.size();
|
||||
if(ntrk != 0) {
|
||||
setPointerToTrackData(pointer);
|
||||
|
||||
@@ -3240,7 +3240,7 @@ void G4GMocrenIO::calcPointers4() {
|
||||
<< kPointerToTrackData << G4endl;
|
||||
|
||||
// pointer to detector data
|
||||
int ndet = kDetectors.size();
|
||||
int ndet = (int)kDetectors.size();
|
||||
if(ndet != 0) {
|
||||
kPointerToDetectorData = pointer;
|
||||
} else {
|
||||
@@ -3689,7 +3689,7 @@ bool G4GMocrenIO::mergeDoseDist(std::vector<class GMocrenDataPrimitive<double> >
|
||||
return false;
|
||||
}
|
||||
|
||||
int num = kDose.size();
|
||||
int num = (int)kDose.size();
|
||||
std::vector<class GMocrenDataPrimitive<double> >::iterator itr1 = kDose.begin();
|
||||
std::vector<class GMocrenDataPrimitive<double> >::iterator itr2 = _dose.begin();
|
||||
for(int i = 0; i < num; i++, itr1++, itr2++) {
|
||||
|
||||
@@ -1,8 +1,96 @@
|
||||
# Category visman History
|
||||
|
||||
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!
|
||||
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!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2022-11-25 Gabriele Cosmo (visman-V11-00-31)
|
||||
- Fixed compilation warning for implicit type conversions on macOS/XCode 14.1.
|
||||
|
||||
## 2022-11-05 John Allison (visman-V11-00-30)
|
||||
- Eliminate G4cerr and introduce G4warn in remaining visman files.
|
||||
- `#define G4warn G4cout`
|
||||
- The above is temporary until a genuine G4warn output stream is
|
||||
implemented.
|
||||
- Change G4cerr to G4warn in all cases.
|
||||
- Change G4cout to G4warn in those cases where `verbosity >= warnings`.
|
||||
|
||||
## 2022-11-04 John Allison (visman-V11-00-29)
|
||||
- G4VisManager.cc: Eliminate G4cerr and introduce G4warn.
|
||||
- Only for G4VisManager.cc for now to test the principle.
|
||||
- Other vis files will be migrated if this MR is successful.
|
||||
- `#define G4warn G4cout`
|
||||
- The above is temporary until a genuine G4warn output stream is
|
||||
implemented.
|
||||
- Change G4cerr to G4warn in all cases.
|
||||
- Change G4cout to G4warn in those cases where `verbosity >= warnings`.
|
||||
|
||||
## 2022-10-30 John Allison (visman-V11-00-28)
|
||||
- Implement void G4VisManager::DrawGeometry
|
||||
(G4VPhysicalVolume* v, const G4Transform3D& t)
|
||||
- Draws a geometry tree starting at the specified physical volume.
|
||||
|
||||
## 2022-10-28 John Allison (visman-V11-00-27)
|
||||
- Implement generic cutaway.
|
||||
- Prior to this tag, cutaways were implemented only in OpenGL by using
|
||||
OpenGL's clipping plane feature. This still pertains for OpenGL because
|
||||
it is very fast, but this tag implements cutaways using Boolean operations.
|
||||
Evgueni Tcherniaev and I have found a way to make this reasonably
|
||||
robust and reliable. The initial motivation and implementation on the
|
||||
management side (G4VSceneHandler) came from a Geant4 user,
|
||||
Pooria Heidary, via a GitHub pull request.
|
||||
- G4VSceneHandler::CreateCutawaySolid:
|
||||
- The initial implementation is by Pooria Heidary.
|
||||
- G4VSceneHandler::RequestPrimitives:
|
||||
- Check validity of Boolean solids. This is particularly pertinent
|
||||
for cutaways, because the cutting volume (the subtractor) is
|
||||
large and general and often the target volume is entirely within
|
||||
or entirely outside. But it is a check that now applies to all
|
||||
geometries, with or without cutaways, so it is a bug fix.
|
||||
- Sometimes solids that have no substance get requested. They may
|
||||
be part of the geometry tree but have been "spirited away", for
|
||||
example by a Boolean subtraction in which the original volume
|
||||
is entirely inside the subtractor.
|
||||
- The problem is that the Boolean Processor still returns a
|
||||
polyhedron in these cases (IMHO it should not), so the
|
||||
workaround is to return before the damage is done.
|
||||
- The check involves seeking a point inside the resulting
|
||||
Boolean solid. If it cannot be found within a large number
|
||||
of attempts, it is assumed to be invalid.
|
||||
- G4VisCommandsViewer.cc:
|
||||
- Make sure the normal to the cutaway plane is normalised (unit vector).
|
||||
- G4VisCommandsViewerSet.cc:
|
||||
- Make sure the normal to the sectioning plane is normalised (unit vector).
|
||||
|
||||
## 2022-10-13 Guy Barrand (visman-V11-00-26)
|
||||
- G4VisExecutive.icc: add TOOLSSG_OFFSCREEN.
|
||||
|
||||
## 2022-09-19 John Allison (visman-V11-00-25)
|
||||
- G4VSceneHandler.cc::StandardSpecialMeshRendering():
|
||||
- Draw container if not marked invisible.
|
||||
|
||||
## 2022-09-13 Evgueni Tcherniaev (visman-V11-00-24)
|
||||
- G4VSceneHandler: implemented GetPointInBox() and GetPointInTet()
|
||||
to sample a random point inside a box and a tetrahedron.
|
||||
|
||||
## 2022-09-10 Ben Morgan (visman-V11-00-23)
|
||||
- Mark compile time only and buildmode-specific headers as "no_geant4_module_check"
|
||||
|
||||
## 2022-09-03 Ben Morgan (visman-V11-00-22)
|
||||
- Add PRIVATE dependency on G4volumes for multithreaded builds only.
|
||||
|
||||
## 2022-08-17 John Allison (visman-V11-00-21)
|
||||
- Back out code that forces /vis/verbose and /control/verbose
|
||||
- G4VisCommandsCompound.cc, G4VisCommandsSceneAdd.cc,
|
||||
G4VisCommandsTouchable.cc, G4VisCommandsViewer.cc:
|
||||
- Sometimes the vis system forced extra vis messages or the echoing of
|
||||
commands. Not sure why this was done - perhaps with a thought to
|
||||
providing useful information - but it causes surprises, for example,
|
||||
when the control verbosity is zero (no command echoing) a command is
|
||||
still echoed. With this patch, there will be no such surprises - what
|
||||
the user sets as vis and/or control verbosity will apply at all times.
|
||||
|
||||
## 2022-06-13 Laurie Nevay (visman-V11-00-20)
|
||||
- G4VisCommandsSceneAdd - changed the default width of axes added to the scene with
|
||||
|
||||
@@ -419,6 +419,15 @@ protected:
|
||||
// For a tetrahedron mesh, draw as surfaces by colour and material
|
||||
// with inner shared faces removed.
|
||||
|
||||
G4ThreeVector GetPointInBox(const G4ThreeVector& pos,
|
||||
G4double halfX,
|
||||
G4double halfY,
|
||||
G4double halfZ) const;
|
||||
// Sample a random point inside the box
|
||||
|
||||
G4ThreeVector GetPointInTet(const std::vector<G4ThreeVector>& vertices) const;
|
||||
// Sample a random point inside the tetrahedron
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Data members
|
||||
|
||||
|
||||
@@ -198,17 +198,17 @@ protected:
|
||||
|
||||
// Operations
|
||||
void AddSplinePoint(const G4Vector3D& v);
|
||||
G4Vector3D GetInterpolatedSplinePoint(float t); // t = 0...1; 0=vp[0] ... 1=vp[max]
|
||||
int GetNumPoints();
|
||||
G4Vector3D GetInterpolatedSplinePoint(G4float t); // t = 0...1; 0=vp[0] ... 1=vp[max]
|
||||
G4int GetNumPoints();
|
||||
G4Vector3D GetPoint(int);
|
||||
// method for computing the Catmull-Rom parametric equation
|
||||
// given a time (t) and a vector quadruple (p1,p2,p3,p4).
|
||||
G4Vector3D CatmullRom_Eq(float t, const G4Vector3D& p1, const G4Vector3D& p2,
|
||||
G4Vector3D CatmullRom_Eq(G4float t, const G4Vector3D& p1, const G4Vector3D& p2,
|
||||
const G4Vector3D& p3, const G4Vector3D& p4);
|
||||
|
||||
private:
|
||||
std::vector<G4Vector3D> vp;
|
||||
float delta_t;
|
||||
G4float delta_t;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -31,84 +31,86 @@
|
||||
#ifndef G4VISEXECUTIVE_ICC
|
||||
#define G4VISEXECUTIVE_ICC
|
||||
|
||||
// Supported drivers...
|
||||
|
||||
// Not needing external packages or libraries...
|
||||
#include "G4ASCIITree.hh"
|
||||
#include "G4DAWNFILE.hh"
|
||||
#include "G4HepRepFile.hh"
|
||||
#include "G4RayTracer.hh"
|
||||
// Filter/Model Factories
|
||||
#include "G4HitFilterFactories.hh"
|
||||
#include "G4DigiFilterFactories.hh"
|
||||
#include "G4TrajectoryFilterFactories.hh"
|
||||
#include "G4TrajectoryModelFactories.hh"
|
||||
#include "G4VRML2File.hh"
|
||||
#include "G4GMocrenFile.hh"
|
||||
|
||||
// Supported drivers...
|
||||
// Not needing external packages or libraries...
|
||||
#include "G4ASCIITree.hh" // no_geant4_module_check
|
||||
#include "G4DAWNFILE.hh" // no_geant4_module_check
|
||||
#include "G4HepRepFile.hh" // no_geant4_module_check
|
||||
#include "G4RayTracer.hh" // no_geant4_module_check
|
||||
#include "G4VRML2File.hh" // no_geant4_module_check
|
||||
#include "G4GMocrenFile.hh" // no_geant4_module_check
|
||||
#include "G4ToolsSGOffscreen.hh" // no_geant4_module_check
|
||||
|
||||
// Needing external packages or libraries...
|
||||
#ifdef G4VIS_USE_OPENGLX
|
||||
#include "G4OpenGLImmediateX.hh"
|
||||
#include "G4OpenGLStoredX.hh"
|
||||
#include "G4OpenGLImmediateX.hh" // no_geant4_module_check
|
||||
#include "G4OpenGLStoredX.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLWIN32
|
||||
#include "G4OpenGLImmediateWin32.hh"
|
||||
#include "G4OpenGLStoredWin32.hh"
|
||||
#include "G4OpenGLImmediateWin32.hh" // no_geant4_module_check
|
||||
#include "G4OpenGLStoredWin32.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLXM
|
||||
#include "G4OpenGLImmediateXm.hh"
|
||||
#include "G4OpenGLStoredXm.hh"
|
||||
#include "G4OpenGLImmediateXm.hh" // no_geant4_module_check
|
||||
#include "G4OpenGLStoredXm.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPENGLQT
|
||||
#include "G4OpenGLImmediateQt.hh"
|
||||
#include "G4OpenGLStoredQt.hh"
|
||||
#include "G4OpenGLImmediateQt.hh" // no_geant4_module_check
|
||||
#include "G4OpenGLStoredQt.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OIX
|
||||
#include "G4OpenInventorX.hh"
|
||||
#include "G4OpenInventorXtExtended.hh"
|
||||
#include "G4OpenInventorX.hh" // no_geant4_module_check
|
||||
#include "G4OpenInventorXtExtended.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OIQT
|
||||
#include "G4OpenInventorQt.hh"
|
||||
#include "G4OpenInventorQt.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OIWIN32
|
||||
#include "G4OpenInventorWin32.hh"
|
||||
#include "G4OpenInventorWin32.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_RAYTRACERX
|
||||
#include "G4RayTracerX.hh"
|
||||
#include "G4RayTracerX.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_QT3D
|
||||
#include "G4Qt3D.hh"
|
||||
#include "G4Qt3D.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_TOOLSSG_X11_GLES
|
||||
#include "G4ToolsSGX11GLES.hh"
|
||||
#include "G4ToolsSGX11GLES.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_TOOLSSG_WINDOWS_GLES
|
||||
#include "G4ToolsSGWindowsGLES.hh"
|
||||
#include "G4ToolsSGWindowsGLES.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_TOOLSSG_XT_GLES
|
||||
#include "G4ToolsSGXtGLES.hh"
|
||||
#include "G4ToolsSGXtGLES.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_TOOLSSG_QT_GLES
|
||||
#include "G4ToolsSGQtGLES.hh"
|
||||
#include "G4ToolsSGQtGLES.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VTK
|
||||
#include "G4Vtk.hh"
|
||||
#include "G4Vtk.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VTK_QT
|
||||
#include "G4VtkQt.hh"
|
||||
#include "G4VtkQt.hh" // no_geant4_module_check
|
||||
#endif
|
||||
|
||||
// The inline keyword prevents the compiler making an external
|
||||
@@ -135,6 +137,11 @@ G4VisExecutive::RegisterGraphicsSystems () {
|
||||
RegisterGraphicsSystem (new G4RayTracer);
|
||||
RegisterGraphicsSystem (new G4VRML2File);
|
||||
RegisterGraphicsSystem (new G4GMocrenFile);
|
||||
RegisterGraphicsSystem (new G4ToolsSGOffscreen);
|
||||
|
||||
G4VGraphicsSystem* tsg_offscreen = new G4ToolsSGOffscreen;
|
||||
RegisterGraphicsSystem(tsg_offscreen);
|
||||
tsg_offscreen->AddNickname("TSG_FILE");
|
||||
|
||||
// Graphics systems needing external packages or libraries...
|
||||
// Register OGL family of drivers with their normal names,
|
||||
|
||||
@@ -286,6 +286,10 @@ public: // With description
|
||||
void Draw (const G4VSolid&, const G4VisAttributes&,
|
||||
const G4Transform3D& objectTransformation = G4Transform3D());
|
||||
|
||||
void DrawGeometry
|
||||
(G4VPhysicalVolume*, const G4Transform3D& t = G4Transform3D());
|
||||
// Draws a geometry tree starting at the specified physical volume.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Optional methods that you may use to bracket a series of Draw
|
||||
// messages that have identical objectTransformation to improve
|
||||
|
||||
@@ -97,3 +97,7 @@ geant4_module_link_libraries(G4vis_management
|
||||
G4navigation
|
||||
G4digits
|
||||
G4heprandom)
|
||||
|
||||
if(GEANT4_BUILD_MULTITHREADED)
|
||||
geant4_module_link_libraries(G4vis_management PRIVATE G4volumes)
|
||||
endif()
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
|
||||
#include <set>
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
G4Scene::G4Scene (const G4String& name):
|
||||
fName (name),
|
||||
fRefreshAtEndOfEvent(true),
|
||||
@@ -131,7 +133,7 @@ G4bool G4Scene::AddWorldIfEmpty (G4bool warn) {
|
||||
pWorld -> GetLogicalVolume () -> GetVisAttributes ();
|
||||
if (!pVisAttribs || pVisAttribs -> IsVisible ()) {
|
||||
if (warn) {
|
||||
G4cout <<
|
||||
G4warn <<
|
||||
"Your \"world\" has no vis attributes or is marked as visible."
|
||||
"\n For a better view of the contents, mark the world as"
|
||||
" invisible, e.g.,"
|
||||
@@ -144,10 +146,10 @@ G4bool G4Scene::AddWorldIfEmpty (G4bool warn) {
|
||||
// Note: default depth and no modeling parameters.
|
||||
if (successful) {
|
||||
if (warn) {
|
||||
G4cout <<
|
||||
G4warn <<
|
||||
"G4Scene::AddWorldIfEmpty: The scene had no extent."
|
||||
"\n \"world\" has been added.";
|
||||
G4cout << G4endl;
|
||||
G4warn << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -165,7 +167,7 @@ G4bool G4Scene::AddRunDurationModel (G4VModel* pModel, G4bool warn)
|
||||
}
|
||||
if (i != fRunDurationModelList.end ()) {
|
||||
if (warn) {
|
||||
G4cout << "G4Scene::AddRunDurationModel: model \""
|
||||
G4warn << "G4Scene::AddRunDurationModel: model \""
|
||||
<< pModel -> GetGlobalDescription ()
|
||||
<< "\"\n is already in the run-duration list of scene \""
|
||||
<< fName
|
||||
@@ -180,14 +182,14 @@ G4bool G4Scene::AddRunDurationModel (G4VModel* pModel, G4bool warn)
|
||||
}
|
||||
|
||||
G4bool G4Scene::AddEndOfEventModel (G4VModel* pModel, G4bool warn) {
|
||||
G4int i, nModels = fEndOfEventModelList.size ();
|
||||
for (i = 0; i < nModels; i++) {
|
||||
std::size_t i, nModels = fEndOfEventModelList.size ();
|
||||
for (i = 0; i < nModels; ++i) {
|
||||
if (pModel -> GetGlobalDescription () ==
|
||||
fEndOfEventModelList[i].fpModel -> GetGlobalDescription ()) break;
|
||||
}
|
||||
if (i < nModels) {
|
||||
if (warn) {
|
||||
G4cout << "G4Scene::AddEndOfEventModel: a model \""
|
||||
G4warn << "G4Scene::AddEndOfEventModel: a model \""
|
||||
<< pModel -> GetGlobalDescription ()
|
||||
<< "\"\n is already in the end-of-event list of scene \""
|
||||
<< fName << "\"."
|
||||
@@ -201,14 +203,14 @@ G4bool G4Scene::AddEndOfEventModel (G4VModel* pModel, G4bool warn) {
|
||||
}
|
||||
|
||||
G4bool G4Scene::AddEndOfRunModel (G4VModel* pModel, G4bool warn) {
|
||||
G4int i, nModels = fEndOfRunModelList.size ();
|
||||
for (i = 0; i < nModels; i++) {
|
||||
std::size_t i, nModels = fEndOfRunModelList.size ();
|
||||
for (i = 0; i < nModels; ++i) {
|
||||
if (pModel -> GetGlobalDescription () ==
|
||||
fEndOfRunModelList[i].fpModel -> GetGlobalDescription ()) break;
|
||||
}
|
||||
if (i < nModels) {
|
||||
if (warn) {
|
||||
G4cout << "G4Scene::AddEndOfRunModel: a model \""
|
||||
G4warn << "G4Scene::AddEndOfRunModel: a model \""
|
||||
<< pModel -> GetGlobalDescription ()
|
||||
<< "\"\n is already in the end-of-run list of scene \""
|
||||
<< fName << "\"."
|
||||
|
||||
@@ -66,6 +66,8 @@
|
||||
#include "G4Polyhedra.hh"
|
||||
#include "G4Tet.hh"
|
||||
#include "G4DisplacedSolid.hh"
|
||||
#include "G4UnionSolid.hh"
|
||||
#include "G4IntersectionSolid.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PhysicalVolumeModel.hh"
|
||||
#include "G4ModelingParameters.hh"
|
||||
@@ -78,7 +80,7 @@
|
||||
#include "G4VScoringMesh.hh"
|
||||
#include "G4Mesh.hh"
|
||||
#include "G4DefaultLinearColorMap.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4QuickRand.hh"
|
||||
#include "G4StateManager.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4RunManagerFactory.hh"
|
||||
@@ -92,6 +94,8 @@
|
||||
|
||||
#include <set>
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
G4VSceneHandler::G4VSceneHandler (G4VGraphicsSystem& system, G4int id, const G4String& name):
|
||||
fSystem (system),
|
||||
fSceneHandlerId (id),
|
||||
@@ -344,14 +348,14 @@ void G4VSceneHandler::AddCompound (const G4THitsMap<G4double>& hits) {
|
||||
G4bool scoreMapHits = false;
|
||||
G4ScoringManager* scoringManager = G4ScoringManager::GetScoringManagerIfExist();
|
||||
if (scoringManager) {
|
||||
size_t nMeshes = scoringManager->GetNumberOfMesh();
|
||||
for (size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
|
||||
G4VScoringMesh* mesh = scoringManager->GetMesh(iMesh);
|
||||
std::size_t nMeshes = scoringManager->GetNumberOfMesh();
|
||||
for (std::size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
|
||||
G4VScoringMesh* mesh = scoringManager->GetMesh((G4int)iMesh);
|
||||
if (mesh && mesh->IsActive()) {
|
||||
MeshScoreMap scoreMap = mesh->GetScoreMap();
|
||||
const G4String& mapNam = const_cast<G4THitsMap<G4double>&>(hits).GetName();
|
||||
for(MeshScoreMap::const_iterator i = scoreMap.begin();
|
||||
i != scoreMap.end(); ++i) {
|
||||
for(MeshScoreMap::const_iterator i = scoreMap.cbegin();
|
||||
i != scoreMap.cend(); ++i) {
|
||||
const G4String& scoreMapName = i->first;
|
||||
if (scoreMapName == mapNam) {
|
||||
G4DefaultLinearColorMap colorMap("G4VSceneHandlerColorMap");
|
||||
@@ -387,13 +391,13 @@ void G4VSceneHandler::AddCompound (const G4THitsMap<G4StatDouble>& hits) {
|
||||
G4bool scoreMapHits = false;
|
||||
G4ScoringManager* scoringManager = G4ScoringManager::GetScoringManagerIfExist();
|
||||
if (scoringManager) {
|
||||
size_t nMeshes = scoringManager->GetNumberOfMesh();
|
||||
for (size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
|
||||
G4VScoringMesh* mesh = scoringManager->GetMesh(iMesh);
|
||||
std::size_t nMeshes = scoringManager->GetNumberOfMesh();
|
||||
for (std::size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
|
||||
G4VScoringMesh* mesh = scoringManager->GetMesh((G4int)iMesh);
|
||||
if (mesh && mesh->IsActive()) {
|
||||
MeshScoreMap scoreMap = mesh->GetScoreMap();
|
||||
for(MeshScoreMap::const_iterator i = scoreMap.begin();
|
||||
i != scoreMap.end(); ++i) {
|
||||
for(MeshScoreMap::const_iterator i = scoreMap.cbegin();
|
||||
i != scoreMap.cend(); ++i) {
|
||||
const G4String& scoreMapName = i->first;
|
||||
const G4THitsMap<G4StatDouble>* foundHits = i->second;
|
||||
if (foundHits == &hits) {
|
||||
@@ -426,7 +430,7 @@ void G4VSceneHandler::AddCompound (const G4THitsMap<G4StatDouble>& hits) {
|
||||
|
||||
void G4VSceneHandler::AddCompound(const G4Mesh& mesh)
|
||||
{
|
||||
G4cerr <<
|
||||
G4warn <<
|
||||
"There has been an attempt to draw a mesh with option \""
|
||||
<< fpViewer->GetViewParameters().GetSpecialMeshRenderingOption()
|
||||
<< "\":\n" << mesh
|
||||
@@ -468,7 +472,7 @@ void G4VSceneHandler::AddPrimitive (const G4Polymarker& polymarker) {
|
||||
G4Circle dot (polymarker);
|
||||
dot.SetWorldSize (0.);
|
||||
dot.SetScreenSize (0.1); // Very small circle.
|
||||
for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
|
||||
for (std::size_t iPoint = 0; iPoint < polymarker.size (); ++iPoint) {
|
||||
dot.SetPosition (polymarker[iPoint]);
|
||||
AddPrimitive (dot);
|
||||
}
|
||||
@@ -477,7 +481,7 @@ void G4VSceneHandler::AddPrimitive (const G4Polymarker& polymarker) {
|
||||
case G4Polymarker::circles:
|
||||
{
|
||||
G4Circle circle (polymarker); // Default circle
|
||||
for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
|
||||
for (std::size_t iPoint = 0; iPoint < polymarker.size (); ++iPoint) {
|
||||
circle.SetPosition (polymarker[iPoint]);
|
||||
AddPrimitive (circle);
|
||||
}
|
||||
@@ -486,7 +490,7 @@ void G4VSceneHandler::AddPrimitive (const G4Polymarker& polymarker) {
|
||||
case G4Polymarker::squares:
|
||||
{
|
||||
G4Square square (polymarker); // Default square
|
||||
for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
|
||||
for (std::size_t iPoint = 0; iPoint < polymarker.size (); ++iPoint) {
|
||||
square.SetPosition (polymarker[iPoint]);
|
||||
AddPrimitive (square);
|
||||
}
|
||||
@@ -504,9 +508,9 @@ void G4VSceneHandler::RemoveViewerFromList (G4VViewer* pViewer) {
|
||||
|
||||
|
||||
void G4VSceneHandler::AddPrimitive (const G4Plotter&) {
|
||||
G4cerr << "WARNING: Plotter not implemented for " << fSystem.GetName() << G4endl;
|
||||
G4cerr << " Open a plotter-aware graphics system or remove plotter with" << G4endl;
|
||||
G4cerr << " /vis/scene/removeModel Plotter" << G4endl;
|
||||
G4warn << "WARNING: Plotter not implemented for " << fSystem.GetName() << G4endl;
|
||||
G4warn << " Open a plotter-aware graphics system or remove plotter with" << G4endl;
|
||||
G4warn << " /vis/scene/removeModel Plotter" << G4endl;
|
||||
}
|
||||
|
||||
void G4VSceneHandler::SetScene (G4Scene* pScene) {
|
||||
@@ -520,6 +524,31 @@ void G4VSceneHandler::SetScene (G4Scene* pScene) {
|
||||
|
||||
void G4VSceneHandler::RequestPrimitives (const G4VSolid& solid)
|
||||
{
|
||||
// Sometimes solids that have no substance get requested. They may
|
||||
// be part of the geometry tree but have been "spirited away", for
|
||||
// example by a Boolean subtraction in wich the original volume
|
||||
// is entirely inside the subtractor.
|
||||
// The problem is that the Boolean Processor still returns a
|
||||
// polyhedron in these cases (IMHO it should not), so the
|
||||
// workaround is to return before the damage is done.
|
||||
auto pSolid = &solid;
|
||||
auto pBooleanSolid = dynamic_cast<const G4BooleanSolid*>(pSolid);
|
||||
if (pBooleanSolid) {
|
||||
G4ThreeVector bmin, bmax;
|
||||
pBooleanSolid->BoundingLimits(bmin, bmax);
|
||||
G4bool isGood = false;
|
||||
for (G4int i=0; i<100000; ++i) {
|
||||
G4double x = bmin.x() + (bmax.x() - bmin.x())*G4QuickRand();
|
||||
G4double y = bmin.y() + (bmax.y() - bmin.y())*G4QuickRand();
|
||||
G4double z = bmin.z() + (bmax.z() - bmin.z())*G4QuickRand();
|
||||
if (pBooleanSolid->Inside(G4ThreeVector(x,y,z)) == kInside) {
|
||||
isGood = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isGood) return;
|
||||
}
|
||||
|
||||
const G4ViewParameters::DrawingStyle style = GetDrawingStyle(fpVisAttribs);
|
||||
const G4ViewParameters& vp = fpViewer->GetViewParameters();
|
||||
|
||||
@@ -546,25 +575,25 @@ void G4VSceneHandler::RequestPrimitives (const G4VSolid& solid)
|
||||
if (verbosity >= G4VisManager::errors &&
|
||||
problematicSolids.find(&solid) == problematicSolids.end()) {
|
||||
problematicSolids.insert(&solid);
|
||||
G4cerr <<
|
||||
G4warn <<
|
||||
"ERROR: G4VSceneHandler::RequestPrimitives"
|
||||
"\n Polyhedron not available for " << solid.GetName ();
|
||||
G4PhysicalVolumeModel* pPVModel = dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
|
||||
if (pPVModel) {
|
||||
G4cerr << "\n Touchable path: " << pPVModel->GetFullPVPath();
|
||||
G4warn << "\n Touchable path: " << pPVModel->GetFullPVPath();
|
||||
}
|
||||
static G4bool explanation = false;
|
||||
if (!explanation) {
|
||||
explanation = true;
|
||||
G4cerr <<
|
||||
G4warn <<
|
||||
"\n This means it cannot be visualized in the usual way on most systems."
|
||||
"\n 1) The solid may not have implemented the CreatePolyhedron method."
|
||||
"\n 2) For Boolean solids, the BooleanProcessor, which attempts to create"
|
||||
"\n the resultant polyhedron, may have failed."
|
||||
"\n Try RayTracer. It uses Geant4's tracking algorithms instead.";
|
||||
}
|
||||
G4cerr << "\n Drawing solid with cloud of points.";
|
||||
G4cerr << G4endl;
|
||||
G4warn << "\n Drawing solid with cloud of points.";
|
||||
G4warn << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -660,7 +689,7 @@ void G4VSceneHandler::ProcessScene()
|
||||
// Create modeling parameters from view parameters...
|
||||
G4ModelingParameters* pMP = CreateModelingParameters();
|
||||
|
||||
for(size_t i = 0; i < runDurationModelList.size(); i++)
|
||||
for(std::size_t i = 0; i < runDurationModelList.size(); ++i)
|
||||
{
|
||||
if(runDurationModelList[i].fActive)
|
||||
{
|
||||
@@ -702,7 +731,7 @@ void G4VSceneHandler::ProcessScene()
|
||||
const G4Run* run = runManager->GetCurrentRun();
|
||||
const std::vector<const G4Event*>* events =
|
||||
run ? run->GetEventVector() : 0;
|
||||
size_t nKeptEvents = 0;
|
||||
std::size_t nKeptEvents = 0;
|
||||
if(events)
|
||||
nKeptEvents = events->size();
|
||||
if(nKeptEvents)
|
||||
@@ -736,7 +765,7 @@ void G4VSceneHandler::ProcessScene()
|
||||
{
|
||||
if(verbosity >= G4VisManager::warnings)
|
||||
{
|
||||
G4cout << "WARNING: Cannot refresh events accumulated over more"
|
||||
G4warn << "WARNING: Cannot refresh events accumulated over more"
|
||||
"\n than one runs. Refreshed just the last run."
|
||||
<< G4endl;
|
||||
}
|
||||
@@ -762,11 +791,11 @@ void G4VSceneHandler::DrawEvent(const G4Event* event)
|
||||
{
|
||||
const std::vector<G4Scene::Model>& EOEModelList =
|
||||
fpScene -> GetEndOfEventModelList ();
|
||||
size_t nModels = EOEModelList.size();
|
||||
std::size_t nModels = EOEModelList.size();
|
||||
if (nModels) {
|
||||
G4ModelingParameters* pMP = CreateModelingParameters();
|
||||
pMP->SetEvent(event);
|
||||
for (size_t i = 0; i < nModels; i++) {
|
||||
for (std::size_t i = 0; i < nModels; ++i) {
|
||||
if (EOEModelList[i].fActive) {
|
||||
fpModel = EOEModelList[i].fpModel;
|
||||
fpModel -> SetModelingParameters(pMP);
|
||||
@@ -783,11 +812,11 @@ void G4VSceneHandler::DrawEndOfRunModels()
|
||||
{
|
||||
const std::vector<G4Scene::Model>& EORModelList =
|
||||
fpScene -> GetEndOfRunModelList ();
|
||||
size_t nModels = EORModelList.size();
|
||||
std::size_t nModels = EORModelList.size();
|
||||
if (nModels) {
|
||||
G4ModelingParameters* pMP = CreateModelingParameters();
|
||||
pMP->SetEvent(0);
|
||||
for (size_t i = 0; i < nModels; i++) {
|
||||
for (std::size_t i = 0; i < nModels; ++i) {
|
||||
if (EORModelList[i].fActive) {
|
||||
fpModel = EORModelList[i].fpModel;
|
||||
fpModel -> SetModelingParameters(pMP);
|
||||
@@ -908,32 +937,69 @@ G4DisplacedSolid* G4VSceneHandler::CreateSectionSolid()
|
||||
|
||||
G4DisplacedSolid* G4VSceneHandler::CreateCutawaySolid()
|
||||
{
|
||||
// To be reviewed.
|
||||
const G4ViewParameters& vp = fpViewer->GetViewParameters();
|
||||
if (vp.IsCutaway()) {
|
||||
|
||||
std::vector<G4DisplacedSolid*> cutaway_solids;
|
||||
|
||||
G4double radius = fpScene->GetExtent().GetExtentRadius();
|
||||
G4double safe = radius + fpScene->GetExtent().GetExtentCentre().mag();
|
||||
G4VSolid* cutawayBox =
|
||||
new G4Box("_cutaway_box", safe, safe, safe); // world box...
|
||||
|
||||
for (int plane_no = 0; plane_no < int(vp.GetCutawayPlanes().size()); plane_no++){
|
||||
|
||||
const G4Normal3D originalNormal(0,0,1); // ...so this is original normal.
|
||||
|
||||
const G4Plane3D& sp = vp.GetCutawayPlanes()[plane_no]; //];
|
||||
const G4double& a = sp.a();
|
||||
const G4double& b = sp.b();
|
||||
const G4double& c = sp.c();
|
||||
const G4double& d = sp.d();
|
||||
const G4Normal3D newNormal(-a,-b,-c); // Convention: keep a*x+b*y+c*z+d>=0
|
||||
// Not easy to see why the above gives the right convention, but it has been
|
||||
// arrived at by trial and error to agree with the OpenGL implementation
|
||||
// of clipping planes.
|
||||
|
||||
G4Transform3D requiredTransform; // Null transform
|
||||
// Calculate the rotation
|
||||
// If newNormal is (0,0,1), no need to do anything
|
||||
// Treat (0,0,-1) as a special case, since cannot define axis in this case
|
||||
if (newNormal == G4Normal3D(0,0,-1)) {
|
||||
requiredTransform = G4Rotate3D(pi,G4Vector3D(1,0,0));
|
||||
} else if (newNormal != originalNormal) {
|
||||
const G4double& angle = std::acos(newNormal.dot(originalNormal));
|
||||
const G4Vector3D& axis = originalNormal.cross(newNormal);
|
||||
requiredTransform = G4Rotate3D(angle, axis);
|
||||
}
|
||||
// Translation
|
||||
requiredTransform = requiredTransform * G4TranslateZ3D(d + safe);
|
||||
cutaway_solids.push_back
|
||||
(new G4DisplacedSolid("_displaced_cutaway_box", cutawayBox, requiredTransform));
|
||||
}
|
||||
|
||||
if (cutaway_solids.size() == 1){
|
||||
return (G4DisplacedSolid*) cutaway_solids[0];
|
||||
} else if (vp.GetCutawayMode() == G4ViewParameters::cutawayUnion) {
|
||||
G4UnionSolid* union2 =
|
||||
new G4UnionSolid("_union_2", cutaway_solids[0], cutaway_solids[1]);
|
||||
if (cutaway_solids.size() == 2)
|
||||
return (G4DisplacedSolid*)union2;
|
||||
else
|
||||
return (G4DisplacedSolid*)
|
||||
new G4UnionSolid("_union_3", union2, cutaway_solids[2]);
|
||||
} else if (vp.GetCutawayMode() == G4ViewParameters::cutawayIntersection){
|
||||
G4IntersectionSolid* intersection2 =
|
||||
new G4IntersectionSolid("_intersection_2", cutaway_solids[0], cutaway_solids[1]);
|
||||
if (cutaway_solids.size() == 2)
|
||||
return (G4DisplacedSolid*)intersection2;
|
||||
else
|
||||
return (G4DisplacedSolid*)
|
||||
new G4IntersectionSolid("_intersection_3", intersection2, cutaway_solids[2]);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
/*** An alternative way of getting a cutaway is to use
|
||||
Command /vis/scene/add/volume
|
||||
Guidance :
|
||||
Adds a physical volume to current scene, with optional clipping volume.
|
||||
If physical-volume-name is "world" (the default), the top of the
|
||||
main geometry tree (material world) is added. If "worlds", the
|
||||
top of all worlds - material world and parallel worlds, if any - are
|
||||
added. Otherwise a search of all worlds is made, taking the first
|
||||
matching occurrence only. To see a representation of the geometry
|
||||
hierarchy of the worlds, try "/vis/drawTree [worlds]" or one of the
|
||||
driver/browser combinations that have the required functionality, e.g., HepRep.
|
||||
If clip-volume-type is specified, the subsequent parameters are used to
|
||||
to define a clipping volume. For example,
|
||||
"/vis/scene/add/volume ! ! ! -box km 0 1 0 1 0 1" will draw the world
|
||||
with the positive octant cut away. (If the Boolean Processor issues
|
||||
warnings try replacing 0 by 0.000000001 or something.)
|
||||
If clip-volume-type is prepended with '-', the clip-volume is subtracted
|
||||
(cutaway). (This is the default if there is no prepended character.)
|
||||
If '*' is prepended, the intersection of the physical-volume and the
|
||||
clip-volume is made. (You can make a section/DCUT with a thin box, for
|
||||
example).
|
||||
For "box", the parameters are xmin,xmax,ymin,ymax,zmin,zmax.
|
||||
Only "box" is programmed at present.
|
||||
***/
|
||||
}
|
||||
|
||||
void G4VSceneHandler::LoadAtts(const G4Visible& visible, G4AttHolder* holder)
|
||||
@@ -1126,7 +1192,7 @@ G4int G4VSceneHandler::GetNoOfSides(const G4VisAttributes* pVisAttribs)
|
||||
lineSegmentsPerCircle = pVisAttribs->GetForcedLineSegmentsPerCircle();
|
||||
if (lineSegmentsPerCircle < pVisAttribs->GetMinLineSegmentsPerCircle()) {
|
||||
lineSegmentsPerCircle = pVisAttribs->GetMinLineSegmentsPerCircle();
|
||||
G4cout <<
|
||||
G4warn <<
|
||||
"G4VSceneHandler::GetNoOfSides: attempt to set the"
|
||||
"\nnumber of line segments per circle < " << lineSegmentsPerCircle
|
||||
<< "; forced to " << pVisAttribs->GetMinLineSegmentsPerCircle() << G4endl;
|
||||
@@ -1139,7 +1205,7 @@ std::ostream& operator << (std::ostream& os, const G4VSceneHandler& sh) {
|
||||
|
||||
os << "Scene handler " << sh.fName << " has "
|
||||
<< sh.fViewerList.size () << " viewer(s):";
|
||||
for (size_t i = 0; i < sh.fViewerList.size (); i++) {
|
||||
for (std::size_t i = 0; i < sh.fViewerList.size (); ++i) {
|
||||
os << "\n " << *(sh.fViewerList [i]);
|
||||
}
|
||||
|
||||
@@ -1238,8 +1304,26 @@ void G4VSceneHandler::StandardSpecialMeshRendering(const G4Mesh& mesh)
|
||||
case G4Mesh::sphere: [[fallthrough]];
|
||||
case G4Mesh::invalid: break;
|
||||
}
|
||||
if (!implemented) {
|
||||
G4VSceneHandler::AddCompound(mesh); // Base class function - just print warning
|
||||
if (implemented) {
|
||||
// Draw container if not marked invisible...
|
||||
auto container = mesh.GetContainerVolume();
|
||||
auto containerLogical = container->GetLogicalVolume();
|
||||
auto containerVisAtts = containerLogical->GetVisAttributes();
|
||||
if (containerVisAtts == nullptr || containerVisAtts->IsVisible()) {
|
||||
auto solid = containerLogical->GetSolid();
|
||||
auto polyhedron = solid->GetPolyhedron();
|
||||
// Always draw as wireframe
|
||||
G4VisAttributes tmpVisAtts;
|
||||
if (containerVisAtts != nullptr) tmpVisAtts = *containerVisAtts;
|
||||
tmpVisAtts.SetForceWireframe();
|
||||
polyhedron->SetVisAttributes(tmpVisAtts);
|
||||
BeginPrimitives(mesh.GetTransform());
|
||||
AddPrimitive(*polyhedron);
|
||||
EndPrimitives();
|
||||
}
|
||||
} else {
|
||||
// Invoke base class function
|
||||
G4VSceneHandler::AddCompound(mesh);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1324,10 +1408,7 @@ void G4VSceneHandler::Draw3DRectMeshAsDots(const G4Mesh& mesh)
|
||||
auto& dotsInMap = dotsByMaterial[material];
|
||||
const auto& range = positionByMaterial.equal_range(material);
|
||||
for (auto posByMat = range.first; posByMat != range.second; ++posByMat) {
|
||||
const G4double x = posByMat->second.getX() + (2.*G4UniformRand()-1.)*halfX;
|
||||
const G4double y = posByMat->second.getY() + (2.*G4UniformRand()-1.)*halfY;
|
||||
const G4double z = posByMat->second.getZ() + (2.*G4UniformRand()-1.)*halfZ;
|
||||
dotsInMap.push_back(G4ThreeVector(x,y,z));
|
||||
dotsInMap.push_back(GetPointInBox(posByMat->second, halfX, halfY, halfZ));
|
||||
++nDots;
|
||||
}
|
||||
|
||||
@@ -1610,28 +1691,7 @@ void G4VSceneHandler::DrawTetMeshAsDots(const G4Mesh& mesh)
|
||||
auto& dotsInMap = dotsByMaterial[material];
|
||||
const auto& range = verticesByMaterial.equal_range(material);
|
||||
for (auto vByMat = range.first; vByMat != range.second; ++vByMat) {
|
||||
const std::vector<G4ThreeVector>& vertices = vByMat->second;
|
||||
// Calculate extent/bounding box
|
||||
G4double xmin, xmax, ymin, ymax, zmin, zmax;
|
||||
xmin = ymin = zmin = DBL_MAX;
|
||||
xmax = ymax = zmax = -DBL_MAX;
|
||||
for (const auto& vertex: vertices) {
|
||||
if (xmin > vertex.x()) xmin = vertex.x();
|
||||
if (ymin > vertex.y()) ymin = vertex.y();
|
||||
if (zmin > vertex.z()) zmin = vertex.z();
|
||||
if (xmax < vertex.x()) xmax = vertex.x();
|
||||
if (ymax < vertex.y()) ymax = vertex.y();
|
||||
if (zmax < vertex.z()) zmax = vertex.z();
|
||||
}
|
||||
// Place dot at random in the extent/bounding box. Yes, I know this will
|
||||
// be bigger than the tetrahedron, so sometimes the position will be outside
|
||||
// the tetrahedron, but it will still give a reasonable visual representation.
|
||||
// If you have a smart algorithm for generating a random point in a
|
||||
// tetrahedron, please let us know.
|
||||
const G4double x = xmin + G4UniformRand()*(xmax - xmin);
|
||||
const G4double y = ymin + G4UniformRand()*(ymax - ymin);
|
||||
const G4double z = zmin + G4UniformRand()*(zmax - zmin);
|
||||
dotsInMap.push_back(G4ThreeVector(x,y,z));
|
||||
dotsInMap.push_back(GetPointInTet(vByMat->second));
|
||||
++nDots;
|
||||
}
|
||||
|
||||
@@ -1719,8 +1779,6 @@ void G4VSceneHandler::DrawTetMeshAsSurfaces(const G4Mesh& mesh)
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
const auto& container = mesh.GetContainerVolume();
|
||||
|
||||
// This map is static so that once filled it stays filled.
|
||||
static std::map<G4String,std::map<const G4Material*,G4Polyhedron>> surfacesByMaterialAndMesh;
|
||||
auto& surfacesByMaterial = surfacesByMaterialAndMesh[mesh.GetContainerVolume()->GetName()];
|
||||
@@ -1736,7 +1794,7 @@ void G4VSceneHandler::DrawTetMeshAsSurfaces(const G4Mesh& mesh)
|
||||
tmpMP.SetCullingInvisible(true); // ... or invisble volumes.
|
||||
const G4bool useFullExtent = true; // To avoid calculating the extent
|
||||
G4PhysicalVolumeModel tmpPVModel
|
||||
(container,
|
||||
(mesh.GetContainerVolume(),
|
||||
G4PhysicalVolumeModel::UNLIMITED,
|
||||
G4Transform3D(), // so that positions are in local coordinates
|
||||
&tmpMP,
|
||||
@@ -1836,3 +1894,42 @@ void G4VSceneHandler::DrawTetMeshAsSurfaces(const G4Mesh& mesh)
|
||||
firstPrint = false;
|
||||
return;
|
||||
}
|
||||
|
||||
G4ThreeVector
|
||||
G4VSceneHandler::GetPointInBox(const G4ThreeVector& pos,
|
||||
G4double halfX,
|
||||
G4double halfY,
|
||||
G4double halfZ) const
|
||||
{
|
||||
G4double x = pos.getX() + (2.*G4QuickRand() - 1.)*halfX;
|
||||
G4double y = pos.getY() + (2.*G4QuickRand() - 1.)*halfY;
|
||||
G4double z = pos.getZ() + (2.*G4QuickRand() - 1.)*halfZ;
|
||||
return G4ThreeVector(x, y, z);
|
||||
}
|
||||
|
||||
G4ThreeVector
|
||||
G4VSceneHandler::GetPointInTet(const std::vector<G4ThreeVector>& vertices) const
|
||||
{
|
||||
G4double p = G4QuickRand();
|
||||
G4double q = G4QuickRand();
|
||||
G4double r = G4QuickRand();
|
||||
if (p + q > 1.)
|
||||
{
|
||||
p = 1. - p;
|
||||
q = 1. - q;
|
||||
}
|
||||
if (q + r > 1.)
|
||||
{
|
||||
G4double tmp = r;
|
||||
r = 1. - p - q;
|
||||
q = 1. - tmp;
|
||||
}
|
||||
else if (p + q + r > 1.)
|
||||
{
|
||||
G4double tmp = r;
|
||||
r = p + q + r - 1.;
|
||||
p = 1. - q - tmp;
|
||||
}
|
||||
G4double a = 1. - p - q - r;
|
||||
return vertices[0]*a + vertices[1]*p + vertices[2]*q + vertices[3]*r;
|
||||
}
|
||||
|
||||
@@ -135,8 +135,8 @@ void G4VViewer::SetTouchable
|
||||
const auto& pvStore = G4PhysicalVolumeStore::GetInstance();
|
||||
for (const auto& pvNodeId: fullPath) {
|
||||
const auto& pv = pvNodeId.GetPhysicalVolume();
|
||||
auto iterator = find(pvStore->begin(),pvStore->end(),pv);
|
||||
if (iterator == pvStore->end()) {
|
||||
auto iterator = find(pvStore->cbegin(),pvStore->cend(),pv);
|
||||
if (iterator == pvStore->cend()) {
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Volume no longer in physical volume store.";
|
||||
G4Exception("G4VViewer::SetTouchable", "visman0501", JustWarning, ed);
|
||||
@@ -155,12 +155,8 @@ void G4VViewer::TouchableSetVisibility
|
||||
{
|
||||
// Changes the Vis Attribute Modifiers WITHOUT triggering a rebuild.
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << "/vis/touchable/set/visibility ";
|
||||
if (visibiity) oss << "true"; else oss << "false";
|
||||
|
||||
// The following is equivalent to
|
||||
// G4UImanager::GetUIpointer()->ApplyCommand(oss.str());
|
||||
// G4UImanager::GetUIpointer()->ApplyCommand("/vis/touchable/set/visibility ...");
|
||||
// (assuming the touchable has already been set), but avoids view rebuild.
|
||||
|
||||
// Instantiate a working copy of a G4VisAttributes object...
|
||||
@@ -176,11 +172,6 @@ void G4VViewer::TouchableSetVisibility
|
||||
// G4ModelingParameters::VASVisibility (VAS = Vis Attribute Signifier)
|
||||
// signifies that it is the visibility that should be picked out
|
||||
// and merged with the touchable's normal vis attributes.
|
||||
|
||||
// Record on G4cout (with #) for information.
|
||||
if (G4UImanager::GetUIpointer()->GetVerboseLevel() >= 2) {
|
||||
G4cout << "# " << oss.str() << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
void G4VViewer::TouchableSetColour
|
||||
@@ -189,13 +180,8 @@ void G4VViewer::TouchableSetColour
|
||||
{
|
||||
// Changes the Vis Attribute Modifiers WITHOUT triggering a rebuild.
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << "/vis/touchable/set/colour "
|
||||
<< colour.GetRed() << ' ' << colour.GetGreen()
|
||||
<< ' ' << colour.GetBlue() << ' ' << colour.GetAlpha();
|
||||
|
||||
// The following is equivalent to
|
||||
// G4UImanager::GetUIpointer()->ApplyCommand(oss.str());
|
||||
// G4UImanager::GetUIpointer()->ApplyCommand("/vis/touchable/set/colour ...");
|
||||
// (assuming the touchable has already been set), but avoids view rebuild.
|
||||
|
||||
// Instantiate a working copy of a G4VisAttributes object...
|
||||
@@ -211,11 +197,6 @@ void G4VViewer::TouchableSetColour
|
||||
// G4ModelingParameters::VASColour (VAS = Vis Attribute Signifier)
|
||||
// signifies that it is the colour that should be picked out
|
||||
// and merged with the touchable's normal vis attributes.
|
||||
|
||||
// Record on G4cout (with #) for information.
|
||||
if (G4UImanager::GetUIpointer()->GetVerboseLevel() >= 2) {
|
||||
G4cout << "# " << oss.str() << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector <G4ThreeVector> G4VViewer::ComputeFlyThrough(G4Vector3D* /*aVect*/)
|
||||
@@ -228,7 +209,7 @@ std::vector <G4ThreeVector> G4VViewer::ComputeFlyThrough(G4Vector3D* /*aVect*/)
|
||||
// int myCurveType = Bezier;
|
||||
|
||||
// number if step points
|
||||
int stepPoints = 500;
|
||||
G4int stepPoints = 500;
|
||||
|
||||
|
||||
G4Spline spline;
|
||||
@@ -248,8 +229,8 @@ std::vector <G4ThreeVector> G4VViewer::ComputeFlyThrough(G4Vector3D* /*aVect*/)
|
||||
|
||||
// Draw the spline
|
||||
|
||||
for (int i = 0; i < stepPoints; i++) {
|
||||
float t = (float)i / (float)stepPoints;
|
||||
for (G4int i = 0; i < stepPoints; ++i) {
|
||||
G4float t = (G4float)i / (G4float)stepPoints;
|
||||
G4Vector3D cameraPosition = spline.GetInterpolatedSplinePoint(t);
|
||||
// G4Vector3D targetPoint = spline.GetInterpolatedSplinePoint(t);
|
||||
|
||||
@@ -415,15 +396,15 @@ G4VViewer::G4Spline::~G4Spline()
|
||||
{}
|
||||
|
||||
// Solve the Catmull-Rom parametric equation for a given time(t) and vector quadruple (p1,p2,p3,p4)
|
||||
G4Vector3D G4VViewer::G4Spline::CatmullRom_Eq(float t, const G4Vector3D& p1, const G4Vector3D& p2, const G4Vector3D& p3, const G4Vector3D& p4)
|
||||
G4Vector3D G4VViewer::G4Spline::CatmullRom_Eq(G4float t, const G4Vector3D& p1, const G4Vector3D& p2, const G4Vector3D& p3, const G4Vector3D& p4)
|
||||
{
|
||||
float t2 = t * t;
|
||||
float t3 = t2 * t;
|
||||
G4float t2 = t * t;
|
||||
G4float t3 = t2 * t;
|
||||
|
||||
float b1 = .5 * ( -t3 + 2*t2 - t);
|
||||
float b2 = .5 * ( 3*t3 - 5*t2 + 2);
|
||||
float b3 = .5 * (-3*t3 + 4*t2 + t);
|
||||
float b4 = .5 * ( t3 - t2 );
|
||||
G4float b1 = .5 * ( -t3 + 2*t2 - t);
|
||||
G4float b2 = .5 * ( 3*t3 - 5*t2 + 2);
|
||||
G4float b3 = .5 * (-3*t3 + 4*t2 + t);
|
||||
G4float b4 = .5 * ( t3 - t2 );
|
||||
|
||||
return (p1*b1 + p2*b2 + p3*b3 + p4*b4);
|
||||
}
|
||||
@@ -431,32 +412,32 @@ G4Vector3D G4VViewer::G4Spline::CatmullRom_Eq(float t, const G4Vector3D& p1, con
|
||||
void G4VViewer::G4Spline::AddSplinePoint(const G4Vector3D& v)
|
||||
{
|
||||
vp.push_back(v);
|
||||
delta_t = (float)1 / (float)vp.size();
|
||||
delta_t = (G4float)1 / (G4float)vp.size();
|
||||
}
|
||||
|
||||
|
||||
G4Vector3D G4VViewer::G4Spline::GetPoint(int a)
|
||||
G4Vector3D G4VViewer::G4Spline::GetPoint(G4int a)
|
||||
{
|
||||
return vp[a];
|
||||
}
|
||||
|
||||
int G4VViewer::G4Spline::GetNumPoints()
|
||||
G4int G4VViewer::G4Spline::GetNumPoints()
|
||||
{
|
||||
return vp.size();
|
||||
return (G4int)vp.size();
|
||||
}
|
||||
|
||||
G4Vector3D G4VViewer::G4Spline::GetInterpolatedSplinePoint(float t)
|
||||
G4Vector3D G4VViewer::G4Spline::GetInterpolatedSplinePoint(G4float t)
|
||||
{
|
||||
// Find out in which interval we are on the spline
|
||||
int p = (int)(t / delta_t);
|
||||
G4int p = (G4int)(t / delta_t);
|
||||
// Compute local control point indices
|
||||
#define BOUNDS(pp) { if (pp < 0) pp = 0; else if (pp >= (int)vp.size()-1) pp = vp.size() - 1; }
|
||||
int p0 = p - 1; BOUNDS(p0);
|
||||
int p1 = p; BOUNDS(p1);
|
||||
int p2 = p + 1; BOUNDS(p2);
|
||||
int p3 = p + 2; BOUNDS(p3);
|
||||
#define BOUNDS(pp) { if (pp < 0) pp = 0; else if (pp >= (G4int)vp.size()-1) pp = (G4int)vp.size() - 1; }
|
||||
G4int p0 = p - 1; BOUNDS(p0);
|
||||
G4int p1 = p; BOUNDS(p1);
|
||||
G4int p2 = p + 1; BOUNDS(p2);
|
||||
G4int p3 = p + 2; BOUNDS(p3);
|
||||
// Relative (local) time
|
||||
float lt = (t - delta_t*(float)p) / delta_t;
|
||||
G4float lt = (t - delta_t*p) / delta_t;
|
||||
// Interpolate
|
||||
return CatmullRom_Eq(lt, vp[p0], vp[p1], vp[p2], vp[p3]);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
#include "G4PhysicalVolumeModel.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
G4int G4VVisCommand::fCurrentArrow3DLineSegmentsPerCircle = 6;
|
||||
G4Colour G4VVisCommand::fCurrentColour = G4Colour::White();
|
||||
G4Colour G4VVisCommand::fCurrentTextColour = G4Colour::Blue();
|
||||
@@ -101,7 +103,7 @@ G4bool G4VVisCommand::ConvertToDoublePair(const G4String& paramString,
|
||||
} else {
|
||||
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cout << "ERROR: Unrecognised unit" << G4endl;
|
||||
G4warn << "ERROR: Unrecognised unit" << G4endl;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -136,14 +138,14 @@ void G4VVisCommand::ConvertToColour
|
||||
|
||||
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
|
||||
|
||||
const size_t iPos0 = 0;
|
||||
const std::size_t iPos0 = 0;
|
||||
if (std::isalpha(redOrString[iPos0])) {
|
||||
|
||||
// redOrString is probably alphabetic characters defining the colour
|
||||
if (!G4Colour::GetColour(redOrString, colour)) {
|
||||
// Not a recognised string
|
||||
if (verbosity >= G4VisManager::warnings) {
|
||||
G4cout << "WARNING: Colour \"" << redOrString
|
||||
G4warn << "WARNING: Colour \"" << redOrString
|
||||
<< "\" not found. Defaulting to " << colour
|
||||
<< G4endl;
|
||||
}
|
||||
@@ -162,7 +164,7 @@ void G4VVisCommand::ConvertToColour
|
||||
iss >> red;
|
||||
if (iss.fail()) {
|
||||
if (verbosity >= G4VisManager::warnings) {
|
||||
G4cout << "WARNING: String \"" << redOrString
|
||||
G4warn << "WARNING: String \"" << redOrString
|
||||
<< "\" cannot be parsed. Defaulting to " << colour
|
||||
<< G4endl;
|
||||
}
|
||||
@@ -188,17 +190,17 @@ G4bool G4VVisCommand::ProvideValueOfUnit
|
||||
G4bool success = true;
|
||||
if (!G4UnitDefinition::IsUnitDefined(unit)) {
|
||||
if (verbosity >= G4VisManager::warnings) {
|
||||
G4cerr << where
|
||||
G4warn << where
|
||||
<< "\n Unit \"" << unit << "\" not defined"
|
||||
<< G4endl;
|
||||
}
|
||||
success = false;
|
||||
} else if (G4UnitDefinition::GetCategory(unit) != category) {
|
||||
if (verbosity >= G4VisManager::warnings) {
|
||||
G4cerr << where
|
||||
G4warn << where
|
||||
<< "\n Unit \"" << unit << "\" not a unit of " << category;
|
||||
if (category == "Volumic Mass") G4cerr << " (density)";
|
||||
G4cerr << G4endl;
|
||||
if (category == "Volumic Mass") G4warn << " (density)";
|
||||
G4warn << G4endl;
|
||||
}
|
||||
success = false;
|
||||
} else {
|
||||
@@ -213,7 +215,7 @@ void G4VVisCommand::CheckSceneAndNotifyHandlers(G4Scene* pScene)
|
||||
|
||||
if (!pScene) {
|
||||
if (verbosity >= G4VisManager::warnings) {
|
||||
G4cout << "WARNING: Scene pointer is null."
|
||||
G4warn << "WARNING: Scene pointer is null."
|
||||
<< G4endl;
|
||||
}
|
||||
return;
|
||||
@@ -222,7 +224,7 @@ void G4VVisCommand::CheckSceneAndNotifyHandlers(G4Scene* pScene)
|
||||
G4VSceneHandler* pSceneHandler = fpVisManager -> GetCurrentSceneHandler();
|
||||
if (!pSceneHandler) {
|
||||
if (verbosity >= G4VisManager::warnings) {
|
||||
G4cout << "WARNING: Scene handler not found." << G4endl;
|
||||
G4warn << "WARNING: Scene handler not found." << G4endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -244,7 +246,7 @@ G4bool G4VVisCommand::CheckView ()
|
||||
|
||||
if (!viewer) {
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cerr <<
|
||||
G4warn <<
|
||||
"ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
|
||||
<< G4endl;
|
||||
}
|
||||
@@ -258,7 +260,7 @@ void G4VVisCommand::G4VisCommandsSceneAddUnsuccessful
|
||||
(G4VisManager::Verbosity verbosity) {
|
||||
// Some frequently used error printing...
|
||||
if (verbosity >= G4VisManager::warnings) {
|
||||
G4cout <<
|
||||
G4warn <<
|
||||
"WARNING: For some reason, possibly mentioned above, it has not been"
|
||||
"\n possible to add to the scene."
|
||||
<< G4endl;
|
||||
@@ -281,7 +283,7 @@ void G4VVisCommand::RefreshIfRequired(G4VViewer* viewer) {
|
||||
}
|
||||
else {
|
||||
if (verbosity >= G4VisManager::warnings) {
|
||||
G4cout << "Issue /vis/viewer/refresh or flush to see effect."
|
||||
G4warn << "Issue /vis/viewer/refresh or flush to see effect."
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
@@ -295,7 +297,7 @@ void G4VVisCommand::InterpolateViews
|
||||
const G4int waitTimePerPointmilliseconds,
|
||||
const G4String exportString)
|
||||
{
|
||||
const G4int safety = viewVector.size()*nInterpolationPoints;
|
||||
const G4int safety = (G4int)viewVector.size()*nInterpolationPoints;
|
||||
G4int safetyCount = 0;
|
||||
do {
|
||||
G4ViewParameters* vp =
|
||||
@@ -395,7 +397,7 @@ void G4VVisCommand::CopyGuidanceFrom
|
||||
(const G4UIcommand* fromCmd, G4UIcommand* toCmd, G4int startLine)
|
||||
{
|
||||
if (fromCmd && toCmd) {
|
||||
const G4int nGuideEntries = fromCmd->GetGuidanceEntries();
|
||||
const G4int nGuideEntries = (G4int)fromCmd->GetGuidanceEntries();
|
||||
for (G4int i = startLine; i < nGuideEntries; ++i) {
|
||||
const G4String& guidance = fromCmd->GetGuidanceLine(i);
|
||||
toCmd->SetGuidance(guidance);
|
||||
@@ -407,7 +409,7 @@ void G4VVisCommand::CopyParametersFrom
|
||||
(const G4UIcommand* fromCmd, G4UIcommand* toCmd)
|
||||
{
|
||||
if (fromCmd && toCmd) {
|
||||
const G4int nParEntries = fromCmd->GetParameterEntries();
|
||||
const G4int nParEntries = (G4int)fromCmd->GetParameterEntries();
|
||||
for (G4int i = 0; i < nParEntries; ++i) {
|
||||
G4UIparameter* parameter = new G4UIparameter(*(fromCmd->GetParameter(i)));
|
||||
toCmd->SetParameter(parameter);
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
#include <sstream>
|
||||
#include <cmath>
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
G4ViewParameters::G4ViewParameters ():
|
||||
fDrawingStyle (wireframe),
|
||||
fNumberOfCloudPoints(10000),
|
||||
@@ -184,7 +186,7 @@ void G4ViewParameters::AddCutawayPlane (const G4Plane3D& cutawayPlane) {
|
||||
fCutawayPlanes.push_back (cutawayPlane);
|
||||
}
|
||||
else {
|
||||
G4cerr <<
|
||||
G4warn <<
|
||||
"ERROR: G4ViewParameters::AddCutawayPlane:"
|
||||
"\n A maximum of 3 cutaway planes supported." << G4endl;
|
||||
}
|
||||
@@ -193,7 +195,7 @@ void G4ViewParameters::AddCutawayPlane (const G4Plane3D& cutawayPlane) {
|
||||
void G4ViewParameters::ChangeCutawayPlane
|
||||
(size_t index, const G4Plane3D& cutawayPlane) {
|
||||
if (index >= fCutawayPlanes.size()) {
|
||||
G4cerr <<
|
||||
G4warn <<
|
||||
"ERROR: G4ViewParameters::ChangeCutawayPlane:"
|
||||
"\n Plane " << index << " does not exist." << G4endl;
|
||||
} else {
|
||||
@@ -204,12 +206,12 @@ void G4ViewParameters::ChangeCutawayPlane
|
||||
void G4ViewParameters::SetVisibleDensity (G4double visibleDensity) {
|
||||
const G4double reasonableMaximum = 10.0 * g / cm3;
|
||||
if (visibleDensity < 0) {
|
||||
G4cout << "G4ViewParameters::SetVisibleDensity: attempt to set negative "
|
||||
G4warn << "G4ViewParameters::SetVisibleDensity: attempt to set negative "
|
||||
"density - ignored." << G4endl;
|
||||
}
|
||||
else {
|
||||
if (visibleDensity > reasonableMaximum) {
|
||||
G4cout << "G4ViewParameters::SetVisibleDensity: density > "
|
||||
G4warn << "G4ViewParameters::SetVisibleDensity: density > "
|
||||
<< G4BestUnit (reasonableMaximum, "Volumic Mass")
|
||||
<< " - did you mean this?"
|
||||
<< G4endl;
|
||||
@@ -222,7 +224,7 @@ G4int G4ViewParameters::SetNoOfSides (G4int nSides) {
|
||||
const G4int nSidesMin = fDefaultVisAttributes.GetMinLineSegmentsPerCircle();
|
||||
if (nSides < nSidesMin) {
|
||||
nSides = nSidesMin;
|
||||
G4cout << "G4ViewParameters::SetNoOfSides: attempt to set the"
|
||||
G4warn << "G4ViewParameters::SetNoOfSides: attempt to set the"
|
||||
"\nnumber of sides per circle < " << nSidesMin
|
||||
<< "; forced to " << nSides << G4endl;
|
||||
}
|
||||
@@ -234,7 +236,7 @@ G4int G4ViewParameters::SetNumberOfCloudPoints(G4int nPoints) {
|
||||
const G4int nPointsMin = 100;
|
||||
if (nPoints < nPointsMin) {
|
||||
nPoints = nPointsMin;
|
||||
G4cout << "G4ViewParameters::SetNumberOfCloudPoints:"
|
||||
G4warn << "G4ViewParameters::SetNumberOfCloudPoints:"
|
||||
"\nnumber of points per cloud set to minimum " << nPoints
|
||||
<< G4endl;
|
||||
}
|
||||
@@ -253,7 +255,7 @@ void G4ViewParameters::SetViewAndLights
|
||||
static G4bool firstTime = true;
|
||||
if (firstTime) {
|
||||
firstTime = false;
|
||||
G4cout <<
|
||||
G4warn <<
|
||||
"WARNING: Viewpoint direction is very close to the up vector direction."
|
||||
"\n Change the up vector or \"/vis/viewer/set/rotationStyle freeRotation\"."
|
||||
<< G4endl;
|
||||
@@ -1259,7 +1261,7 @@ void G4ViewParameters::SetXGeometryString (const G4String& geomString)
|
||||
// if there is only Width. Special case to be backward compatible
|
||||
// We set Width and Height the same to obtain a square windows.
|
||||
|
||||
G4cout << "Unrecognised geometry string \""
|
||||
G4warn << "Unrecognised geometry string \""
|
||||
<< geomString
|
||||
<< "\". No Height found. Using Width value instead"
|
||||
<< G4endl;
|
||||
|
||||
@@ -47,6 +47,8 @@
|
||||
#include "G4PhysicalVolumeModel.hh"
|
||||
#include "G4AttDef.hh"
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
////////////// /vis/abortReviewKeptEvents /////////////////////////////
|
||||
|
||||
G4VisCommandAbortReviewKeptEvents::G4VisCommandAbortReviewKeptEvents () {
|
||||
@@ -69,7 +71,7 @@ G4String G4VisCommandAbortReviewKeptEvents::GetCurrentValue (G4UIcommand*) {
|
||||
void G4VisCommandAbortReviewKeptEvents::SetNewValue (G4UIcommand*,
|
||||
G4String newValue) {
|
||||
fpVisManager->SetAbortReviewKeptEvents(G4UIcommand::ConvertToBool(newValue));
|
||||
G4cout << "Type \"continue\" to complete the abort." << G4endl;
|
||||
G4warn << "Type \"continue\" to complete the abort." << G4endl;
|
||||
}
|
||||
|
||||
////////////// /vis/abortReviewPlots /////////////////////////////
|
||||
@@ -94,7 +96,7 @@ G4String G4VisCommandAbortReviewPlots::GetCurrentValue (G4UIcommand*) {
|
||||
void G4VisCommandAbortReviewPlots::SetNewValue (G4UIcommand*,
|
||||
G4String newValue) {
|
||||
fpVisManager->SetAbortReviewPlots(G4UIcommand::ConvertToBool(newValue));
|
||||
G4cout << "Type \"continue\" to complete the abort." << G4endl;
|
||||
G4warn << "Type \"continue\" to complete the abort." << G4endl;
|
||||
}
|
||||
|
||||
////////////// /vis/drawOnlyToBeKeptEvents /////////////////////////////
|
||||
@@ -131,9 +133,9 @@ void G4VisCommandDrawOnlyToBeKeptEvents::SetNewValue (G4UIcommand*,
|
||||
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
|
||||
if (verbosity < G4VisManager::warnings) {
|
||||
if (fpVisManager->GetDrawEventOnlyIfToBeKept()) {
|
||||
G4cout << "Only events that have been kept will be drawn." << G4endl;
|
||||
G4warn << "Only events that have been kept will be drawn." << G4endl;
|
||||
} else {
|
||||
G4cout << "All events will be drawn." << G4endl;
|
||||
G4warn << "All events will be drawn." << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -299,7 +301,7 @@ G4String G4VisCommandReviewKeptEvents::GetCurrentValue (G4UIcommand*)
|
||||
void G4VisCommandReviewKeptEvents::SetNewValue (G4UIcommand*, G4String newValue)
|
||||
{
|
||||
if (fpVisManager->GetReviewingKeptEvents()) {
|
||||
G4cout <<
|
||||
G4warn <<
|
||||
"\"/vis/reviewKeptEvents\" not allowed within an already started review."
|
||||
"\n No action taken."
|
||||
<< G4endl;
|
||||
@@ -317,7 +319,7 @@ void G4VisCommandReviewKeptEvents::SetNewValue (G4UIcommand*, G4String newValue)
|
||||
|
||||
if (!nKeptEvents) {
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cerr <<
|
||||
G4warn <<
|
||||
"ERROR: G4VisCommandReviewKeptEvents::SetNewValue: No kept events,"
|
||||
"\n or kept events not accessible."
|
||||
<< G4endl;
|
||||
@@ -328,7 +330,7 @@ void G4VisCommandReviewKeptEvents::SetNewValue (G4UIcommand*, G4String newValue)
|
||||
G4VViewer* viewer = fpVisManager->GetCurrentViewer();
|
||||
if (!viewer) {
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cerr <<
|
||||
G4warn <<
|
||||
"ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
|
||||
<< G4endl;
|
||||
}
|
||||
@@ -338,7 +340,7 @@ void G4VisCommandReviewKeptEvents::SetNewValue (G4UIcommand*, G4String newValue)
|
||||
G4Scene* pScene = fpVisManager->GetCurrentScene();
|
||||
if (!pScene) {
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
|
||||
G4warn << "ERROR: No current scene. Please create one." << G4endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -367,13 +369,13 @@ void G4VisCommandReviewKeptEvents::SetNewValue (G4UIcommand*, G4String newValue)
|
||||
for (size_t i = 0; i < nKeptEvents; ++i) {
|
||||
const G4Event* event = (*events)[i];
|
||||
if (verbosity >= G4VisManager::warnings) {
|
||||
G4cout << "Drawing event : " << event->GetEventID() <<
|
||||
G4warn << "Drawing event : " << event->GetEventID() <<
|
||||
". At EndOfEvent, enter any command, then \"cont[inue]\"..."
|
||||
<< G4endl;
|
||||
static G4bool first = true;
|
||||
if (first) {
|
||||
first = false;
|
||||
G4cout <<
|
||||
G4warn <<
|
||||
" Useful commands might be:"
|
||||
"\n \"/vis/scene/add/trajectories\" if not already added."
|
||||
"\n \"/vis/viewer/...\" to change the view (zoom, set/viewpoint,...)."
|
||||
@@ -413,7 +415,7 @@ void G4VisCommandReviewKeptEvents::SetNewValue (G4UIcommand*, G4String newValue)
|
||||
for (size_t i = 0; i < nKeptEvents; ++i) {
|
||||
const G4Event* event = (*events)[i];
|
||||
if (verbosity >= G4VisManager::warnings) {
|
||||
G4cout << "Drawing event : " << event->GetEventID()
|
||||
G4warn << "Drawing event : " << event->GetEventID()
|
||||
<< " with macro file \"" << macroFileName << G4endl;
|
||||
}
|
||||
fpVisManager->SetRequestedEvent(event);
|
||||
@@ -496,7 +498,7 @@ namespace {
|
||||
void G4VisCommandReviewPlots::SetNewValue (G4UIcommand*, G4String)
|
||||
{
|
||||
if (fpVisManager->GetReviewingPlots()) {
|
||||
G4cout <<
|
||||
G4warn <<
|
||||
"\"/vis/reviewPlots\" not allowed within an already started review."
|
||||
"\n No action taken."
|
||||
<< G4endl;
|
||||
@@ -508,7 +510,7 @@ void G4VisCommandReviewPlots::SetNewValue (G4UIcommand*, G4String)
|
||||
auto currentViewer = fpVisManager->GetCurrentViewer();
|
||||
if (!currentViewer) {
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cerr <<
|
||||
G4warn <<
|
||||
"ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
|
||||
<< G4endl;
|
||||
}
|
||||
@@ -516,7 +518,7 @@ void G4VisCommandReviewPlots::SetNewValue (G4UIcommand*, G4String)
|
||||
}
|
||||
|
||||
if (currentViewer->GetName().find("TOOLSSG") == std::string::npos) {
|
||||
G4cerr <<
|
||||
G4warn <<
|
||||
"WARNING: Current viewer not able to draw plots."
|
||||
"\n Try \"/vis/open TSG\", then \"/vis/reviewPlots\" again."
|
||||
<< G4endl;
|
||||
@@ -526,7 +528,7 @@ void G4VisCommandReviewPlots::SetNewValue (G4UIcommand*, G4String)
|
||||
G4Scene* pScene = fpVisManager->GetCurrentScene();
|
||||
if (!pScene) {
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cerr << "ERROR: No current scene. Please create one." << G4endl;
|
||||
G4warn << "ERROR: No current scene. Please create one." << G4endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#include <sstream>
|
||||
#include <set>
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
////////////// /vis/drawTree ///////////////////////////////////////
|
||||
|
||||
G4VisCommandDrawTree::G4VisCommandDrawTree() {
|
||||
@@ -112,7 +114,7 @@ void G4VisCommandDrawTree::SetNewValue(G4UIcommand*, G4String newValue) {
|
||||
}
|
||||
if (keepViewer) {
|
||||
if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) {
|
||||
G4cout << "Reverting to " << keepViewer->GetName() << G4endl;
|
||||
G4warn << "Reverting to " << keepViewer->GetName() << G4endl;
|
||||
}
|
||||
fpVisManager->SetCurrentGraphicsSystem(keepSystem);
|
||||
fpVisManager->SetCurrentScene(keepScene);
|
||||
@@ -168,7 +170,7 @@ void G4VisCommandDrawView::SetNewValue(G4UIcommand*, G4String newValue) {
|
||||
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
|
||||
if (!currentViewer) {
|
||||
if (verbosity >= G4VisManager::warnings) {
|
||||
G4cout <<
|
||||
G4warn <<
|
||||
"WARNING: G4VisCommandsDrawView::SetNewValue: no current viewer."
|
||||
<< G4endl;
|
||||
}
|
||||
@@ -188,12 +190,6 @@ void G4VisCommandDrawView::SetNewValue(G4UIcommand*, G4String newValue) {
|
||||
>> zoomFactor >> dolly >> dollyUnit;
|
||||
|
||||
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
||||
G4int keepVerbose = UImanager->GetVerboseLevel();
|
||||
G4int newVerbose(0);
|
||||
if (keepVerbose >= 2 ||
|
||||
fpVisManager->GetVerbosity() >= G4VisManager::confirmations)
|
||||
newVerbose = 2;
|
||||
UImanager->SetVerboseLevel(newVerbose);
|
||||
G4ViewParameters vp = currentViewer->GetViewParameters();
|
||||
G4bool keepAutoRefresh = vp.IsAutoRefresh();
|
||||
vp.SetAutoRefresh(false);
|
||||
@@ -209,7 +205,6 @@ void G4VisCommandDrawView::SetNewValue(G4UIcommand*, G4String newValue) {
|
||||
currentViewer->SetViewParameters(vp);
|
||||
UImanager->ApplyCommand(
|
||||
G4String("/vis/viewer/dollyTo " + dolly + " " + dollyUnit));
|
||||
UImanager->SetVerboseLevel(keepVerbose);
|
||||
}
|
||||
|
||||
////////////// /vis/drawLogicalVolume ///////////////////////////////////////
|
||||
@@ -238,11 +233,6 @@ G4VisCommandDrawLogicalVolume::~G4VisCommandDrawLogicalVolume() {
|
||||
void G4VisCommandDrawLogicalVolume::SetNewValue(G4UIcommand*, G4String newValue) {
|
||||
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
|
||||
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
||||
G4int keepVerbose = UImanager->GetVerboseLevel();
|
||||
G4int newVerbose(0);
|
||||
if (keepVerbose >= 2 || verbosity >= G4VisManager::confirmations)
|
||||
newVerbose = 2;
|
||||
UImanager->SetVerboseLevel(newVerbose);
|
||||
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
|
||||
const G4ViewParameters& currentViewParams = currentViewer->GetViewParameters();
|
||||
G4bool keepAutoRefresh = currentViewParams.IsAutoRefresh();
|
||||
@@ -256,10 +246,9 @@ void G4VisCommandDrawLogicalVolume::SetNewValue(G4UIcommand*, G4String newValue)
|
||||
G4bool keepMarkerNotHidden = currentViewParams.IsMarkerNotHidden();
|
||||
if (!keepMarkerNotHidden) UImanager->ApplyCommand("/vis/viewer/set/hiddenMarker false");
|
||||
if (keepAutoRefresh) UImanager->ApplyCommand("/vis/viewer/set/autoRefresh true");
|
||||
UImanager->SetVerboseLevel(keepVerbose);
|
||||
if (verbosity >= G4VisManager::warnings) {
|
||||
if (keepDrawingStyle != currentViewParams.GetDrawingStyle()) {
|
||||
G4cout
|
||||
G4warn
|
||||
<< "Drawing style changed to wireframe. To restore previous style:";
|
||||
G4String style, edge;
|
||||
switch (keepDrawingStyle) {
|
||||
@@ -274,12 +263,12 @@ void G4VisCommandDrawLogicalVolume::SetNewValue(G4UIcommand*, G4String newValue)
|
||||
case G4ViewParameters::cloud:
|
||||
style = "cloud"; edge = ""; break;
|
||||
}
|
||||
G4cout << "\n /vis/viewer/set/style " + style;
|
||||
if (!edge.empty()) G4cout << "\n /vis/viewer/set/hiddenEdge " + edge;
|
||||
G4cout << G4endl;
|
||||
G4warn << "\n /vis/viewer/set/style " + style;
|
||||
if (!edge.empty()) G4warn << "\n /vis/viewer/set/hiddenEdge " + edge;
|
||||
G4warn << G4endl;
|
||||
}
|
||||
if (keepMarkerNotHidden != currentViewParams.IsMarkerNotHidden()) {
|
||||
G4cout
|
||||
G4warn
|
||||
<< "Markers changed to \"not hidden\". To restore previous condition:"
|
||||
<< "\n /vis/viewer/set/hiddenmarker true"
|
||||
<< G4endl;
|
||||
@@ -317,15 +306,9 @@ G4VisCommandDrawVolume::~G4VisCommandDrawVolume() {
|
||||
void G4VisCommandDrawVolume::SetNewValue(G4UIcommand*, G4String newValue) {
|
||||
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
|
||||
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
||||
G4int keepVerbose = UImanager->GetVerboseLevel();
|
||||
G4int newVerbose(0);
|
||||
if (keepVerbose >= 2 || verbosity >= G4VisManager::confirmations)
|
||||
newVerbose = 2;
|
||||
UImanager->SetVerboseLevel(newVerbose);
|
||||
UImanager->ApplyCommand("/vis/scene/create");
|
||||
UImanager->ApplyCommand(G4String("/vis/scene/add/volume " + newValue));
|
||||
UImanager->ApplyCommand("/vis/sceneHandler/attach");
|
||||
UImanager->SetVerboseLevel(keepVerbose);
|
||||
static G4bool warned = false;
|
||||
if (verbosity >= G4VisManager::confirmations && !warned) {
|
||||
G4cout <<
|
||||
@@ -384,12 +367,6 @@ void G4VisCommandOpen::SetNewValue (G4UIcommand* command, G4String newValue)
|
||||
std::istringstream is(newValue);
|
||||
is >> systemName >> windowSizeHint;
|
||||
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
||||
G4int keepVerbose = UImanager->GetVerboseLevel();
|
||||
G4int newVerbose(0);
|
||||
if (keepVerbose >= 2 ||
|
||||
fpVisManager->GetVerbosity() >= G4VisManager::confirmations)
|
||||
newVerbose = 2;
|
||||
UImanager->SetVerboseLevel(newVerbose);
|
||||
|
||||
auto errorCode = UImanager->ApplyCommand(G4String("/vis/sceneHandler/create " + systemName));
|
||||
if (errorCode) {
|
||||
@@ -413,8 +390,6 @@ finish:
|
||||
fpVisManager->PrintAvailableGraphicsSystems(G4VisManager::warnings,ed);
|
||||
command->CommandFailed(errorCode,ed);
|
||||
}
|
||||
|
||||
UImanager->SetVerboseLevel(keepVerbose);
|
||||
}
|
||||
|
||||
////////////// /vis/plot ///////////////////////////////////////
|
||||
@@ -447,7 +422,7 @@ void G4VisCommandPlot::SetNewValue (G4UIcommand*, G4String newValue)
|
||||
{
|
||||
auto currentViewer = fpVisManager->GetCurrentViewer();
|
||||
if (currentViewer->GetName().find("TOOLSSG") == std::string::npos) {
|
||||
G4cerr <<
|
||||
G4warn <<
|
||||
"WARNING: Current viewer not able to draw plots."
|
||||
"\n Try \"/vis/open TSG\", then \"/vis/plot " << newValue << "\" again."
|
||||
<< G4endl;
|
||||
@@ -476,7 +451,7 @@ void G4VisCommandPlot::SetNewValue (G4UIcommand*, G4String newValue)
|
||||
|
||||
if (!keepEnable) {
|
||||
fpVisManager->Disable();
|
||||
G4cerr <<
|
||||
G4warn <<
|
||||
"WARNING: drawing was enabled for plotting but is now restored to disabled mode."
|
||||
<< G4endl;
|
||||
}
|
||||
@@ -533,16 +508,10 @@ G4VisCommandSpecify::~G4VisCommandSpecify() {
|
||||
void G4VisCommandSpecify::SetNewValue(G4UIcommand*, G4String newValue) {
|
||||
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
|
||||
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
||||
G4int keepVerbose = UImanager->GetVerboseLevel();
|
||||
G4int newVerbose(0);
|
||||
if (keepVerbose >= 2 || verbosity >= G4VisManager::confirmations)
|
||||
newVerbose = 2;
|
||||
UImanager->SetVerboseLevel(newVerbose);
|
||||
// UImanager->ApplyCommand(G4String("/geometry/print " + newValue));
|
||||
UImanager->ApplyCommand("/vis/scene/create");
|
||||
UImanager->ApplyCommand(G4String("/vis/scene/add/logicalVolume " + newValue));
|
||||
UImanager->ApplyCommand("/vis/sceneHandler/attach");
|
||||
UImanager->SetVerboseLevel(keepVerbose);
|
||||
static G4bool warned = false;
|
||||
if (verbosity >= G4VisManager::confirmations && !warned) {
|
||||
G4cout <<
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4UImanager.hh"
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
std::map<G4LogicalVolume*, const G4VisAttributes*>
|
||||
G4VVisCommandGeometry::fVisAttsMap;
|
||||
|
||||
@@ -86,7 +88,7 @@ void G4VisCommandGeometryList::SetNewValue(G4UIcommand*, G4String newValue)
|
||||
}
|
||||
if (newValue != "all" && !found) {
|
||||
if (fpVisManager->GetVerbosity() >= G4VisManager::errors) {
|
||||
G4cerr << "ERROR: Logical volume \"" << newValue
|
||||
G4warn << "ERROR: Logical volume \"" << newValue
|
||||
<< "\" not found in logical volume store." << G4endl;
|
||||
}
|
||||
return;
|
||||
@@ -143,7 +145,7 @@ void G4VisCommandGeometryRestore::SetNewValue(G4UIcommand*, G4String newValue)
|
||||
}
|
||||
if (newValue != "all" && !found) {
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cerr << "ERROR: Logical volume \"" << newValue
|
||||
G4warn << "ERROR: Logical volume \"" << newValue
|
||||
<< "\" not found in logical volume store." << G4endl;
|
||||
}
|
||||
return;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user