Geant4-11
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends
G4Qt3DSceneHandler Class Reference

#include <G4Qt3DSceneHandler.hh>

Inheritance diagram for G4Qt3DSceneHandler:
G4VSceneHandler G4VGraphicsScene

Public Types

enum  MarkerSizeType { world , screen }
 

Public Member Functions

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 &)
 
virtual 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
 
virtual void AddSolid (const G4Box &)
 
virtual void AddSolid (const G4Cons &)
 
virtual void AddSolid (const G4Ellipsoid &)
 
virtual void AddSolid (const G4Orb &)
 
virtual void AddSolid (const G4Para &)
 
virtual void AddSolid (const G4Polycone &)
 
virtual void AddSolid (const G4Polyhedra &)
 
virtual void AddSolid (const G4Sphere &)
 
virtual void AddSolid (const G4TessellatedSolid &)
 
virtual void AddSolid (const G4Torus &)
 
virtual void AddSolid (const G4Trap &)
 
virtual void AddSolid (const G4Trd &)
 
virtual void AddSolid (const G4Tubs &)
 
virtual void AddSolid (const G4VSolid &)
 
template<class T >
void AddSolidT (const T &solid)
 
template<class T >
void AddSolidWithAuxiliaryEdges (const T &solid)
 
void AddViewerToList (G4VViewer *pView)
 
virtual void BeginModeling ()
 
void BeginPrimitives (const G4Transform3D &objectTransformation)
 
void BeginPrimitives2D (const G4Transform3D &objectTransformation)
 
void ClearStore ()
 
void ClearTransientStore ()
 
G4ModelingParametersCreateModelingParameters ()
 
void DrawEndOfRunModels ()
 
void DrawEvent (const G4Event *)
 
virtual void EndModeling ()
 
void EndPrimitives ()
 
void EndPrimitives2D ()
 
 G4Qt3DSceneHandler (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
 
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 ()
 
G4bool IsReadyForTransients () const
 
void PostAddSolid ()
 
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 ~G4Qt3DSceneHandler ()
 

Protected Member Functions

virtual G4DisplacedSolidCreateCutawaySolid ()
 
G4Qt3DQEntityCreateNewNode ()
 
virtual G4DisplacedSolidCreateSectionSolid ()
 
void EstablishG4Qt3DQEntities ()
 
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
 
Qt3DCore::QEntity * fpPersistentObjects
 
std::vector< G4Qt3DQEntity * > fpPhysicalVolumeObjects
 
Qt3DCore::QEntity * fpQt3DScene
 
G4bool fProcessing2D
 
G4bool fProcessingSolid
 
G4ScenefpScene
 
Qt3DCore::QEntity * fpTransientObjects
 
G4VViewerfpViewer
 
const G4VisAttributesfpVisAttribs
 
G4bool fReadyForTransients
 
const G4int fSceneHandlerId
 
G4VGraphicsSystemfSystem
 
G4bool fTransientsDrawnThisEvent
 
G4bool fTransientsDrawnThisRun
 
G4int fViewCount
 
G4ViewerList fViewerList
 

Static Protected Attributes

static G4int fSceneIdCount = 0
 

Friends

class G4Qt3DViewer
 

Detailed Description

Definition at line 40 of file G4Qt3DSceneHandler.hh.

Member Enumeration Documentation

◆ MarkerSizeType

Enumerator
world 
screen 

Definition at line 58 of file G4VSceneHandler.hh.

Constructor & Destructor Documentation

◆ G4Qt3DSceneHandler()

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

Definition at line 69 of file G4Qt3DSceneHandler.cc.

72{
73#ifdef G4QT3DDEBUG
74 G4cout << "G4Qt3DSceneHandler::G4Qt3DSceneHandler called" << G4endl;
75#endif
76 fpQt3DScene = new Qt3DCore::QEntity;
77 fpQt3DScene->setObjectName("G4Qt3DSceneRoot");
79}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
Qt3DCore::QEntity * fpQt3DScene
static G4int fSceneIdCount
G4VSceneHandler(G4VGraphicsSystem &system, G4int id, const G4String &name="")
const char * name(G4int ptype)

References EstablishG4Qt3DQEntities(), fpQt3DScene, G4cout, and G4endl.

◆ ~G4Qt3DSceneHandler()

G4Qt3DSceneHandler::~G4Qt3DSceneHandler ( )
virtual

Definition at line 81 of file G4Qt3DSceneHandler.cc.

82{
83 // Doesn't like this - it gives BAD_ACCESS in delete_entity_recursively.
84 // Curiously the delete traceback shows three calls to this recursively:
85 /*#1 0x0000000100411906 in (anonymous namespace)::delete_entity_recursively(Qt3DCore::QNode*) at /Users/johna/Geant4/geant4-dev/source/visualization/Qt3D/src/G4Qt3DSceneHandler.cc:60
86 #2 0x0000000100411840 in G4Qt3DSceneHandler::~G4Qt3DSceneHandler() at /Users/johna/Geant4/geant4-dev/source/visualization/Qt3D/src/G4Qt3DSceneHandler.cc:169
87 #3 0x0000000100411fc5 in G4Qt3DSceneHandler::~G4Qt3DSceneHandler() at /Users/johna/Geant4/geant4-dev/source/visualization/Qt3D/src/G4Qt3DSceneHandler.cc:168
88 #4 0x0000000100411fe9 in G4Qt3DSceneHandler::~G4Qt3DSceneHandler() at /Users/johna/Geant4/geant4-dev/source/visualization/Qt3D/src/G4Qt3DSceneHandler.cc:168
89 #5 0x0000000101032510 in G4VisManager::~G4VisManager() at /Users/johna/Geant4/geant4-dev/source/visualization/management/src/G4VisManager.cc:214
90 #6 0x0000000100013885 in G4VisExecutive::~G4VisExecutive() at /Users/johna/Geant4/geant4-dev/source/visualization/management/include/G4VisExecutive.hh:119
91 #7 0x00000001000119a5 in G4VisExecutive::~G4VisExecutive() at /Users/johna/Geant4/geant4-dev/source/visualization/management/include/G4VisExecutive.hh:119
92 #8 0x00000001000119c9 in G4VisExecutive::~G4VisExecutive() at /Users/johna/Geant4/geant4-dev/source/visualization/management/include/G4VisExecutive.hh:119
93 #9 0x00000001000117dd in main at /Users/johna/Geant4/geant4-dev/examples/basic/B1/exampleB1.cc:108
94 */
95 //if (fpQt3DScene) delete_entity_recursively(fpQt3DScene);
96}

Member Function Documentation

◆ AddCompound() [1/6]

void G4Qt3DSceneHandler::AddCompound ( const G4Mesh mesh)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 1053 of file G4Qt3DSceneHandler.cc.

1054{
1055 // Special mesh rendering
1056 // Limited to rectangular 3-deep meshes
1057 if (mesh.GetMeshType() != G4Mesh::rectangle ||
1058 mesh.GetMeshDepth() != 3) {
1060 }
1061
1062 auto container = mesh.GetContainerVolume();
1063
1064 static G4bool firstPrint = true;
1066 G4bool print = firstPrint && verbosity >= G4VisManager::confirmations;
1067
1068 if (print) {
1069 G4cout
1070 << "Special case drawing of G4VNestedParameterisation in G4OpenGLSceneHandler"
1071 << '\n' << mesh
1072 << G4endl;
1073 }
1074
1075 // Instantiate a temporary G4PhysicalVolumeModel
1077 tmpMP.SetCulling(true); // This avoids drawing transparent...
1078 tmpMP.SetCullingInvisible(true); // ... or invisble volumes.
1079 const G4bool useFullExtent = true; // To avoid calculating the extent
1080 G4PhysicalVolumeModel tmpPVModel
1081 (container,
1083 G4Transform3D(),
1084 &tmpMP,
1085 useFullExtent);
1086
1087 // Instantiate a pseudo scene so that we can make a "private" descent
1088 // into the nested parameterisation and fill a multimap...
1089 std::multimap<const G4Colour,G4ThreeVector> positionByColour;
1090 G4double halfX = 0., halfY = 0., halfZ = 0.;
1091 struct PseudoScene: public G4PseudoScene {
1092 PseudoScene
1093 (G4PhysicalVolumeModel* pvModel // input...the following are outputs
1094 , std::multimap<const G4Colour,G4ThreeVector>& positionByColour
1095 , G4double& halfX, G4double& halfY, G4double& halfZ)
1096 : fpPVModel(pvModel)
1097 , fPositionByColour(positionByColour)
1098 , fHalfX(halfX), fHalfY(halfY), fHalfZ(halfZ)
1099 {}
1100 using G4PseudoScene::AddSolid; // except for...
1101 void AddSolid(const G4Box& box) {
1102 const G4Colour& colour = fpPVModel->GetCurrentLV()->GetVisAttributes()->GetColour();
1103 const G4ThreeVector& position = fpCurrentObjectTransformation->getTranslation();
1104 fPositionByColour.insert(std::make_pair(colour,position));
1105 fHalfX = box.GetXHalfLength();
1106 fHalfY = box.GetYHalfLength();
1107 fHalfZ = box.GetZHalfLength();
1108 }
1109 G4PhysicalVolumeModel* fpPVModel;
1110 std::multimap<const G4Colour,G4ThreeVector>& fPositionByColour;
1111 G4double &fHalfX, &fHalfY, &fHalfZ;
1112 }
1113 pseudoScene(&tmpPVModel,positionByColour,halfX,halfY,halfZ);
1114
1115 // Make private descent into the nested parameterisation
1116 tmpPVModel.DescribeYourselfTo(pseudoScene);
1117
1118 // Make list of found colours
1119 std::set<G4Colour> setOfColours;
1120 for (const auto& entry: positionByColour) {
1121 setOfColours.insert(entry.first);
1122 }
1123
1124 if (print) {
1125 for (const auto& colour: setOfColours) {
1126 G4cout << "setOfColours: " << colour << G4endl;
1127 }
1128 }
1129
1130 // Draw as dots
1132 G4int nDotsTotal = 0;
1133 for (const auto& colour: setOfColours) {
1134 G4int nDots = 0;
1135 G4Polymarker dots;
1136 dots.SetVisAttributes(G4Colour(colour));
1138 dots.SetSize(G4VMarker::screen,1.);
1139 dots.SetInfo(container->GetName());
1140 const auto range = positionByColour.equal_range(colour);
1141 for (auto posByCol = range.first; posByCol != range.second; ++posByCol) {
1142 const G4double x = posByCol->second.getX() + (2.*G4UniformRand()-1.)*halfX;
1143 const G4double y = posByCol->second.getY() + (2.*G4UniformRand()-1.)*halfY;
1144 const G4double z = posByCol->second.getZ() + (2.*G4UniformRand()-1.)*halfZ;
1145 dots.push_back(G4ThreeVector(x,y,z));
1146 ++nDots;
1147 }
1148 AddPrimitive(dots);
1149 if (print) {
1150 G4cout
1151 << "Number of dots for colour " << colour
1152 << ": " << nDots << G4endl;
1153 }
1154 nDotsTotal += nDots;
1155 }
1156 if (print) {
1157 G4cout << "Total number of dots: " << nDotsTotal << G4endl;
1158 }
1159 EndPrimitives ();
1160
1161 firstPrint = false;
1162
1163 return;
1164}
CLHEP::Hep3Vector G4ThreeVector
HepGeom::Transform3D G4Transform3D
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
void print(G4double elem)
#define G4UniformRand()
Definition: Randomize.hh:52
Definition: G4Box.hh:56
G4double GetYHalfLength() const
G4double GetZHalfLength() const
G4double GetXHalfLength() const
static G4bool GetColour(const G4String &key, G4Colour &result)
Definition: G4Colour.cc:161
MeshType GetMeshType() const
Definition: G4Mesh.hh:62
G4VPhysicalVolume * GetContainerVolume() const
Definition: G4Mesh.hh:61
const G4Transform3D & GetTransform() const
Definition: G4Mesh.hh:64
@ rectangle
Definition: G4Mesh.hh:52
G4int GetMeshDepth() const
Definition: G4Mesh.hh:63
void SetCulling(G4bool)
void SetCullingInvisible(G4bool)
void SetMarkerType(MarkerType)
void AddSolid(const G4Box &solid)
void AddPrimitive(const G4Polyline &)
void BeginPrimitives(const G4Transform3D &objectTransformation)
virtual void SetInfo(const G4String &info)
void SetSize(SizeType, G4double)
Definition: G4VMarker.cc:94
virtual void AddSolid(const G4Box &)
virtual void AddCompound(const G4VTrajectory &)
static Verbosity GetVerbosity()
void SetVisAttributes(const G4VisAttributes *)
Definition: G4Visible.cc:96

References G4VSceneHandler::AddCompound(), AddPrimitive(), G4VSceneHandler::AddSolid(), G4PseudoScene::AddSolid(), BeginPrimitives(), G4VisManager::confirmations, G4PhysicalVolumeModel::DescribeYourselfTo(), G4Polymarker::dots, EndPrimitives(), G4cout, G4endl, G4UniformRand, G4Colour::GetColour(), G4Mesh::GetContainerVolume(), G4Mesh::GetMeshDepth(), G4Mesh::GetMeshType(), G4Mesh::GetTransform(), G4VisManager::GetVerbosity(), G4Box::GetXHalfLength(), G4Box::GetYHalfLength(), G4Box::GetZHalfLength(), print(), G4Mesh::rectangle, G4VMarker::screen, G4ModelingParameters::SetCulling(), G4ModelingParameters::SetCullingInvisible(), G4VMarker::SetInfo(), G4Polymarker::SetMarkerType(), G4VMarker::SetSize(), G4Visible::SetVisAttributes(), and G4PhysicalVolumeModel::UNLIMITED.

◆ AddCompound() [2/6]

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

Implements G4VGraphicsScene.

Reimplemented in G4GMocrenFileSceneHandler, G4HepRepFileSceneHandler, G4OpenGLSceneHandler, G4VRML2FileSceneHandler, and G4GMocrenFileSceneHandler.

Definition at line 340 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}
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

