Geant4  10.02.p03
G4VRML2FileSceneHandler Class Reference

#include <G4VRML2FileSceneHandler.hh>

Inheritance diagram for G4VRML2FileSceneHandler:
Collaboration 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 G4VSolid &)
 
void AddCompound (const G4VTrajectory &traj)
 
void AddCompound (const G4VHit &hit)
 
void AddCompound (const G4VDigi &digi)
 
void AddCompound (const G4THitsMap< G4double > &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 BeginPrimitives2D (const G4Transform3D &objectTransformation)
 
virtual void EndPrimitives2D ()
 
virtual const G4VisExtent & GetExtent () const
 
const G4String & GetName () const
 
G4int GetSceneHandlerId () const
 
G4int GetViewCount () const
 
G4VGraphicsSystem * GetGraphicsSystem () const
 
G4Scene * GetScene () const
 
const G4ViewerList & GetViewerList () const
 
G4VModel * GetModel () const
 
G4VViewer * GetCurrentViewer () const
 
G4bool GetMarkForClearingTransientStore () const
 
G4bool IsReadyForTransients () const
 
G4bool GetTransientsDrawnThisEvent () const
 
G4bool GetTransientsDrawnThisRun () const
 
const G4Transform3D & GetObjectTransformation () const
 
void SetName (const G4String &)
 
void SetCurrentViewer (G4VViewer *)
 
virtual void SetScene (G4Scene *)
 
G4ViewerList & SetViewerList ()
 
void SetModel (G4VModel *)
 
void SetMarkForClearingTransientStore (G4bool)
 
void SetTransientsDrawnThisEvent (G4bool)
 
void SetTransientsDrawnThisRun (G4bool)
 
void SetObjectTransformation (const G4Transform3D &)
 
const G4Colour & GetColour (const G4Visible &)
 
const G4Colour & GetColor (const G4Visible &)
 
const G4Colour & GetTextColour (const G4Text &)
 
const G4Colour & GetTextColor (const G4Text &)
 
G4double GetLineWidth (const G4VisAttributes *)
 
G4ViewParameters::DrawingStyle GetDrawingStyle (const G4VisAttributes *)
 
G4bool GetAuxEdgeVisible (const G4VisAttributes *)
 
G4int GetNoOfSides (const G4VisAttributes *)
 
G4double GetMarkerSize (const G4VMarker &, MarkerSizeType &)
 
G4double GetMarkerDiameter (const G4VMarker &, MarkerSizeType &)
 
G4double GetMarkerRadius (const G4VMarker &, MarkerSizeType &)
 
G4ModelingParameters * CreateModelingParameters ()
 
void DrawEvent (const G4Event *)
 
void DrawEndOfRunModels ()
 
G4int IncrementViewCount ()
 
virtual void ClearStore ()
 
void AddViewerToList (G4VViewer *pView)
 
void RemoveViewerFromList (G4VViewer *pView)
 
- Public Member Functions inherited from G4VGraphicsScene
 G4VGraphicsScene ()
 
virtual ~G4VGraphicsScene ()
 

Public Attributes

std::ofstream fDest
 

Private Member Functions

void SendMaterialNode (const G4VisAttributes *pAV)
 
void SendMaterialNode ()
 
void SendLineColor (const G4VisAttributes *pAV)
 
void SendMarkerColor (const G4VMarker &mark)
 
void SendMarkerWorldPosition (const G4VMarker &mark)
 
G4double GetMarkerHalfSize (const G4VMarker &mark)
 
void GetMarkerWorldPosition (const G4VMarker &mark, double *pX, double *pY, double *pZ)
 
G4bool isConnected ()
 
G4bool IsPVPickable ()
 
void SetPVPickability (G4bool on_off)
 
G4double SetPVTransparency ()
 
G4double GetPVTransparency ()
 

Private Attributes

char fVRMLFileDestDir [256]
 
char fVRMLFileName [256]
 
G4VRML2File & fSystem
 
G4bool fFlagDestOpen
 
G4int fMaxFileNum
 
G4bool fPVPickable
 
G4double fPVTransparency
 

Static Private Attributes

static G4int fSceneIdCount = 0
 

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 G4VSolid * CreateSectionSolid ()
 
virtual G4VSolid * CreateCutawaySolid ()
 
void LoadAtts (const G4Visible &, G4AttHolder *)
 
- Protected Attributes inherited from G4VSceneHandler
G4VGraphicsSystem & fSystem
 
const G4int fSceneHandlerId
 
G4String fName
 
G4int fViewCount
 
G4ViewerList fViewerList
 
G4VViewer * fpViewer
 
G4Scene * fpScene
 
G4bool fMarkForClearingTransientStore
 
G4bool fReadyForTransients
 
G4bool fTransientsDrawnThisEvent
 
G4bool fTransientsDrawnThisRun
 
G4bool fProcessingSolid
 
G4bool fProcessing2D
 
G4VModel * fpModel
 
G4Transform3D fObjectTransformation
 
G4int fNestingDepth
 
const G4VisAttributes * fpVisAttribs
 
const G4Transform3D fIdentityTransformation
 

Detailed Description

Definition at line 45 of file G4VRML2FileSceneHandler.hh.

Constructor & Destructor Documentation

◆ G4VRML2FileSceneHandler()

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

Definition at line 73 of file G4VRML2FileSceneHandler.cc.

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

◆ ~G4VRML2FileSceneHandler()

G4VRML2FileSceneHandler::~G4VRML2FileSceneHandler ( )
virtual

Definition at line 118 of file G4VRML2FileSceneHandler.cc.

119 {
120 #if defined DEBUG_FR_SCENE
122  G4cout << "***** ~G4VRML2FileSceneHandler" << G4endl;
123 #endif
124  VRMLEndModeling();
125 }
G4GLOB_DLL std::ostream G4cout
static Verbosity GetVerbosity()
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

Member Function Documentation

◆ AddCompound() [1/4]

void G4VRML2FileSceneHandler::AddCompound ( const G4VTrajectory &  traj)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 68 of file G4VRML2FileSceneHandler.hh.

68  {
70  }
virtual void AddCompound(const G4VTrajectory &)
Here is the call graph for this function:

◆ AddCompound() [2/4]

void G4VRML2FileSceneHandler::AddCompound ( const G4VHit &  hit)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 71 of file G4VRML2FileSceneHandler.hh.

71  {
73  }
virtual void AddCompound(const G4VTrajectory &)
Here is the call graph for this function:

◆ AddCompound() [3/4]

void G4VRML2FileSceneHandler::AddCompound ( const G4VDigi &  digi)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 74 of file G4VRML2FileSceneHandler.hh.

74  {
76  }
virtual void AddCompound(const G4VTrajectory &)
Here is the call graph for this function:

◆ AddCompound() [4/4]

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

Reimplemented from G4VSceneHandler.

Definition at line 77 of file G4VRML2FileSceneHandler.hh.

77  {
79  }
virtual void AddCompound(const G4VTrajectory &)
Here is the call graph for this function:

◆ AddPrimitive() [1/7]

void G4VRML2FileSceneHandler::AddPrimitive ( const G4Polyline &  )
virtual

Implements G4VSceneHandler.

Here is the caller graph for this function:

◆ AddPrimitive() [2/7]

void G4VRML2FileSceneHandler::AddPrimitive ( const G4Polyhedron &  )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [3/7]

void G4VRML2FileSceneHandler::AddPrimitive ( const G4Text &  )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [4/7]

void G4VRML2FileSceneHandler::AddPrimitive ( const G4Circle &  )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [5/7]

void G4VRML2FileSceneHandler::AddPrimitive ( const G4Square &  )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [6/7]

void G4VRML2FileSceneHandler::AddPrimitive ( const G4Polymarker &  polymarker)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 89 of file G4VRML2FileSceneHandler.hh.

90  { G4VSceneHandler::AddPrimitive (polymarker); }
virtual void AddPrimitive(const G4Polyline &)=0
Here is the call graph for this function:

◆ AddPrimitive() [7/7]

void G4VRML2FileSceneHandler::AddPrimitive ( const G4Scale &  scale)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 91 of file G4VRML2FileSceneHandler.hh.

virtual void AddPrimitive(const G4Polyline &)=0
Here is the call graph for this function:

◆ AddSolid() [1/11]

void G4VRML2FileSceneHandler::AddSolid ( const G4Box &  )
virtual

Reimplemented from G4VSceneHandler.

Here is the caller graph for this function:

◆ AddSolid() [2/11]

void G4VRML2FileSceneHandler::AddSolid ( const G4Cons &  )
virtual

Reimplemented from G4VSceneHandler.

◆ AddSolid() [3/11]

void G4VRML2FileSceneHandler::AddSolid ( const G4Tubs &  )
virtual

Reimplemented from G4VSceneHandler.

◆ AddSolid() [4/11]

void G4VRML2FileSceneHandler::AddSolid ( const G4Trd &  )
virtual

Reimplemented from G4VSceneHandler.

◆ AddSolid() [5/11]

void G4VRML2FileSceneHandler::AddSolid ( const G4Trap &  )
virtual

Reimplemented from G4VSceneHandler.

◆ AddSolid() [6/11]

void G4VRML2FileSceneHandler::AddSolid ( const G4Sphere &  )
virtual

Reimplemented from G4VSceneHandler.

◆ AddSolid() [7/11]

void G4VRML2FileSceneHandler::AddSolid ( const G4Para &  )
virtual

Reimplemented from G4VSceneHandler.

◆ AddSolid() [8/11]

void G4VRML2FileSceneHandler::AddSolid ( const G4Torus &  )
virtual

Reimplemented from G4VSceneHandler.

◆ AddSolid() [9/11]

void G4VRML2FileSceneHandler::AddSolid ( const G4Polycone &  polycone)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 61 of file G4VRML2FileSceneHandler.hh.

61  {
62  G4VSceneHandler::AddSolid (polycone);
63  }
virtual void AddSolid(const G4Box &)
Here is the call graph for this function:

◆ AddSolid() [10/11]

void G4VRML2FileSceneHandler::AddSolid ( const G4Polyhedra &  polyhedra)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 64 of file G4VRML2FileSceneHandler.hh.

64  {
65  G4VSceneHandler::AddSolid (polyhedra);
66  }
virtual void AddSolid(const G4Box &)
Here is the call graph for this function:

◆ AddSolid() [11/11]

void G4VRML2FileSceneHandler::AddSolid ( const G4VSolid &  )
virtual

Reimplemented from G4VSceneHandler.

◆ BeginModeling()

void G4VRML2FileSceneHandler::BeginModeling ( )
virtual

Reimplemented from G4VSceneHandler.

Here is the caller graph for this function:

◆ BeginPrimitives()

void G4VRML2FileSceneHandler::BeginPrimitives ( const G4Transform3D &  objectTransformation)
virtual

Reimplemented from G4VSceneHandler.

Here is the caller graph for this function:

◆ ClearTransientStore()

void G4VRML2FileSceneHandler::ClearTransientStore ( )
virtual

Reimplemented from G4VSceneHandler.

Here is the caller graph for this function:

◆ closePort()

void G4VRML2FileSceneHandler::closePort ( )

Definition at line 196 of file G4VRML2FileSceneHandler.cc.

197 {
198  char command[256] ;
199  char viewer [256] ;
200  strcpy( viewer, NO_VRML_VIEWER ); // initialization
201  if( getenv( ENV_VRML_VIEWER ) ) {
202  strcpy( viewer, getenv( ENV_VRML_VIEWER ) ) ;
203  }
204 
205  // close VRML file
206  fDest.close(); fFlagDestOpen = false ;
208  G4cout << "*** VRML 2.0 File " << fVRMLFileName << " is generated." << G4endl;
209 
210 
211  // Invoke viewer
212 
213  if ( !strcmp(viewer, NO_VRML_VIEWER )) {
215  G4cout << "MESSAGE from VRML2FILE driver:" << G4endl;
216  G4cout << " Set an environmental variable " ;
218  G4cout << " if you want to visualize the generated VRML file" << G4endl;
219  G4cout << " automatically. For example, " << G4endl;
220  G4cout << " setenv " << ENV_VRML_VIEWER << " vrwave " << G4endl;
221  }
222  } else {
223  sprintf( command, "%s %s", viewer, fVRMLFileName );
224  (void) system( command );
225  }
226 }
const char ENV_VRML_VIEWER[]
G4GLOB_DLL std::ostream G4cout
const char NO_VRML_VIEWER[]
static Verbosity GetVerbosity()
system("rm -rf microbeam.root")
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ connectPort()

