Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VRML2FileSceneHandler Class Reference

#include <G4VRML2FileSceneHandler.hh>

+ Inheritance diagram for G4VRML2FileSceneHandler:

Public Member Functions

 G4VRML2FileSceneHandler (G4VRML2File &system, const G4String &name="")
 
virtual ~G4VRML2FileSceneHandler ()
 
void AddSolid (const G4Box &)
 
void AddSolid (const G4Cons &)
 
void AddSolid (const G4Tubs &)
 
void AddSolid (const G4Trd &)
 
void AddSolid (const G4Trap &)
 
void AddSolid (const G4Sphere &)
 
void AddSolid (const G4Para &)
 
void AddSolid (const G4Torus &)
 
void AddSolid (const G4Polycone &polycone)
 
void AddSolid (const G4Polyhedra &polyhedra)
 
void AddSolid (const G4Orb &orb)
 
void AddSolid (const G4Ellipsoid &ellipsoid)
 
void AddSolid (const G4TessellatedSolid &tess)
 
void AddSolid (const G4VSolid &)
 
void AddCompound (const G4VTrajectory &traj)
 
void AddCompound (const G4VHit &hit)
 
void AddCompound (const G4VDigi &digi)
 
void AddCompound (const G4THitsMap< G4double > &hits)
 
void AddCompound (const G4THitsMap< G4StatDouble > &hits)
 
void BeginPrimitives (const G4Transform3D &objectTransformation)
 
void EndPrimitives ()
 
void AddPrimitive (const G4Polyline &)
 
void AddPrimitive (const G4Polyhedron &)
 
void AddPrimitive (const G4Text &)
 
void AddPrimitive (const G4Circle &)
 
void AddPrimitive (const G4Square &)
 
void AddPrimitive (const G4Polymarker &polymarker)
 
void AddPrimitive (const G4Scale &scale)
 
void ClearTransientStore ()
 
void BeginModeling ()
 
void EndModeling ()
 
void VRMLBeginModeling ()
 
void VRMLEndModeling ()
 
void connectPort ()
 
void closePort ()
 
- Public Member Functions inherited from G4VSceneHandler
 G4VSceneHandler (G4VGraphicsSystem &system, G4int id, const G4String &name="")
 
virtual ~G4VSceneHandler ()
 
virtual void PreAddSolid (const G4Transform3D &objectTransformation, const G4VisAttributes &)
 
virtual void PostAddSolid ()
 
virtual void AddSolid (const G4Box &)
 
virtual void AddSolid (const G4Cons &)
 
virtual void AddSolid (const G4Orb &)
 
virtual void AddSolid (const G4Para &)
 
virtual void AddSolid (const G4Sphere &)
 
virtual void AddSolid (const G4Torus &)
 
virtual void AddSolid (const G4Trap &)
 
virtual void AddSolid (const G4Trd &)
 
virtual void AddSolid (const G4Tubs &)
 
virtual void AddSolid (const G4Ellipsoid &)
 
virtual void AddSolid (const G4Polycone &)
 
virtual void AddSolid (const G4Polyhedra &)
 
virtual void AddSolid (const G4TessellatedSolid &)
 
virtual void AddSolid (const G4VSolid &)
 
virtual void AddCompound (const G4VTrajectory &)
 
virtual void AddCompound (const G4VHit &)
 
virtual void AddCompound (const G4VDigi &)
 
virtual void AddCompound (const G4THitsMap< G4double > &)
 
virtual void AddCompound (const G4THitsMap< G4StatDouble > &)
 
virtual void BeginModeling ()
 
virtual void EndModeling ()
 
virtual void BeginPrimitives (const G4Transform3D &objectTransformation=G4Transform3D())
 
virtual void EndPrimitives ()
 
virtual void BeginPrimitives2D (const G4Transform3D &objectTransformation=G4Transform3D())
 
virtual void EndPrimitives2D ()
 
virtual void AddPrimitive (const G4Polyline &)=0
 
virtual void AddPrimitive (const G4Scale &)
 