References G4VScoringMesh::DrawMesh(), G4cout, G4endl, G4ScoringManager::GetMesh(), G4VSceneHandler::GetName(), G4ScoringManager::GetNumberOfMesh(), G4VScoringMesh::GetScoreMap(), G4ScoringManager::GetScoringManagerIfExist(), and G4VScoringMesh::IsActive().

◆ AddCompound() [3/6]

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

Implements G4VGraphicsScene.

Reimplemented in G4GMocrenFileSceneHandler, G4HepRepFileSceneHandler, G4OpenGLSceneHandler, G4VRML2FileSceneHandler, and G4GMocrenFileSceneHandler.

Definition at line 383 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}

References G4VScoringMesh::DrawMesh(), G4cout, G4endl, G4ScoringManager::GetMesh(), G4ScoringManager::GetNumberOfMesh(), G4VScoringMesh::GetScoreMap(), G4ScoringManager::GetScoringManagerIfExist(), and G4VScoringMesh::IsActive().

◆ AddCompound() [4/6]

void G4VSceneHandler::AddCompound ( const G4VDigi digi)
virtualinherited

Implements G4VGraphicsScene.

Reimplemented in G4GMocrenFileSceneHandler, G4HepRepFileSceneHandler, G4OpenGLSceneHandler, G4VRML2FileSceneHandler, and G4GMocrenFileSceneHandler.

Definition at line 335 of file G4VSceneHandler.cc.

335 {
336 // Cast away const because Draw is non-const!!!!
337 const_cast<G4VDigi&>(digi).Draw();
338}

◆ AddCompound() [5/6]

void G4VSceneHandler::AddCompound ( const G4VHit hit)
virtualinherited

Implements G4VGraphicsScene.

Reimplemented in G4GMocrenFileSceneHandler, G4HepRepFileSceneHandler, G4HepRepFileSceneHandler, G4OpenGLSceneHandler, G4VRML2FileSceneHandler, and G4GMocrenFileSceneHandler.

Definition at line 330 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/6]

void G4VSceneHandler::AddCompound ( const G4VTrajectory traj)
virtualinherited

Implements G4VGraphicsScene.

Reimplemented in G4GMocrenFileSceneHandler, G4HepRepFileSceneHandler, G4HepRepFileSceneHandler, G4OpenGLSceneHandler, G4VRML2FileSceneHandler, and G4GMocrenFileSceneHandler.

Definition at line 318 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
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
virtual void DrawTrajectory() const

References G4VTrajectory::DrawTrajectory(), FatalException, G4VSceneHandler::fpModel, and G4Exception().

Referenced by AddCompound(), G4VtkSceneHandler::AddCompound(), G4HepRepFileSceneHandler::AddCompound(), G4OpenGLSceneHandler::AddCompound(), and G4GMocrenFileSceneHandler::AddCompound().

◆ AddPrimitive() [1/13]

void G4Qt3DSceneHandler::AddPrimitive ( const G4Circle circle)
virtual

Implements G4VSceneHandler.

Definition at line 560 of file G4Qt3DSceneHandler.cc.