void G4VRML2FileSceneHandler::connectPort ( )

Definition at line 135 of file G4VRML2FileSceneHandler.cc.

136 {
137  // g4_00.wrl, g4_01.wrl, ..., g4_MAX_FILE_INDEX.wrl
138  const int MAX_FILE_INDEX = fMaxFileNum - 1 ;
139 
140  // dest directory (null if no environmental variables is set)
141  strcpy ( fVRMLFileName, fVRMLFileDestDir) ;
142 
143  // create full path name (default)
145 
146  // Determine VRML file name
147  for( int i = 0 ; i < fMaxFileNum ; i++) {
148 
149  // Message in the final execution
150  if( i == MAX_FILE_INDEX )
151  {
153  G4cout << "===========================================" << G4endl;
154  G4cout << "WARNING MESSAGE from VRML2FILE driver: " << G4endl;
155  G4cout << " This file name is the final one in the " << G4endl;
156  G4cout << " automatic updation of the output file name." << G4endl;
157  G4cout << " You may overwrite existing files, i.e. " << G4endl;
158  G4cout << " g4_XX.wrl. " << G4endl;
159  G4cout << "===========================================" << G4endl;
160  }
161  }
162 
163  // re-determine file name as G4VRMLFILE_DEST_DIR/g4_XX.wrl
164  if( i >= 0 && i <= 9 ) {
165  sprintf( fVRMLFileName, "%s%s%s%d.wrl" , fVRMLFileDestDir, WRL_FILE_HEADER, "0", i );
166  } else {
167  sprintf( fVRMLFileName, "%s%s%d.wrl" , fVRMLFileDestDir, WRL_FILE_HEADER, i );
168  }
169 
170  // check validity of the file name
171  std::ifstream fin ;
172  fin.open(fVRMLFileName) ;
173  if(!fin) {
174  // new file
175  fin.close();
176  break;
177  } else {
178  // already exists (try next)
179  fin.close();
180  }
181 
182  } // for
183 
184  // open a VRML 2.0 file with determined file name
186  G4cout << "===========================================" << G4endl;
187  G4cout << "Output VRML 2.0 file: " << fVRMLFileName << G4endl;
188  G4cout << "Maximum number of files in the destination directory: " << fMaxFileNum << G4endl;
189  G4cout << " (Customizable with the environment variable: G4VRMLFILE_MAX_FILE_NUM) " << G4endl;
190  G4cout << "===========================================" << G4endl;
191  }
192  fDest.open(fVRMLFileName) ; fFlagDestOpen = true ;
193 }
const char DEFAULT_WRL_FILE_NAME[]
TString fin
G4GLOB_DLL std::ostream G4cout
static Verbosity GetVerbosity()
#define G4endl
Definition: G4ios.hh:61
const char WRL_FILE_HEADER[]
Here is the call graph for this function:
Here is the caller graph for this function:

◆ EndModeling()

void G4VRML2FileSceneHandler::EndModeling ( )
virtual

Reimplemented from G4VSceneHandler.

Here is the caller graph for this function:

◆ EndPrimitives()

void G4VRML2FileSceneHandler::EndPrimitives ( )
virtual

Reimplemented from G4VSceneHandler.

Here is the caller graph for this function:

◆ GetMarkerHalfSize()

G4double G4VRML2FileSceneHandler::GetMarkerHalfSize ( const G4VMarker &  mark)
private
Here is the caller graph for this function:

◆ GetMarkerWorldPosition()

void G4VRML2FileSceneHandler::GetMarkerWorldPosition ( const G4VMarker &  mark,
double *  pX,
double *  pY,
double *  pZ 
)
private
Here is the caller graph for this function:

◆ GetPVTransparency()

G4double G4VRML2FileSceneHandler::GetPVTransparency ( )
inlineprivate

Definition at line 126 of file G4VRML2FileSceneHandler.hh.

126 { return fPVTransparency ; }

◆ isConnected()

G4bool G4VRML2FileSceneHandler::isConnected ( )
inlineprivate

Definition at line 121 of file G4VRML2FileSceneHandler.hh.

◆ IsPVPickable()

G4bool G4VRML2FileSceneHandler::IsPVPickable ( )
inlineprivate

