Geant4-11
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes
G4HepRepFileSceneHandler Class Reference

#include <G4HepRepFileSceneHandler.hh>

Inheritance diagram for G4HepRepFileSceneHandler:
G4VSceneHandler G4VGraphicsScene

Public Types

enum  MarkerSizeType { world , screen }
 

Public Member Functions

virtual void AddCompound (const G4Mesh &)
 
virtual void AddCompound (const G4THitsMap< G4double > &)
 
virtual void AddCompound (const G4THitsMap< G4StatDouble > &)
 
virtual void AddCompound (const G4VDigi &)
 
virtual void AddCompound (const G4VHit &)
 
void AddCompound (const G4VHit &)
 
virtual void AddCompound (const G4VTrajectory &)
 
void AddCompound (const G4VTrajectory &)
 
void AddPrimitive (const G4Circle &)
 
virtual void AddPrimitive (const G4Circle &)=0
 
virtual void AddPrimitive (const G4Plotter &)
 
void AddPrimitive (const G4Polyhedron &)
 
virtual void AddPrimitive (const G4Polyhedron &)=0
 
void AddPrimitive (const G4Polyline &)
 
virtual void AddPrimitive (const G4Polyline &)=0
 
virtual void AddPrimitive (const G4Polymarker &)
 
void AddPrimitive (const G4Polymarker &)
 
void AddPrimitive (const G4Square &)
 
virtual void AddPrimitive (const G4Square &)=0
 
void AddPrimitive (const G4Text &)
 
virtual void AddPrimitive (const G4Text &)=0
 
void AddSolid (const G4Box &)
 
void AddSolid (const G4Cons &)
 
void AddSolid (const G4Ellipsoid &)
 
void AddSolid (const G4Orb &)
 
void AddSolid (const G4Para &)
 
void AddSolid (const G4Polycone &)
 
void AddSolid (const G4Polyhedra &)
 
void AddSolid (const G4Sphere &)
 
void AddSolid (const G4TessellatedSolid &)
 
void AddSolid (const G4Torus &)
 
void AddSolid (const G4Trap &)
 
void AddSolid (const G4Trd &)
 
void AddSolid (const G4Tubs &)
 
void AddSolid (const G4VSolid &)
 
template<class T >
void AddSolidT (const T &solid)
 
template<class T >
void AddSolidWithAuxiliaryEdges (const T &solid)
 
void AddViewerToList (G4VViewer *pView)
 
void BeginModeling ()
 
virtual void BeginPrimitives (const G4Transform3D &objectTransformation=G4Transform3D())
 
void BeginPrimitives2D (const G4Transform3D &objectTransformation)
 
virtual void ClearStore ()
 
void ClearTransientStore ()
 
G4ModelingParametersCreateModelingParameters ()
 
void DrawEndOfRunModels ()
 
void DrawEvent (const G4Event *)
 
void EndModeling ()
 
virtual void EndPrimitives ()
 
void EndPrimitives2D ()
 
 G4HepRepFileSceneHandler (G4VGraphicsSystem &system, const G4String &name)
 
G4bool GetAuxEdgeVisible (const G4VisAttributes *)
 
const G4ColourGetColor ()
 
const G4ColourGetColor (const G4Visible &)
 
const G4ColourGetColour ()
 
const G4ColourGetColour (const G4Visible &)
 
G4VViewerGetCurrentViewer () const
 
G4ViewParameters::DrawingStyle GetDrawingStyle (const G4VisAttributes *)
 
virtual const G4VisExtentGetExtent () const
 
G4VGraphicsSystemGetGraphicsSystem () const
 
G4HepRepFileXMLWriterGetHepRepXMLWriter ()
 
G4double GetLineWidth (const G4VisAttributes *)
 
G4double GetMarkerDiameter (const G4VMarker &, MarkerSizeType &)
 
G4double GetMarkerRadius (const G4VMarker &, MarkerSizeType &)
 
G4double GetMarkerSize (const G4VMarker &, MarkerSizeType &)
 
G4bool GetMarkForClearingTransientStore () const
 
G4VModelGetModel () const
 
const G4StringGetName () const
 
G4int GetNoOfSides (const G4VisAttributes *)
 
G4int GetNumberOfCloudPoints (const G4VisAttributes *) const
 
const G4Transform3DGetObjectTransformation () const
 
G4SceneGetScene () const
 
G4int GetSceneHandlerId () const
 
const G4ColourGetTextColor (const G4Text &)
 
const G4ColourGetTextColour (const G4Text &)
 
G4bool GetTransientsDrawnThisEvent () const
 
G4bool GetTransientsDrawnThisRun () const
 
G4int GetViewCount () const
 
const G4ViewerListGetViewerList () const
 
G4int IncrementViewCount ()
 
void InitHit ()
 
void InitTrajectory ()
 
G4bool IsReadyForTransients () const
 
virtual void PostAddSolid ()
 
virtual void PreAddSolid (const G4Transform3D &objectTransformation, const G4VisAttributes &)
 
void RemoveViewerFromList (G4VViewer *pView)
 
void SetCurrentViewer (G4VViewer *)
 
void SetMarkForClearingTransientStore (G4bool)
 
void SetModel (G4VModel *)
 
void SetName (const G4String &)
 
void SetObjectTransformation (const G4Transform3D &)
 
virtual void SetScene (G4Scene *)
 
void SetTransientsDrawnThisEvent (G4bool)
 
void SetTransientsDrawnThisRun (G4bool)
 
G4ViewerListSetViewerList ()
 
virtual ~G4HepRepFileSceneHandler ()
 

Protected Member Functions

virtual G4DisplacedSolidCreateCutawaySolid ()
 
virtual G4DisplacedSolidCreateSectionSolid ()
 
void LoadAtts (const G4Visible &, G4AttHolder *)
 
virtual void ProcessScene ()
 
virtual void RequestPrimitives (const G4VSolid &solid)
 

Protected Attributes

const G4Transform3D fIdentityTransformation
 
G4bool fMarkForClearingTransientStore
 
G4String fName
 
G4int fNestingDepth
 
G4Transform3D fObjectTransformation
 
G4VModelfpModel
 
G4bool fProcessing2D
 
G4bool fProcessingSolid
 
G4ScenefpScene
 
G4VViewerfpViewer
 
const G4VisAttributesfpVisAttribs
 
G4bool fReadyForTransients
 
const G4int fSceneHandlerId
 
G4VGraphicsSystemfSystem
 
G4bool fTransientsDrawnThisEvent
 
G4bool fTransientsDrawnThisRun
 
G4int fViewCount
 
G4ViewerList fViewerList
 

Static Protected Attributes

static G4int fSceneIdCount = 0
 

Private Member Functions

void AddHepRepInstance (const char *primName, const G4Visible visible)
 
void CheckFileOpen ()
 

Private Attributes

G4bool doneInitHit
 
G4bool doneInitTraj
 
G4bool drawingHit
 
G4bool drawingTraj
 
int fileCounter
 
G4bool haveVisible
 
G4HepRepFileXMLWriterhepRepXMLWriter
 
std::map< G4String, G4AttDef > * hitAttDefs
 
std::vector< G4AttValue > * hitAttValues
 
G4bool inPrimitives2D
 
std::map< G4String, G4AttDef > * trajAttDefs
 
std::vector< G4AttValue > * trajAttValues
 
const G4VisTrajContexttrajContext
 
G4bool warnedAbout2DMarkers
 
G4bool warnedAbout3DText
 

Detailed Description

Definition at line 58 of file G4HepRepFileSceneHandler.hh.

Member Enumeration Documentation

◆ MarkerSizeType

Enumerator
world 
screen 

Definition at line 58 of file G4VSceneHandler.hh.

Constructor & Destructor Documentation

◆ G4HepRepFileSceneHandler()

G4HepRepFileSceneHandler::G4HepRepFileSceneHandler ( G4VGraphicsSystem system,
const G4String name 
)

Definition at line 69 of file G4HepRepFileSceneHandler.cc.

72{
74 fileCounter = 0;
75
76 inPrimitives2D = false;
77 warnedAbout3DText = false;
79 haveVisible = false;
80 drawingTraj = false;
81 doneInitTraj = false;
82 drawingHit = false;
83 doneInitHit = false;
84 trajContext = 0;
85 trajAttValues = 0;
86 trajAttDefs = 0;
87 hitAttValues = 0;
88 hitAttDefs = 0;
89}
std::map< G4String, G4AttDef > * trajAttDefs
std::map< G4String, G4AttDef > * hitAttDefs
std::vector< G4AttValue > * trajAttValues
G4HepRepFileXMLWriter * hepRepXMLWriter
G4HepRepFileXMLWriter * GetHepRepXMLWriter()
const G4VisTrajContext * trajContext
std::vector< G4AttValue > * hitAttValues
G4VSceneHandler(G4VGraphicsSystem &system, G4int id, const G4String &name="")
const char * name(G4int ptype)

References doneInitHit, doneInitTraj, drawingHit, drawingTraj, fileCounter, GetHepRepXMLWriter(), haveVisible, hepRepXMLWriter, hitAttDefs, hitAttValues, inPrimitives2D, trajAttDefs, trajAttValues, trajContext, warnedAbout2DMarkers, and warnedAbout3DText.

◆ ~G4HepRepFileSceneHandler()

G4HepRepFileSceneHandler::~G4HepRepFileSceneHandler ( )
virtual

Definition at line 91 of file G4HepRepFileSceneHandler.cc.

91{}

Member Function Documentation

◆ AddCompound() [1/8]

void G4VSceneHandler::AddCompound ( const G4Mesh mesh)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 132 of file G4VSceneHandler.cc.

427{
429 ed << "There has been an attempt to draw a mesh (a nested parameterisation),"
430 "\nbut it is not implemented by the current graphics driver. Here we simply"
431 "\ndraw the container, \"" << mesh.GetContainerVolume()->GetName() << "\".";
432 G4Exception("G4VSceneHandler::AddCompound(const G4Mesh&)",
433 "visman0107", JustWarning, ed);
434
435 const auto& pv = mesh.GetContainerVolume();
436 const auto& lv = pv->GetLogicalVolume();
437 const auto& solid = lv->GetSolid();
438 const auto& transform = mesh.GetTransform();
439 // Make sure container is visible
440 const auto& saveVisAtts = lv->GetVisAttributes();
441 auto tmpVisAtts = *saveVisAtts;
442 tmpVisAtts.SetVisibility(true);
443 auto colour = saveVisAtts->GetColour();
444 colour.SetAlpha(1.);
445 tmpVisAtts.SetColour(colour);
446 // Draw container
447 PreAddSolid(transform,tmpVisAtts);
448 solid->DescribeYourselfTo(*this);
449 PostAddSolid();
450 // Restore vis attributes
451 lv->SetVisAttributes(saveVisAtts);
452}
@ 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
G4VSolid * GetSolid() const
G4VPhysicalVolume * GetContainerVolume() const
Definition: G4Mesh.hh:61
const G4Transform3D & GetTransform() const
Definition: G4Mesh.hh:64
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const
virtual void PreAddSolid(const G4Transform3D &objectTransformation, const G4VisAttributes &)
virtual void PostAddSolid()
G4bool transform(G4String &input, const G4String &type)

◆ AddCompound() [2/8]

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

Reimplemented from G4VSceneHandler.

Definition at line 130 of file G4VSceneHandler.cc.

340 {
341 using MeshScoreMap = G4VScoringMesh::MeshScoreMap;
342 //G4cout << "AddCompound: hits: " << &hits << G4endl;
343 G4bool scoreMapHits = false;
345 if (scoringManager) {
346 size_t nMeshes = scoringManager->GetNumberOfMesh();
347 for (size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
348 G4VScoringMesh* mesh = scoringManager->GetMesh(iMesh);
349 if (mesh && mesh->IsActive()) {
350 MeshScoreMap scoreMap = mesh->GetScoreMap();
351 const G4String& mapNam = const_cast<G4THitsMap<G4double>&>(hits).GetName();
352 for(MeshScoreMap::const_iterator i = scoreMap.begin();
353 i != scoreMap.end(); ++i) {
354 const G4String& scoreMapName = i->first;
355 if (scoreMapName == mapNam) {
356 G4DefaultLinearColorMap colorMap("G4VSceneHandlerColorMap");
357 scoreMapHits = true;
358 mesh->DrawMesh(scoreMapName, &colorMap);
359 }
360 }
361 }
362 }
363 }
364 if (scoreMapHits) {
365 static G4bool first = true;
366 if (first) {
367 first = false;
368 G4cout <<
369 "Scoring map drawn with default parameters."
370 "\n To get gMocren file for gMocren browser:"
371 "\n /vis/open gMocrenFile"
372 "\n /vis/viewer/flush"
373 "\n Many other options available with /score/draw... commands."
374 "\n You might want to \"/vis/viewer/set/autoRefresh false\"."
375 << G4endl;
376 }
377 } else { // Not score map hits. Just call DrawAllHits.
378 // Cast away const because DrawAllHits is non-const!!!!
379 const_cast<G4THitsMap<G4double>&>(hits).DrawAllHits();
380 }
381}
bool G4bool
Definition: G4Types.hh:86
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
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/8]

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

Reimplemented from G4VSceneHandler.

Definition at line 131 of file G4VSceneHandler.cc.

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

◆ AddCompound() [4/8]

void G4VSceneHandler::AddCompound ( const G4VDigi digi)
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<G4VDigi&>(digi).Draw();
338}

◆ AddCompound() [5/8]

void G4VSceneHandler::AddCompound ( const G4VHit hit)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 128 of file G4VSceneHandler.cc.

330 {
331 // Cast away const because Draw is non-const!!!!
332 const_cast<G4VHit&>(hit).Draw();
333}
Definition: G4VHit.hh:48

◆ AddCompound() [6/8]

void G4HepRepFileSceneHandler::AddCompound ( const G4VHit hit)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 929 of file G4HepRepFileSceneHandler.cc.

930{
931#ifdef G4HEPREPFILEDEBUG
932 G4cout << "G4HepRepFileSceneHandler::AddCompound(G4VHit&) " << G4endl;
933#endif
934
935 // Pointers to hold hit attribute values and definitions.
936 std::vector<G4AttValue>* rawHitAttValues = hit.CreateAttValues();
937 hitAttValues = new std::vector<G4AttValue>;
938 hitAttDefs = new std::map<G4String, G4AttDef>;
939
940 // Iterators to use with attribute values and definitions.
941 std::vector<G4AttValue>::iterator iAttVal;
942 std::map<G4String, G4AttDef>::const_iterator iAttDef;
943
944 // Get hit attributes and definitions in standard HepRep style
945 // (uniform units, 3Vectors decomposed).
946 if(rawHitAttValues)
947 {
948 G4bool error = G4AttCheck(rawHitAttValues, hit.GetAttDefs())
950 if(error)
951 {
952 G4cout << "G4HepRepFileSceneHandler::AddCompound(hit):"
953 "\nERROR found during conversion to standard hit attributes."
954 << G4endl;
955 }
956#ifdef G4HEPREPFILEDEBUG
957 G4cout << "G4HepRepFileSceneHandler::AddCompound(hit): standardised "
958 "attributes:\n"
960#endif
961 delete rawHitAttValues;
962 }
963
964 // Open the HepRep output file if it is not already open.
966
967 // Add the Event Data Type if it hasn't already been added.
968 if(strcmp("Event Data", hepRepXMLWriter->prevTypeName[0]) != 0)
969 {
970 hepRepXMLWriter->addType("Event Data", 0);
972 }
973
974 // Find out the current HitType.
975 G4String hitType = "Hits";
976 if(hitAttValues)
977 {
978 G4bool found = false;
979 for(iAttVal = hitAttValues->begin();
980 iAttVal != hitAttValues->end() && !found; ++iAttVal)
981 {
982 if(strcmp(iAttVal->GetName(), "HitType") == 0)
983 {
984 hitType = iAttVal->GetValue();
985 found = true;
986 }
987 }
988 }
989
990 // Add the Hits Type.
991 G4String previousName = hepRepXMLWriter->prevTypeName[1];
992 hepRepXMLWriter->addType(hitType, 1);
993
994 // If this is the first hit of this event,
995 // specify attribute values common to all hits.
996 if(strcmp(hitType, previousName) != 0)
997 {
998 hepRepXMLWriter->addAttValue("Layer", 130);
999
1000 // Take all Hit attDefs from first hit.
1001 // Would rather be able to get these attDefs without needing a reference
1002 // from any particular hit, but don't know how to do that. Write out hit
1003 // attribute definitions.
1005 {
1006 for(iAttVal = hitAttValues->begin(); iAttVal != hitAttValues->end();
1007 ++iAttVal)
1008 {
1009 iAttDef = hitAttDefs->find(iAttVal->GetName());
1010 if(iAttDef != hitAttDefs->end())
1011 {
1012 // Protect against incorrect use of Category. Anything value other
1013 // than the standard ones will be considered to be in the physics
1014 // category.
1015 G4String category = iAttDef->second.GetCategory();
1016 if(strcmp(category, "Draw") != 0 &&
1017 strcmp(category, "Physics") != 0 &&
1018 strcmp(category, "Association") != 0 &&
1019 strcmp(category, "PickAction") != 0)
1020 category = "Physics";
1021 hepRepXMLWriter->addAttDef(iAttVal->GetName(),
1022 iAttDef->second.GetDesc(), category,
1023 iAttDef->second.GetExtra());
1024 }
1025 }
1026 }
1027 } // end of special treatment for when this is the first hit.
1028
1029 // Now that we have written out all of the attributes that are based on the
1030 // hit's particulars, call base class to deconstruct hit into a primitives.
1031 drawingHit = true;
1032 doneInitHit = false;
1033 G4VSceneHandler::AddCompound(hit); // Invoke default action.
1034 drawingHit = false;
1035}
G4bool Standard(std::vector< G4AttValue > *standardValues, std::map< G4String, G4AttDef > *standardDefinitions) const
Definition: G4AttCheck.cc:350
void addAttValue(const char *name, const char *value)
void addType(const char *name, int newTypeDepth)
void addAttDef(const char *name, const char *desc, const char *type, const char *extra)
virtual std::vector< G4AttValue > * CreateAttValues() const
Definition: G4VHit.hh:64
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
Definition: G4VHit.hh:58
virtual void AddCompound(const G4VTrajectory &)
static PROLOG_HANDLER error
Definition: xmlrole.cc:127

References G4HepRepFileXMLWriter::addAttDef(), G4HepRepFileXMLWriter::addAttValue(), G4VSceneHandler::AddCompound(), G4HepRepFileXMLWriter::addInstance(), G4HepRepFileXMLWriter::addType(), CheckFileOpen(), G4VHit::CreateAttValues(), doneInitHit, drawingHit, error, G4cout, G4endl, G4VHit::GetAttDefs(), hepRepXMLWriter, hitAttDefs, hitAttValues, G4HepRepFileXMLWriter::prevTypeName, and G4AttCheck::Standard().

◆ AddCompound() [7/8]

void G4VSceneHandler::AddCompound ( const G4VTrajectory traj)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 127 of file G4VSceneHandler.cc.