561{
562#ifdef G4QT3DDEBUG
563 G4cout <<
564 "G4Qt3DSceneHandler::AddPrimitive(const G4Circle& circle) called.\n"
565 << circle
566 << G4endl;
567#endif
568
569#ifdef G4QT3DDEBUG
570 MarkerSizeType sizeType;
571 G4double size = GetMarkerSize (circle, sizeType);
572 switch (sizeType) {
573 default:
574 case screen:
575 // Draw in screen coordinates.
576 G4cout << "screen";
577 break;
578 case world:
579 // Draw in world coordinates.
580 G4cout << "world";
581 break;
582 }
583 G4cout << " size: " << size << G4endl;
584#endif
585
586 auto currentNode = CreateNewNode();
587 if (!currentNode) {
588 static G4bool first = true;
589 if (first) {
590 first = false;
591 G4Exception("G4Qt3DSceneHandler::AddPrimitive(const G4Circle&)",
592 "qt3d-0003", JustWarning,
593 "No available node!");
594 }
595 return;
596 }
597
599
602
603 const auto& colour = fpVisAttribs->GetColour();
604 auto material = new Qt3DExtras::QDiffuseSpecularMaterial();
605 material->setObjectName("materialForCircle");
606 material->setAmbient(G4Qt3DUtils::ConvertToQColor(colour));
607 if (colour.GetAlpha() < 1.) material->setAlphaBlendingEnabled(true);
608
609 auto sphereMesh = new Qt3DExtras::QSphereMesh;
610 sphereMesh->setObjectName("sphereMesh");
611 G4double radius;
612 if (circle.GetSizeType() == G4VMarker::world ) {
613 radius =circle.GetWorldRadius();
614 } else { // Screen-size or none
615 // Not figured out how to do screen-size, so use scene extent
616 const G4double scale = 200.; // Roughly pixles per scene
617 radius = circle.GetScreenRadius()*fpScene->GetExtent().GetExtentRadius()/scale;
618 }
619 sphereMesh->setRadius(radius);
620
621 auto currentEntity = new Qt3DCore::QEntity(currentNode);
622 currentEntity->addComponent(material);
623 currentEntity->addComponent(transform);
624 currentEntity->addComponent(sphereMesh);
625}
@ JustWarning
HepGeom::Translate3D G4Translate3D
G4Qt3DQEntity * CreateNewNode()
const G4VisExtent & GetExtent() const
SizeType GetSizeType() const
Definition: G4VMarker.cc:87
G4double GetScreenRadius() const
G4Point3D GetPosition() const
G4double GetWorldRadius() const
G4Transform3D fObjectTransformation
G4double GetMarkerSize(const G4VMarker &, MarkerSizeType &)
G4VViewer * fpViewer
const G4VisAttributes * fpVisAttribs
const G4VisAttributes * GetApplicableVisAttributes(const G4VisAttributes *) const
const G4Colour & GetColour() const
G4double GetExtentRadius() const
Definition: G4VisExtent.cc:75
const G4VisAttributes * GetVisAttributes() const
Qt3DCore::QTransform * CreateQTransformFrom(const G4Transform3D &)
Definition: G4Qt3DUtils.cc:33
QColor ConvertToQColor(const G4Colour &c)
Definition: G4Qt3DUtils.cc:46
G4bool transform(G4String &input, const G4String &type)
string material
Definition: eplot.py:19

References G4Qt3DUtils::ConvertToQColor(), CreateNewNode(), G4Qt3DUtils::CreateQTransformFrom(), G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpScene, G4VSceneHandler::fpViewer, G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4Exception(), G4VViewer::GetApplicableVisAttributes(), G4VisAttributes::GetColour(), G4Scene::GetExtent(), G4VisExtent::GetExtentRadius(), G4VSceneHandler::GetMarkerSize(), G4VMarker::GetPosition(), G4VMarker::GetScreenRadius(), G4VMarker::GetSizeType(), G4Visible::GetVisAttributes(), G4VMarker::GetWorldRadius(), JustWarning, eplot::material, G4VSceneHandler::screen, G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform(), G4VMarker::world, and G4VSceneHandler::world.

◆ 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 G4Qt3DSceneHandler::AddPrimitive ( const G4Polyhedron polyhedron)
virtual

Implements G4VSceneHandler.

Definition at line 696 of file G4Qt3DSceneHandler.cc.