Definition at line 123 of file G4VRML2FileSceneHandler.hh.

◆ SendLineColor()

void G4VRML2FileSceneHandler::SendLineColor ( const G4VisAttributes *  pAV)
private
Here is the caller graph for this function:

◆ SendMarkerColor()

void G4VRML2FileSceneHandler::SendMarkerColor ( const G4VMarker &  mark)
private
Here is the caller graph for this function:

◆ SendMarkerWorldPosition()

void G4VRML2FileSceneHandler::SendMarkerWorldPosition ( const G4VMarker &  mark)
private
Here is the caller graph for this function:

◆ SendMaterialNode() [1/2]

void G4VRML2FileSceneHandler::SendMaterialNode ( const G4VisAttributes *  pAV)
private

◆ SendMaterialNode() [2/2]

void G4VRML2FileSceneHandler::SendMaterialNode ( )
private
Here is the caller graph for this function:

◆ SetPVPickability()

void G4VRML2FileSceneHandler::SetPVPickability ( G4bool  on_off)
inlineprivate

Definition at line 124 of file G4VRML2FileSceneHandler.hh.

124 { fPVPickable = on_off ;}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetPVTransparency()

G4double G4VRML2FileSceneHandler::SetPVTransparency ( )
private
Here is the caller graph for this function:

◆ VRMLBeginModeling()

void G4VRML2FileSceneHandler::VRMLBeginModeling ( )
Here is the caller graph for this function:

◆ VRMLEndModeling()

void G4VRML2FileSceneHandler::VRMLEndModeling ( )
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ G4VRML2FileViewer

friend class G4VRML2FileViewer
friend

Definition at line 47 of file G4VRML2FileSceneHandler.hh.

Member Data Documentation

◆ fDest

std::ofstream G4VRML2FileSceneHandler::fDest

Definition at line 144 of file G4VRML2FileSceneHandler.hh.

◆ fFlagDestOpen

G4bool G4VRML2FileSceneHandler::fFlagDestOpen
private

Definition at line 134 of file G4VRML2FileSceneHandler.hh.

◆ fMaxFileNum

G4int G4VRML2FileSceneHandler::fMaxFileNum
private

Definition at line 136 of file G4VRML2FileSceneHandler.hh.

◆ fPVPickable

G4bool G4VRML2FileSceneHandler::fPVPickable
private

Definition at line 138 of file G4VRML2FileSceneHandler.hh.

◆ fPVTransparency

G4double G4VRML2FileSceneHandler::fPVTransparency
private

Definition at line 139 of file G4VRML2FileSceneHandler.hh.

◆ fSceneIdCount

G4int G4VRML2FileSceneHandler::fSceneIdCount = 0
staticprivate

Definition at line 141 of file G4VRML2FileSceneHandler.hh.

◆ fSystem

G4VRML2File& G4VRML2FileSceneHandler::fSystem
private

Definition at line 133 of file G4VRML2FileSceneHandler.hh.

◆ fVRMLFileDestDir

char G4VRML2FileSceneHandler::fVRMLFileDestDir[256]
private

Definition at line 130 of file G4VRML2FileSceneHandler.hh.

◆ fVRMLFileName

char G4VRML2FileSceneHandler::fVRMLFileName[256]
private

Definition at line 131 of file G4VRML2FileSceneHandler.hh.


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