318 {
319 G4TrajectoriesModel* trajectoriesModel =
320 dynamic_cast<G4TrajectoriesModel*>(fpModel);
321 if (trajectoriesModel)
322 traj.DrawTrajectory();
323 else {
325 ("G4VSceneHandler::AddCompound(const G4VTrajectory&)",
326 "visman0105", FatalException, "Not a G4TrajectoriesModel.");
327 }
328}
@ FatalException
virtual void DrawTrajectory() const

◆ AddCompound() [8/8]

void G4HepRepFileSceneHandler::AddCompound ( const G4VTrajectory traj)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 517 of file G4HepRepFileSceneHandler.cc.

518{
519#ifdef G4HEPREPFILEDEBUG
520 G4cout << "G4HepRepFileSceneHandler::AddCompound(const G4VTrajectory&) "
521 << G4endl;
522#endif
523
524 G4TrajectoriesModel* pTrModel = dynamic_cast<G4TrajectoriesModel*>(fpModel);
525 if(!pTrModel)
526 G4Exception("G4HepRepFileSceneHandler::AddCompound(const G4VTrajectory&)",
527 "vis-HepRep0001", FatalException, "Not a G4TrajectoriesModel.");
528
529 // Pointers to hold trajectory attribute values and definitions.
530 std::vector<G4AttValue>* rawTrajAttValues = traj.CreateAttValues();
531 trajAttValues = new std::vector<G4AttValue>;
532 trajAttDefs = new std::map<G4String, G4AttDef>;
533
534 // Iterators to use with attribute values and definitions.
535 std::vector<G4AttValue>::iterator iAttVal;
536 std::map<G4String, G4AttDef>::const_iterator iAttDef;
537 G4int i;
538
539 // Get trajectory attributes and definitions in standard HepRep style
540 // (uniform units, 3Vectors decomposed).
541 if(rawTrajAttValues)
542 {
543 G4bool error = G4AttCheck(rawTrajAttValues, traj.GetAttDefs())
545 if(error)
546 {
547 G4cout
548 << "G4HepRepFileSceneHandler::AddCompound(traj):"
549 "\nERROR found during conversion to standard trajectory attributes."
550 << G4endl;
551 }
552#ifdef G4HEPREPFILEDEBUG
553 G4cout << "G4HepRepFileSceneHandler::AddCompound(traj): standardised "
554 "attributes:\n"
556#endif
557 delete rawTrajAttValues;
558 }
559
560 // Open the HepRep output file if it is not already open.
562
563 // Add the Event Data Type if it hasn't already been added.
564 if(strcmp("Event Data", hepRepXMLWriter->prevTypeName[0]) != 0)
565 {
566 hepRepXMLWriter->addType("Event Data", 0);
568 }
569
570 // Add the Trajectories Type.
571 G4String previousName = hepRepXMLWriter->prevTypeName[1];
572 hepRepXMLWriter->addType("Trajectories", 1);
573
574 // If this is the first trajectory of this event,
575 // specify attribute values common to all trajectories.
576 if(strcmp("Trajectories", previousName) != 0)
577 {
578 hepRepXMLWriter->addAttValue("Layer", 100);
579
580 // Take all Trajectory attDefs from first trajectory.
581 // Would rather be able to get these attDefs without needing a reference
582 // from any particular trajectory, but don't know how to do that. Write out
583 // trajectory attribute definitions.
585 {
586 for(iAttVal = trajAttValues->begin(); iAttVal != trajAttValues->end();
587 ++iAttVal)
588 {
589 iAttDef = trajAttDefs->find(iAttVal->GetName());
590 if(iAttDef != trajAttDefs->end())
591 {
592 // Protect against incorrect use of Category. Anything value other
593 // than the standard ones will be considered to be in the physics
594 // category.
595 G4String category = iAttDef->second.GetCategory();
596 if(strcmp(category, "Draw") != 0 &&
597 strcmp(category, "Physics") != 0 &&
598 strcmp(category, "Association") != 0 &&
599 strcmp(category, "PickAction") != 0)
600 category = "Physics";
601 hepRepXMLWriter->addAttDef(iAttVal->GetName(),
602 iAttDef->second.GetDesc(), category,
603 iAttDef->second.GetExtra());
604 }
605 }
606 }
607
608 // Take all TrajectoryPoint attDefs from first point of first trajectory.
609 // Would rather be able to get these attDefs without needing a reference
610 // from any particular point, but don't know how to do that.
612 traj.GetPointEntries() > 0)
613 {
614 G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(0);
615
616 // Pointers to hold trajectory point attribute values and definitions.
617 std::vector<G4AttValue>* rawPointAttValues =
618 aTrajectoryPoint->CreateAttValues();
619 std::vector<G4AttValue>* pointAttValues = new std::vector<G4AttValue>;
620 std::map<G4String, G4AttDef>* pointAttDefs =
621 new std::map<G4String, G4AttDef>;
622
623 // Get first trajectory point's attributes and definitions in standard
624 // HepRep style (uniform units, 3Vectors decomposed).
625 if(rawPointAttValues)
626 {
627 G4bool error =
628 G4AttCheck(rawPointAttValues, aTrajectoryPoint->GetAttDefs())
629 .Standard(pointAttValues, pointAttDefs);
630 if(error)
631 {
632 G4cout << "G4HepRepFileSceneHandler::AddCompound(traj):"
633 "\nERROR found during conversion to standard first point "
634 "attributes."
635 << G4endl;
636 }
637
638 // Write out point attribute definitions.
639 if(pointAttValues && pointAttDefs)
640 {
641 for(iAttVal = pointAttValues->begin();
642 iAttVal != pointAttValues->end(); ++iAttVal)
643 {
644 iAttDef = pointAttDefs->find(iAttVal->GetName());
645 if(iAttDef != pointAttDefs->end())
646 {
647 // Protect against incorrect use of Category. Anything value
648 // other than the standard ones will be considered to be in the
649 // physics category.
650 G4String category = iAttDef->second.GetCategory();
651 if(strcmp(category, "Draw") != 0 &&
652 strcmp(category, "Physics") != 0 &&
653 strcmp(category, "Association") != 0 &&
654 strcmp(category, "PickAction") != 0)
655 category = "Physics";
656 // Do not write out the Aux or Pos attribute. Aux does not
657 // conform to the HepRep rule that each object can have only one
658 // instance of a given AttValue. Both of these attributes are
659 // redundant to actual position information of the point.
660 if(strcmp(iAttVal->GetName(), "Aux-X") != 0 &&
661 strcmp(iAttVal->GetName(), "Aux-Y") != 0 &&
662 strcmp(iAttVal->GetName(), "Aux-Z") != 0 &&
663 strcmp(iAttVal->GetName(), "Pos-X") != 0 &&
664 strcmp(iAttVal->GetName(), "Pos-Y") != 0 &&
665 strcmp(iAttVal->GetName(), "Pos-Z") != 0)
666 hepRepXMLWriter->addAttDef(iAttVal->GetName(),
667 iAttDef->second.GetDesc(), category,
668 iAttDef->second.GetExtra());
669 }
670 }
671 }
672 delete rawPointAttValues;
673 }
674
675 // Clean up point attributes.
676 if(pointAttValues)
677 delete pointAttValues;
678 if(pointAttDefs)
679 delete pointAttDefs;
680 }
681 } // end of special treatment for when this is the first trajectory.
682
683 // Now that we have written out all of the attributes that are based on the
684 // trajectory's particulars, call base class to deconstruct trajectory into
685 // polyline and/or points (or nothing if trajectory is to be filtered out). If
686 // base class calls for drawing points, no points will actually be drawn there
687 // since we instead need to do point drawing from here (in order to obtain the
688 // points attributes, not available from AddPrimitive(...point). Instead,
689 // such a call will just serve to set the flag that tells us that point
690 // drawing was requested for this trajectory (depends on several factors
691 // including trajContext and filtering).
692 drawingTraj = true;
693 doneInitTraj = false;
695 drawingTraj = false;
696
697 // Draw step points.
699 {
700 if(!doneInitTraj)
702 // Create Trajectory Points as a subType of Trajectories.
703 // Note that we should create this heprep type even if there are no actual
704 // points. This allows the user to tell that points don't exist (admittedly
705 // odd) rather than that they were omitted by the drawing mode.
706 previousName = hepRepXMLWriter->prevTypeName[2];
707 hepRepXMLWriter->addType("Trajectory Step Points", 2);
708
709 float redness;
710 float greenness;
711 float blueness;
712 G4int markSize;
713 G4bool visible;
714 G4bool square;
716 redness = colour.GetRed();
717 greenness = colour.GetGreen();
718 blueness = colour.GetBlue();
719 markSize = (G4int) trajContext->GetStepPtsSize();
720 visible = (G4int) trajContext->GetStepPtsVisible();
722
723 // Avoiding drawing anything black on black.
724 if(redness == 0. && greenness == 0. && blueness == 0.)
725 {
726 redness = 1.;
727 greenness = 1.;
728 blueness = 1.;
729 }
730
731 // Specify attributes common to all trajectory points.
732 if(strcmp("Trajectory Step Points", previousName) != 0)
733 {
734 hepRepXMLWriter->addAttValue("DrawAs", "Point");
735 hepRepXMLWriter->addAttValue("MarkColor", redness, greenness, blueness);
736 hepRepXMLWriter->addAttValue("MarkSize", markSize);
737 hepRepXMLWriter->addAttValue("Layer", 110);
738 hepRepXMLWriter->addAttValue("Visibility", visible);
739 if(square)
740 hepRepXMLWriter->addAttValue("MarkName", "square");
741 else
742 hepRepXMLWriter->addAttValue("MarkName", "dot");
743 }
744
745 // Loop over all points on this trajectory.
746 for(i = 0; i < traj.GetPointEntries(); i++)
747 {
748 G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(i);
749
750 // Each point is a separate instance of the type Trajectory Points.
752
753 // Pointers to hold trajectory point attribute values and definitions.
754 std::vector<G4AttValue>* rawPointAttValues =
755 aTrajectoryPoint->CreateAttValues();
756 std::vector<G4AttValue>* pointAttValues = new std::vector<G4AttValue>;
757 std::map<G4String, G4AttDef>* pointAttDefs =
758 new std::map<G4String, G4AttDef>;
759
760 // Get trajectory point attributes and definitions in standard HepRep
761 // style (uniform units, 3Vectors decomposed).
762 if(rawPointAttValues)
763 {
764 G4bool error =
765 G4AttCheck(rawPointAttValues, aTrajectoryPoint->GetAttDefs())
766 .Standard(pointAttValues, pointAttDefs);
767 if(error)
768 {
769 G4cout
770 << "G4HepRepFileSceneHandler::AddCompound(traj):"
771 "\nERROR found during conversion to standard point attributes."
772 << G4endl;
773 }
774
775 // Write out point attribute values.
776 if(pointAttValues)
777 {
778 for(iAttVal = pointAttValues->begin();
779 iAttVal != pointAttValues->end(); ++iAttVal)
780 // Do not write out the Aux or Pos attribute. Aux does not conform
781 // to the HepRep rule that each object can have only one instance of
782 // a given AttValue. Both of these attributes are redundant to
783 // actual position information of the point.
784 if(strcmp(iAttVal->GetName(), "Aux-X") != 0 &&
785 strcmp(iAttVal->GetName(), "Aux-Y") != 0 &&
786 strcmp(iAttVal->GetName(), "Aux-Z") != 0 &&
787 strcmp(iAttVal->GetName(), "Pos-X") != 0 &&
788 strcmp(iAttVal->GetName(), "Pos-Y") != 0 &&
789 strcmp(iAttVal->GetName(), "Pos-Z") != 0)
790 hepRepXMLWriter->addAttValue(iAttVal->GetName(),
791 iAttVal->GetValue());
792 }
793 }
794
795 // Clean up point attributes.
796 delete pointAttDefs;
797 delete pointAttValues;
798 delete rawPointAttValues;
799
800 // Each trajectory point is made of a single primitive, a point.
802 G4Point3D vertex = aTrajectoryPoint->GetPosition();
803 hepRepXMLWriter->addPoint(vertex.x(), vertex.y(), vertex.z());
804 }
805 }
806
807 // Draw Auxiliary Points
809 {
810 if(!doneInitTraj)
812 // Create Trajectory Points as a subType of Trajectories.
813 // Note that we should create this heprep type even if there are no actual
814 // points. This allows the user to tell that points don't exist (admittedly
815 // odd) rather than that they were omitted by the drawing mode.
816 previousName = hepRepXMLWriter->prevTypeName[2];
817 hepRepXMLWriter->addType("Trajectory Auxiliary Points", 2);
818
819 float redness;
820 float greenness;
821 float blueness;
822 G4int markSize;
823 G4bool visible;
824 G4bool square;
826 redness = colour.GetRed();
827 greenness = colour.GetGreen();
828 blueness = colour.GetBlue();
829 markSize = (G4int) trajContext->GetAuxPtsSize();
830 visible = (G4int) trajContext->GetAuxPtsVisible();
832
833 // Avoiding drawing anything black on black.
834 if(redness == 0. && greenness == 0. && blueness == 0.)
835 {
836 redness = 1.;
837 greenness = 1.;
838 blueness = 1.;
839 }
840
841 // Specify attributes common to all trajectory points.
842 if(strcmp("Trajectory Auxiliary Points", previousName) != 0)
843 {
844 hepRepXMLWriter->addAttValue("DrawAs", "Point");
845 hepRepXMLWriter->addAttValue("MarkColor", redness, greenness, blueness);
846 hepRepXMLWriter->addAttValue("MarkSize", markSize);
847 hepRepXMLWriter->addAttValue("Layer", 110);
848 hepRepXMLWriter->addAttValue("Visibility", visible);
849 if(square)
850 hepRepXMLWriter->addAttValue("MarkName", "Square");
851 else
852 hepRepXMLWriter->addAttValue("MarkName", "Dot");
853 }
854
855 // Loop over all points on this trajectory.
856 for(i = 0; i < traj.GetPointEntries(); i++)
857 {
858 G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(i);
859
860 // Each point is a separate instance of the type Trajectory Points.
862
863 // Pointers to hold trajectory point attribute values and definitions.
864 std::vector<G4AttValue>* rawPointAttValues =
865 aTrajectoryPoint->CreateAttValues();
866 std::vector<G4AttValue>* pointAttValues = new std::vector<G4AttValue>;
867 std::map<G4String, G4AttDef>* pointAttDefs =
868 new std::map<G4String, G4AttDef>;
869
870 // Get trajectory point attributes and definitions in standard HepRep
871 // style (uniform units, 3Vectors decomposed).
872 if(rawPointAttValues)
873 {
874 G4bool error =
875 G4AttCheck(rawPointAttValues, aTrajectoryPoint->GetAttDefs())
876 .Standard(pointAttValues, pointAttDefs);
877 if(error)
878 {
879 G4cout
880 << "G4HepRepFileSceneHandler::AddCompound(traj):"
881 "\nERROR found during conversion to standard point attributes."
882 << G4endl;
883 }
884
885 // Write out point attribute values.
886 if(pointAttValues)
887 {
888 for(iAttVal = pointAttValues->begin();
889 iAttVal != pointAttValues->end(); ++iAttVal)
890 // Do not write out the Aux or Pos attribute. Aux does not conform
891 // to the HepRep rule that each object can have only one instance of
892 // a given AttValue. Both of these attributes are redundant to
893 // actual position information of the point.
894 if(strcmp(iAttVal->GetName(), "Aux-X") != 0 &&
895 strcmp(iAttVal->GetName(), "Aux-Y") != 0 &&
896 strcmp(iAttVal->GetName(), "Aux-Z") != 0 &&
897 strcmp(iAttVal->GetName(), "Pos-X") != 0 &&
898 strcmp(iAttVal->GetName(), "Pos-Y") != 0 &&
899 strcmp(iAttVal->GetName(), "Pos-Z") != 0)
900 hepRepXMLWriter->addAttValue(iAttVal->GetName(),
901 iAttVal->GetValue());
902 }
903 }
904
905 // Clean up point attributes.
906 delete pointAttDefs;
907 delete pointAttValues;
908 delete rawPointAttValues;
909
910 // Each trajectory point is made of a single primitive, a point.
911 G4Point3D vertex = aTrajectoryPoint->GetPosition();
912
913 // Loop over auxiliary points associated with this Trajectory Point.
914 const std::vector<G4ThreeVector>* auxiliaries =
915 aTrajectoryPoint->GetAuxiliaryPoints();
916 if(0 != auxiliaries)
917 {
918 for(size_t iAux = 0; iAux < auxiliaries->size(); ++iAux)
919 {
920 const G4ThreeVector auxPos((*auxiliaries)[iAux]);
922 hepRepXMLWriter->addPoint(auxPos.x(), auxPos.y(), auxPos.z());
923 }
924 }
925 }
926 }
927}
int G4int
Definition: G4Types.hh:85
G4double GetBlue() const
Definition: G4Colour.hh:154
G4double GetRed() const
Definition: G4Colour.hh:152
G4double GetGreen() const
Definition: G4Colour.hh:153
void addPoint(double x, double y, double z)
virtual std::vector< G4AttValue > * CreateAttValues() const
virtual const std::vector< G4ThreeVector > * GetAuxiliaryPoints() const
virtual const G4ThreeVector GetPosition() const =0
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual G4VTrajectoryPoint * GetPoint(G4int i) const =0
virtual G4int GetPointEntries() const =0
virtual std::vector< G4AttValue > * CreateAttValues() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
G4bool GetDrawAuxPts() const
G4Colour GetStepPtsColour() const
G4double GetStepPtsSize() const
G4Polymarker::MarkerType GetAuxPtsType() const
G4double GetAuxPtsSize() const
G4Colour GetAuxPtsColour() const
G4bool GetAuxPtsVisible() const
G4bool GetStepPtsVisible() const
G4Polymarker::MarkerType GetStepPtsType() const
G4bool GetDrawStepPts() const

References G4HepRepFileXMLWriter::addAttDef(), G4HepRepFileXMLWriter::addAttValue(), G4VSceneHandler::AddCompound(), G4HepRepFileXMLWriter::addInstance(), G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), G4HepRepFileXMLWriter::addType(), CheckFileOpen(), G4VTrajectory::CreateAttValues(), G4VTrajectoryPoint::CreateAttValues(), doneInitTraj, drawingTraj, error, FatalException, G4VSceneHandler::fpModel, G4cout, G4endl, G4Exception(), G4VTrajectory::GetAttDefs(), G4VTrajectoryPoint::GetAttDefs(), G4VTrajectoryPoint::GetAuxiliaryPoints(), G4VisTrajContext::GetAuxPtsColour(), G4VisTrajContext::GetAuxPtsSize(), G4VisTrajContext::GetAuxPtsType(), G4VisTrajContext::GetAuxPtsVisible(), G4Colour::GetBlue(), G4VisTrajContext::GetDrawAuxPts(), G4VisTrajContext::GetDrawStepPts(), G4Colour::GetGreen(), G4VTrajectory::GetPoint(), G4VTrajectory::GetPointEntries(), G4VTrajectoryPoint::GetPosition(), G4Colour::GetRed(), G4VisTrajContext::GetStepPtsColour(), G4VisTrajContext::GetStepPtsSize(), G4VisTrajContext::GetStepPtsType(), G4VisTrajContext::GetStepPtsVisible(), hepRepXMLWriter, InitTrajectory(), G4HepRepFileXMLWriter::prevTypeName, G4Polymarker::squares, G4AttCheck::Standard(), trajAttDefs, trajAttValues, trajContext, HepGeom::BasicVector3D< T >::x(), CLHEP::Hep3Vector::x(), HepGeom::BasicVector3D< T >::y(), CLHEP::Hep3Vector::y(), HepGeom::BasicVector3D< T >::z(), and CLHEP::Hep3Vector::z().