697{
698 auto currentNode = CreateNewNode();
699 if (!currentNode) {
700 static G4bool first = true;
701 if (first) {
702 first = false;
703 G4Exception("G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron&)",
704 "qt3d-0003", JustWarning,
705 "No available node!");
706 }
707 return;
708 }
709
710 if (polyhedron.GetNoFacets() == 0) return;
711
713
714 // Roll out vertices and normals for the faces. Note that this means vertices
715 // are duplicated. For example a box has 8 vertices, but to define 6 faces
716 // you need 12 triangles and 36 vertices. If it was just a matter of vertices
717 // we could restrict the number to 8 and use the indices to define the
718 // triangles, but we also have to consider the normals. A vertex can be have
719 // more than one normal, depending on which face it is being used to define.
720 // So we roll out all the vertices and normals for each triangle.
721 std::vector<G4Point3D> vertices;
722 std::vector<G4Normal3D> normals;
723
724 // Also roll out edges (as lines) for wireframe. Avoid duplicate lines,
725 // including those that differ only in the order of vertices.
726 typedef std::pair<G4Point3D,G4Point3D> Line;
727 std::vector<Line> lines;
728 auto insertIfNew = [&lines](const Line& newLine) {
729 for (const auto& line: lines) {
730 if ((newLine.first==line.first && newLine.second==line.second) ||
731 (newLine.first==line.second && newLine.second==line.first))
732 return;
733 }
734 lines.push_back(newLine);
735 };
736
737 G4bool isAuxilaryEdgeVisible = fpViewer->GetViewParameters().IsAuxEdgeVisible();
738 G4bool notLastFace;
739 do {
740 G4int nEdges;
741 G4Point3D vertex [4];
742 G4int edgeFlag[4];
743 G4Normal3D normal [4];
744 notLastFace = polyhedron.GetNextFacet(nEdges, vertex, edgeFlag, normal);
745 vertices.push_back(vertex[0]);
746 vertices.push_back(vertex[1]);
747 vertices.push_back(vertex[2]);
748 normals.push_back(normal[0]);
749 normals.push_back(normal[1]);
750 normals.push_back(normal[2]);
751 if(isAuxilaryEdgeVisible||edgeFlag[0]>0)insertIfNew(Line(vertex[0],vertex[1]));
752 if(isAuxilaryEdgeVisible||edgeFlag[1]>0)insertIfNew(Line(vertex[1],vertex[2]));
753 if (nEdges == 3) {
754 // Face is a triangle
755 // One more line for wireframe, triangles for surfaces are complete
756 if(isAuxilaryEdgeVisible||edgeFlag[2]>0)insertIfNew(Line(vertex[2],vertex[0]));
757 } else if (nEdges == 4) {
758 // Face is a quadrilateral
759 // Create another triangle for surfaces, add two more lines for wireframe
760 vertices.push_back(vertex[2]);
761 vertices.push_back(vertex[3]);
762 vertices.push_back(vertex[0]);
763 normals.push_back(normal[2]);
764 normals.push_back(normal[3]);
765 normals.push_back(normal[0]);
766 if(isAuxilaryEdgeVisible||edgeFlag[2]>0)insertIfNew(Line(vertex[2],vertex[3]));
767 if(isAuxilaryEdgeVisible||edgeFlag[3]>0)insertIfNew(Line(vertex[3],vertex[0]));
768 } else {
769 G4cerr
770 << "ERROR: polyhedron face with unexpected number of edges (" << nEdges << ')'
771 << "\n Tag: " << fpModel->GetCurrentTag()
772 << G4endl;
773 return;
774 }
775 } while (notLastFace);
776 const auto nVerts = vertices.size();
777 const auto nLines = lines.size();
778
779 // Now put stuff into Qt objects
780
782 transform->setObjectName("transform");
783
784 Qt3DCore::QEntity* wireframeEntity = nullptr;
785 Qt3DCore::QEntity* surfaceEntity = nullptr;
786 static G4int errorCount = 0;
788 switch (drawing_style) {
790 wireframeEntity = new Qt3DCore::QEntity(currentNode);
791 wireframeEntity->addComponent(transform);
792 break;
794 wireframeEntity = new Qt3DCore::QEntity(currentNode);
795 wireframeEntity->addComponent(transform);
796 surfaceEntity = new Qt3DCore::QEntity(currentNode);
797 surfaceEntity->addComponent(transform);
798 break;
800 surfaceEntity = new Qt3DCore::QEntity(currentNode);
801 surfaceEntity->addComponent(transform);
802 break;
804 wireframeEntity = new Qt3DCore::QEntity(currentNode);
805 wireframeEntity->addComponent(transform);
806 surfaceEntity = new Qt3DCore::QEntity(currentNode);
807 surfaceEntity->addComponent(transform);
808 break;
810 // Shouldn't happen in this function (it's a polyhedron!)
811 if (errorCount == 0) {
812 ++errorCount;
813 G4cerr << "WARNING: Qt3D: cloud drawing not implemented" << G4endl;
814 }
815 return;
816 break;
817 }
818
819 const auto vertexByteSize = 3*sizeof(PRECISION);
820
821 Qt3DRender::QGeometry* vertexGeometry = nullptr;
822 Qt3DRender::QGeometry* lineGeometry = nullptr;
823
824 Qt3DRender::QAttribute* positionAtt = nullptr;
825 Qt3DRender::QAttribute* normalAtt = nullptr;
826 Qt3DRender::QAttribute* lineAtt = nullptr;
827
828 Qt3DRender::QBuffer* vertexBuffer = nullptr;
829 if (drawing_style == G4ViewParameters::hlr ||
830 drawing_style == G4ViewParameters::hsr ||
831 drawing_style == G4ViewParameters::hlhsr) {
832
833 // Put vertices, normals into QByteArray
834 // Accomodates both vertices and normals - hence 2*
835 QByteArray vertexByteArray;
836 const auto vertexBufferByteSize = 2*nVerts*vertexByteSize;
837 vertexByteArray.resize(vertexBufferByteSize);
838 auto vertexBufferArray = reinterpret_cast<PRECISION*>(vertexByteArray.data());
839 G4int i1 = 0;
840 for (size_t i = 0; i < nVerts; i++) {
841 vertexBufferArray[i1++] = vertices[i].x();
842 vertexBufferArray[i1++] = vertices[i].y();
843 vertexBufferArray[i1++] = vertices[i].z();
844 vertexBufferArray[i1++] = normals[i].x();
845 vertexBufferArray[i1++] = normals[i].y();
846 vertexBufferArray[i1++] = normals[i].z();
847 }
848 // Vertex buffer (vertices and normals)
849 vertexGeometry = new Qt3DRender::QGeometry();
850 vertexGeometry->setObjectName("vertexGeometry");
851 vertexBuffer = new Qt3DRender::QBuffer(vertexGeometry);
852 vertexBuffer->setObjectName("Vertex buffer");
853 vertexBuffer->setData(vertexByteArray);
854
855 // Position attribute
856 positionAtt = new Qt3DRender::QAttribute;
857 positionAtt->setObjectName("Position attribute");
858 positionAtt->setName(Qt3DRender::QAttribute::defaultPositionAttributeName());
859 positionAtt->setBuffer(vertexBuffer);
860 positionAtt->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
861 positionAtt->setVertexBaseType(BASETYPE);
862 positionAtt->setVertexSize(3);
863 positionAtt->setCount(nVerts);
864 positionAtt->setByteOffset(0);
865 positionAtt->setByteStride(2*vertexByteSize);
866
867 // Normal attribute
868 normalAtt = new Qt3DRender::QAttribute;
869 normalAtt->setObjectName("Normal attribute");
870 normalAtt->setName(Qt3DRender::QAttribute::defaultNormalAttributeName());
871 normalAtt->setBuffer(vertexBuffer);
872 normalAtt->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
873 normalAtt->setVertexBaseType(BASETYPE);
874 normalAtt->setVertexSize(3);
875 normalAtt->setCount(nVerts);
876 normalAtt->setByteOffset(vertexByteSize);
877 normalAtt->setByteStride(2*vertexByteSize);
878 }
879
880 Qt3DRender::QBuffer* lineBuffer = nullptr;
881 if (drawing_style == G4ViewParameters::wireframe ||
882 drawing_style == G4ViewParameters::hlr ||
883 drawing_style == G4ViewParameters::hlhsr) {
884
885 // Put lines into a QByteArray
886 QByteArray lineByteArray;
887 const auto lineBufferByteSize = 2*nLines*vertexByteSize;
888 lineByteArray.resize(lineBufferByteSize);
889 auto lineBufferArray = reinterpret_cast<PRECISION*>(lineByteArray.data());
890 G4int i2 = 0;
891 for (const auto& line: lines) {
892 lineBufferArray[i2++] = line.first.x();
893 lineBufferArray[i2++] = line.first.y();
894 lineBufferArray[i2++] = line.first.z();
895 lineBufferArray[i2++] = line.second.x();
896 lineBufferArray[i2++] = line.second.y();
897 lineBufferArray[i2++] = line.second.z();
898 }
899 // Line loop buffer
900 lineGeometry = new Qt3DRender::QGeometry();
901 lineGeometry->setObjectName("lineGeometry");
902 lineBuffer = new Qt3DRender::QBuffer(lineGeometry);
903 lineBuffer->setObjectName("Line buffer");
904 lineBuffer->setData(lineByteArray);
905
906 // Line attribute
907 lineAtt = new Qt3DRender::QAttribute;
908 lineAtt->setObjectName("Position attribute");
909 lineAtt->setName(Qt3DRender::QAttribute::defaultPositionAttributeName());
910 lineAtt->setBuffer(lineBuffer);
911 lineAtt->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
912 lineAtt->setVertexBaseType(BASETYPE);
913 lineAtt->setVertexSize(3);
914 lineAtt->setCount(nLines);
915 lineAtt->setByteOffset(0);
916 lineAtt->setByteStride(vertexByteSize);
917 }
918
919 // Create material and renderer(s)...
920
921 const auto& colour = fpVisAttribs->GetColour();
922 Qt3DExtras::QDiffuseSpecularMaterial* material;
923 Qt3DRender::QGeometryRenderer* renderer;
924 switch (drawing_style) {
925
927
928 lineGeometry->addAttribute(lineAtt);
929
930 material = new Qt3DExtras::QDiffuseSpecularMaterial();
931 material->setObjectName("materialForWireframe");
932 material->setAmbient(G4Qt3DUtils::ConvertToQColor(colour));
933 material->setShininess(0.);
934 material->setSpecular(0.);
935 wireframeEntity->addComponent(material);
936
937 renderer = new Qt3DRender::QGeometryRenderer;
938 renderer->setObjectName("polyhedronWireframeRenderer");
939 renderer->setGeometry(lineGeometry);
940 renderer->setVertexCount(2*nLines);
941 renderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Lines);
942 wireframeEntity->addComponent(renderer);
943
944 break;
945
947
948 // Surfaces with background colour to hide the edges
949
950 vertexGeometry->addAttribute(positionAtt);
951 vertexGeometry->addAttribute(normalAtt);
952
953 material = new Qt3DExtras::QDiffuseSpecularMaterial();
954 material->setObjectName("materialForHiddenLines");
955 material->setAmbient(Qt::white); // White for now (should be from fVP)
956 material->setShininess(0.);
957 material->setSpecular(0.);
958 surfaceEntity->addComponent(material);
959
960 renderer = new Qt3DRender::QGeometryRenderer;
961 renderer->setObjectName("polyhedronSurfaceRenderer");
962 renderer->setGeometry(vertexGeometry);
963 renderer->setVertexCount(nVerts);
964 renderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Triangles);
965 surfaceEntity->addComponent(renderer);
966
967 // Edges
968
969 lineGeometry->addAttribute(lineAtt);
970
971 material = new Qt3DExtras::QDiffuseSpecularMaterial();
972 material->setObjectName("materialForWireFrame");
973 material->setAmbient(G4Qt3DUtils::ConvertToQColor(colour));
974 material->setShininess(0.);
975 material->setSpecular(0.);
976 wireframeEntity->addComponent(material);
977
978 renderer = new Qt3DRender::QGeometryRenderer;
979 renderer->setObjectName("polyhedronWireframeRenderer");
980 renderer->setGeometry(lineGeometry);
981 renderer->setVertexCount(2*nLines);
982 renderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Lines);
983 wireframeEntity->addComponent(renderer);
984
985 break;
986
988
989 vertexGeometry->addAttribute(positionAtt);
990 vertexGeometry->addAttribute(normalAtt);
991
992 material = new Qt3DExtras::QDiffuseSpecularMaterial();
993 material->setObjectName("materialForSurface");
994 material->setAmbient(G4Qt3DUtils::ConvertToQColor(colour));
995 if (colour.GetAlpha() < 1.) material->setAlphaBlendingEnabled(true);
996 surfaceEntity->addComponent(material);
997
998 renderer = new Qt3DRender::QGeometryRenderer;
999 renderer->setObjectName("polyhedronSurfaceRenderer");
1000 renderer->setGeometry(vertexGeometry);
1001 renderer->setVertexCount(nVerts);
1002 renderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Triangles);
1003 surfaceEntity->addComponent(renderer);
1004
1005 break;
1006
1008
1009 // Surfaces
1010
1011 vertexGeometry->addAttribute(positionAtt);
1012 vertexGeometry->addAttribute(normalAtt);
1013
1014 material = new Qt3DExtras::QDiffuseSpecularMaterial();
1015 material->setObjectName("materialForSurface");
1016 material->setAmbient(G4Qt3DUtils::ConvertToQColor(colour));
1017 if (colour.GetAlpha() < 1.) material->setAlphaBlendingEnabled(true);
1018 surfaceEntity->addComponent(material);
1019
1020 renderer = new Qt3DRender::QGeometryRenderer;
1021 renderer->setObjectName("polyhedronSurfaceRenderer");
1022 renderer->setGeometry(vertexGeometry);
1023 renderer->setVertexCount(nVerts);
1024 renderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Triangles);
1025 surfaceEntity->addComponent(renderer);
1026
1027 // Edges
1028
1029 lineGeometry->addAttribute(lineAtt);
1030
1031 material = new Qt3DExtras::QDiffuseSpecularMaterial();
1032 material->setObjectName("materialForWireframe");
1033 material->setAmbient(G4Qt3DUtils::ConvertToQColor(colour));
1034 material->setShininess(0.);
1035 material->setSpecular(0.);
1036 wireframeEntity->addComponent(material);
1037
1038 renderer = new Qt3DRender::QGeometryRenderer;
1039 renderer->setObjectName("polyhedronSurfaceRenderer");
1040 renderer->setGeometry(lineGeometry);
1041 renderer->setVertexCount(2*nLines);
1042 renderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Lines);
1043 wireframeEntity->addComponent(renderer);
1044
1045 break;
1046
1048 // Case trapped at start of function, so no need to implement
1049 break;
1050 }
1051}
#define PRECISION
#define BASETYPE
virtual G4String GetCurrentTag() const
Definition: G4VModel.cc:46
G4ViewParameters::DrawingStyle GetDrawingStyle(const G4VisAttributes *)
const G4ViewParameters & GetViewParameters() const
G4bool IsAuxEdgeVisible() const
G4int GetNoFacets() const
G4bool GetNextFacet(G4int &n, G4Point3D *nodes, G4int *edgeFlags=0, G4Normal3D *normals=0) const
static double normal(HepRandomEngine *eptr)
Definition: RandPoisson.cc:79