virtual void AddPrimitive (const G4Text &)=0
 
virtual void AddPrimitive (const G4Circle &)=0
 
virtual void AddPrimitive (const G4Square &)=0
 
virtual void AddPrimitive (const G4Polymarker &)
 
virtual void AddPrimitive (const G4Polyhedron &)=0
 
virtual const G4VisExtentGetExtent () const
 
const G4StringGetName () const
 
G4int GetSceneHandlerId () const
 
G4int GetViewCount () const
 
G4VGraphicsSystemGetGraphicsSystem () const
 
G4SceneGetScene () const
 
const G4ViewerListGetViewerList () const
 
G4VModelGetModel () const
 
G4VViewerGetCurrentViewer () const
 
G4bool GetMarkForClearingTransientStore () const
 
G4bool IsReadyForTransients () const
 
G4bool GetTransientsDrawnThisEvent () const
 
G4bool GetTransientsDrawnThisRun () const
 
const G4Transform3DGetObjectTransformation () const
 
void SetName (const G4String &)
 
void SetCurrentViewer (G4VViewer *)
 
virtual void SetScene (G4Scene *)
 
G4ViewerListSetViewerList ()
 
void SetModel (G4VModel *)
 
void SetMarkForClearingTransientStore (G4bool)
 
void SetTransientsDrawnThisEvent (G4bool)
 
void SetTransientsDrawnThisRun (G4bool)
 
void SetObjectTransformation (const G4Transform3D &)
 
const G4ColourGetColour ()
 
const G4ColourGetColor ()
 
const G4ColourGetTextColour (const G4Text &)
 
const G4ColourGetTextColor (const G4Text &)
 
G4double GetLineWidth (const G4VisAttributes *)
 
G4ViewParameters::DrawingStyle GetDrawingStyle (const G4VisAttributes *)
 
G4int GetNumberOfCloudPoints (const G4VisAttributes *) const
 
G4bool GetAuxEdgeVisible (const G4VisAttributes *)
 
G4int GetNoOfSides (const G4VisAttributes *)
 
G4double GetMarkerSize (const G4VMarker &, MarkerSizeType &)
 
G4double GetMarkerDiameter (const G4VMarker &, MarkerSizeType &)
 
G4double GetMarkerRadius (const G4VMarker &, MarkerSizeType &)
 
G4ModelingParametersCreateModelingParameters ()
 
void DrawEvent (const G4Event *)
 
void DrawEndOfRunModels ()
 
template<class T >
void AddSolidT (const T &solid)
 
template<class T >
void AddSolidWithAuxiliaryEdges (const T &solid)
 
G4int IncrementViewCount ()
 
virtual void ClearStore ()
 
virtual void ClearTransientStore ()
 
void AddViewerToList (G4VViewer *pView)
 
void RemoveViewerFromList (G4VViewer *pView)
 
- Public Member Functions inherited from G4VGraphicsScene
 G4VGraphicsScene ()
 
virtual ~G4VGraphicsScene ()
 
virtual void PreAddSolid (const G4Transform3D &objectTransformation, const G4VisAttributes &visAttribs)=0
 
virtual void PostAddSolid ()=0
 
virtual void AddSolid (const G4Box &)=0
 
virtual void AddSolid (const G4Cons &)=0
 
virtual void AddSolid (const G4Orb &)=0
 
virtual void AddSolid (const G4Para &)=0
 
virtual void AddSolid (const G4Sphere &)=0
 
virtual void AddSolid (const G4Torus &)=0
 
virtual void AddSolid (const G4Trap &)=0
 
virtual void AddSolid (const G4Trd &)=0
 
virtual void AddSolid (const G4Tubs &)=0
 
virtual void AddSolid (const G4Ellipsoid &)=0
 
virtual void AddSolid (const G4Polycone &)=0
 
virtual void AddSolid (const G4Polyhedra &)=0
 
virtual void AddSolid (const G4TessellatedSolid &)=0
 
virtual void AddSolid (const G4VSolid &)=0
 