◆ AddHepRepInstance()

void G4HepRepFileSceneHandler::AddHepRepInstance ( const char *  primName,
const G4Visible  visible 
)
private

Definition at line 1394 of file G4HepRepFileSceneHandler.cc.

1396{
1397#ifdef G4HEPREPFILEDEBUG
1398 G4cout << "G4HepRepFileSceneHandler::AddHepRepInstance called." << G4endl;
1399#endif
1400
1401 // Open the HepRep output file if it is not already open.
1402 CheckFileOpen();
1403
1404 G4VPhysicalVolume* pCurrentPV = 0;
1405 G4LogicalVolume* pCurrentLV = 0;
1406 G4int currentDepth = 0;
1407 G4PhysicalVolumeModel* pPVModel =
1408 dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
1409 if(pPVModel)
1410 {
1411 pCurrentPV = pPVModel->GetCurrentPV();
1412 pCurrentLV = pPVModel->GetCurrentLV();
1413 currentDepth = pPVModel->GetCurrentDepth();
1414 }
1415
1416#ifdef G4HEPREPFILEDEBUG
1417 G4cout << "pCurrentPV:" << pCurrentPV
1418 << ", readyForTransients:" << fReadyForTransients << G4endl;
1419#endif
1420
1421 if(drawingTraj || drawingHit)
1422 {
1423 // In this case, HepRep type, layer and instance were already created
1424 // in the AddCompound method.
1425 }
1426 else if(fReadyForTransients)
1427 {
1428 if(strcmp("Event Data", hepRepXMLWriter->prevTypeName[0]) != 0)
1429 {
1430 hepRepXMLWriter->addType("Event Data", 0);
1432 }
1433
1434 // Applications have the option of either calling AddSolid(G4VTrajectory&)
1435 // and AddSolid(G4VHits&), or of just decomposing these into simpler
1436 // primitives. In the former case, drawing will be handled above and will
1437 // include setting of physics attributes. In the latter case, which is an
1438 // older style of working, we end up drawing the trajectories and hits here,
1439 // where we have no access to physics attributes. We receive primitives
1440 // here. We can figure out that these are transients, but we have to guess
1441 // exactly what these transients represent. We assume the primitives are
1442 // being used as in G4VTrajectory, hence we assume: Lines are Trajectories
1443 // Squares that come after we've seen trajectories are Auxiliary Points
1444 // Circles that come after we've seen trajectories are Step Points
1445 // Other primitives are Hits
1446
1447 int layer;
1448
1449 if(strcmp("Text", primName) == 0)
1450 {
1451 hepRepXMLWriter->addType("EventID", 1);
1452 }
1453 else
1454 {
1455 if(strcmp("Line", primName) == 0)
1456 {
1457 hepRepXMLWriter->addType("TransientPolylines", 1);
1458 layer = 100;
1459 }
1460 else
1461 {
1462 if(strcmp(hepRepXMLWriter->prevTypeName[1], "TransientPolylines") ==
1463 0 &&
1464 strcmp("Square", primName) == 0)
1465 {
1466 hepRepXMLWriter->addType("AuxiliaryPoints", 2);
1467 layer = 110;
1468 }
1469 else
1470 {
1471 if(strcmp(hepRepXMLWriter->prevTypeName[1], "TransientPolylines") ==
1472 0 &&
1473 strcmp("Circle", primName) == 0)
1474 {
1475 hepRepXMLWriter->addType("StepPoints", 2);
1476 layer = 120;
1477 }
1478 else
1479 {
1480 hepRepXMLWriter->addType("Hits", 1);
1481 layer = 130;
1482 }
1483 }
1484 }
1485 hepRepXMLWriter->addAttValue("Layer", layer);
1486 }
1487
1489
1490 // Handle Type declaration for Axes, Ruler, etc.
1491 }
1492 else if(pCurrentPV == 0)
1493 {
1494 if(strcmp("AxesEtc", hepRepXMLWriter->prevTypeName[0]) != 0)
1495 {
1496 hepRepXMLWriter->addType("AxesEtc", 0);
1498 }
1499
1500 int layer;
1501
1502 if(strcmp("Text", primName) == 0)
1503 {
1504 hepRepXMLWriter->addType("Text", 1);
1505 }
1506 else
1507 {
1508 if(strcmp("Line", primName) == 0)
1509 {
1510 hepRepXMLWriter->addType("Polylines", 1);
1511 layer = 100;
1512 }
1513 else
1514 {
1515 hepRepXMLWriter->addType("Points", 1);
1516 layer = 130;
1517 }
1518 hepRepXMLWriter->addAttValue("Layer", layer);
1519 }
1520
1522
1523 // Handle Type declaration for Detector Geometry,
1524 // replacing G4's top geometry level name "worldPhysical" with the
1525 // name "Detector Geometry".
1526 }
1527 else
1528 {
1529 // G4cout << "CurrentDepth" << currentDepth << G4endl;
1530 // G4cout << "currentName" << pCurrentPV->GetName() << G4endl;
1531 if(strcmp("Detector Geometry", hepRepXMLWriter->prevTypeName[0]) != 0)
1532 {
1533 // G4cout << "Adding Det Geom type" << G4endl;
1534 hepRepXMLWriter->addType("Detector Geometry", 0);
1536 }
1537
1538 // Re-insert any layers of the hierarchy that were removed by G4's culling
1539 // process. Don't bother checking if same type name as last instance.
1540 if(strcmp(hepRepXMLWriter->prevTypeName[currentDepth + 1],
1541 pCurrentPV->GetName()) != 0)
1542 {
1543 // G4cout << "Looking for mother of:" << pCurrentLV->GetName() << G4endl;
1545 typedef std::vector<PVNodeID> PVPath;
1546 const PVPath& drawnPVPath = pPVModel->GetDrawnPVPath();
1547 PVPath::const_reverse_iterator ri = ++drawnPVPath.rbegin();
1548 G4int drawnMotherDepth;
1549 if(ri != drawnPVPath.rend())
1550 {
1551 // This volume has a mother.
1552 drawnMotherDepth = ri->GetNonCulledDepth();
1553 // G4cout << "drawnMotherDepth" << drawnMotherDepth << G4endl;
1554 }
1555 else
1556 {
1557 // This volume has no mother. Must be a top level volume.
1558 drawnMotherDepth = -1;
1559 // G4cout << "Mother must be very top" << G4endl;
1560 }
1561
1562 while(drawnMotherDepth < (currentDepth - 1))
1563 {
1564 G4String culledParentName = "Culled parent of " + pCurrentPV->GetName();
1565 // G4cout << "Inserting culled layer " << culledParentName << " at
1566 // depth:" << drawnMotherDepth+2 << G4endl;
1567 hepRepXMLWriter->addType(culledParentName, drawnMotherDepth + 2);
1569 drawnMotherDepth++;
1570 }
1571 }
1572
1573 // Add the HepRepType for the current volume.
1574 hepRepXMLWriter->addType(pCurrentPV->GetName(), currentDepth + 1);
1576
1578
1579 if(fpVisAttribs && (fpVisAttribs->IsVisible() == 0) &&
1580 messenger->getCullInvisibles())
1581 return;
1582
1583 // Additional attributes.
1585 hepRepXMLWriter->addAttValue("LVol", pCurrentLV->GetName());
1586 G4Region* region = pCurrentLV->GetRegion();
1587 G4String regionName = region ? region->GetName() : G4String("No region");
1588 hepRepXMLWriter->addAttValue("Region", regionName);
1589 hepRepXMLWriter->addAttValue("RootRegion", pCurrentLV->IsRootRegion());
1590 hepRepXMLWriter->addAttValue("Solid", pCurrentLV->GetSolid()->GetName());
1592 pCurrentLV->GetSolid()->GetEntityType());
1593 G4Material* material = pPVModel->GetCurrentMaterial();
1594 G4String matName = material ? material->GetName() : G4String("No material");
1595 hepRepXMLWriter->addAttValue("Material", matName);
1596 G4double matDensity = material ? material->GetDensity() : 0.;
1597 hepRepXMLWriter->addAttValue("Density", matDensity * m3 / kg);
1598 G4State matState = material ? material->GetState() : kStateUndefined;
1599 hepRepXMLWriter->addAttValue("State", matState);
1600 G4double matRadlen = material ? material->GetRadlen() : 0.;
1601 hepRepXMLWriter->addAttValue("Radlen", matRadlen / m);
1602 }
1603
1604 hepRepXMLWriter->addAttValue("DrawAs", primName);
1605
1606 // Handle color and visibility attributes.
1607 float redness;
1608 float greenness;
1609 float blueness;
1610 G4bool isVisible;
1611
1613 {
1614 G4Colour colour;
1615
1616 if(fpVisAttribs)
1617 {
1618 colour = fpVisAttribs->GetColour();
1619 isVisible = fpVisAttribs->IsVisible();
1620 }
1621 else
1622 {
1623 colour = visible.GetVisAttributes()->GetColour();
1624 isVisible =
1626 ->IsVisible();
1627 }
1628
1629 redness = colour.GetRed();
1630 greenness = colour.GetGreen();
1631 blueness = colour.GetBlue();
1632
1633 // Avoiding drawing anything black on black.
1634 if(redness == 0. && greenness == 0. && blueness == 0.)
1635 {
1636 redness = 1.;
1637 greenness = 1.;
1638 blueness = 1.;
1639 }
1640 }
1641 else
1642 {
1643#ifdef G4HEPREPFILEDEBUG
1644 G4cout
1645 << "G4HepRepFileSceneHandler::AddHepRepInstance using default colour."
1646 << G4endl;
1647#endif
1648 redness = 1.;
1649 greenness = 1.;
1650 blueness = 1.;
1651 isVisible = true;
1652 }
1653
1654 if(strcmp(primName, "Point") == 0)
1655 hepRepXMLWriter->addAttValue("MarkColor", redness, greenness, blueness);
1656 else
1657 hepRepXMLWriter->addAttValue("LineColor", redness, greenness, blueness);
1658
1659 hepRepXMLWriter->addAttValue("Visibility", isVisible);
1660}
G4State
Definition: G4Material.hh:111
@ kStateUndefined
Definition: G4Material.hh:111
static constexpr double kg
Definition: G4SIunits.hh:167
static constexpr double m
Definition: G4SIunits.hh:109
static constexpr double m3
Definition: G4SIunits.hh:111
double G4double
Definition: G4Types.hh:83
virtual G4bool getCullInvisibles()
static G4HepRepMessenger * GetInstance()
G4bool IsRootRegion() const
G4Region * GetRegion() const
const G4String & GetName() const
const std::vector< G4PhysicalVolumeNodeID > & GetDrawnPVPath() const
G4VPhysicalVolume * GetCurrentPV() const
G4LogicalVolume * GetCurrentLV() const
G4Material * GetCurrentMaterial() const
const G4String & GetName() const
G4VViewer * fpViewer
const G4VisAttributes * fpVisAttribs
G4String GetName() const
virtual G4GeometryType GetEntityType() const =0
const G4VisAttributes * GetApplicableVisAttributes(const G4VisAttributes *) const
const G4Colour & GetColour() const
G4bool IsVisible() const
const G4VisAttributes * GetVisAttributes() const
string material
Definition: eplot.py:19

References G4HepRepFileXMLWriter::addAttValue(), G4HepRepFileXMLWriter::addInstance(), G4HepRepFileXMLWriter::addType(), CheckFileOpen(), drawingHit, drawingTraj, G4VSceneHandler::fpModel, G4VSceneHandler::fpViewer, G4VSceneHandler::fpVisAttribs, G4VSceneHandler::fReadyForTransients, G4cout, G4endl, G4VViewer::GetApplicableVisAttributes(), G4Colour::GetBlue(), G4VisAttributes::GetColour(), G4HepRepMessenger::getCullInvisibles(), G4PhysicalVolumeModel::GetCurrentDepth(), G4PhysicalVolumeModel::GetCurrentLV(), G4PhysicalVolumeModel::GetCurrentMaterial(), G4PhysicalVolumeModel::GetCurrentPV(), G4PhysicalVolumeModel::GetDrawnPVPath(), G4VSolid::GetEntityType(), G4Colour::GetGreen(), G4HepRepMessenger::GetInstance(), G4LogicalVolume::GetName(), G4Region::GetName(), G4VPhysicalVolume::GetName(), G4VSolid::GetName(), G4Colour::GetRed(), G4LogicalVolume::GetRegion(), G4LogicalVolume::GetSolid(), G4Visible::GetVisAttributes(), haveVisible, hepRepXMLWriter, G4LogicalVolume::IsRootRegion(), G4VisAttributes::IsVisible(), kg, kStateUndefined, m, m3, eplot::material, G4HepRepFileXMLWriter::prevTypeName, and G4HepRepFileXMLWriter::typeDepth.

Referenced by AddPrimitive(), and AddSolid().

◆ AddPrimitive() [1/13]

void G4HepRepFileSceneHandler::AddPrimitive ( const G4Circle circle)
virtual

Implements G4VSceneHandler.

Definition at line 1244 of file G4HepRepFileSceneHandler.cc.

1245{
1246#ifdef G4HEPREPFILEDEBUG
1247 G4cout
1248 << "G4HepRepFileSceneHandler::AddPrimitive(const G4Circle& circle) called:"
1249 "\n radius: "
1250 << circle.GetWorldRadius() << G4endl;
1251 PrintThings();
1252#endif
1253
1255
1256 if(fpVisAttribs && (fpVisAttribs->IsVisible() == 0) &&
1257 messenger->getCullInvisibles())
1258 return;
1259
1260 if(inPrimitives2D)
1261 {
1263 {
1264 G4cout << "HepRepFile does not currently support 2D circles." << G4endl;
1265 warnedAbout2DMarkers = true;
1266 }
1267 return;
1268 }
1269
1270 MarkerSizeType sizeType;
1271 G4double size = GetMarkerSize(circle, sizeType);
1272 if(sizeType == world)
1273 size = 4.;
1274
1275 if(drawingTraj)
1276 return;
1277
1278 if(drawingHit)
1279 InitHit();
1280
1281 haveVisible = true;
1282 AddHepRepInstance("Point", circle);
1283
1284 hepRepXMLWriter->addAttValue("MarkName", "Dot");
1285 hepRepXMLWriter->addAttValue("MarkSize", (G4int) size);
1286
1288
1289 G4Point3D center = (fObjectTransformation) *circle.GetPosition();
1290 hepRepXMLWriter->addPoint(center.x(), center.y(), center.z());
1291}
void AddHepRepInstance(const char *primName, const G4Visible visible)
G4Point3D GetPosition() const
G4double GetWorldRadius() const
G4Transform3D fObjectTransformation
G4double GetMarkerSize(const G4VMarker &, MarkerSizeType &)

References G4HepRepFileXMLWriter::addAttValue(), AddHepRepInstance(), G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), drawingHit, drawingTraj, G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4HepRepMessenger::getCullInvisibles(), G4HepRepMessenger::GetInstance(), G4VSceneHandler::GetMarkerSize(), G4VMarker::GetPosition(), G4VMarker::GetWorldRadius(), haveVisible, hepRepXMLWriter, InitHit(), inPrimitives2D, G4VisAttributes::IsVisible(), warnedAbout2DMarkers, G4VSceneHandler::world, HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ AddPrimitive() [2/13]

virtual void G4VSceneHandler::AddPrimitive ( const G4Circle )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [3/13]

void G4VSceneHandler::AddPrimitive ( const G4Plotter )
virtual

Reimplemented from G4VSceneHandler.

Definition at line 192 of file G4VSceneHandler.cc.

501 {
502 G4cerr << "WARNING: Plotter not implemented for " << fSystem.GetName() << G4endl;
503 G4cerr << " Open a plotter-aware graphics system or remove plotter with" << G4endl;
504 G4cerr << " /vis/scene/removeModel Plotter" << G4endl;
505}
G4GLOB_DLL std::ostream G4cerr
const G4String & GetName() const
G4VGraphicsSystem & fSystem

◆ AddPrimitive() [4/13]

void G4HepRepFileSceneHandler::AddPrimitive ( const G4Polyhedron polyhedron)
virtual

Implements G4VSceneHandler.

Definition at line 1342 of file G4HepRepFileSceneHandler.cc.

1343{
1344#ifdef G4HEPREPFILEDEBUG
1345 G4cout << "G4HepRepFileSceneHandler::AddPrimitive(const G4Polyhedron& "
1346 "polyhedron) called."
1347 << G4endl;
1348 PrintThings();
1349#endif
1350
1352
1353 if(fpVisAttribs && (fpVisAttribs->IsVisible() == 0) &&
1354 messenger->getCullInvisibles())
1355 return;
1356
1357 if(polyhedron.GetNoFacets() == 0)
1358 return;
1359
1360 if(drawingTraj)
1361 return;
1362
1363 if(drawingHit)
1364 InitHit();
1365
1366 haveVisible = true;
1367 AddHepRepInstance("Polygon", polyhedron);
1368
1369 G4Normal3D surfaceNormal;
1370 G4Point3D vertex;
1371
1372 G4bool notLastFace;
1373 do
1374 {
1376 notLastFace = polyhedron.GetNextNormal(surfaceNormal);
1377
1378 G4int edgeFlag = 1;
1379 G4bool notLastEdge;
1380 do
1381 {
1382 notLastEdge = polyhedron.GetNextVertex(vertex, edgeFlag);
1383 vertex = (fObjectTransformation) *vertex;
1384 hepRepXMLWriter->addPoint(vertex.x(), vertex.y(), vertex.z());
1385 } while(notLastEdge);
1386 } while(notLastFace);
1387}
G4bool GetNextNormal(G4Normal3D &normal) const
G4bool GetNextVertex(G4Point3D &vertex, G4int &edgeFlag) const
G4int GetNoFacets() const

References AddHepRepInstance(), G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), drawingHit, drawingTraj, G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4HepRepMessenger::getCullInvisibles(), G4HepRepMessenger::GetInstance(), HepPolyhedron::GetNextNormal(), HepPolyhedron::GetNextVertex(), HepPolyhedron::GetNoFacets(), haveVisible, hepRepXMLWriter, InitHit(), G4VisAttributes::IsVisible(), HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ AddPrimitive() [5/13]

virtual void G4VSceneHandler::AddPrimitive ( const G4Polyhedron )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [6/13]