References BASETYPE, G4ViewParameters::cloud, G4Qt3DUtils::ConvertToQColor(), CreateNewNode(), G4Qt3DUtils::CreateQTransformFrom(), G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpModel, G4VSceneHandler::fpViewer, G4VSceneHandler::fpVisAttribs, G4cerr, G4endl, G4Exception(), G4VViewer::GetApplicableVisAttributes(), G4VisAttributes::GetColour(), G4VModel::GetCurrentTag(), G4VSceneHandler::GetDrawingStyle(), HepPolyhedron::GetNextFacet(), HepPolyhedron::GetNoFacets(), G4VViewer::GetViewParameters(), G4Visible::GetVisAttributes(), G4ViewParameters::hlhsr, G4ViewParameters::hlr, G4ViewParameters::hsr, G4ViewParameters::IsAuxEdgeVisible(), JustWarning, eplot::material, CLHEP::normal(), PRECISION, G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform(), and G4ViewParameters::wireframe.

◆ AddPrimitive() [5/13]

virtual void G4VSceneHandler::AddPrimitive ( const G4Polyhedron )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [6/13]

void G4Qt3DSceneHandler::AddPrimitive ( const G4Polyline polyline)
virtual

Implements G4VSceneHandler.

Definition at line 257 of file G4Qt3DSceneHandler.cc.

258{
259#ifdef G4QT3DDEBUG
260 G4cout <<
261 "G4Qt3DSceneHandler::AddPrimitive(const G4Polyline& polyline) called.\n"
262 << polyline
263 << G4endl;
264#endif
265
266 if (polyline.size() == 0) return;
267
268 auto currentNode = CreateNewNode();
269 if (!currentNode) {
270 static G4bool first = true;
271 if (first) {
272 first = false;
273 G4Exception("G4Qt3DSceneHandler::AddPrimitive(const G4Polyline&)",
274 "qt3d-0003", JustWarning,
275 "No available node!");
276 }
277 return;
278 }
279
281
283 transform->setObjectName("transform");
284
285 auto polylineEntity = new Qt3DCore::QEntity(currentNode);
286 polylineEntity->addComponent(transform);
287
288 const auto vertexByteSize = 3*sizeof(PRECISION);
289
290 const size_t nLines = polyline.size() - 1;
291 QByteArray polylineByteArray;
292 const auto polylineBufferByteSize = 2*nLines*vertexByteSize;
293 polylineByteArray.resize(polylineBufferByteSize);
294 auto polylineBufferArray = reinterpret_cast<PRECISION*>(polylineByteArray.data());
295 G4int iLine = 0;
296 for (size_t i = 0; i < nLines; ++i) {
297 polylineBufferArray[iLine++] = polyline[i].x();
298 polylineBufferArray[iLine++] = polyline[i].y();
299 polylineBufferArray[iLine++] = polyline[i].z();
300 polylineBufferArray[iLine++] = polyline[i+1].x();
301 polylineBufferArray[iLine++] = polyline[i+1].y();
302 polylineBufferArray[iLine++] = polyline[i+1].z();
303 }
304 auto polylineGeometry = new Qt3DRender::QGeometry();
305 polylineGeometry->setObjectName("polylineGeometry");
306 auto polylineBuffer = new Qt3DRender::QBuffer(polylineGeometry);
307 polylineBuffer->setObjectName("Polyline buffer");
308 polylineBuffer->setData(polylineByteArray);
309
310 auto polylineAtt = new Qt3DRender::QAttribute;
311 polylineAtt->setObjectName("Position attribute");
312 polylineAtt->setName(Qt3DRender::QAttribute::defaultPositionAttributeName());
313 polylineAtt->setBuffer(polylineBuffer);
314 polylineAtt->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
315 polylineAtt->setVertexBaseType(BASETYPE);
316 polylineAtt->setVertexSize(3);
317 polylineAtt->setCount(nLines);
318 polylineAtt->setByteOffset(0);
319 polylineAtt->setByteStride(vertexByteSize);
320
321 const auto& colour = fpVisAttribs->GetColour();
322
323 polylineGeometry->addAttribute(polylineAtt);
324
325 auto material = new Qt3DExtras::QDiffuseSpecularMaterial();
326 material->setObjectName("materialForPolyline");
327 material->setAmbient(G4Qt3DUtils::ConvertToQColor(colour));
328 material->setShininess(0.);
329 material->setSpecular(0.);
330 polylineEntity->addComponent(material);
331
332 auto renderer = new Qt3DRender::QGeometryRenderer;
333 renderer->setObjectName("polylineWireframeRenderer");
334 renderer->setGeometry(polylineGeometry);
335 renderer->setVertexCount(2*nLines);
336 renderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Lines);
337 polylineEntity->addComponent(renderer);
338}

References BASETYPE, G4Qt3DUtils::ConvertToQColor(), CreateNewNode(), G4Qt3DUtils::CreateQTransformFrom(), G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpViewer, G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4Exception(), G4VViewer::GetApplicableVisAttributes(), G4VisAttributes::GetColour(), G4Visible::GetVisAttributes(), JustWarning, eplot::material, PRECISION, and G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform().

Referenced by AddCompound().

◆ 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}
MarkerType GetMarkerType() const

◆ AddPrimitive() [9/13]

void G4Qt3DSceneHandler::AddPrimitive ( const G4Polymarker polymarker)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 340 of file G4Qt3DSceneHandler.cc.