virtual void AddCompound (const G4VTrajectory &)=0
 
virtual void AddCompound (const G4VHit &)=0
 
virtual void AddCompound (const G4VDigi &)=0
 
virtual void AddCompound (const G4THitsMap< G4double > &)=0
 
virtual void AddCompound (const G4THitsMap< G4StatDouble > &)=0
 
virtual void BeginPrimitives (const G4Transform3D &objectTransformation=G4Transform3D())=0
 
virtual void EndPrimitives ()=0
 
virtual void BeginPrimitives2D (const G4Transform3D &objectTransformation=G4Transform3D())=0
 
virtual void EndPrimitives2D ()=0
 
virtual void AddPrimitive (const G4Polyline &)=0
 
virtual void AddPrimitive (const G4Scale &)=0
 
virtual void AddPrimitive (const G4Text &)=0
 
virtual void AddPrimitive (const G4Circle &)=0
 
virtual void AddPrimitive (const G4Square &)=0
 
virtual void AddPrimitive (const G4Polymarker &)=0
 
virtual void AddPrimitive (const G4Polyhedron &)=0
 
virtual const G4VisExtentGetExtent () const
 

Public Attributes

std::ofstream fDest
 

Friends

class G4VRML2FileViewer
 

Additional Inherited Members

- Public Types inherited from G4VSceneHandler
enum  MarkerSizeType { world , screen }
 
- Protected Member Functions inherited from G4VSceneHandler
virtual void ProcessScene ()
 
virtual void RequestPrimitives (const G4VSolid &solid)
 
virtual G4DisplacedSolidCreateSectionSolid ()
 
virtual G4DisplacedSolidCreateCutawaySolid ()
 
void LoadAtts (const G4Visible &, G4AttHolder *)
 
- Protected Attributes inherited from G4VSceneHandler
G4VGraphicsSystemfSystem
 
const G4int fSceneHandlerId
 
G4String fName
 
G4int fViewCount
 
G4ViewerList fViewerList
 
G4VViewerfpViewer
 
G4ScenefpScene
 
G4bool fMarkForClearingTransientStore
 
G4bool fReadyForTransients
 
G4bool fTransientsDrawnThisEvent
 
G4bool fTransientsDrawnThisRun
 
G4bool fProcessingSolid
 
G4bool fProcessing2D
 
G4VModelfpModel
 
G4Transform3D fObjectTransformation
 
G4int fNestingDepth
 
const G4VisAttributesfpVisAttribs
 
const G4Transform3D fIdentityTransformation
 

Detailed Description

Definition at line 44 of file G4VRML2FileSceneHandler.hh.

Constructor & Destructor Documentation

◆ G4VRML2FileSceneHandler()

G4VRML2FileSceneHandler::G4VRML2FileSceneHandler ( G4VRML2File system,
const G4String name = "" 
)

Definition at line 74 of file G4VRML2FileSceneHandler.cc.

74 :
75 G4VSceneHandler(system, fSceneIdCount++, name),
76 fSystem(system),
77 fFlagDestOpen( false ),
78 fPVPickable ( false ),
79 fDest()
80{
81 // output file name
82 strcpy(fVRMLFileName, "");
83
84 // destination directory
85 if ( std::getenv( VRMLFILE_DEST_DIR ) == NULL ) {
86 strcpy( fVRMLFileDestDir, "" );
87 } else {
88 strcpy( fVRMLFileDestDir, std::getenv( VRMLFILE_DEST_DIR ) );
89 }
90
91
92 // maximum number of g4.prim files in the dest directory
93 fMaxFileNum = DEFAULT_MAX_WRL_FILE_NUM ; // initialization
94 if ( std::getenv( "G4VRMLFILE_MAX_FILE_NUM" ) != NULL ) {
95
96 sscanf( std::getenv("G4VRMLFILE_MAX_FILE_NUM"), "%d", &fMaxFileNum ) ;
97
98 } else {
99 fMaxFileNum = DEFAULT_MAX_WRL_FILE_NUM ;
100 }
101 if( fMaxFileNum < 1 ) { fMaxFileNum = 1; }
102
103
104 // PV name pickability
105 if( std::getenv( "G4VRML_PV_PICKABLE" ) != NULL ) {
106
107 int is_pickable ;
108 sscanf( std::getenv("G4VRML_PV_PICKABLE"), "%d", &is_pickable ) ;
109
110 if ( is_pickable ) { SetPVPickability ( true ) ; }
111 }
112
113 // PV Transparency
114 SetPVTransparency ();
115
116}
const int DEFAULT_MAX_WRL_FILE_NUM
const char VRMLFILE_DEST_DIR[]

