Import Geant4 1.0.0 source tree
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user