Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4VSceneHandler Class Referenceabstract

#include <G4VSceneHandler.hh>

Inheritance diagram for G4VSceneHandler:
Collaboration 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 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)
 
virtual void EndPrimitives ()
 
virtual void BeginPrimitives2D (const G4Transform3D &objectTransformation)
 
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 *)
 
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 ()
 

Protected Member Functions

virtual void ProcessScene ()
 
virtual void RequestPrimitives (const G4VSolid &solid)
 
virtual G4VSolidCreateSectionSolid ()
 
virtual G4VSolidCreateCutawaySolid ()
 
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

Enumerator
world 
screen 

Definition at line 68 of file G4VSceneHandler.hh.

Constructor & Destructor Documentation

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 }
G4bool GetTransientsDrawnThisRun() const
const XML_Char * name
Definition: expat.h:151
G4VViewer * fpViewer
const G4int fSceneHandlerId
static G4VisManager * GetInstance()
G4bool GetTransientsDrawnThisEvent() const
const G4VisAttributes * fpVisAttribs
const G4String & GetName() const
G4bool fMarkForClearingTransientStore
G4bool fTransientsDrawnThisEvent
G4bool fTransientsDrawnThisRun
G4VGraphicsSystem & fSystem

Here is the call graph for this function:

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

void G4VSceneHandler::AddCompound ( const G4VTrajectory traj)
virtual

Implements G4VGraphicsScene.

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

Definition at line 313 of file G4VSceneHandler.cc.

313  {
314  G4TrajectoriesModel* trajectoriesModel =
315  dynamic_cast<G4TrajectoriesModel*>(fpModel);
316  if (trajectoriesModel)
317  traj.DrawTrajectory();
318  else {
320  ("G4VSceneHandler::AddCompound(const G4VTrajectory&)",
321  "visman0105", FatalException, "Not a G4TrajectoriesModel.");
322  }
323 }
virtual void DrawTrajectory() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Here is the call graph for this function:

Here is the caller graph for this function:

void G4VSceneHandler::AddCompound ( const G4VHit hit)
virtual

Implements G4VGraphicsScene.

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

Definition at line 325 of file G4VSceneHandler.cc.

325  {
326  // Cast away const because Draw is non-const!!!!
327  const_cast<G4VHit&>(hit).Draw();
328 }
Definition: G4VHit.hh:48
void G4VSceneHandler::AddCompound ( const G4VDigi digi)
virtual

Implements G4VGraphicsScene.

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

Definition at line 330 of file G4VSceneHandler.cc.

330  {
331  // Cast away const because Draw is non-const!!!!
332  const_cast<G4VDigi&>(digi).Draw();
333 }
void G4VSceneHandler::AddCompound ( const G4THitsMap< G4double > &  hits)
virtual

Implements G4VGraphicsScene.

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

Definition at line 335 of file G4VSceneHandler.cc.

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

Here is the call graph for this function:

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

Implements G4VGraphicsScene.

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

Definition at line 377 of file G4VSceneHandler.cc.

377  {
378  //G4cout << "AddCompound: hits: " << &hits << G4endl;
379  G4bool scoreMapHits = false;
381  if (scoringManager) {
382  size_t nMeshes = scoringManager->GetNumberOfMesh();
383  for (size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
384  G4VScoringMesh* mesh = scoringManager->GetMesh(iMesh);
385  if (mesh && mesh->IsActive()) {
386  MeshScoreMap scoreMap = mesh->GetScoreMap();
387  for(MeshScoreMap::const_iterator i = scoreMap.begin();
388  i != scoreMap.end(); ++i) {
389  const G4String& scoreMapName = i->first;
390  const G4THitsMap<G4StatDouble>* foundHits = i->second;
391  if (foundHits == &hits) {
392  G4DefaultLinearColorMap colorMap("G4VSceneHandlerColorMap");
393  scoreMapHits = true;
394  mesh->DrawMesh(scoreMapName, &colorMap);
395  }
396  }
397  }
398  }
399  }
400  if (scoreMapHits) {
401  static G4bool first = true;
402  if (first) {
403  first = false;
404  G4cout <<
405  "Scoring map drawn with default parameters."
406  "\n To get gMocren file for gMocren browser:"
407  "\n /vis/open gMocrenFile"
408  "\n /vis/viewer/flush"
409  "\n Many other options available with /score/draw... commands."
410  "\n You might want to \"/vis/viewer/set/autoRefresh false\"."
411  << G4endl;
412  }
413  } else { // Not score map hits. Just call DrawAllHits.
414  // Cast away const because DrawAllHits is non-const!!!!
415  const_cast<G4THitsMap<G4StatDouble>&>(hits).DrawAllHits();
416  }
417 }
void DrawMesh(const G4String &psName, G4VScoreColorMap *colorMap, G4int axflg=111)
G4int first(char) const
G4GLOB_DLL std::ostream G4cout
static G4ScoringManager * GetScoringManagerIfExist()
bool G4bool
Definition: G4Types.hh:79
MeshScoreMap GetScoreMap() const
#define G4endl
Definition: G4ios.hh:61
G4bool IsActive() const
size_t GetNumberOfMesh() const
G4VScoringMesh * GetMesh(G4int i) const
std::map< G4String, RunScore * > MeshScoreMap

Here is the call graph for this function:

void G4VSceneHandler::AddPrimitive ( const G4Scale scale)
virtual

Implements G4VGraphicsScene.

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

Definition at line 423 of file G4VSceneHandler.cc.

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

Here is the call graph for this function:

void G4VSceneHandler::AddPrimitive ( const G4Polymarker polymarker)
virtual

Implements G4VGraphicsScene.

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

Definition at line 527 of file G4VSceneHandler.cc.

527  {
528  switch (polymarker.GetMarkerType()) {
529  default:
530  case G4Polymarker::dots:
531  {
532  for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
533  G4Circle dot (polymarker);
534  dot.SetPosition (polymarker[iPoint]);
535  dot.SetWorldSize (0.);
536  dot.SetScreenSize (0.1); // Very small circle.
537  AddPrimitive (dot);
538  }
539  }
540  break;
542  {
543  for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
544  G4Circle circle (polymarker);
545  circle.SetPosition (polymarker[iPoint]);
546  AddPrimitive (circle);
547  }
548  }
549  break;
551  {
552  for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
553  G4Square square (polymarker);
554  square.SetPosition (polymarker[iPoint]);
555  AddPrimitive (square);
556  }
557  }
558  break;
559  }
560 }
MarkerType GetMarkerType() const
virtual void AddPrimitive(const G4Polyline &)=0

Here is the call graph for this function:

void G4VSceneHandler::AddSolid ( const G4Box box)
virtual

Implements G4VGraphicsScene.

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

Definition at line 246 of file G4VSceneHandler.cc.

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

Here is the call graph for this function:

Here is the caller graph for this function:

void G4VSceneHandler::AddSolid ( const G4Cons cons)
virtual
void G4VSceneHandler::AddSolid ( const G4Orb orb)
virtual
void G4VSceneHandler::AddSolid ( const G4Para para)
virtual
void G4VSceneHandler::AddSolid ( const G4Sphere sphere)
virtual
void G4VSceneHandler::AddSolid ( const G4Torus torus)
virtual
void G4VSceneHandler::AddSolid ( const G4Trap trap)
virtual
void G4VSceneHandler::AddSolid ( const G4Trd trd)
virtual
void G4VSceneHandler::AddSolid ( const G4Tubs tubs)
virtual
void G4VSceneHandler::AddSolid ( const G4Ellipsoid ellipsoid)
virtual
void G4VSceneHandler::AddSolid ( const G4Polycone polycone)
virtual
void G4VSceneHandler::AddSolid ( const G4Polyhedra polyhedra)
virtual
void G4VSceneHandler::AddSolid ( const G4VSolid solid)
virtual
template<class T >
void G4VSceneHandler::AddSolidT ( const T &  solid)

Definition at line 220 of file G4VSceneHandler.cc.

221 {
222  // Get and check applicable vis attributes.
224  RequestPrimitives (solid);
225 }
G4VViewer * fpViewer
const G4VisAttributes * GetApplicableVisAttributes(const G4VisAttributes *) const
const G4VisAttributes * fpVisAttribs
virtual void RequestPrimitives(const G4VSolid &solid)

Here is the caller graph for this function:

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

Definition at line 228 of file G4VSceneHandler.cc.

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

Here is the call graph for this function:

Here is the caller graph for this function:

void G4VSceneHandler::AddViewerToList ( G4VViewer pView)

Definition at line 419 of file G4VSceneHandler.cc.

419  {
420  fViewerList.push_back (pViewer);
421 }
G4ViewerList fViewerList
void G4VSceneHandler::BeginModeling ( )
virtual
void G4VSceneHandler::BeginPrimitives ( const G4Transform3D objectTransformation)
virtual

Implements G4VGraphicsScene.

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

Definition at line 160 of file G4VSceneHandler.cc.

160  {
161  //static G4int count = 0;
162  //G4cout << "G4VSceneHandler::BeginPrimitives: " << count++ << G4endl;
163  fNestingDepth++;
164  if (fNestingDepth > 1)
166  ("G4VSceneHandler::BeginPrimitives",
167  "visman0101", FatalException,
168  "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
169  fObjectTransformation = objectTransformation;
170 }
G4Transform3D fObjectTransformation
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Here is the call graph for this function:

Here is the caller graph for this function:

void G4VSceneHandler::BeginPrimitives2D ( const G4Transform3D objectTransformation)
virtual

Implements G4VGraphicsScene.

Reimplemented in G4HepRepFileSceneHandler.

Definition at line 184 of file G4VSceneHandler.cc.

184  {
185  fNestingDepth++;
186  if (fNestingDepth > 1)
188  ("G4VSceneHandler::BeginPrimitives2D",
189  "visman0103", FatalException,
190  "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
191  fObjectTransformation = objectTransformation;
192  fProcessing2D = true;
193 }
G4Transform3D fObjectTransformation
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Here is the call graph for this function:

Here is the caller graph for this function:

void G4VSceneHandler::ClearStore ( )
virtual

Reimplemented in G4XXXSGSceneHandler, and G4XXXStoredSceneHandler.

Definition at line 215 of file G4VSceneHandler.cc.

215 {}

Here is the caller graph for this function:

void G4VSceneHandler::ClearTransientStore ( )
virtual
G4VSolid * G4VSceneHandler::CreateCutawaySolid ( )
protectedvirtual

Definition at line 860 of file G4VSceneHandler.cc.

861 {
862  // To be reviewed.
863  return 0;
864  /*** An alternative way of getting a cutaway is to use
865  Command /vis/scene/add/volume
866  Guidance :
867  Adds a physical volume to current scene, with optional clipping volume.
868  If physical-volume-name is "world" (the default), the top of the
869  main geometry tree (material world) is added. If "worlds", the
870  top of all worlds - material world and parallel worlds, if any - are
871  added. Otherwise a search of all worlds is made, taking the first
872  matching occurence only. To see a representation of the geometry
873  hierarchy of the worlds, try "/vis/drawTree [worlds]" or one of the
874  driver/browser combinations that have the required functionality, e.g., HepRep.
875  If clip-volume-type is specified, the subsequent parameters are used to
876  to define a clipping volume. For example,
877  "/vis/scene/add/volume ! ! ! -box km 0 1 0 1 0 1" will draw the world
878  with the positive octant cut away. (If the Boolean Processor issues
879  warnings try replacing 0 by 0.000000001 or something.)
880  If clip-volume-type is prepended with '-', the clip-volume is subtracted
881  (cutaway). (This is the default if there is no prepended character.)
882  If '*' is prepended, the intersection of the physical-volume and the
883  clip-volume is made. (You can make a section/DCUT with a thin box, for
884  example).
885  For "box", the parameters are xmin,xmax,ymin,ymax,zmin,zmax.
886  Only "box" is programmed at present.
887  ***/
888 }

Here is the caller graph for this function:

G4ModelingParameters * G4VSceneHandler::CreateModelingParameters ( )

Definition at line 774 of file G4VSceneHandler.cc.

775 {
776  // Create modeling parameters from View Parameters...
777  if (!fpViewer) return NULL;
778 
779  const G4ViewParameters& vp = fpViewer -> GetViewParameters ();
780 
781  // Convert drawing styles...
782  G4ModelingParameters::DrawingStyle modelDrawingStyle =
784  switch (vp.GetDrawingStyle ()) {
785  default:
787  modelDrawingStyle = G4ModelingParameters::wf;
788  break;
790  modelDrawingStyle = G4ModelingParameters::hlr;
791  break;
793  modelDrawingStyle = G4ModelingParameters::hsr;
794  break;
796  modelDrawingStyle = G4ModelingParameters::hlhsr;
797  break;
798  }
799 
800  // Decide if covered daughters are really to be culled...
801  G4bool reallyCullCovered =
802  vp.IsCullingCovered() // Culling daughters depends also on...
803  && !vp.IsSection () // Sections (DCUT) not requested.
804  && !vp.IsCutaway () // Cutaways not requested.
805  ;
806 
807  G4ModelingParameters* pModelingParams = new G4ModelingParameters
809  modelDrawingStyle,
810  vp.IsCulling (),
811  vp.IsCullingInvisible (),
812  vp.IsDensityCulling (),
813  vp.GetVisibleDensity (),
814  reallyCullCovered,
815  vp.GetNoOfSides ()
816  );
817 
818  pModelingParams->SetWarning
820 
821  pModelingParams->SetExplodeFactor(vp.GetExplodeFactor());
822  pModelingParams->SetExplodeCentre(vp.GetExplodeCentre());
823 
824  pModelingParams->SetSectionSolid(CreateSectionSolid());
825  pModelingParams->SetCutawaySolid(CreateCutawaySolid());
826  // The polyhedron objects are deleted in the modeling parameters destructor.
827 
829 
830  return pModelingParams;
831 }
virtual G4VSolid * CreateSectionSolid()
G4double GetVisibleDensity() const
const G4Point3D & GetExplodeCentre() const
G4bool IsCullingInvisible() const
G4VViewer * fpViewer
G4double GetExplodeFactor() const
G4bool IsDensityCulling() const
virtual G4VSolid * CreateCutawaySolid()
void SetCutawaySolid(G4VSolid *pCutawaySolid)
const std::vector< G4ModelingParameters::VisAttributesModifier > & GetVisAttributesModifiers() const
bool G4bool
Definition: G4Types.hh:79
G4bool IsCullingCovered() const
void SetSectionSolid(G4VSolid *pSectionSolid)
G4bool IsSection() const
void SetVisAttributesModifiers(const std::vector< VisAttributesModifier > &)
G4bool IsCutaway() const
G4int GetNoOfSides() const
void SetWarning(G4bool)
static Verbosity GetVerbosity()
DrawingStyle GetDrawingStyle() const
void SetExplodeFactor(G4double explodeFactor)
const G4VisAttributes * GetDefaultVisAttributes() const
void SetExplodeCentre(const G4Point3D &explodeCentre)
G4bool IsCulling() const

Here is the call graph for this function:

Here is the caller graph for this function:

G4VSolid * G4VSceneHandler::CreateSectionSolid ( )
protectedvirtual

Definition at line 833 of file G4VSceneHandler.cc.

834 {
835  G4VSolid* sectioner = 0;
837  if (vp.IsSection () ) {
839  G4double safe = radius + fpScene->GetExtent().GetExtentCentre().mag();
840  G4VSolid* sectionBox =
841  new G4Box("_sectioner", safe, safe, 1.e-5 * radius); // Thin in z-plane.
842  const G4Plane3D& sp = vp.GetSectionPlane ();
843  G4double a = sp.a();
844  G4double b = sp.b();
845  G4double c = sp.c();
846  G4double d = sp.d();
847  G4Transform3D transform = G4TranslateZ3D(-d);
848  const G4Normal3D normal(a,b,c);
849  if (normal != G4Normal3D(0,0,1)) {
850  const G4double angle = std::acos(normal.dot(G4Normal3D(0,0,1)));
851  const G4Vector3D axis = G4Normal3D(0,0,1).cross(normal);
852  transform = G4Rotate3D(angle, axis) * transform;
853  }
854  sectioner = new G4DisplacedSolid
855  ("_displaced_sectioning_box", sectionBox, transform);
856  }
857  return sectioner;
858 }
T c() const
Definition: Plane3D.h:83
Definition: G4Box.hh:64
G4VViewer * fpViewer
const G4ViewParameters & GetViewParameters() const
static G4double angle[DIM]
const G4Point3D & GetExtentCentre() const
Definition: G4VisExtent.cc:63
T d() const
Definition: Plane3D.h:86
static double normal(HepRandomEngine *eptr)
Definition: RandPoisson.cc:77
G4double GetExtentRadius() const
Definition: G4VisExtent.cc:73
const G4VisExtent & GetExtent() const
G4bool IsSection() const
HepGeom::Rotate3D G4Rotate3D
T a() const
Definition: Plane3D.h:77
const G4Plane3D & GetSectionPlane() const
double G4double
Definition: G4Types.hh:76
T b() const
Definition: Plane3D.h:80
HepGeom::TranslateZ3D G4TranslateZ3D
HepGeom::Normal3D< G4double > G4Normal3D
Definition: G4Normal3D.hh:35

Here is the call graph for this function:

Here is the caller graph for this function:

void G4VSceneHandler::DrawEndOfRunModels ( )

Definition at line 752 of file G4VSceneHandler.cc.

753 {
754  const std::vector<G4Scene::Model>& EORModelList =
755  fpScene -> GetEndOfRunModelList ();
756  size_t nModels = EORModelList.size();
757  if (nModels) {
759  pMP->SetEvent(0);
760  for (size_t i = 0; i < nModels; i++) {
761  if (EORModelList[i].fActive) {
762  G4VModel* pModel = EORModelList[i].fpModel;
763  pModel -> SetModelingParameters(pMP);
764  SetModel (pModel);
765  pModel -> DescribeYourselfTo (*this);
766  pModel -> SetModelingParameters(0);
767  }
768  }
769  delete pMP;
770  SetModel (0);
771  }
772 }
G4ModelingParameters * CreateModelingParameters()
void SetEvent(const G4Event *pEvent)
void SetModel(G4VModel *)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4VSceneHandler::DrawEvent ( const G4Event event)

Definition at line 730 of file G4VSceneHandler.cc.

731 {
732  const std::vector<G4Scene::Model>& EOEModelList =
733  fpScene -> GetEndOfEventModelList ();
734  size_t nModels = EOEModelList.size();
735  if (nModels) {
737  pMP->SetEvent(event);
738  for (size_t i = 0; i < nModels; i++) {
739  if (EOEModelList[i].fActive) {
740  G4VModel* pModel = EOEModelList[i].fpModel;
741  pModel -> SetModelingParameters(pMP);
742  SetModel (pModel);
743  pModel -> DescribeYourselfTo (*this);
744  pModel -> SetModelingParameters(0);
745  }
746  }
747  delete pMP;
748  SetModel (0);
749  }
750 }
G4ModelingParameters * CreateModelingParameters()
void SetEvent(const G4Event *pEvent)
void SetModel(G4VModel *)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4VSceneHandler::EndModeling ( )
virtual

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

Definition at line 210 of file G4VSceneHandler.cc.

211 {
212  fpModel = 0;
213 }

Here is the caller graph for this function:

void G4VSceneHandler::EndPrimitives ( )
virtual

Implements G4VGraphicsScene.

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

Definition at line 172 of file G4VSceneHandler.cc.

172  {
173  if (fNestingDepth <= 0)
174  G4Exception("G4VSceneHandler::EndPrimitives",
175  "visman0102", FatalException, "Nesting error.");
176  fNestingDepth--;
177  if (fReadyForTransients) {
180  }
181 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4bool fTransientsDrawnThisEvent
G4bool fTransientsDrawnThisRun

Here is the call graph for this function:

Here is the caller graph for this function:

void G4VSceneHandler::EndPrimitives2D ( )
virtual

Implements G4VGraphicsScene.

Reimplemented in G4HepRepFileSceneHandler.

Definition at line 195 of file G4VSceneHandler.cc.

195  {
196  if (fNestingDepth <= 0)
197  G4Exception("G4VSceneHandler::EndPrimitives2D",
198  "visman0104", FatalException, "Nesting error.");
199  fNestingDepth--;
200  if (fReadyForTransients) {
203  }
204  fProcessing2D = false;
205 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4bool fTransientsDrawnThisEvent
G4bool fTransientsDrawnThisRun

Here is the call graph for this function:

Here is the caller graph for this function:

G4bool G4VSceneHandler::GetAuxEdgeVisible ( const G4VisAttributes pVisAttribs)

Definition at line 1008 of file G4VSceneHandler.cc.

1008  {
1009  G4bool isAuxEdgeVisible = fpViewer->GetViewParameters().IsAuxEdgeVisible ();
1010  if (pVisAttribs -> IsForceAuxEdgeVisible()) {
1011  isAuxEdgeVisible = pVisAttribs->IsForcedAuxEdgeVisible();
1012  }
1013  return isAuxEdgeVisible;
1014 }
G4VViewer * fpViewer
const G4ViewParameters & GetViewParameters() const
G4bool IsAuxEdgeVisible() const
bool G4bool
Definition: G4Types.hh:79
G4bool IsForcedAuxEdgeVisible() const

Here is the call graph for this function:

const G4Colour& G4VSceneHandler::GetColor ( )

Here is the caller graph for this function:

const G4Colour& G4VSceneHandler::GetColour ( )

Here is the caller graph for this function:

G4VViewer* G4VSceneHandler::GetCurrentViewer ( ) const

Here is the caller graph for this function:

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

Definition at line 969 of file G4VSceneHandler.cc.

969  {
970  // Drawing style is normally determined by the view parameters, but
971  // it can be overriddden by the ForceDrawingStyle flag in the vis
972  // attributes.
975  if (pVisAttribs -> IsForceDrawingStyle ()) {
977  pVisAttribs -> GetForcedDrawingStyle ();
978  // This is complicated because if hidden line and surface removal
979  // has been requested we wish to preserve this sometimes.
980  switch (forcedStyle) {
981  case (G4VisAttributes::solid):
982  switch (style) {
983  case (G4ViewParameters::hlr):
984  style = G4ViewParameters::hlhsr;
985  break;
987  style = G4ViewParameters::hsr;
988  break;
990  case (G4ViewParameters::hsr):
991  default:
992  break;
993  }
994  break;
996  default:
997  // But if forced style is wireframe, do it, because one of its
998  // main uses is in displaying the consituent solids of a Boolean
999  // solid and their surfaces overlap with the resulting Booean
1000  // solid, making a mess if hlr is specified.
1002  break;
1003  }
1004  }
1005  return style;
1006 }
G4VViewer * fpViewer
const G4ViewParameters & GetViewParameters() const
DrawingStyle GetDrawingStyle() const

Here is the caller graph for this function:

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 {
140  }
141 }
static const G4VisExtent NullExtent
Definition: G4VisExtent.hh:80
const G4VisExtent & GetExtent() const

Here is the call graph for this function:

G4VGraphicsSystem* G4VSceneHandler::GetGraphicsSystem ( ) const

Here is the caller graph for this function:

G4double G4VSceneHandler::GetLineWidth ( const G4VisAttributes pVisAttribs)

Definition at line 959 of file G4VSceneHandler.cc.

960 {
961  G4double lineWidth = pVisAttribs->GetLineWidth();
962  if (lineWidth < 1.) lineWidth = 1.;
963  lineWidth *= fpViewer -> GetViewParameters().GetGlobalLineWidthScale();
964  if (lineWidth < 1.) lineWidth = 1.;
965  return lineWidth;
966 }
G4double GetLineWidth() const
G4VViewer * fpViewer
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

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

Definition at line 1017 of file G4VSceneHandler.cc.

1019 {
1020  G4bool userSpecified = marker.GetWorldSize() || marker.GetScreenSize();
1021  const G4VMarker& defaultMarker =
1022  fpViewer -> GetViewParameters().GetDefaultMarker();
1023  G4double size = userSpecified ?
1024  marker.GetWorldSize() : defaultMarker.GetWorldSize();
1025  if (size) {
1026  // Draw in world coordinates.
1027  markerSizeType = world;
1028  }
1029  else {
1030  size = userSpecified ?
1031  marker.GetScreenSize() : defaultMarker.GetScreenSize();
1032  // Draw in screen coordinates.
1033  markerSizeType = screen;
1034  }
1035  size *= fpViewer -> GetViewParameters().GetGlobalMarkerScale();
1036  if (markerSizeType == screen && size < 1.) size = 1.;
1037  return size;
1038 }
G4double GetWorldSize() const
G4VViewer * fpViewer
G4double GetScreenSize() const
bool G4bool
Definition: G4Types.hh:79
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

G4bool G4VSceneHandler::GetMarkForClearingTransientStore ( ) const
G4VModel* G4VSceneHandler::GetModel ( ) const

Here is the caller graph for this function:

const G4String& G4VSceneHandler::GetName ( ) const

Here is the caller graph for this function:

G4int G4VSceneHandler::GetNoOfSides ( const G4VisAttributes pVisAttribs)

Definition at line 1040 of file G4VSceneHandler.cc.

1041 {
1042  // No. of sides (lines segments per circle) is normally determined
1043  // by the view parameters, but it can be overriddden by the
1044  // ForceLineSegmentsPerCircle in the vis attributes.
1045  G4int lineSegmentsPerCircle = fpViewer->GetViewParameters().GetNoOfSides();
1046  if (pVisAttribs) {
1047  if (pVisAttribs->IsForceLineSegmentsPerCircle())
1048  lineSegmentsPerCircle = pVisAttribs->GetForcedLineSegmentsPerCircle();
1049  if (lineSegmentsPerCircle < pVisAttribs->GetMinLineSegmentsPerCircle()) {
1050  lineSegmentsPerCircle = pVisAttribs->GetMinLineSegmentsPerCircle();
1051  G4cout <<
1052  "G4VSceneHandler::GetNoOfSides: attempt to set the"
1053  "\nnumber of line segements per circle < " << lineSegmentsPerCircle
1054  << "; forced to " << pVisAttribs->GetMinLineSegmentsPerCircle() << G4endl;
1055  }
1056  }
1057  return lineSegmentsPerCircle;
1058 }
G4VViewer * fpViewer
const G4ViewParameters & GetViewParameters() const
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
static G4int GetMinLineSegmentsPerCircle()
G4int GetForcedLineSegmentsPerCircle() const
G4int GetNoOfSides() const
#define G4endl
Definition: G4ios.hh:61
G4bool IsForceLineSegmentsPerCircle() const

Here is the call graph for this function:

Here is the caller graph for this function:

const G4Transform3D& G4VSceneHandler::GetObjectTransformation ( ) const
G4Scene* G4VSceneHandler::GetScene ( ) const

Here is the caller graph for this function:

G4int G4VSceneHandler::GetSceneHandlerId ( ) const
const G4Colour& G4VSceneHandler::GetTextColor ( const G4Text )
const G4Colour & G4VSceneHandler::GetTextColour ( const G4Text text)

Definition at line 950 of file G4VSceneHandler.cc.

950  {
951  const G4VisAttributes* pVA = text.GetVisAttributes ();
952  if (!pVA) {
954  }
955  const G4Colour& colour = pVA -> GetColour ();
956  return colour;
957 }
const G4VisAttributes * GetVisAttributes() const
static const G4Colour & GetCurrentTextColour()
const G4Colour & GetColour()

Here is the call graph for this function:

Here is the caller graph for this function:

G4bool G4VSceneHandler::GetTransientsDrawnThisEvent ( ) const
G4bool G4VSceneHandler::GetTransientsDrawnThisRun ( ) const
G4int G4VSceneHandler::GetViewCount ( ) const
const G4ViewerList& G4VSceneHandler::GetViewerList ( ) const
G4int G4VSceneHandler::IncrementViewCount ( )
G4bool G4VSceneHandler::IsReadyForTransients ( ) const
void G4VSceneHandler::LoadAtts ( const G4Visible visible,
G4AttHolder holder 
)
protected

Definition at line 890 of file G4VSceneHandler.cc.

891 {
892  // Load G4Atts from G4VisAttributes, if any...
893  const G4VisAttributes* va = visible.GetVisAttributes();
894  if (va) {
895  const std::map<G4String,G4AttDef>* vaDefs =
896  va->GetAttDefs();
897  if (vaDefs) {
898  holder->AddAtts(visible.GetVisAttributes()->CreateAttValues(), vaDefs);
899  }
900  }
901 
902  G4PhysicalVolumeModel* pPVModel =
903  dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
904  if (pPVModel) {
905  // Load G4Atts from G4PhysicalVolumeModel...
906  const std::map<G4String,G4AttDef>* pvDefs = pPVModel->GetAttDefs();
907  if (pvDefs) {
908  holder->AddAtts(pPVModel->CreateCurrentAttValues(), pvDefs);
909  }
910  }
911 
912  G4TrajectoriesModel* trajModel = dynamic_cast<G4TrajectoriesModel*>(fpModel);
913  if (trajModel) {
914  // Load G4Atts from trajectory model...
915  const std::map<G4String,G4AttDef>* trajModelDefs = trajModel->GetAttDefs();
916  if (trajModelDefs) {
917  holder->AddAtts(trajModel->CreateCurrentAttValues(), trajModelDefs);
918  }
919  // Load G4Atts from trajectory...
920  const G4VTrajectory* traj = trajModel->GetCurrentTrajectory();
921  if (traj) {
922  const std::map<G4String,G4AttDef>* trajDefs = traj->GetAttDefs();
923  if (trajDefs) {
924  holder->AddAtts(traj->CreateAttValues(), trajDefs);
925  }
926  G4int nPoints = traj->GetPointEntries();
927  for (G4int i = 0; i < nPoints; ++i) {
928  G4VTrajectoryPoint* trajPoint = traj->GetPoint(i);
929  if (trajPoint) {
930  const std::map<G4String,G4AttDef>* pointDefs = trajPoint->GetAttDefs();
931  if (pointDefs) {
932  holder->AddAtts(trajPoint->CreateAttValues(), pointDefs);
933  }
934  }
935  }
936  }
937  }
938 
939  G4HitsModel* hitsModel = dynamic_cast<G4HitsModel*>(fpModel);
940  if (hitsModel) {
941  // Load G4Atts from hit...
942  const G4VHit* hit = hitsModel->GetCurrentHit();
943  const std::map<G4String,G4AttDef>* hitsDefs = hit->GetAttDefs();
944  if (hitsDefs) {
945  holder->AddAtts(hit->CreateAttValues(), hitsDefs);
946  }
947  }
948 }
void AddAtts(const std::vector< G4AttValue > *values, const std::map< G4String, G4AttDef > *defs)
Definition: G4AttHolder.hh:65
const std::map< G4String, G4AttDef > * GetAttDefs() const
std::vector< G4AttValue > * CreateCurrentAttValues() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual G4VTrajectoryPoint * GetPoint(G4int i) const =0
Definition: G4VHit.hh:48
const G4VisAttributes * GetVisAttributes() const
int G4int
Definition: G4Types.hh:78
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual std::vector< G4AttValue > * CreateAttValues() const
virtual int GetPointEntries() const =0
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
const G4VHit * GetCurrentHit() const
Definition: G4HitsModel.hh:58
const G4VTrajectory * GetCurrentTrajectory() const
virtual std::vector< G4AttValue > * CreateAttValues() const
std::vector< G4AttValue > * CreateCurrentAttValues() const
const std::vector< G4AttValue > * CreateAttValues() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
Definition: G4VHit.hh:60
const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual std::vector< G4AttValue > * CreateAttValues() const
Definition: G4VHit.hh:67

Here is the call graph for this function:

void G4VSceneHandler::PostAddSolid ( )
virtual

Implements G4VGraphicsScene.

Reimplemented in G4XXXSGSceneHandler, G4HepRepSceneHandler, G4XXXStoredSceneHandler, and G4VTreeSceneHandler.

Definition at line 150 of file G4VSceneHandler.cc.

150  {
151  fpVisAttribs = 0;
152  fProcessingSolid = false;
153  if (fReadyForTransients) {
156  }
157 }
const G4VisAttributes * fpVisAttribs
G4bool fTransientsDrawnThisEvent
G4bool fTransientsDrawnThisRun

Here is the caller graph for this function:

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

Implements G4VGraphicsScene.

Reimplemented in G4XXXSGSceneHandler, G4HepRepSceneHandler, G4XXXStoredSceneHandler, and G4VTreeSceneHandler.

Definition at line 143 of file G4VSceneHandler.cc.

144  {
145  fObjectTransformation = objectTransformation;
146  fpVisAttribs = &visAttribs;
147  fProcessingSolid = true;
148 }
G4Transform3D fObjectTransformation
const G4VisAttributes * fpVisAttribs

Here is the caller graph for this function:

void G4VSceneHandler::ProcessScene ( )
protectedvirtual

Definition at line 606 of file G4VSceneHandler.cc.

606  {
607 
608  // Assumes graphics database store has already been cleared if
609  // relevant for the particular scene handler.
610 
611  if (!fpScene) return;
612 
613  G4VisManager* visManager = G4VisManager::GetInstance();
614 
615  if (!visManager->GetConcreteInstance()) return;
616 
617  G4VisManager::Verbosity verbosity = visManager->GetVerbosity();
618 
619  fReadyForTransients = false;
620 
621  // Reset fMarkForClearingTransientStore. (Leaving
622  // fMarkForClearingTransientStore true causes problems with
623  // recomputing transients below.) Restore it again at end...
624  G4bool tmpMarkForClearingTransientStore = fMarkForClearingTransientStore;
626 
627  // Traverse geometry tree and send drawing primitives to window(s).
628 
629  const std::vector<G4Scene::Model>& runDurationModelList =
630  fpScene -> GetRunDurationModelList ();
631 
632  if (runDurationModelList.size ()) {
633  if (verbosity >= G4VisManager::confirmations) {
634  G4cout << "Traversing scene data..." << G4endl;
635  }
636 
637  BeginModeling ();
638 
639  // Create modeling parameters from view parameters...
641 
642  for (size_t i = 0; i < runDurationModelList.size (); i++) {
643  if (runDurationModelList[i].fActive) {
644  G4VModel* pModel = runDurationModelList[i].fpModel;
645  // Note: this is not the place to take action on
646  // pModel->GetTransformation(). The model must take care of
647  // this in pModel->DescribeYourselfTo(*this). See, for example,
648  // G4PhysicalVolumeModel and /vis/scene/add/logo.
649  pModel -> SetModelingParameters (pMP);
650  SetModel (pModel); // Store for use by derived class.
651  pModel -> DescribeYourselfTo (*this);
652  pModel -> SetModelingParameters (0);
653  }
654  }
655 
656  delete pMP;
657  EndModeling ();
658  }
659 
660  fReadyForTransients = true;
661 
662  // Refresh event from end-of-event model list.
663  // Allow only in Idle or GeomClosed state...
665  G4ApplicationState state = stateManager->GetCurrentState();
666  if (state == G4State_Idle || state == G4State_GeomClosed) {
667 
668  visManager->SetEventRefreshing(true);
669 
670  if (visManager->GetRequestedEvent()) {
671  DrawEvent(visManager->GetRequestedEvent());
672 
673  } else {
674 
676 #ifdef G4MULTITHREADED
678  { runManager = G4MTRunManager::GetMasterRunManager(); }
679 #endif
680  if (runManager) {
681  const G4Run* run = runManager->GetCurrentRun();
682  const std::vector<const G4Event*>* events =
683  run? run->GetEventVector(): 0;
684  size_t nKeptEvents = 0;
685  if (events) nKeptEvents = events->size();
686  if (nKeptEvents) {
687 
689 
690  if (verbosity >= G4VisManager::confirmations) {
691  G4cout << "Refreshing event..." << G4endl;
692  }
693  const G4Event* event = 0;
694  if (events && events->size()) event = events->back();
695  if (event) DrawEvent(event);
696 
697  } else { // Accumulating events.
698 
699  if (verbosity >= G4VisManager::confirmations) {
700  G4cout << "Refreshing events in run..." << G4endl;
701  }
702  for (const auto& event: *events) {
703  if (event) DrawEvent(event);
704  }
705 
706  if (!fpScene->GetRefreshAtEndOfRun()) {
707  if (verbosity >= G4VisManager::warnings) {
708  G4cout <<
709  "WARNING: Cannot refresh events accumulated over more"
710  "\n than one runs. Refreshed just the last run."
711  << G4endl;
712  }
713  }
714  }
715  }
716  }
717  }
718  visManager->SetEventRefreshing(false);
719  }
720 
721  // Refresh end-of-run model list.
722  // Allow only in Idle or GeomClosed state...
723  if (state == G4State_Idle || state == G4State_GeomClosed) {
725  }
726 
727  fMarkForClearingTransientStore = tmpMarkForClearingTransientStore;
728 }
virtual void BeginModeling()
G4ModelingParameters * CreateModelingParameters()
static G4VVisManager * GetConcreteInstance()
void SetEventRefreshing(G4bool)
const std::vector< const G4Event * > * GetEventVector() const
Definition: G4Run.hh:115
G4bool GetRefreshAtEndOfEvent() const
const G4Run * GetCurrentRun() const
static G4StateManager * GetStateManager()
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
static G4MTRunManager * GetMasterRunManager()
G4bool GetRefreshAtEndOfRun() const
static G4VisManager * GetInstance()
Definition: G4Run.hh:46
virtual void EndModeling()
G4ApplicationState GetCurrentState() const
G4bool IsMultithreadedApplication()
Definition: G4Threading.cc:152
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
G4bool fMarkForClearingTransientStore
void DrawEvent(const G4Event *)
static Verbosity GetVerbosity()
const G4Event * GetRequestedEvent() const
#define G4endl
Definition: G4ios.hh:61
void SetModel(G4VModel *)
G4ApplicationState

Here is the call graph for this function:

Here is the caller graph for this function:

void G4VSceneHandler::RemoveViewerFromList ( G4VViewer pView)

Definition at line 562 of file G4VSceneHandler.cc.

562  {
563  fViewerList.remove(pViewer);
564 }
void remove(G4VViewer *)
Definition: G4ViewerList.cc:31
G4ViewerList fViewerList

Here is the call graph for this function:

Here is the caller graph for this function:

void G4VSceneHandler::RequestPrimitives ( const G4VSolid solid)
protectedvirtual

Reimplemented in G4ASCIITreeSceneHandler.

Definition at line 575 of file G4VSceneHandler.cc.

575  {
577  G4Polyhedron* pPolyhedron = solid.GetPolyhedron ();
579  if (pPolyhedron) {
580  pPolyhedron -> SetVisAttributes (fpVisAttribs);
582  AddPrimitive (*pPolyhedron);
583  EndPrimitives ();
584  }
585  else {
587  if (verbosity >= G4VisManager::errors) {
588  G4cerr <<
589  "ERROR: G4VSceneHandler::RequestPrimitives"
590  "\n Polyhedron not available for " << solid.GetName () <<
591  "\n Touchable path: ";
592  G4PhysicalVolumeModel* pPVModel = dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
593  if (pPVModel) {
594  G4cerr << pPVModel->GetFullPVPath();
595  }
596  G4cerr <<
597  "\n This means it cannot be visualized on most systems (try RayTracer)."
598  "\n 1) The solid may not have implemented the CreatePolyhedron method."
599  "\n 2) For Boolean solids, the BooleanProcessor, which attempts to create"
600  "\n the resultant polyhedron, may have failed."
601  << G4endl;
602  }
603  }
604 }
virtual G4Polyhedron * GetPolyhedron() const
Definition: G4VSolid.cc:665
G4String GetName() const
virtual void BeginPrimitives(const G4Transform3D &objectTransformation)
G4Transform3D fObjectTransformation
G4int GetNoOfSides(const G4VisAttributes *)
virtual void AddPrimitive(const G4Polyline &)=0
virtual void EndPrimitives()
const std::vector< G4PhysicalVolumeNodeID > & GetFullPVPath() const
const G4VisAttributes * fpVisAttribs
static Verbosity GetVerbosity()
#define G4endl
Definition: G4ios.hh:61
static void SetNumberOfRotationSteps(G4int n)
G4GLOB_DLL std::ostream G4cerr
static void ResetNumberOfRotationSteps()

Here is the call graph for this function:

void G4VSceneHandler::SetCurrentViewer ( G4VViewer )
void G4VSceneHandler::SetMarkForClearingTransientStore ( G4bool  )

Here is the caller graph for this function:

void G4VSceneHandler::SetModel ( G4VModel )

Here is the caller graph for this function:

void G4VSceneHandler::SetName ( const G4String )
void G4VSceneHandler::SetObjectTransformation ( const G4Transform3D )
void G4VSceneHandler::SetScene ( G4Scene pScene)
virtual

Definition at line 566 of file G4VSceneHandler.cc.

566  {
567  fpScene = pScene;
568  // Notify all viewers that a kernel visit is required.
570  for (i = fViewerList.begin(); i != fViewerList.end(); i++) {
571  (*i) -> SetNeedKernelVisit (true);
572  }
573 }
G4ViewerList fViewerList
std::vector< G4VViewer * >::iterator G4ViewerListIterator
Definition: G4ViewerList.hh:43
void G4VSceneHandler::SetTransientsDrawnThisEvent ( G4bool  )
void G4VSceneHandler::SetTransientsDrawnThisRun ( G4bool  )
G4ViewerList& G4VSceneHandler::SetViewerList ( )

Friends And Related Function Documentation

friend class G4VViewer
friend

Definition at line 63 of file G4VSceneHandler.hh.

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

Definition at line 1060 of file G4VSceneHandler.cc.

1060  {
1061 
1062  os << "Scene handler " << sh.fName << " has "
1063  << sh.fViewerList.size () << " viewer(s):";
1064  for (size_t i = 0; i < sh.fViewerList.size (); i++) {
1065  os << "\n " << *(sh.fViewerList [i]);
1066  }
1067 
1068  if (sh.fpScene) {
1069  os << "\n " << *sh.fpScene;
1070  }
1071  else {
1072  os << "\n This scene handler currently has no scene.";
1073  }
1074 
1075  return os;
1076 }

Member Data Documentation

const G4Transform3D G4VSceneHandler::fIdentityTransformation
protected

Definition at line 357 of file G4VSceneHandler.hh.

G4bool G4VSceneHandler::fMarkForClearingTransientStore
protected

Definition at line 345 of file G4VSceneHandler.hh.

G4String G4VSceneHandler::fName
protected

Definition at line 340 of file G4VSceneHandler.hh.

G4int G4VSceneHandler::fNestingDepth
protected

Definition at line 355 of file G4VSceneHandler.hh.

G4Transform3D G4VSceneHandler::fObjectTransformation
protected

Definition at line 353 of file G4VSceneHandler.hh.

G4VModel* G4VSceneHandler::fpModel
protected

Definition at line 352 of file G4VSceneHandler.hh.

G4bool G4VSceneHandler::fProcessing2D
protected

Definition at line 351 of file G4VSceneHandler.hh.

G4bool G4VSceneHandler::fProcessingSolid
protected

Definition at line 350 of file G4VSceneHandler.hh.

G4Scene* G4VSceneHandler::fpScene
protected

Definition at line 344 of file G4VSceneHandler.hh.

G4VViewer* G4VSceneHandler::fpViewer
protected

Definition at line 343 of file G4VSceneHandler.hh.

const G4VisAttributes* G4VSceneHandler::fpVisAttribs
protected

Definition at line 356 of file G4VSceneHandler.hh.

G4bool G4VSceneHandler::fReadyForTransients
protected

Definition at line 346 of file G4VSceneHandler.hh.

const G4int G4VSceneHandler::fSceneHandlerId
protected

Definition at line 339 of file G4VSceneHandler.hh.

G4VGraphicsSystem& G4VSceneHandler::fSystem
protected

Definition at line 338 of file G4VSceneHandler.hh.

G4bool G4VSceneHandler::fTransientsDrawnThisEvent
protected

Definition at line 348 of file G4VSceneHandler.hh.

G4bool G4VSceneHandler::fTransientsDrawnThisRun
protected

Definition at line 349 of file G4VSceneHandler.hh.

G4int G4VSceneHandler::fViewCount
protected

Definition at line 341 of file G4VSceneHandler.hh.

G4ViewerList G4VSceneHandler::fViewerList
protected

Definition at line 342 of file G4VSceneHandler.hh.


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