◆ ~G4VRML2FileSceneHandler()

G4VRML2FileSceneHandler::~G4VRML2FileSceneHandler ( )
virtual

Definition at line 119 of file G4VRML2FileSceneHandler.cc.

120{
121#if defined DEBUG_FR_SCENE
123 G4cout << "***** ~G4VRML2FileSceneHandler" << G4endl;
124#endif
126}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static Verbosity GetVerbosity()

Member Function Documentation

◆ AddCompound() [1/5]

void G4VRML2FileSceneHandler::AddCompound ( const G4THitsMap< G4double > &  hits)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 85 of file G4VRML2FileSceneHandler.hh.

85 {
87 }
virtual void AddCompound(const G4VTrajectory &)

◆ AddCompound() [2/5]

void G4VRML2FileSceneHandler::AddCompound ( const G4THitsMap< G4StatDouble > &  hits)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 88 of file G4VRML2FileSceneHandler.hh.

88 {
90 }

◆ AddCompound() [3/5]

void G4VRML2FileSceneHandler::AddCompound ( const G4VDigi digi)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 82 of file G4VRML2FileSceneHandler.hh.

82 {
84 }

◆ AddCompound() [4/5]

void G4VRML2FileSceneHandler::AddCompound ( const G4VHit hit)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 79 of file G4VRML2FileSceneHandler.hh.

79 {
81 }

◆ AddCompound() [5/5]

void G4VRML2FileSceneHandler::AddCompound ( const G4VTrajectory traj)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 76 of file G4VRML2FileSceneHandler.hh.

76 {
78 }

◆ AddPrimitive() [1/7]

void G4VRML2FileSceneHandler::AddPrimitive ( const G4Circle )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [2/7]

void G4VRML2FileSceneHandler::AddPrimitive ( const G4Polyhedron )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [3/7]

void G4VRML2FileSceneHandler::AddPrimitive ( const G4Polyline )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [4/7]

void G4VRML2FileSceneHandler::AddPrimitive ( const G4Polymarker polymarker)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 100 of file G4VRML2FileSceneHandler.hh.

101 { G4VSceneHandler::AddPrimitive (polymarker); }
virtual void AddPrimitive(const G4Polyline &)=0

◆ AddPrimitive() [5/7]

void G4VRML2FileSceneHandler::AddPrimitive ( const G4Scale scale)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 102 of file G4VRML2FileSceneHandler.hh.

◆ AddPrimitive() [6/7]

void G4VRML2FileSceneHandler::AddPrimitive ( const G4Square )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [7/7]

void G4VRML2FileSceneHandler::AddPrimitive ( const G4Text )
virtual

Implements G4VSceneHandler.

◆ AddSolid() [1/14]

void G4VRML2FileSceneHandler::AddSolid ( const G4Box )
virtual

Reimplemented from G4VSceneHandler.

◆ AddSolid() [2/14]

void G4VRML2FileSceneHandler::AddSolid ( const G4Cons )
virtual

Reimplemented from G4VSceneHandler.

◆ AddSolid() [3/14]

void G4VRML2FileSceneHandler::AddSolid ( const G4Ellipsoid ellipsoid)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 69 of file G4VRML2FileSceneHandler.hh.

69 {
70 G4VSceneHandler::AddSolid (ellipsoid);
71 }
virtual void AddSolid(const G4Box &)

