Geant4 11.1.1
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 G4VSolid &)
 
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 ClearTransientStore ()
 
void BeginModeling ()
 
void EndModeling ()
 
void VRMLBeginModeling ()
 
void VRMLEndModeling ()
 
void connectPort ()
 
void closePort ()
 
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 AddCompound (const G4Mesh &)
 
virtual void AddPrimitive (const G4Polyline &)=0
 
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 void AddPrimitive (const G4Plotter &)
 
- 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 AddCompound (const G4Mesh &)
 
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 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 void AddPrimitive (const G4Plotter &)
 
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 G4ColourGetColour (const G4Visible &)
 
const G4ColourGetColor (const G4Visible &)
 
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 AddCompound (const G4Mesh &)=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 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 void AddPrimitive (const G4Plotter &)=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 *)
 
void StandardSpecialMeshRendering (const G4Mesh &)
 
void Draw3DRectMeshAsDots (const G4Mesh &)
 
void Draw3DRectMeshAsSurfaces (const G4Mesh &)
 
void DrawTetMeshAsDots (const G4Mesh &)
 
void DrawTetMeshAsSurfaces (const G4Mesh &)
 
G4ThreeVector GetPointInBox (const G4ThreeVector &pos, G4double halfX, G4double halfY, G4double halfZ) const
 
G4ThreeVector GetPointInTet (const std::vector< G4ThreeVector > &vertices) const
 
- 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 43 of file G4VRML2FileSceneHandler.hh.

Constructor & Destructor Documentation

◆ G4VRML2FileSceneHandler()

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

Definition at line 72 of file G4VRML2FileSceneHandler.cc.

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(std::getenv(VRMLFILE_DEST_DIR) == NULL)
85 {
86 strcpy(fVRMLFileDestDir, "");
87 }
88 else
89 {
90 strcpy(fVRMLFileDestDir, std::getenv(VRMLFILE_DEST_DIR));
91 }
92
93 // maximum number of g4.prim files in the dest directory
94 fMaxFileNum = DEFAULT_MAX_WRL_FILE_NUM; // initialization
95 if(std::getenv("G4VRMLFILE_MAX_FILE_NUM") != NULL)
96 {
97 sscanf(std::getenv("G4VRMLFILE_MAX_FILE_NUM"), "%d", &fMaxFileNum);
98 }
99 else
100 {
101 fMaxFileNum = DEFAULT_MAX_WRL_FILE_NUM;
102 }
103 if(fMaxFileNum < 1)
104 {
105 fMaxFileNum = 1;
106 }
107
108 // PV name pickability
109 if(std::getenv("G4VRML_PV_PICKABLE") != NULL)
110 {
111 int is_pickable;
112 sscanf(std::getenv("G4VRML_PV_PICKABLE"), "%d", &is_pickable);
113
114 if(is_pickable)
115 {
116 SetPVPickability(true);
117 }
118 }
119
120 // PV Transparency
121 SetPVTransparency();
122}
const int DEFAULT_MAX_WRL_FILE_NUM
const char VRMLFILE_DEST_DIR[]

◆ ~G4VRML2FileSceneHandler()

G4VRML2FileSceneHandler::~G4VRML2FileSceneHandler ( )
virtual

Definition at line 124 of file G4VRML2FileSceneHandler.cc.

125{
126#if defined DEBUG_FR_SCENE
128 G4cout << "***** ~G4VRML2FileSceneHandler" << G4endl;
129#endif
131}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static Verbosity GetVerbosity()

Member Function Documentation

◆ AddCompound() [1/6]

void G4VSceneHandler::AddCompound ( const G4Mesh mesh)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 133 of file G4VSceneHandler.cc.