void G4HepRepFileSceneHandler::AddPrimitive ( const G4Polyline polyline)
virtual

Implements G4VSceneHandler.

Definition at line 1087 of file G4HepRepFileSceneHandler.cc.

1088{
1089#ifdef G4HEPREPFILEDEBUG
1090 G4cout << "G4HepRepFileSceneHandler::AddPrimitive(const G4Polyline& "
1091 "polyline) called:"
1092 "\n polyline: "
1093 << polyline << G4endl;
1094 PrintThings();
1095#endif
1096
1098
1099 if(fpVisAttribs && (fpVisAttribs->IsVisible() == 0) &&
1100 messenger->getCullInvisibles())
1101 return;
1102
1103 if(inPrimitives2D)
1104 {
1106 {
1107 G4cout << "HepRepFile does not currently support 2D lines." << G4endl;
1108 warnedAbout2DMarkers = true;
1109 }
1110 return;
1111 }
1112
1113 if(drawingTraj)
1115
1116 if(drawingHit)
1117 InitHit();
1118
1119 haveVisible = true;
1120 AddHepRepInstance("Line", polyline);
1121
1123
1124 for(size_t i = 0; i < polyline.size(); i++)
1125 {
1126 G4Point3D vertex = (fObjectTransformation) *polyline[i];
1127 hepRepXMLWriter->addPoint(vertex.x(), vertex.y(), vertex.z());
1128 }
1129}

References AddHepRepInstance(), G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), drawingHit, drawingTraj, G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4HepRepMessenger::getCullInvisibles(), G4HepRepMessenger::GetInstance(), haveVisible, hepRepXMLWriter, InitHit(), InitTrajectory(), inPrimitives2D, G4VisAttributes::IsVisible(), warnedAbout2DMarkers, HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ AddPrimitive() [7/13]

virtual void G4VSceneHandler::AddPrimitive ( const G4Polyline )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [8/13]

void G4VSceneHandler::AddPrimitive ( const G4Polymarker polymarker)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 190 of file G4VSceneHandler.cc.

458 {
459 switch (polymarker.GetMarkerType()) {
460 default:
462 {
463 G4Circle dot (polymarker);
464 dot.SetWorldSize (0.);
465 dot.SetScreenSize (0.1); // Very small circle.
466 for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
467 dot.SetPosition (polymarker[iPoint]);
468 AddPrimitive (dot);
469 }
470 }
471 break;
473 {
474 G4Circle circle (polymarker); // Default circle
475 for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
476 circle.SetPosition (polymarker[iPoint]);
477 AddPrimitive (circle);
478 }
479 }
480 break;
482 {
483 G4Square square (polymarker); // Default square
484 for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
485 square.SetPosition (polymarker[iPoint]);
486 AddPrimitive (square);
487 }
488 }
489 break;
490 }
491}
void AddPrimitive(const G4Polyline &)
MarkerType GetMarkerType() const

◆ AddPrimitive() [9/13]

void G4HepRepFileSceneHandler::AddPrimitive ( const G4Polymarker line)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 1131 of file G4HepRepFileSceneHandler.cc.

1132{
1133#ifdef G4HEPREPFILEDEBUG
1134 G4cout
1135 << "G4HepRepFileSceneHandler::AddPrimitive(const G4Polymarker& line) called"
1136 << G4endl;
1137 PrintThings();
1138#endif
1139
1141
1142 if(fpVisAttribs && (fpVisAttribs->IsVisible() == 0) &&
1143 messenger->getCullInvisibles())
1144 return;
1145
1146 if(inPrimitives2D)
1147 {
1149 {
1150 G4cout << "HepRepFile does not currently support 2D lines." << G4endl;
1151 warnedAbout2DMarkers = true;
1152 }
1153 return;
1154 }
1155
1156 MarkerSizeType sizeType;
1157 G4double size = GetMarkerSize(line, sizeType);
1158 if(sizeType == world)
1159 size = 4.;
1160
1161 if(drawingTraj)
1162 return;
1163
1164 if(drawingHit)
1165 InitHit();
1166
1167 haveVisible = true;
1168 AddHepRepInstance("Point", line);
1169
1170 hepRepXMLWriter->addAttValue("MarkName", "Dot");
1171 hepRepXMLWriter->addAttValue("MarkSize", (G4int) size);
1172
1174
1175 for(size_t i = 0; i < line.size(); i++)
1176 {
1177 G4Point3D vertex = (fObjectTransformation) *line[i];
1178 hepRepXMLWriter->addPoint(vertex.x(), vertex.y(), vertex.z());
1179 }
1180}

References G4HepRepFileXMLWriter::addAttValue(), AddHepRepInstance(), G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), drawingHit, drawingTraj, G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4HepRepMessenger::getCullInvisibles(), G4HepRepMessenger::GetInstance(), G4VSceneHandler::GetMarkerSize(), haveVisible, hepRepXMLWriter, InitHit(), inPrimitives2D, G4VisAttributes::IsVisible(), warnedAbout2DMarkers, G4VSceneHandler::world, HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ AddPrimitive() [10/13]

void G4HepRepFileSceneHandler::AddPrimitive ( const G4Square square)
virtual

Implements G4VSceneHandler.

Definition at line 1293 of file G4HepRepFileSceneHandler.cc.

1294{
1295#ifdef G4HEPREPFILEDEBUG
1296 G4cout
1297 << "G4HepRepFileSceneHandler::AddPrimitive(const G4Square& square) called:"
1298 "\n side: "
1299 << square.GetWorldRadius() << G4endl;
1300 PrintThings();
1301#endif
1302
1304
1305 if(fpVisAttribs && (fpVisAttribs->IsVisible() == 0) &&
1306 messenger->getCullInvisibles())
1307 return;
1308
1309 if(inPrimitives2D)
1310 {
1312 {
1313 G4cout << "HepRepFile does not currently support 2D squares." << G4endl;
1314 warnedAbout2DMarkers = true;
1315 }
1316 return;
1317 }
1318
1319 MarkerSizeType sizeType;
1320 G4double size = GetMarkerSize(square, sizeType);
1321 if(sizeType == world)
1322 size = 4.;
1323
1324 if(drawingTraj)
1325 return;
1326
1327 if(drawingHit)
1328 InitHit();
1329
1330 haveVisible = true;
1331 AddHepRepInstance("Point", square);
1332
1333 hepRepXMLWriter->addAttValue("MarkName", "Square");
1334 hepRepXMLWriter->addAttValue("MarkSize", (G4int) size);
1335
1337
1338 G4Point3D center = (fObjectTransformation) *square.GetPosition();
1339 hepRepXMLWriter->addPoint(center.x(), center.y(), center.z());
1340}

References G4HepRepFileXMLWriter::addAttValue(), AddHepRepInstance(), G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), drawingHit, drawingTraj, G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4HepRepMessenger::getCullInvisibles(), G4HepRepMessenger::GetInstance(), G4VSceneHandler::GetMarkerSize(), G4VMarker::GetPosition(), G4VMarker::GetWorldRadius(), haveVisible, hepRepXMLWriter, InitHit(), inPrimitives2D, G4VisAttributes::IsVisible(), warnedAbout2DMarkers, G4VSceneHandler::world, HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ AddPrimitive() [11/13]

virtual void G4VSceneHandler::AddPrimitive ( const G4Square )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [12/13]

void G4HepRepFileSceneHandler::AddPrimitive ( const G4Text text)
virtual

Implements G4VSceneHandler.

Definition at line 1182 of file G4HepRepFileSceneHandler.cc.

1183{
1184#ifdef G4HEPREPFILEDEBUG
1185 G4cout << "G4HepRepFileSceneHandler::AddPrimitive(const G4Text& text) called:"
1186 "\n text: "
1187 << text.GetText() << G4endl;
1188 PrintThings();
1189#endif
1190
1191 if(!inPrimitives2D)
1192 {
1194 {
1195 G4cout << "HepRepFile does not currently support 3D text." << G4endl;
1196 G4cout
1197 << "HepRep browsers can directly display text attributes on request."
1198 << G4endl;
1199 G4cout << "See Application Developers Guide for how to attach attributes "
1200 "to viewable objects."
1201 << G4endl;
1202 warnedAbout3DText = true;
1203 }
1204 return;
1205 }
1206
1207 MarkerSizeType sizeType;
1208 G4double size = GetMarkerSize(text, sizeType);
1209 if(sizeType == world)
1210 size = 12.;
1211
1212 haveVisible = true;
1213 AddHepRepInstance("Text", text);
1214
1215 hepRepXMLWriter->addAttValue("VAlign", "Top");
1216 hepRepXMLWriter->addAttValue("HAlign", "Left");
1217 hepRepXMLWriter->addAttValue("FontName", "Arial");
1218 hepRepXMLWriter->addAttValue("FontStyle", "Plain");
1219 hepRepXMLWriter->addAttValue("FontSize", (G4int) size);
1220 hepRepXMLWriter->addAttValue("FontHasBanner", "TRUE");
1221 hepRepXMLWriter->addAttValue("FontBannerColor", "0,0,0");
1222
1223 const G4Colour& colour = GetTextColour(text);
1224 float redness = colour.GetRed();
1225 float greenness = colour.GetGreen();
1226 float blueness = colour.GetBlue();
1227
1228 // Avoiding drawing anything black on black.
1229 if(redness == 0. && greenness == 0. && blueness == 0.)
1230 {
1231 redness = 1.;
1232 greenness = 1.;
1233 blueness = 1.;
1234 }
1235 hepRepXMLWriter->addAttValue("FontColor", redness, greenness, blueness);
1236
1238
1239 hepRepXMLWriter->addAttValue("Text", text.GetText());
1240 hepRepXMLWriter->addAttValue("VPos", .99 - text.GetYOffset());
1241 hepRepXMLWriter->addAttValue("HPos", text.GetXOffset());
1242}
G4double GetYOffset() const
G4double GetXOffset() const
G4String GetText() const
const G4Colour & GetTextColour(const G4Text &)

References G4HepRepFileXMLWriter::addAttValue(), AddHepRepInstance(), G4HepRepFileXMLWriter::addPrimitive(), G4cout, G4endl, G4Colour::GetBlue(), G4Colour::GetGreen(), G4VSceneHandler::GetMarkerSize(), G4Colour::GetRed(), G4Text::GetText(), G4VSceneHandler::GetTextColour(), G4Text::GetXOffset(), G4Text::GetYOffset(), haveVisible, hepRepXMLWriter, inPrimitives2D, warnedAbout3DText, and G4VSceneHandler::world.

◆ AddPrimitive() [13/13]

virtual void G4VSceneHandler::AddPrimitive ( const G4Text )
virtual

Implements G4VSceneHandler.

◆ AddSolid() [1/14]

void G4HepRepFileSceneHandler::AddSolid ( const G4Box box)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 145 of file G4HepRepFileSceneHandler.cc.

146{
147#ifdef G4HEPREPFILEDEBUG
148 G4cout << "G4HepRepFileSceneHandler::AddSolid(const G4Box& box) called for "
149 << box.GetName() << G4endl;
150 PrintThings();
151#endif
152
153 if(drawingTraj)
154 return;
155
156 if(drawingHit)
157 InitHit();
158
159 haveVisible = false;
160 AddHepRepInstance("Prism", NULL);
161
163
164 // Get and check applicable vis attributes.
166 if(fpVisAttribs && (fpVisAttribs->IsVisible() == 0) &&
167 messenger->getCullInvisibles())
168 return;
169
171
172 G4double dx = box.GetXHalfLength();
173 G4double dy = box.GetYHalfLength();
174 G4double dz = box.GetZHalfLength();
175
176 G4Point3D vertex1(G4Point3D(dx, dy, -dz));
177 G4Point3D vertex2(G4Point3D(dx, -dy, -dz));
178 G4Point3D vertex3(G4Point3D(-dx, -dy, -dz));
179 G4Point3D vertex4(G4Point3D(-dx, dy, -dz));
180 G4Point3D vertex5(G4Point3D(dx, dy, dz));
181 G4Point3D vertex6(G4Point3D(dx, -dy, dz));
182 G4Point3D vertex7(G4Point3D(-dx, -dy, dz));
183 G4Point3D vertex8(G4Point3D(-dx, dy, dz));
184
185 vertex1 = (fObjectTransformation) *vertex1;
186 vertex2 = (fObjectTransformation) *vertex2;
187 vertex3 = (fObjectTransformation) *vertex3;
188 vertex4 = (fObjectTransformation) *vertex4;
189 vertex5 = (fObjectTransformation) *vertex5;
190 vertex6 = (fObjectTransformation) *vertex6;
191 vertex7 = (fObjectTransformation) *vertex7;
192 vertex8 = (fObjectTransformation) *vertex8;
193
194 hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z());
195 hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z());
196 hepRepXMLWriter->addPoint(vertex3.x(), vertex3.y(), vertex3.z());
197 hepRepXMLWriter->addPoint(vertex4.x(), vertex4.y(), vertex4.z());
198 hepRepXMLWriter->addPoint(vertex5.x(), vertex5.y(), vertex5.z());
199 hepRepXMLWriter->addPoint(vertex6.x(), vertex6.y(), vertex6.z());
200 hepRepXMLWriter->addPoint(vertex7.x(), vertex7.y(), vertex7.z());
201 hepRepXMLWriter->addPoint(vertex8.x(), vertex8.y(), vertex8.z());
202}
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:34
G4double GetYHalfLength() const
G4double GetZHalfLength() const
G4double GetXHalfLength() const

References AddHepRepInstance(), G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), drawingHit, drawingTraj, G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpViewer, G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4VViewer::GetApplicableVisAttributes(), G4HepRepMessenger::getCullInvisibles(), G4HepRepMessenger::GetInstance(), G4VSolid::GetName(), G4Box::GetXHalfLength(), G4Box::GetYHalfLength(), G4Box::GetZHalfLength(), haveVisible, hepRepXMLWriter, InitHit(), G4VisAttributes::IsVisible(), HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ AddSolid() [2/14]

void G4HepRepFileSceneHandler::AddSolid ( const G4Cons cons)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 204 of file G4HepRepFileSceneHandler.cc.

205{
206#ifdef G4HEPREPFILEDEBUG
207 G4cout << "G4HepRepFileSceneHandler::AddSolid(const G4Cons& cons) called for "
208 << cons.GetName() << G4endl;
209 PrintThings();
210#endif
211
212 // HepRApp does not correctly represent the end faces of cones at
213 // non-standard angles, let the base class convert these solids to polygons.
215 G4bool linedUpWithAnAxis =
216 (std::fabs(r.phiX()) <= .001 || std::fabs(r.phiY()) <= .001 ||
217 std::fabs(r.phiZ()) <= .001 || std::fabs(r.phiX() - pi) <= .001 ||
218 std::fabs(r.phiY() - pi) <= .001 || std::fabs(r.phiZ() - pi) <= .001);
219 // G4cout << "Angle X:" << r.phiX() << ", Angle Y:" << r.phiY() << ", Angle
220 // Z:" << r.phiZ() << G4endl; G4cout << "linedUpWithAnAxis:" <<
221 // linedUpWithAnAxis << G4endl;
222
223 // HepRep does not have a primitive for a cut cone,
224 // so if this cone is cut, let the base class convert this
225 // solid to polygons.
227 if(cons.GetDeltaPhiAngle() < twopi || !linedUpWithAnAxis ||
228 messenger->renderCylAsPolygons())
229 {
230 G4VSceneHandler::AddSolid(cons); // Invoke default action.
231 }
232 else
233 {
234 if(drawingTraj)
235 return;
236
237 if(drawingHit)
238 InitHit();
239
240 haveVisible = false;
241 AddHepRepInstance("Cylinder", NULL);
242
243 // Get and check applicable vis attributes.
245 if(fpVisAttribs && (fpVisAttribs->IsVisible() == 0) &&
246 messenger->getCullInvisibles())
247 return;
248
249 G4Point3D vertex1(G4Point3D(0., 0., -cons.GetZHalfLength()));
250 G4Point3D vertex2(G4Point3D(0., 0., cons.GetZHalfLength()));
251
252 vertex1 = (fObjectTransformation) *vertex1;
253 vertex2 = (fObjectTransformation) *vertex2;
254
255 // Outer cylinder.
257 hepRepXMLWriter->addAttValue("Radius1", messenger->getScale() *
258 cons.GetOuterRadiusMinusZ());
259 hepRepXMLWriter->addAttValue("Radius2", messenger->getScale() *
260 cons.GetOuterRadiusPlusZ());
261 hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z());
262 hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z());
263
264 // Inner cylinder.
266 hepRepXMLWriter->addAttValue("Radius1", messenger->getScale() *
267 cons.GetInnerRadiusMinusZ());
268 hepRepXMLWriter->addAttValue("Radius2", messenger->getScale() *
269 cons.GetInnerRadiusPlusZ());
270 hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z());
271 hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z());
272 }
273}
static constexpr double twopi
Definition: G4SIunits.hh:56
static constexpr double pi
Definition: G4SIunits.hh:55
double phiY() const
Definition: Rotation.cc:128
double phiX() const
Definition: Rotation.cc:124
double phiZ() const
Definition: Rotation.cc:132
G4double GetOuterRadiusPlusZ() const
G4double GetDeltaPhiAngle() const
G4double GetInnerRadiusMinusZ() const
G4double GetInnerRadiusPlusZ() const
G4double GetOuterRadiusMinusZ() const
G4double GetZHalfLength() const
virtual G4bool renderCylAsPolygons()
virtual G4double getScale()
virtual void AddSolid(const G4Box &)
CLHEP::HepRotation getRotation() const

References G4HepRepFileXMLWriter::addAttValue(), AddHepRepInstance(), G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), G4VSceneHandler::AddSolid(), drawingHit, drawingTraj, G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpViewer, G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4VViewer::GetApplicableVisAttributes(), G4HepRepMessenger::getCullInvisibles(), G4Cons::GetDeltaPhiAngle(), G4Cons::GetInnerRadiusMinusZ(), G4Cons::GetInnerRadiusPlusZ(), G4HepRepMessenger::GetInstance(), G4VSolid::GetName(), G4Cons::GetOuterRadiusMinusZ(), G4Cons::GetOuterRadiusPlusZ(), HepGeom::Transform3D::getRotation(), G4HepRepMessenger::getScale(), G4Cons::GetZHalfLength(), haveVisible, hepRepXMLWriter, InitHit(), G4VisAttributes::IsVisible(), CLHEP::HepRotation::phiX(), CLHEP::HepRotation::phiY(), CLHEP::HepRotation::phiZ(), pi, G4HepRepMessenger::renderCylAsPolygons(), twopi, HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ AddSolid() [3/14]

void G4HepRepFileSceneHandler::AddSolid ( const G4Ellipsoid ellipsoid)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 484 of file G4HepRepFileSceneHandler.cc.

485{
486#ifdef G4HEPREPFILEDEBUG
487 G4cout << "G4HepRepFileSceneHandler::AddSolid(const G4Ellipsoid& ellipsoid) "
488 "called for "
489 << ellipsoid.GetName() << G4endl;
490 PrintThings();
491#endif
492 G4VSceneHandler::AddSolid(ellipsoid); // Invoke default action.
493}