◆ AddSolid() [4/14]

void G4VRML2FileSceneHandler::AddSolid ( const G4Orb orb)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 66 of file G4VRML2FileSceneHandler.hh.

66 {
68 }

◆ AddSolid() [5/14]

void G4VRML2FileSceneHandler::AddSolid ( const G4Para )
virtual

Reimplemented from G4VSceneHandler.

◆ AddSolid() [6/14]

void G4VRML2FileSceneHandler::AddSolid ( const G4Polycone polycone)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 60 of file G4VRML2FileSceneHandler.hh.

60 {
62 }

◆ AddSolid() [7/14]

void G4VRML2FileSceneHandler::AddSolid ( const G4Polyhedra polyhedra)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 63 of file G4VRML2FileSceneHandler.hh.

63 {
64 G4VSceneHandler::AddSolid (polyhedra);
65 }

◆ AddSolid() [8/14]

void G4VRML2FileSceneHandler::AddSolid ( const G4Sphere )
virtual

Reimplemented from G4VSceneHandler.

◆ AddSolid() [9/14]

void G4VRML2FileSceneHandler::AddSolid ( const G4TessellatedSolid tess)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 72 of file G4VRML2FileSceneHandler.hh.

72 {
74 }

◆ AddSolid() [10/14]

void G4VRML2FileSceneHandler::AddSolid ( const G4Torus )
virtual

Reimplemented from G4VSceneHandler.

◆ AddSolid() [11/14]

void G4VRML2FileSceneHandler::AddSolid ( const G4Trap )
virtual

Reimplemented from G4VSceneHandler.

◆ AddSolid() [12/14]

void G4VRML2FileSceneHandler::AddSolid ( const G4Trd )
virtual

Reimplemented from G4VSceneHandler.

◆ AddSolid() [13/14]

void G4VRML2FileSceneHandler::AddSolid ( const G4Tubs )
virtual

Reimplemented from G4VSceneHandler.

◆ AddSolid() [14/14]

void G4VRML2FileSceneHandler::AddSolid ( const G4VSolid )
virtual

Reimplemented from G4VSceneHandler.

◆ BeginModeling()

void G4VRML2FileSceneHandler::BeginModeling ( )
virtual

Reimplemented from G4VSceneHandler.

◆ BeginPrimitives()

void G4VRML2FileSceneHandler::BeginPrimitives ( const G4Transform3D objectTransformation)
virtual

Reimplemented from G4VSceneHandler.

◆ ClearTransientStore()

void G4VRML2FileSceneHandler::ClearTransientStore ( )
virtual

Reimplemented from G4VSceneHandler.

◆ closePort()

void G4VRML2FileSceneHandler::closePort ( )

Definition at line 198 of file G4VRML2FileSceneHandler.cc.

199{
200 char command[256] ;
201 char viewer [256] ;
202 strcpy( viewer, NO_VRML_VIEWER ); // initialization
203 if( std::getenv( ENV_VRML_VIEWER ) ) {
204 strcpy( viewer, std::getenv( ENV_VRML_VIEWER ) ) ;
205 }
206
207 // close VRML file
208 fDest.close(); fFlagDestOpen = false ;
210 G4cout << "*** VRML 2.0 File " << fVRMLFileName << " is generated." << G4endl;
211
212
213 // Invoke viewer
214
215 if ( !strcmp(viewer, NO_VRML_VIEWER )) {
217 G4cout << "MESSAGE from VRML2FILE driver:" << G4endl;
218 G4cout << " Set an environmental variable " ;
220 G4cout << " if you want to visualize the generated VRML file" << G4endl;
221 G4cout << " automatically. For example, " << G4endl;
222 G4cout << " setenv " << ENV_VRML_VIEWER << " vrwave " << G4endl;
223 }
224 } else {
225 std::ostringstream ossCommand;
226 ossCommand << viewer << ' ' << fVRMLFileName;
227 strncpy(command,ossCommand.str().c_str(),sizeof(command)-1);
228 command[sizeof(command)-1] = '\0';
229 int iErr = system( command );
230 if ( iErr != 0 ) {
232 ed << "Error " << iErr
233 << " when calling system with \"" << command
234 << "\".";
235 G4Exception("G4VRML2FileSceneHandler::closePort()",
236 "VRML-2006", JustWarning, ed);
237 }
238 }
239}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
const char NO_VRML_VIEWER[]
const char ENV_VRML_VIEWER[]

