Import Geant4 9.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:25:56 +02:00
parent 74cad5e589
commit 89a9605df1
4440 changed files with 379508 additions and 189225 deletions
@@ -0,0 +1,20 @@
#------------------------------------------------------------------------------
# CMakeLists.txt
# Module : G4vis_management
# Package: Geant4.src.G4visualization.G4vis_management
#
# CMakeLists.txt for single level library that may be build global or granular
#
# Generated on : 24/9/2010
#
# $Id: CMakeLists.txt,v 1.1 2010/09/29 19:14:49 bmorgan Exp $
#
#------------------------------------------------------------------------------
include(Geant4MacroLibraryTargets)
if(GEANT4_BUILD_GRANULAR_LIBS)
GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
else()
GEANT4_GLOBAL_LIBRARY_TARGET(COMPONENTS sources.cmake)
endif()
+4 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.16 2009/11/04 12:58:43 allison Exp $
# $Id: GNUmakefile,v 1.17 2010/03/08 16:34:17 lgarnier Exp $
# -------------------------------------------------------------
# GNUmakefile for visualization library. John Allison, 5/7/95.
@@ -8,6 +8,9 @@ ifndef G4INSTALL
G4INSTALL = ../../..
endif
# For debug mode
# CPPFLAGS += -DG4DEBUG_VIS_MANAGEMENT
GLOBLIBS = libG4modeling.lib
GLOBLIBS += libG4run.lib libG4event.lib
GLOBLIBS += libG4tracking.lib libG4processes.lib libG4digits_hits.lib
+113 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.137 2009/11/22 14:08:09 allison Exp $
$Id: History,v 1.160.2.1 2010/12/14 15:55:56 gcosmo Exp $
-------------------------------------------------------------------
@@ -26,6 +26,118 @@ committal in the CVS repository !
History file for visualization management sub-category
------------------------------------------------------
14th December 2010 Gabriele Cosmo (visman-V09-03-16)
- G4VisManager: moved GetVerbosity() static method to non-inline to allow for
Windows DLL exporting.
13th November 2010 John Allison (visman-V09-03-15)
- G4VisCommandScene.cc:
o Backed out change in /vis/scene/notifyHandlers.
o Improved comments.
- G4VisManager.hh: Tidied layout.
10th November 2010 Laurent Garnier
- G4VisCommandScene.cc:
o In /vis/scene/notifyHandlers: Add a clear for Transient Store.
7th November 2010 John Allison (visman-V09-03-14)
- G4VisExecutive.icc: Inlined constructor.
- G4VisManager.cc: Fixed Coverity warning.
- G4VisCommandsViewer.cc: Fixed Coverity warning.
6th November 2010 John Allison
- G4VisCommandsSceneAdd.cc: Fixed Coverity warning.
5th November 2010 John Allison (visman-V09-03-13)
- G4VSceneHandler.cc and G4ViewParameters.cc:
o Fixed Coverity warning.
6th October 2010 John Allison (visman-V09-03-12)
- Added /vis/viewer/set/defaultColour and /vis/viewer/set/defaultTextColour.
3rd September 2010 Gabriele Cosmo (visman-V09-03-11)
- Added missing inclusion of <sstream> header in G4ViewParameters.cc.
15th June 2010 John Allison (visman-V09-03-10)
- G4VisCommandsGeometrySet.hh: Added virtual destructors to fix
compilation warnings.
- G4VisCommandsGeometrySet.cc: Changed "/vis/viewer/rebuild" to
"/vis/scene/notifyHandlers", the command to be executed after a
"/vis/geometry/..." command. "/vis/scene/notifyHandlers" causes
rebuild if viewer is "auto-refresh", otherwiae a message advises a
rebuild. This prevents over-enthusiatic rebuildin.
3rd June 2010 John Allison (visman-V09-03-09)
- G4VisManager.cc: Checked valid view in DispatchToModel.
- Changed /vis/scene/add/digiti[sz]ations to /vis/scene/add/digis.
1st June 2010 John Allison (visman-V09-03-07)
- G4VisManager:
o Made fVerbosity and GetVerbosity static (saves having to get vis
manager pointer).
o Some tidying.
- G4VisCommandsSceneAdd.cc: Fixed compiler warning.
30th May 2010 John Allison (visman-V09-03-06)
- Added /vis/scene/add/digiti[sz]ations.
- Added /vis/filtering/digi.
- G4VisManager, G4VisExecutive: Added registration and methods for digis.
- G4VSceneHandler: Added AddCompound(const G4VDigi&).
29th May 2010 John Allison (visman-V09-03-05)
- Co-works greps-V09-03-01 and tracking-V09-03-03.
- G4VisManager:
o Introduced DispatchToModel without i_mode.
o Moved i-mode deprecation warning to G4VTrajectory.
- G4VSceneHandler.cc:
o Moved i-mode deprecation warning to G4VTrajectory.
- G4VisCommandsViewer.cc: /vis/viewer/rebuild:
o Added sceneHandler->ClearTransientStore().
o Added viewer->Set/Clear/DrawView().
28th May 2010 John Allison (visman-V09-03-04)
- G4VisManager, G4VisExecutive:
Introduced optional verbosity string argument in constructor. You
can now write, for example:
G4VisManager* visManager = new G4VisExecutive("quiet");
Note that the default is "warnings":
G4VisManager* visManager = new G4VisExecutive;
28th May 2010 John Allison (visman-V09-03-03)
- Co-works interfaces-V09-03-04.
- G4VisExecutive.icc: Change order of flags to follow G4UIExecutive.
26th May 2010 John Allison (visman-V09-03-02)
- G4VisExecutive.icc: Added drivers with generic nicknames:
o OGL, OGLI, OGLS, OI.
o The specific driver depends on G4VIS_USE and G4UI_USE flags. So,
for example, "/vis/open OGL" might open an OGLSX window on X or an
OGLSWin32 on Windows. It means that example vis.mac scripts can
be written with this generic command that will work on all systems
and all user choices. In particular, it will open an OGLSQt
window in a G4UIQt session.
20th May 2010 John Allison (visman-V09-03-01)
- G4VisCommandsCompound.cc: Restore previous viewer after /vis/drawTree.
- G4VisManager.hh: Cosmetic.
- G4VGraphicsSystem: Add Set methods.
11th May 2010 John Allison (visman-V09-03-00)
- G4VSceneHandler:
o Follow change in generic section and cutaway interface.
o Trap use of user-defined DrawTrajectory and print i_mode warning.
- G4VisCommandsSceneAdd.cc:
o Follow change in generic section and cutaway interface.
o Trap use of i_mode and print warning.
- G4VisManager.cc:
o Trap use of i_mode and print warning.
9th March 2010 Laurent Garnier
- G4OpenGLViewer : Fix clipping when resizing non square size windows
8th March 2010 Laurent Garnier
-G4VisManager.cc : Add protection against null pointer
22nd November 2009 John Allison (visman-V09-02-08)
- G4VisCommandsSceneAdd.cc: /vis/scene/add/trajectories rich:
o Added G4RichTrajectoryPoint().GetAttDefs() to informational.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VGraphicsSystem.hh,v 1.11 2006/06/29 21:28:04 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VGraphicsSystem.hh,v 1.12 2010/05/20 07:55:47 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
// John Allison 27th March 1996
@@ -79,11 +79,15 @@ public: // With description
const G4String& GetNickname () const;
const G4String& GetDescription () const;
Functionality GetFunctionality () const;
void SetName (const G4String&);
void SetNickName (const G4String&);
void SetDescription (const G4String&);
void SetFunctionality (Functionality);
protected:
const G4String fName;
const G4String fNickname;
const G4String fDescription;
G4String fName;
G4String fNickname;
G4String fDescription;
Functionality fFunctionality;
};
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VGraphicsSystem.icc,v 1.7 2006/06/29 21:28:06 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VGraphicsSystem.icc,v 1.8 2010/05/20 07:55:47 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
// John Allison 27th March 1996
@@ -47,3 +47,19 @@ inline G4VGraphicsSystem::Functionality
G4VGraphicsSystem::GetFunctionality () const {
return fFunctionality;
}
inline void G4VGraphicsSystem::SetName (const G4String& name) {
fName = name;
}
inline void G4VGraphicsSystem::SetNickName (const G4String& nickname) {
fNickname = nickname;
}
inline void G4VGraphicsSystem::SetDescription (const G4String& description) {
fDescription = description;
}
inline void G4VGraphicsSystem::SetFunctionality (Functionality f) {
fFunctionality = f;
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VSceneHandler.hh,v 1.42 2009/11/04 12:55:33 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4VSceneHandler.hh,v 1.44 2010/05/30 11:30:49 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
// John Allison 19th July 1996.
@@ -128,6 +128,7 @@ public: // With description
virtual void AddCompound (const G4VTrajectory&);
virtual void AddCompound (const G4VHit&);
virtual void AddCompound (const G4VDigi&);
virtual void AddCompound (const G4THitsMap<G4double>&);
//////////////////////////////////////////////////////////////
@@ -308,19 +309,20 @@ protected:
//////////////////////////////////////////////////////////////
// Other internal routines...
virtual const G4Polyhedron* CreateSectionPolyhedron ();
virtual const G4Polyhedron* CreateCutawayPolyhedron ();
virtual G4VSolid* CreateSectionSolid ();
virtual G4VSolid* CreateCutawaySolid ();
// Generic clipping using the BooleanProcessor in graphics_reps is
// implemented in this class. Subclasses that implement their own
// clipping should provide an override that returns zero.
void LoadAtts(const G4Visible&, G4AttHolder*);
// Load G4AttValues and G4AttDefs associated with the G4Visible
// object onto the G4AttHolder object. It checks fpModel, and also
// loads the G4AttValues and G4AttDefs from G4PhysicalVolumeModel,
// G4VTrajectory, G4VTrajectoryPoint, or G4VHits, as appropriate.
// The G4AttHolder object is an object of a class that publicly
// inherits G4AttHolder - see, e.g., SoG4Polyhedron in the Open
// Inventor driver. G4AttHolder deletes G4AttValues in its
// G4VTrajectory, G4VTrajectoryPoint, G4VHit or G4VDigi, as
// appropriate. The G4AttHolder object is an object of a class that
// publicly inherits G4AttHolder - see, e.g., SoG4Polyhedron in the
// Open Inventor driver. G4AttHolder deletes G4AttValues in its
// destructor to ensure proper clean-up of G4AttValues.
//////////////////////////////////////////////////////////////
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsGeometrySet.hh,v 1.3 2007/01/05 16:24:19 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VisCommandsGeometrySet.hh,v 1.4 2010/06/15 16:33:55 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
// /vis/geometry commands - John Allison 31st January 2006
@@ -39,12 +39,14 @@ class G4VisAttributes;
class G4VVisCommandGeometrySetFunction {
public:
virtual ~G4VVisCommandGeometrySetFunction() {}
virtual void operator()(G4VisAttributes*) const = 0;
};
class G4VisCommandGeometrySetColourFunction:
public G4VVisCommandGeometrySetFunction {
public:
virtual ~G4VisCommandGeometrySetColourFunction() {}
G4VisCommandGeometrySetColourFunction
(const G4Colour& colour):
fColour(colour) {}
@@ -58,6 +60,7 @@ private:
class G4VisCommandGeometrySetDaughtersInvisibleFunction:
public G4VVisCommandGeometrySetFunction {
public:
virtual ~G4VisCommandGeometrySetDaughtersInvisibleFunction() {}
G4VisCommandGeometrySetDaughtersInvisibleFunction
(G4bool daughtersInvisible):
fDaughtersInvisible(daughtersInvisible) {}
@@ -71,6 +74,7 @@ private:
class G4VisCommandGeometrySetForceAuxEdgeVisibleFunction:
public G4VVisCommandGeometrySetFunction {
public:
virtual ~G4VisCommandGeometrySetForceAuxEdgeVisibleFunction() {}
G4VisCommandGeometrySetForceAuxEdgeVisibleFunction
(G4bool forceAuxEdgeVisible):
fForceAuxEdgeVisible(forceAuxEdgeVisible) {}
@@ -84,6 +88,7 @@ private:
class G4VisCommandGeometrySetForceLineSegmentsPerCircleFunction:
public G4VVisCommandGeometrySetFunction {
public:
virtual ~G4VisCommandGeometrySetForceLineSegmentsPerCircleFunction() {}
G4VisCommandGeometrySetForceLineSegmentsPerCircleFunction
(G4int lineSegmentsPerCircle):
fLineSegmentsPerCircle(lineSegmentsPerCircle) {}
@@ -97,6 +102,7 @@ private:
class G4VisCommandGeometrySetForceSolidFunction:
public G4VVisCommandGeometrySetFunction {
public:
virtual ~G4VisCommandGeometrySetForceSolidFunction() {}
G4VisCommandGeometrySetForceSolidFunction
(G4bool forceSolid):
fForceSolid(forceSolid) {}
@@ -110,6 +116,7 @@ private:
class G4VisCommandGeometrySetForceWireframeFunction:
public G4VVisCommandGeometrySetFunction {
public:
virtual ~G4VisCommandGeometrySetForceWireframeFunction() {}
G4VisCommandGeometrySetForceWireframeFunction
(G4bool forceWireframe):
fForceWireframe(forceWireframe) {}
@@ -123,6 +130,7 @@ private:
class G4VisCommandGeometrySetLineStyleFunction:
public G4VVisCommandGeometrySetFunction {
public:
virtual ~G4VisCommandGeometrySetLineStyleFunction() {}
G4VisCommandGeometrySetLineStyleFunction
(G4VisAttributes::LineStyle lineStyle):
fLineStyle(lineStyle) {}
@@ -136,6 +144,7 @@ private:
class G4VisCommandGeometrySetLineWidthFunction:
public G4VVisCommandGeometrySetFunction {
public:
virtual ~G4VisCommandGeometrySetLineWidthFunction() {}
G4VisCommandGeometrySetLineWidthFunction
(G4double lineWidth):
fLineWidth(lineWidth) {}
@@ -149,6 +158,7 @@ private:
class G4VisCommandGeometrySetVisibilityFunction:
public G4VVisCommandGeometrySetFunction {
public:
virtual ~G4VisCommandGeometrySetVisibilityFunction() {}
G4VisCommandGeometrySetVisibilityFunction
(G4bool visibility):
fVisibility(visibility) {}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsSceneAdd.hh,v 1.19 2009/11/04 13:15:02 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4VisCommandsSceneAdd.hh,v 1.21 2010/06/03 10:17:44 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
// /vis/scene commands - John Allison 9th August 1998
@@ -52,6 +52,18 @@ private:
G4UIcommand* fpCommand;
};
class G4VisCommandSceneAddDigis: public G4VVisCommandScene {
public:
G4VisCommandSceneAddDigis ();
virtual ~G4VisCommandSceneAddDigis ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4VisCommandSceneAddDigis (const G4VisCommandSceneAddDigis&);
G4VisCommandSceneAddDigis& operator = (const G4VisCommandSceneAddDigis&);
G4UIcmdWithoutParameter* fpCommand;
};
class G4VisCommandSceneAddEventID: public G4VVisCommandScene {
public:
G4VisCommandSceneAddEventID ();
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsViewerSet.hh,v 1.23 2009/05/13 18:17:25 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4VisCommandsViewerSet.hh,v 1.24 2010/10/06 10:15:38 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
// /vis/viewer/set commands - John Allison 16th May 2000
@@ -58,6 +58,8 @@ private:
G4UIcommand* fpCommandBackground;
G4UIcommand* fpCommandCulling;
G4UIcmdWithAString* fpCommandCutawayMode;
G4UIcommand* fpCommandDefaultColour;
G4UIcommand* fpCommandDefaultTextColour;
G4UIcmdWithABool* fpCommandEdge;
G4UIcommand* fpCommandExplodeFactor;
G4UIcmdWithADouble* fpCommandGlobalMarkerScale;
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisExecutive.hh,v 1.9 2009/11/17 15:34:06 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4VisExecutive.hh,v 1.10 2010/05/28 16:48:03 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
// John Allison 2nd February 2005 (based on MyVisManager, 24th January 1998).
@@ -55,7 +55,7 @@
// ...
// #ifdef G4VIS_USE
// // Instantiate and initialise Visualization Manager.
// G4VisManager* visManager = new G4VisExecutive; // See Nore (a).
// G4VisManager* visManager = new G4VisExecutive; // See Note (a).
// visManager -> SetVerboseLevel (verbosityString); // See Note (b).
// visManager -> RegisterGraphicsSystem (new myGS); // See Note (c).
// visManager -> Initialize (); // See Note (d).
@@ -76,7 +76,9 @@
// separate file, see advice below.
// (b) The verbosityString ("quiet", "errors", "warnings",
// "confirmations", etc. - "help /vis/verbose" to see options) can be
// set here or with /vis/verbose.
// set here or with /vis/verbose. Alternatively, you can instantiate
// with a verbosity string. e.g:
// G4VisManager* visManager = new G4VisExecutive("quiet");
// (c) You can register your own graphics system like this.
// (d) Your can intialise like this with C++ code or use /vis/initialize.
//
@@ -120,7 +122,7 @@ class G4VisExecutive: public G4VisManager {
public: // With description
G4VisExecutive () {}
G4VisExecutive (const G4String& verbosityString = "warnings");
private:
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisExecutive.icc,v 1.22 2009/10/12 11:54:50 akimura Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4VisExecutive.icc,v 1.27 2010/11/07 11:14:33 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
// John Allison 24th January 1998.
@@ -42,6 +42,7 @@
#include "G4HepRepFile.hh"
#include "G4RayTracer.hh"
#include "G4HitFilterFactories.hh"
#include "G4DigiFilterFactories.hh"
#include "G4TrajectoryFilterFactories.hh"
#include "G4TrajectoryModelFactories.hh"
#include "G4VRML1File.hh"
@@ -91,6 +92,11 @@
#include "G4VRML2.hh"
#endif
inline
G4VisExecutive::G4VisExecutive (const G4String& verbosityString):
G4VisManager(verbosityString)
{}
// The inline keyword prevents the compiler making an external
// reference even though they cannot actually be inlined since they
// are virtual functions. This prevents a "multiple definition" error
@@ -117,6 +123,65 @@ G4VisExecutive::RegisterGraphicsSystems () {
RegisterGraphicsSystem (new G4FukuiRenderer);
#endif
// Register OGL graphics system with generic nicknames
#ifdef G4VIS_USE_OPENGL
G4VGraphicsSystem* ogl = 0;
G4VGraphicsSystem* ogli = 0;
G4VGraphicsSystem* ogls = 0;
// Follow G4UIExecutive
#if defined(G4UI_USE_QT)
#ifdef G4VIS_USE_OPENGLQT
ogl = new G4OpenGLStoredQt;
ogli = new G4OpenGLImmediateQt;
ogls = new G4OpenGLStoredQt;
#endif
#elif defined(G4UI_USE_XM)
#ifdef G4VIS_USE_OPENGLXM
ogl = new G4OpenGLStoredXm;
ogli = new G4OpenGLImmediateXm;
ogls = new G4OpenGLStoredXm;
#endif
#elif defined(G4UI_USE_WIN32)
#ifdef G4VIS_USE_OPENGLWIN32
ogl = new G4OpenGLStoredWin32;
ogli = new G4OpenGLImmediateWin32;
ogls = new G4OpenGLStoredWin32;
#endif
#elif defined(G4UI_USE_TCSH)
#if defined (G4VIS_USE_OPENGLX)
ogl = new G4OpenGLStoredX;
ogli = new G4OpenGLImmediateX;
ogls = new G4OpenGLStoredX;
#elif defined (G4VIS_USE_OPENGLWIN32)
ogl = new G4OpenGLStoredWin32;
ogli = new G4OpenGLImmediateWin32;
ogls = new G4OpenGLStoredWin32;
#endif
#else
#if defined (G4VIS_USE_OPENGLX)
ogl = new G4OpenGLStoredX;
ogli = new G4OpenGLImmediateX;
ogls = new G4OpenGLStoredX;
#elif defined (G4VIS_USE_OPENGLWIN32)
ogl = new G4OpenGLStoredWin32;
ogli = new G4OpenGLImmediateWin32;
ogls = new G4OpenGLStoredWin32;
#endif
#endif
if (ogl) {
ogl->SetNickName("OGL");
RegisterGraphicsSystem (ogl);
}
if (ogli) {
ogli->SetNickName("OGLI");
RegisterGraphicsSystem (ogli);
}
if (ogls) {
ogls->SetNickName("OGLS");
RegisterGraphicsSystem (ogls);
}
#endif
#ifdef G4VIS_USE_OPENGLX
RegisterGraphicsSystem (new G4OpenGLImmediateX);
RegisterGraphicsSystem (new G4OpenGLStoredX);
@@ -137,6 +202,21 @@ G4VisExecutive::RegisterGraphicsSystems () {
RegisterGraphicsSystem (new G4OpenGLStoredQt);
#endif
// Register OI graphics system with generic nickname
#ifdef G4VIS_USE_OI
G4VGraphicsSystem* oi = 0;
#ifdef G4VIS_USE_OIX
oi = new G4OpenInventorX;
#endif
#ifdef G4VIS_USE_OIWIN32
oi = new G4OpenInventorWin32;
#endif
if (oi) {
oi->SetNickName("OI");
RegisterGraphicsSystem (oi);
}
#endif
#ifdef G4VIS_USE_OIX
RegisterGraphicsSystem (new G4OpenInventorX);
#endif
@@ -175,6 +255,9 @@ G4VisExecutive::RegisterModelFactories()
// Hit filter models
RegisterModelFactory(new G4HitAttributeFilterFactory());
// Digi filter models
RegisterModelFactory(new G4DigiAttributeFilterFactory());
}
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisManager.hh,v 1.70 2009/02/25 18:28:00 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4VisManager.hh,v 1.76 2010/11/13 10:54:55 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
@@ -65,17 +65,18 @@
// with the current viewer, in particular, the Draw operations.
//
// Each scene comprises drawable objects such as detector components
// and hits when appropriate. A scene handler translates a scene into
// graphics-system-specific function calls and, possibly, a
// graphics-system-dependent database - display lists, scene graphs,
// etc. Each viewer has its "view parameters" (see class description
// of G4ViewParameters for available parameters and also for a
// description of the concept of a "standard view" and all that).
// and trajectories, hits and digis when appropriate. A scene handler
// translates a scene into graphics-system-specific function calls
// and, possibly, a graphics-system-dependent database - display
// lists, scene graphs, etc. Each viewer has its "view parameters"
// (see class description of G4ViewParameters for available parameters
// and also for a description of the concept of a "standard view" and
// all that).
//
// A friend class G4VisStateDependent is "state dependent", i.e., it
// is notified on change of state (G4ApplicationState). This is used
// to message the G4VisManager to draw hits and trajectories in the
// current scene at the end of event, as required.
// to message the G4VisManager to draw hits, digis and trajectories in
// the current scene at the end of event, as required.
#ifndef G4VISMANAGER_HH
#define G4VISMANAGER_HH
@@ -112,6 +113,7 @@ namespace {
typedef G4VModelFactory<G4VTrajectoryModel> G4TrajDrawModelFactory;
typedef G4VModelFactory< G4VFilter<G4VTrajectory> > G4TrajFilterFactory;
typedef G4VModelFactory< G4VFilter<G4VHit> > G4HitFilterFactory;
typedef G4VModelFactory< G4VFilter<G4VDigi> > G4DigiFilterFactory;
}
class G4VisManager: public G4VVisManager {
@@ -128,27 +130,20 @@ class G4VisManager: public G4VVisManager {
friend class G4RayTrajectory;
friend class G4RayTracerSceneHandler;
friend class G4RTMessenger;
friend class G4OpenGLStoredSceneHandler;
friend class G4OpenGLViewerMessenger;
friend class G4OpenGLXViewerMessenger;
friend class G4OpenGLXmViewerMessenger;
friend class G4XXXSceneHandler;
friend class G4HepRepFileSceneHandler;
// Management friends...
friend class G4VSceneHandler;
friend class G4VViewer;
friend std::ostream & operator <<
(std::ostream &, const G4VGraphicsSystem &);
friend std::ostream & operator <<
(std::ostream &, const G4VSceneHandler &);
friend class G4VisStateDependent;
friend class G4VisCommandList;
// operator << friends...
friend std::ostream& operator << (std::ostream&, const G4VGraphicsSystem&);
friend std::ostream& operator << (std::ostream&, const G4VSceneHandler&);
public: // With description
enum Verbosity {
@@ -164,7 +159,7 @@ public: // With description
protected: // With description
G4VisManager ();
G4VisManager (const G4String& verbosityString = "warnings");
// The constructor is protected so that an object of the derived
// class may be constructed.
@@ -214,6 +209,12 @@ public: // With description
void RegisterModel(G4VFilter<G4VHit>* filter);
// Register trajectory hit model. Assumes ownership of model.
void RegisterModelFactory(G4DigiFilterFactory* factory);
// Register trajectory digi model factory. Assumes ownership of factory.
void RegisterModel(G4VFilter<G4VDigi>* filter);
// Register trajectory digi model. Assumes ownership of model.
void SelectTrajectoryModel(const G4String& model);
// Set default trajectory model. Useful for use in compiled code
@@ -280,6 +281,8 @@ public: // With description
void Draw (const G4VHit&);
void Draw (const G4VDigi&);
void Draw (const G4VTrajectory&, G4int i_mode);
// i_mode is a parameter that can be used to control the drawing of
// the trajectory. See, e.g., G4VTrajectory::DrawTrajectory.
@@ -305,11 +308,13 @@ public: // With description
// has changed so that they may rebuild their graphics database, if
// any, and redraw all views.
void DispatchToModel(const G4VTrajectory&);
void DispatchToModel(const G4VTrajectory&, G4int i_mode);
// Draw the trajectory.
G4bool FilterTrajectory(const G4VTrajectory&);
G4bool FilterHit(const G4VHit&);
G4bool FilterDigi(const G4VDigi&);
////////////////////////////////////////////////////////////////////////
// Administration routines.
@@ -328,8 +333,8 @@ private:
void EndOfEvent ();
// This is called on change of state (G4ApplicationState). It is
// used to draw hits and trajectories if included in the current
// scene at the end of event, as required.
// used to draw hits, digis and trajectories if included in the
// current scene at the end of event, as required.
void EndOfRun ();
@@ -356,7 +361,7 @@ public: // With description
// already registered.
const G4SceneHandlerList& GetAvailableSceneHandlers () const;
const G4SceneList& GetSceneList () const;
Verbosity GetVerbosity () const;
static Verbosity GetVerbosity ();
G4bool GetTransientsDrawnThisRun () const;
G4bool GetTransientsDrawnThisEvent () const;
const G4Event* GetRequestedEvent () const;
@@ -365,10 +370,10 @@ public: // With description
void SetUserAction (G4VUserVisAction* pVisAction,
const G4VisExtent& = G4VisExtent::NullExtent);
void SetUserActionExtent (const G4VisExtent&);
void SetCurrentGraphicsSystem (G4VGraphicsSystem* pSystem);
void SetCurrentGraphicsSystem (G4VGraphicsSystem*);
void SetCurrentScene (G4Scene*);
void SetCurrentSceneHandler (G4VSceneHandler* pScene);
void SetCurrentViewer (G4VViewer* pView);
void SetCurrentSceneHandler (G4VSceneHandler*);
void SetCurrentViewer (G4VViewer*);
G4SceneHandlerList& SetAvailableSceneHandlers (); // Returns lvalue.
G4SceneList& SetSceneList (); // Returns lvalue.
void SetVerboseLevel (G4int);
@@ -444,7 +449,7 @@ private:
G4GraphicsSystemList fAvailableGraphicsSystems;
G4SceneList fSceneList;
G4SceneHandlerList fAvailableSceneHandlers;
Verbosity fVerbosity;
static Verbosity fVerbosity;
std::vector<G4UImessenger*> fMessengerList;
std::vector<G4UIcommand*> fDirectoryList;
G4VisStateDependent* fpStateDependent; // Friend state dependent class.
@@ -466,6 +471,9 @@ private:
// Hit filter model manager
G4VisFilterManager<G4VHit>* fpHitFilterMgr;
// Digi filter model manager
G4VisFilterManager<G4VDigi>* fpDigiFilterMgr;
};
#include "G4VisManager.icc"
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisManager.icc,v 1.21 2009/01/13 09:55:15 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4VisManager.icc,v 1.23 2010/12/14 15:53:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
// GEANT4 Visualization Manager - John Allison 02/Jan/1996.
@@ -68,11 +68,6 @@ G4VisManager::GetCurrentGraphicsSystem () const {
return fpGraphicsSystem;
}
inline G4VisManager::Verbosity G4VisManager::GetVerbosity () const {
return fVerbosity;
}
inline G4bool G4VisManager::GetTransientsDrawnThisEvent() const {
return fTransientsDrawnThisEvent;
}
@@ -0,0 +1,160 @@
#------------------------------------------------------------------------------
# sources.cmake
# Module : G4vis_management
# Package: Geant4.src.G4visualization.G4vis_management
#
# Sources description for a library.
# Lists the sources and headers of the code explicitely.
# Lists include paths needed.
# Lists the internal granular and global dependencies of the library.
# Source specific properties should be added at the end.
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake,v 1.1 2010/09/29 19:15:02 bmorgan Exp $
#
#------------------------------------------------------------------------------
# List external includes needed.
include_directories(${CLHEP_INCLUDE_DIRS})
# List internal includes needed.
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/digits/include)
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/hits/include)
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/utils/include)
include_directories(${CMAKE_SOURCE_DIR}/source/event/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/magneticfield/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/navigation/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/solids/Boolean/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/solids/CSG/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/solids/specific/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/volumes/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPGeometry/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPRandom/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/graphics_reps/include)
include_directories(${CMAKE_SOURCE_DIR}/source/intercoms/include)
include_directories(${CMAKE_SOURCE_DIR}/source/materials/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/run/include)
include_directories(${CMAKE_SOURCE_DIR}/source/track/include)
include_directories(${CMAKE_SOURCE_DIR}/source/tracking/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/modeling/include)
#
# Define the Geant4 Module.
#
include(Geant4MacroDefineModule)
GEANT4_DEFINE_MODULE(NAME G4vis_management
HEADERS
G4GraphicsSystemList.hh
G4Scene.hh
G4Scene.icc
G4SceneHandlerList.hh
G4SceneList.hh
G4VGraphicsSystem.hh
G4VGraphicsSystem.icc
G4VSceneHandler.hh
G4VSceneHandler.icc
G4VUserVisAction.hh
G4VViewer.hh
G4VViewer.icc
G4VVisCommand.hh
G4VVisCommand.icc
G4ViewParameters.hh
G4ViewParameters.icc
G4ViewerList.hh
G4VisCommandModelCreate.hh
G4VisCommands.hh
G4VisCommandsCompound.hh
G4VisCommandsGeometry.hh
G4VisCommandsGeometrySet.hh
G4VisCommandsListManager.hh
G4VisCommandsScene.hh
G4VisCommandsSceneAdd.hh
G4VisCommandsSceneHandler.hh
G4VisCommandsViewer.hh
G4VisCommandsViewerSet.hh
G4VisExecutive.hh
G4VisExecutive.icc
G4VisFeaturesOfDAWNFILE.hh
G4VisFeaturesOfFukuiRenderer.hh
G4VisFeaturesOfOpenGL.hh
G4VisFeaturesOfOpenInventor.hh
G4VisFilterManager.hh
G4VisListManager.hh
G4VisManager.hh
G4VisManager.icc
G4VisModelManager.hh
G4VisStateDependent.hh
SOURCES
G4GraphicsSystemList.cc
G4Scene.cc
G4SceneHandlerList.cc
G4SceneList.cc
G4VGraphicsSystem.cc
G4VSceneHandler.cc
G4VViewer.cc
G4VVisCommand.cc
G4ViewParameters.cc
G4ViewerList.cc
G4VisCommands.cc
G4VisCommandsCompound.cc
G4VisCommandsGeometry.cc
G4VisCommandsGeometrySet.cc
G4VisCommandsScene.cc
G4VisCommandsSceneAdd.cc
G4VisCommandsSceneHandler.cc
G4VisCommandsViewer.cc
G4VisCommandsViewerSet.cc
G4VisFeaturesOfDAWNFILE.cc
G4VisFeaturesOfFukuiRenderer.cc
G4VisFeaturesOfOpenGL.cc
G4VisFeaturesOfOpenInventor.cc
G4VisManager.cc
G4VisStateDependent.cc
GRANULAR_DEPENDENCIES
G4csg
G4detutils
G4digits
G4event
G4geomBoolean
G4geometrymng
G4globman
G4graphics_reps
G4hits
G4intercoms
G4magneticfield
G4materials
G4modeling
G4navigation
G4partman
G4procman
G4run
G4specsolids
G4track
G4tracking
G4vis_management
G4volumes
GLOBAL_DEPENDENCIES
G4digits_hits
G4event
G4geometry
G4global
G4graphics_reps
G4intercoms
G4materials
G4modeling
G4particles
G4processes
G4run
G4track
G4tracking
LINK_LIBRARIES
)
# List any source specific properties here
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VSceneHandler.cc,v 1.91 2009/11/16 13:51:08 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4VSceneHandler.cc,v 1.96 2010/11/05 16:00:11 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
// John Allison 19th July 1996
@@ -66,6 +66,7 @@
#include "G4Torus.hh"
#include "G4Polycone.hh"
#include "G4Polyhedra.hh"
#include "G4DisplacedSolid.hh"
#include "G4LogicalVolume.hh"
#include "G4PhysicalVolumeModel.hh"
#include "G4ModelingParameters.hh"
@@ -73,6 +74,7 @@
#include "G4VTrajectoryPoint.hh"
#include "G4HitsModel.hh"
#include "G4VHit.hh"
#include "G4VDigi.hh"
#include "G4ScoringManager.hh"
#include "G4DefaultLinearColorMap.hh"
#include "Randomize.hh"
@@ -257,11 +259,17 @@ void G4VSceneHandler::AddSolid (const G4VSolid& solid) {
}
void G4VSceneHandler::AddCompound (const G4VTrajectory& traj) {
G4TrajectoriesModel* pTrModel =
G4TrajectoriesModel* trajectoriesModel =
dynamic_cast<G4TrajectoriesModel*>(fpModel);
if (!pTrModel) G4Exception
if (!trajectoriesModel) G4Exception
("G4VSceneHandler::AddCompound(const G4VTrajectory&): Not a G4TrajectoriesModel.");
traj.DrawTrajectory(pTrModel->GetDrawingMode());
else {
if (trajectoriesModel->IsDrawingModeSet()) {
traj.DrawTrajectory(trajectoriesModel->GetDrawingMode());
} else {
traj.DrawTrajectory();
}
}
}
void G4VSceneHandler::AddCompound (const G4VHit& hit) {
@@ -269,6 +277,11 @@ void G4VSceneHandler::AddCompound (const G4VHit& hit) {
const_cast<G4VHit&>(hit).Draw();
}
void G4VSceneHandler::AddCompound (const G4VDigi& digi) {
// Cast away const because Draw is non-const!!!!
const_cast<G4VDigi&>(digi).Draw();
}
void G4VSceneHandler::AddCompound (const G4THitsMap<G4double>& hits) {
//G4cout << "AddCompound: hits: " << &hits << G4endl;
G4bool scoreMapHits = false;
@@ -479,8 +492,7 @@ void G4VSceneHandler::RequestPrimitives (const G4VSolid& solid) {
break;
}
else {
G4VisManager::Verbosity verbosity =
G4VisManager::GetInstance()->GetVerbosity();
G4VisManager::Verbosity verbosity = G4VisManager::GetVerbosity();
if (verbosity >= G4VisManager::errors) {
G4cout <<
"ERROR: G4VSceneHandler::RequestPrimitives"
@@ -500,8 +512,7 @@ void G4VSceneHandler::RequestPrimitives (const G4VSolid& solid) {
AddPrimitive (*pPolyhedron);
}
else {
G4VisManager::Verbosity verbosity =
G4VisManager::GetInstance()->GetVerbosity();
G4VisManager::Verbosity verbosity = G4VisManager::GetVerbosity();
if (verbosity >= G4VisManager::errors) {
G4cout <<
"ERROR: G4VSceneHandler::RequestPrimitives"
@@ -735,28 +746,27 @@ G4ModelingParameters* G4VSceneHandler::CreateModelingParameters ()
);
pModelingParams->SetWarning
(G4VisManager::GetInstance()->GetVerbosity() >= G4VisManager::warnings);
(G4VisManager::GetVerbosity() >= G4VisManager::warnings);
pModelingParams->SetExplodeFactor(vp.GetExplodeFactor());
pModelingParams->SetExplodeCentre(vp.GetExplodeCentre());
pModelingParams->SetSectionPolyhedron(CreateSectionPolyhedron());
pModelingParams->SetCutawayPolyhedron(CreateCutawayPolyhedron());
pModelingParams->SetSectionSolid(CreateSectionSolid());
pModelingParams->SetCutawaySolid(CreateCutawaySolid());
// The polyhedron objects are deleted in the modeling parameters destructor.
return pModelingParams;
}
const G4Polyhedron* G4VSceneHandler::CreateSectionPolyhedron()
G4VSolid* G4VSceneHandler::CreateSectionSolid()
{
/* Disable for now. Boolean processor not up to it.
G4VSolid* sectioner = 0;
const G4ViewParameters& vp = fpViewer->GetViewParameters();
if (vp.IsSection () ) {
G4double radius = fpScene->GetExtent().GetExtentRadius();
G4double safe = radius + fpScene->GetExtent().GetExtentCentre().mag();
G4Box sectionBox("clipper",
safe, safe, 1.e-5 * radius); // Thin in z-plane.
G4Polyhedron* sectioner = sectionBox.CreatePolyhedron();
G4VSolid* sectionBox =
new G4Box("_sectioner", safe, safe, 1.e-5 * radius); // Thin in z-plane.
const G4Plane3D& s = vp.GetSectionPlane ();
G4double a = s.a();
G4double b = s.b();
@@ -769,16 +779,13 @@ const G4Polyhedron* G4VSceneHandler::CreateSectionPolyhedron()
const G4Vector3D axis = G4Normal3D(0,0,1).cross(normal);
transform = G4Rotate3D(angle, axis) * transform;
}
sectioner->Transform(transform);
return sectioner;
} else {
return 0;
sectioner = new G4DisplacedSolid
("_displaced_sectioning_box", sectionBox, transform);
}
*/
return 0;
return sectioner;
}
const G4Polyhedron* G4VSceneHandler::CreateCutawayPolyhedron()
G4VSolid* G4VSceneHandler::CreateCutawaySolid()
{
return 0;
}
@@ -24,13 +24,15 @@
// ********************************************************************
//
//
// $Id: G4ViewParameters.cc,v 1.36 2009/01/21 17:05:12 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4ViewParameters.cc,v 1.38 2010/11/05 16:00:11 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
// John Allison 19th July 1996
// View parameters and options.
#include <sstream>
#include "G4ViewParameters.hh"
#include "G4VisManager.hh"
@@ -46,6 +48,7 @@ G4ViewParameters::G4ViewParameters ():
fAllValues(0x000F),
fXNegative(0x0010),
fYNegative(0x0020),
fGeometryMask(0),
fDrawingStyle (wireframe),
fAuxEdgeVisible (false),
fRepStyle (polyhedron),
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsCompound.cc,v 1.39 2007/11/16 20:29:04 perl Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VisCommandsCompound.cc,v 1.40 2010/05/20 07:54:01 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
// Compound /vis/ commands - John Allison 15th May 2000
@@ -65,6 +65,11 @@ void G4VisCommandDrawTree::SetNewValue(G4UIcommand*, G4String newValue) {
std::istringstream is(newValue);
is >> pvname >> system;
G4VGraphicsSystem* keepSystem = fpVisManager->GetCurrentGraphicsSystem();
G4Scene* keepScene = fpVisManager->GetCurrentScene();
G4VSceneHandler* keepSceneHandler = fpVisManager->GetCurrentSceneHandler();
G4VViewer* keepViewer = fpVisManager->GetCurrentViewer();
G4UImanager* UImanager = G4UImanager::GetUIpointer();
G4int keepVerbose = UImanager->GetVerboseLevel();
G4int newVerbose(0);
@@ -76,6 +81,16 @@ void G4VisCommandDrawTree::SetNewValue(G4UIcommand*, G4String newValue) {
UImanager->ApplyCommand(G4String("/vis/drawVolume " + pvname));
UImanager->ApplyCommand("/vis/viewer/flush");
UImanager->SetVerboseLevel(keepVerbose);
if (keepViewer) {
if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) {
G4cout << "Reverting to " << keepViewer->GetName() << G4endl;
}
fpVisManager->SetCurrentGraphicsSystem(keepSystem);
fpVisManager->SetCurrentScene(keepScene);
fpVisManager->SetCurrentSceneHandler(keepSceneHandler);
fpVisManager->SetCurrentViewer(keepViewer);
}
}
////////////// /vis/drawView ///////////////////////////////////////
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsGeometrySet.cc,v 1.7 2007/01/05 16:24:19 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VisCommandsGeometrySet.cc,v 1.8 2010/06/15 16:34:30 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
// /vis/geometry commands - John Allison 31st January 2006
@@ -63,7 +63,7 @@ void G4VVisCommandGeometrySet::Set
return;
}
if (fpVisManager->GetCurrentViewer()) {
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/rebuild");
G4UImanager::GetUIpointer()->ApplyCommand("/vis/scene/notifyHandlers");
}
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsScene.cc,v 1.68 2008/04/28 16:12:38 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VisCommandsScene.cc,v 1.70 2010/11/13 10:52:00 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
// /vis/scene commands - John Allison 9th August 1998
@@ -540,9 +540,6 @@ void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand*,
if (aScene) {
const G4String& aSceneName = aScene -> GetName ();
if (sceneName == aSceneName) {
// Clear store and force a rebuild of graphical database...
//aSceneHandler -> ClearStore (); // Not nec?? Done below
//with NeedKernelVisit and DrawView. JA.
G4ViewerList& viewerList = aSceneHandler -> SetViewerList ();
const G4int nViewers = viewerList.size ();
for (G4int iV = 0; iV < nViewers; iV++) {
@@ -553,7 +550,18 @@ void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand*,
fpVisManager -> SetCurrentViewer(aViewer);
fpVisManager -> SetCurrentSceneHandler(aSceneHandler);
fpVisManager -> SetCurrentScene(aScene);
// Re-draw, forcing rebuild of graphics database, if any...
// ClearTransientStore. This clears the transient, e.g.,
// trajectories part of the store/graphical database but
// also re-draws the permanent part (detector) and thus
// has the effect of clearing trajectories from the view.
// This should not be necessary since NeedKernelVisit,
// ClearView and DrawView should have the effect of
// deleting the whole store and re-creating it, then
// clearing and re-drawing. But ClearView does not seem
// to work for all viewers. If it's a problem for you,
// uncomment the next line.
//aSceneHandler->ClearTransientStore();
// Now, force rebuild of graphical database, if any, and re-draw.
aViewer -> NeedKernelVisit();
aViewer -> SetView ();
aViewer -> ClearView ();
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsSceneAdd.cc,v 1.78 2009/11/22 14:02:30 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4VisCommandsSceneAdd.cc,v 1.84 2010/11/06 18:34:26 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
// /vis/scene commands - John Allison 9th August 1998
#include "G4VisCommandsSceneAdd.hh"
@@ -36,6 +36,7 @@
#include "G4LogicalVolumeModel.hh"
#include "G4ModelingParameters.hh"
#include "G4HitsModel.hh"
#include "G4DigiModel.hh"
#include "G4PSHitsModel.hh"
#include "G4TrajectoriesModel.hh"
#include "G4ScaleModel.hh"
@@ -157,6 +158,51 @@ void G4VisCommandSceneAddAxes::SetNewValue (G4UIcommand*, G4String newValue) {
}
////////////// /vis/scene/add/digis ///////////////////////////////////////
G4VisCommandSceneAddDigis::G4VisCommandSceneAddDigis () {
fpCommand = new G4UIcmdWithoutParameter ("/vis/scene/add/digis", this);
fpCommand -> SetGuidance ("Adds digis to current scene.");
fpCommand -> SetGuidance
("Digis are drawn at end of event when the scene in which"
"\nthey are added is current.");
}
G4VisCommandSceneAddDigis::~G4VisCommandSceneAddDigis () {
delete fpCommand;
}
G4String G4VisCommandSceneAddDigis::GetCurrentValue (G4UIcommand*) {
return "";
}
void G4VisCommandSceneAddDigis::SetNewValue (G4UIcommand*, G4String) {
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4bool warn(verbosity >= G4VisManager::warnings);
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cout << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
G4DigiModel* model = new G4DigiModel;
const G4String& currentSceneName = pScene -> GetName ();
G4bool successful = pScene -> AddEndOfEventModel (model, warn);
if (successful) {
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Digis will be drawn in scene \""
<< currentSceneName << "\"."
<< G4endl;
}
}
else G4VisCommandsSceneAddUnsuccessful(verbosity);
UpdateVisManagerScene (currentSceneName);
}
////////////// /vis/scene/add/eventID ///////////////////////////////////////
G4VisCommandSceneAddEventID::G4VisCommandSceneAddEventID () {
@@ -260,7 +306,7 @@ void G4VisCommandSceneAddEventID::EventID::operator()
nEvents = currentRun->GetNumberOfEventToBeProcessed();
} else {
const std::vector<const G4Event*>* events =
currentRun? currentRun->GetEventVector(): 0;
currentRun->GetEventVector();
if (events) nEvents = events->size();
}
if (eventID < nEvents - 1) return; // Not last event.
@@ -1372,6 +1418,7 @@ void G4VisCommandSceneAddTrajectories::SetNewValue (G4UIcommand*,
propagatorInField->SetTrajectoryFilter(0); // Switch off smooth trajectories.
static G4IdentityTrajectoryFilter auxiliaryPointsFilter;
G4String defaultTrajectoryType;
G4bool i_mode_found = false;
G4int i_mode = 0;
if (smooth && rich) {
UImanager->ApplyCommand("/tracking/storeTrajectory 3");
@@ -1389,10 +1436,12 @@ void G4VisCommandSceneAddTrajectories::SetNewValue (G4UIcommand*,
std::istringstream iss(newValue);
iss >> i_mode;
if (iss) {
i_mode_found = true;
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: Integer parameter " << i_mode << " found."
"\n DEPRECATED - will be removed at next major release."
"\n Use \"/vis/modeling/trajectories\" commands."
G4cout <<
"WARNING: Integer parameter " << i_mode << " found."
"\n DEPRECATED - its use in this command will be removed at a future major"
"\n release. Use \"/vis/modeling/trajectories\" commands."
<< G4endl;
}
} else {
@@ -1420,7 +1469,12 @@ void G4VisCommandSceneAddTrajectories::SetNewValue (G4UIcommand*,
}
}
G4TrajectoriesModel* model = new G4TrajectoriesModel(i_mode);
G4TrajectoriesModel* model = 0;
if (i_mode_found) {
model = new G4TrajectoriesModel(i_mode);
} else {
model = new G4TrajectoriesModel();
}
const G4String& currentSceneName = pScene -> GetName ();
pScene -> AddEndOfEventModel (model, warn);
@@ -1535,8 +1589,8 @@ void G4VisCommandSceneAddUserAction::SetNewValue (G4UIcommand*,
model->SetGlobalTag("Vis User Action");
model->SetExtent(extent);
const G4String& currentSceneName = pScene -> GetName ();
pScene -> AddRunDurationModel (model, warn);
if (verbosity >= G4VisManager::confirmations) {
G4bool successful = pScene -> AddRunDurationModel (model, warn);
if (successful && verbosity >= G4VisManager::confirmations) {
G4cout << "User Vis Action added to scene \""
<< currentSceneName << "\"";
if (verbosity >= G4VisManager::parameters) {
@@ -1804,12 +1858,13 @@ void G4VisCommandSceneAddVolume::SetNewValue (G4UIcommand*,
const G4double x0 = (param2 + param1) / 2.;
const G4double y0 = (param4 + param3) / 2.;
const G4double z0 = (param6 + param5) / 2.;
G4Box clippingBox("_clipping_box",dX,dY,dZ);
G4Polyhedron* clippingPolyhedron =
new G4PolyhedronBox(dX,dY,dZ); // The model deletes.
clippingPolyhedron->Transform(G4Translate3D(x0,y0,z0));
G4VSolid* clippingSolid =
new G4DisplacedSolid
("_displaced_clipping_box",
new G4Box("_clipping_box",dX,dY,dZ),
G4Translate3D(x0,y0,z0));
for (size_t i = 0; i < foundVolumes.size(); ++i) {
models[i]->SetClippingPolyhedron(clippingPolyhedron);
models[i]->SetClippingSolid(clippingSolid);
models[i]->SetClippingMode(clippingMode);
}
} // If any other shape consider NumberOfRotationSides!!!!!!!!!!!
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsViewer.cc,v 1.75 2009/01/19 15:47:49 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4VisCommandsViewer.cc,v 1.77 2010/11/07 11:14:07 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
// /vis/viewer commands - John Allison 25th October 1998
@@ -437,6 +437,7 @@ void G4VisCommandViewerClone::SetNewValue (G4UIcommand*, G4String newValue) {
cloneName = cloneName.strip (G4String::both, ' ');
cloneName = cloneName.strip (G4String::both, '"');
G4bool errorWhileNaming = false;
if (cloneName == "none") {
G4int subID = 0;
do {
@@ -449,9 +450,22 @@ void G4VisCommandViewerClone::SetNewValue (G4UIcommand*, G4String newValue) {
G4String::npos) {
cloneName.insert(nextSpacePosition, oss.str());
} else {
cloneName.insert(cloneName.find(' '), oss.str());
G4String::size_type spacePosition = cloneName.find(' ');
if (spacePosition != G4String::npos)
cloneName.insert(spacePosition, oss.str());
else
errorWhileNaming = true;
}
} while (fpVisManager -> GetViewer (cloneName));
} while (!errorWhileNaming && fpVisManager -> GetViewer (cloneName));
}
if (errorWhileNaming) {
if (verbosity >= G4VisManager::errors) {
G4cout << "ERROR: While naming clone viewer \"" << cloneName
<< "\"."
<< G4endl;
}
return;
}
if (fpVisManager -> GetViewer (cloneName)) {
@@ -1037,6 +1051,7 @@ void G4VisCommandViewerRebuild::SetNewValue (G4UIcommand*, G4String newValue) {
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4String& rebuildName = newValue;
G4VViewer* viewer = fpVisManager -> GetViewer (rebuildName);
if (!viewer) {
if (verbosity >= G4VisManager::errors) {
@@ -1047,7 +1062,21 @@ void G4VisCommandViewerRebuild::SetNewValue (G4UIcommand*, G4String newValue) {
return;
}
G4VSceneHandler* sceneHandler = viewer->GetSceneHandler();
if (!sceneHandler) {
if (verbosity >= G4VisManager::errors) {
G4cout << "ERROR: Viewer \"" << viewer->GetName() << "\"" <<
" has no scene handler - report serious bug."
<< G4endl;
}
return;
}
sceneHandler->ClearTransientStore();
viewer->NeedKernelVisit();
viewer->SetView();
viewer->ClearView();
viewer->DrawView();
// Check auto-refresh and print confirmations, but without changing
// view paramters...
@@ -1391,22 +1420,13 @@ void G4VisCommandViewerUpdate::SetNewValue (G4UIcommand*, G4String newValue) {
return;
}
if (viewer) {
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Viewer \"" << viewer -> GetName () << "\"";
G4cout << " post-processing triggered." << G4endl;
}
viewer -> ShowView ();
// Assume future need to "refresh" transients...
sceneHandler -> SetMarkForClearingTransientStore(true);
}
else {
if (verbosity >= G4VisManager::errors) {
G4cout << "ERROR: Viewer \"" << updateName << "\"";
G4cout << " not found - \"/vis/viewer/list\""
"\n to see possibilities." << G4endl;
}
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Viewer \"" << viewer -> GetName () << "\"";
G4cout << " post-processing triggered." << G4endl;
}
viewer -> ShowView ();
// Assume future need to "refresh" transients...
sceneHandler -> SetMarkForClearingTransientStore(true);
}
////////////// /vis/viewer/zoom and zoomTo ////////////////////////////
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsViewerSet.cc,v 1.50 2009/05/13 18:17:25 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4VisCommandsViewerSet.cc,v 1.53 2010/11/05 15:57:20 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
// /vis/viewer/set commands - John Allison 16th May 2000
@@ -142,6 +142,52 @@ G4VisCommandsViewerSet::G4VisCommandsViewerSet ():
fpCommandCutawayMode->SetCandidates ("add union multiply intersection");
fpCommandCutawayMode->SetDefaultValue("union");
fpCommandDefaultColour = new G4UIcommand
("/vis/viewer/set/defaultColour",this);
fpCommandDefaultColour->SetGuidance
("Set defaultColour colour and transparency (default white and opaque).");
fpCommandDefaultColour->SetGuidance
("Accepts (a) RGB triplet. e.g., \".3 .4 .5\", or"
"\n(b) string such as \"white\", \"black\", \"grey\", \"red\"..."
"\n(c) an additional number for opacity, e.g., \".3 .4 .5 .6\""
"\n or \"grey ! ! .6\" (note \"!\"'s for unused green and blue parameters),"
"\n e.g. \"! ! ! 0.\" for a transparent colour.");
parameter = new G4UIparameter("red_or_string", 's', omitable = true);
parameter -> SetDefaultValue ("1.");
fpCommandDefaultColour -> SetParameter (parameter);
parameter = new G4UIparameter("green", 'd', omitable = true);
parameter -> SetDefaultValue (1.);
fpCommandDefaultColour -> SetParameter (parameter);
parameter = new G4UIparameter ("blue", 'd', omitable = true);
parameter -> SetDefaultValue (1.);
fpCommandDefaultColour -> SetParameter (parameter);
parameter = new G4UIparameter ("opacity", 'd', omitable = true);
parameter -> SetDefaultValue (1.);
fpCommandDefaultColour -> SetParameter (parameter);
fpCommandDefaultTextColour = new G4UIcommand
("/vis/viewer/set/defaultTextColour",this);
fpCommandDefaultTextColour->SetGuidance
("Set defaultTextColour colour and transparency (default white and opaque).");
fpCommandDefaultTextColour->SetGuidance
("Accepts (a) RGB triplet. e.g., \".3 .4 .5\", or"
"\n(b) string such as \"white\", \"black\", \"grey\", \"red\"..."
"\n(c) an additional number for opacity, e.g., \".3 .4 .5 .6\""
"\n or \"grey ! ! .6\" (note \"!\"'s for unused green and blue parameters),"
"\n e.g. \"! ! ! 0.\" for a transparent colour.");
parameter = new G4UIparameter("red_or_string", 's', omitable = true);
parameter -> SetDefaultValue ("1.");
fpCommandDefaultTextColour -> SetParameter (parameter);
parameter = new G4UIparameter("green", 'd', omitable = true);
parameter -> SetDefaultValue (1.);
fpCommandDefaultTextColour -> SetParameter (parameter);
parameter = new G4UIparameter ("blue", 'd', omitable = true);
parameter -> SetDefaultValue (1.);
fpCommandDefaultTextColour -> SetParameter (parameter);
parameter = new G4UIparameter ("opacity", 'd', omitable = true);
parameter -> SetDefaultValue (1.);
fpCommandDefaultTextColour -> SetParameter (parameter);
fpCommandEdge = new G4UIcmdWithABool("/vis/viewer/set/edge",this);
fpCommandEdge->SetGuidance
("Edges become visible/invisible in surface mode.");
@@ -266,9 +312,11 @@ G4VisCommandsViewerSet::G4VisCommandsViewerSet ():
fpCommandProjection->SetParameter(parameter);
parameter = new G4UIparameter("field-half-angle",'d',omitable = true);
parameter->SetDefaultValue(30.);
//parameter->SetCurrentAsDefault(true);
fpCommandProjection->SetParameter(parameter);
parameter = new G4UIparameter("unit",'s',omitable = true);
parameter->SetDefaultValue("deg");
//parameter->SetCurrentAsDefault(true);
fpCommandProjection->SetParameter(parameter);
fpCommandSectionPlane = new G4UIcommand("/vis/viewer/set/sectionPlane",this);
@@ -400,6 +448,8 @@ G4VisCommandsViewerSet::~G4VisCommandsViewerSet() {
delete fpCommandBackground;
delete fpCommandCulling;
delete fpCommandCutawayMode;
delete fpCommandDefaultColour;
delete fpCommandDefaultTextColour;
delete fpCommandEdge;
delete fpCommandExplodeFactor;
delete fpCommandGlobalLineWidthScale;
@@ -610,6 +660,56 @@ void G4VisCommandsViewerSet::SetNewValue
}
}
else if (command == fpCommandDefaultColour) {
G4String redOrString;
G4double green, blue, opacity;
std::istringstream iss(newValue);
iss >> redOrString >> green >> blue >> opacity;
G4Colour colour(1.,1.,1.); // Default white and opaque.
const size_t iPos0 = 0;
if (std::isalpha(redOrString[iPos0])) {
G4Colour::GetColour(redOrString, colour); // Remains default (white) if
// not found.
} else {
colour = G4Colour(G4UIcommand::ConvertTo3Vector(newValue));
}
colour = G4Colour(colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity);
G4VisAttributes va = vp.GetDefaultVisAttributes();
va.SetColour(colour);
vp.SetDefaultVisAttributes(va);
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Default colour "
<< vp.GetDefaultVisAttributes()->GetColour()
<< " requested."
<< G4endl;
}
}
else if (command == fpCommandDefaultTextColour) {
G4String redOrString;
G4double green, blue, opacity;
std::istringstream iss(newValue);
iss >> redOrString >> green >> blue >> opacity;
G4Colour colour(1.,1.,1.); // Default white and opaque.
const size_t iPos0 = 0;
if (std::isalpha(redOrString[iPos0])) {
G4Colour::GetColour(redOrString, colour); // Remains default (white) if
// not found.
} else {
colour = G4Colour(G4UIcommand::ConvertTo3Vector(newValue));
}
colour = G4Colour(colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity);
G4VisAttributes va = vp.GetDefaultTextVisAttributes();
va.SetColour(colour);
vp.SetDefaultTextVisAttributes(va);
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Default colour "
<< vp.GetDefaultTextVisAttributes()->GetColour()
<< " requested."
<< G4endl;
}
}
else if (command == fpCommandEdge) {
G4ViewParameters::DrawingStyle existingStyle = vp.GetDrawingStyle();
if (G4UIcommand::ConvertToBool(newValue)) {
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VisManager.cc,v 1.122 2009/11/04 12:58:00 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4VisManager.cc,v 1.131 2010/12/14 15:53:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
// GEANT4 Visualization Manager - John Allison 02/Jan/1996.
@@ -78,7 +78,9 @@
G4VisManager* G4VisManager::fpInstance = 0;
G4VisManager::G4VisManager ():
G4VisManager::Verbosity G4VisManager::fVerbosity = G4VisManager::warnings;
G4VisManager::G4VisManager (const G4String& verbosityString):
fVerbose (1),
fInitialised (false),
fpUserVisAction (0),
@@ -86,7 +88,6 @@ G4VisManager::G4VisManager ():
fpScene (0),
fpSceneHandler (0),
fpViewer (0),
fVerbosity (warnings),
fpStateDependent (0),
fEventRefreshing (false),
fTransientsDrawnThisRun (false),
@@ -100,6 +101,7 @@ G4VisManager::G4VisManager ():
fpTrajDrawModelMgr = new G4VisModelManager<G4VTrajectoryModel>("/vis/modeling/trajectories");
fpTrajFilterMgr = new G4VisFilterManager<G4VTrajectory>("/vis/filtering/trajectories");
fpHitFilterMgr = new G4VisFilterManager<G4VHit>("/vis/filtering/hits");
fpDigiFilterMgr = new G4VisFilterManager<G4VDigi>("/vis/filtering/digi");
VerbosityGuidanceStrings.push_back
("Simple graded message scheme - digit or string (1st character defines):");
@@ -122,54 +124,56 @@ G4VisManager::G4VisManager ():
G4Exception
("G4VisManager: attempt to Construct more than one VisManager.");
}
else {
fpInstance = this;
SetConcreteInstance(this);
fpInstance = this;
SetConcreteInstance(this);
fpStateDependent = new G4VisStateDependent (this);
// No need to delete this; G4StateManager does this.
fpStateDependent = new G4VisStateDependent (this);
// No need to delete this; G4StateManager does this.
if (fVerbosity >= startup) {
G4cout << "Visualization Manager instantiating..." << G4endl;
}
// Note: The specific graphics systems must be instantiated in a
// higher level library to avoid circular dependencies. Also,
// some specifically need additional external libararies that the
// user must supply. Therefore we ask the user to implement
// RegisterGraphicsSystems() and RegisterModelFactories()
// in a subclass. We have to wait for the subclass to instantiate
// so RegisterGraphicsSystems() cannot be called from this
// constructor; it is called from Initialise(). So we ask the
// user:
// (a) to write a subclass and implement RegisterGraphicsSystems()
// and RegisterModelFactories(). See
// visualization/include/G4VisExecutive.hh/icc as an example.
// (b) instantiate the subclass.
// (c) invoke the Initialise() method of the subclass.
// For example:
// ...
// #ifdef G4VIS_USE
// // Instantiate and initialise Visualization Manager.
// G4VisManager* visManager = new G4VisExecutive;
// visManager -> SetVerboseLevel (Verbose);
// visManager -> Initialise ();
// #endif
// // (Don't forget to delete visManager;)
// ...
// Make top level command directory...
G4UIcommand* directory;
directory = new G4UIdirectory ("/vis/");
directory -> SetGuidance ("Visualization commands.");
fDirectoryList.push_back (directory);
// Instantiate top level basic commands
G4VVisCommand::SetVisManager (this); // Sets shared pointer
RegisterMessenger(new G4VisCommandVerbose);
RegisterMessenger(new G4VisCommandInitialize);
fVerbosity = GetVerbosityValue(verbosityString);
if (fVerbosity >= startup) {
G4cout
<< "Visualization Manager instantiating with verbosity \""
<< VerbosityString(fVerbosity)
<< "\"..." << G4endl;
}
// Note: The specific graphics systems must be instantiated in a
// higher level library to avoid circular dependencies. Also,
// some specifically need additional external libararies that the
// user must supply. Therefore we ask the user to implement
// RegisterGraphicsSystems() and RegisterModelFactories()
// in a subclass. We have to wait for the subclass to instantiate
// so RegisterGraphicsSystems() cannot be called from this
// constructor; it is called from Initialise(). So we ask the
// user:
// (a) to write a subclass and implement RegisterGraphicsSystems()
// and RegisterModelFactories(). See
// visualization/include/G4VisExecutive.hh/icc as an example.
// (b) instantiate the subclass.
// (c) invoke the Initialise() method of the subclass.
// For example:
// ...
// #ifdef G4VIS_USE
// // Instantiate and initialise Visualization Manager.
// G4VisManager* visManager = new G4VisExecutive;
// visManager -> SetVerboseLevel (Verbose);
// visManager -> Initialise ();
// #endif
// // (Don't forget to delete visManager;)
// ...
// Make top level command directory...
G4UIcommand* directory;
directory = new G4UIdirectory ("/vis/");
directory -> SetGuidance ("Visualization commands.");
fDirectoryList.push_back (directory);
// Instantiate top level basic commands
G4VVisCommand::SetVisManager (this); // Sets shared pointer
RegisterMessenger(new G4VisCommandVerbose);
RegisterMessenger(new G4VisCommandInitialize);
}
G4VisManager::~G4VisManager () {
@@ -179,10 +183,14 @@ G4VisManager::~G4VisManager () {
delete fSceneList[i];
}
for (i = 0; i < fAvailableSceneHandlers.size (); ++i) {
if (fAvailableSceneHandlers[i] != NULL) {
delete fAvailableSceneHandlers[i];
}
}
for (i = 0; i < fAvailableGraphicsSystems.size (); ++i) {
delete fAvailableGraphicsSystems[i];
if (fAvailableGraphicsSystems[i]) {
delete fAvailableGraphicsSystems[i];
}
}
if (fVerbosity >= startup) {
G4cout << "Graphics systems deleted." << G4endl;
@@ -195,9 +203,10 @@ G4VisManager::~G4VisManager () {
delete fDirectoryList[i];
}
delete fpTrajDrawModelMgr;
delete fpTrajFilterMgr;
delete fpDigiFilterMgr;
delete fpHitFilterMgr;
delete fpTrajFilterMgr;
delete fpTrajDrawModelMgr;
}
G4VisManager* G4VisManager::GetInstance () {
@@ -283,6 +292,12 @@ void G4VisManager::Initialise () {
directory = new G4UIdirectory ("/vis/filtering/hits/create/");
directory -> SetGuidance ("Create hit filters and messengers.");
fDirectoryList.push_back (directory);
directory = new G4UIdirectory ("/vis/filtering/digi/");
directory -> SetGuidance ("Digi filtering commands.");
fDirectoryList.push_back (directory);
directory = new G4UIdirectory ("/vis/filtering/digi/create/");
directory -> SetGuidance ("Create digi filters and messengers.");
fDirectoryList.push_back (directory);
RegisterMessengers ();
@@ -431,6 +446,17 @@ G4VisManager::RegisterModelFactory(G4HitFilterFactory* factory)
fpHitFilterMgr->Register(factory);
}
void G4VisManager::RegisterModel(G4VFilter<G4VDigi>* model)
{
fpDigiFilterMgr->Register(model);
}
void
G4VisManager::RegisterModelFactory(G4DigiFilterFactory* factory)
{
fpDigiFilterMgr->Register(factory);
}
void G4VisManager::SelectTrajectoryModel(const G4String& model)
{
fpTrajDrawModelMgr->SetCurrent(model);
@@ -600,6 +626,13 @@ void G4VisManager::Draw (const G4VHit& hit) {
}
}
void G4VisManager::Draw (const G4VDigi& digi) {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> AddCompound (digi);
}
}
void G4VisManager::Draw (const G4VTrajectory& traj,
G4int i_mode) {
if (IsValidView ()) {
@@ -856,6 +889,35 @@ G4bool G4VisManager::FilterHit(const G4VHit& hit)
return fpHitFilterMgr->Accept(hit);
}
G4bool G4VisManager::FilterDigi(const G4VDigi& digi)
{
return fpDigiFilterMgr->Accept(digi);
}
void G4VisManager::DispatchToModel(const G4VTrajectory& trajectory)
{
G4bool visible(true);
// See if trajectory passes filter
G4bool passed = FilterTrajectory(trajectory);
if (!passed) {
// Draw invisible trajectory if trajectory failed filter and
// are filtering in soft mode
if (fpTrajFilterMgr->GetMode() == FilterMode::Soft) visible = false;
else {return;}
}
// Go on to draw trajectory
assert (0 != fpTrajDrawModelMgr);
const G4VTrajectoryModel* trajectoryModel = CurrentTrajDrawModel();
assert (0 != trajectoryModel); // Should exist
trajectoryModel->Draw(trajectory, visible);
}
void G4VisManager::DispatchToModel(const G4VTrajectory& trajectory, G4int i_mode)
{
G4bool visible(true);
@@ -873,12 +935,25 @@ void G4VisManager::DispatchToModel(const G4VTrajectory& trajectory, G4int i_mode
// Go on to draw trajectory
assert (0 != fpTrajDrawModelMgr);
const G4VTrajectoryModel* model = CurrentTrajDrawModel();
const G4VTrajectoryModel* trajectoryModel = CurrentTrajDrawModel();
assert (0 != model); // Should exist
assert (0 != trajectoryModel); // Should exist
model->Draw(trajectory, i_mode, visible);
}
if (IsValidView()) {
G4TrajectoriesModel* trajectoriesModel =
dynamic_cast<G4TrajectoriesModel*>(fpSceneHandler->GetModel());
if (trajectoriesModel) {
if (trajectoriesModel->IsDrawingModeSet()) {
trajectoryModel->Draw(trajectory, i_mode, visible);
} else {
trajectoryModel->Draw(trajectory, visible);
}
} else {
// Just draw at user's request
trajectoryModel->Draw(trajectory, i_mode, visible);
}
}
}
void G4VisManager::SetUserAction
(G4VUserVisAction* pVisAction,
@@ -985,7 +1060,13 @@ void G4VisManager::SetCurrentSceneHandler (G4VSceneHandler* pSceneHandler) {
<< G4endl;
}
}
IsValidView (); // Checks.
if (!IsValidView ()) {
if (fVerbosity >= warnings) {
G4cout <<
"WARNING: Problem setting scene handler - please report circumstances."
<< G4endl;
}
}
}
else {
fpViewer = 0;
@@ -1008,7 +1089,13 @@ void G4VisManager::SetCurrentViewer (G4VViewer* pViewer) {
fpSceneHandler -> SetCurrentViewer (pViewer);
fpScene = fpSceneHandler -> GetScene ();
fpGraphicsSystem = fpSceneHandler -> GetGraphicsSystem ();
IsValidView (); // Checks.
if (!IsValidView ()) {
if (fVerbosity >= warnings) {
G4cout <<
"WARNING: Problem setting viewer - please report circumstances."
<< G4endl;
}
}
}
void G4VisManager::RegisterMessengers () {
@@ -1067,6 +1154,7 @@ void G4VisManager::RegisterMessengers () {
RegisterMessenger(new G4VisCommandSceneAddEventID);
RegisterMessenger(new G4VisCommandSceneAddGhosts);
RegisterMessenger(new G4VisCommandSceneAddHits);
RegisterMessenger(new G4VisCommandSceneAddDigis);
RegisterMessenger(new G4VisCommandSceneAddLogicalVolume);
RegisterMessenger(new G4VisCommandSceneAddLogo);
RegisterMessenger(new G4VisCommandSceneAddPSHits);
@@ -1128,6 +1216,12 @@ void G4VisManager::RegisterMessengers () {
(fpHitFilterMgr, fpHitFilterMgr->Placement()));
RegisterMessenger(new G4VisCommandManagerMode< G4VisFilterManager<G4VHit> >
(fpHitFilterMgr, fpHitFilterMgr->Placement()));
// Digi filter manager commands
RegisterMessenger(new G4VisCommandListManagerList< G4VisFilterManager<G4VDigi> >
(fpDigiFilterMgr, fpDigiFilterMgr->Placement()));
RegisterMessenger(new G4VisCommandManagerMode< G4VisFilterManager<G4VDigi> >
(fpDigiFilterMgr, fpDigiFilterMgr->Placement()));
}
void G4VisManager::PrintAvailableGraphicsSystems () const {
@@ -1280,6 +1374,7 @@ void G4VisManager::EndOfEvent ()
// Unless last event (in which case wait end of run)...
if (eventID < nEventsToBeProcessed - 1) {
fpViewer->ShowView();
fpViewer->DrawView();
fpSceneHandler->SetMarkForClearingTransientStore(true);
} else { // Last event...
// Keep, but only if user has not kept any...
@@ -1364,10 +1459,11 @@ void G4VisManager::EndOfRun ()
G4cout <<
" Only useful if before starting the run:"
"\n a) trajectories are stored (\"/vis/scene/add/trajectories [smooth|rich]\"), or"
"\n b) the Draw method of any hits is implemented."
"\n To view trajectories and hits:"
"\n b) the Draw method of any hits or digis is implemented."
"\n To view trajectories, hits or digis:"
"\n open a viewer, draw a volume, \"/vis/scene/add/trajectories\""
"\n \"/vis/scene/add/hits\" and, possibly, \"/vis/viewer/flush\"."
"\n \"/vis/scene/add/hits\" or \"/vis/scene/add/digitisations\""
"\n and, possibly, \"/vis/viewer/flush\"."
"\n To see all events: \"/vis/scene/endOfEventAction accumulate\"."
"\n To see events individually: \"/vis/reviewKeptEvents\"."
<< G4endl;
@@ -1486,6 +1582,10 @@ G4VisManager::Verbosity G4VisManager::GetVerbosityValue(G4int intVerbosity) {
return verbosity;
}
G4VisManager::Verbosity G4VisManager::GetVerbosity () {
return fVerbosity;
}
void G4VisManager::SetVerboseLevel (G4int intVerbosity) {
fVerbosity = GetVerbosityValue(intVerbosity);
}