341{
342 if (polymarker.size() == 0) return;
343
344 auto currentNode = CreateNewNode();
345 if (!currentNode) {
346 static G4bool first = true;
347 if (first) {
348 first = false;
349 G4Exception("G4Qt3DSceneHandler::AddPrimitive(const G4Polymarker&)",
350 "qt3d-0003", JustWarning,
351 "No available node!");
352 }
353 return;
354 }
355
357
358 switch (polymarker.GetMarkerType()) {
359 default:
361 {
362 const size_t nDots = polymarker.size();
363
365 transform->setObjectName("transform");
366
367 auto polymarkerEntity = new Qt3DCore::QEntity(currentNode);
368 polymarkerEntity->addComponent(transform);
369
370 const auto vertexByteSize = 3*sizeof(PRECISION);
371
372 QByteArray polymarkerByteArray;
373 const auto polymarkerBufferByteSize = nDots*vertexByteSize;
374 polymarkerByteArray.resize(polymarkerBufferByteSize);
375 auto polymarkerBufferArray = reinterpret_cast<PRECISION*>(polymarkerByteArray.data());
376 G4int iMarker = 0;
377 for (size_t i = 0; i < polymarker.size(); ++i) {
378 polymarkerBufferArray[iMarker++] = polymarker[i].x();
379 polymarkerBufferArray[iMarker++] = polymarker[i].y();
380 polymarkerBufferArray[iMarker++] = polymarker[i].z();
381 }
382 auto polymarkerGeometry = new Qt3DRender::QGeometry();
383 polymarkerGeometry->setObjectName("polymarkerGeometry");
384 auto polymarkerBuffer = new Qt3DRender::QBuffer(polymarkerGeometry);
385 polymarkerBuffer->setObjectName("Polymarker buffer");
386 polymarkerBuffer->setData(polymarkerByteArray);
387
388 auto polymarkerAtt = new Qt3DRender::QAttribute;
389 polymarkerAtt->setObjectName("Position attribute");
390 polymarkerAtt->setName(Qt3DRender::QAttribute::defaultPositionAttributeName());
391 polymarkerAtt->setBuffer(polymarkerBuffer);
392 polymarkerAtt->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
393 polymarkerAtt->setVertexBaseType(BASETYPE);
394 polymarkerAtt->setVertexSize(3);
395 polymarkerAtt->setCount(nDots);
396 polymarkerAtt->setByteOffset(0);
397 polymarkerAtt->setByteStride(vertexByteSize);
398
399 const auto& colour = fpVisAttribs->GetColour();
400
401 polymarkerGeometry->addAttribute(polymarkerAtt);
402
403 auto material = new Qt3DExtras::QDiffuseSpecularMaterial();
404 material->setObjectName("materialForPolymarker");
405 material->setAmbient(G4Qt3DUtils::ConvertToQColor(colour));
406 material->setShininess(0.);
407 material->setSpecular(0.);
408 polymarkerEntity->addComponent(material);
409
410 auto renderer = new Qt3DRender::QGeometryRenderer;
411 renderer->setObjectName("polymarkerWireframeRenderer");
412 renderer->setGeometry(polymarkerGeometry);
413 renderer->setVertexCount(nDots);
414 renderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Points);
415 polymarkerEntity->addComponent(renderer);
416 }
417 break;
419 {
420 G4Circle circle (polymarker); // Default circle
421
422 const auto& colour = fpVisAttribs->GetColour();
423 auto material = new Qt3DExtras::QDiffuseSpecularMaterial();
424 material->setObjectName("materialForCircle");
425 material->setAmbient(G4Qt3DUtils::ConvertToQColor(colour));
426 if (colour.GetAlpha() < 1.) material->setAlphaBlendingEnabled(true);
427
428 auto sphereMesh = new Qt3DExtras::QSphereMesh;
429 sphereMesh->setObjectName("sphereMesh");
430 G4double radius;
431 if (circle.GetSizeType() == G4VMarker::world ) {
432 radius =circle.GetWorldRadius();
433 } else { // Screen-size or none
434 // Not figured out how to do screen-size, so use scene extent
435 const G4double scale = 200.; // Roughly pixels per scene
436 radius = circle.GetScreenRadius()*fpScene->GetExtent().GetExtentRadius()/scale;
437 }
438 sphereMesh->setRadius(radius);
439// sphereMesh->setInstanceCount(polymarker.size()); // Not undertood instancing yet
440
441// auto currentEntity = new Qt3DCore::QEntity(currentNode); // Not undertood instancing yet
442 for (size_t iPoint = 0; iPoint < polymarker.size(); iPoint++) {
443 auto position = fObjectTransformation*G4Translate3D(polymarker[iPoint]);
445 auto currentEntity = new Qt3DCore::QEntity(currentNode); // Not undertood instancing yet
446 currentEntity->addComponent(material);
447 currentEntity->addComponent(transform);
448 currentEntity->addComponent(sphereMesh);
449 }
450 }
451 break;
453 {
454 G4Square square (polymarker); // Default square
455
456 const auto& colour = fpVisAttribs->GetColour();
457 auto material = new Qt3DExtras::QDiffuseSpecularMaterial();
458 material->setObjectName("materialForSquare");
459 material->setAmbient(G4Qt3DUtils::ConvertToQColor(colour));
460 if (colour.GetAlpha() < 1.) material->setAlphaBlendingEnabled(true);
461
462 auto boxMesh = new Qt3DExtras::QCuboidMesh();
463 boxMesh->setObjectName("boxMesh");
464 G4double side;
465 if (square.GetSizeType() == G4VMarker::world ) {
466 side = square.GetWorldDiameter();
467 } else { // Screen-size or none
468 // Not figured out how to do screen-size, so use scene extent
469 const G4double scale = 200.; // Roughly pixles per scene
470 side = square.GetScreenDiameter()*fpScene->GetExtent().GetExtentRadius()/scale;
471 }
472 boxMesh->setXExtent(side);
473 boxMesh->setYExtent(side);
474 boxMesh->setZExtent(side);
475
476 for (size_t iPoint = 0; iPoint < polymarker.size(); iPoint++) {
477 auto position = fObjectTransformation*G4Translate3D(polymarker[iPoint]);
479 auto currentEntity = new Qt3DCore::QEntity(currentNode);
480 currentEntity->addComponent(material);
481 currentEntity->addComponent(transform);
482 currentEntity->addComponent(boxMesh);
483 }
484 }
485 break;
486 }
487}

References BASETYPE, G4Polymarker::circles, G4Qt3DUtils::ConvertToQColor(), CreateNewNode(), G4Qt3DUtils::CreateQTransformFrom(), G4Polymarker::dots, G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpScene, G4VSceneHandler::fpViewer, G4VSceneHandler::fpVisAttribs, G4Exception(), G4VViewer::GetApplicableVisAttributes(), G4VisAttributes::GetColour(), G4Scene::GetExtent(), G4VisExtent::GetExtentRadius(), G4Polymarker::GetMarkerType(), G4VMarker::GetScreenDiameter(), G4VMarker::GetScreenRadius(), G4VMarker::GetSizeType(), G4Visible::GetVisAttributes(), G4VMarker::GetWorldDiameter(), G4VMarker::GetWorldRadius(), JustWarning, eplot::material, PRECISION, G4Polymarker::squares, G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform(), and G4VMarker::world.

◆ AddPrimitive() [10/13]

void G4Qt3DSceneHandler::AddPrimitive ( const G4Square square)
virtual

Implements G4VSceneHandler.

Definition at line 627 of file G4Qt3DSceneHandler.cc.

628{
629#ifdef G4QT3DDEBUG
630 G4cout <<
631 "G4Qt3DSceneHandler::AddPrimitive(const G4Square& square) called.\n"
632 << square
633 << G4endl;
634#endif
635
636#ifdef G4QT3DDEBUG
637 MarkerSizeType sizeType;
638 G4double size = GetMarkerSize (square, sizeType);
639 switch (sizeType) {
640 default:
641 case screen:
642 // Draw in screen coordinates.
643 G4cout << "screen";
644 break;
645 case world:
646 // Draw in world coordinates.
647 G4cout << "world";
648 break;
649 }
650 G4cout << " size: " << size << G4endl;
651#endif
652
653 auto currentNode = CreateNewNode();
654 if (!currentNode) {
655 static G4bool first = true;
656 if (first) {
657 first = false;
658 G4Exception("G4Qt3DSceneHandler::AddPrimitive(const G4Square&)",
659 "qt3d-0003", JustWarning,
660 "No available node!");
661 }
662 return;
663 }
664
666
669
670 const auto& colour = fpVisAttribs->GetColour();
671 auto material = new Qt3DExtras::QDiffuseSpecularMaterial();
672 material->setObjectName("materialForSquare");
673 material->setAmbient(G4Qt3DUtils::ConvertToQColor(colour));
674 if (colour.GetAlpha() < 1.) material->setAlphaBlendingEnabled(true);
675
676 auto boxMesh = new Qt3DExtras::QCuboidMesh();
677 boxMesh->setObjectName("boxMesh");
678 G4double side;
679 if (square.GetSizeType() == G4VMarker::world ) {
680 side = square.GetWorldDiameter();
681 } else { // Screen-size or none
682 // Not figured out how to do screen-size, so use scene extent
683 const G4double scale = 200.; // Roughly pixles per scene
684 side = square.GetScreenDiameter()*fpScene->GetExtent().GetExtentRadius()/scale;
685 }
686 boxMesh->setXExtent(side);
687 boxMesh->setYExtent(side);
688 boxMesh->setZExtent(side);
689
690 auto currentEntity = new Qt3DCore::QEntity(currentNode);
691 currentEntity->addComponent(material);
692 currentEntity->addComponent(transform);
693 currentEntity->addComponent(boxMesh);
694}
G4double GetWorldDiameter() const
G4double GetScreenDiameter() const

References G4Qt3DUtils::ConvertToQColor(), CreateNewNode(), G4Qt3DUtils::CreateQTransformFrom(), G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpScene, G4VSceneHandler::fpViewer, G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4Exception(), G4VViewer::GetApplicableVisAttributes(), G4VisAttributes::GetColour(), G4Scene::GetExtent(), G4VisExtent::GetExtentRadius(), G4VSceneHandler::GetMarkerSize(), G4VMarker::GetPosition(), G4VMarker::GetScreenDiameter(), G4VMarker::GetSizeType(), G4Visible::GetVisAttributes(), G4VMarker::GetWorldDiameter(), JustWarning, eplot::material, G4VSceneHandler::screen, G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform(), G4VMarker::world, and G4VSceneHandler::world.

◆ AddPrimitive() [11/13]

virtual void G4VSceneHandler::AddPrimitive ( const G4Square )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [12/13]

void G4Qt3DSceneHandler::AddPrimitive ( const G4Text )
virtual

Implements G4VSceneHandler.

Definition at line 496 of file G4Qt3DSceneHandler.cc.

496 {
497#endif
498
499 static G4bool first = true;
500 if (first) {
501 first = false;
502 G4Exception("G4Qt3DSceneHandler::AddPrimitive(const G4Text&)",
503 "qt3D-0002", JustWarning,
504 "Text drawing doesn't work yet");
505 } // OK. Not working, but let it execute, which it does without error.
506
507 /* But it crashes after /vis/viewer/rebuild!!!
508 auto currentNode = CreateNewNode();
509 if (!currentNode) {
510 static G4bool first = true;
511 if (first) {
512 first = false;
513 G4Exception("G4Qt3DSceneHandler::AddPrimitive(const G4Text&)",
514 "qt3d-0003", JustWarning,
515 "No available node!");
516 }
517 return;
518 }
519
520 fpVisAttribs = fpViewer->GetApplicableVisAttributes(text.GetVisAttributes());
521
522 auto position = fObjectTransformation*G4Translate3D(text.GetPosition());
523 auto transform = G4Qt3DUtils::CreateQTransformFrom(position);
524// transform->setScale(10);
525 transform->setScale(0.1);
526
527// auto currentEntity = new Qt3DCore::QEntity(currentNode);
528
529 // This simply does not work
530 auto qtext = new Qt3DExtras::QText2DEntity();
531 qtext->setParent(currentNode);
532// qtext->setParent(currentEntity); // ?? Doesn't help
533 qtext->setText(text.GetText().c_str());
534// qtext->setHeight(100);
535// qtext->setWidth(1000);
536 qtext->setHeight(20);
537 qtext->setWidth(100);
538 qtext->setColor(Qt::green);
539 qtext->setFont(QFont("Courier New", 10));
540 qtext->addComponent(transform);
541
542 // This produces text in 3D facing +z - not what we want
543// const auto& colour = GetTextColour(text);
544// auto material = new Qt3DExtras::QDiffuseSpecularMaterial();
545// material->setObjectName("materialForText");
546// material->setAmbient(G4Qt3DUtils::ConvertToQColor(colour));
547// if (colour.GetAlpha() < 1.) material->setAlphaBlendingEnabled(true);
548//
549// auto textMesh = new Qt3DExtras::QExtrudedTextMesh();
550// textMesh->setText(text.GetText().c_str());
551// textMesh->setFont(QFont("Courier New", 10));
552// textMesh->setDepth(.01f);
553//
554// currentNode->addComponent(material);
555// currentNode->addComponent(transform);
556// currentNode->addComponent(textMesh);
557 */
558}

