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

#include <G4VSceneHandler.hh>

+ Inheritance diagram for G4VSceneHandler:

Public Types

enum  MarkerSizeType { world , screen }
 

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

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

Friends

class G4VViewer
 
std::ostream & operator<< (std::ostream &os, const G4VSceneHandler &s)
 

Detailed Description

Definition at line 61 of file G4VSceneHandler.hh.

Member Enumeration Documentation

◆ MarkerSizeType

Enumerator
world 
screen 

Definition at line 68 of file G4VSceneHandler.hh.

Constructor & Destructor Documentation

◆ G4VSceneHandler()

G4VSceneHandler::G4VSceneHandler ( G4VGraphicsSystem system,
G4int  id,
const G4String name = "" 
)

Definition at line 94 of file G4VSceneHandler.cc.

94 :
95 fSystem (system),
96 fSceneHandlerId (id),
97 fViewCount (0),
98 fpViewer (0),
99 fpScene (0),
100 fMarkForClearingTransientStore (true), // Ready for first
101 // ClearTransientStoreIfMarked(),
102 // e.g., at end of run (see
103 // G4VisManager.cc).
104 fReadyForTransients (true), // Only false while processing scene.
105 fProcessingSolid (false),
106 fProcessing2D (false),
107 fpModel (0),
108 fNestingDepth (0),
109 fpVisAttribs (0)
110{
112 fpScene = pVMan -> GetCurrentScene ();
113 if (name == "") {
114 std::ostringstream ost;
115 ost << fSystem.GetName () << '-' << fSceneHandlerId;
116 fName = ost.str();
117 }
118 else {
119 fName = name;
120 }
123}
const G4String & GetName() const
G4bool fTransientsDrawnThisEvent
const G4int fSceneHandlerId
G4bool fTransientsDrawnThisRun
G4VViewer * fpViewer
G4bool fMarkForClearingTransientStore
const G4VisAttributes * fpVisAttribs
G4VGraphicsSystem & fSystem
G4bool GetTransientsDrawnThisEvent() const
G4bool GetTransientsDrawnThisRun() const
static G4VisManager * GetInstance()
const char * name(G4int ptype)

◆ ~G4VSceneHandler()

G4VSceneHandler::~G4VSceneHandler ( )
virtual

Definition at line 125 of file G4VSceneHandler.cc.

125 {
126 G4VViewer* last;
127 while( ! fViewerList.empty() ) {
128 last = fViewerList.back();
129 fViewerList.pop_back();
130 delete last;
131 }
132}
G4ViewerList fViewerList

Member Function Documentation

◆ AddCompound() [1/5]

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

Implements G4VGraphicsScene.

Reimplemented in G4DAWNFILESceneHandler, G4GMocrenFileSceneHandler, G4HepRepFileSceneHandler, G4HepRepSceneHandler, G4VRML1FileSceneHandler, and G4VRML2FileSceneHandler.

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}
bool G4bool
Definition: G4Types.hh:86
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4VScoringMesh * GetMesh(G4int i) const
size_t GetNumberOfMesh() const
static G4ScoringManager * GetScoringManagerIfExist()
std::size_t first(char) const
const G4String & GetName() const
G4bool IsActive() const
std::map< G4String, RunScore * > MeshScoreMap
void DrawMesh(const G4String &psName, G4VScoreColorMap *colorMap, G4int axflg=111)
MeshScoreMap GetScoreMap() const

◆ AddCompound() [2/5]

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

Implements G4VGraphicsScene.

Reimplemented in G4DAWNFILESceneHandler, G4GMocrenFileSceneHandler, G4HepRepFileSceneHandler, G4HepRepSceneHandler, G4VRML1FileSceneHandler, and G4VRML2FileSceneHandler.

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}

◆ AddCompound() [3/5]

void G4VSceneHandler::AddCompound ( const G4VDigi digi)
virtual

Implements G4VGraphicsScene.

Reimplemented in G4DAWNFILESceneHandler, G4HepRepFileSceneHandler, G4HepRepSceneHandler, G4VRML1FileSceneHandler, 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() [4/5]

void G4VSceneHandler::AddCompound ( const G4VHit hit)
virtual

Implements G4VGraphicsScene.

Reimplemented in G4HepRepFileSceneHandler, G4DAWNFILESceneHandler, G4GMocrenFileSceneHandler, G4HepRepSceneHandler, G4VRML1FileSceneHandler, and G4VRML2FileSceneHandler.

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() [5/5]

void G4VSceneHandler::AddCompound ( const G4VTrajectory traj)
virtual

Implements G4VGraphicsScene.

Reimplemented in G4HepRepFileSceneHandler, G4HepRepSceneHandler, G4DAWNFILESceneHandler, G4GMocrenFileSceneHandler, G4VRML1FileSceneHandler, and G4VRML2FileSceneHandler.

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

Referenced by G4HepRepFileSceneHandler::AddCompound(), G4HepRepSceneHandler::AddCompound(), G4DAWNFILESceneHandler::AddCompound(), G4GMocrenFileSceneHandler::AddCompound(), G4VRML1FileSceneHandler::AddCompound(), and G4VRML2FileSceneHandler::AddCompound().

◆ AddPrimitive() [1/7]

◆ AddPrimitive() [2/7]

◆ AddPrimitive() [3/7]

◆ AddPrimitive() [4/7]

void G4VSceneHandler::AddPrimitive ( const G4Polymarker polymarker)
virtual

Implements G4VGraphicsScene.

Reimplemented in G4HepRepFileSceneHandler, G4HepRepSceneHandler, G4RayTracerSceneHandler, G4VTreeSceneHandler, G4DAWNFILESceneHandler, G4GMocrenFileSceneHandler, G4VRML1FileSceneHandler, G4VRML2FileSceneHandler, G4XXXFileSceneHandler, G4XXXSceneHandler, G4XXXSGSceneHandler, and G4XXXStoredSceneHandler.

Definition at line 534 of file G4VSceneHandler.cc.

534 {
535 switch (polymarker.GetMarkerType()) {
536 default:
538 {
539 G4Circle dot (polymarker);
540 dot.SetWorldSize (0.);
541 dot.SetScreenSize (0.1); // Very small circle.
542 for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
543 dot.SetPosition (polymarker[iPoint]);
544 AddPrimitive (dot);
545 }
546 }
547 break;
549 {
550 G4Circle circle (polymarker); // Default circle
551 for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
552 circle.SetPosition (polymarker[iPoint]);
553 AddPrimitive (circle);
554 }
555 }
556 break;
558 {
559 G4Square square (polymarker); // Default square
560 for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
561 square.SetPosition (polymarker[iPoint]);
562 AddPrimitive (square);
563 }
564 }
565 break;
566 }
567}
MarkerType GetMarkerType() const
virtual void AddPrimitive(const G4Polyline &)=0

◆ AddPrimitive() [5/7]

void G4VSceneHandler::AddPrimitive ( const G4Scale scale)
virtual

Implements G4VGraphicsScene.

Reimplemented in G4RayTracerSceneHandler, G4VTreeSceneHandler, G4DAWNFILESceneHandler, G4GMocrenFileSceneHandler, G4HepRepFileSceneHandler, G4HepRepSceneHandler, G4VRML1FileSceneHandler, G4VRML2FileSceneHandler, G4XXXFileSceneHandler, G4XXXSceneHandler, G4XXXSGSceneHandler, and G4XXXStoredSceneHandler.

Definition at line 430 of file G4VSceneHandler.cc.

430 {
431
432 const G4double margin(0.01);
433 // Fractional margin - ensures scale is comfortably inside viewing
434 // volume.
435 const G4double oneMinusMargin (1. - margin);
436
437 const G4VisExtent& sceneExtent = fpScene->GetExtent();
438
439 // Useful constants...
440 const G4double length(scale.GetLength());
441 const G4double halfLength(length / 2.);
442 const G4double tickLength(length / 20.);
443 const G4double piBy2(halfpi);
444
445 // Get size of scene...
446 const G4double xmin = sceneExtent.GetXmin();
447 const G4double xmax = sceneExtent.GetXmax();
448 const G4double ymin = sceneExtent.GetYmin();
449 const G4double ymax = sceneExtent.GetYmax();
450 const G4double zmin = sceneExtent.GetZmin();
451 const G4double zmax = sceneExtent.GetZmax();
452
453 // Create (empty) polylines having the same vis attributes...
454 G4Polyline scaleLine, tick11, tick12, tick21, tick22;
455 G4VisAttributes visAtts(*scale.GetVisAttributes()); // Long enough life.
456 scaleLine.SetVisAttributes(&visAtts);
457 tick11.SetVisAttributes(&visAtts);
458 tick12.SetVisAttributes(&visAtts);
459 tick21.SetVisAttributes(&visAtts);
460 tick22.SetVisAttributes(&visAtts);
461
462 // Add points to the polylines to represent an scale parallel to the
463 // x-axis centred on the origin...
464 G4Point3D r1(G4Point3D(-halfLength, 0., 0.));
465 G4Point3D r2(G4Point3D( halfLength, 0., 0.));
466 scaleLine.push_back(r1);
467 scaleLine.push_back(r2);
468 G4Point3D ticky(0., tickLength, 0.);
469 G4Point3D tickz(0., 0., tickLength);
470 tick11.push_back(r1 + ticky);
471 tick11.push_back(r1 - ticky);
472 tick12.push_back(r1 + tickz);
473 tick12.push_back(r1 - tickz);
474 tick21.push_back(r2 + ticky);
475 tick21.push_back(r2 - ticky);
476 tick22.push_back(r2 + tickz);
477 tick22.push_back(r2 - tickz);
478 G4Point3D textPosition(0., tickLength, 0.);
479
480 // Transform appropriately...
481
482 G4Transform3D transformation;
483 if (scale.GetAutoPlacing()) {
484 G4Transform3D rotation;
485 switch (scale.GetDirection()) {
486 case G4Scale::x:
487 break;
488 case G4Scale::y:
489 rotation = G4RotateZ3D(piBy2);
490 break;
491 case G4Scale::z:
492 rotation = G4RotateY3D(piBy2);
493 break;
494 }
495 G4double sxmid;
496 G4double symid;
497 G4double szmid;
498 sxmid = xmin + oneMinusMargin * (xmax - xmin);
499 symid = ymin + margin * (ymax - ymin);
500 szmid = zmin + oneMinusMargin * (zmax - zmin);
501 switch (scale.GetDirection()) {
502 case G4Scale::x:
503 sxmid -= halfLength;
504 break;
505 case G4Scale::y:
506 symid += halfLength;
507 break;
508 case G4Scale::z:
509 szmid -= halfLength;
510 break;
511 }
512 G4Translate3D translation(sxmid, symid, szmid);
513 transformation = translation * rotation;
514 } else {
515 if (fpModel) transformation = fpModel->GetTransformation();
516 }
517
518 // Draw...
519 // We would like to call BeginPrimitives(transformation) here but
520 // calling BeginPrimitives from within an AddPrimitive is not
521 // allowed! So we have to do our own transformation...
522 AddPrimitive(scaleLine.transform(transformation));
523 AddPrimitive(tick11.transform(transformation));
524 AddPrimitive(tick12.transform(transformation));
525 AddPrimitive(tick21.transform(transformation));
526 AddPrimitive(tick22.transform(transformation));
527 G4Text text(scale.GetAnnotation(),textPosition.transform(transformation));
529 text.SetVisAttributes(va);
530 text.SetScreenSize(scale.GetAnnotationSize());
531 AddPrimitive(text);
532}
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:34
HepGeom::RotateZ3D G4RotateZ3D
HepGeom::RotateY3D G4RotateY3D
double G4double
Definition: G4Types.hh:83
G4Polyline & transform(const G4Transform3D &)
Definition: G4Polyline.cc:37
Direction GetDirection() const
const G4String & GetAnnotation() const
G4double GetLength() const
G4double GetAnnotationSize() const
G4bool GetAutoPlacing() const
const G4VisExtent & GetExtent() const
Definition: G4Text.hh:72
const G4Transform3D & GetTransformation() const
static const G4Colour & GetCurrentTextColour()
G4double GetYmin() const
Definition: G4VisExtent.hh:101
G4double GetXmax() const
Definition: G4VisExtent.hh:100
G4double GetYmax() const
Definition: G4VisExtent.hh:102
G4double GetZmax() const
Definition: G4VisExtent.hh:104
G4double GetZmin() const
Definition: G4VisExtent.hh:103
G4double GetXmin() const
Definition: G4VisExtent.hh:99
void SetVisAttributes(const G4VisAttributes *)
Definition: G4Visible.cc:79
const G4VisAttributes * GetVisAttributes() const

◆ AddPrimitive() [6/7]

◆ AddPrimitive() [7/7]

◆ AddSolid() [1/14]

void G4VSceneHandler::AddSolid ( const G4Box box)
virtual

Implements G4VGraphicsScene.

Reimplemented in G4HepRepFileSceneHandler, G4VRML1FileSceneHandler, G4VRML2FileSceneHandler, G4XXXFileSceneHandler, G4XXXSGSceneHandler, G4XXXStoredSceneHandler, G4DAWNFILESceneHandler, G4GMocrenFileSceneHandler, and G4HepRepSceneHandler.

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)

Referenced by G4HepRepSceneHandler::AddSolid(), G4HepRepFileSceneHandler::AddSolid(), G4XXXFileSceneHandler::AddSolid(), G4XXXSGSceneHandler::AddSolid(), G4XXXStoredSceneHandler::AddSolid(), G4DAWNFILESceneHandler::AddSolid(), G4GMocrenFileSceneHandler::AddSolid(), G4VRML1FileSceneHandler::AddSolid(), and G4VRML2FileSceneHandler::AddSolid().

◆ AddSolid() [2/14]

◆ AddSolid() [3/14]

void G4VSceneHandler::AddSolid ( const G4Ellipsoid ellipsoid)
virtual

◆ AddSolid() [4/14]

◆ AddSolid() [5/14]

◆ AddSolid() [6/14]

void G4VSceneHandler::AddSolid ( const G4Polycone polycone)
virtual

◆ AddSolid() [7/14]

void G4VSceneHandler::AddSolid ( const G4Polyhedra polyhedra)
virtual

◆ AddSolid() [8/14]

◆ AddSolid() [9/14]

◆ AddSolid() [10/14]

◆ AddSolid() [11/14]

◆ AddSolid() [12/14]

◆ AddSolid() [13/14]

◆ AddSolid() [14/14]

◆ AddSolidT()

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

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)
const G4VisAttributes * GetApplicableVisAttributes(const G4VisAttributes *) const

Referenced by AddSolid().

◆ AddSolidWithAuxiliaryEdges()

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

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

Referenced by AddSolid().

◆ AddViewerToList()

void G4VSceneHandler::AddViewerToList ( G4VViewer pView)

Definition at line 426 of file G4VSceneHandler.cc.

426 {
427 fViewerList.push_back (pViewer);
428}

◆ BeginModeling()

◆ BeginPrimitives()

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

Implements G4VGraphicsScene.

Reimplemented in G4DAWNFILESceneHandler, G4GMocrenFileSceneHandler, G4HepRepSceneHandler, G4VRML1FileSceneHandler, G4VRML2FileSceneHandler, G4XXXSGSceneHandler, and G4XXXStoredSceneHandler.

Definition at line 160 of file G4VSceneHandler.cc.

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

Referenced by G4GMocrenFileSceneHandler::BeginPrimitives(), G4HepRepSceneHandler::BeginPrimitives(), G4XXXSGSceneHandler::BeginPrimitives(), G4XXXStoredSceneHandler::BeginPrimitives(), and RequestPrimitives().

◆ BeginPrimitives2D()

void G4VSceneHandler::BeginPrimitives2D ( const G4Transform3D objectTransformation = G4Transform3D())
virtual

Implements G4VGraphicsScene.

Reimplemented in G4HepRepFileSceneHandler.

Definition at line 184 of file G4VSceneHandler.cc.

185 {
187 if (fNestingDepth > 1)
189 ("G4VSceneHandler::BeginPrimitives2D",
190 "visman0103", FatalException,
191 "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
192 fObjectTransformation = objectTransformation;
193 fProcessing2D = true;
194}

Referenced by G4HepRepFileSceneHandler::BeginPrimitives2D().

◆ ClearStore()

void G4VSceneHandler::ClearStore ( )
virtual

◆ ClearTransientStore()

◆ CreateCutawaySolid()

G4DisplacedSolid * G4VSceneHandler::CreateCutawaySolid ( )
protectedvirtual

Definition at line 948 of file G4VSceneHandler.cc.

949{
950 // To be reviewed.
951 return 0;
952 /*** An alternative way of getting a cutaway is to use
953 Command /vis/scene/add/volume
954 Guidance :
955 Adds a physical volume to current scene, with optional clipping volume.
956 If physical-volume-name is "world" (the default), the top of the
957 main geometry tree (material world) is added. If "worlds", the
958 top of all worlds - material world and parallel worlds, if any - are
959 added. Otherwise a search of all worlds is made, taking the first
960 matching occurrence only. To see a representation of the geometry
961 hierarchy of the worlds, try "/vis/drawTree [worlds]" or one of the
962 driver/browser combinations that have the required functionality, e.g., HepRep.
963 If clip-volume-type is specified, the subsequent parameters are used to
964 to define a clipping volume. For example,
965 "/vis/scene/add/volume ! ! ! -box km 0 1 0 1 0 1" will draw the world
966 with the positive octant cut away. (If the Boolean Processor issues
967 warnings try replacing 0 by 0.000000001 or something.)
968 If clip-volume-type is prepended with '-', the clip-volume is subtracted
969 (cutaway). (This is the default if there is no prepended character.)
970 If '*' is prepended, the intersection of the physical-volume and the
971 clip-volume is made. (You can make a section/DCUT with a thin box, for
972 example).
973 For "box", the parameters are xmin,xmax,ymin,ymax,zmin,zmax.
974 Only "box" is programmed at present.
975 ***/
976}

Referenced by CreateModelingParameters().

◆ CreateModelingParameters()

G4ModelingParameters * G4VSceneHandler::CreateModelingParameters ( )

Definition at line 845 of file G4VSceneHandler.cc.

846{
847 // Create modeling parameters from View Parameters...
848 if (!fpViewer) return NULL;
849
850 const G4ViewParameters& vp = fpViewer -> GetViewParameters ();
851
852 // Convert drawing styles...
853 G4ModelingParameters::DrawingStyle modelDrawingStyle =
855 switch (vp.GetDrawingStyle ()) {
856 default:
858 modelDrawingStyle = G4ModelingParameters::wf;
859 break;
861 modelDrawingStyle = G4ModelingParameters::hlr;
862 break;
864 modelDrawingStyle = G4ModelingParameters::hsr;
865 break;
867 modelDrawingStyle = G4ModelingParameters::hlhsr;
868 break;
870 modelDrawingStyle = G4ModelingParameters::cloud;
871 break;
872 }
873
874 // Decide if covered daughters are really to be culled...
875 G4bool reallyCullCovered =
876 vp.IsCullingCovered() // Culling daughters depends also on...
877 && !vp.IsSection () // Sections (DCUT) not requested.
878 && !vp.IsCutaway () // Cutaways not requested.
879 ;
880
881 G4ModelingParameters* pModelingParams = new G4ModelingParameters
883 modelDrawingStyle,
884 vp.IsCulling (),
885 vp.IsCullingInvisible (),
886 vp.IsDensityCulling (),
887 vp.GetVisibleDensity (),
888 reallyCullCovered,
889 vp.GetNoOfSides ()
890 );
891
892 pModelingParams->SetNumberOfCloudPoints(vp.GetNumberOfCloudPoints());
893 pModelingParams->SetWarning
895
896 pModelingParams->SetCBDAlgorithmNumber(vp.GetCBDAlgorithmNumber());
897 pModelingParams->SetCBDParameters(vp.GetCBDParameters());
898
899 pModelingParams->SetExplodeFactor(vp.GetExplodeFactor());
900 pModelingParams->SetExplodeCentre(vp.GetExplodeCentre());
901
902 pModelingParams->SetSectionSolid(CreateSectionSolid());
903 pModelingParams->SetCutawaySolid(CreateCutawaySolid());
904 // The polyhedron objects are deleted in the modeling parameters destructor.
905
907
908 return pModelingParams;
909}
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)
virtual G4DisplacedSolid * CreateSectionSolid()
virtual G4DisplacedSolid * CreateCutawaySolid()
const std::vector< G4ModelingParameters::VisAttributesModifier > & GetVisAttributesModifiers() const
G4int GetNoOfSides() 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
G4bool IsCullingInvisible() const
const G4VisAttributes * GetDefaultVisAttributes() const
G4bool IsDensityCulling() const
G4double GetVisibleDensity() const
const G4Point3D & GetExplodeCentre() const
G4bool IsCullingCovered() const
DrawingStyle GetDrawingStyle() const
static Verbosity GetVerbosity()

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

◆ CreateSectionSolid()

G4DisplacedSolid * G4VSceneHandler::CreateSectionSolid ( )
protectedvirtual

Definition at line 911 of file G4VSceneHandler.cc.

912{
913 G4DisplacedSolid* sectioner = 0;
914
916 if (vp.IsSection () ) {
917
919 G4double safe = radius + fpScene->GetExtent().GetExtentCentre().mag();
920 G4VSolid* sectionBox =
921 new G4Box("_sectioner", safe, safe, 1.e-5 * radius); // Thin in z-plane...
922 const G4Normal3D originalNormal(0,0,1); // ...so this is original normal.
923
924 const G4Plane3D& sp = vp.GetSectionPlane ();
925 const G4double& a = sp.a();
926 const G4double& b = sp.b();
927 const G4double& c = sp.c();
928 const G4double& d = sp.d();
929 const G4Normal3D newNormal(a,b,c);
930
931 G4Transform3D requiredTransform;
932 // Rotate
933 if (newNormal != originalNormal) {
934 const G4double& angle = std::acos(newNormal.dot(originalNormal));
935 const G4Vector3D& axis = originalNormal.cross(newNormal);
936 requiredTransform = G4Rotate3D(angle, axis);
937 }
938 // Translate
939 requiredTransform = requiredTransform * G4TranslateZ3D(-d);
940
941 sectioner = new G4DisplacedSolid
942 ("_displaced_sectioning_box", sectionBox, requiredTransform);
943 }
944
945 return sectioner;
946}
HepGeom::Rotate3D G4Rotate3D
HepGeom::TranslateZ3D G4TranslateZ3D
Definition: G4Box.hh:56
const G4ViewParameters & GetViewParameters() const
const G4Plane3D & GetSectionPlane() const
G4double GetExtentRadius() const
Definition: G4VisExtent.cc:75
const G4Point3D & GetExtentCentre() const
Definition: G4VisExtent.cc:65
BasicVector3D< T > cross(const BasicVector3D< T > &v) const

Referenced by CreateModelingParameters().

◆ DrawEndOfRunModels()

void G4VSceneHandler::DrawEndOfRunModels ( )

Definition at line 824 of file G4VSceneHandler.cc.

825{
826 const std::vector<G4Scene::Model>& EORModelList =
827 fpScene -> GetEndOfRunModelList ();
828 size_t nModels = EORModelList.size();
829 if (nModels) {
831 pMP->SetEvent(0);
832 for (size_t i = 0; i < nModels; i++) {
833 if (EORModelList[i].fActive) {
834 fpModel = EORModelList[i].fpModel;
835 fpModel -> SetModelingParameters(pMP);
836 fpModel -> DescribeYourselfTo (*this);
837 fpModel -> SetModelingParameters(0);
838 }
839 }
840 fpModel = 0;
841 delete pMP;
842 }
843}
void SetEvent(const G4Event *pEvent)
G4ModelingParameters * CreateModelingParameters()

Referenced by ProcessScene().

◆ DrawEvent()

void G4VSceneHandler::DrawEvent ( const G4Event event)

Definition at line 803 of file G4VSceneHandler.cc.

804{
805 const std::vector<G4Scene::Model>& EOEModelList =
806 fpScene -> GetEndOfEventModelList ();
807 size_t nModels = EOEModelList.size();
808 if (nModels) {
810 pMP->SetEvent(event);
811 for (size_t i = 0; i < nModels; i++) {
812 if (EOEModelList[i].fActive) {
813 fpModel = EOEModelList[i].fpModel;
814 fpModel -> SetModelingParameters(pMP);
815 fpModel -> DescribeYourselfTo (*this);
816 fpModel -> SetModelingParameters(0);
817 }
818 }
819 fpModel = 0;
820 delete pMP;
821 }
822}

Referenced by ProcessScene().

◆ EndModeling()

◆ EndPrimitives()

◆ EndPrimitives2D()

void G4VSceneHandler::EndPrimitives2D ( )
virtual

Implements G4VGraphicsScene.

Reimplemented in G4HepRepFileSceneHandler.

Definition at line 196 of file G4VSceneHandler.cc.

196 {
197 if (fNestingDepth <= 0)
198 G4Exception("G4VSceneHandler::EndPrimitives2D",
199 "visman0104", FatalException, "Nesting error.");
204 }
205 fProcessing2D = false;
206}

Referenced by G4HepRepFileSceneHandler::EndPrimitives2D().

◆ GetAuxEdgeVisible()

G4bool G4VSceneHandler::GetAuxEdgeVisible ( const G4VisAttributes pVisAttribs)

Definition at line 1116 of file G4VSceneHandler.cc.

1116 {
1117 G4bool isAuxEdgeVisible = fpViewer->GetViewParameters().IsAuxEdgeVisible ();
1118 if (pVisAttribs -> IsForceAuxEdgeVisible()) {
1119 isAuxEdgeVisible = pVisAttribs->IsForcedAuxEdgeVisible();
1120 }
1121 return isAuxEdgeVisible;
1122}
G4bool IsAuxEdgeVisible() const
G4bool IsForcedAuxEdgeVisible() const

◆ GetColor()

const G4Colour & G4VSceneHandler::GetColor ( )

◆ GetColour()

const G4Colour & G4VSceneHandler::GetColour ( )

Referenced by GetTextColour().

◆ GetCurrentViewer()

G4VViewer * G4VSceneHandler::GetCurrentViewer ( ) const

◆ GetDrawingStyle()

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

Definition at line 1056 of file G4VSceneHandler.cc.

1057 {
1058 // Drawing style is normally determined by the view parameters, but
1059 // it can be overriddden by the ForceDrawingStyle flag in the vis
1060 // attributes.
1062 const G4ViewParameters::DrawingStyle viewerStyle = vp.GetDrawingStyle();
1063 G4ViewParameters::DrawingStyle resultantStyle = viewerStyle;
1064 if (pVisAttribs -> IsForceDrawingStyle ()) {
1066 pVisAttribs -> GetForcedDrawingStyle ();
1067 // This is complicated because if hidden line and surface removal
1068 // has been requested we wish to preserve this sometimes.
1069 switch (forcedStyle) {
1071 switch (viewerStyle) {
1072 case (G4ViewParameters::hlr):
1073 resultantStyle = G4ViewParameters::hlhsr;
1074 break;
1076 resultantStyle = G4ViewParameters::hsr;
1077 break;
1079 resultantStyle = G4ViewParameters::hsr;
1080 break;
1082 case (G4ViewParameters::hsr):
1083 break;
1084 }
1085 break;
1087 resultantStyle = G4ViewParameters::cloud;
1088 break;
1090 default:
1091 // But if forced style is wireframe, do it, because one of its
1092 // main uses is in displaying the consituent solids of a Boolean
1093 // solid and their surfaces overlap with the resulting Booean
1094 // solid, making a mess if hlr is specified.
1095 resultantStyle = G4ViewParameters::wireframe;
1096 break;
1097 }
1098 }
1099 return resultantStyle;
1100}

Referenced by G4XXXFileSceneHandler::AddPrimitive(), G4XXXSceneHandler::AddPrimitive(), G4XXXSGSceneHandler::AddPrimitive(), G4XXXStoredSceneHandler::AddPrimitive(), and RequestPrimitives().

◆ GetExtent()

const G4VisExtent & G4VSceneHandler::GetExtent ( ) const
virtual

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}

◆ GetGraphicsSystem()

◆ GetLineWidth()

G4double G4VSceneHandler::GetLineWidth ( const G4VisAttributes pVisAttribs)

Definition at line 1047 of file G4VSceneHandler.cc.

1048{
1049 G4double lineWidth = pVisAttribs->GetLineWidth();
1050 if (lineWidth < 1.) lineWidth = 1.;
1051 lineWidth *= fpViewer -> GetViewParameters().GetGlobalLineWidthScale();
1052 if (lineWidth < 1.) lineWidth = 1.;
1053 return lineWidth;
1054}
G4double GetLineWidth() const

◆ GetMarkerDiameter()

G4double G4VSceneHandler::GetMarkerDiameter ( const G4VMarker ,
MarkerSizeType  
)

◆ GetMarkerRadius()

G4double G4VSceneHandler::GetMarkerRadius ( const G4VMarker ,
MarkerSizeType  
)

◆ GetMarkerSize()

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

Definition at line 1124 of file G4VSceneHandler.cc.

1127{
1128 G4bool userSpecified = marker.GetWorldSize() || marker.GetScreenSize();
1129 const G4VMarker& defaultMarker =
1130 fpViewer -> GetViewParameters().GetDefaultMarker();
1131 G4double size = userSpecified ?
1132 marker.GetWorldSize() : defaultMarker.GetWorldSize();
1133 if (size) {
1134 // Draw in world coordinates.
1135 markerSizeType = world;
1136 }
1137 else {
1138 size = userSpecified ?
1139 marker.GetScreenSize() : defaultMarker.GetScreenSize();
1140 // Draw in screen coordinates.
1141 markerSizeType = screen;
1142 }
1143 size *= fpViewer -> GetViewParameters().GetGlobalMarkerScale();
1144 if (markerSizeType == screen && size < 1.) size = 1.;
1145 return size;
1146}
G4double GetScreenSize() const
G4double GetWorldSize() const

Referenced by G4XXXFileSceneHandler::AddPrimitive(), G4XXXSceneHandler::AddPrimitive(), G4XXXSGSceneHandler::AddPrimitive(), G4XXXStoredSceneHandler::AddPrimitive(), and G4HepRepFileSceneHandler::AddPrimitive().

◆ GetMarkForClearingTransientStore()

G4bool G4VSceneHandler::GetMarkForClearingTransientStore ( ) const

◆ GetModel()

G4VModel * G4VSceneHandler::GetModel ( ) const

◆ GetName()

◆ GetNoOfSides()

G4int G4VSceneHandler::GetNoOfSides ( const G4VisAttributes pVisAttribs)

Definition at line 1148 of file G4VSceneHandler.cc.

1149{
1150 // No. of sides (lines segments per circle) is normally determined
1151 // by the view parameters, but it can be overriddden by the
1152 // ForceLineSegmentsPerCircle in the vis attributes.
1153 G4int lineSegmentsPerCircle = fpViewer->GetViewParameters().GetNoOfSides();
1154 if (pVisAttribs) {
1155 if (pVisAttribs->IsForceLineSegmentsPerCircle())
1156 lineSegmentsPerCircle = pVisAttribs->GetForcedLineSegmentsPerCircle();
1157 if (lineSegmentsPerCircle < pVisAttribs->GetMinLineSegmentsPerCircle()) {
1158 lineSegmentsPerCircle = pVisAttribs->GetMinLineSegmentsPerCircle();
1159 G4cout <<
1160 "G4VSceneHandler::GetNoOfSides: attempt to set the"
1161 "\nnumber of line segments per circle < " << lineSegmentsPerCircle
1162 << "; forced to " << pVisAttribs->GetMinLineSegmentsPerCircle() << G4endl;
1163 }
1164 }
1165 return lineSegmentsPerCircle;
1166}
int G4int
Definition: G4Types.hh:85
G4bool IsForceLineSegmentsPerCircle() const
G4int GetForcedLineSegmentsPerCircle() const
static G4int GetMinLineSegmentsPerCircle()

Referenced by RequestPrimitives().

◆ GetNumberOfCloudPoints()

G4int G4VSceneHandler::GetNumberOfCloudPoints ( const G4VisAttributes pVisAttribs) const

Definition at line 1102 of file G4VSceneHandler.cc.

1103 {
1104 // Returns no of cloud points from current view parameters, unless the user
1105 // has forced through the vis attributes, thereby over-riding the
1106 // current view parameter.
1107 G4int numberOfCloudPoints = fpViewer->GetViewParameters().GetNumberOfCloudPoints();
1108 if (pVisAttribs -> IsForceDrawingStyle() &&
1109 pVisAttribs -> GetForcedDrawingStyle() == G4VisAttributes::cloud &&
1110 pVisAttribs -> GetForcedNumberOfCloudPoints() > 0) {
1111 numberOfCloudPoints = pVisAttribs -> GetForcedNumberOfCloudPoints();
1112 }
1113 return numberOfCloudPoints;
1114}

Referenced by RequestPrimitives().

◆ GetObjectTransformation()

const G4Transform3D & G4VSceneHandler::GetObjectTransformation ( ) const

◆ GetScene()

◆ GetSceneHandlerId()

G4int G4VSceneHandler::GetSceneHandlerId ( ) const

◆ GetTextColor()

const G4Colour & G4VSceneHandler::GetTextColor ( const G4Text )

◆ GetTextColour()

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

Definition at line 1038 of file G4VSceneHandler.cc.

1038 {
1039 const G4VisAttributes* pVA = text.GetVisAttributes ();
1040 if (!pVA) {
1042 }
1043 const G4Colour& colour = pVA -> GetColour ();
1044 return colour;
1045}
const G4Colour & GetColour()

Referenced by G4HepRepFileSceneHandler::AddPrimitive().

◆ GetTransientsDrawnThisEvent()

G4bool G4VSceneHandler::GetTransientsDrawnThisEvent ( ) const

◆ GetTransientsDrawnThisRun()

G4bool G4VSceneHandler::GetTransientsDrawnThisRun ( ) const

◆ GetViewCount()

G4int G4VSceneHandler::GetViewCount ( ) const

◆ GetViewerList()

const G4ViewerList & G4VSceneHandler::GetViewerList ( ) const

◆ IncrementViewCount()

G4int G4VSceneHandler::IncrementViewCount ( )

◆ IsReadyForTransients()

G4bool G4VSceneHandler::IsReadyForTransients ( ) const

◆ LoadAtts()

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

Definition at line 978 of file G4VSceneHandler.cc.

979{
980 // Load G4Atts from G4VisAttributes, if any...
981 const G4VisAttributes* va = visible.GetVisAttributes();
982 if (va) {
983 const std::map<G4String,G4AttDef>* vaDefs =
984 va->GetAttDefs();
985 if (vaDefs) {
986 holder->AddAtts(visible.GetVisAttributes()->CreateAttValues(), vaDefs);
987 }
988 }
989
990 G4PhysicalVolumeModel* pPVModel =
991 dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
992 if (pPVModel) {
993 // Load G4Atts from G4PhysicalVolumeModel...
994 const std::map<G4String,G4AttDef>* pvDefs = pPVModel->GetAttDefs();
995 if (pvDefs) {
996 holder->AddAtts(pPVModel->CreateCurrentAttValues(), pvDefs);
997 }
998 }
999
1000 G4TrajectoriesModel* trajModel = dynamic_cast<G4TrajectoriesModel*>(fpModel);
1001 if (trajModel) {
1002 // Load G4Atts from trajectory model...
1003 const std::map<G4String,G4AttDef>* trajModelDefs = trajModel->GetAttDefs();
1004 if (trajModelDefs) {
1005 holder->AddAtts(trajModel->CreateCurrentAttValues(), trajModelDefs);
1006 }
1007 // Load G4Atts from trajectory...
1008 const G4VTrajectory* traj = trajModel->GetCurrentTrajectory();
1009 if (traj) {
1010 const std::map<G4String,G4AttDef>* trajDefs = traj->GetAttDefs();
1011 if (trajDefs) {
1012 holder->AddAtts(traj->CreateAttValues(), trajDefs);
1013 }
1014 G4int nPoints = traj->GetPointEntries();
1015 for (G4int i = 0; i < nPoints; ++i) {
1016 G4VTrajectoryPoint* trajPoint = traj->GetPoint(i);
1017 if (trajPoint) {
1018 const std::map<G4String,G4AttDef>* pointDefs = trajPoint->GetAttDefs();
1019 if (pointDefs) {
1020 holder->AddAtts(trajPoint->CreateAttValues(), pointDefs);
1021 }
1022 }
1023 }
1024 }
1025 }
1026
1027 G4HitsModel* hitsModel = dynamic_cast<G4HitsModel*>(fpModel);
1028 if (hitsModel) {
1029 // Load G4Atts from hit...
1030 const G4VHit* hit = hitsModel->GetCurrentHit();
1031 const std::map<G4String,G4AttDef>* hitsDefs = hit->GetAttDefs();
1032 if (hitsDefs) {
1033 holder->AddAtts(hit->CreateAttValues(), hitsDefs);
1034 }
1035 }
1036}
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:66
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
Definition: G4VHit.hh:59
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

◆ PostAddSolid()

void G4VSceneHandler::PostAddSolid ( )
virtual

◆ PreAddSolid()

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

◆ ProcessScene()

void G4VSceneHandler::ProcessScene ( )
protectedvirtual

Definition at line 658 of file G4VSceneHandler.cc.

659{
660 // Assumes graphics database store has already been cleared if
661 // relevant for the particular scene handler.
662
663 if(!fpScene)
664 return;
665
667 {
668 G4Exception("G4VSceneHandler::ProcessScene", "visman0106", JustWarning,
669 "The scene has no extent.");
670 }
671
673
674 if(!visManager->GetConcreteInstance())
675 return;
676
677 G4VisManager::Verbosity verbosity = visManager->GetVerbosity();
678
679 fReadyForTransients = false;
680
681 // Reset fMarkForClearingTransientStore. (Leaving
682 // fMarkForClearingTransientStore true causes problems with
683 // recomputing transients below.) Restore it again at end...
684 G4bool tmpMarkForClearingTransientStore = fMarkForClearingTransientStore;
686
687 // Traverse geometry tree and send drawing primitives to window(s).
688
689 const std::vector<G4Scene::Model>& runDurationModelList =
691
692 if(runDurationModelList.size())
693 {
694 if(verbosity >= G4VisManager::confirmations)
695 {
696 G4cout << "Traversing scene data..." << G4endl;
697 }
698
700
701 // Create modeling parameters from view parameters...
703
704 for(size_t i = 0; i < runDurationModelList.size(); i++)
705 {
706 if(runDurationModelList[i].fActive)
707 {
708 fpModel = runDurationModelList[i].fpModel;
709 // Note: this is not the place to take action on
710 // pModel->GetTransformation(). The model must take care of
711 // this in pModel->DescribeYourselfTo(*this). See, for example,
712 // G4PhysicalVolumeModel and /vis/scene/add/logo.
716 }
717 }
718
719 fpModel = 0;
720 delete pMP;
721
722 EndModeling();
723 }
724
725 fReadyForTransients = true;
726
727 // Refresh event from end-of-event model list.
728 // Allow only in Idle or GeomClosed state...
730 G4ApplicationState state = stateManager->GetCurrentState();
731 if(state == G4State_Idle || state == G4State_GeomClosed)
732 {
733 visManager->SetEventRefreshing(true);
734
735 if(visManager->GetRequestedEvent())
736 {
737 DrawEvent(visManager->GetRequestedEvent());
738 }
739 else
740 {
742 if(runManager)
743 {
744 const G4Run* run = runManager->GetCurrentRun();
745 const std::vector<const G4Event*>* events =
746 run ? run->GetEventVector() : 0;
747 size_t nKeptEvents = 0;
748 if(events)
749 nKeptEvents = events->size();
750 if(nKeptEvents)
751 {
753 {
754 if(verbosity >= G4VisManager::confirmations)
755 {
756 G4cout << "Refreshing event..." << G4endl;
757 }
758 const G4Event* event = 0;
759 if(events && events->size())
760 event = events->back();
761 if(event)
762 DrawEvent(event);
763 }
764 else
765 { // Accumulating events.
766
767 if(verbosity >= G4VisManager::confirmations)
768 {
769 G4cout << "Refreshing events in run..." << G4endl;
770 }
771 for(const auto& event : *events)
772 {
773 if(event)
774 DrawEvent(event);
775 }
776
778 {
779 if(verbosity >= G4VisManager::warnings)
780 {
781 G4cout << "WARNING: Cannot refresh events accumulated over more"
782 "\n than one runs. Refreshed just the last run."
783 << G4endl;
784 }
785 }
786 }
787 }
788 }
789 }
790 visManager->SetEventRefreshing(false);
791 }
792
793 // Refresh end-of-run model list.
794 // Allow only in Idle or GeomClosed state...
795 if(state == G4State_Idle || state == G4State_GeomClosed)
796 {
798 }
799
800 fMarkForClearingTransientStore = tmpMarkForClearingTransientStore;
801}
G4ApplicationState
@ G4State_Idle
@ G4State_GeomClosed
@ JustWarning
static G4RunManager * GetMasterRunManager()
const G4Run * GetCurrentRun() const
Definition: G4Run.hh:49
const std::vector< const G4Event * > * GetEventVector() const
Definition: G4Run.hh:119
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()
static G4VVisManager * GetConcreteInstance()
static const G4VisExtent & GetNullExtent()
Definition: G4VisExtent.cc:60
void SetEventRefreshing(G4bool)
const G4Event * GetRequestedEvent() const

Referenced by G4VViewer::ProcessView().

◆ RemoveViewerFromList()

void G4VSceneHandler::RemoveViewerFromList ( G4VViewer pView)

Definition at line 569 of file G4VSceneHandler.cc.

569 {
570 fViewerList.remove(pViewer);
571}
void remove(G4VViewer *)
Definition: G4ViewerList.cc:30

Referenced by G4VViewer::~G4VViewer().

◆ RequestPrimitives()

void G4VSceneHandler::RequestPrimitives ( const G4VSolid solid)
protectedvirtual

Reimplemented in G4ASCIITreeSceneHandler, and G4RayTracerSceneHandler.

Definition at line 582 of file G4VSceneHandler.cc.

583{
586
587 switch (style) {
588 default:
593 {
594 // Use polyhedral representation
596 G4Polyhedron* pPolyhedron = solid.GetPolyhedron ();
598 if (pPolyhedron) {
599 pPolyhedron -> SetVisAttributes (fpVisAttribs);
601 AddPrimitive (*pPolyhedron);
602 EndPrimitives ();
603 break;
604 } else { // Print warnings and drop through to cloud
606 static std::set<const G4VSolid*> problematicSolids;
607 if (verbosity >= G4VisManager::errors &&
608 problematicSolids.find(&solid) == problematicSolids.end()) {
609 problematicSolids.insert(&solid);
610 G4cerr <<
611 "ERROR: G4VSceneHandler::RequestPrimitives"
612 "\n Polyhedron not available for " << solid.GetName ();
613 G4PhysicalVolumeModel* pPVModel = dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
614 if (pPVModel) {
615 G4cerr << "\n Touchable path: " << pPVModel->GetFullPVPath();
616 }
617 static G4bool explanation = false;
618 if (!explanation) {
619 explanation = true;
620 G4cerr <<
621 "\n This means it cannot be visualized in the usual way on most systems."
622 "\n 1) The solid may not have implemented the CreatePolyhedron method."
623 "\n 2) For Boolean solids, the BooleanProcessor, which attempts to create"
624 "\n the resultant polyhedron, may have failed."
625 "\n Try RayTracer. It uses Geant4's tracking algorithms instead.";
626 }
627 G4cerr << "\n Drawing solid with cloud of points.";
628 G4cerr << G4endl;
629 }
630 }
631 } // fallthrough
632
634 {
635 // Form solid out of cloud of dots
636 G4Polymarker dots;
637 // Note: OpenGL has a fast implementation of polymarker so it's better
638 // to build a polymarker rather than add a succession of circles.
639 // And anyway, in Qt, in the latter case each circle would be a scene-tree
640 // entry, something we would want to avoid.
643 dots.SetSize(G4VMarker::screen,1.);
644 G4int numberOfCloudPoints = GetNumberOfCloudPoints(fpVisAttribs);
645 if (numberOfCloudPoints <= 0) numberOfCloudPoints = vp.GetNumberOfCloudPoints();
646 for (G4int i = 0; i < numberOfCloudPoints; ++i) {
648 dots.push_back(p);
649 }
651 AddPrimitive(dots);
652 EndPrimitives ();
653 }
654 break;
655 }
656}
G4GLOB_DLL std::ostream G4cerr
const std::vector< G4PhysicalVolumeNodeID > & GetFullPVPath() const
void SetMarkerType(MarkerType)
void SetSize(SizeType, G4double)
Definition: G4VMarker.cc:118
G4int GetNumberOfCloudPoints(const G4VisAttributes *) const
G4int GetNoOfSides(const G4VisAttributes *)
virtual void EndPrimitives()
G4ViewParameters::DrawingStyle GetDrawingStyle(const G4VisAttributes *)
virtual void BeginPrimitives(const G4Transform3D &objectTransformation=G4Transform3D())
G4String GetName() const
virtual G4ThreeVector GetPointOnSurface() const
Definition: G4VSolid.cc:140
virtual G4Polyhedron * GetPolyhedron() const
Definition: G4VSolid.cc:693
static void SetNumberOfRotationSteps(G4int n)
static void ResetNumberOfRotationSteps()

Referenced by AddSolidT(), and AddSolidWithAuxiliaryEdges().

◆ SetCurrentViewer()

void G4VSceneHandler::SetCurrentViewer ( G4VViewer )

◆ SetMarkForClearingTransientStore()

◆ SetModel()

void G4VSceneHandler::SetModel ( G4VModel )

◆ SetName()

void G4VSceneHandler::SetName ( const G4String )

◆ SetObjectTransformation()

void G4VSceneHandler::SetObjectTransformation ( const G4Transform3D )

◆ SetScene()

void G4VSceneHandler::SetScene ( G4Scene pScene)
virtual

Definition at line 573 of file G4VSceneHandler.cc.

573 {
574 fpScene = pScene;
575 // Notify all viewers that a kernel visit is required.
577 for (i = fViewerList.begin(); i != fViewerList.end(); i++) {
578 (*i) -> SetNeedKernelVisit (true);
579 }
580}
std::vector< G4VViewer * >::iterator G4ViewerListIterator
Definition: G4ViewerList.hh:42

◆ SetTransientsDrawnThisEvent()

void G4VSceneHandler::SetTransientsDrawnThisEvent ( G4bool  )

◆ SetTransientsDrawnThisRun()

void G4VSceneHandler::SetTransientsDrawnThisRun ( G4bool  )

◆ SetViewerList()

G4ViewerList & G4VSceneHandler::SetViewerList ( )

Friends And Related Function Documentation

◆ G4VViewer

friend class G4VViewer
friend

Definition at line 63 of file G4VSceneHandler.hh.

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const G4VSceneHandler s 
)
friend

Definition at line 1168 of file G4VSceneHandler.cc.

1168 {
1169
1170 os << "Scene handler " << sh.fName << " has "
1171 << sh.fViewerList.size () << " viewer(s):";
1172 for (size_t i = 0; i < sh.fViewerList.size (); i++) {
1173 os << "\n " << *(sh.fViewerList [i]);
1174 }
1175
1176 if (sh.fpScene) {
1177 os << "\n " << *sh.fpScene;
1178 }
1179 else {
1180 os << "\n This scene handler currently has no scene.";
1181 }
1182
1183 return os;
1184}

Member Data Documentation

◆ fIdentityTransformation

const G4Transform3D G4VSceneHandler::fIdentityTransformation
protected

Definition at line 363 of file G4VSceneHandler.hh.

◆ fMarkForClearingTransientStore

G4bool G4VSceneHandler::fMarkForClearingTransientStore
protected

Definition at line 351 of file G4VSceneHandler.hh.

Referenced by ProcessScene().

◆ fName

G4String G4VSceneHandler::fName
protected

Definition at line 346 of file G4VSceneHandler.hh.

Referenced by G4VSceneHandler().

◆ fNestingDepth

G4int G4VSceneHandler::fNestingDepth
protected

◆ fObjectTransformation

◆ fpModel

◆ fProcessing2D

G4bool G4VSceneHandler::fProcessing2D
protected

◆ fProcessingSolid

G4bool G4VSceneHandler::fProcessingSolid
protected

◆ fpScene

◆ fpViewer

◆ fpVisAttribs

◆ fReadyForTransients

◆ fSceneHandlerId

const G4int G4VSceneHandler::fSceneHandlerId
protected

Definition at line 345 of file G4VSceneHandler.hh.

Referenced by G4VSceneHandler().

◆ fSystem

G4VGraphicsSystem& G4VSceneHandler::fSystem
protected

Definition at line 344 of file G4VSceneHandler.hh.

Referenced by G4VSceneHandler().

◆ fTransientsDrawnThisEvent

G4bool G4VSceneHandler::fTransientsDrawnThisEvent
protected

Definition at line 354 of file G4VSceneHandler.hh.

Referenced by EndPrimitives(), EndPrimitives2D(), G4VSceneHandler(), and PostAddSolid().

◆ fTransientsDrawnThisRun

G4bool G4VSceneHandler::fTransientsDrawnThisRun
protected

Definition at line 355 of file G4VSceneHandler.hh.

Referenced by EndPrimitives(), EndPrimitives2D(), G4VSceneHandler(), and PostAddSolid().

◆ fViewCount

G4int G4VSceneHandler::fViewCount
protected

Definition at line 347 of file G4VSceneHandler.hh.

◆ fViewerList

G4ViewerList G4VSceneHandler::fViewerList
protected

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