Import Geant4 5.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:57:27 +02:00
parent 330b82b769
commit 37fff30d2e
5733 changed files with 263867 additions and 74574 deletions
@@ -22,7 +22,7 @@
//
//
// $Id: G4GraphicsSystemList.cc,v 1.3 2001/07/11 10:09:18 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
#include "G4GraphicsSystemList.hh"
@@ -22,7 +22,7 @@
//
//
// $Id: G4Scene.cc,v 1.11 2001/08/24 20:47:41 johna Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// Scene data John Allison 19th July 1996.
@@ -22,7 +22,7 @@
//
//
// $Id: G4SceneHandlerList.cc,v 1.3 2001/07/11 10:09:18 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
#include "G4SceneHandlerList.hh"
@@ -22,7 +22,7 @@
//
//
// $Id: G4SceneList.cc,v 1.5 2001/07/11 10:09:18 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
#include "G4SceneList.hh"
@@ -22,7 +22,7 @@
//
//
// $Id: G4VGraphicsSystem.cc,v 1.9 2001/08/05 02:29:09 johna Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// John Allison 27th March 1996
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VSceneHandler.cc,v 1.23 2001/09/10 10:52:01 johna Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4VSceneHandler.cc,v 1.25 2002/11/11 18:37:13 johna Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// John Allison 19th July 1996
@@ -52,6 +52,7 @@
#include "G4Visible.hh"
#include "G4VisAttributes.hh"
#include "G4VModel.hh"
#include "G4TrajectoriesModel.hh"
#include "G4Box.hh"
#include "G4Cons.hh"
#include "G4Tubs.hh"
@@ -65,6 +66,8 @@
#include "G4LogicalVolume.hh"
#include "G4PhysicalVolumeModel.hh"
#include "G4ModelingParameters.hh"
#include "G4VTrajectory.hh"
#include "G4VHit.hh"
G4VSceneHandler::G4VSceneHandler (G4VGraphicsSystem& system, G4int id, const G4String& name):
fSystem (system),
@@ -179,6 +182,15 @@ void G4VSceneHandler::AddThis (const G4VSolid& solid) {
RequestPrimitives (solid);
}
void G4VSceneHandler::AddThis (const G4VTrajectory& traj) {
traj.DrawTrajectory(((G4TrajectoriesModel*)fpModel)->GetDrawingMode());
}
void G4VSceneHandler::AddThis (const G4VHit& hit) {
((G4VHit&)hit).Draw(); // Cast to non-const because Draw is non-const!!!!
}
void G4VSceneHandler::AddViewerToList (G4VViewer* pViewer) {
fViewerList.push_back (pViewer);
}
@@ -194,7 +206,7 @@ void G4VSceneHandler::BeginModeling () {
void G4VSceneHandler::BeginPrimitives
(const G4Transform3D& objectTransformation) {
if (!GetModel ()) G4Exception ("G4VSceneHandler::BeginPrimitives: NO MODEL!!!");
if (!fpModel) G4Exception ("G4VSceneHandler::BeginPrimitives: NO MODEL!!!");
fpObjectTransformation = &objectTransformation;
}
@@ -360,12 +372,12 @@ void G4VSceneHandler::SetScene (G4Scene* pScene) {
}
void G4VSceneHandler::RequestPrimitives (const G4VSolid& solid) {
if (!GetModel ())
if (!fpModel)
G4Exception ("G4VSceneHandler::RequestPrimitives: NO MODEL!!!");
G4Polyhedron* pPolyhedron;
G4NURBS* pNURBS;
BeginPrimitives (*fpObjectTransformation);
switch (GetModel () -> GetModelingParameters () -> GetRepStyle ()) {
switch (fpModel -> GetModelingParameters () -> GetRepStyle ()) {
case G4ModelingParameters::nurbs:
pNURBS = solid.CreateNURBS ();
if (pNURBS) {
@@ -390,7 +402,7 @@ void G4VSceneHandler::RequestPrimitives (const G4VSolid& solid) {
case G4ModelingParameters::polyhedron:
default:
G4Polyhedron::SetNumberOfRotationSteps
(GetModel () -> GetModelingParameters () -> GetNoOfSides ());
(fpModel -> GetModelingParameters () -> GetNoOfSides ());
pPolyhedron = solid.CreatePolyhedron ();
G4Polyhedron::ResetNumberOfRotationSteps ();
if (pPolyhedron) {
@@ -22,7 +22,7 @@
//
//
// $Id: G4VViewer.cc,v 1.16 2001/08/14 18:34:47 johna Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// John Allison 27th March 1996
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VVisCommand.cc,v 1.10 2001/09/10 10:49:51 johna Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4VVisCommand.cc,v 1.11 2002/11/27 12:32:31 johna Exp $
// GEANT4 tag $Name: geant4-05-00 $
// Base class for visualization commands - John Allison 9th August 1998
// It is really a messenger - we have one command per messenger.
@@ -94,19 +94,6 @@ G4int G4VVisCommand::GetNewIntValue(const G4String& paramString)
return vl;
}
G4double G4VVisCommand::GetNewDoubleValue(const G4String& paramString)
{
G4double vl;
char unts[30];
const char* t = paramString;
G4std::istrstream is((char*)t);
is >> vl >> unts;
G4String unt = unts;
return (vl*ValueOf(unt));
}
G4ThreeVector G4VVisCommand::GetNew3VectorValue(const G4String& paramString)
{
G4double vx;
@@ -22,7 +22,7 @@
//
//
// $Id: G4ViewParameters.cc,v 1.14 2001/08/05 02:29:12 johna Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// John Allison 19th July 1996
@@ -22,7 +22,7 @@
//
//
// $Id: G4ViewerList.cc,v 1.3 2001/07/11 10:09:18 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
#include "G4ViewerList.hh"
@@ -22,7 +22,7 @@
//
//
// $Id: G4VisCommands.cc,v 1.6 2001/09/10 10:54:30 johna Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
// /vis/ top level commands - John Allison 5th February 2001
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsCompound.cc,v 1.22 2002/05/08 13:25:26 johna Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4VisCommandsCompound.cc,v 1.23 2002/10/24 15:12:26 johna Exp $
// GEANT4 tag $Name: geant4-05-00 $
// Compound /vis/ commands - John Allison 15th May 2000
@@ -205,7 +205,7 @@ void G4VisCommandDrawVolume::SetNewValue
if (verbosity >= G4VisManager::warnings) {
G4cout <<
"WARNING: For systems which are not \"auto-refresh\" you will need to"
"\n issue \"/vis/viewer/update\" or \"/vis/viewer/flush\"."
"\n issue \"/vis/viewer/refresh\" or \"/vis/viewer/flush\"."
<< G4endl;
}
}
@@ -301,7 +301,7 @@ void G4VisCommandSpecify::SetNewValue
if (verbosity >= G4VisManager::warnings) {
G4cout <<
"WARNING: For systems which are not \"auto-refresh\" you will need to"
"\n issue \"/vis/viewer/update\" or \"/vis/viewer/flush\"."
"\n issue \"/vis/viewer/refresh\" or \"/vis/viewer/flush\"."
<< G4endl;
}
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4VisCommandsScene.cc,v 1.30 2001/11/12 18:22:11 johna Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
// /vis/scene commands - John Allison 9th August 1998
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsSceneAdd.cc,v 1.30 2002/06/19 15:49:34 johna Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4VisCommandsSceneAdd.cc,v 1.34 2002/12/11 16:10:06 johna Exp $
// GEANT4 tag $Name: geant4-05-00 $
// /vis/scene commands - John Allison 9th August 1998
@@ -47,6 +47,7 @@
#include "G4ApplicationState.hh"
#include "G4UIcommand.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4ios.hh"
#include "g4std/strstream"
@@ -384,7 +385,7 @@ G4VisCommandSceneAddScale::G4VisCommandSceneAddScale () {
("Defaults: 1 m x 1 0 0 auto 0 0 0 m");
fpCommand -> SetGuidance
("Adds an annotated scale line to the current scene.");
fpCommand -> SetGuidance (G4Scale::GuidanceString);
fpCommand -> SetGuidance (G4Scale::GetGuidanceString());
G4UIparameter* parameter;
parameter = new G4UIparameter ("length", 'd', omitable = true);
parameter->SetDefaultValue (1.);
@@ -617,8 +618,8 @@ void G4VisCommandSceneAddScale::SetNewValue (G4UIcommand* command,
G4VisCommandSceneAddText::G4VisCommandSceneAddText () {
G4bool omitable;
fpCommand = new G4UIcommand ("/vis/scene/add/text", this);
fpCommand -> SetGuidance
("Adds text at (x, y, z) unit font_size x_offset y_offset text.");
fpCommand -> SetGuidance
("Adds text at (x*unit, y*unit, z*unit) with font_size x_offset y_offset.");
fpCommand -> SetGuidance
("Font size and offsets in pixels.");
G4UIparameter* parameter;
@@ -701,13 +702,27 @@ void G4VisCommandSceneAddText::SetNewValue (G4UIcommand* command,
////////////// /vis/scene/add/trajectories ///////////////////////////////////
G4VisCommandSceneAddTrajectories::G4VisCommandSceneAddTrajectories () {
fpCommand = new G4UIcmdWithoutParameter
G4bool omitable;
fpCommand = new G4UIcmdWithAnInteger
("/vis/scene/add/trajectories", this);
fpCommand -> SetGuidance
("/vis/scene/add/trajectories [drawing-mode]");
fpCommand -> SetGuidance
("Default integer parameter: 0");
fpCommand -> SetGuidance
("Adds trajectories to current scene.");
fpCommand -> SetGuidance
("Trajectories are drawn at end of event when the scene in which"
" they are added is current.");
("Causes trajectories, if any, to be drawn at the end of processiing an"
"\nevent. The drawing mode is an integer that is passed to the"
"\nDrawTrajectory method. The default implementation in G4VTrajectory,"
"\nif drawing-mode > 0, draws the trajectory as a polyline and, if"
"\ndrawing-mode != 0, draws markers of screen size abs(drawing-mode)/1000"
"\nin pixels at each step and auxiliary point, if any. So drawing-mode"
"\n== 5000 is a good choice."
"\nEnable storing with \"/tracking/storeTrajectory 1\"."
"\nSee also \"/vis/scene/endOfEventAction\".");
fpCommand -> SetParameterName ("drawing-mode", omitable = true);
fpCommand -> SetDefaultValue (0);
}
G4VisCommandSceneAddTrajectories::~G4VisCommandSceneAddTrajectories () {
@@ -732,7 +747,11 @@ void G4VisCommandSceneAddTrajectories::SetNewValue (G4UIcommand* command,
return;
}
G4TrajectoriesModel* model = new G4TrajectoriesModel;
G4int drawingMode;
const char* s = newValue;
G4std::istrstream is ((char*)s);
is >> drawingMode;
G4TrajectoriesModel* model = new G4TrajectoriesModel(drawingMode);
const G4String& currentSceneName = pScene -> GetName ();
G4bool successful = pScene -> AddEndOfEventModel (model, warn);
if (successful) {
@@ -22,7 +22,7 @@
//
//
// $Id: G4VisCommandsSceneHandler.cc,v 1.22 2001/09/10 10:56:55 johna Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
// /vis/sceneHandler commands - John Allison 10th October 1998
@@ -22,7 +22,7 @@
//
//
// $Id: G4VisCommandsViewer.cc,v 1.35 2002/04/26 21:23:31 asaim Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
// /vis/viewer commands - John Allison 25th October 1998
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsViewerSet.cc,v 1.19 2002/05/01 09:55:28 johna Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4VisCommandsViewerSet.cc,v 1.20 2002/11/27 12:33:28 johna Exp $
// GEANT4 tag $Name: geant4-05-00 $
// /vis/viewer/set commands - John Allison 16th May 2000
@@ -32,6 +32,7 @@
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4UnitsTable.hh"
#include "G4VisManager.hh"
@@ -89,6 +90,18 @@ G4VisCommandsViewerSet::G4VisCommandsViewerSet ():
fpCommandEdge->SetParameterName("edge",omitable = true);
fpCommandEdge->SetDefaultValue(true);
fpCommandGlobalMarkerScale = new G4UIcmdWithADouble
("/vis/viewer/set/globalMarkerScale", this);
fpCommandGlobalMarkerScale -> SetGuidance
("/vis/viewer/set/globalMarkerScale [<scale-factor>]");
fpCommandGlobalMarkerScale -> SetGuidance
("default: 1");
fpCommandGlobalMarkerScale -> SetGuidance
("Multiplies marker sizes by this factor.");
fpCommandGlobalMarkerScale -> SetParameterName("scale-factorr",
omitable=true);
fpCommandGlobalMarkerScale->SetDefaultValue(1.);
fpCommandHiddenEdge =
new G4UIcmdWithABool("/vis/viewer/set/hiddenEdge",this);
fpCommandHiddenEdge->SetGuidance("/vis/viewer/set/edge [true|false]");
@@ -292,6 +305,7 @@ G4VisCommandsViewerSet::~G4VisCommandsViewerSet() {
delete fpCommandAutoRefresh;
delete fpCommandCulling;
delete fpCommandEdge;
delete fpCommandGlobalMarkerScale;
delete fpCommandHiddenEdge;
delete fpCommandHiddenMarker;
delete fpCommandLineSegments;
@@ -504,6 +518,16 @@ void G4VisCommandsViewerSet::SetNewValue
}
}
else if (command == fpCommandGlobalMarkerScale) {
G4double globalMarkerScale
= fpCommandGlobalMarkerScale->GetNewDoubleValue(newValue);
vp.SetGlobalMarkerScale(globalMarkerScale);
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Global Marker Scale changed to "
<< vp.GetGlobalMarkerScale() << G4endl;
}
}
else if (command == fpCommandHiddenEdge) {
G4ViewParameters::DrawingStyle existingStyle = vp.GetDrawingStyle();
if (GetNewBoolValue(newValue)) {
@@ -22,7 +22,7 @@
//
//
// $Id: G4VisFeaturesOfDAWNFILE.cc,v 1.5 2001/07/11 10:09:19 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "G4VisFeaturesOfDAWNFILE.hh"
@@ -22,7 +22,7 @@
//
//
// $Id: G4VisFeaturesOfFukuiRenderer.cc,v 1.4 2001/07/11 10:09:19 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4VisFeaturesOfOpenGL.cc,v 1.4 2001/07/11 10:09:19 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4VisFeaturesOfOpenInventor.cc,v 1.4 2001/07/11 10:09:19 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VisManager.cc,v 1.45 2002/04/26 21:23:31 asaim Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4VisManager.cc,v 1.48 2002/11/20 17:19:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// GEANT4 Visualization Manager - John Allison 02/Jan/1996.
@@ -232,7 +232,7 @@ void G4VisManager::Enable() {
}
void G4VisManager::Disable() {
fpConcreteInstance = 0;
SetConcreteInstance(0);
if (fVerbosity >= confirmations) {
G4cout <<
"G4VisManager::Disable: visualization disabled."
@@ -288,15 +288,10 @@ void G4VisManager::Draw (const G4Circle& circle,
const G4Transform3D& objectTransform) {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
G4ModelingParameters* pMP = fpSceneHandler -> CreateModelingParameters ();
G4VModel* pModel = new G4NullModel (pMP);
fpSceneHandler -> SetModel (pModel);
CheckModel();
fpSceneHandler -> BeginPrimitives (objectTransform);
fpSceneHandler -> AddPrimitive (circle);
fpSceneHandler -> EndPrimitives ();
fpSceneHandler -> SetModel (0);
delete pModel;
delete pMP;
}
}
@@ -304,15 +299,10 @@ void G4VisManager::Draw (const G4NURBS& nurbs,
const G4Transform3D& objectTransform) {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
G4ModelingParameters* pMP = fpSceneHandler -> CreateModelingParameters ();
G4VModel* pModel = new G4NullModel (pMP);
fpSceneHandler -> SetModel (pModel);
CheckModel();
fpSceneHandler -> BeginPrimitives (objectTransform);
fpSceneHandler -> AddPrimitive (nurbs);
fpSceneHandler -> EndPrimitives ();
fpSceneHandler -> SetModel (0);
delete pModel;
delete pMP;
}
}
@@ -320,15 +310,10 @@ void G4VisManager::Draw (const G4Polyhedron& polyhedron,
const G4Transform3D& objectTransform) {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
G4ModelingParameters* pMP = fpSceneHandler -> CreateModelingParameters ();
G4VModel* pModel = new G4NullModel (pMP);
fpSceneHandler -> SetModel (pModel);
CheckModel();
fpSceneHandler -> BeginPrimitives (objectTransform);
fpSceneHandler -> AddPrimitive (polyhedron);
fpSceneHandler -> EndPrimitives ();
fpSceneHandler -> SetModel (0);
delete pModel;
delete pMP;
}
}
@@ -336,15 +321,10 @@ void G4VisManager::Draw (const G4Polyline& line,
const G4Transform3D& objectTransform) {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
G4ModelingParameters* pMP = fpSceneHandler -> CreateModelingParameters ();
G4VModel* pModel = new G4NullModel (pMP);
fpSceneHandler -> SetModel (pModel);
CheckModel();
fpSceneHandler -> BeginPrimitives (objectTransform);
fpSceneHandler -> AddPrimitive (line);
fpSceneHandler -> EndPrimitives ();
fpSceneHandler -> SetModel (0);
delete pModel;
delete pMP;
}
}
@@ -352,15 +332,10 @@ void G4VisManager::Draw (const G4Polymarker& polymarker,
const G4Transform3D& objectTransform) {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
G4ModelingParameters* pMP = fpSceneHandler -> CreateModelingParameters ();
G4VModel* pModel = new G4NullModel (pMP);
fpSceneHandler -> SetModel (pModel);
CheckModel();
fpSceneHandler -> BeginPrimitives (objectTransform);
fpSceneHandler -> AddPrimitive (polymarker);
fpSceneHandler -> EndPrimitives ();
fpSceneHandler -> SetModel (0);
delete pModel;
delete pMP;
}
}
@@ -368,15 +343,10 @@ void G4VisManager::Draw (const G4Scale& scale,
const G4Transform3D& objectTransform) {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
G4ModelingParameters* pMP = fpSceneHandler -> CreateModelingParameters ();
G4VModel* pModel = new G4NullModel (pMP);
fpSceneHandler -> SetModel (pModel);
CheckModel();
fpSceneHandler -> BeginPrimitives (objectTransform);
fpSceneHandler -> AddPrimitive (scale);
fpSceneHandler -> EndPrimitives ();
fpSceneHandler -> SetModel (0);
delete pModel;
delete pMP;
}
}
@@ -384,15 +354,10 @@ void G4VisManager::Draw (const G4Square& square,
const G4Transform3D& objectTransform) {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
G4ModelingParameters* pMP = fpSceneHandler -> CreateModelingParameters ();
G4VModel* pModel = new G4NullModel (pMP);
fpSceneHandler -> SetModel (pModel);
CheckModel();
fpSceneHandler -> BeginPrimitives (objectTransform);
fpSceneHandler -> AddPrimitive (square);
fpSceneHandler -> EndPrimitives ();
fpSceneHandler -> SetModel (0);
delete pModel;
delete pMP;
}
}
@@ -400,15 +365,10 @@ void G4VisManager::Draw (const G4Text& text,
const G4Transform3D& objectTransform) {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
G4ModelingParameters* pMP = fpSceneHandler -> CreateModelingParameters ();
G4VModel* pModel = new G4NullModel (pMP);
fpSceneHandler -> SetModel (pModel);
CheckModel();
fpSceneHandler -> BeginPrimitives (objectTransform);
fpSceneHandler -> AddPrimitive (text);
fpSceneHandler -> EndPrimitives ();
fpSceneHandler -> SetModel (0);
delete pModel;
delete pMP;
}
}
@@ -425,15 +385,10 @@ void G4VisManager::Draw (const G4VSolid& solid,
const G4Transform3D& objectTransform) {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
G4ModelingParameters* pMP = fpSceneHandler -> CreateModelingParameters ();
G4VModel* pModel = new G4NullModel (pMP);
fpSceneHandler -> SetModel (pModel);
CheckModel();
fpSceneHandler -> PreAddThis (objectTransform, attribs);
solid.DescribeYourselfTo (*fpSceneHandler);
fpSceneHandler -> PostAddThis ();
fpSceneHandler -> SetModel (0);
delete pModel;
delete pMP;
}
}
@@ -479,7 +434,7 @@ void G4VisManager::CreateViewer (G4String name) {
fpSceneHandler -> AddViewerToList (fpViewer);
fpSceneHandler -> SetCurrentViewer (fpViewer);
// Make it possible for user action code to Draw.
fpConcreteInstance = this;
SetConcreteInstance(this);
const G4ViewParameters& vp = fpViewer->GetViewParameters();
G4bool warn = false;
@@ -496,7 +451,7 @@ void G4VisManager::CreateViewer (G4String name) {
G4cout <<
"WARNING: objects with visibility flag set to \"false\""
" will not be drawn!"
"\n \"/vis/set/culling off\" to Draw such objects."
"\n \"/vis/viewer/set/culling global false\" to Draw such objects."
<< G4endl;
}
}
@@ -510,15 +465,14 @@ void G4VisManager::CreateViewer (G4String name) {
warn = true;
if (fVerbosity >= warnings) {
G4cout <<
"WARNING: covered objects in solid mode will not be part of"
" the scene!"
"\n \"/vis/set/cull_covered_daughters off\" to reverse this."
"WARNING: covered objects in solid mode will not be rendered!"
"\n \"/vis/viewer/set/culling coveredDaughters false\" to reverse this."
<< G4endl;
}
}
if (warn) {
if (fVerbosity >= warnings) {
G4cout << " Also see other \"/vis/set\" commands."
G4cout << " Also see other \"/vis/viewer/set\" commands."
<< G4endl;
}
}
@@ -568,7 +522,7 @@ void G4VisManager::DeleteCurrentSceneHandler () {
fpSceneHandler = fAvailableSceneHandlers [0];
fpViewer = 0;
// Make it impossible for user action code to Draw.
fpConcreteInstance = 0;
SetConcreteInstance(0);
if (fVerbosity >= warnings) {
G4cout << "WARNING: scene handler is now \""
<< fpSceneHandler -> GetName ();
@@ -580,7 +534,7 @@ void G4VisManager::DeleteCurrentSceneHandler () {
fpSceneHandler = 0;
fpViewer = 0;
// Make it impossible for user action code to Draw.
fpConcreteInstance = 0;
SetConcreteInstance(0);
if (fVerbosity >= warnings) {
G4cout <<
"WARNING: There are now no scene handlers left."
@@ -619,7 +573,7 @@ void G4VisManager::DeleteCurrentViewer () {
fpViewer = 0;
fpSceneHandler -> SetCurrentViewer (0);
// Make it impossible for user action code to Draw.
fpConcreteInstance = 0;
SetConcreteInstance(0);
if (fVerbosity >= warnings) {
G4cout <<
"WARNING: There are now no viewers left for this scene handler."
@@ -765,14 +719,14 @@ void G4VisManager::SetCurrentGraphicsSystem (G4VGraphicsSystem* pSystem) {
else {
fpViewer = 0;
// Make it impossible for user action code to Draw.
fpConcreteInstance = 0;
SetConcreteInstance(0);
}
}
else {
fpSceneHandler = 0;
fpViewer = 0;
// Make it impossible for user action code to Draw.
fpConcreteInstance = 0;
SetConcreteInstance(0);
}
}
}
@@ -816,7 +770,7 @@ void G4VisManager::SetCurrentSceneHandler (G4VSceneHandler* pSceneHandler) {
else {
fpViewer = 0;
// Make it impossible for user action code to Draw.
fpConcreteInstance = 0;
SetConcreteInstance(0);
if (fVerbosity >= warnings) {
G4cout <<
"WARNING: No viewers for this scene handler - please create one."
@@ -1030,32 +984,30 @@ void G4VisManager::BeginOfEvent () {
void G4VisManager::EndOfEvent () {
//G4cout << "G4VisManager::EndOfEvent" << G4endl;
if (fpConcreteInstance && IsValidView ()) {
if (GetConcreteInstance() && IsValidView ()) {
ClearTransientStoreIfMarked();
G4ModelingParameters* pMP =
fpSceneHandler -> CreateModelingParameters ();
fVisManagerModelingParameters
= *(fpSceneHandler -> CreateModelingParameters ());
const G4std::vector<G4VModel*>& EOEModelList =
fpScene -> GetEndOfEventModelList ();
for (size_t i = 0; i < EOEModelList.size (); i++) {
G4VModel* pModel = EOEModelList [i];
pModel -> SetModelingParameters (pMP);
pModel -> SetModelingParameters (&fVisManagerModelingParameters);
fpSceneHandler -> SetModel (pModel);
pModel -> DescribeYourselfTo (*fpSceneHandler);
pModel -> SetModelingParameters (0);
fpSceneHandler -> SetModel (0);
}
delete pMP;
if (fpScene->GetRefreshAtEndOfEvent()) {
fpViewer->ShowView(); // ...for systems needing post processing.
fpSceneHandler->SetMarkForClearingTransientStore(true);
}
fpSceneHandler -> SetModel (0); // Flags invalid model.
}
}
void G4VisManager::EndOfRun () {
//G4cout << "G4VisManager::EndOfRun" << G4endl;
if (fpConcreteInstance && IsValidView ()) {
fpSceneHandler->SetMarkForClearingTransientStore(false);
if (GetConcreteInstance() && IsValidView ()) {
fpSceneHandler->SetMarkForClearingTransientStore(true);
}
}
@@ -1067,6 +1019,18 @@ void G4VisManager::ClearTransientStoreIfMarked(){
}
}
void G4VisManager::CheckModel () {
G4VModel* pModel = fpSceneHandler->GetModel();
if (!pModel) { // provide a null model.
pModel = &fVisManagerNullModel;
fpSceneHandler -> SetModel (pModel);
}
// Ensure modeling parameters are right for this view...
fVisManagerModelingParameters
= *(fpSceneHandler -> CreateModelingParameters ());
pModel->SetModelingParameters (&fVisManagerModelingParameters);
}
G4String G4VisManager::ViewerShortName (const G4String& viewerName) const {
G4String viewerShortName (viewerName);
viewerShortName = viewerShortName (0, viewerShortName.find (' '));
@@ -1172,7 +1136,7 @@ G4bool G4VisManager::IsValidView () {
if (!fInitialised) Initialise ();
fpConcreteInstance = 0;
SetConcreteInstance(0);
// Unless we survive a few preliminary tests, users must not use.
if (!fpGraphicsSystem) return false;
@@ -1236,7 +1200,7 @@ G4bool G4VisManager::IsValidView () {
return false;
}
fpConcreteInstance = this; // Unless we find another problem, users can use!
SetConcreteInstance(this); // Unless we find another problem, users can use!
G4bool isValid = true;
if (fpScene -> IsEmpty ()) { // Add world by default if possible...
G4bool warn(fVerbosity >= warnings);
@@ -1251,7 +1215,7 @@ G4bool G4VisManager::IsValidView () {
<< G4endl;
}
isValid = false;
fpConcreteInstance = 0; // Users must not use!
SetConcreteInstance(0); // Users must not use!
}
else {
G4UImanager::GetUIpointer () -> ApplyCommand ("/vis/viewer/reset");
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VisStateDependent.cc,v 1.4 2001/09/10 10:41:33 johna Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4VisStateDependent.cc,v 1.5 2002/12/05 01:37:37 asaim Exp $
// GEANT4 tag $Name: geant4-05-00 $
#include "G4VisStateDependent.hh"
@@ -35,16 +35,16 @@ G4VisStateDependent::G4VisStateDependent (G4VisManager* pVisManager):
G4bool G4VisStateDependent::Notify (G4ApplicationState requestedState) {
G4StateManager* stateManager = G4StateManager::GetStateManager();
G4ApplicationState previousState = stateManager->GetPreviousState();
if (previousState == Idle && requestedState == GeomClosed) {
if (previousState == G4State_Idle && requestedState == G4State_GeomClosed) {
fpVisManager -> BeginOfRun ();
}
else if (previousState == GeomClosed && requestedState == EventProc) {
else if (previousState == G4State_GeomClosed && requestedState == G4State_EventProc) {
fpVisManager -> BeginOfEvent ();
}
else if (previousState == EventProc && requestedState == GeomClosed) {
else if (previousState == G4State_EventProc && requestedState == G4State_GeomClosed) {
fpVisManager -> EndOfEvent ();
}
else if (previousState == GeomClosed && requestedState == Idle) {
else if (previousState == G4State_GeomClosed && requestedState == G4State_Idle) {
fpVisManager -> EndOfRun ();
}
return true;