432{
433 G4warn <<
434 "There has been an attempt to draw a mesh with option \""
436 << "\":\n" << mesh
437 << "but it is not of a recognised type or is not implemented"
438 "\nby the current graphics driver. Instead we draw its"
439 "\ncontainer \"" << mesh.GetContainerVolume()->GetName() << "\"."
440 << G4endl;
441 const auto& pv = mesh.GetContainerVolume();
442 const auto& lv = pv->GetLogicalVolume();
443 const auto& solid = lv->GetSolid();
444 const auto& transform = mesh.GetTransform();
445 // Make sure container is visible
446 G4VisAttributes tmpVisAtts; // Visible, white, not forced.
447 const auto& saveVisAtts = lv->GetVisAttributes();
448 if (saveVisAtts) {
449 tmpVisAtts = *saveVisAtts;
450 tmpVisAtts.SetVisibility(true);
451 auto colour = saveVisAtts->GetColour();
452 colour.SetAlpha(1.);
453 tmpVisAtts.SetColour(colour);
454 }
455 // Draw container
456 PreAddSolid(transform,tmpVisAtts);
457 solid->DescribeYourselfTo(*this);
458 PostAddSolid();
459 // Restore vis attributes
460 lv->SetVisAttributes(saveVisAtts);
461}
#define G4warn
Definition: G4Scene.cc:41
G4VSolid * GetSolid() const
G4VPhysicalVolume * GetContainerVolume() const
Definition: G4Mesh.hh:73
const G4Transform3D & GetTransform() const
Definition: G4Mesh.hh:77
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const
virtual void PreAddSolid(const G4Transform3D &objectTransformation, const G4VisAttributes &)
G4VViewer * fpViewer
virtual void PostAddSolid()
const G4ViewParameters & GetViewParameters() const
SMROption GetSpecialMeshRenderingOption() const
void SetColour(const G4Colour &)
void SetVisibility(G4bool=true)

◆ AddCompound() [2/6]

void G4VSceneHandler::AddCompound ( const G4THitsMap< G4double > &  hits)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 131 of file G4VSceneHandler.cc.

345 {
346 using MeshScoreMap = G4VScoringMesh::MeshScoreMap;
347 //G4cout << "AddCompound: hits: " << &hits << G4endl;
348 G4bool scoreMapHits = false;
350 if (scoringManager) {
351 std::size_t nMeshes = scoringManager->GetNumberOfMesh();
352 for (std::size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
353 G4VScoringMesh* mesh = scoringManager->GetMesh((G4int)iMesh);
354 if (mesh && mesh->IsActive()) {
355 MeshScoreMap scoreMap = mesh->GetScoreMap();
356 const G4String& mapNam = const_cast<G4THitsMap<G4double>&>(hits).GetName();
357 for(MeshScoreMap::const_iterator i = scoreMap.cbegin();
358 i != scoreMap.cend(); ++i) {
359 const G4String& scoreMapName = i->first;
360 if (scoreMapName == mapNam) {
361 G4DefaultLinearColorMap colorMap("G4VSceneHandlerColorMap");
362 scoreMapHits = true;
363 mesh->DrawMesh(scoreMapName, &colorMap);
364 }
365 }
366 }
367 }
368 }
369 if (scoreMapHits) {
370 static G4bool first = true;
371 if (first) {
372 first = false;
373 G4cout <<
374 "Scoring map drawn with default parameters."
375 "\n To get gMocren file for gMocren browser:"
376 "\n /vis/open gMocrenFile"
377 "\n /vis/viewer/flush"
378 "\n Many other options available with /score/draw... commands."
379 "\n You might want to \"/vis/viewer/set/autoRefresh false\"."
380 << G4endl;
381 }
382 } else { // Not score map hits. Just call DrawAllHits.
383 // Cast away const because DrawAllHits is non-const!!!!
384 const_cast<G4THitsMap<G4double>&>(hits).DrawAllHits();
385 }
386}
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4VScoringMesh * GetMesh(G4int i) const
size_t GetNumberOfMesh() const
static G4ScoringManager * GetScoringManagerIfExist()
const G4String & GetName() const
G4bool IsActive() const
std::map< G4String, RunScore * > MeshScoreMap
void DrawMesh(const G4String &psName, G4VScoreColorMap *colorMap, G4int axflg=111)
MeshScoreMap GetScoreMap() const

◆ AddCompound() [3/6]

void G4VSceneHandler::AddCompound ( const G4THitsMap< G4StatDouble > &  hits)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 132 of file G4VSceneHandler.cc.