References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().

◆ AddSolid() [4/14]

void G4HepRepFileSceneHandler::AddSolid ( const G4Orb orb)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 474 of file G4HepRepFileSceneHandler.cc.

475{
476#ifdef G4HEPREPFILEDEBUG
477 G4cout << "G4HepRepFileSceneHandler::AddSolid(const G4Orb& orb) called for "
478 << orb.GetName() << G4endl;
479 PrintThings();
480#endif
481 G4VSceneHandler::AddSolid(orb); // Invoke default action.
482}

References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().

◆ AddSolid() [5/14]

void G4HepRepFileSceneHandler::AddSolid ( const G4Para para)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 431 of file G4HepRepFileSceneHandler.cc.

432{
433#ifdef G4HEPREPFILEDEBUG
434 G4cout << "G4HepRepFileSceneHandler::AddSolid(const G4Para& para) called for "
435 << para.GetName() << G4endl;
436 PrintThings();
437#endif
438 G4VSceneHandler::AddSolid(para); // Invoke default action.
439}

References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().

◆ AddSolid() [6/14]

void G4HepRepFileSceneHandler::AddSolid ( const G4Polycone polycone)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 452 of file G4HepRepFileSceneHandler.cc.

453{
454#ifdef G4HEPREPFILEDEBUG
455 G4cout << "G4HepRepFileSceneHandler::AddSolid(const G4Polycone& polycone) "
456 "called for "
457 << polycone.GetName() << G4endl;
458 PrintThings();
459#endif
460 G4VSceneHandler::AddSolid(polycone); // Invoke default action.
461}

References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().

◆ AddSolid() [7/14]

void G4HepRepFileSceneHandler::AddSolid ( const G4Polyhedra polyhedra)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 463 of file G4HepRepFileSceneHandler.cc.

464{
465#ifdef G4HEPREPFILEDEBUG
466 G4cout << "G4HepRepFileSceneHandler::AddSolid(const G4Polyhedra& polyhedra) "
467 "called for "
468 << polyhedra.GetName() << G4endl;
469 PrintThings();
470#endif
471 G4VSceneHandler::AddSolid(polyhedra); // Invoke default action.
472}

References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().

◆ AddSolid() [8/14]

void G4HepRepFileSceneHandler::AddSolid ( const G4Sphere sphere)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 420 of file G4HepRepFileSceneHandler.cc.

421{
422#ifdef G4HEPREPFILEDEBUG
423 G4cout
424 << "G4HepRepFileSceneHandler::AddSolid(const G4Sphere& sphere) called for "
425 << sphere.GetName() << G4endl;
426 PrintThings();
427#endif
428 G4VSceneHandler::AddSolid(sphere); // Invoke default action.
429}

References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().

◆ AddSolid() [9/14]

void G4HepRepFileSceneHandler::AddSolid ( const G4TessellatedSolid tess)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 495 of file G4HepRepFileSceneHandler.cc.

496{
497#ifdef G4HEPREPFILEDEBUG
498 G4cout << "G4HepRepFileSceneHandler::AddSolid(const G4TessellatedSolid& ) "
499 "called for "
500 << tess.GetName() << G4endl;
501 PrintThings();
502#endif
503 G4VSceneHandler::AddSolid(tess); // Invoke default action.
504}

References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().

◆ AddSolid() [10/14]

void G4HepRepFileSceneHandler::AddSolid ( const G4Torus torus)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 441 of file G4HepRepFileSceneHandler.cc.

442{
443#ifdef G4HEPREPFILEDEBUG
444 G4cout
445 << "G4HepRepFileSceneHandler::AddSolid(const G4Torus& torus) called for "
446 << torus.GetName() << G4endl;
447 PrintThings();
448#endif
449 G4VSceneHandler::AddSolid(torus); // Invoke default action.
450}

References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().

◆ AddSolid() [11/14]

void G4HepRepFileSceneHandler::AddSolid ( const G4Trap trap)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 410 of file G4HepRepFileSceneHandler.cc.

411{
412#ifdef G4HEPREPFILEDEBUG
413 G4cout << "G4HepRepFileSceneHandler::AddSolid(const G4Trap& trap) called for "
414 << trap.GetName() << G4endl;
415 PrintThings();
416#endif
417 G4VSceneHandler::AddSolid(trap); // Invoke default action.
418}

References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().

◆ AddSolid() [12/14]

void G4HepRepFileSceneHandler::AddSolid ( const G4Trd trd)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 349 of file G4HepRepFileSceneHandler.cc.

350{
351#ifdef G4HEPREPFILEDEBUG
352 G4cout << "G4HepRepFileSceneHandler::AddSolid(const G4Trd& trd) called for "
353 << trd.GetName() << G4endl;
354 PrintThings();
355#endif
356
357 if(drawingTraj)
358 return;
359
360 if(drawingHit)
361 InitHit();
362
363 haveVisible = false;
364 AddHepRepInstance("Prism", NULL);
365
367
368 // Get and check applicable vis attributes.
370 if(fpVisAttribs && (fpVisAttribs->IsVisible() == 0) &&
371 messenger->getCullInvisibles())
372 return;
373
375
376 G4double dx1 = trd.GetXHalfLength1();
377 G4double dy1 = trd.GetYHalfLength1();
378 G4double dx2 = trd.GetXHalfLength2();
379 G4double dy2 = trd.GetYHalfLength2();
380 G4double dz = trd.GetZHalfLength();
381
382 G4Point3D vertex1(G4Point3D(dx1, dy1, -dz));
383 G4Point3D vertex2(G4Point3D(dx1, -dy1, -dz));
384 G4Point3D vertex3(G4Point3D(-dx1, -dy1, -dz));
385 G4Point3D vertex4(G4Point3D(-dx1, dy1, -dz));
386 G4Point3D vertex5(G4Point3D(dx2, dy2, dz));
387 G4Point3D vertex6(G4Point3D(dx2, -dy2, dz));
388 G4Point3D vertex7(G4Point3D(-dx2, -dy2, dz));
389 G4Point3D vertex8(G4Point3D(-dx2, dy2, dz));
390
391 vertex1 = (fObjectTransformation) *vertex1;
392 vertex2 = (fObjectTransformation) *vertex2;
393 vertex3 = (fObjectTransformation) *vertex3;
394 vertex4 = (fObjectTransformation) *vertex4;
395 vertex5 = (fObjectTransformation) *vertex5;
396 vertex6 = (fObjectTransformation) *vertex6;
397 vertex7 = (fObjectTransformation) *vertex7;
398 vertex8 = (fObjectTransformation) *vertex8;
399
400 hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z());
401 hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z());
402 hepRepXMLWriter->addPoint(vertex3.x(), vertex3.y(), vertex3.z());
403 hepRepXMLWriter->addPoint(vertex4.x(), vertex4.y(), vertex4.z());
404 hepRepXMLWriter->addPoint(vertex5.x(), vertex5.y(), vertex5.z());
405 hepRepXMLWriter->addPoint(vertex6.x(), vertex6.y(), vertex6.z());
406 hepRepXMLWriter->addPoint(vertex7.x(), vertex7.y(), vertex7.z());
407 hepRepXMLWriter->addPoint(vertex8.x(), vertex8.y(), vertex8.z());
408}
G4double GetXHalfLength2() const
G4double GetYHalfLength2() const
G4double GetXHalfLength1() const
G4double GetYHalfLength1() const
G4double GetZHalfLength() const

References AddHepRepInstance(), G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), drawingHit, drawingTraj, G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpViewer, G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4VViewer::GetApplicableVisAttributes(), G4HepRepMessenger::getCullInvisibles(), G4HepRepMessenger::GetInstance(), G4VSolid::GetName(), G4Trd::GetXHalfLength1(), G4Trd::GetXHalfLength2(), G4Trd::GetYHalfLength1(), G4Trd::GetYHalfLength2(), G4Trd::GetZHalfLength(), haveVisible, hepRepXMLWriter, InitHit(), G4VisAttributes::IsVisible(), HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ AddSolid() [13/14]

void G4HepRepFileSceneHandler::AddSolid ( const G4Tubs tubs)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 275 of file G4HepRepFileSceneHandler.cc.

276{
277#ifdef G4HEPREPFILEDEBUG
278 G4cout << "G4HepRepFileSceneHandler::AddSolid(const G4Tubs& tubs) called for "
279 << tubs.GetName() << G4endl;
280 PrintThings();
281#endif
282
283 // HepRApp does not correctly represent the end faces of cylinders at
284 // non-standard angles, let the base class convert these solids to polygons.
286 G4bool linedUpWithAnAxis =
287 (std::fabs(r.phiX()) <= .001 || std::fabs(r.phiY()) <= .001 ||
288 std::fabs(r.phiZ()) <= .001 || std::fabs(r.phiX() - pi) <= .001 ||
289 std::fabs(r.phiY() - pi) <= .001 || std::fabs(r.phiZ() - pi) <= .001);
290 // G4cout << "Angle X:" << r.phiX() << ", Angle Y:" << r.phiY() << ", Angle
291 // Z:" << r.phiZ() << G4endl; G4cout << "linedUpWithAnAxis:" <<
292 // linedUpWithAnAxis << G4endl;
293
294 // HepRep does not have a primitive for a cut cylinder,
295 // so if this cylinder is cut, let the base class convert this
296 // solid to polygons.
298 if(tubs.GetDeltaPhiAngle() < twopi || !linedUpWithAnAxis ||
299 messenger->renderCylAsPolygons())
300 {
301 G4VSceneHandler::AddSolid(tubs); // Invoke default action.
302 }
303 else
304 {
305 if(drawingTraj)
306 return;
307
308 if(drawingHit)
309 InitHit();
310
311 haveVisible = false;
312 AddHepRepInstance("Cylinder", NULL);
313
314 // Get and check applicable vis attributes.
316 if(fpVisAttribs && (fpVisAttribs->IsVisible() == 0) &&
317 messenger->getCullInvisibles())
318 return;
319
320 G4Point3D vertex1(G4Point3D(0., 0., -tubs.GetZHalfLength()));
321 G4Point3D vertex2(G4Point3D(0., 0., tubs.GetZHalfLength()));
322
323 vertex1 = (fObjectTransformation) *vertex1;
324 vertex2 = (fObjectTransformation) *vertex2;
325
326 // Outer cylinder.
328 hepRepXMLWriter->addAttValue("Radius1",
329 messenger->getScale() * tubs.GetOuterRadius());
330 hepRepXMLWriter->addAttValue("Radius2",
331 messenger->getScale() * tubs.GetOuterRadius());
332 hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z());
333 hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z());
334
335 // Inner cylinder.
336 if(tubs.GetInnerRadius() != 0.)
337 {
339 hepRepXMLWriter->addAttValue("Radius1", messenger->getScale() *
340 tubs.GetInnerRadius());
341 hepRepXMLWriter->addAttValue("Radius2", messenger->getScale() *
342 tubs.GetInnerRadius());
343 hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z());
344 hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z());
345 }
346 }
347}
G4double GetZHalfLength() const
G4double GetInnerRadius() const
G4double GetOuterRadius() const
G4double GetDeltaPhiAngle() const

References G4HepRepFileXMLWriter::addAttValue(), AddHepRepInstance(), G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), G4VSceneHandler::AddSolid(), drawingHit, drawingTraj, G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpViewer, G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4VViewer::GetApplicableVisAttributes(), G4HepRepMessenger::getCullInvisibles(), G4Tubs::GetDeltaPhiAngle(), G4Tubs::GetInnerRadius(), G4HepRepMessenger::GetInstance(), G4VSolid::GetName(), G4Tubs::GetOuterRadius(), HepGeom::Transform3D::getRotation(), G4HepRepMessenger::getScale(), G4Tubs::GetZHalfLength(), haveVisible, hepRepXMLWriter, InitHit(), G4VisAttributes::IsVisible(), CLHEP::HepRotation::phiX(), CLHEP::HepRotation::phiY(), CLHEP::HepRotation::phiZ(), pi, G4HepRepMessenger::renderCylAsPolygons(), twopi, HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ AddSolid() [14/14]

void G4HepRepFileSceneHandler::AddSolid ( const G4VSolid solid)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 506 of file G4HepRepFileSceneHandler.cc.

507{
508#ifdef G4HEPREPFILEDEBUG
509 G4cout
510 << "G4HepRepFileSceneHandler::AddSolid(const G4Solid& solid) called for "
511 << solid.GetName() << G4endl;
512 PrintThings();
513#endif
514 G4VSceneHandler::AddSolid(solid); // Invoke default action.
515}

References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().

◆ AddSolidT()

template<class T >
void G4VSceneHandler::AddSolidT ( const T &  solid)
inherited

Definition at line 220 of file G4VSceneHandler.cc.

222{
223 // Get and check applicable vis attributes.
225 RequestPrimitives (solid);
226}
virtual void RequestPrimitives(const G4VSolid &solid)

References G4VSceneHandler::fpViewer, G4VSceneHandler::fpVisAttribs, G4VViewer::GetApplicableVisAttributes(), and G4VSceneHandler::RequestPrimitives().

Referenced by G4VSceneHandler::AddSolid().

◆ AddSolidWithAuxiliaryEdges()

template<class T >
void G4VSceneHandler::AddSolidWithAuxiliaryEdges ( const T &  solid)
inherited

Definition at line 228 of file G4VSceneHandler.cc.

230{
231 // Get and check applicable vis attributes.
233 // Draw with auxiliary edges unless otherwise specified.
235 // Create a vis atts object for the modified vis atts.
236 // It is static so that we may return a reliable pointer to it.
237 static G4VisAttributes visAttsWithAuxEdges;
238 // Initialise it with the current vis atts and reset the pointer.
239 visAttsWithAuxEdges = *fpVisAttribs;
240 // Force auxiliary edges visible.
241 visAttsWithAuxEdges.SetForceAuxEdgeVisible();
242 fpVisAttribs = &visAttsWithAuxEdges;
243 }
244 RequestPrimitives (solid);
245}
void SetForceAuxEdgeVisible(G4bool=true)
G4bool IsForceAuxEdgeVisible() const

References G4VSceneHandler::fpViewer, G4VSceneHandler::fpVisAttribs, G4VViewer::GetApplicableVisAttributes(), G4VisAttributes::IsForceAuxEdgeVisible(), G4VSceneHandler::RequestPrimitives(), and G4VisAttributes::SetForceAuxEdgeVisible().

Referenced by G4VSceneHandler::AddSolid().

◆ AddViewerToList()

void G4VSceneHandler::AddViewerToList ( G4VViewer pView)
inherited

Definition at line 454 of file G4VSceneHandler.cc.

454 {
455 fViewerList.push_back (pViewer);
456}
G4ViewerList fViewerList

References G4VSceneHandler::fViewerList.

◆ BeginModeling()

void G4HepRepFileSceneHandler::BeginModeling ( )
virtual

Reimplemented from G4VSceneHandler.

Definition at line 93 of file G4HepRepFileSceneHandler.cc.

94{
96 const G4VTrajectoryModel* model = visManager->CurrentTrajDrawModel();
97 trajContext = &model->GetContext();
98
99 G4VSceneHandler::BeginModeling(); // Required: see G4VSceneHandler.hh.
100}
virtual void BeginModeling()
const G4VisTrajContext & GetContext() const
const G4VTrajectoryModel * CurrentTrajDrawModel() const
static G4VisManager * GetInstance()

References G4VSceneHandler::BeginModeling(), G4VisManager::CurrentTrajDrawModel(), G4VTrajectoryModel::GetContext(), G4VisManager::GetInstance(), and trajContext.

◆ BeginPrimitives()

void G4VSceneHandler::BeginPrimitives ( const G4Transform3D objectTransformation = G4Transform3D())
virtualinherited

Implements G4VGraphicsScene.

Reimplemented in G4DAWNFILESceneHandler, G4GMocrenFileSceneHandler, G4OpenGLImmediateSceneHandler, G4OpenGLSceneHandler, G4OpenGLStoredSceneHandler, G4OpenInventorSceneHandler, G4Qt3DSceneHandler, and G4VRML2FileSceneHandler.

Definition at line 160 of file G4VSceneHandler.cc.

