80 fFlagDestOpen( false )
83 strcpy(fVRMLFileName,
"");
86 strcpy( fVRMLFileDestDir,
"" );
93 if ( getenv(
"G4VRMLFILE_MAX_FILE_NUM" ) != NULL ) {
95 sscanf( getenv(
"G4VRMLFILE_MAX_FILE_NUM"),
"%d", &fMaxFileNum ) ;
100 if( fMaxFileNum < 1 ) { fMaxFileNum = 1; }
107 #if defined DEBUG_FR_SCENE
115 #define G4VRML1SCENEHANDLER G4VRML1FileSceneHandler
116 #define IS_CONNECTED this->isConnected()
117 #include "G4VRML1SceneHandlerFunc.icc"
119 #undef G4VRML1SCENEHANDLER
125 const int MAX_FILE_INDEX = fMaxFileNum - 1 ;
128 strcpy ( fVRMLFileName, fVRMLFileDestDir) ;
134 for(
int i = 0 ; i < fMaxFileNum ; i++) {
137 if( i == MAX_FILE_INDEX )
140 G4cout <<
"===========================================" <<
G4endl;
141 G4cout <<
"WARNING MESSAGE from VRML1FILE driver: " <<
G4endl;
142 G4cout <<
" This file name is the final one in the " <<
G4endl;
143 G4cout <<
" automatic updation of the output file name." <<
G4endl;
144 G4cout <<
" You may overwrite existing files, i.e. " <<
G4endl;
146 G4cout <<
"===========================================" <<
G4endl;
151 std::ostringstream filename;
154 << std::setw(2) << std::setfill(
'0') << i <<
".wrl";
155 strncpy(fVRMLFileName,filename.str().c_str(),
sizeof(fVRMLFileName));
159 fin.open(fVRMLFileName) ;
174 G4cout <<
"===========================================" <<
G4endl;
175 G4cout <<
"Output VRML 1.0 file: " << fVRMLFileName <<
G4endl;
176 G4cout <<
"Maximum number of files in the destination directory: " << fMaxFileNum <<
G4endl;
177 G4cout <<
" (Customizable with the environment variable: G4VRMLFILE_MAX_FILE_NUM) " <<
G4endl;
178 G4cout <<
"===========================================" <<
G4endl;
180 fDest.open(fVRMLFileName) ; fFlagDestOpen = true ;
194 fDest.close(); fFlagDestOpen = false ;
196 G4cout <<
"*** VRML 1.0 File " << fVRMLFileName <<
" is generated." <<
G4endl;
204 G4cout <<
" Set an environmental variable " ;
206 G4cout <<
" if you want to visualize the generated VRML file" <<
G4endl;
211 std::ostringstream ossCommand;
212 ossCommand << viewer <<
' ' << fVRMLFileName;
213 strncpy(command,ossCommand.str().c_str(),
sizeof(command));
214 (
void) system( command );
218 G4int G4VRML1FileSceneHandler::fSceneIdCount = 0;
G4VRML1FileSceneHandler(G4VRML1File &system, const G4String &name="")
const int DEFAULT_MAX_WRL_FILE_NUM
const char ENV_VRML_VIEWER[]
const char VRMLFILE_DEST_DIR[]
G4GLOB_DLL std::ostream G4cout
const char NO_VRML_VIEWER[]
static Verbosity GetVerbosity()
const char WRL_FILE_HEADER[]
typedef void(XMLCALL *XML_ElementDeclHandler)(void *userData
virtual ~G4VRML1FileSceneHandler()
const char DEFAULT_WRL_FILE_NAME[]