388 {
389 using MeshScoreMap = G4VScoringMesh::MeshScoreMap;
390 //G4cout << "AddCompound: hits: " << &hits << G4endl;
391 G4bool scoreMapHits = false;
393 if (scoringManager) {
394 std::size_t nMeshes = scoringManager->GetNumberOfMesh();
395 for (std::size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
396 G4VScoringMesh* mesh = scoringManager->GetMesh((G4int)iMesh);
397 if (mesh && mesh->IsActive()) {
398 MeshScoreMap scoreMap = mesh->GetScoreMap();
399 for(MeshScoreMap::const_iterator i = scoreMap.cbegin();
400 i != scoreMap.cend(); ++i) {
401 const G4String& scoreMapName = i->first;
402 const G4THitsMap<G4StatDouble>* foundHits = i->second;
403 if (foundHits == &hits) {
404 G4DefaultLinearColorMap colorMap("G4VSceneHandlerColorMap");
405 scoreMapHits = true;
406 mesh->DrawMesh(scoreMapName, &colorMap);
407 }
408 }
409 }
410 }
411 }
412 if (scoreMapHits) {
413 static G4bool first = true;
414 if (first) {
415 first = false;
416 G4cout <<
417 "Scoring map drawn with default parameters."
418 "\n To get gMocren file for gMocren browser:"
419 "\n /vis/open gMocrenFile"
420 "\n /vis/viewer/flush"
421 "\n Many other options available with /score/draw... commands."
422 "\n You might want to \"/vis/viewer/set/autoRefresh false\"."
423 << G4endl;
424 }
425 } else { // Not score map hits. Just call DrawAllHits.
426 // Cast away const because DrawAllHits is non-const!!!!
427 const_cast<G4THitsMap<G4StatDouble>&>(hits).DrawAllHits();
428 }
429}

◆ AddCompound() [4/6]

void G4VSceneHandler::AddCompound ( const G4VDigi digi)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 130 of file G4VSceneHandler.cc.

340 {
341 // Cast away const because Draw is non-const!!!!
342 const_cast<G4VDigi&>(digi).Draw();
343}

◆ AddCompound() [5/6]

void G4VSceneHandler::AddCompound ( const G4VHit hit)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 129 of file G4VSceneHandler.cc.

335 {
336 // Cast away const because Draw is non-const!!!!
337 const_cast<G4VHit&>(hit).Draw();
338}
Definition: G4VHit.hh:48

◆ AddCompound() [6/6]

void G4VSceneHandler::AddCompound ( const G4VTrajectory traj)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 128 of file G4VSceneHandler.cc.

323 {
324 G4TrajectoriesModel* trajectoriesModel =
325 dynamic_cast<G4TrajectoriesModel*>(fpModel);
326 if (trajectoriesModel)
327 traj.DrawTrajectory();
328 else {
330 ("G4VSceneHandler::AddCompound(const G4VTrajectory&)",
331 "visman0105", FatalException, "Not a G4TrajectoriesModel.");
332 }
333}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
virtual void DrawTrajectory() const

◆ AddPrimitive() [1/12]

void G4VRML2FileSceneHandler::AddPrimitive ( const G4Circle )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [2/12]

virtual void G4VSceneHandler::AddPrimitive ( const G4Circle )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [3/12]

void G4VSceneHandler::AddPrimitive ( const G4Plotter )
virtual

Reimplemented from G4VSceneHandler.

Definition at line 193 of file G4VSceneHandler.cc.

510 {
511 G4warn << "WARNING: Plotter not implemented for " << fSystem.GetName() << G4endl;
512 G4warn << " Open a plotter-aware graphics system or remove plotter with" << G4endl;
513 G4warn << " /vis/scene/removeModel Plotter" << G4endl;
514}
const G4String & GetName() const

◆ AddPrimitive() [4/12]

void G4VRML2FileSceneHandler::AddPrimitive ( const G4Polyhedron )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [5/12]

virtual void G4VSceneHandler::AddPrimitive ( const G4Polyhedron )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [6/12]