References G4Exception(), and JustWarning.

◆ AddPrimitive() [13/13]

virtual void G4VSceneHandler::AddPrimitive ( const G4Text )
virtual

Implements G4VSceneHandler.

◆ AddSolid() [1/14]

void G4VSceneHandler::AddSolid ( const G4Box box)
virtualinherited

Implements G4VGraphicsScene.

Reimplemented in G4DAWNFILESceneHandler, G4GMocrenFileSceneHandler, G4HepRepFileSceneHandler, G4OpenGLSceneHandler, G4VRML2FileSceneHandler, G4VRML2FileSceneHandler, G4DAWNFILESceneHandler, G4GMocrenFileSceneHandler, and G4VtkSceneHandler.

Definition at line 247 of file G4VSceneHandler.cc.

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

References G4VSceneHandler::AddSolidT().

Referenced by AddCompound(), G4VtkSceneHandler::AddSolid(), G4HepRepFileSceneHandler::AddSolid(), and G4GMocrenFileSceneHandler::AddSolid().

◆ AddSolid() [2/14]

void G4VSceneHandler::AddSolid ( const G4Cons cons)
virtualinherited

◆ AddSolid() [3/14]

void G4VSceneHandler::AddSolid ( const G4Ellipsoid ellipsoid)
virtualinherited

◆ AddSolid() [4/14]

void G4VSceneHandler::AddSolid ( const G4Orb orb)
virtualinherited

◆ AddSolid() [5/14]

void G4VSceneHandler::AddSolid ( const G4Para para)
virtualinherited

◆ AddSolid() [6/14]

void G4VSceneHandler::AddSolid ( const G4Polycone polycone)
virtualinherited

◆ AddSolid() [7/14]

void G4VSceneHandler::AddSolid ( const G4Polyhedra polyhedra)
virtualinherited

◆ AddSolid() [8/14]

void G4VSceneHandler::AddSolid ( const G4Sphere sphere)
virtualinherited

◆ AddSolid() [9/14]

void G4VSceneHandler::AddSolid ( const G4TessellatedSolid tess)
virtualinherited

◆ AddSolid() [10/14]

void G4VSceneHandler::AddSolid ( const G4Torus torus)
virtualinherited

◆ AddSolid() [11/14]

void G4VSceneHandler::AddSolid ( const G4Trap trap)
virtualinherited

◆ AddSolid() [12/14]

void G4VSceneHandler::AddSolid ( const G4Trd trd)
virtualinherited

◆ AddSolid() [13/14]

void G4VSceneHandler::AddSolid ( const G4Tubs tubs)
virtualinherited

◆ AddSolid() [14/14]

void G4VSceneHandler::AddSolid ( const G4VSolid solid)
virtualinherited

◆ 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 G4VSceneHandler::BeginModeling ( )
virtualinherited

◆ BeginPrimitives()

void G4Qt3DSceneHandler::BeginPrimitives ( const G4Transform3D objectTransformation)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 246 of file G4Qt3DSceneHandler.cc.

248{
249 G4VSceneHandler::BeginPrimitives(objectTransformation);
250}
virtual void BeginPrimitives(const G4Transform3D &objectTransformation=G4Transform3D())

References G4VSceneHandler::BeginPrimitives().

Referenced by AddCompound().

◆ BeginPrimitives2D()

void G4Qt3DSceneHandler::BeginPrimitives2D ( const G4Transform3D objectTransformation)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 219 of file G4Qt3DSceneHandler.cc.

220{
221// The x,y coordinates of the primitives passed to AddPrimitive are
222// intrepreted as screen coordinates, -1 < x,y < 1. The
223// z-coordinate is ignored.
224// IMPORTANT: invoke this from your polymorphic versions, e.g.:
225// void MyXXXSceneHandler::BeginPrimitives2D
226// (const G4Transform3D& objectTransformation) {
227 static G4bool first = true;
228 if (first) {
229 first = false;
230 G4Exception("G4Qt3DSceneHandler::BeginPrimitives2D", "qt3D-0001",
232 "2D drawing not yet implemented");
233 }
234 G4VSceneHandler::BeginPrimitives2D (objectTransformation);
235// ...
236}
virtual void BeginPrimitives2D(const G4Transform3D &objectTransformation=G4Transform3D())

References G4VSceneHandler::BeginPrimitives2D(), G4Exception(), and JustWarning.

◆ ClearStore()

void G4Qt3DSceneHandler::ClearStore ( )
virtual

◆ ClearTransientStore()

void G4Qt3DSceneHandler::ClearTransientStore ( )
virtual

◆ 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

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().

◆ CreateNewNode()

G4Qt3DQEntity * G4Qt3DSceneHandler::CreateNewNode ( )
protected

Definition at line 121 of file G4Qt3DSceneHandler.cc.

122{
123 // Create a G4Qt3DQEntity node suitable for next solid or primitive
124
125 G4Qt3DQEntity* newNode = nullptr;
126
127 if (fReadyForTransients) { // All transients hang from this node
128 newNode = new G4Qt3DQEntity(fpTransientObjects);
130 newNode->setObjectName(name.c_str());
131 return newNode;
132 }
133
134 G4PhysicalVolumeModel* pPVModel =
135 dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
136
137 if (!pPVModel) { // Persistent objects (e.g., axes)
138 newNode = new G4Qt3DQEntity(fpPersistentObjects);
139 newNode->setObjectName(fpModel->GetGlobalTag().c_str());
140 return newNode;
141 }
142
143 // So this is a G4PhysicalVolumeModel
144
146 typedef std::vector<PVNodeID> PVPath;
147// const PVPath& drawnPVPath = pPVModel->GetDrawnPVPath();
148 const PVPath& fullPVPath = pPVModel->GetFullPVPath();
149 //G4int currentDepth = pPVModel->GetCurrentDepth();
150 //G4VPhysicalVolume* pCurrentPV = pPVModel->GetCurrentPV();
151 //G4LogicalVolume* pCurrentLV = pPVModel->GetCurrentLV();
152 //G4Material* pCurrentMaterial = pPVModel->GetCurrentMaterial();
153 // Note: pCurrentMaterial may be zero (parallel world).
154
155#ifdef G4QTDEBUG
156 G4cout << "A: " << fullPVPath << G4endl; // DEBUG
157#endif
158
159 // Find appropriate root
160 const size_t nWorlds = fpPhysicalVolumeObjects.size();
161 size_t iWorld = 0;
162 for (; iWorld < nWorlds; ++iWorld) {
163 if (fullPVPath[0].GetPhysicalVolume() ==
164 fpPhysicalVolumeObjects[iWorld]->GetPVNodeID().GetPhysicalVolume()) break;
165 }
166 if (iWorld == nWorlds) {
167 G4Exception("G4Qt3DSceneHandler::CreateNewNode", "qt3D-0000", FatalException,
168 "World mis-match - not possible(!?)");
169 }
170
171 // (Re-)establish pv path of root entity
173 world->SetPVNodeID(fullPVPath[0]);
174
175 // Create nodes as required
176 G4Qt3DQEntity* node = world;
177 newNode = node;
178 const size_t depth = fullPVPath.size();
179 size_t iDepth = 1;
180 while (iDepth < depth) {
181 const auto& children = node->children();
182 const G4int nChildren = children.size(); // int size() (Qt covention?)
183 G4int iChild = 0;
184 G4Qt3DQEntity* child = nullptr;
185 for (; iChild < nChildren; ++iChild) {
186 child = static_cast<G4Qt3DQEntity*>(children[iChild]);
187 if (child->GetPVNodeID() == fullPVPath[iDepth]) break;
188 }
189 if (iChild != nChildren) { // Existing node found
190 node = child; // Must be the ancestor of new node (subsequent iteration)
191 } else {
192 // Add a new node as child of node
193 newNode = new G4Qt3DQEntity(node);
194 newNode->SetPVNodeID(fullPVPath[iDepth]);
195 std::ostringstream oss;
196 oss << newNode->GetPVNodeID().GetPhysicalVolume()->GetName()
197 << ':' << newNode->GetPVNodeID().GetCopyNo();
198 newNode->setObjectName(oss.str().c_str());
199 node = newNode;
200 }
201 ++iDepth;
202 }
203
204 return node;
205}
const std::vector< G4PhysicalVolumeNodeID > & GetFullPVPath() const
void SetPVNodeID(const G4PhysicalVolumeModel::G4PhysicalVolumeNodeID &id)
const G4PhysicalVolumeModel::G4PhysicalVolumeNodeID & GetPVNodeID() const
std::vector< G4Qt3DQEntity * > fpPhysicalVolumeObjects
Qt3DCore::QEntity * fpPersistentObjects
const G4String & GetGlobalTag() const
const G4String & GetName() const