161 {
162 //static G4int count = 0;
163 //G4cout << "G4VSceneHandler::BeginPrimitives: " << count++ << G4endl;
165 if (fNestingDepth > 1)
167 ("G4VSceneHandler::BeginPrimitives",
168 "visman0101", FatalException,
169 "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
170 fObjectTransformation = objectTransformation;
171}

References FatalException, G4VSceneHandler::fNestingDepth, G4VSceneHandler::fObjectTransformation, and G4Exception().

Referenced by G4GMocrenFileSceneHandler::BeginPrimitives(), G4OpenGLSceneHandler::BeginPrimitives(), G4OpenInventorSceneHandler::BeginPrimitives(), G4Qt3DSceneHandler::BeginPrimitives(), and G4VSceneHandler::RequestPrimitives().

◆ BeginPrimitives2D()

void G4HepRepFileSceneHandler::BeginPrimitives2D ( const G4Transform3D objectTransformation)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 107 of file G4HepRepFileSceneHandler.cc.

109{
110#ifdef G4HEPREPFILEDEBUG
111 G4cout << "G4HepRepFileSceneHandler::BeginPrimitives2D() " << G4endl;
112#endif
113 inPrimitives2D = true;
114 G4VSceneHandler::BeginPrimitives2D(objectTransformation);
115}
virtual void BeginPrimitives2D(const G4Transform3D &objectTransformation=G4Transform3D())

References G4VSceneHandler::BeginPrimitives2D(), G4cout, G4endl, and inPrimitives2D.

◆ CheckFileOpen()

void G4HepRepFileSceneHandler::CheckFileOpen ( )
private

Definition at line 1662 of file G4HepRepFileSceneHandler.cc.

1663{
1664#ifdef G4HEPREPFILEDEBUG
1665 G4cout << "G4HepRepFileSceneHandler::CheckFileOpen called." << G4endl;
1666#endif
1667
1669 {
1670 G4String newFileSpec;
1671
1673
1674 if(messenger->getOverwrite())
1675 {
1676 newFileSpec =
1677 messenger->getFileDir() + messenger->getFileName() + ".heprep";
1678 }
1679 else
1680 {
1681 newFileSpec = messenger->getFileDir() + messenger->getFileName() +
1683 }
1684
1685 G4cout << "HepRepFile writing to " << newFileSpec << G4endl;
1686
1687 hepRepXMLWriter->open(newFileSpec);
1688
1689 if(!messenger->getOverwrite())
1690 fileCounter++;
1691
1692 hepRepXMLWriter->addAttDef("Generator", "HepRep Data Generator", "Physics",
1693 "");
1694 G4String versionString = G4Version;
1695 versionString = versionString.substr(1, versionString.size() - 2);
1696 versionString = " Geant4 version " + versionString + " " + G4Date;
1697 hepRepXMLWriter->addAttValue("Generator", versionString);
1698
1699 hepRepXMLWriter->addAttDef("LVol", "Logical Volume", "Physics", "");
1700 hepRepXMLWriter->addAttDef("Region", "Cuts Region", "Physics", "");
1701 hepRepXMLWriter->addAttDef("RootRegion", "Root Region", "Physics", "");
1702 hepRepXMLWriter->addAttDef("Solid", "Solid Name", "Physics", "");
1703 hepRepXMLWriter->addAttDef("EType", "Entity Type", "Physics", "");
1704 hepRepXMLWriter->addAttDef("Material", "Material Name", "Physics", "");
1705 hepRepXMLWriter->addAttDef("Density", "Material Density", "Physics",
1706 "kg/m3");
1707 hepRepXMLWriter->addAttDef("State", "Material State", "Physics", "");
1708 hepRepXMLWriter->addAttDef("Radlen", "Material Radiation Length", "Physics",
1709 "m");
1710 }
1711}
static const G4String G4Date
Definition: G4Version.hh:60
static const G4String G4Version
Definition: G4Version.hh:58
void open(const char *filespec)
virtual G4String getFileName()
virtual G4String getFileDir()
virtual G4bool getOverwrite()
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:445

References G4HepRepFileXMLWriter::addAttDef(), G4HepRepFileXMLWriter::addAttValue(), G4UIcommand::ConvertToString(), fileCounter, G4cout, G4Date, G4endl, G4Version, G4HepRepMessenger::getFileDir(), G4HepRepMessenger::getFileName(), G4HepRepMessenger::GetInstance(), G4HepRepMessenger::getOverwrite(), hepRepXMLWriter, G4HepRepFileXMLWriter::isOpen, and G4HepRepFileXMLWriter::open().

Referenced by AddCompound(), and AddHepRepInstance().

◆ ClearStore()

void G4VSceneHandler::ClearStore ( )
virtualinherited

◆ ClearTransientStore()

void G4HepRepFileSceneHandler::ClearTransientStore ( )
virtual

Reimplemented from G4VSceneHandler.

Definition at line 1713 of file G4HepRepFileSceneHandler.cc.

1714{
1715 // This is typically called after an update and before drawing hits
1716 // of the next event. To simulate the clearing of "transients"
1717 // (hits, etc.) the detector is redrawn...
1718 if(fpViewer)
1719 {
1720 fpViewer->SetView();
1722 fpViewer->DrawView();
1723 }
1724}
virtual void DrawView()=0
virtual void ClearView()=0
virtual void SetView()=0

References G4VViewer::ClearView(), G4VViewer::DrawView(), G4VSceneHandler::fpViewer, and G4VViewer::SetView().

◆ CreateCutawaySolid()

G4DisplacedSolid * G4VSceneHandler::CreateCutawaySolid ( )
protectedvirtualinherited

Reimplemented in G4OpenGLSceneHandler.

Definition at line 904 of file G4VSceneHandler.cc.

905{
906 // To be reviewed.
907 return 0;
908 /*** An alternative way of getting a cutaway is to use
909 Command /vis/scene/add/volume
910 Guidance :
911 Adds a physical volume to current scene, with optional clipping volume.
912 If physical-volume-name is "world" (the default), the top of the
913 main geometry tree (material world) is added. If "worlds", the
914 top of all worlds - material world and parallel worlds, if any - are
915 added. Otherwise a search of all worlds is made, taking the first
916 matching occurrence only. To see a representation of the geometry
917 hierarchy of the worlds, try "/vis/drawTree [worlds]" or one of the
918 driver/browser combinations that have the required functionality, e.g., HepRep.
919 If clip-volume-type is specified, the subsequent parameters are used to
920 to define a clipping volume. For example,
921 "/vis/scene/add/volume ! ! ! -box km 0 1 0 1 0 1" will draw the world
922 with the positive octant cut away. (If the Boolean Processor issues
923 warnings try replacing 0 by 0.000000001 or something.)
924 If clip-volume-type is prepended with '-', the clip-volume is subtracted
925 (cutaway). (This is the default if there is no prepended character.)
926 If '*' is prepended, the intersection of the physical-volume and the
927 clip-volume is made. (You can make a section/DCUT with a thin box, for
928 example).
929 For "box", the parameters are xmin,xmax,ymin,ymax,zmin,zmax.
930 Only "box" is programmed at present.
931 ***/
932}

Referenced by G4VSceneHandler::CreateModelingParameters().

◆ CreateModelingParameters()

G4ModelingParameters * G4VSceneHandler::CreateModelingParameters ( )
inherited

Definition at line 798 of file G4VSceneHandler.cc.

799{
800 // Create modeling parameters from View Parameters...
801 if (!fpViewer) return NULL;
802
803 const G4ViewParameters& vp = fpViewer -> GetViewParameters ();
804
805 // Convert drawing styles...
806 G4ModelingParameters::DrawingStyle modelDrawingStyle =
808 switch (vp.GetDrawingStyle ()) {
809 default:
811 modelDrawingStyle = G4ModelingParameters::wf;
812 break;
814 modelDrawingStyle = G4ModelingParameters::hlr;
815 break;
817 modelDrawingStyle = G4ModelingParameters::hsr;
818 break;
820 modelDrawingStyle = G4ModelingParameters::hlhsr;
821 break;
823 modelDrawingStyle = G4ModelingParameters::cloud;
824 break;
825 }
826
827 // Decide if covered daughters are really to be culled...
828 G4bool reallyCullCovered =
829 vp.IsCullingCovered() // Culling daughters depends also on...
830 && !vp.IsSection () // Sections (DCUT) not requested.
831 && !vp.IsCutaway () // Cutaways not requested.
832 ;
833
834 G4ModelingParameters* pModelingParams = new G4ModelingParameters
836 modelDrawingStyle,
837 vp.IsCulling (),
838 vp.IsCullingInvisible (),
839 vp.IsDensityCulling (),
840 vp.GetVisibleDensity (),
841 reallyCullCovered,
842 vp.GetNoOfSides ()
843 );
844
845 pModelingParams->SetNumberOfCloudPoints(vp.GetNumberOfCloudPoints());
846 pModelingParams->SetWarning
848
849 pModelingParams->SetCBDAlgorithmNumber(vp.GetCBDAlgorithmNumber());
850 pModelingParams->SetCBDParameters(vp.GetCBDParameters());
851
852 pModelingParams->SetExplodeFactor(vp.GetExplodeFactor());
853 pModelingParams->SetExplodeCentre(vp.GetExplodeCentre());
854
855 pModelingParams->SetSectionSolid(CreateSectionSolid());
856 pModelingParams->SetCutawaySolid(CreateCutawaySolid());
857 // The polyhedron objects are deleted in the modeling parameters destructor.
858
860
861 pModelingParams->SetSpecialMeshRendering(vp.IsSpecialMeshRendering());
862 pModelingParams->SetSpecialMeshVolumes(vp.GetSpecialMeshVolumes());
863
864 return pModelingParams;
865}
void SetCBDParameters(const std::vector< G4double > &)
void SetWarning(G4bool)
void SetNumberOfCloudPoints(G4int)
void SetCBDAlgorithmNumber(G4int)
void SetExplodeFactor(G4double explodeFactor)
void SetVisAttributesModifiers(const std::vector< VisAttributesModifier > &)
void SetExplodeCentre(const G4Point3D &explodeCentre)
void SetCutawaySolid(G4DisplacedSolid *pCutawaySolid)
void SetSectionSolid(G4DisplacedSolid *pSectionSolid)
void SetSpecialMeshVolumes(const std::vector< PVNameCopyNo > &)
void SetSpecialMeshRendering(G4bool)
virtual G4DisplacedSolid * CreateSectionSolid()
virtual G4DisplacedSolid * CreateCutawaySolid()
const std::vector< G4ModelingParameters::VisAttributesModifier > & GetVisAttributesModifiers() const
G4int GetNoOfSides() const
G4bool IsSpecialMeshRendering() const
G4double GetExplodeFactor() const
G4int GetNumberOfCloudPoints() const
G4bool IsCutaway() const
G4bool IsSection() const
G4bool IsCulling() const
const std::vector< G4double > & GetCBDParameters() const
G4int GetCBDAlgorithmNumber() const
const std::vector< G4ModelingParameters::PVNameCopyNo > & GetSpecialMeshVolumes() const
G4bool IsCullingInvisible() const
const G4VisAttributes * GetDefaultVisAttributes() const
G4bool IsDensityCulling() const
G4double GetVisibleDensity() const
const G4Point3D & GetExplodeCentre() const
G4bool IsCullingCovered() const
DrawingStyle GetDrawingStyle() const
static Verbosity GetVerbosity()

References G4ViewParameters::cloud, G4ModelingParameters::cloud, G4VSceneHandler::CreateCutawaySolid(), G4VSceneHandler::CreateSectionSolid(), G4VSceneHandler::fpViewer, G4ViewParameters::GetCBDAlgorithmNumber(), G4ViewParameters::GetCBDParameters(), G4ViewParameters::GetDefaultVisAttributes(), G4ViewParameters::GetDrawingStyle(), G4ViewParameters::GetExplodeCentre(), G4ViewParameters::GetExplodeFactor(), G4ViewParameters::GetNoOfSides(), G4ViewParameters::GetNumberOfCloudPoints(), G4ViewParameters::GetSpecialMeshVolumes(), G4VisManager::GetVerbosity(), G4ViewParameters::GetVisAttributesModifiers(), G4ViewParameters::GetVisibleDensity(), G4ViewParameters::hlhsr, G4ModelingParameters::hlhsr, G4ViewParameters::hlr, G4ModelingParameters::hlr, G4ViewParameters::hsr, G4ModelingParameters::hsr, G4ViewParameters::IsCulling(), G4ViewParameters::IsCullingCovered(), G4ViewParameters::IsCullingInvisible(), G4ViewParameters::IsCutaway(), G4ViewParameters::IsDensityCulling(), G4ViewParameters::IsSection(), G4ViewParameters::IsSpecialMeshRendering(), G4ModelingParameters::SetCBDAlgorithmNumber(), G4ModelingParameters::SetCBDParameters(), G4ModelingParameters::SetCutawaySolid(), G4ModelingParameters::SetExplodeCentre(), G4ModelingParameters::SetExplodeFactor(), G4ModelingParameters::SetNumberOfCloudPoints(), G4ModelingParameters::SetSectionSolid(), G4ModelingParameters::SetSpecialMeshRendering(), G4ModelingParameters::SetSpecialMeshVolumes(), G4ModelingParameters::SetVisAttributesModifiers(), G4ModelingParameters::SetWarning(), G4VisManager::warnings, G4ModelingParameters::wf, and G4ViewParameters::wireframe.

Referenced by G4VSceneHandler::DrawEndOfRunModels(), G4VSceneHandler::DrawEvent(), and G4VSceneHandler::ProcessScene().

◆ CreateSectionSolid()

G4DisplacedSolid * G4VSceneHandler::CreateSectionSolid ( )
protectedvirtualinherited

Reimplemented in G4OpenGLSceneHandler.

Definition at line 867 of file G4VSceneHandler.cc.

868{
869 G4DisplacedSolid* sectioner = 0;
870
872 if (vp.IsSection () ) {
873
875 G4double safe = radius + fpScene->GetExtent().GetExtentCentre().mag();
876 G4VSolid* sectionBox =
877 new G4Box("_sectioner", safe, safe, 1.e-5 * radius); // Thin in z-plane...
878 const G4Normal3D originalNormal(0,0,1); // ...so this is original normal.
879
880 const G4Plane3D& sp = vp.GetSectionPlane ();
881 const G4double& a = sp.a();
882 const G4double& b = sp.b();
883 const G4double& c = sp.c();
884 const G4double& d = sp.d();
885 const G4Normal3D newNormal(a,b,c);
886
887 G4Transform3D requiredTransform;
888 // Rotate
889 if (newNormal != originalNormal) {
890 const G4double& angle = std::acos(newNormal.dot(originalNormal));
891 const G4Vector3D& axis = originalNormal.cross(newNormal);
892 requiredTransform = G4Rotate3D(angle, axis);
893 }
894 // Translate
895 requiredTransform = requiredTransform * G4TranslateZ3D(-d);
896
897 sectioner = new G4DisplacedSolid
898 ("_displaced_sectioning_box", sectionBox, requiredTransform);
899 }
900
901 return sectioner;
902}
static const G4double angle[DIMMOTT]
HepGeom::Rotate3D G4Rotate3D
HepGeom::TranslateZ3D G4TranslateZ3D
Definition: G4Box.hh:56
const G4VisExtent & GetExtent() const
const G4ViewParameters & GetViewParameters() const
const G4Plane3D & GetSectionPlane() const
G4double GetExtentRadius() const
Definition: G4VisExtent.cc:75
const G4Point3D & GetExtentCentre() const
Definition: G4VisExtent.cc:65
BasicVector3D< T > cross(const BasicVector3D< T > &v) const

References angle, HepGeom::BasicVector3D< T >::cross(), HepGeom::BasicVector3D< T >::dot(), G4VSceneHandler::fpScene, G4VSceneHandler::fpViewer, G4Scene::GetExtent(), G4VisExtent::GetExtentCentre(), G4VisExtent::GetExtentRadius(), G4ViewParameters::GetSectionPlane(), G4VViewer::GetViewParameters(), G4ViewParameters::IsSection(), HepGeom::BasicVector3D< T >::mag(), and G4InuclParticleNames::sp.

Referenced by G4VSceneHandler::CreateModelingParameters(), and G4OpenGLSceneHandler::CreateSectionSolid().

◆ DrawEndOfRunModels()

void G4VSceneHandler::DrawEndOfRunModels ( )
inherited

Definition at line 777 of file G4VSceneHandler.cc.

778{
779 const std::vector<G4Scene::Model>& EORModelList =
780 fpScene -> GetEndOfRunModelList ();
781 size_t nModels = EORModelList.size();
782 if (nModels) {
784 pMP->SetEvent(0);
785 for (size_t i = 0; i < nModels; i++) {
786 if (EORModelList[i].fActive) {
787 fpModel = EORModelList[i].fpModel;
788 fpModel -> SetModelingParameters(pMP);
789 fpModel -> DescribeYourselfTo (*this);
790 fpModel -> SetModelingParameters(0);
791 }
792 }
793 fpModel = 0;
794 delete pMP;
795 }
796}
void SetEvent(const G4Event *pEvent)
G4ModelingParameters * CreateModelingParameters()

References G4VSceneHandler::CreateModelingParameters(), G4VSceneHandler::fpModel, G4VSceneHandler::fpScene, and G4ModelingParameters::SetEvent().

Referenced by G4VisManager::EndOfRun(), and G4VSceneHandler::ProcessScene().

◆ DrawEvent()

void G4VSceneHandler::DrawEvent ( const G4Event event)
inherited

Definition at line 756 of file G4VSceneHandler.cc.

757{
758 const std::vector<G4Scene::Model>& EOEModelList =
759 fpScene -> GetEndOfEventModelList ();
760 size_t nModels = EOEModelList.size();
761 if (nModels) {
763 pMP->SetEvent(event);
764 for (size_t i = 0; i < nModels; i++) {
765 if (EOEModelList[i].fActive) {
766 fpModel = EOEModelList[i].fpModel;
767 fpModel -> SetModelingParameters(pMP);
768 fpModel -> DescribeYourselfTo (*this);
769 fpModel -> SetModelingParameters(0);
770 }
771 }
772 fpModel = 0;
773 delete pMP;
774 }
775}

References G4VSceneHandler::CreateModelingParameters(), G4VSceneHandler::fpModel, G4VSceneHandler::fpScene, and G4ModelingParameters::SetEvent().

Referenced by G4VisManager::EndOfEvent(), and G4VSceneHandler::ProcessScene().

◆ EndModeling()

void G4HepRepFileSceneHandler::EndModeling ( )
virtual

Reimplemented from G4VSceneHandler.

Definition at line 102 of file G4HepRepFileSceneHandler.cc.

103{
104 G4VSceneHandler::EndModeling(); // Required: see G4VSceneHandler.hh.
105}
virtual void EndModeling()

References G4VSceneHandler::EndModeling().

◆ EndPrimitives()

void G4VSceneHandler::EndPrimitives ( )
virtualinherited

◆ EndPrimitives2D()

void G4HepRepFileSceneHandler::EndPrimitives2D ( )
virtual

Reimplemented from G4VSceneHandler.

Definition at line 117 of file G4HepRepFileSceneHandler.cc.

118{
119#ifdef G4HEPREPFILEDEBUG
120 G4cout << "G4HepRepFileSceneHandler::EndPrimitives2D() " << G4endl;
121#endif
123 inPrimitives2D = false;
124}
virtual void EndPrimitives2D()

References G4VSceneHandler::EndPrimitives2D(), G4cout, G4endl, and inPrimitives2D.

◆ GetAuxEdgeVisible()

G4bool G4VSceneHandler::GetAuxEdgeVisible ( const G4VisAttributes pVisAttribs)
inherited

Definition at line 1081 of file G4VSceneHandler.cc.

1081 {
1082 G4bool isAuxEdgeVisible = fpViewer->GetViewParameters().IsAuxEdgeVisible ();
1083 if (pVisAttribs -> IsForceAuxEdgeVisible()) {
1084 isAuxEdgeVisible = pVisAttribs->IsForcedAuxEdgeVisible();
1085 }
1086 return isAuxEdgeVisible;
1087}
G4bool IsAuxEdgeVisible() const
G4bool IsForcedAuxEdgeVisible() const

References G4VSceneHandler::fpViewer, G4VViewer::GetViewParameters(), G4ViewParameters::IsAuxEdgeVisible(), and G4VisAttributes::IsForcedAuxEdgeVisible().

Referenced by G4OpenGLSceneHandler::AddPrimitive(), and G4OpenInventorSceneHandler::AddProperties().

◆ GetColor() [1/2]

const G4Colour & G4VSceneHandler::GetColor ( )
inherited

◆ GetColor() [2/2]

const G4Colour & G4VSceneHandler::GetColor ( const G4Visible )
inherited

◆ GetColour() [1/2]

const G4Colour & G4VSceneHandler::GetColour ( )
inherited

◆ GetColour() [2/2]

const G4Colour & G4VSceneHandler::GetColour ( const G4Visible visible)
inherited

◆ GetCurrentViewer()

G4VViewer * G4VSceneHandler::GetCurrentViewer ( ) const
inherited

◆ GetDrawingStyle()

G4ViewParameters::DrawingStyle G4VSceneHandler::GetDrawingStyle ( const G4VisAttributes pVisAttribs)
inherited

Definition at line 1021 of file G4VSceneHandler.cc.