void G4VRML2FileSceneHandler::AddPrimitive ( const G4Polyline )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [7/12]

virtual void G4VSceneHandler::AddPrimitive ( const G4Polyline )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [8/12]

void G4VSceneHandler::AddPrimitive ( const G4Polymarker polymarker)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 191 of file G4VSceneHandler.cc.

467 {
468 switch (polymarker.GetMarkerType()) {
469 default:
471 {
472 G4Circle dot (polymarker);
473 dot.SetWorldSize (0.);
474 dot.SetScreenSize (0.1); // Very small circle.
475 for (std::size_t iPoint = 0; iPoint < polymarker.size (); ++iPoint) {
476 dot.SetPosition (polymarker[iPoint]);
477 AddPrimitive (dot);
478 }
479 }
480 break;
482 {
483 G4Circle circle (polymarker); // Default circle
484 for (std::size_t iPoint = 0; iPoint < polymarker.size (); ++iPoint) {
485 circle.SetPosition (polymarker[iPoint]);
486 AddPrimitive (circle);
487 }
488 }
489 break;
491 {
492 G4Square square (polymarker); // Default square
493 for (std::size_t iPoint = 0; iPoint < polymarker.size (); ++iPoint) {
494 square.SetPosition (polymarker[iPoint]);
495 AddPrimitive (square);
496 }
497 }
498 break;
499 }
500}
MarkerType GetMarkerType() const
void AddPrimitive(const G4Polyline &)

◆ AddPrimitive() [9/12]

void G4VRML2FileSceneHandler::AddPrimitive ( const G4Square )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [10/12]

virtual void G4VSceneHandler::AddPrimitive ( const G4Square )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [11/12]

void G4VRML2FileSceneHandler::AddPrimitive ( const G4Text )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [12/12]

virtual void G4VSceneHandler::AddPrimitive ( const G4Text )
virtual

Implements G4VSceneHandler.

◆ AddSolid() [1/23]

void G4VSceneHandler::AddSolid ( const G4Box box)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 99 of file G4VSceneHandler.cc.

252 {
253 AddSolidT (box);
254 // If your graphics system is sophisticated enough to handle a
255 // particular solid shape as a primitive, in your derived class write a
256 // function to override this.
257 // Your function might look like this...
258 // void G4MySceneHandler::AddSolid (const G4Box& box) {
259 // Get and check applicable vis attributes.
260 // fpVisAttribs = fpViewer->GetApplicableVisAttributes(fpVisAttribs);
261 // Do not draw if not visible.
262 // if (fpVisAttribs->IsVisible()) {
263 // Get parameters of appropriate object, e.g.:
264 // G4double dx = box.GetXHalfLength ();
265 // G4double dy = box.GetYHalfLength ();
266 // G4double dz = box.GetZHalfLength ();
267 // ...
268 // and Draw or Store in your display List.
269}
void AddSolidT(const T &solid)

◆ AddSolid() [2/23]

void G4VRML2FileSceneHandler::AddSolid ( const G4Box )
virtual

Reimplemented from G4VSceneHandler.

◆ AddSolid() [3/23]

void G4VSceneHandler::AddSolid ( const G4Cons cons)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 100 of file G4VSceneHandler.cc.

271 {
272 AddSolidT (cons);
273}

◆ AddSolid() [4/23]

void G4VRML2FileSceneHandler::AddSolid ( const G4Cons )
virtual

Reimplemented from G4VSceneHandler.

◆ AddSolid() [5/23]

void G4VSceneHandler::AddSolid ( const G4Ellipsoid ellipsoid)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 110 of file G4VSceneHandler.cc.

303 {
304 AddSolidWithAuxiliaryEdges (ellipsoid);
305}
void AddSolidWithAuxiliaryEdges(const T &solid)

◆ AddSolid() [6/23]

void G4VSceneHandler::AddSolid ( const G4Orb orb)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 101 of file G4VSceneHandler.cc.

275 {
277}

◆ AddSolid() [7/23]

void G4VSceneHandler::AddSolid ( const G4Para para)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 102 of file G4VSceneHandler.cc.