References FatalException, G4VSceneHandler::fpModel, fpPersistentObjects, fpPhysicalVolumeObjects, fpTransientObjects, G4VSceneHandler::fReadyForTransients, G4cout, G4endl, G4Exception(), G4PhysicalVolumeModel::G4PhysicalVolumeNodeID::GetCopyNo(), G4PhysicalVolumeModel::GetFullPVPath(), G4VModel::GetGlobalTag(), G4VPhysicalVolume::GetName(), G4PhysicalVolumeModel::G4PhysicalVolumeNodeID::GetPhysicalVolume(), G4Qt3DQEntity::GetPVNodeID(), G4InuclParticleNames::name(), G4Qt3DQEntity::SetPVNodeID(), and G4VSceneHandler::world.

Referenced by AddPrimitive().

◆ 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
const G4Plane3D & GetSectionPlane() const
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 G4VSceneHandler::EndModeling ( )
virtualinherited

◆ EndPrimitives()

void G4Qt3DSceneHandler::EndPrimitives ( )
virtual

Reimplemented from G4VSceneHandler.

Definition at line 252 of file G4Qt3DSceneHandler.cc.

253{
255}
virtual void EndPrimitives()

References G4VSceneHandler::EndPrimitives().

Referenced by AddCompound().

◆ EndPrimitives2D()

void G4Qt3DSceneHandler::EndPrimitives2D ( )
virtual

Reimplemented from G4VSceneHandler.

Definition at line 238 of file G4Qt3DSceneHandler.cc.

239{
240// IMPORTANT: invoke this from your polymorphic versions, e.g.:
241// void MyXXXSceneHandler::EndPrimitives2D () {
242// ...
244}
virtual void EndPrimitives2D()

References G4VSceneHandler::EndPrimitives2D().

◆ EstablishG4Qt3DQEntities()

void G4Qt3DSceneHandler::EstablishG4Qt3DQEntities ( )
protected

Definition at line 98 of file G4Qt3DSceneHandler.cc.

99{
100 fpTransientObjects = new G4Qt3DQEntity(fpQt3DScene); // Hangs from root
101 fpTransientObjects ->setObjectName("G4Qt3DTORoot");
102 fpPersistentObjects = new G4Qt3DQEntity(fpQt3DScene); // Hangs from root
103 fpPersistentObjects ->setObjectName("G4Qt3DPORoot");
104
105 // Physical volume objects for each world hang from POs
106 G4TransportationManager* transportationManager
108 size_t nWorlds = transportationManager->GetNoWorlds();
109 std::vector<G4VPhysicalVolume*>::iterator iterWorld
110 = transportationManager->GetWorldsIterator();
111 fpPhysicalVolumeObjects.resize(nWorlds);
112 for (size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
113 G4VPhysicalVolume* world = (*iterWorld);
114 auto entity = new G4Qt3DQEntity(fpPersistentObjects);
115 entity->setObjectName("G4Qt3DPORoot_"+QString(world->GetName()));
117 fpPhysicalVolumeObjects[i] = entity;
118 }
119}
static G4TransportationManager * GetTransportationManager()
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
size_t GetNoWorlds() const

References fpPersistentObjects, fpPhysicalVolumeObjects, fpQt3DScene, fpTransientObjects, G4TransportationManager::GetNoWorlds(), G4TransportationManager::GetTransportationManager(), G4TransportationManager::GetWorldsIterator(), and G4VSceneHandler::world.

Referenced by ClearStore(), and G4Qt3DSceneHandler().

◆ 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 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(), 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

◆ 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(), AddPrimitive(), G4VtkSceneHandler::AddPrimitive(), G4HepRepFileSceneHandler::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

◆ 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
virtual std::vector< G4AttValue > * CreateAttValues() const
Definition: G4VHit.hh:64
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
Definition: G4VHit.hh:58
virtual std::vector< G4AttValue > * CreateAttValues() const
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
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 G4Qt3DSceneHandler::PostAddSolid ( )
virtual

Reimplemented from G4VSceneHandler.

Definition at line 214 of file G4Qt3DSceneHandler.cc.

215{
217}
virtual void PostAddSolid()

References G4VSceneHandler::PostAddSolid().

◆ PreAddSolid()

void G4Qt3DSceneHandler::PreAddSolid ( const G4Transform3D objectTransformation,
const G4VisAttributes visAttribs 
)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 207 of file G4Qt3DSceneHandler.cc.

210{
211 G4VSceneHandler::PreAddSolid(objectTransformation, visAttribs);
212}
virtual void PreAddSolid(const G4Transform3D &objectTransformation, const G4VisAttributes &)

References G4VSceneHandler::PreAddSolid().

◆ 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
virtual void BeginModeling()
void DrawEvent(const G4Event *)
virtual void EndModeling()
G4bool fMarkForClearingTransientStore
static G4VVisManager * GetConcreteInstance()
static const G4VisExtent & GetNullExtent()
Definition: G4VisExtent.cc:60
void SetEventRefreshing(G4bool)
const G4Event * GetRequestedEvent() const
static G4VisManager * GetInstance()
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}
G4int GetNumberOfCloudPoints(const G4VisAttributes *) const
G4int GetNoOfSides(const G4VisAttributes *)
virtual void AddPrimitive(const G4Polyline &)=0
G4String GetName() const
virtual G4ThreeVector GetPointOnSurface() const
Definition: G4VSolid.cc:152
virtual G4Polyhedron * GetPolyhedron() const
Definition: G4VSolid.cc:705
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

Friends And Related Function Documentation

◆ G4Qt3DViewer

friend class G4Qt3DViewer
friend

Definition at line 42 of file G4Qt3DSceneHandler.hh.

Field Documentation

◆ fIdentityTransformation

const G4Transform3D G4VSceneHandler::fIdentityTransformation
protectedinherited

Definition at line 364 of file G4VSceneHandler.hh.

◆ 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

◆ fpPersistentObjects

Qt3DCore::QEntity* G4Qt3DSceneHandler::fpPersistentObjects
protected

Definition at line 82 of file G4Qt3DSceneHandler.hh.

Referenced by CreateNewNode(), and EstablishG4Qt3DQEntities().

◆ fpPhysicalVolumeObjects

std::vector<G4Qt3DQEntity*> G4Qt3DSceneHandler::fpPhysicalVolumeObjects
protected

Definition at line 83 of file G4Qt3DSceneHandler.hh.

Referenced by CreateNewNode(), and EstablishG4Qt3DQEntities().

◆ fpQt3DScene

Qt3DCore::QEntity* G4Qt3DSceneHandler::fpQt3DScene
protected

◆ fProcessing2D

G4bool G4VSceneHandler::fProcessing2D
protectedinherited

◆ fProcessingSolid

G4bool G4VSceneHandler::fProcessingSolid
protectedinherited

◆ fpScene

G4Scene* G4VSceneHandler::fpScene
protectedinherited

◆ fpTransientObjects

Qt3DCore::QEntity* G4Qt3DSceneHandler::fpTransientObjects
protected

◆ fpViewer

G4VViewer* G4VSceneHandler::fpViewer
protectedinherited

Definition at line 350 of file G4VSceneHandler.hh.

Referenced by G4OpenInventorSceneHandler::AddCircleSquare(), G4VtkSceneHandler::AddCompound(), G4HepRepFileSceneHandler::AddHepRepInstance(), G4ToolsSGSceneHandler::AddPrimitive(), G4OpenGLSceneHandler::AddPrimitive(), AddPrimitive(), G4VtkSceneHandler::AddPrimitive(), G4OpenInventorSceneHandler::AddPrimitive(), G4OpenGLImmediateSceneHandler::AddPrimitivePreambleInternal(), G4OpenGLStoredSceneHandler::AddPrimitivePreambleInternal(), G4VtkSceneHandler::AddPrimitiveTensorGlyph(), G4OpenInventorSceneHandler::AddProperties(), G4HepRepFileSceneHandler::AddSolid(), G4VSceneHandler::AddSolidT(), G4VSceneHandler::AddSolidWithAuxiliaryEdges(), G4OpenInventorSceneHandler::AddTransform(), G4OpenGLImmediateSceneHandler::BeginPrimitives2D(), G4OpenGLStoredQtSceneHandler::ClearStore(), G4GMocrenFileSceneHandler::ClearTransientStore(), G4HepRepFileSceneHandler::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 G4Qt3DSceneHandler::fSceneIdCount = 0
staticprotected

Definition at line 78 of file G4Qt3DSceneHandler.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

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