1022 {
1023 // Drawing style is normally determined by the view parameters, but
1024 // it can be overriddden by the ForceDrawingStyle flag in the vis
1025 // attributes.
1027 const G4ViewParameters::DrawingStyle viewerStyle = vp.GetDrawingStyle();
1028 G4ViewParameters::DrawingStyle resultantStyle = viewerStyle;
1029 if (pVisAttribs -> IsForceDrawingStyle ()) {
1031 pVisAttribs -> GetForcedDrawingStyle ();
1032 // This is complicated because if hidden line and surface removal
1033 // has been requested we wish to preserve this sometimes.
1034 switch (forcedStyle) {
1036 switch (viewerStyle) {
1037 case (G4ViewParameters::hlr):
1038 resultantStyle = G4ViewParameters::hlhsr;
1039 break;
1041 resultantStyle = G4ViewParameters::hsr;
1042 break;
1044 resultantStyle = G4ViewParameters::hsr;
1045 break;
1047 case (G4ViewParameters::hsr):
1048 break;
1049 }
1050 break;
1052 resultantStyle = G4ViewParameters::cloud;
1053 break;
1055 default:
1056 // But if forced style is wireframe, do it, because one of its
1057 // main uses is in displaying the consituent solids of a Boolean
1058 // solid and their surfaces overlap with the resulting Booean
1059 // solid, making a mess if hlr is specified.
1060 resultantStyle = G4ViewParameters::wireframe;
1061 break;
1062 }
1063 }
1064 return resultantStyle;
1065}

References G4VisAttributes::cloud, G4ViewParameters::cloud, G4VSceneHandler::fpViewer, G4ViewParameters::GetDrawingStyle(), G4VViewer::GetViewParameters(), G4ViewParameters::hlhsr, G4ViewParameters::hlr, G4ViewParameters::hsr, G4VisAttributes::solid, G4VisAttributes::wireframe, and G4ViewParameters::wireframe.

Referenced by G4OpenGLSceneHandler::AddPrimitive(), G4Qt3DSceneHandler::AddPrimitive(), G4ToolsSGSceneHandler::AddPrimitive(), G4VtkSceneHandler::AddPrimitiveTensorGlyph(), G4OpenInventorSceneHandler::AddProperties(), G4OpenInventorSceneHandler::GeneratePrerequisites(), and G4VSceneHandler::RequestPrimitives().

◆ GetExtent()

const G4VisExtent & G4VSceneHandler::GetExtent ( ) const
virtualinherited

Reimplemented from G4VGraphicsScene.

Definition at line 134 of file G4VSceneHandler.cc.

135{
136 if (fpScene) {
137 return fpScene->GetExtent();
138 } else {
139 static const G4VisExtent defaultExtent = G4VisExtent();
140 return defaultExtent;
141 }
142}

References G4VSceneHandler::fpScene, and G4Scene::GetExtent().

Referenced by G4VtkViewer::SetView().

◆ GetGraphicsSystem()

G4VGraphicsSystem * G4VSceneHandler::GetGraphicsSystem ( ) const
inherited

◆ GetHepRepXMLWriter()

G4HepRepFileXMLWriter * G4HepRepFileSceneHandler::GetHepRepXMLWriter ( )

Definition at line 1389 of file G4HepRepFileSceneHandler.cc.

1390{
1391 return hepRepXMLWriter;
1392}

References hepRepXMLWriter.

Referenced by G4HepRepFileSceneHandler().

◆ GetLineWidth()

G4double G4VSceneHandler::GetLineWidth ( const G4VisAttributes pVisAttribs)
inherited

Definition at line 1012 of file G4VSceneHandler.cc.

1013{
1014 G4double lineWidth = pVisAttribs->GetLineWidth();
1015 if (lineWidth < 1.) lineWidth = 1.;
1016 lineWidth *= fpViewer -> GetViewParameters().GetGlobalLineWidthScale();
1017 if (lineWidth < 1.) lineWidth = 1.;
1018 return lineWidth;
1019}
G4double GetLineWidth() const

References G4VSceneHandler::fpViewer, and G4VisAttributes::GetLineWidth().

Referenced by G4OpenGLSceneHandler::AddPrimitive().

◆ GetMarkerDiameter()

G4double G4VSceneHandler::GetMarkerDiameter ( const G4VMarker ,
MarkerSizeType  
)
inherited

◆ GetMarkerRadius()

G4double G4VSceneHandler::GetMarkerRadius ( const G4VMarker ,
MarkerSizeType  
)
inherited

◆ GetMarkerSize()

G4double G4VSceneHandler::GetMarkerSize ( const G4VMarker marker,
G4VSceneHandler::MarkerSizeType markerSizeType 
)
inherited

Definition at line 1089 of file G4VSceneHandler.cc.

1092{
1093 G4bool userSpecified = marker.GetWorldSize() || marker.GetScreenSize();
1094 const G4VMarker& defaultMarker =
1095 fpViewer -> GetViewParameters().GetDefaultMarker();
1096 G4double size = userSpecified ?
1097 marker.GetWorldSize() : defaultMarker.GetWorldSize();
1098 if (size) {
1099 // Draw in world coordinates.
1100 markerSizeType = world;
1101 }
1102 else {
1103 size = userSpecified ?
1104 marker.GetScreenSize() : defaultMarker.GetScreenSize();
1105 // Draw in screen coordinates.
1106 markerSizeType = screen;
1107 }
1108 size *= fpViewer -> GetViewParameters().GetGlobalMarkerScale();
1109 if (markerSizeType == screen && size < 1.) size = 1.;
1110 return size;
1111}
G4double GetScreenSize() const
G4double GetWorldSize() const

References G4VSceneHandler::fpViewer, G4VMarker::GetScreenSize(), G4VMarker::GetWorldSize(), G4VSceneHandler::screen, and G4VSceneHandler::world.

Referenced by G4OpenInventorSceneHandler::AddCircleSquare(), G4Qt3DSceneHandler::AddPrimitive(), G4VtkSceneHandler::AddPrimitive(), AddPrimitive(), G4OpenGLSceneHandler::AddPrimitive(), G4OpenInventorSceneHandler::AddPrimitive(), G4ToolsSGSceneHandler::AddPrimitive(), G4OpenGLQtViewer::DrawText(), G4OpenGLViewer::DrawText(), and G4OpenGLXViewer::DrawText().

◆ GetMarkForClearingTransientStore()

G4bool G4VSceneHandler::GetMarkForClearingTransientStore ( ) const
inherited

◆ GetModel()

G4VModel * G4VSceneHandler::GetModel ( ) const
inherited

◆ GetName()

const G4String & G4VSceneHandler::GetName ( ) const
inherited

◆ GetNoOfSides()

G4int G4VSceneHandler::GetNoOfSides ( const G4VisAttributes pVisAttribs)
inherited

Definition at line 1113 of file G4VSceneHandler.cc.

1114{
1115 // No. of sides (lines segments per circle) is normally determined
1116 // by the view parameters, but it can be overriddden by the
1117 // ForceLineSegmentsPerCircle in the vis attributes.
1118 G4int lineSegmentsPerCircle = fpViewer->GetViewParameters().GetNoOfSides();
1119 if (pVisAttribs) {
1120 if (pVisAttribs->IsForceLineSegmentsPerCircle())
1121 lineSegmentsPerCircle = pVisAttribs->GetForcedLineSegmentsPerCircle();
1122 if (lineSegmentsPerCircle < pVisAttribs->GetMinLineSegmentsPerCircle()) {
1123 lineSegmentsPerCircle = pVisAttribs->GetMinLineSegmentsPerCircle();
1124 G4cout <<
1125 "G4VSceneHandler::GetNoOfSides: attempt to set the"
1126 "\nnumber of line segments per circle < " << lineSegmentsPerCircle
1127 << "; forced to " << pVisAttribs->GetMinLineSegmentsPerCircle() << G4endl;
1128 }
1129 }
1130 return lineSegmentsPerCircle;
1131}
G4bool IsForceLineSegmentsPerCircle() const
G4int GetForcedLineSegmentsPerCircle() const
static G4int GetMinLineSegmentsPerCircle()

References G4VSceneHandler::fpViewer, G4cout, G4endl, G4VisAttributes::GetForcedLineSegmentsPerCircle(), G4VisAttributes::GetMinLineSegmentsPerCircle(), G4ViewParameters::GetNoOfSides(), G4VViewer::GetViewParameters(), and G4VisAttributes::IsForceLineSegmentsPerCircle().

Referenced by G4OpenGLSceneHandler::AddPrimitive(), and G4VSceneHandler::RequestPrimitives().

◆ GetNumberOfCloudPoints()

G4int G4VSceneHandler::GetNumberOfCloudPoints ( const G4VisAttributes pVisAttribs) const
inherited

Definition at line 1067 of file G4VSceneHandler.cc.

1068 {
1069 // Returns no of cloud points from current view parameters, unless the user
1070 // has forced through the vis attributes, thereby over-riding the
1071 // current view parameter.
1072 G4int numberOfCloudPoints = fpViewer->GetViewParameters().GetNumberOfCloudPoints();
1073 if (pVisAttribs -> IsForceDrawingStyle() &&
1074 pVisAttribs -> GetForcedDrawingStyle() == G4VisAttributes::cloud &&
1075 pVisAttribs -> GetForcedNumberOfCloudPoints() > 0) {
1076 numberOfCloudPoints = pVisAttribs -> GetForcedNumberOfCloudPoints();
1077 }
1078 return numberOfCloudPoints;
1079}

References G4VisAttributes::cloud, G4VSceneHandler::fpViewer, G4ViewParameters::GetNumberOfCloudPoints(), and G4VViewer::GetViewParameters().

Referenced by G4VSceneHandler::RequestPrimitives().

◆ GetObjectTransformation()

const G4Transform3D & G4VSceneHandler::GetObjectTransformation ( ) const
inherited

◆ GetScene()

G4Scene * G4VSceneHandler::GetScene ( ) const
inherited

◆ GetSceneHandlerId()

G4int G4VSceneHandler::GetSceneHandlerId ( ) const
inherited

◆ GetTextColor()

const G4Colour & G4VSceneHandler::GetTextColor ( const G4Text )
inherited

◆ GetTextColour()

const G4Colour & G4VSceneHandler::GetTextColour ( const G4Text text)
inherited

◆ GetTransientsDrawnThisEvent()

G4bool G4VSceneHandler::GetTransientsDrawnThisEvent ( ) const
inherited

◆ GetTransientsDrawnThisRun()

G4bool G4VSceneHandler::GetTransientsDrawnThisRun ( ) const
inherited

◆ GetViewCount()

G4int G4VSceneHandler::GetViewCount ( ) const
inherited

◆ GetViewerList()

const G4ViewerList & G4VSceneHandler::GetViewerList ( ) const
inherited

◆ IncrementViewCount()

G4int G4VSceneHandler::IncrementViewCount ( )
inherited

◆ InitHit()

void G4HepRepFileSceneHandler::InitHit ( )

Definition at line 1062 of file G4HepRepFileSceneHandler.cc.

1063{
1064 if(!doneInitHit)
1065 {
1066 // For every hit, add an instance of Type Hit.
1068
1069 // Write out the hit's attribute values.
1070 if(hitAttValues)
1071 {
1072 std::vector<G4AttValue>::iterator iAttVal;
1073 for(iAttVal = hitAttValues->begin(); iAttVal != hitAttValues->end();
1074 ++iAttVal)
1075 hepRepXMLWriter->addAttValue(iAttVal->GetName(), iAttVal->GetValue());
1076 delete hitAttValues;
1077 }
1078
1079 // Clean up hit attributes.
1080 if(hitAttDefs)
1081 delete hitAttDefs;
1082
1083 doneInitHit = true;
1084 }
1085}

References G4HepRepFileXMLWriter::addAttValue(), G4HepRepFileXMLWriter::addInstance(), doneInitHit, hepRepXMLWriter, hitAttDefs, and hitAttValues.

Referenced by AddPrimitive(), and AddSolid().

◆ InitTrajectory()

void G4HepRepFileSceneHandler::InitTrajectory ( )

Definition at line 1037 of file G4HepRepFileSceneHandler.cc.

1038{
1039 if(!doneInitTraj)
1040 {
1041 // For every trajectory, add an instance of Type Trajectory.
1043
1044 // Write out the trajectory's attribute values.
1045 if(trajAttValues)
1046 {
1047 std::vector<G4AttValue>::iterator iAttVal;
1048 for(iAttVal = trajAttValues->begin(); iAttVal != trajAttValues->end();
1049 ++iAttVal)
1050 hepRepXMLWriter->addAttValue(iAttVal->GetName(), iAttVal->GetValue());
1051 delete trajAttValues;
1052 }
1053
1054 // Clean up trajectory attributes.
1055 if(trajAttDefs)
1056 delete trajAttDefs;
1057
1058 doneInitTraj = true;
1059 }
1060}

References G4HepRepFileXMLWriter::addAttValue(), G4HepRepFileXMLWriter::addInstance(), doneInitTraj, hepRepXMLWriter, trajAttDefs, and trajAttValues.

Referenced by AddCompound(), and AddPrimitive().

◆ IsReadyForTransients()

G4bool G4VSceneHandler::IsReadyForTransients ( ) const
inherited

◆ LoadAtts()

void G4VSceneHandler::LoadAtts ( const G4Visible visible,
G4AttHolder holder 
)
protectedinherited

Definition at line 934 of file G4VSceneHandler.cc.

935{
936 // Load G4Atts from G4VisAttributes, if any...
937 const G4VisAttributes* va = visible.GetVisAttributes();
938 if (va) {
939 const std::map<G4String,G4AttDef>* vaDefs =
940 va->GetAttDefs();
941 if (vaDefs) {
942 holder->AddAtts(visible.GetVisAttributes()->CreateAttValues(), vaDefs);
943 }
944 }
945
946 G4PhysicalVolumeModel* pPVModel =
947 dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
948 if (pPVModel) {
949 // Load G4Atts from G4PhysicalVolumeModel...
950 const std::map<G4String,G4AttDef>* pvDefs = pPVModel->GetAttDefs();
951 if (pvDefs) {
952 holder->AddAtts(pPVModel->CreateCurrentAttValues(), pvDefs);
953 }
954 }
955
956 G4TrajectoriesModel* trajModel = dynamic_cast<G4TrajectoriesModel*>(fpModel);
957 if (trajModel) {
958 // Load G4Atts from trajectory model...
959 const std::map<G4String,G4AttDef>* trajModelDefs = trajModel->GetAttDefs();
960 if (trajModelDefs) {
961 holder->AddAtts(trajModel->CreateCurrentAttValues(), trajModelDefs);
962 }
963 // Load G4Atts from trajectory...
964 const G4VTrajectory* traj = trajModel->GetCurrentTrajectory();
965 if (traj) {
966 const std::map<G4String,G4AttDef>* trajDefs = traj->GetAttDefs();
967 if (trajDefs) {
968 holder->AddAtts(traj->CreateAttValues(), trajDefs);
969 }
970 G4int nPoints = traj->GetPointEntries();
971 for (G4int i = 0; i < nPoints; ++i) {
972 G4VTrajectoryPoint* trajPoint = traj->GetPoint(i);
973 if (trajPoint) {
974 const std::map<G4String,G4AttDef>* pointDefs = trajPoint->GetAttDefs();
975 if (pointDefs) {
976 holder->AddAtts(trajPoint->CreateAttValues(), pointDefs);
977 }
978 }
979 }
980 }
981 }
982
983 G4HitsModel* hitsModel = dynamic_cast<G4HitsModel*>(fpModel);
984 if (hitsModel) {
985 // Load G4Atts from hit...
986 const G4VHit* hit = hitsModel->GetCurrentHit();
987 const std::map<G4String,G4AttDef>* hitsDefs = hit->GetAttDefs();
988 if (hitsDefs) {
989 holder->AddAtts(hit->CreateAttValues(), hitsDefs);
990 }
991 }
992}
void AddAtts(const std::vector< G4AttValue > *values, const std::map< G4String, G4AttDef > *defs)
Definition: G4AttHolder.hh:64
const G4VHit * GetCurrentHit() const
Definition: G4HitsModel.hh:57
std::vector< G4AttValue > * CreateCurrentAttValues() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
const G4VTrajectory * GetCurrentTrajectory() const
std::vector< G4AttValue > * CreateCurrentAttValues() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
const std::vector< G4AttValue > * CreateAttValues() const

References G4AttHolder::AddAtts(), G4VHit::CreateAttValues(), G4VisAttributes::CreateAttValues(), G4VTrajectory::CreateAttValues(), G4VTrajectoryPoint::CreateAttValues(), G4PhysicalVolumeModel::CreateCurrentAttValues(), G4TrajectoriesModel::CreateCurrentAttValues(), G4VSceneHandler::fpModel, G4VHit::GetAttDefs(), G4VisAttributes::GetAttDefs(), G4VTrajectory::GetAttDefs(), G4VTrajectoryPoint::GetAttDefs(), G4PhysicalVolumeModel::GetAttDefs(), G4TrajectoriesModel::GetAttDefs(), G4HitsModel::GetCurrentHit(), G4TrajectoriesModel::GetCurrentTrajectory(), G4VTrajectory::GetPoint(), G4VTrajectory::GetPointEntries(), and G4Visible::GetVisAttributes().

Referenced by G4OpenInventorSceneHandler::AddCircleSquare(), G4OpenInventorSceneHandler::AddPrimitive(), G4OpenGLImmediateSceneHandler::AddPrimitivePreambleInternal(), and G4OpenGLStoredSceneHandler::AddPrimitivePreambleInternal().

◆ PostAddSolid()

void G4VSceneHandler::PostAddSolid ( )
virtualinherited

◆ PreAddSolid()

void G4VSceneHandler::PreAddSolid ( const G4Transform3D objectTransformation,
const G4VisAttributes visAttribs 
)
virtualinherited

◆ ProcessScene()

void G4VSceneHandler::ProcessScene ( )
protectedvirtualinherited

Reimplemented in G4OpenGLSceneHandler.

Definition at line 612 of file G4VSceneHandler.cc.