279 {
280 AddSolidT (para);
281}

◆ AddSolid() [8/23]

void G4VRML2FileSceneHandler::AddSolid ( const G4Para )
virtual

Reimplemented from G4VSceneHandler.

◆ AddSolid() [9/23]

void G4VSceneHandler::AddSolid ( const G4Polycone polycone)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 111 of file G4VSceneHandler.cc.

307 {
308 AddSolidT (polycone);
309}

◆ AddSolid() [10/23]

void G4VSceneHandler::AddSolid ( const G4Polyhedra polyhedra)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 112 of file G4VSceneHandler.cc.

311 {
312 AddSolidT (polyhedra);
313}

◆ AddSolid() [11/23]

void G4VSceneHandler::AddSolid ( const G4Sphere sphere)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 103 of file G4VSceneHandler.cc.

283 {
285}

◆ AddSolid() [12/23]

void G4VRML2FileSceneHandler::AddSolid ( const G4Sphere )
virtual

Reimplemented from G4VSceneHandler.

◆ AddSolid() [13/23]

void G4VSceneHandler::AddSolid ( const G4TessellatedSolid tess)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 113 of file G4VSceneHandler.cc.

315 {
316 AddSolidT (tess);
317}

◆ AddSolid() [14/23]

void G4VSceneHandler::AddSolid ( const G4Torus torus)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 104 of file G4VSceneHandler.cc.

287 {
289}

◆ AddSolid() [15/23]

void G4VRML2FileSceneHandler::AddSolid ( const G4Torus )
virtual

Reimplemented from G4VSceneHandler.

◆ AddSolid() [16/23]

void G4VSceneHandler::AddSolid ( const G4Trap trap)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 105 of file G4VSceneHandler.cc.

291 {
292 AddSolidT (trap);
293}

◆ AddSolid() [17/23]

void G4VRML2FileSceneHandler::AddSolid ( const G4Trap )
virtual

Reimplemented from G4VSceneHandler.

◆ AddSolid() [18/23]

void G4VSceneHandler::AddSolid ( const G4Trd trd)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 106 of file G4VSceneHandler.cc.

295 {
296 AddSolidT (trd);
297}

◆ AddSolid() [19/23]

void G4VRML2FileSceneHandler::AddSolid ( const G4Trd )
virtual

Reimplemented from G4VSceneHandler.

◆ AddSolid() [20/23]

void G4VSceneHandler::AddSolid ( const G4Tubs tubs)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 107 of file G4VSceneHandler.cc.

299 {
300 AddSolidT (tubs);
301}

◆ AddSolid() [21/23]

void G4VRML2FileSceneHandler::AddSolid ( const G4Tubs )
virtual

Reimplemented from G4VSceneHandler.

◆ AddSolid() [22/23]

void G4VSceneHandler::AddSolid ( const G4VSolid solid)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 116 of file G4VSceneHandler.cc.

319 {
320 AddSolidT (solid);
321}

◆ AddSolid() [23/23]

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 220 of file G4VRML2FileSceneHandler.cc.

221{
222 char command[256];
223 char viewer[256];
224 strcpy(viewer, NO_VRML_VIEWER); // initialization
225 if(std::getenv(ENV_VRML_VIEWER))
226 {
227 strcpy(viewer, std::getenv(ENV_VRML_VIEWER));
228 }
229
230 // close VRML file
231 fDest.close();
232 fFlagDestOpen = false;
234 G4cout << "*** VRML 2.0 File " << fVRMLFileName << " is generated."
235 << G4endl;
236
237 // Invoke viewer
238
239 if(!strcmp(viewer, NO_VRML_VIEWER))
240 {
242 {
243 G4cout << "MESSAGE from VRML2FILE driver:" << G4endl;
244 G4cout << " Set an environmental variable ";
246 G4cout << " if you want to visualize the generated VRML file"
247 << G4endl;
248 G4cout << " automatically. For example, " << G4endl;
249 G4cout << " setenv " << ENV_VRML_VIEWER << " vrwave " << G4endl;
250 G4cout << "ALSO you may change the file header with "
252 G4cout << " or the whole filename with " << ENV_WRL_FILE_NAME
253 << G4endl;
254 }
255 }
256 else
257 {
258 std::ostringstream ossCommand;
259 ossCommand << viewer << ' ' << fVRMLFileName;
260 strncpy(command, ossCommand.str().c_str(), sizeof(command) - 1);
261 command[sizeof(command) - 1] = '\0';
262 int iErr = system(command);
263 if(iErr != 0)
264 {
266 ed << "Error " << iErr << " when calling system with \"" << command
267 << "\".";
268 G4Exception("G4VRML2FileSceneHandler::closePort()", "VRML-2006",
269 JustWarning, ed);
270 }
271 }
272}
@ JustWarning
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
const char ENV_WRL_FILE_NAME[]
const char NO_VRML_VIEWER[]
const char ENV_WRL_FILE_HEADER[]
const char ENV_VRML_VIEWER[]

