Import Geant4 4.0.0 source tree
This commit is contained in:
@@ -21,16 +21,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VRML2FileSceneHandler.cc,v 1.4.4.1 2001/06/28 19:16:04 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: G4VRML2FileSceneHandler.cc,v 1.7 2001/09/18 07:53:16 stanaka Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
// G4VRML2FileSceneHandler.cc
|
||||
// Satoshi Tanaka & Yasuhide Sawada
|
||||
|
||||
//=================//
|
||||
#ifdef G4VIS_BUILD_VRMLFILE_DRIVER
|
||||
//=================//
|
||||
|
||||
|
||||
//#define DEBUG_FR_SCENE
|
||||
|
||||
@@ -68,6 +64,7 @@ const char DEFAULT_WRL_FILE_NAME[] = "g4.wrl";
|
||||
const char ENV_VRML_VIEWER [] = "G4VRMLFILE_VIEWER";
|
||||
const char NO_VRML_VIEWER [] = "NONE";
|
||||
const char VRMLFILE_DEST_DIR [] = "G4VRMLFILE_DEST_DIR";
|
||||
const int DEFAULT_MAX_WRL_FILE_NUM = 100 ;
|
||||
|
||||
|
||||
G4VRML2FileSceneHandler::G4VRML2FileSceneHandler(G4VRML2File& system, const G4String& name) :
|
||||
@@ -91,15 +88,15 @@ G4VRML2FileSceneHandler::G4VRML2FileSceneHandler(G4VRML2File& system, const G4St
|
||||
|
||||
|
||||
// maximum number of g4.prim files in the dest directory
|
||||
fMaxFileNum = 1 ; // initialization
|
||||
fMaxFileNum = DEFAULT_MAX_WRL_FILE_NUM ; // initialization
|
||||
if ( getenv( "G4VRMLFILE_MAX_FILE_NUM" ) != NULL ) {
|
||||
|
||||
sscanf( getenv("G4VRMLFILE_MAX_FILE_NUM"), "%d", &fMaxFileNum ) ;
|
||||
|
||||
} else {
|
||||
fMaxFileNum = 1 ;
|
||||
fMaxFileNum = DEFAULT_MAX_WRL_FILE_NUM ;
|
||||
}
|
||||
if( fMaxFileNum < 1 ) { fMaxFileNum = 1 ; }
|
||||
if( fMaxFileNum < 1 ) { fMaxFileNum = 1; }
|
||||
|
||||
|
||||
// PV name pickability
|
||||
@@ -126,16 +123,16 @@ G4VRML2FileSceneHandler::~G4VRML2FileSceneHandler()
|
||||
}
|
||||
|
||||
|
||||
#define G4VRML2SCENE G4VRML2FileSceneHandler
|
||||
#define G4VRML2SCENEHANDLER G4VRML2FileSceneHandler
|
||||
#define IS_CONNECTED this->isConnected()
|
||||
#include "G4VRML2SceneHandlerFunc.icc"
|
||||
#undef IS_CONNECTED
|
||||
#undef G4VRML2SCENE
|
||||
#undef G4VRML2SCENEHANDLER
|
||||
|
||||
|
||||
void G4VRML2FileSceneHandler::connectPort()
|
||||
{
|
||||
// g4.wrl, g4_1.wrl, ..., g4_MAX_FILE_INDEX.wrl
|
||||
// g4_00.wrl, g4_01.wrl, ..., g4_MAX_FILE_INDEX.wrl
|
||||
const int MAX_FILE_INDEX = fMaxFileNum - 1 ;
|
||||
|
||||
// dest directory (null if no environmental variables is set)
|
||||
@@ -147,20 +144,23 @@ void G4VRML2FileSceneHandler::connectPort()
|
||||
// Determine VRML file name
|
||||
for( int i = 0 ; i < fMaxFileNum ; i++) {
|
||||
|
||||
// Message
|
||||
if( fMaxFileNum > 1 && i == MAX_FILE_INDEX ) {
|
||||
// Message in the final execution
|
||||
if( i == MAX_FILE_INDEX )
|
||||
{
|
||||
G4cerr << "===========================================" << G4endl;
|
||||
G4cerr << "WARNING MESSAGE from VRML2FILE driver: " << G4endl;
|
||||
G4cerr << "WARNING MESSAGE from VRML2FILE driver: " << G4endl;
|
||||
G4cerr << " This file name is the final one in the " << G4endl;
|
||||
G4cerr << " automatic updation of the output file name." << G4endl;
|
||||
G4cerr << " You may overwrite an existing file of " << G4endl;
|
||||
G4cerr << " the same name. " << G4endl;
|
||||
G4cerr << " You may overwrite existing files, i.e. " << G4endl;
|
||||
G4cerr << " g4_XX.wrl. " << G4endl;
|
||||
G4cerr << "===========================================" << G4endl;
|
||||
}
|
||||
|
||||
// re-determine file to G4VRMLFILE_DEST_DIR/g4_i.wrl for i>0
|
||||
if( i > 0 ) {
|
||||
sprintf( fVRMLFileName, "%s%s%d.wrl" , fVRMLFileDestDir, WRL_FILE_HEADER, i );
|
||||
// re-determine file name as G4VRMLFILE_DEST_DIR/g4_XX.wrl
|
||||
if( i >= 0 && i <= 9 ) {
|
||||
sprintf( fVRMLFileName, "%s%s%s%d.wrl" , fVRMLFileDestDir, WRL_FILE_HEADER, "0", i );
|
||||
} else {
|
||||
sprintf( fVRMLFileName, "%s%s%d.wrl" , fVRMLFileDestDir, WRL_FILE_HEADER, i );
|
||||
}
|
||||
|
||||
// check validity of the file name
|
||||
@@ -168,7 +168,7 @@ void G4VRML2FileSceneHandler::connectPort()
|
||||
fin.open(fVRMLFileName) ;
|
||||
if(!fin) {
|
||||
// new file
|
||||
fin.close(); // error recovery
|
||||
fin.close();
|
||||
break;
|
||||
} else {
|
||||
// already exists (try next)
|
||||
@@ -219,5 +219,3 @@ void G4VRML2FileSceneHandler::closePort()
|
||||
|
||||
G4int G4VRML2FileSceneHandler::fSceneIdCount = 0;
|
||||
G4int G4VRML2FileSceneHandler::fSceneCount = 0;
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user