613{
614 // Assumes graphics database store has already been cleared if
615 // relevant for the particular scene handler.
616
617 if(!fpScene)
618 return;
619
621 {
622 G4Exception("G4VSceneHandler::ProcessScene", "visman0106", JustWarning,
623 "The scene has no extent.");
624 }
625
627
628 if(!visManager->GetConcreteInstance())
629 return;
630
631 G4VisManager::Verbosity verbosity = visManager->GetVerbosity();
632
633 fReadyForTransients = false;
634
635 // Reset fMarkForClearingTransientStore. (Leaving
636 // fMarkForClearingTransientStore true causes problems with
637 // recomputing transients below.) Restore it again at end...
638 G4bool tmpMarkForClearingTransientStore = fMarkForClearingTransientStore;
640
641 // Traverse geometry tree and send drawing primitives to window(s).
642
643 const std::vector<G4Scene::Model>& runDurationModelList =
645
646 if(runDurationModelList.size())
647 {
648 if(verbosity >= G4VisManager::confirmations)
649 {
650 G4cout << "Traversing scene data..." << G4endl;
651 }
652
654
655 // Create modeling parameters from view parameters...
657
658 for(size_t i = 0; i < runDurationModelList.size(); i++)
659 {
660 if(runDurationModelList[i].fActive)
661 {
662 fpModel = runDurationModelList[i].fpModel;
665 // To see the extents of each model represented as wireframe boxes,
666 // uncomment the next line and DrawExtent in namespace above
667 // DrawExtent(fpModel);
669 }
670 }
671
672 fpModel = 0;
673 delete pMP;
674
675 EndModeling();
676 }
677
678 fReadyForTransients = true;
679
680 // Refresh event from end-of-event model list.
681 // Allow only in Idle or GeomClosed state...
683 G4ApplicationState state = stateManager->GetCurrentState();
684 if(state == G4State_Idle || state == G4State_GeomClosed)
685 {
686 visManager->SetEventRefreshing(true);
687
688 if(visManager->GetRequestedEvent())
689 {
690 DrawEvent(visManager->GetRequestedEvent());
691 }
692 else
693 {
695 if(runManager)
696 {
697 const G4Run* run = runManager->GetCurrentRun();
698 const std::vector<const G4Event*>* events =
699 run ? run->GetEventVector() : 0;
700 size_t nKeptEvents = 0;
701 if(events)
702 nKeptEvents = events->size();
703 if(nKeptEvents)
704 {
706 {
707 if(verbosity >= G4VisManager::confirmations)
708 {
709 G4cout << "Refreshing event..." << G4endl;
710 }
711 const G4Event* event = 0;
712 if(events && events->size())
713 event = events->back();
714 if(event)
715 DrawEvent(event);
716 }
717 else
718 { // Accumulating events.
719
720 if(verbosity >= G4VisManager::confirmations)
721 {
722 G4cout << "Refreshing events in run..." << G4endl;
723 }
724 for(const auto& event : *events)
725 {
726 if(event)
727 DrawEvent(event);
728 }
729
731 {
732 if(verbosity >= G4VisManager::warnings)
733 {
734 G4cout << "WARNING: Cannot refresh events accumulated over more"
735 "\n than one runs. Refreshed just the last run."
736 << G4endl;
737 }
738 }
739 }
740 }
741 }
742 }
743 visManager->SetEventRefreshing(false);
744 }
745
746 // Refresh end-of-run model list.
747 // Allow only in Idle or GeomClosed state...
748 if(state == G4State_Idle || state == G4State_GeomClosed)
749 {
751 }
752
753 fMarkForClearingTransientStore = tmpMarkForClearingTransientStore;
754}
G4ApplicationState
@ G4State_Idle
@ G4State_GeomClosed
static G4RunManager * GetMasterRunManager()
const G4Run * GetCurrentRun() const
Definition: G4Run.hh:49
const std::vector< Model > & GetRunDurationModelList() const
G4bool GetRefreshAtEndOfEvent() const
G4bool GetRefreshAtEndOfRun() const
const G4ApplicationState & GetCurrentState() const
static G4StateManager * GetStateManager()
void SetModelingParameters(const G4ModelingParameters *)
virtual void DescribeYourselfTo(G4VGraphicsScene &)=0
void DrawEvent(const G4Event *)
G4bool fMarkForClearingTransientStore
static G4VVisManager * GetConcreteInstance()
static const G4VisExtent & GetNullExtent()
Definition: G4VisExtent.cc:60
void SetEventRefreshing(G4bool)
const G4Event * GetRequestedEvent() const
Definition: run.py:1

References G4VSceneHandler::BeginModeling(), G4VisManager::confirmations, G4VSceneHandler::CreateModelingParameters(), G4VModel::DescribeYourselfTo(), G4VSceneHandler::DrawEndOfRunModels(), G4VSceneHandler::DrawEvent(), G4VSceneHandler::EndModeling(), G4VSceneHandler::fMarkForClearingTransientStore, G4VSceneHandler::fpModel, G4VSceneHandler::fpScene, G4VSceneHandler::fReadyForTransients, G4cout, G4endl, G4Exception(), G4State_GeomClosed, G4State_Idle, G4VVisManager::GetConcreteInstance(), G4RunManager::GetCurrentRun(), G4StateManager::GetCurrentState(), G4Scene::GetExtent(), G4VisManager::GetInstance(), G4RunManagerFactory::GetMasterRunManager(), G4VisExtent::GetNullExtent(), G4Scene::GetRefreshAtEndOfEvent(), G4Scene::GetRefreshAtEndOfRun(), G4VisManager::GetRequestedEvent(), G4Scene::GetRunDurationModelList(), G4StateManager::GetStateManager(), G4VisManager::GetVerbosity(), JustWarning, G4VisManager::SetEventRefreshing(), G4VModel::SetModelingParameters(), and G4VisManager::warnings.

Referenced by G4OpenGLSceneHandler::ProcessScene(), and G4VViewer::ProcessView().

◆ RemoveViewerFromList()

void G4VSceneHandler::RemoveViewerFromList ( G4VViewer pView)
inherited

Definition at line 493 of file G4VSceneHandler.cc.

493 {
494 fViewerList.remove(pViewer); // Does nothing if already removed
495 // And reset current viewer
496 auto visManager = G4VisManager::GetInstance();
497 visManager->SetCurrentViewer(nullptr);
498}
void remove(G4VViewer *)
Definition: G4ViewerList.cc:30

References G4VSceneHandler::fViewerList, G4VisManager::GetInstance(), and G4ViewerList::remove().

Referenced by G4VViewer::~G4VViewer().

◆ RequestPrimitives()

void G4VSceneHandler::RequestPrimitives ( const G4VSolid solid)
protectedvirtualinherited

Reimplemented in G4ASCIITreeSceneHandler, and G4RayTracerSceneHandler.

Definition at line 516 of file G4VSceneHandler.cc.

517{
520
521 switch (style) {
522 default:
527 {
528 // Use polyhedral representation
530 G4Polyhedron* pPolyhedron = solid.GetPolyhedron ();
532 if (pPolyhedron) {
533 pPolyhedron -> SetVisAttributes (fpVisAttribs);
535 AddPrimitive (*pPolyhedron);
536 EndPrimitives ();
537 break;
538 } else { // Print warnings and drop through to cloud
540 static std::set<const G4VSolid*> problematicSolids;
541 if (verbosity >= G4VisManager::errors &&
542 problematicSolids.find(&solid) == problematicSolids.end()) {
543 problematicSolids.insert(&solid);
544 G4cerr <<
545 "ERROR: G4VSceneHandler::RequestPrimitives"
546 "\n Polyhedron not available for " << solid.GetName ();
547 G4PhysicalVolumeModel* pPVModel = dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
548 if (pPVModel) {
549 G4cerr << "\n Touchable path: " << pPVModel->GetFullPVPath();
550 }
551 static G4bool explanation = false;
552 if (!explanation) {
553 explanation = true;
554 G4cerr <<
555 "\n This means it cannot be visualized in the usual way on most systems."
556 "\n 1) The solid may not have implemented the CreatePolyhedron method."
557 "\n 2) For Boolean solids, the BooleanProcessor, which attempts to create"
558 "\n the resultant polyhedron, may have failed."
559 "\n Try RayTracer. It uses Geant4's tracking algorithms instead.";
560 }
561 G4cerr << "\n Drawing solid with cloud of points.";
562 G4cerr << G4endl;
563 }
564 }
565 }
566 [[fallthrough]];
567
569 {
570 // Form solid out of cloud of dots on surface of solid
571 G4Polymarker dots;
572 // Note: OpenGL has a fast implementation of polymarker so it's better
573 // to build a polymarker rather than add a succession of circles.
574 // And anyway, in Qt, in the latter case each circle would be a scene-tree
575 // entry, something we would want to avoid.
578 dots.SetSize(G4VMarker::screen,1.);
579 G4int numberOfCloudPoints = GetNumberOfCloudPoints(fpVisAttribs);
580 if (numberOfCloudPoints <= 0) numberOfCloudPoints = vp.GetNumberOfCloudPoints();
581 for (G4int i = 0; i < numberOfCloudPoints; ++i) {
583 dots.push_back(p);
584 }
586 AddPrimitive(dots);
587 EndPrimitives ();
588 break;
589 }
590 }
591}
const std::vector< G4PhysicalVolumeNodeID > & GetFullPVPath() const
void SetMarkerType(MarkerType)
void SetSize(SizeType, G4double)
Definition: G4VMarker.cc:94
G4int GetNumberOfCloudPoints(const G4VisAttributes *) const
G4int GetNoOfSides(const G4VisAttributes *)
virtual void EndPrimitives()
G4ViewParameters::DrawingStyle GetDrawingStyle(const G4VisAttributes *)
virtual void BeginPrimitives(const G4Transform3D &objectTransformation=G4Transform3D())
virtual void AddPrimitive(const G4Polyline &)=0
virtual G4ThreeVector GetPointOnSurface() const
Definition: G4VSolid.cc:152
virtual G4Polyhedron * GetPolyhedron() const
Definition: G4VSolid.cc:705
void SetVisAttributes(const G4VisAttributes *)
Definition: G4Visible.cc:96
static void SetNumberOfRotationSteps(G4int n)
static void ResetNumberOfRotationSteps()

References G4VSceneHandler::AddPrimitive(), G4VSceneHandler::BeginPrimitives(), G4ViewParameters::cloud, G4Polymarker::dots, G4VSceneHandler::EndPrimitives(), G4VisManager::errors, G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpModel, G4VSceneHandler::fpViewer, G4VSceneHandler::fpVisAttribs, G4cerr, G4endl, G4VSceneHandler::GetDrawingStyle(), G4PhysicalVolumeModel::GetFullPVPath(), G4VSolid::GetName(), G4VSceneHandler::GetNoOfSides(), G4ViewParameters::GetNumberOfCloudPoints(), G4VSceneHandler::GetNumberOfCloudPoints(), G4VSolid::GetPointOnSurface(), G4VSolid::GetPolyhedron(), G4VisManager::GetVerbosity(), G4VViewer::GetViewParameters(), G4ViewParameters::hlhsr, G4ViewParameters::hlr, G4ViewParameters::hsr, HepPolyhedron::ResetNumberOfRotationSteps(), G4VMarker::screen, G4Polymarker::SetMarkerType(), HepPolyhedron::SetNumberOfRotationSteps(), G4VMarker::SetSize(), G4Visible::SetVisAttributes(), and G4ViewParameters::wireframe.

Referenced by G4VSceneHandler::AddSolidT(), and G4VSceneHandler::AddSolidWithAuxiliaryEdges().

◆ SetCurrentViewer()

void G4VSceneHandler::SetCurrentViewer ( G4VViewer )
inherited

◆ SetMarkForClearingTransientStore()

void G4VSceneHandler::SetMarkForClearingTransientStore ( G4bool  )
inherited

◆ SetModel()

void G4VSceneHandler::SetModel ( G4VModel )
inherited

◆ SetName()

void G4VSceneHandler::SetName ( const G4String )
inherited

◆ SetObjectTransformation()

void G4VSceneHandler::SetObjectTransformation ( const G4Transform3D )
inherited

◆ SetScene()

void G4VSceneHandler::SetScene ( G4Scene pScene)
virtualinherited

Reimplemented in G4OpenGLStoredQtSceneHandler.

Definition at line 507 of file G4VSceneHandler.cc.

507 {
508 fpScene = pScene;
509 // Notify all viewers that a kernel visit is required.
511 for (i = fViewerList.begin(); i != fViewerList.end(); i++) {
512 (*i) -> SetNeedKernelVisit (true);
513 }
514}
std::vector< G4VViewer * >::iterator G4ViewerListIterator
Definition: G4ViewerList.hh:42

References G4VSceneHandler::fpScene, and G4VSceneHandler::fViewerList.

Referenced by G4OpenGLStoredQtSceneHandler::SetScene().

◆ SetTransientsDrawnThisEvent()

void G4VSceneHandler::SetTransientsDrawnThisEvent ( G4bool  )
inherited

◆ SetTransientsDrawnThisRun()

void G4VSceneHandler::SetTransientsDrawnThisRun ( G4bool  )
inherited

◆ SetViewerList()

G4ViewerList & G4VSceneHandler::SetViewerList ( )
inherited

Field Documentation

◆ doneInitHit

G4bool G4HepRepFileSceneHandler::doneInitHit
private

Definition at line 146 of file G4HepRepFileSceneHandler.hh.

Referenced by AddCompound(), G4HepRepFileSceneHandler(), and InitHit().

◆ doneInitTraj

G4bool G4HepRepFileSceneHandler::doneInitTraj
private

◆ drawingHit

G4bool G4HepRepFileSceneHandler::drawingHit
private

◆ drawingTraj

G4bool G4HepRepFileSceneHandler::drawingTraj
private

◆ fIdentityTransformation

const G4Transform3D G4VSceneHandler::fIdentityTransformation
protectedinherited

Definition at line 364 of file G4VSceneHandler.hh.

◆ fileCounter

int G4HepRepFileSceneHandler::fileCounter
private

Definition at line 138 of file G4HepRepFileSceneHandler.hh.

Referenced by CheckFileOpen(), and G4HepRepFileSceneHandler().

◆ fMarkForClearingTransientStore

G4bool G4VSceneHandler::fMarkForClearingTransientStore
protectedinherited

Definition at line 352 of file G4VSceneHandler.hh.

Referenced by G4VSceneHandler::ProcessScene().

◆ fName

G4String G4VSceneHandler::fName
protectedinherited

Definition at line 347 of file G4VSceneHandler.hh.

◆ fNestingDepth

G4int G4VSceneHandler::fNestingDepth
protectedinherited

◆ fObjectTransformation

G4Transform3D G4VSceneHandler::fObjectTransformation
protectedinherited

◆ fpModel

G4VModel* G4VSceneHandler::fpModel
protectedinherited

◆ fProcessing2D

G4bool G4VSceneHandler::fProcessing2D
protectedinherited

◆ fProcessingSolid

G4bool G4VSceneHandler::fProcessingSolid
protectedinherited

◆ fpScene

G4Scene* G4VSceneHandler::fpScene
protectedinherited

◆ fpViewer

G4VViewer* G4VSceneHandler::fpViewer
protectedinherited

Definition at line 350 of file G4VSceneHandler.hh.

Referenced by G4OpenInventorSceneHandler::AddCircleSquare(), G4VtkSceneHandler::AddCompound(), AddHepRepInstance(), G4ToolsSGSceneHandler::AddPrimitive(), G4OpenGLSceneHandler::AddPrimitive(), G4Qt3DSceneHandler::AddPrimitive(), G4VtkSceneHandler::AddPrimitive(), G4OpenInventorSceneHandler::AddPrimitive(), G4OpenGLImmediateSceneHandler::AddPrimitivePreambleInternal(), G4OpenGLStoredSceneHandler::AddPrimitivePreambleInternal(), G4VtkSceneHandler::AddPrimitiveTensorGlyph(), G4OpenInventorSceneHandler::AddProperties(), AddSolid(), G4VSceneHandler::AddSolidT(), G4VSceneHandler::AddSolidWithAuxiliaryEdges(), G4OpenInventorSceneHandler::AddTransform(), G4OpenGLImmediateSceneHandler::BeginPrimitives2D(), G4OpenGLStoredQtSceneHandler::ClearStore(), G4GMocrenFileSceneHandler::ClearTransientStore(), ClearTransientStore(), G4OpenGLImmediateSceneHandler::ClearTransientStore(), G4OpenGLStoredQtSceneHandler::ClearTransientStore(), G4OpenGLStoredSceneHandler::ClearTransientStore(), G4VSceneHandler::CreateModelingParameters(), G4VSceneHandler::CreateSectionSolid(), G4OpenGLStoredSceneHandler::EndModeling(), G4OpenGLStoredQtSceneHandler::ExtraPOProcessing(), G4OpenInventorSceneHandler::GeneratePrerequisites(), G4VSceneHandler::GetAuxEdgeVisible(), G4VSceneHandler::GetColour(), G4VSceneHandler::GetDrawingStyle(), G4VSceneHandler::GetLineWidth(), G4VSceneHandler::GetMarkerSize(), G4VSceneHandler::GetNoOfSides(), G4VSceneHandler::GetNumberOfCloudPoints(), G4VSceneHandler::GetTextColour(), G4GMocrenFileSceneHandler::IsVisible(), G4VSceneHandler::RequestPrimitives(), and G4OpenGLStoredQtSceneHandler::SetScene().

◆ fpVisAttribs

const G4VisAttributes* G4VSceneHandler::fpVisAttribs
protectedinherited

◆ fReadyForTransients

G4bool G4VSceneHandler::fReadyForTransients
protectedinherited

◆ fSceneHandlerId

const G4int G4VSceneHandler::fSceneHandlerId
protectedinherited

Definition at line 346 of file G4VSceneHandler.hh.

◆ fSceneIdCount

G4int G4HepRepFileSceneHandler::fSceneIdCount = 0
staticprotected

Definition at line 132 of file G4HepRepFileSceneHandler.hh.

◆ fSystem

G4VGraphicsSystem& G4VSceneHandler::fSystem
protectedinherited

Definition at line 345 of file G4VSceneHandler.hh.

Referenced by G4VSceneHandler::AddPrimitive().

◆ fTransientsDrawnThisEvent

G4bool G4VSceneHandler::fTransientsDrawnThisEvent
protectedinherited

◆ fTransientsDrawnThisRun

G4bool G4VSceneHandler::fTransientsDrawnThisRun
protectedinherited

◆ fViewCount

G4int G4VSceneHandler::fViewCount
protectedinherited

Definition at line 348 of file G4VSceneHandler.hh.

◆ fViewerList

G4ViewerList G4VSceneHandler::fViewerList
protectedinherited

◆ haveVisible

G4bool G4HepRepFileSceneHandler::haveVisible
private

◆ hepRepXMLWriter

G4HepRepFileXMLWriter* G4HepRepFileSceneHandler::hepRepXMLWriter
private

◆ hitAttDefs

std::map<G4String, G4AttDef>* G4HepRepFileSceneHandler::hitAttDefs
private

Definition at line 153 of file G4HepRepFileSceneHandler.hh.

Referenced by AddCompound(), G4HepRepFileSceneHandler(), and InitHit().

◆ hitAttValues

std::vector<G4AttValue>* G4HepRepFileSceneHandler::hitAttValues
private

Definition at line 152 of file G4HepRepFileSceneHandler.hh.

Referenced by AddCompound(), G4HepRepFileSceneHandler(), and InitHit().

◆ inPrimitives2D

G4bool G4HepRepFileSceneHandler::inPrimitives2D
private

◆ trajAttDefs

std::map<G4String, G4AttDef>* G4HepRepFileSceneHandler::trajAttDefs
private

◆ trajAttValues

std::vector<G4AttValue>* G4HepRepFileSceneHandler::trajAttValues
private

◆ trajContext

const G4VisTrajContext* G4HepRepFileSceneHandler::trajContext
private

◆ warnedAbout2DMarkers

G4bool G4HepRepFileSceneHandler::warnedAbout2DMarkers
private

Definition at line 142 of file G4HepRepFileSceneHandler.hh.

Referenced by AddPrimitive(), and G4HepRepFileSceneHandler().

◆ warnedAbout3DText

G4bool G4HepRepFileSceneHandler::warnedAbout3DText
private

Definition at line 141 of file G4HepRepFileSceneHandler.hh.

Referenced by AddPrimitive(), and G4HepRepFileSceneHandler().


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