#include <G4VRML1FileSceneHandler.hh>
Inheritance diagram for G4VRML1FileSceneHandler:
Definition at line 45 of file G4VRML1FileSceneHandler.hh.
G4VRML1FileSceneHandler::G4VRML1FileSceneHandler | ( | G4VRML1File & | system, | |
const G4String & | name = "" | |||
) |
Definition at line 74 of file G4VRML1FileSceneHandler.cc.
References DEFAULT_MAX_WRL_FILE_NUM, and VRMLFILE_DEST_DIR.
00074 : 00075 G4VSceneHandler(system, fSceneIdCount++, name), 00076 fSystem(system), 00077 fDest() , 00078 fFlagDestOpen( false ) 00079 { 00080 fCurrentDEF = ""; 00081 strcpy(fVRMLFileName, ""); 00082 00083 if ( getenv( VRMLFILE_DEST_DIR ) == NULL ) { 00084 strcpy( fVRMLFileDestDir, "" ); 00085 } else { 00086 strcpy( fVRMLFileDestDir, getenv( VRMLFILE_DEST_DIR ) ); 00087 } 00088 00089 // maximum number of g4.wrl files in the dest directory 00090 fMaxFileNum = DEFAULT_MAX_WRL_FILE_NUM ; // initialization 00091 if ( getenv( "G4VRMLFILE_MAX_FILE_NUM" ) != NULL ) { 00092 00093 sscanf( getenv("G4VRMLFILE_MAX_FILE_NUM"), "%d", &fMaxFileNum ) ; 00094 00095 } else { 00096 fMaxFileNum = DEFAULT_MAX_WRL_FILE_NUM ; 00097 } 00098 if( fMaxFileNum < 1 ) { fMaxFileNum = 1; } 00099 00100 }
G4VRML1FileSceneHandler::~G4VRML1FileSceneHandler | ( | ) | [virtual] |
Definition at line 103 of file G4VRML1FileSceneHandler.cc.
References G4VisManager::errors, G4cout, G4endl, G4VisManager::GetVerbosity(), and VRMLEndModeling().
00104 { 00105 #if defined DEBUG_FR_SCENE 00106 if (G4VisManager::GetVerbosity() >= G4VisManager::errors) 00107 G4cout << "***** ~G4VRML1FileSceneHandler" << G4endl; 00108 #endif 00109 VRMLEndModeling(); 00110 }
void G4VRML1FileSceneHandler::AddCompound | ( | const G4THitsMap< G4double > & | hits | ) | [inline, virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 77 of file G4VRML1FileSceneHandler.hh.
References G4VSceneHandler::AddCompound().
00077 { 00078 G4VSceneHandler::AddCompound(hits); 00079 }
void G4VRML1FileSceneHandler::AddCompound | ( | const G4VDigi & | digi | ) | [inline, virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 74 of file G4VRML1FileSceneHandler.hh.
References G4VSceneHandler::AddCompound().
00074 { 00075 G4VSceneHandler::AddCompound(digi); 00076 }
void G4VRML1FileSceneHandler::AddCompound | ( | const G4VHit & | hit | ) | [inline, virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 71 of file G4VRML1FileSceneHandler.hh.
References G4VSceneHandler::AddCompound().
00071 { 00072 G4VSceneHandler::AddCompound(hit); 00073 }
void G4VRML1FileSceneHandler::AddCompound | ( | const G4VTrajectory & | traj | ) | [inline, virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 68 of file G4VRML1FileSceneHandler.hh.
References G4VSceneHandler::AddCompound().
00068 { 00069 G4VSceneHandler::AddCompound(traj); 00070 }
void G4VRML1FileSceneHandler::AddPrimitive | ( | const G4Scale & | scale | ) | [inline, virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 92 of file G4VRML1FileSceneHandler.hh.
References G4VSceneHandler::AddPrimitive().
00093 { G4VSceneHandler::AddPrimitive (scale); }
void G4VRML1FileSceneHandler::AddPrimitive | ( | const G4Polymarker & | polymarker | ) | [inline, virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 90 of file G4VRML1FileSceneHandler.hh.
References G4VSceneHandler::AddPrimitive().
00091 { G4VSceneHandler::AddPrimitive (polymarker); }
void G4VRML1FileSceneHandler::AddPrimitive | ( | const G4Square & | ) | [virtual] |
Implements G4VSceneHandler.
void G4VRML1FileSceneHandler::AddPrimitive | ( | const G4Circle & | ) | [virtual] |
Implements G4VSceneHandler.
void G4VRML1FileSceneHandler::AddPrimitive | ( | const G4Text & | ) | [virtual] |
Implements G4VSceneHandler.
void G4VRML1FileSceneHandler::AddPrimitive | ( | const G4NURBS & | ) | [virtual] |
Implements G4VSceneHandler.
void G4VRML1FileSceneHandler::AddPrimitive | ( | const G4Polyhedron & | ) | [virtual] |
Implements G4VSceneHandler.
void G4VRML1FileSceneHandler::AddPrimitive | ( | const G4Polyline & | ) | [virtual] |
Implements G4VSceneHandler.
void G4VRML1FileSceneHandler::AddSolid | ( | const G4VSolid & | ) | [virtual] |
Reimplemented from G4VSceneHandler.
void G4VRML1FileSceneHandler::AddSolid | ( | const G4Polyhedra & | polyhedra | ) | [inline, virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 64 of file G4VRML1FileSceneHandler.hh.
References G4VSceneHandler::AddSolid().
00064 { 00065 G4VSceneHandler::AddSolid (polyhedra); 00066 }
void G4VRML1FileSceneHandler::AddSolid | ( | const G4Polycone & | polycone | ) | [inline, virtual] |
Reimplemented from G4VSceneHandler.
Definition at line 61 of file G4VRML1FileSceneHandler.hh.
References G4VSceneHandler::AddSolid().
00061 { 00062 G4VSceneHandler::AddSolid (polycone); 00063 }
void G4VRML1FileSceneHandler::AddSolid | ( | const G4Torus & | ) | [virtual] |
Reimplemented from G4VSceneHandler.
void G4VRML1FileSceneHandler::AddSolid | ( | const G4Para & | ) | [virtual] |
Reimplemented from G4VSceneHandler.
void G4VRML1FileSceneHandler::AddSolid | ( | const G4Sphere & | ) | [virtual] |
Reimplemented from G4VSceneHandler.
void G4VRML1FileSceneHandler::AddSolid | ( | const G4Trap & | ) | [virtual] |
Reimplemented from G4VSceneHandler.
void G4VRML1FileSceneHandler::AddSolid | ( | const G4Trd & | ) | [virtual] |
Reimplemented from G4VSceneHandler.
void G4VRML1FileSceneHandler::AddSolid | ( | const G4Tubs & | ) | [virtual] |
Reimplemented from G4VSceneHandler.
void G4VRML1FileSceneHandler::AddSolid | ( | const G4Cons & | ) | [virtual] |
Reimplemented from G4VSceneHandler.
void G4VRML1FileSceneHandler::AddSolid | ( | const G4Box & | ) | [virtual] |
Reimplemented from G4VSceneHandler.
void G4VRML1FileSceneHandler::BeginModeling | ( | ) | [virtual] |
Reimplemented from G4VSceneHandler.
void G4VRML1FileSceneHandler::BeginPrimitives | ( | const G4Transform3D & | objectTransformation | ) | [virtual] |
Reimplemented from G4VSceneHandler.
void G4VRML1FileSceneHandler::ClearTransientStore | ( | ) | [virtual] |
Reimplemented from G4VSceneHandler.
void G4VRML1FileSceneHandler::closePort | ( | ) |
Definition at line 182 of file G4VRML1FileSceneHandler.cc.
References ENV_VRML_VIEWER, G4VisManager::errors, G4cout, G4endl, G4VisManager::GetVerbosity(), and NO_VRML_VIEWER.
00183 { 00184 char command[256] ; 00185 char viewer [256] ; 00186 strcpy( viewer, NO_VRML_VIEWER ); // initialization 00187 if( getenv( ENV_VRML_VIEWER ) ) { 00188 strcpy( viewer, getenv( ENV_VRML_VIEWER ) ) ; 00189 } 00190 00191 // close VRML file 00192 fDest.close(); fFlagDestOpen = false ; 00193 if (G4VisManager::GetVerbosity() >= G4VisManager::errors) 00194 G4cout << "*** VRML 1.0 File " << fVRMLFileName << " is generated." << G4endl; 00195 00196 00197 // Invoke viewer 00198 00199 if ( !strcmp(viewer, NO_VRML_VIEWER )) { 00200 if (G4VisManager::GetVerbosity() >= G4VisManager::errors) { 00201 G4cout << "MESSAGE from VRML1FILE driver:" << G4endl; 00202 G4cout << " Set an environmental variable " ; 00203 G4cout << ENV_VRML_VIEWER << G4endl; 00204 G4cout << " if you want to visualize the generated VRML file" << G4endl; 00205 G4cout << " automatically. For example, " << G4endl; 00206 G4cout << " setenv " << ENV_VRML_VIEWER << " vrweb " << G4endl; 00207 } 00208 } else { 00209 sprintf( command, "%s %s", viewer, fVRMLFileName ); 00210 (void) system( command ); 00211 } 00212 }
void G4VRML1FileSceneHandler::connectPort | ( | ) |
Definition at line 120 of file G4VRML1FileSceneHandler.cc.
References DEFAULT_WRL_FILE_NAME, G4VisManager::errors, G4cout, G4endl, G4VisManager::GetVerbosity(), and WRL_FILE_HEADER.
00121 { 00122 // g4_00.wrl, g4_01.wrl, ..., g4_MAX_FILE_INDEX.wrl 00123 const int MAX_FILE_INDEX = fMaxFileNum - 1 ; 00124 00125 // dest directory (null if no environmental variables is set) 00126 strcpy ( fVRMLFileName, fVRMLFileDestDir) ; 00127 00128 // create (full) path name (default) 00129 strcat ( fVRMLFileName, DEFAULT_WRL_FILE_NAME ); 00130 00131 // Determine VRML file name 00132 for( int i = 0 ; i < fMaxFileNum ; i++) { 00133 00134 // Message in the final execution 00135 if( i == MAX_FILE_INDEX ) 00136 { 00137 if (G4VisManager::GetVerbosity() >= G4VisManager::errors) { 00138 G4cout << "===========================================" << G4endl; 00139 G4cout << "WARNING MESSAGE from VRML1FILE driver: " << G4endl; 00140 G4cout << " This file name is the final one in the " << G4endl; 00141 G4cout << " automatic updation of the output file name." << G4endl; 00142 G4cout << " You may overwrite existing files, i.e. " << G4endl; 00143 G4cout << " g4_XX.wrl. " << G4endl; 00144 G4cout << "===========================================" << G4endl; 00145 } 00146 } 00147 00148 // re-determine file name as G4VRMLFILE_DEST_DIR/g4_XX.wrl 00149 if( i >= 0 && i <= 9 ) { 00150 sprintf( fVRMLFileName, "%s%s%s%d.wrl" , fVRMLFileDestDir, WRL_FILE_HEADER, "0", i ); 00151 } else { 00152 sprintf( fVRMLFileName, "%s%s%d.wrl" , fVRMLFileDestDir, WRL_FILE_HEADER, i ); 00153 } 00154 00155 // check validity of the file name 00156 std::ifstream fin ; 00157 fin.open(fVRMLFileName) ; 00158 if(!fin) { 00159 // new file 00160 fin.close(); 00161 break; 00162 } else { 00163 // already exists (try next) 00164 fin.close(); 00165 } 00166 00167 00168 } // for 00169 00170 // open a VRML 1.0 file with determined file name 00171 if (G4VisManager::GetVerbosity() >= G4VisManager::errors) { 00172 G4cout << "===========================================" << G4endl; 00173 G4cout << "Output VRML 1.0 file: " << fVRMLFileName << G4endl; 00174 G4cout << "Maximum number of files in the destination directory: " << fMaxFileNum << G4endl; 00175 G4cout << " (Customizable with the environment variable: G4VRMLFILE_MAX_FILE_NUM) " << G4endl; 00176 G4cout << "===========================================" << G4endl; 00177 } 00178 fDest.open(fVRMLFileName) ; fFlagDestOpen = true ; 00179 }
void G4VRML1FileSceneHandler::EndModeling | ( | ) | [virtual] |
Reimplemented from G4VSceneHandler.
void G4VRML1FileSceneHandler::EndPrimitives | ( | ) | [virtual] |
Reimplemented from G4VSceneHandler.
void G4VRML1FileSceneHandler::VRMLBeginModeling | ( | ) |
Referenced by G4VRML1FileViewer::DrawView().
void G4VRML1FileSceneHandler::VRMLEndModeling | ( | ) |
Referenced by G4VRML1FileViewer::ShowView(), and ~G4VRML1FileSceneHandler().
friend class G4VRML1FileViewer [friend] |
Definition at line 47 of file G4VRML1FileSceneHandler.hh.