Import Geant4 1.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:28:20 +02:00
parent aaa409b6ee
commit ca1c8cb059
2995 changed files with 106830 additions and 299600 deletions
+52 -20
View File
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Scene.cc,v 1.3 1999/05/25 09:14:15 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4Scene.cc,v 1.4.4.1 1999/12/07 20:53:59 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// Scene data John Allison 19th July 1996.
@@ -25,29 +25,39 @@ G4Scene::G4Scene (const G4String& name):
G4Scene::~G4Scene () {}
void G4Scene::AddRunDurationModel (G4VModel* pModel) {
G4bool G4Scene::AddRunDurationModel (G4VModel* pModel) {
G4int i, nModels = fRunDurationModelList.entries ();
for (i = 0; i < nModels; i++) {
if (pModel -> GetGlobalDescription () ==
fRunDurationModelList [i] -> GetGlobalDescription ()) break;
}
if (i < nModels) {
G4cout << "G4Scene::AddRunDurationModel: model \""
<< pModel -> GetGlobalDescription ()
<< "\"\n is already in the run-duration list of scene \""
<< fName
<< "\"."
<< endl;
return false;
}
fRunDurationModelList.append (pModel);
G4int nModels = fRunDurationModelList.entries ();
nModels = fRunDurationModelList.entries (); // ...has increased by 1...
G4BoundingSphereScene boundingSphereScene;
for (int i = 0; i < nModels; i++) {
for (i = 0; i < nModels; i++) {
const G4VisExtent& thisExtent =
fRunDurationModelList[i] -> GetExtent ();
G4Point3D thisCentre = thisExtent.GetExtentCentre ();
G4double thisRadius = thisExtent.GetExtentRadius ();
//thisCentre.transform (fRunDurationModelList[i] -> GetTransformation ());
// To by-pass temporary CLHEP non-const problem...
G4Transform3D modelTransformation =
fRunDurationModelList[i] -> GetTransformation ();
thisCentre.transform (modelTransformation);
thisCentre.transform (fRunDurationModelList[i] -> GetTransformation ());
boundingSphereScene.AccrueBoundingSphere (thisCentre, thisRadius);
}
fExtent = boundingSphereScene.GetBoundingSphereExtent ();
fStandardTargetPoint = fExtent.GetExtentCentre ();
return true;
}
void G4Scene::AddWorldIfEmpty () {
G4bool G4Scene::AddWorldIfEmpty () {
G4bool successful = false;
if (IsEmpty ()) {
G4VPhysicalVolume* pWorld =
G4TransportationManager::GetTransportationManager ()
@@ -64,14 +74,36 @@ void G4Scene::AddWorldIfEmpty () {
" SetVisAttributes (G4VisAttributes::Invisible);"
<< endl;
}
AddRunDurationModel (new G4PhysicalVolumeModel (pWorld));
successful = AddRunDurationModel (new G4PhysicalVolumeModel (pWorld));
// Note: default depth and no modeling parameters.
G4cout <<
"G4Scene::AddWorldIfEmpty: The scene was empty,"
"\n \"world\" has been added.";
G4cout << endl;
if (successful) {
G4cout <<
"G4Scene::AddWorldIfEmpty: The scene was empty,"
"\n \"world\" has been added.";
G4cout << endl;
}
}
}
return successful;
}
G4bool G4Scene::AddEndOfEventModel (G4VModel* pModel) {
G4int i, nModels = fEndOfEventModelList.entries ();
for (i = 0; i < nModels; i++) {
if (pModel -> GetGlobalDescription () ==
fEndOfEventModelList [i] -> GetGlobalDescription ()) break;
}
if (i < nModels) {
G4cout << "G4Scene::AddEndOfEventModel: model \""
<< pModel -> GetGlobalDescription ()
<< "\"\n is already in the run-duration list of scene \""
<< fName
<< "\"."
<< endl;
return false;
}
fEndOfEventModelList.append (pModel);
return true;
}
void G4Scene::Clear () {
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VGraphicsSystem.cc,v 1.4 1999/05/10 14:04:11 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VGraphicsSystem.cc,v 1.4.8.1 1999/12/07 20:53:59 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// John Allison 27th March 1996
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VSceneHandler.cc,v 1.4 1999/05/10 14:04:13 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VSceneHandler.cc,v 1.7.2.1 1999/12/07 20:53:59 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// John Allison 19th July 1996
@@ -49,7 +49,7 @@ G4VSceneHandler::G4VSceneHandler (G4VGraphicsSystem& system, G4int id, const G4S
fpViewer (0),
fReadyForTransients (false),
fpModel (0),
fpObjectTransformation (0),
fpObjectTransformation (&G4Transform3D::Identity),
fpVisAttribs (0),
fCurrentDepth (0),
fpCurrentPV (0),
@@ -72,6 +72,25 @@ G4VSceneHandler::~G4VSceneHandler () {
fViewerList.clearAndDestroy ();
}
void G4VSceneHandler::EndModeling () {}
void G4VSceneHandler::PreAddThis (const G4Transform3D& objectTransformation,
const G4VisAttributes& visAttribs) {
fpObjectTransformation = &objectTransformation;
fpVisAttribs = &visAttribs;
}
void G4VSceneHandler::PostAddThis () {
fpObjectTransformation = &G4Transform3D::Identity;
fpVisAttribs = 0;
}
void G4VSceneHandler::ClearStore () {
fpViewer -> NeedKernelVisit ();
}
void G4VSceneHandler::ClearTransientStore () {}
void G4VSceneHandler::AddThis (const G4Box& box) {
RequestPrimitives (box);
// If your graphics system is sophisticated enough to handle a
@@ -262,7 +281,7 @@ void G4VSceneHandler::ProcessScene (G4VViewer& view) {
// Traverse geometry tree and send drawing primitives to window(s).
const RWTPtrOrderedVector <G4VModel>& runDurationModelList =
const G4RWTPtrOrderedVector <G4VModel>& runDurationModelList =
fpScene -> GetRunDurationModelList ();
if (runDurationModelList.entries ()) {
@@ -280,7 +299,8 @@ void G4VSceneHandler::ProcessScene (G4VViewer& view) {
// comes to do this, then perhaps there should be a default
// set of modeling parameters in the view parameters for the
// case of a zero modeling parameters pointer.)
// (I think for the G4 Vis System we'll rely on view parameters and convert.
// (I think for the G4 Vis System we'll rely on view parameters
// and convert using pMP = CreateModelingParameters () as above.)
pModel -> SetModelingParameters (pMP);
SetModel (pModel); // Store for use by derived class.
BeginModeling ();
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VViewer.cc,v 1.3 1999/01/11 00:48:30 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VViewer.cc,v 1.4.4.1 1999/12/07 20:53:59 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// John Allison 27th March 1996
@@ -81,8 +81,8 @@ void G4VViewer::ProcessView () {
// necessary to visit the kernel (this should be Done in the concrete
// object's DrawView ())...
if (fNeedKernelVisit) {
fNeedKernelVisit = false;
fSceneHandler.ProcessScene (*this);
fNeedKernelVisit = false;
}
}
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VVisCommand.cc,v 1.3 1999/05/10 14:04:14 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VVisCommand.cc,v 1.4.4.1 1999/12/07 20:53:59 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
// Base class for visualization commands - John Allison 9th August 1998
// It is really a messenger - we have one command per messenger.
@@ -17,6 +17,8 @@ G4VVisCommand::~G4VVisCommand () {}
G4VisManager* G4VVisCommand::fpVisManager = 0;
G4UIcmdWithAString* G4VVisCommand::fpCommandSceneEdit = 0;
G4UIcmdWithAString* G4VVisCommand::fpCommandSceneNotifyHandlers = 0;
G4UIcmdWithAString* G4VVisCommand::fpCommandSceneRemove = 0;
@@ -34,3 +36,5 @@ G4UIcommand* G4VVisCommand::fpCommandViewerCreate = 0;
G4UIcmdWithAString* G4VVisCommand::fpCommandViewerRemove = 0;
G4UIcmdWithAString* G4VVisCommand::fpCommandViewerSelect = 0;
G4UIcmdWithAString* G4VVisCommand::fpCommandViewerUpdate = 0;
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ViewParameters.cc,v 1.4 1999/05/25 09:14:17 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4ViewParameters.cc,v 1.4.8.1 1999/12/07 20:53:59 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// John Allison 19th July 1996
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandTemplates.cc,v 1.2 1999/01/09 16:31:18 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VisCommandTemplates.cc,v 1.3.2.1 1999/12/07 20:54:00 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// Visualization Command Messenger Template private functions.
@@ -39,11 +39,11 @@ G4int G4VisButtonCommandMessengerInterpret (G4String newValues) {
G4String& choice = newValues;
G4int iSelector = -1;
if (choice.compareTo ("0") == 0 ||
choice.compareTo ("off", RWCString::ignoreCase) == 0 ||
choice.compareTo ("false", RWCString::ignoreCase) == 0) iSelector = 0;
choice.compareTo ("off", G4String::ignoreCase) == 0 ||
choice.compareTo ("false", G4String::ignoreCase) == 0) iSelector = 0;
if (choice.compareTo ("1") == 0 ||
choice.compareTo ("on", RWCString::ignoreCase) == 0 ||
choice.compareTo ("true", RWCString::ignoreCase) == 0) iSelector = 1;
choice.compareTo ("on", G4String::ignoreCase) == 0 ||
choice.compareTo ("true", G4String::ignoreCase) == 0) iSelector = 1;
if (iSelector < 0 || choice.isNull ()) {
G4cout << "Choice not recognised."
"\n Choice is 0 (or off or false) or 1 (or on or true)." << endl;;
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandsCamera.cc,v 1.3 1999/01/11 00:48:31 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VisCommandsCamera.cc,v 1.3.8.1 1999/12/07 20:54:00 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandsCameraMessengers.cc,v 1.2 1999/01/09 16:31:19 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VisCommandsCameraMessengers.cc,v 1.2.8.1 1999/12/07 20:54:00 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// Messengers for /vis~/camera commands - John Allison 6th April 1998.
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandsScene.cc,v 1.7 1999/05/10 14:04:15 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VisCommandsScene.cc,v 1.9.4.1 1999/12/07 20:54:00 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
// /vis/scene commands - John Allison 9th August 1998
@@ -30,6 +30,13 @@ G4VVisCommandScene::G4VVisCommandScene () {}
G4VVisCommandScene::~G4VVisCommandScene () {}
G4String G4VVisCommandScene::CurrentSceneName () {
const G4Scene* pScene = fpVisManager -> GetCurrentScene ();
G4String currentSceneName;
if (pScene) currentSceneName = pScene -> GetName ();
return currentSceneName;
}
void G4VVisCommandScene::UpdateCandidateLists () {
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
@@ -40,6 +47,11 @@ void G4VVisCommandScene::UpdateCandidateLists () {
}
nameList = nameList.strip ();
if (fpCommandSceneEdit) {
fpCommandSceneEdit -> GetParameter (0) ->
SetParameterCandidates (nameList);
}
if (fpCommandSceneNotifyHandlers) {
fpCommandSceneNotifyHandlers -> GetParameter (0) ->
SetParameterCandidates (nameList);
@@ -61,20 +73,16 @@ void G4VVisCommandScene::UpdateCandidateLists () {
}
}
void G4VVisCommandScene::UpdateVisManagerSceneAndViewParameters
void G4VVisCommandScene::UpdateVisManagerScene
(const G4String& sceneName) {
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
G4int iScene, nScenes = sceneList.entries ();
for (iScene = 0; iScene < nScenes; iScene++) {
if (sceneList [iScene] -> GetName () == sceneName) break;
}
if (iScene < nScenes) {
fpVisManager -> SetCurrentScene (sceneList [iScene]);
G4UImanager::GetUIpointer () -> ApplyCommand ("/vis/camera/reset");
}
else {
fpVisManager -> SetCurrentScene (0);
}
G4Scene* pScene = 0; // Zero unless scene has been found...
if (iScene < nScenes) pScene = sceneList [iScene];
fpVisManager -> SetCurrentScene (pScene);
}
////////////// /vis/scene/create ///////////////////////////////////////
@@ -89,6 +97,7 @@ G4VisCommandSceneCreate::G4VisCommandSceneCreate (): fId (0) {
fpCommand -> SetParameterName ("scene-name",
omitable = true,
currentAsDefault = true);
fpCommandSceneEdit = fpCommand;
}
G4VisCommandSceneCreate::~G4VisCommandSceneCreate () {
@@ -129,13 +138,68 @@ void G4VisCommandSceneCreate::SetNewValue (G4UIcommand* command,
sceneList.append (new G4Scene (newName));
// Adds empty scene data object to list.
UpdateVisManagerSceneAndViewParameters (newName);
UpdateVisManagerScene (newName);
G4cout << "New empty scene \"" << newName << "\" created." << endl;
UpdateCandidateLists ();
}
}
////////////// /vis/scene/edit ///////////////////////////////////////
G4VisCommandSceneEdit::G4VisCommandSceneEdit () {
G4bool omitable, currentAsDefault;
fpCommand = new G4UIcmdWithAString ("/vis/scene/edit", this);
fpCommand -> SetGuidance ("/vis/scene/edit [<scene-name>]");
fpCommand -> SetGuidance ("Edits a scene (default current scene).");
fpCommand -> SetGuidance ("This scene becomes current.");
fpCommand -> SetParameterName ("scene-name",
omitable = true,
currentAsDefault = true);
}
G4VisCommandSceneEdit::~G4VisCommandSceneEdit () {
delete fpCommand;
}
G4String G4VisCommandSceneEdit::GetCurrentValue (G4UIcommand* command) {
return CurrentSceneName ();
}
void G4VisCommandSceneEdit::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4String sceneName;
istrstream is ((char*)newValue.data());
is >> sceneName;
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
G4int iScene, nScenes = sceneList.entries ();
G4Scene* pScene;
for (iScene = 0; iScene < nScenes; iScene++) {
pScene = sceneList [iScene];
if (pScene -> GetName () == sceneName) break;
}
if (iScene >= nScenes) {
G4cout << "G4VisCommandSceneEdit::SetNewValue: Scene \""
<< sceneName << "\" not found."
"\n /vis/scene/list to see scenes."
<< endl;
return;
}
else {
G4cout << "Scene \"" << sceneName << "\" contains:" << endl;
G4String uiCommand ("/vis/scene/list ");
uiCommand += sceneName;
uiCommand += " 1";
G4UImanager::GetUIpointer () -> ApplyCommand (uiCommand);
G4cout <<
"(YOU CAN DO NOTHING YET - /vis/scene/edit FACILITY IN PREPARATION."
<< endl;
}
UpdateVisManagerScene (sceneName);
}
////////////// /vis/scene/list ///////////////////////////////////////
G4VisCommandSceneList::G4VisCommandSceneList () {
@@ -145,7 +209,7 @@ G4VisCommandSceneList::G4VisCommandSceneList () {
fpCommand -> SetGuidance ("Lists scene(s).");
fpCommand -> SetGuidance ("<scene-name> default is \"all\"");
fpCommand -> SetGuidance
("<verbosity> is 0 for short (default) or 1 for long listing.");
("<verbosity> is 0/1/2 for short/medium/long listing.");
G4UIparameter* parameter;
parameter = new G4UIparameter ("scene-name", 's',
omitable = true);
@@ -178,14 +242,36 @@ void G4VisCommandSceneList::SetNewValue (G4UIcommand* command,
G4int iScene, nScenes = sceneList.entries ();
G4bool found = false;
for (iScene = 0; iScene < nScenes; iScene++) {
const G4String& iName = sceneList [iScene] -> GetName ();
G4Scene* pScene = sceneList [iScene];
const G4String& iName = pScene -> GetName ();
if (name != "all") {
if (name != iName) continue;
}
found = true;
G4cout << "Scene name: \"" << iName << "\"";
if (verbosity > 0) {
G4cout << ", " << *sceneList [iScene];
if (verbosity == 1) {
G4int i;
G4cout << "\n Run-duration models:";
G4int nRunModels = pScene -> GetRunDurationModelList ().entries ();
if (nRunModels == 0) {
G4cout << " none.";
}
for (i = 0; i < nRunModels; i++) {
G4VModel* pModel = pScene -> GetRunDurationModelList () [i];
G4cout << "\n " << pModel -> GetGlobalDescription ();
}
G4cout << "\n End-of-event models:";
G4int nEOEModels = pScene -> GetEndOfEventModelList ().entries ();
if (nEOEModels == 0) {
G4cout << " none.";
}
for (i = 0; i < nEOEModels; i++) {
G4VModel* pModel = pScene -> GetEndOfEventModelList () [i];
G4cout << "\n " << pModel -> GetGlobalDescription ();
}
}
if (verbosity >= 2) {
G4cout << "\n " << *sceneList [iScene];
}
G4cout << endl;
}
@@ -221,7 +307,7 @@ G4VisCommandSceneNotifyHandlers::~G4VisCommandSceneNotifyHandlers () {
G4String G4VisCommandSceneNotifyHandlers::GetCurrentValue
(G4UIcommand* command) {
return fpVisManager -> GetCurrentScene () -> GetName ();
return CurrentSceneName ();
}
void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand* command,
@@ -248,25 +334,30 @@ void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand* command,
return;
}
// For each scene handler, if it contains the scene, for each viewer
// set (make current), clear, (re)draw, and show.
// For each scene handler, if it contains the scene, clear and
// rebuild the graphical database, then for each viewer set (make
// current), clear, (re)draw, and show.
const G4int nSceneHandlers = sceneHandlerList.entries ();
for (G4int iSH = 0; iSH < nSceneHandlers; iSH++) {
G4VSceneHandler* aSceneHandler = sceneHandlerList [iSH];
G4Scene* theScene = aSceneHandler -> GetScene ();
const G4String& theSceneName = theScene -> GetName ();
if (sceneName == theSceneName) {
G4Scene* aScene = aSceneHandler -> GetScene ();
const G4String& aSceneName = aScene -> GetName ();
if (sceneName == aSceneName) {
aSceneHandler -> ClearStore ();
aSceneHandler -> ClearTransientStore ();
G4ViewerList& viewerList = aSceneHandler -> SetViewerList ();
const G4int nViewers = viewerList.entries ();
for (G4int iV = 0; iV < nViewers; iV++) {
G4VViewer* aViewer = viewerList [iV];
aViewer -> SetView ();
aViewer -> ClearView ();
aViewer -> DrawView ();
aViewer -> ShowView ();
// Triggers rebuild of graphical database by notifying the scene
// handler. The viewer is supposed to be smart enough to know
// when not to do this. E.g., the second viewer of a scene
// handler does not do it.
G4cout << "Viewer \"" << aViewer -> GetName ()
<< "\" of scene handler \"" << aSceneHandler -> GetName ()
<< "\"\n refreshed at request of scene \"" << sceneName
<< "\"\n prepared at request of scene \"" << sceneName
<< "\"." << endl;
}
}
@@ -293,7 +384,7 @@ G4VisCommandSceneRemove::~G4VisCommandSceneRemove () {
}
G4String G4VisCommandSceneRemove::GetCurrentValue (G4UIcommand* command) {
return fpVisManager -> GetCurrentScene () -> GetName ();
return CurrentSceneName ();
}
void G4VisCommandSceneRemove::SetNewValue (G4UIcommand* command,
@@ -312,12 +403,12 @@ void G4VisCommandSceneRemove::SetNewValue (G4UIcommand* command,
G4cout << "Scene \"" << removeName << "\" removed." << endl;
UpdateCandidateLists ();
if (sceneList.isEmpty ()) {
UpdateVisManagerSceneAndViewParameters ();
UpdateVisManagerScene ();
G4cout << "No scenes left. Please create a new one." << endl;
}
else {
if (currentSceneName == removeName) {
UpdateVisManagerSceneAndViewParameters (sceneList [0] -> GetName ());
UpdateVisManagerScene (sceneList [0] -> GetName ());
G4cout << "Current scene is now \""
<< fpVisManager -> GetCurrentScene () -> GetName ()
<< "\"" << endl;
@@ -354,7 +445,7 @@ G4VisCommandSceneSelect::~G4VisCommandSceneSelect () {
}
G4String G4VisCommandSceneSelect::GetCurrentValue (G4UIcommand* command) {
return fpVisManager -> GetCurrentScene () -> GetName ();
return CurrentSceneName ();
}
void G4VisCommandSceneSelect::SetNewValue (G4UIcommand* command,
@@ -367,7 +458,7 @@ void G4VisCommandSceneSelect::SetNewValue (G4UIcommand* command,
}
G4cout << "Scene \"" << selectName;
if (iScene < nScenes) {
UpdateVisManagerSceneAndViewParameters (selectName);
UpdateVisManagerScene (selectName);
G4cout << "\" selected." << endl;
}
else {
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandsSceneAdd.cc,v 1.5 1999/04/16 09:06:09 mora Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VisCommandsSceneAdd.cc,v 1.8.4.1 1999/12/07 20:54:00 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
// /vis/scene commands - John Allison 9th August 1998
@@ -14,7 +14,9 @@
#include "G4VisManager.hh"
#include "G4TransportationManager.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4PhysicalVolumeModel.hh"
#include "G4LogicalVolumeModel.hh"
#include "G4ModelingParameters.hh"
#include "G4PhysicalVolumeSearchScene.hh"
#include "G4VGlobalFastSimulationManager.hh"
@@ -42,8 +44,8 @@ G4VisCommandSceneAddVolume::G4VisCommandSceneAddVolume () {
fpCommand -> SetGuidance ("Adds a physical volume to the current scene.");
fpCommand -> SetGuidance
("1st parameter: volume name (default \"world\").");
fpCommand -> SetGuidance
(" \"list\" to list all volumes.");
// fpCommand -> SetGuidance // Not implemented - should be in geom?
// (" \"list\" to list all volumes.");
fpCommand -> SetGuidance
("2nd parameter: copy number (default 0).");
fpCommand -> SetGuidance
@@ -134,18 +136,95 @@ void G4VisCommandSceneAddVolume::SetNewValue (G4UIcommand* command,
if (model) {
G4Scene* pScene = fpVisManager -> GetCurrentScene ();
const G4String& currentSceneName = pScene -> GetName ();
pScene -> AddRunDurationModel (model);
UpdateVisManagerSceneAndViewParameters (currentSceneName);
G4cout << "First occurrence of \"" << foundVolume -> GetName ()
<< "\", copy no. " << copyNo
<< ", found at depth " << foundDepth
<< ",\n with further requested depth of descent "
G4bool successful = pScene -> AddRunDurationModel (model);
UpdateVisManagerScene (currentSceneName);
if (successful) {
G4cout << "First occurrence of \"" << foundVolume -> GetName ()
<< "\", copy no. " << copyNo
<< ", found at depth " << foundDepth
<< ",\n with further requested depth of descent "
<< requestedDepthOfDescent
<< ", has been added to scene \"" << currentSceneName << "\""
<< endl;
}
}
}
////////////// /vis/scene/add/logicalVolume ///////////////////////////////////////
G4VisCommandSceneAddLogicalVolume::G4VisCommandSceneAddLogicalVolume () {
G4bool omitable;
fpCommand = new G4UIcommand ("/vis/scene/add/logicalVolume", this);
fpCommand -> AvailableForStates (Idle, GeomClosed);
fpCommand -> SetGuidance
("/vis/scene/add/logicalVolume <logical-volume-name> [<depth-of-descending>]");
fpCommand -> SetGuidance ("Adds a logical volume to the current scene.");
fpCommand -> SetGuidance
("1st parameter: volume name.");
// fpCommand -> SetGuidance // Not implemented - should be in geom?
// (" \"list\" to list all volumes.");
fpCommand -> SetGuidance
("2nd parameter: depth of descending geometry hierarchy (default 1).");
G4UIparameter* parameter;
parameter = new G4UIparameter ("volume", 's', omitable = false);
fpCommand -> SetParameter (parameter);
parameter = new G4UIparameter ("depth", 'i', omitable = true);
parameter -> SetDefaultValue (1);
fpCommand -> SetParameter (parameter);
}
G4VisCommandSceneAddLogicalVolume::~G4VisCommandSceneAddLogicalVolume () {
delete fpCommand;
}
G4String G4VisCommandSceneAddLogicalVolume::GetCurrentValue (G4UIcommand*) {
return "";
}
void G4VisCommandSceneAddLogicalVolume::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
if (sceneList.isEmpty ()) {
G4cout << "No scenes - please create one before adding anything."
<< endl;
return;
}
G4String name;
G4int requestedDepthOfDescent;
const char* s = newValue;
istrstream is ((char*)s);
is >> name >> requestedDepthOfDescent;
G4LogicalVolumeStore *pLVStore = G4LogicalVolumeStore::GetInstance();
int nLV = pLVStore -> entries ();
int iLV;
G4LogicalVolume* pLV;
for (iLV = 0; iLV < nLV; iLV++ ) {
pLV = (*pLVStore) [iLV];
if (pLV -> GetName () == name) break;
}
if (iLV == nLV) {
G4cout << "Logical volume " << name
<< " not found in logical volume Store." << endl;
return;
}
G4VModel* model = new G4LogicalVolumeModel (pLV, requestedDepthOfDescent);
G4Scene* pScene = fpVisManager -> GetCurrentScene ();
const G4String& currentSceneName = pScene -> GetName ();
G4bool succesful = pScene -> AddRunDurationModel (model);
UpdateVisManagerScene (currentSceneName);
if (succesful) {
G4cout << "Logical volume \"" << pLV -> GetName ()
<< " with requested depth of descent "
<< requestedDepthOfDescent
<< ", has been added to scene \"" << currentSceneName << "\""
<< ",\n has been added to scene \"" << currentSceneName << "\""
<< endl;
}
}
////////////// /vis/scene/add/ghosts ///////////////////////////////////////
G4VisCommandSceneAddGhosts::G4VisCommandSceneAddGhosts () {
@@ -193,16 +272,19 @@ void G4VisCommandSceneAddGhosts::SetNewValue (G4UIcommand* command,
if(newValue=="all") {
G4VFlavoredParallelWorld* CurrentFlavoredWorld;
G4bool successful;
for (G4int iParticle=0; iParticle<theParticleTable->entries();
iParticle++)
if(CurrentFlavoredWorld=theGlobalFastSimulationManager->
GetFlavoredWorldForThis(theParticleTable->
GetParticle(iParticle)))
pCurrentScene -> AddRunDurationModel
successful = pCurrentScene -> AddRunDurationModel
(new G4FlavoredParallelWorldModel (CurrentFlavoredWorld));
UpdateVisManagerSceneAndViewParameters ();
G4cout << "Ghosts added to the Scene, refresh the view to see it."
<< endl;
UpdateVisManagerScene ();
if (successful) {
G4cout << "Ghosts added to the Scene, refresh the view to see it."
<< endl;
}
return;
}
@@ -216,11 +298,13 @@ void G4VisCommandSceneAddGhosts::SetNewValue (G4UIcommand* command,
G4VFlavoredParallelWorld* worldForThis;
if(worldForThis=theGlobalFastSimulationManager->
GetFlavoredWorldForThis(currentParticle)) {
pCurrentScene -> AddRunDurationModel
G4bool successful = pCurrentScene -> AddRunDurationModel
(new G4FlavoredParallelWorldModel (worldForThis));
UpdateVisManagerSceneAndViewParameters (currentSceneName);
G4cout << "Ghosts added to the Scene, refresh the view to see it."
<< endl;
UpdateVisManagerScene (currentSceneName);
if (successful) {
G4cout << "Ghosts added to the Scene, refresh the view to see it."
<< endl;
}
}
else G4cout << "There are no ghosts for \""<<newValue<<"\""<<endl;
}
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandsSceneHandler.cc,v 1.7 1999/05/12 13:58:48 barrand Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VisCommandsSceneHandler.cc,v 1.8.2.1 1999/12/07 20:54:01 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
// /vis/sceneHandler commands - John Allison 10th October 1998
@@ -247,9 +247,9 @@ void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand* command,
int iGS; // Selector index.
for (iGS = 0; iGS < nSystems; iGS++) {
if (graphicsSystem.compareTo (gsl [iGS] -> GetName (),
RWCString::ignoreCase) == 0 ||
G4String::ignoreCase) == 0 ||
graphicsSystem.compareTo (gsl [iGS] -> GetNickname (),
RWCString::ignoreCase) == 0) {
G4String::ignoreCase) == 0) {
break; // Match found.
}
}
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandsSceneInclude.cc,v 1.3 1999/01/11 00:48:34 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VisCommandsSceneInclude.cc,v 1.3.8.1 1999/12/07 20:54:01 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
// /vis/scene commands - John Allison 9th August 1998
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandsViewer.cc,v 1.6 1999/05/10 14:04:18 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VisCommandsViewer.cc,v 1.7.4.1 1999/12/07 20:54:01 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
// /vis/viewer commands - John Allison 25th October 1998
@@ -61,6 +61,11 @@ void G4VVisCommandViewer::UpdateCandidateLists () {
fpCommandViewerSelect -> GetParameter (0) ->
SetParameterCandidates (fViewerNameList);
}
if (fpCommandViewerUpdate) {
fpCommandViewerUpdate -> GetParameter (0) ->
SetParameterCandidates (fViewerNameList);
}
}
G4String G4VVisCommandViewer::fViewerNameList;
@@ -468,3 +473,78 @@ void G4VisCommandViewerSelect::SetNewValue (G4UIcommand* command,
<< endl;
}
}
////////////// /vis/viewer/update ///////////////////////////////////////
G4VisCommandViewerUpdate::G4VisCommandViewerUpdate () {
G4bool omitable, currentAsDefault;
fpCommand = new G4UIcmdWithAString ("/vis/viewer/update", this);
fpCommand -> SetGuidance ("/vis/viewer/update [<viewer-name>]");
fpCommand -> SetGuidance
("Updates viewer (necessary for graphical database post-processing.");
fpCommand -> SetGuidance ("Viewer becomes current.");
fpCommand -> SetGuidance
("Specify viewer by name (\"/vis/viewer/list\""
"\n to see possibilities).");
fpCommand -> SetParameterName ("viewer-name",
omitable = true,
currentAsDefault = true);
fpCommandViewerUpdate = fpCommand;
}
G4VisCommandViewerUpdate::~G4VisCommandViewerUpdate () {
delete fpCommand;
}
G4String G4VisCommandViewerUpdate::GetCurrentValue
(G4UIcommand* command) {
G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
if (viewer) {
return viewer -> GetName ();
}
else {
return "none";
}
}
void G4VisCommandViewerUpdate::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4String& updateName = newValue;
G4String updateShortName = ShortName (updateName);
G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
G4bool found = true;
if (updateShortName != ShortName (viewer -> GetName ())) {
found = false;
const G4SceneHandlerList& sceneHandlerList =
fpVisManager -> GetAvailableSceneHandlers ();
G4int nHandlers = sceneHandlerList.entries ();
for (G4int iHandler = 0; iHandler < nHandlers; iHandler++) {
G4VSceneHandler* sceneHandler = sceneHandlerList [iHandler];
const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
for (G4int iViewer = 0; iViewer < viewerList.entries (); iViewer++) {
viewer = viewerList [iViewer];
if (updateShortName == ShortName (viewer -> GetName ())) {
found = true;
fpVisManager -> SetCurrentViewer (viewer);
fpVisManager -> SetCurrentSceneHandler (sceneHandler);
fpVisManager -> SetCurrentGraphicsSystem
(sceneHandler -> GetGraphicsSystem ());
break;
}
}
if (found) break;
}
}
G4cout << "Viewer \"" << updateName << "\"";
if (found) {
viewer -> ShowView ();
G4cout << " updated.";
}
else {
G4cout << " not found - \"/vis/viewer/list\""
"\n to see possibilities.";
}
G4cout << endl;
}
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisFeaturesOfDAWNFILE.cc,v 1.2 1999/01/09 16:31:25 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VisFeaturesOfDAWNFILE.cc,v 1.2.8.1 1999/12/07 20:54:01 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
#include "G4VisFeaturesOfDAWNFILE.hh"
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisFeaturesOfFukuiRenderer.cc,v 1.2 1999/01/09 16:31:26 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VisFeaturesOfFukuiRenderer.cc,v 1.2.8.1 1999/12/07 20:54:01 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisFeaturesOfOpenGL.cc,v 1.2 1999/01/09 16:31:26 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VisFeaturesOfOpenGL.cc,v 1.2.8.1 1999/12/07 20:54:01 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisFeaturesOfOpenInventor.cc,v 1.2 1999/01/09 16:31:27 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VisFeaturesOfOpenInventor.cc,v 1.2.8.1 1999/12/07 20:54:01 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
@@ -1,21 +0,0 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisFeaturesOfRay.cc,v 1.2 1999/01/09 16:31:27 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
#include "G4VisFeaturesOfRay.hh"
G4String G4VisFeaturesOfRayX () {
return
" GEANT4 Ray Tracing to a dumb single buffered X Window."
"\n Advantages: uses GEANT4's own tracking algorithms."
"\n photo-realistic."
"\n Disadvantages: slow.";
}
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManMessCamera.cc,v 1.3 1999/01/11 00:48:35 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VisManMessCamera.cc,v 1.3.8.1 1999/12/07 20:54:02 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// GEANT4 Visualization Manager Messenger - John Allison 22nd July 1996.
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManMessCreateView.cc,v 1.3 1999/01/11 00:48:36 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VisManMessCreateView.cc,v 1.4.2.1 1999/12/07 20:54:02 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// GEANT4 Visualization Manager Messenger - John Allison 22nd July 1996.
@@ -72,17 +72,17 @@ void G4VisManMessenger::DoCommandCreateView (const G4String& commandPath,
int iGS; // Selector index.
for (iGS = 0; iGS < nSystems; iGS++) {
if (selector.compareTo (gsl [iGS] -> GetName (),
RWCString::ignoreCase) == 0 ||
G4String::ignoreCase) == 0 ||
selector.compareTo (gsl [iGS] -> GetNickname (),
RWCString::ignoreCase) == 0) {
G4String::ignoreCase) == 0) {
break; // Match found.
}
}
if (iGS < 0 || iGS >= nSystems) {
// Invalid command line argument or non. Print available systems.
G4bool help;
if (selector.compareTo ("help", RWCString::ignoreCase) == 0 ||
selector.compareTo ("info", RWCString::ignoreCase) == 0)
if (selector.compareTo ("help", G4String::ignoreCase) == 0 ||
selector.compareTo ("info", G4String::ignoreCase) == 0)
help = true;
else help = false;
int maxNameLength = strlen ("class name");
@@ -123,7 +123,7 @@ void G4VisManMessenger::DoCommandCreateView (const G4String& commandPath,
description = gsl [igs] -> GetDescription ();
if (description != "") {
size_t index = 0;
while ((index = description.index ('\n', ++index)) != RW_NPOS) {
while ((index = description.index ('\n', ++index)) != G4std::string::npos) {
description.replace (index, 1, "\n ");
}
G4cout << "\n " << description;
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManMessDraw.cc,v 1.4 1999/04/16 09:06:09 mora Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VisManMessDraw.cc,v 1.4.8.1 1999/12/07 20:54:02 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// GEANT4 Visualization Manager Messenger - John Allison 22nd July 1996.
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManMessExpert.cc,v 1.3 1999/01/11 00:48:37 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VisManMessExpert.cc,v 1.3.8.1 1999/12/07 20:54:02 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// GEANT4 Visualization Manager Messenger - John Allison 22nd July 1996.
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManMessLights.cc,v 1.3 1999/01/11 00:48:38 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VisManMessLights.cc,v 1.3.8.1 1999/12/07 20:54:02 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// GEANT4 Visualization Manager Messenger - John Allison 22nd July 1996.
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManMessSet.cc,v 1.3 1999/01/11 00:48:39 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VisManMessSet.cc,v 1.5.2.1 1999/12/07 20:54:02 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// GEANT4 Visualization Manager Messenger - John Allison 22nd July 1996.
@@ -205,8 +205,8 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
const char* t = newValues;
istrstream is ((char*)t); is >> choice >> density;
G4int iSelector = -1;
if (choice.compareTo ("off",RWCString::ignoreCase) == 0) iSelector = 0;
if (choice.compareTo ("on",RWCString::ignoreCase) == 0) iSelector = 1;
if (choice.compareTo ("off",G4String::ignoreCase) == 0) iSelector = 0;
if (choice.compareTo ("on",G4String::ignoreCase) == 0) iSelector = 1;
if (iSelector < 0) {
G4cout << "Choice not recognised (on/off)." << endl;
const G4ViewParameters& getVP = fpVMan -> GetCurrentViewParameters ();
@@ -406,8 +406,8 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
istrstream is ((char*)t); is >> choice >> x >> y >> z >> unit
>> nx >> ny >> nz;
G4int iSelector = -1;
if (choice.compareTo ("off",RWCString::ignoreCase) == 0) iSelector = 0;
if (choice.compareTo ("on",RWCString::ignoreCase) == 0) iSelector = 1;
if (choice.compareTo ("off",G4String::ignoreCase) == 0) iSelector = 0;
if (choice.compareTo ("on",G4String::ignoreCase) == 0) iSelector = 1;
if (iSelector < 0) {
G4cout << "Choice not recognised (on/off)." << endl;
const G4ViewParameters& getVP = fpVMan -> GetCurrentViewParameters ();
@@ -631,7 +631,7 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
/////////////////////////////////////////// /vis~/set/view /////////
if (commandPath == "/vis~/set/view") {
// Make List of available views.
RWTPtrOrderedVector<G4VViewer> vList;
G4RWTPtrOrderedVector<G4VViewer> vList;
const G4SceneHandlerList& gml = fpVMan -> GetAvailableSceneHandlers ();
G4int nViewTotal = 0;
G4int iGM, nScenes = gml.entries ();
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManMessenger.cc,v 1.2 1999/01/09 16:31:32 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VisManMessenger.cc,v 1.2.8.1 1999/12/07 20:54:03 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// GEANT4 Visualization Manager Messenger - John Allison 22nd July 1996.
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManager.cc,v 1.7 1999/05/12 13:59:23 barrand Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VisManager.cc,v 1.12.2.1 1999/12/07 20:54:03 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// GEANT4 Visualization Manager - John Allison 02/Jan/1996.
@@ -14,13 +14,12 @@
#include "G4VisManager.hh"
#include "G4UImanager.hh"
#include "G4StateManager.hh"
#include "G4VisStateDependent.hh"
#include "G4UIdirectory.hh"
#include "G4VisFeaturesOfFukuiRenderer.hh"
#include "G4VisFeaturesOfDAWNFILE.hh"
#include "G4VisFeaturesOfOpenGL.hh"
#include "G4VisFeaturesOfOpenInventor.hh"
#include "G4VisFeaturesOfRay.hh"
#include "G4VGraphicsSystem.hh"
#include "G4VSceneHandler.hh"
#include "G4VViewer.hh"
@@ -58,8 +57,12 @@ G4VisManager::G4VisManager ():
("G4VisManager: attempt to Construct more than one VisManager.");
}
else {
fpInstance = this;
fpStateDependent = new G4VisStateDependent (this);
// No need to delete this; G4StateManager does this.
G4cout << "Constructing Visualization Manager...." << endl;
// Note: You might think that we could register graphics systems
// and messengers here but we have to give the subclass time to
@@ -119,9 +122,6 @@ void G4VisManager::Initialise () {
#ifdef G4VIS_BUILD_OIWIN32_DRIVER
"\n G4VIS_USE_OIWIN32"
#endif
#ifdef G4VIS_BUILD_RAYX_DRIVER
"\n G4VIS_USE_RAYX"
#endif
#ifdef G4VIS_BUILD_VRML_DRIVER
"\n G4VIS_USE_VRML"
#endif
@@ -425,28 +425,6 @@ void G4VisManager::Draw (const G4VPhysicalVolume& physicalVol,
Draw (*pSol, attribs, objectTransform);
}
G4bool G4VisManager::Notify (G4ApplicationState requestedState) {
G4StateManager* stateManager = G4StateManager::GetStateManager ();
if(stateManager -> GetPreviousState () == EventProc &&
requestedState == GeomClosed) {
if (fpConcreteInstance && IsValidView ()) {
G4ModelingParameters* pMP =
fpSceneHandler -> CreateModelingParameters ();
const RWTPtrOrderedVector <G4VModel>& EOEModelList =
fpScene -> GetEndOfEventModelList ();
fpSceneHandler->ClearTransientStore(); //GB
for (int i = 0; i < EOEModelList.entries (); i++) {
G4VModel* pModel = EOEModelList [i];
pModel -> SetModelingParameters (pMP);
pModel -> DescribeYourselfTo (*fpSceneHandler);
pModel -> SetModelingParameters (0);
}
delete pMP;
}
}
return true;
}
void G4VisManager::CreateSceneHandler (G4String name) {
if (!fInitialised) Initialise ();
if (fpGraphicsSystem) {
@@ -610,7 +588,7 @@ void G4VisManager::GeometryHasChanged () {
G4int iScene, nScenes = sceneList.entries ();
for (iScene = 0; iScene < nScenes; iScene++) {
G4Scene* pScene = sceneList [iScene];
RWTPtrOrderedVector <G4VModel>& modelList =
G4RWTPtrOrderedVector <G4VModel>& modelList =
pScene -> SetRunDurationModelList ();
G4int nModels, iModel;
@@ -673,35 +651,39 @@ void G4VisManager::SetCurrentGraphicsSystem (G4VGraphicsSystem* pSystem) {
fpGraphicsSystem = pSystem;
G4cout << "G4VisManager::SetCurrentGraphicsSystem: system now "
<< pSystem -> GetName ();
const G4SceneHandlerList& sceneHandlerList = fAvailableSceneHandlers;
G4int nSH = sceneHandlerList.entries (); // No. of scene handlers.
G4int iSH;
for (iSH = 0; iSH < nSH; iSH++) {
if (sceneHandlerList [iSH] -> GetGraphicsSystem () == pSystem) break;
}
if (iSH < nSH) {
fpSceneHandler = sceneHandlerList [iSH];
G4cout << "\n Scene Handler now "
<< fpSceneHandler -> GetName ();
const G4ViewerList& viewerList = fpSceneHandler -> GetViewerList ();
if (viewerList.entries ()) {
fpViewer = viewerList [0];
G4cout << "\n Viewer now " << fpViewer -> GetName ();
IsValidView (); // Checks.
// If current scene handler is of same graphics system, leave unchanged.
// Else find the most recent scene handler of same graphics system.
// Or clear pointers.
if (!(fpSceneHandler && fpSceneHandler -> GetGraphicsSystem () == pSystem)) {
const G4SceneHandlerList& sceneHandlerList = fAvailableSceneHandlers;
G4int nSH = sceneHandlerList.entries (); // No. of scene handlers.
G4int iSH;
for (iSH = nSH - 1; iSH >= 0; iSH--) {
if (sceneHandlerList [iSH] -> GetGraphicsSystem () == pSystem) break;
}
if (iSH >= nSH) {
fpSceneHandler = sceneHandlerList [iSH];
G4cout << "\n Scene Handler now "
<< fpSceneHandler -> GetName ();
const G4ViewerList& viewerList = fpSceneHandler -> GetViewerList ();
if (viewerList.entries ()) {
fpViewer = viewerList [0];
G4cout << "\n Viewer now " << fpViewer -> GetName ();
}
else {
fpViewer = 0;
// Make it impossible for user action code to Draw.
fpConcreteInstance = 0;
}
}
else {
fpSceneHandler = 0;
fpViewer = 0;
// Make it impossible for user action code to Draw.
fpConcreteInstance = 0;
fpConcreteInstance = 0;
}
}
else {
fpSceneHandler = 0;
fpViewer = 0;
// Make it impossible for user action code to Draw.
fpConcreteInstance = 0;
}
G4cout << endl;
G4cout << endl;
}
void G4VisManager::SetCurrentSceneHandler (G4VSceneHandler* pSceneHandler) {
@@ -813,8 +795,6 @@ void G4VisManager::PrintAllGraphicsSystems () const {
<< G4VisFeaturesOfOpenGLSXm ()
<< "\n\n Open Inventor"
<< G4VisFeaturesOfOpenInventor ()
<< "\n\n G4RayX (ray tracing on X Windows)\n"
<< G4VisFeaturesOfRayX ()
<< "\n\n VRML1 (produces VRML 1 file over network)"
<< "\n\n VRML1File (produces VRML 1 file locally )"
<< "\n\n VRML2 (produces VRML 2 file over network), in preparation"
@@ -848,9 +828,6 @@ void G4VisManager::PrintInstalledGraphicsSystems () const {
#ifdef G4VIS_BUILD_OIWIN32_DRIVER
<< "\n Open Inventor Win32"
#endif
#ifdef G4VIS_BUILD_RAYX_DRIVER
<< "\n G4RayX (ray tracing on X Windows)"
#endif
#ifdef G4VIS_BUILD_VRML_DRIVER
<< "\n VRML1 (produces VRML 1 file over network)"
<< "\n VRML2 (produces VRML 2 file over network), in preparation"
@@ -903,6 +880,23 @@ void G4VisManager::RefreshCurrentView () { // Soft clear, then redraw.
}
}
void G4VisManager::EndOfEvent () {
if (fpConcreteInstance && IsValidView ()) {
G4ModelingParameters* pMP =
fpSceneHandler -> CreateModelingParameters ();
const G4RWTPtrOrderedVector <G4VModel>& EOEModelList =
fpScene -> GetEndOfEventModelList ();
fpSceneHandler->ClearTransientStore(); //GB
for (int i = 0; i < EOEModelList.entries (); i++) {
G4VModel* pModel = EOEModelList [i];
pModel -> SetModelingParameters (pMP);
pModel -> DescribeYourselfTo (*fpSceneHandler);
pModel -> SetModelingParameters (0);
}
delete pMP;
}
}
G4bool G4VisManager::IsValidView () {
if (!fInitialised) Initialise ();
@@ -925,14 +919,24 @@ G4bool G4VisManager::IsValidView () {
if (fpScene != fpSceneHandler -> GetScene ()) {
G4cout << "G4VisManager::IsValidView ():";
if (fpSceneHandler -> GetScene ()) {
G4cout << "\n Pointers of current scene \""
G4cout <<
"\n The current scene \""
<< fpScene -> GetName ()
<< "\" and scene \""
<< fpSceneHandler -> GetScene () -> GetName ()
<< "\" of current scene handler \""
<< "\" is not handled by"
"\n the current scene handler \""
<< fpSceneHandler -> GetName ()
<< "\" do not correspond."
"\n This shouldn't happen. Please report circumstances."
<< "\""
"\n (it currently handles scene \""
<< fpSceneHandler -> GetScene () -> GetName ()
<< "\")."
"\n Either:"
"\n (a) attach it to the scene handler with"
"\n /vis/sceneHandler/attach "
<< fpScene -> GetName ()
<< ", or"
"\n (b) create a new scene handler with "
"\n /vis/sceneHandler/create <graphics-system>,"
"\n in which case it should pick up the the new scene."
<< endl;
}
else {
@@ -945,6 +949,15 @@ G4bool G4VisManager::IsValidView () {
return false;
}
const G4ViewerList& viewerList = fpSceneHandler -> GetViewerList ();
if (viewerList.entries () == 0) {
G4cout << "G4VisManager::IsValidView (): the current scene handler\n \""
<< fpSceneHandler -> GetName ()
<< "\" has no viewers. Do /vis/viewer/create."
<< endl;
return false;
}
fpConcreteInstance = this; // Unless we find another problem, users can use!
G4bool isValid = true;
if (fpScene -> IsEmpty ()) {
@@ -1089,19 +1102,6 @@ G4OpenInventorWin32::G4OpenInventorWin32 ():
#endif
#ifndef G4VIS_BUILD_RAYX_DRIVER
class G4RayX: public G4VGraphicsSystem {
public:
G4RayX ();
};
G4RayX::G4RayX ():
G4VGraphicsSystem ("G4RayX",
"RayX",
G4VGraphicsSystem::noFunctionality) {}
#endif
#ifndef G4VIS_BUILD_VRML_DRIVER
class G4VRML1: public G4VGraphicsSystem {
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManagerRegisterMessengers.cc,v 1.6 1999/05/25 09:14:21 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VisManagerRegisterMessengers.cc,v 1.8.4.1 1999/12/07 20:54:03 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// G4VisManager::RegisterMessengers - John Allison 30/July/1998.
@@ -64,10 +64,11 @@ manages a list of scenes.
/vis/scene/select [<scene-name>]
* /vis/scene/edit
/vis/scene/remove <scene-name>
/vis/scene/add/volume [<physical-volume-name>] [<copy-no>] [<depth>]
/vis/scene/add/ghosts [<particle>]
* /vis/scene/add/ghost [<particle>] [<physical-volume-name>]
[<copy-no>] [<depth>]
* [<copy-no>] [<depth>]
/vis/scene/add/logicalVolume <logical-volume-name> [<depth>]
/vis/scene/add/volume [<physical-volume-name>] [<copy-no>] [<depth>]
/vis/scene/include/hits [<sensitive-volume-name>] (argument not impl'd yet.)
/vis/scene/include/trajectories [<sensitive-volume-name>] (do.)
* /vis/scene/include/transientObjects
@@ -92,7 +93,7 @@ The commands would look something like:
/vis/sceneHandler/select [<scene-handler-name>]
/vis/sceneHandler/remove <scene-handler-name>
* /vis/sceneHandler/processScene
* /vis/sceneHandler/notifyEndOfProcessiing
* /vis/sceneHandler/notifyEndOfProcessing
Viewers
@@ -111,7 +112,7 @@ clicks, spawn other windows, change viewpoint, etc.).
* /vis/viewer/set/notifyOption immediate|delayed
* /vis/viewer/notifyHandler
* /vis/viewer/clone
* /vis/viewer/update
/vis/viewer/update [<viewer-name>]
Global Commands
@@ -139,8 +140,7 @@ and
would be
/vis/scene/add/volume $1
/vis/sceneHandler/processScene
/vis/sceneHandler/notifyEndOfProcessiing
/vis/scene/notifyHandlers
/vis/viewer/update
or some such.
@@ -179,6 +179,7 @@ or some such.
command = new G4UIdirectory ("/vis/scene/");
command -> SetGuidance ("Operations on Geant4 scenes.");
fMessengerList.append (new G4VisCommandSceneCreate);
// fMessengerList.append (new G4VisCommandSceneEdit);
fMessengerList.append (new G4VisCommandSceneList);
fMessengerList.append (new G4VisCommandSceneNotifyHandlers);
fMessengerList.append (new G4VisCommandSceneSelect);
@@ -187,6 +188,7 @@ or some such.
command -> SetGuidance ("Add model to current scene.");
fMessengerList.append (new G4VisCommandSceneAddVolume);
fMessengerList.append (new G4VisCommandSceneAddGhosts);
fMessengerList.append (new G4VisCommandSceneAddLogicalVolume);
command = new G4UIdirectory ("/vis/scene/include/");
command -> SetGuidance ("Include drawing option in current scene.");
fMessengerList.append (new G4VisCommandSceneIncludeHits);
@@ -204,6 +206,7 @@ or some such.
fMessengerList.append (new G4VisCommandViewerList);
fMessengerList.append (new G4VisCommandViewerSelect);
fMessengerList.append (new G4VisCommandViewerRemove);
fMessengerList.append (new G4VisCommandViewerUpdate);
// Camera - OLD STYLE!!
fMessengerList.append
@@ -0,0 +1,26 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisStateDependent.cc,v 1.1.2.1 1999/12/07 20:54:03 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
#include "G4VisStateDependent.hh"
#include "G4VisManager.hh"
#include "G4StateManager.hh"
G4VisStateDependent::G4VisStateDependent (G4VisManager* pVisManager):
fpVisManager (pVisManager) {}
G4bool G4VisStateDependent::Notify (G4ApplicationState requestedState) {
G4StateManager* stateManager = G4StateManager::GetStateManager ();
if(stateManager -> GetPreviousState () == EventProc &&
requestedState == GeomClosed) {
fpVisManager -> EndOfEvent ();
}
return true;
}
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisToOldVisCommands.cc,v 1.3 1999/06/19 16:29:01 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VisToOldVisCommands.cc,v 1.3.8.1 1999/12/07 20:54:03 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// Implements some /vis/ commands as /vis~/ temporarily.