◆ connectPort()

void G4VRML2FileSceneHandler::connectPort ( )

Definition at line 139 of file G4VRML2FileSceneHandler.cc.

140{
141 // g4_00.wrl, g4_01.wrl, ..., g4_MAX_FILE_INDEX.wrl
142 const int MAX_FILE_INDEX = fMaxFileNum - 1;
143
144 // dest directory (null if no environmental variables is set)
145 strcpy(fVRMLFileName, fVRMLFileDestDir);
146 // add filename if environment variable supplied
147 if(std::getenv(ENV_WRL_FILE_NAME))
148 {
149 strcat(fVRMLFileName, std::getenv(ENV_WRL_FILE_NAME));
150 }
151 else
152 {
153 // Determine VRML file name
154 for(int i = 0; i < fMaxFileNum; i++)
155 {
156 // Message in the final execution
157 if(i == MAX_FILE_INDEX)
158 {
160 {
161 G4cout << "===========================================" << G4endl;
162 G4cout << "WARNING MESSAGE from VRML2FILE driver: " << G4endl;
163 G4cout << " This file name is the final one in the " << G4endl;
164 G4cout << " automatic updation of the output file name." << G4endl;
165 G4cout << " You may overwrite existing files, i.e. " << G4endl;
166 G4cout << " g4_XX.wrl. " << G4endl;
167 G4cout << "===========================================" << G4endl;
168 }
169 }
170
171 // re-determine file name as G4VRMLFILE_DEST_DIR/g4_XX.wrl
172 std::ostringstream filename;
173 filename << fVRMLFileDestDir;
174 if(std::getenv(ENV_WRL_FILE_HEADER) == NULL)
175 {
176 filename << WRL_FILE_HEADER;
177 }
178 else
179 {
180 filename << std::getenv(ENV_WRL_FILE_HEADER) << '_';
181 }
182 filename << std::setw(2) << std::setfill('0') << i << ".wrl";
183 strncpy(fVRMLFileName, filename.str().c_str(), sizeof(fVRMLFileName) - 1);
184 fVRMLFileName[sizeof(fVRMLFileName) - 1] = '\0';
185
186 // check validity of the file name
187 std::ifstream fin;
188 fin.open(fVRMLFileName);
189 if(!fin)
190 {
191 // new file
192 fin.close();
193 break;
194 }
195 else
196 {
197 // already exists (try next)
198 fin.close();
199 }
200
201 } // for
202 }
203
204 // open a VRML 2.0 file with determined file name
206 {
207 G4cout << "===========================================" << G4endl;
208 G4cout << "Output VRML 2.0 file: " << fVRMLFileName << G4endl;
209 G4cout << "Maximum number of files in the destination directory: "
210 << fMaxFileNum << G4endl;
211 G4cout << " (Customizable with the environment variable: "
212 "G4VRMLFILE_MAX_FILE_NUM) "
213 << G4endl;
214 G4cout << "===========================================" << G4endl;
215 }
216 fDest.open(fVRMLFileName);
217 fFlagDestOpen = true;
218}
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 45 of file G4VRML2FileSceneHandler.hh.

Member Data Documentation

◆ fDest

std::ofstream G4VRML2FileSceneHandler::fDest

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