◆ connectPort()

void G4VRML2FileSceneHandler::connectPort ( )

Definition at line 136 of file G4VRML2FileSceneHandler.cc.

137{
138 // g4_00.wrl, g4_01.wrl, ..., g4_MAX_FILE_INDEX.wrl
139 const int MAX_FILE_INDEX = fMaxFileNum - 1 ;
140
141 // dest directory (null if no environmental variables is set)
142 strcpy ( fVRMLFileName, fVRMLFileDestDir) ;
143
144 // create full path name (default)
145 strcat ( fVRMLFileName, DEFAULT_WRL_FILE_NAME );
146
147 // Determine VRML file name
148 for( int i = 0 ; i < fMaxFileNum ; i++) {
149
150 // Message in the final execution
151 if( i == MAX_FILE_INDEX )
152 {
154 G4cout << "===========================================" << G4endl;
155 G4cout << "WARNING MESSAGE from VRML2FILE driver: " << G4endl;
156 G4cout << " This file name is the final one in the " << G4endl;
157 G4cout << " automatic updation of the output file name." << G4endl;
158 G4cout << " You may overwrite existing files, i.e. " << G4endl;
159 G4cout << " g4_XX.wrl. " << G4endl;
160 G4cout << "===========================================" << G4endl;
161 }
162 }
163
164 // re-determine file name as G4VRMLFILE_DEST_DIR/g4_XX.wrl
165 std::ostringstream filename;
166 filename
167 << fVRMLFileDestDir << WRL_FILE_HEADER
168 << std::setw(2) << std::setfill('0') << i << ".wrl";
169 strncpy(fVRMLFileName,filename.str().c_str(),sizeof(fVRMLFileName)-1);
170 fVRMLFileName[sizeof(fVRMLFileName)-1] = '\0';
171
172 // check validity of the file name
173 std::ifstream fin ;
174 fin.open(fVRMLFileName) ;
175 if(!fin) {
176 // new file
177 fin.close();
178 break;
179 } else {
180 // already exists (try next)
181 fin.close();
182 }
183
184 } // for
185
186 // open a VRML 2.0 file with determined file name
188 G4cout << "===========================================" << G4endl;
189 G4cout << "Output VRML 2.0 file: " << fVRMLFileName << G4endl;
190 G4cout << "Maximum number of files in the destination directory: " << fMaxFileNum << G4endl;
191 G4cout << " (Customizable with the environment variable: G4VRMLFILE_MAX_FILE_NUM) " << G4endl;
192 G4cout << "===========================================" << G4endl;
193 }
194 fDest.open(fVRMLFileName) ; fFlagDestOpen = true ;
195}
const char DEFAULT_WRL_FILE_NAME[]
const char WRL_FILE_HEADER[]

◆ EndModeling()

void G4VRML2FileSceneHandler::EndModeling ( )
virtual

Reimplemented from G4VSceneHandler.

◆ EndPrimitives()

void G4VRML2FileSceneHandler::EndPrimitives ( )
virtual

Reimplemented from G4VSceneHandler.

◆ VRMLBeginModeling()

void G4VRML2FileSceneHandler::VRMLBeginModeling ( )

◆ VRMLEndModeling()

void G4VRML2FileSceneHandler::VRMLEndModeling ( )

Friends And Related Function Documentation

◆ G4VRML2FileViewer

friend class G4VRML2FileViewer
friend

Definition at line 46 of file G4VRML2FileSceneHandler.hh.

Member Data Documentation

◆ fDest

std::ofstream G4VRML2FileSceneHandler::fDest

The documentation for this class was generated from the following files: