Geant4  10.02.p03
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 G4Tubs &)
 
virtual void AddSolid (const G4Trd &)
 
virtual void AddSolid (const G4Trap &)
 
virtual void AddSolid (const G4Sphere &)
 
virtual void AddSolid (const G4Para &)
 
virtual void AddSolid (const G4Torus &)
 
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 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 G4Visible &)
 
const G4ColourGetColor (const G4Visible &)
 
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 ()
 
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
 

Private Member Functions

 G4VSceneHandler (const G4VSceneHandler &)
 
G4VSceneHandleroperator= (const G4VSceneHandler &)
 

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

Constructor & Destructor Documentation

◆ G4VSceneHandler() [1/2]

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

Definition at line 91 of file G4VSceneHandler.cc.

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

◆ ~G4VSceneHandler()

G4VSceneHandler::~G4VSceneHandler ( )
virtual

Definition at line 122 of file G4VSceneHandler.cc.

122  {
123  G4VViewer* last;
124  while( ! fViewerList.empty() ) {
125  last = fViewerList.back();
126  fViewerList.pop_back();
127  delete last;
128  }
129 }
G4ViewerList fViewerList

◆ G4VSceneHandler() [2/2]

G4VSceneHandler::G4VSceneHandler ( const G4VSceneHandler )
private

Member Function Documentation

◆ AddCompound() [1/4]

void G4VSceneHandler::AddCompound ( const G4VTrajectory traj)
virtual

Implements G4VGraphicsScene.

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

Definition at line 271 of file G4VSceneHandler.cc.

271  {
272  G4TrajectoriesModel* trajectoriesModel =
273  dynamic_cast<G4TrajectoriesModel*>(fpModel);
274  if (trajectoriesModel)
275  traj.DrawTrajectory();
276  else {
278  ("G4VSceneHandler::AddCompound(const G4VTrajectory&)",
279  "visman0105", FatalException, "Not a G4TrajectoriesModel.");
280  }
281 }
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:

◆ AddCompound() [2/4]

void G4VSceneHandler::AddCompound ( const G4VHit hit)
virtual

Implements G4VGraphicsScene.

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

Definition at line 283 of file G4VSceneHandler.cc.

283  {
284  // Cast away const because Draw is non-const!!!!
285  const_cast<G4VHit&>(hit).Draw();
286 }
hist1 Draw("HIST")
Definition: G4VHit.hh:48
Here is the call graph for this function:

◆ AddCompound() [3/4]

void G4VSceneHandler::AddCompound ( const G4VDigi digi)
virtual

Implements G4VGraphicsScene.

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

Definition at line 288 of file G4VSceneHandler.cc.

288  {
289  // Cast away const because Draw is non-const!!!!
290  const_cast<G4VDigi&>(digi).Draw();
291 }
hist1 Draw("HIST")
Here is the call graph for this function:

◆ AddCompound() [4/4]

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

Implements G4VGraphicsScene.

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

Definition at line 293 of file G4VSceneHandler.cc.

293  {
294  //G4cout << "AddCompound: hits: " << &hits << G4endl;
295  G4bool scoreMapHits = false;
297  if (scoringManager) {
298  size_t nMeshes = scoringManager->GetNumberOfMesh();
299  for (size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
300  G4VScoringMesh* mesh = scoringManager->GetMesh(iMesh);
301  if (mesh && mesh->IsActive()) {
302  MeshScoreMap scoreMap = mesh->GetScoreMap();
303  for(MeshScoreMap::const_iterator i = scoreMap.begin();
304  i != scoreMap.end(); ++i) {
305  const G4String& scoreMapName = i->first;
306  const G4THitsMap<G4double>* foundHits = i->second;
307  if (foundHits == &hits) {
308  G4DefaultLinearColorMap colorMap("G4VSceneHandlerColorMap");
309  scoreMapHits = true;
310  mesh->DrawMesh(scoreMapName, &colorMap);
311  }
312  }
313  }
314  }
315  }
316  if (scoreMapHits) {
317  static G4bool first = true;
318  if (first) {
319  first = false;
320  G4cout <<
321  "Scoring map drawn with default parameters."
322  "\n To get gMocren file for gMocren browser:"
323  "\n /vis/open gMocrenFile"
324  "\n /vis/viewer/flush"
325  "\n Many other options available with /score/draw... commands."
326  "\n You might want to \"/vis/viewer/set/autoRefresh false\"."
327  << G4endl;
328  }
329  } else { // Not score map hits. Just call DrawAllHits.
330  // Cast away const because DrawAllHits is non-const!!!!
331  const_cast<G4THitsMap<G4double>&>(hits).DrawAllHits();
332  }
333 }
void DrawMesh(const G4String &psName, G4VScoreColorMap *colorMap, G4int axflg=111)
G4int first(char) const
G4bool IsActive() const
std::map< G4String, G4THitsMap< G4double > *> MeshScoreMap
MeshScoreMap GetScoreMap() const
size_t GetNumberOfMesh() const
G4VScoringMesh * GetMesh(G4int i) const
void hits()
Definition: readHits.C:15
G4GLOB_DLL std::ostream G4cout
static G4ScoringManager * GetScoringManagerIfExist()
bool G4bool
Definition: G4Types.hh:79
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ AddPrimitive() [1/7]

virtual void G4VSceneHandler::AddPrimitive ( const G4Polyline )
pure virtual

Implements G4VGraphicsScene.

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

Here is the caller graph for this function:

◆ AddPrimitive() [2/7]

void G4VSceneHandler::AddPrimitive ( const G4Scale scale)
virtual

Implements G4VGraphicsScene.

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

Definition at line 339 of file G4VSceneHandler.cc.

339  {
340 
341  const G4double margin(0.01);
342  // Fractional margin - ensures scale is comfortably inside viewing
343  // volume.
344  const G4double oneMinusMargin (1. - margin);
345 
346  const G4VisExtent& sceneExtent = fpScene->GetExtent();
347 
348  // Useful constants...
349  const G4double length(scale.GetLength());
350  const G4double halfLength(length / 2.);
351  const G4double tickLength(length / 20.);
352  const G4double piBy2(halfpi);
353 
354  // Get size of scene...
355  const G4double xmin = sceneExtent.GetXmin();
356  const G4double xmax = sceneExtent.GetXmax();
357  const G4double ymin = sceneExtent.GetYmin();
358  const G4double ymax = sceneExtent.GetYmax();
359  const G4double zmin = sceneExtent.GetZmin();
360  const G4double zmax = sceneExtent.GetZmax();
361 
362  // Create (empty) polylines having the same vis attributes...
363  G4Polyline scaleLine, tick11, tick12, tick21, tick22;
364  G4VisAttributes visAtts(*scale.GetVisAttributes()); // Long enough life.
365  scaleLine.SetVisAttributes(&visAtts);
366  tick11.SetVisAttributes(&visAtts);
367  tick12.SetVisAttributes(&visAtts);
368  tick21.SetVisAttributes(&visAtts);
369  tick22.SetVisAttributes(&visAtts);
370 
371  // Add points to the polylines to represent an scale parallel to the
372  // x-axis centred on the origin...
373  G4Point3D r1(G4Point3D(-halfLength, 0., 0.));
374  G4Point3D r2(G4Point3D( halfLength, 0., 0.));
375  scaleLine.push_back(r1);
376  scaleLine.push_back(r2);
377  G4Point3D ticky(0., tickLength, 0.);
378  G4Point3D tickz(0., 0., tickLength);
379  tick11.push_back(r1 + ticky);
380  tick11.push_back(r1 - ticky);
381  tick12.push_back(r1 + tickz);
382  tick12.push_back(r1 - tickz);
383  tick21.push_back(r2 + ticky);
384  tick21.push_back(r2 - ticky);
385  tick22.push_back(r2 + tickz);
386  tick22.push_back(r2 - tickz);
387  G4Point3D textPosition(0., tickLength, 0.);
388 
389  // Transform appropriately...
390 
391  G4Transform3D transformation;
392  if (scale.GetAutoPlacing()) {
393  G4Transform3D rotation;
394  switch (scale.GetDirection()) {
395  case G4Scale::x:
396  break;
397  case G4Scale::y:
398  rotation = G4RotateZ3D(piBy2);
399  break;
400  case G4Scale::z:
401  rotation = G4RotateY3D(piBy2);
402  break;
403  }
404  G4double sxmid;
405  G4double symid;
406  G4double szmid;
407  sxmid = xmin + oneMinusMargin * (xmax - xmin);
408  symid = ymin + margin * (ymax - ymin);
409  szmid = zmin + oneMinusMargin * (zmax - zmin);
410  switch (scale.GetDirection()) {
411  case G4Scale::x:
412  sxmid -= halfLength;
413  break;
414  case G4Scale::y:
415  symid += halfLength;
416  break;
417  case G4Scale::z:
418  szmid -= halfLength;
419  break;
420  }
421  G4Translate3D translation(sxmid, symid, szmid);
422  transformation = translation * rotation;
423  } else {
424  if (fpModel) transformation = fpModel->GetTransformation();
425  }
426 
427  // Draw...
428  // We would like to call BeginPrimitives(transformation) here but
429  // calling BeginPrimitives from within an AddPrimitive is not
430  // allowed! So we have to do our own transformation...
431  AddPrimitive(scaleLine.transform(transformation));
432  AddPrimitive(tick11.transform(transformation));
433  AddPrimitive(tick12.transform(transformation));
434  AddPrimitive(tick21.transform(transformation));
435  AddPrimitive(tick22.transform(transformation));
436  G4Text text(scale.GetAnnotation(),textPosition.transform(transformation));
437  text.SetScreenSize(scale.GetAnnotationSize());
438  AddPrimitive(text);
439 }
G4double GetYmin() const
Definition: G4VisExtent.hh:91
const G4VisAttributes * GetVisAttributes() const
Definition: G4Text.hh:73
G4double GetXmax() const
Definition: G4VisExtent.hh:90
static const double halfpi
Definition: G4SIunits.hh:76
HepGeom::RotateY3D G4RotateY3D
G4double GetZmax() const
Definition: G4VisExtent.hh:94
G4double GetLength() const
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:35
const G4Transform3D & GetTransformation() const
const G4String & GetAnnotation() const
virtual void AddPrimitive(const G4Polyline &)=0
HepGeom::RotateZ3D G4RotateZ3D
G4double GetXmin() const
Definition: G4VisExtent.hh:89
Direction GetDirection() const
const G4VisExtent & GetExtent() const
G4double GetZmin() const
Definition: G4VisExtent.hh:93
G4double GetYmax() const
Definition: G4VisExtent.hh:92
void SetVisAttributes(const G4VisAttributes *)
Definition: G4Visible.cc:80
G4bool GetAutoPlacing() const
double G4double
Definition: G4Types.hh:76
G4double GetAnnotationSize() const
G4Polyline & transform(const G4Transform3D &)
Definition: G4Polyline.cc:38
void SetScreenSize(G4double)
Here is the call graph for this function:

◆ AddPrimitive() [3/7]

◆ AddPrimitive() [4/7]

◆ AddPrimitive() [5/7]

◆ AddPrimitive() [6/7]

void G4VSceneHandler::AddPrimitive ( const G4Polymarker polymarker)
virtual

Implements G4VGraphicsScene.

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

Definition at line 441 of file G4VSceneHandler.cc.

441  {
442  switch (polymarker.GetMarkerType()) {
443  default:
444  case G4Polymarker::dots:
445  {
446  for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
447  G4Circle dot (polymarker);
448  dot.SetPosition (polymarker[iPoint]);
449  dot.SetWorldSize (0.);
450  dot.SetScreenSize (0.1); // Very small circle.
451  AddPrimitive (dot);
452  }
453  }
454  break;
456  {
457  for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
458  G4Circle circle (polymarker);
459  circle.SetPosition (polymarker[iPoint]);
460  AddPrimitive (circle);
461  }
462  }
463  break;
465  {
466  for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
467  G4Square square (polymarker);
468  square.SetPosition (polymarker[iPoint]);
469  AddPrimitive (square);
470  }
471  }
472  break;
473  }
474 }
virtual void AddPrimitive(const G4Polyline &)=0
MarkerType GetMarkerType() const
Here is the call graph for this function:

◆ AddPrimitive() [7/7]

◆ AddSolid() [1/11]

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 216 of file G4VSceneHandler.cc.

216  {
217  RequestPrimitives (box);
218 // If your graphics system is sophisticated enough to handle a
219 // particular solid shape as a primitive, in your derived class write a
220 // function to override this. (Note: some compilers warn that your
221 // function "hides" this one. That's OK.)
222 // Your function might look like this...
223 // void G4MyScene::AddSolid (const G4Box& box) {
224 // Get parameters of appropriate object, e.g.:
225 // G4double dx = box.GetXHalfLength ();
226 // G4double dy = box.GetYHalfLength ();
227 // G4double dz = box.GetZHalfLength ();
228 // and Draw or Store in your display List.
229 }
virtual void RequestPrimitives(const G4VSolid &solid)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddSolid() [2/11]

void G4VSceneHandler::AddSolid ( const G4Cons cons)
virtual

Implements G4VGraphicsScene.

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

Definition at line 235 of file G4VSceneHandler.cc.

235  {
236  RequestPrimitives (cons);
237 }
virtual void RequestPrimitives(const G4VSolid &solid)
Here is the call graph for this function:

◆ AddSolid() [3/11]

void G4VSceneHandler::AddSolid ( const G4Tubs tubs)
virtual

Implements G4VGraphicsScene.

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

Definition at line 231 of file G4VSceneHandler.cc.

231  {
232  RequestPrimitives (tubs);
233 }
virtual void RequestPrimitives(const G4VSolid &solid)
Here is the call graph for this function:

◆ AddSolid() [4/11]

void G4VSceneHandler::AddSolid ( const G4Trd trd)
virtual

Implements G4VGraphicsScene.

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

Definition at line 239 of file G4VSceneHandler.cc.

239  {
240  RequestPrimitives (trd);
241 }
virtual void RequestPrimitives(const G4VSolid &solid)
Here is the call graph for this function:

◆ AddSolid() [5/11]

void G4VSceneHandler::AddSolid ( const G4Trap trap)
virtual

Implements G4VGraphicsScene.

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

Definition at line 243 of file G4VSceneHandler.cc.

243  {
244  RequestPrimitives (trap);
245 }
virtual void RequestPrimitives(const G4VSolid &solid)
Here is the call graph for this function:

◆ AddSolid() [6/11]

void G4VSceneHandler::AddSolid ( const G4Sphere sphere)
virtual

Implements G4VGraphicsScene.

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

Definition at line 247 of file G4VSceneHandler.cc.

247  {
248  RequestPrimitives (sphere );
249 }
virtual void RequestPrimitives(const G4VSolid &solid)
Here is the call graph for this function:

◆ AddSolid() [7/11]

void G4VSceneHandler::AddSolid ( const G4Para para)
virtual

Implements G4VGraphicsScene.

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

Definition at line 251 of file G4VSceneHandler.cc.

251  {
252  RequestPrimitives (para);
253 }
virtual void RequestPrimitives(const G4VSolid &solid)
Here is the call graph for this function:

◆ AddSolid() [8/11]

void G4VSceneHandler::AddSolid ( const G4Torus torus)
virtual

Implements G4VGraphicsScene.

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

Definition at line 255 of file G4VSceneHandler.cc.

255  {
256  RequestPrimitives (torus);
257 }
virtual void RequestPrimitives(const G4VSolid &solid)
Here is the call graph for this function:

◆ AddSolid() [9/11]

void G4VSceneHandler::AddSolid ( const G4Polycone polycone)
virtual

Implements G4VGraphicsScene.

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

Definition at line 259 of file G4VSceneHandler.cc.

259  {
260  RequestPrimitives (polycone);
261 }
virtual void RequestPrimitives(const G4VSolid &solid)
Here is the call graph for this function:

◆ AddSolid() [10/11]

void G4VSceneHandler::AddSolid ( const G4Polyhedra polyhedra)
virtual

Implements G4VGraphicsScene.

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

Definition at line 263 of file G4VSceneHandler.cc.

263  {
264  RequestPrimitives (polyhedra);
265 }
virtual void RequestPrimitives(const G4VSolid &solid)
Here is the call graph for this function:

◆ AddSolid() [11/11]

void G4VSceneHandler::AddSolid ( const G4VSolid solid)
virtual

Implements G4VGraphicsScene.

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

Definition at line 267 of file G4VSceneHandler.cc.

267  {
268  RequestPrimitives (solid);
269 }
virtual void RequestPrimitives(const G4VSolid &solid)
Here is the call graph for this function:

◆ AddViewerToList()

void G4VSceneHandler::AddViewerToList ( G4VViewer pView)

Definition at line 335 of file G4VSceneHandler.cc.

335  {
336  fViewerList.push_back (pViewer);
337 }
G4ViewerList fViewerList

◆ BeginModeling()

void G4VSceneHandler::BeginModeling ( )
virtual

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

Definition at line 204 of file G4VSceneHandler.cc.

204  {
205 }
Here is the caller graph for this function:

◆ BeginPrimitives()

void G4VSceneHandler::BeginPrimitives ( const G4Transform3D objectTransformation)
virtual

Implements G4VGraphicsScene.

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

Definition at line 157 of file G4VSceneHandler.cc.

157  {
158  //static G4int count = 0;
159  //G4cout << "G4VSceneHandler::BeginPrimitives: " << count++ << G4endl;
160  fNestingDepth++;
161  if (fNestingDepth > 1)
163  ("G4VSceneHandler::BeginPrimitives",
164  "visman0101", FatalException,
165  "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
166  fObjectTransformation = objectTransformation;
167 }
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:

◆ BeginPrimitives2D()

void G4VSceneHandler::BeginPrimitives2D ( const G4Transform3D objectTransformation)
virtual

Implements G4VGraphicsScene.

Reimplemented in G4HepRepFileSceneHandler.

Definition at line 181 of file G4VSceneHandler.cc.

181  {
182  fNestingDepth++;
183  if (fNestingDepth > 1)
185  ("G4VSceneHandler::BeginPrimitives2D",
186  "visman0103", FatalException,
187  "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
188  fObjectTransformation = objectTransformation;
189  fProcessing2D = true;
190 }
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:

◆ ClearStore()

void G4VSceneHandler::ClearStore ( )
virtual

Reimplemented in G4XXXSGSceneHandler, and G4XXXStoredSceneHandler.

Definition at line 212 of file G4VSceneHandler.cc.

212 {}
Here is the caller graph for this function:

◆ ClearTransientStore()

void G4VSceneHandler::ClearTransientStore ( )
virtual

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

Definition at line 214 of file G4VSceneHandler.cc.

214 {}
Here is the caller graph for this function:

◆ CreateCutawaySolid()

G4VSolid * G4VSceneHandler::CreateCutawaySolid ( )
protectedvirtual

Definition at line 765 of file G4VSceneHandler.cc.

766 {
767  return 0;
768 }
Here is the caller graph for this function:

◆ CreateModelingParameters()

G4ModelingParameters * G4VSceneHandler::CreateModelingParameters ( )

Definition at line 679 of file G4VSceneHandler.cc.

680 {
681  // Create modeling parameters from View Parameters...
682  if (!fpViewer) return NULL;
683 
684  const G4ViewParameters& vp = fpViewer -> GetViewParameters ();
685 
686  // Convert drawing styles...
687  G4ModelingParameters::DrawingStyle modelDrawingStyle =
689  switch (vp.GetDrawingStyle ()) {
690  default:
692  modelDrawingStyle = G4ModelingParameters::wf;
693  break;
695  modelDrawingStyle = G4ModelingParameters::hlr;
696  break;
698  modelDrawingStyle = G4ModelingParameters::hsr;
699  break;
701  modelDrawingStyle = G4ModelingParameters::hlhsr;
702  break;
703  }
704 
705  // Decide if covered daughters are really to be culled...
706  G4bool reallyCullCovered =
707  vp.IsCullingCovered() // Culling daughters depends also on...
708  && !vp.IsSection () // Sections (DCUT) not requested.
709  && !vp.IsCutaway () // Cutaways not requested.
710  ;
711 
712  G4ModelingParameters* pModelingParams = new G4ModelingParameters
714  modelDrawingStyle,
715  vp.IsCulling (),
716  vp.IsCullingInvisible (),
717  vp.IsDensityCulling (),
718  vp.GetVisibleDensity (),
719  reallyCullCovered,
720  vp.GetNoOfSides ()
721  );
722 
723  pModelingParams->SetWarning
725 
726  pModelingParams->SetExplodeFactor(vp.GetExplodeFactor());
727  pModelingParams->SetExplodeCentre(vp.GetExplodeCentre());
728 
729  pModelingParams->SetSectionSolid(CreateSectionSolid());
730  pModelingParams->SetCutawaySolid(CreateCutawaySolid());
731  // The polyhedron objects are deleted in the modeling parameters destructor.
732 
734 
735  return pModelingParams;
736 }
const std::vector< G4ModelingParameters::VisAttributesModifier > & GetVisAttributesModifiers() const
DrawingStyle GetDrawingStyle() const
virtual G4VSolid * CreateSectionSolid()
G4bool IsCullingInvisible() const
G4VViewer * fpViewer
G4int GetNoOfSides() const
G4double GetExplodeFactor() const
G4bool IsCutaway() const
virtual G4VSolid * CreateCutawaySolid()
G4bool IsSection() const
void SetCutawaySolid(G4VSolid *pCutawaySolid)
G4bool IsDensityCulling() const
bool G4bool
Definition: G4Types.hh:79
G4bool IsCullingCovered() const
void SetSectionSolid(G4VSolid *pSectionSolid)
void SetVisAttributesModifiers(const std::vector< VisAttributesModifier > &)
const G4Point3D & GetExplodeCentre() const
void SetWarning(G4bool)
static Verbosity GetVerbosity()
const G4VisAttributes * GetDefaultVisAttributes() const
void SetExplodeFactor(G4double explodeFactor)
G4bool IsCulling() const
void SetExplodeCentre(const G4Point3D &explodeCentre)
G4double GetVisibleDensity() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateSectionSolid()

G4VSolid * G4VSceneHandler::CreateSectionSolid ( )
protectedvirtual

Definition at line 738 of file G4VSceneHandler.cc.

739 {
740  G4VSolid* sectioner = 0;
742  if (vp.IsSection () ) {
744  G4double safe = radius + fpScene->GetExtent().GetExtentCentre().mag();
745  G4VSolid* sectionBox =
746  new G4Box("_sectioner", safe, safe, 1.e-5 * radius); // Thin in z-plane.
747  const G4Plane3D& sp = vp.GetSectionPlane ();
748  G4double a = sp.a();
749  G4double b = sp.b();
750  G4double c = sp.c();
751  G4double d = sp.d();
752  G4Transform3D transform = G4TranslateZ3D(-d);
753  const G4Normal3D normal(a,b,c);
754  if (normal != G4Normal3D(0,0,1)) {
755  const G4double angle = std::acos(normal.dot(G4Normal3D(0,0,1)));
756  const G4Vector3D axis = G4Normal3D(0,0,1).cross(normal);
757  transform = G4Rotate3D(angle, axis) * transform;
758  }
759  sectioner = new G4DisplacedSolid
760  ("_displaced_sectioning_box", sectionBox, transform);
761  }
762  return sectioner;
763 }
Float_t d
Definition: G4Box.hh:64
G4VViewer * fpViewer
G4double GetExtentRadius() const
Definition: G4VisExtent.cc:73
const G4Plane3D & GetSectionPlane() const
static G4double angle[DIM]
static double normal(HepRandomEngine *eptr)
Definition: RandPoisson.cc:77
G4bool IsSection() const
const G4VisExtent & GetExtent() const
T c() const
Definition: Plane3D.h:83
const G4Point3D & GetExtentCentre() const
Definition: G4VisExtent.cc:63
T a() const
Definition: Plane3D.h:77
HepGeom::Rotate3D G4Rotate3D
const G4ViewParameters & GetViewParameters() const
double G4double
Definition: G4Types.hh:76
T b() const
Definition: Plane3D.h:80
T d() const
Definition: Plane3D.h:86
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:

◆ DrawEndOfRunModels()

void G4VSceneHandler::DrawEndOfRunModels ( )

Definition at line 657 of file G4VSceneHandler.cc.

658 {
659  const std::vector<G4Scene::Model>& EORModelList =
660  fpScene -> GetEndOfRunModelList ();
661  size_t nModels = EORModelList.size();
662  if (nModels) {
664  pMP->SetEvent(0);
665  for (size_t i = 0; i < nModels; i++) {
666  if (EORModelList[i].fActive) {
667  G4VModel* pModel = EORModelList[i].fpModel;
668  pModel -> SetModelingParameters(pMP);
669  SetModel (pModel);
670  pModel -> DescribeYourselfTo (*this);
671  pModel -> SetModelingParameters(0);
672  }
673  }
674  delete pMP;
675  SetModel (0);
676  }
677 }
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:

◆ DrawEvent()

void G4VSceneHandler::DrawEvent ( const G4Event event)

Definition at line 635 of file G4VSceneHandler.cc.

636 {
637  const std::vector<G4Scene::Model>& EOEModelList =
638  fpScene -> GetEndOfEventModelList ();
639  size_t nModels = EOEModelList.size();
640  if (nModels) {
642  pMP->SetEvent(event);
643  for (size_t i = 0; i < nModels; i++) {
644  if (EOEModelList[i].fActive) {
645  G4VModel* pModel = EOEModelList[i].fpModel;
646  pModel -> SetModelingParameters(pMP);
647  SetModel (pModel);
648  pModel -> DescribeYourselfTo (*this);
649  pModel -> SetModelingParameters(0);
650  }
651  }
652  delete pMP;
653  SetModel (0);
654  }
655 }
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:

◆ EndModeling()

void G4VSceneHandler::EndModeling ( )
virtual

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

Definition at line 207 of file G4VSceneHandler.cc.

208 {
209  fpModel = 0;
210 }
Here is the caller graph for this function:

◆ EndPrimitives()

void G4VSceneHandler::EndPrimitives ( )
virtual

Implements G4VGraphicsScene.

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

Definition at line 169 of file G4VSceneHandler.cc.

169  {
170  if (fNestingDepth <= 0)
171  G4Exception("G4VSceneHandler::EndPrimitives",
172  "visman0102", FatalException, "Nesting error.");
173  fNestingDepth--;
174  if (fReadyForTransients) {
177  }
178 }
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:

◆ EndPrimitives2D()

void G4VSceneHandler::EndPrimitives2D ( )
virtual

Implements G4VGraphicsScene.

Reimplemented in G4HepRepFileSceneHandler.

Definition at line 192 of file G4VSceneHandler.cc.

192  {
193  if (fNestingDepth <= 0)
194  G4Exception("G4VSceneHandler::EndPrimitives2D",
195  "visman0104", FatalException, "Nesting error.");
196  fNestingDepth--;
197  if (fReadyForTransients) {
200  }
201  fProcessing2D = false;
202 }
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:

◆ GetAuxEdgeVisible()

G4bool G4VSceneHandler::GetAuxEdgeVisible ( const G4VisAttributes pVisAttribs)

Definition at line 895 of file G4VSceneHandler.cc.

895  {
896  G4bool isAuxEdgeVisible = fpViewer->GetViewParameters().IsAuxEdgeVisible ();
897  if (pVisAttribs -> IsForceAuxEdgeVisible()) isAuxEdgeVisible = true;
898  return isAuxEdgeVisible;
899 }
G4VViewer * fpViewer
bool G4bool
Definition: G4Types.hh:79
G4bool IsAuxEdgeVisible() const
const G4ViewParameters & GetViewParameters() const
Here is the call graph for this function:

◆ GetColor()

const G4Colour& G4VSceneHandler::GetColor ( const G4Visible )
Here is the caller graph for this function:

◆ GetColour()

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

Definition at line 830 of file G4VSceneHandler.cc.

830  {
831  // Colour is determined by the applicable vis attributes.
832  const G4Colour& colour = fpViewer ->
833  GetApplicableVisAttributes (visible.GetVisAttributes ()) -> GetColour ();
834  return colour;
835 }
const G4VisAttributes * GetVisAttributes() const
G4VViewer * fpViewer
const G4Colour & GetColour(const G4Visible &)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCurrentViewer()

G4VViewer* G4VSceneHandler::GetCurrentViewer ( ) const
Here is the caller graph for this function:

◆ GetDrawingStyle()

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

Definition at line 856 of file G4VSceneHandler.cc.

856  {
857  // Drawing style is normally determined by the view parameters, but
858  // it can be overriddden by the ForceDrawingStyle flag in the vis
859  // attributes.
862  if (pVisAttribs -> IsForceDrawingStyle ()) {
864  pVisAttribs -> GetForcedDrawingStyle ();
865  // This is complicated because if hidden line and surface removal
866  // has been requested we wish to preserve this sometimes.
867  switch (forcedStyle) {
868  case (G4VisAttributes::solid):
869  switch (style) {
870  case (G4ViewParameters::hlr):
871  style = G4ViewParameters::hlhsr;
872  break;
874  style = G4ViewParameters::hsr;
875  break;
877  case (G4ViewParameters::hsr):
878  default:
879  break;
880  }
881  break;
883  default:
884  // But if forced style is wireframe, do it, because one of its
885  // main uses is in displaying the consituent solids of a Boolean
886  // solid and their surfaces overlap with the resulting Booean
887  // solid, making a mess if hlr is specified.
889  break;
890  }
891  }
892  return style;
893 }
DrawingStyle GetDrawingStyle() const
G4VViewer * fpViewer
const G4ViewParameters & GetViewParameters() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetExtent()

const G4VisExtent & G4VSceneHandler::GetExtent ( ) const
virtual

Reimplemented from G4VGraphicsScene.

Definition at line 131 of file G4VSceneHandler.cc.

132 {
133  if (fpScene) {
134  return fpScene->GetExtent();
135  } else {
137  }
138 }
static const G4VisExtent NullExtent
Definition: G4VisExtent.hh:80
const G4VisExtent & GetExtent() const
Here is the call graph for this function:

◆ GetGraphicsSystem()

G4VGraphicsSystem* G4VSceneHandler::GetGraphicsSystem ( ) const
Here is the caller graph for this function:

◆ GetLineWidth()

G4double G4VSceneHandler::GetLineWidth ( const G4VisAttributes pVisAttribs)

Definition at line 846 of file G4VSceneHandler.cc.

847 {
848  G4double lineWidth = pVisAttribs->GetLineWidth();
849  if (lineWidth < 1.) lineWidth = 1.;
850  lineWidth *= fpViewer -> GetViewParameters().GetGlobalLineWidthScale();
851  if (lineWidth < 1.) lineWidth = 1.;
852  return lineWidth;
853 }
G4VViewer * fpViewer
double G4double
Definition: G4Types.hh:76
G4double GetLineWidth() const
Here is the call graph for this function:

◆ GetMarkerDiameter()

G4double G4VSceneHandler::GetMarkerDiameter ( const G4VMarker ,
MarkerSizeType  
)

◆ GetMarkerRadius()

G4double G4VSceneHandler::GetMarkerRadius ( const G4VMarker ,
MarkerSizeType  
)
Here is the caller graph for this function:

◆ GetMarkerSize()

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

Definition at line 902 of file G4VSceneHandler.cc.

904 {
905  G4bool userSpecified = marker.GetWorldSize() || marker.GetScreenSize();
906  const G4VMarker& defaultMarker =
907  fpViewer -> GetViewParameters().GetDefaultMarker();
908  G4double size = userSpecified ?
909  marker.GetWorldSize() : defaultMarker.GetWorldSize();
910  if (size) {
911  // Draw in world coordinates.
912  markerSizeType = world;
913  }
914  else {
915  size = userSpecified ?
916  marker.GetScreenSize() : defaultMarker.GetScreenSize();
917  // Draw in screen coordinates.
918  markerSizeType = screen;
919  }
920  size *= fpViewer -> GetViewParameters().GetGlobalMarkerScale();
921  if (markerSizeType == screen && size < 1.) size = 1.;
922  return size;
923 }
G4VViewer * fpViewer
G4double GetWorldSize() const
bool G4bool
Definition: G4Types.hh:79
G4double GetScreenSize() const
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetMarkForClearingTransientStore()

G4bool G4VSceneHandler::GetMarkForClearingTransientStore ( ) const
Here is the caller graph for this function:

◆ GetModel()

G4VModel* G4VSceneHandler::GetModel ( ) const
Here is the caller graph for this function:

◆ GetName()

const G4String& G4VSceneHandler::GetName ( ) const
Here is the caller graph for this function:

◆ GetNoOfSides()

G4int G4VSceneHandler::GetNoOfSides ( const G4VisAttributes pVisAttribs)

Definition at line 925 of file G4VSceneHandler.cc.

926 {
927  // No. of sides (lines segments per circle) is normally determined
928  // by the view parameters, but it can be overriddden by the
929  // ForceLineSegmentsPerCircle in the vis attributes.
930  G4int lineSegmentsPerCircle = fpViewer->GetViewParameters().GetNoOfSides();
931  if (pVisAttribs) {
932  if (pVisAttribs->IsForceLineSegmentsPerCircle())
933  lineSegmentsPerCircle = pVisAttribs->GetForcedLineSegmentsPerCircle();
934  if (lineSegmentsPerCircle < pVisAttribs->GetMinLineSegmentsPerCircle()) {
935  lineSegmentsPerCircle = pVisAttribs->GetMinLineSegmentsPerCircle();
936  G4cout <<
937  "G4VSceneHandler::GetNoOfSides: attempt to set the"
938  "\nnumber of line segements per circle < " << lineSegmentsPerCircle
939  << "; forced to " << pVisAttribs->GetMinLineSegmentsPerCircle() << G4endl;
940  }
941  }
942  return lineSegmentsPerCircle;
943 }
G4VViewer * fpViewer
G4int GetNoOfSides() const
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
static G4int GetMinLineSegmentsPerCircle()
G4bool IsForceLineSegmentsPerCircle() const
const G4ViewParameters & GetViewParameters() const
#define G4endl
Definition: G4ios.hh:61
G4int GetForcedLineSegmentsPerCircle() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetObjectTransformation()

const G4Transform3D& G4VSceneHandler::GetObjectTransformation ( ) const
Here is the caller graph for this function:

◆ GetScene()

G4Scene* G4VSceneHandler::GetScene ( ) const
Here is the caller graph for this function:

◆ GetSceneHandlerId()

G4int G4VSceneHandler::GetSceneHandlerId ( ) const

◆ GetTextColor()

const G4Colour& G4VSceneHandler::GetTextColor ( const G4Text )

◆ GetTextColour()

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

Definition at line 837 of file G4VSceneHandler.cc.

837  {
838  const G4VisAttributes* pVA = text.GetVisAttributes ();
839  if (!pVA) {
840  pVA = fpViewer -> GetViewParameters (). GetDefaultTextVisAttributes ();
841  }
842  const G4Colour& colour = pVA -> GetColour ();
843  return colour;
844 }
const G4VisAttributes * GetVisAttributes() const
G4VViewer * fpViewer
const G4Colour & GetColour(const G4Visible &)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTransientsDrawnThisEvent()

G4bool G4VSceneHandler::GetTransientsDrawnThisEvent ( ) const
Here is the caller graph for this function:

◆ GetTransientsDrawnThisRun()

G4bool G4VSceneHandler::GetTransientsDrawnThisRun ( ) const
Here is the caller graph for this function:

◆ 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 770 of file G4VSceneHandler.cc.

771 {
772  // Load G4Atts from G4VisAttributes, if any...
773  const G4VisAttributes* va = visible.GetVisAttributes();
774  if (va) {
775  const std::map<G4String,G4AttDef>* vaDefs =
776  va->GetAttDefs();
777  if (vaDefs) {
778  holder->AddAtts(visible.GetVisAttributes()->CreateAttValues(), vaDefs);
779  }
780  }
781 
782  G4PhysicalVolumeModel* pPVModel =
783  dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
784  if (pPVModel) {
785  // Load G4Atts from G4PhysicalVolumeModel...
786  const std::map<G4String,G4AttDef>* pvDefs = pPVModel->GetAttDefs();
787  if (pvDefs) {
788  holder->AddAtts(pPVModel->CreateCurrentAttValues(), pvDefs);
789  }
790  }
791 
792  G4TrajectoriesModel* trajModel = dynamic_cast<G4TrajectoriesModel*>(fpModel);
793  if (trajModel) {
794  // Load G4Atts from trajectory model...
795  const std::map<G4String,G4AttDef>* trajModelDefs = trajModel->GetAttDefs();
796  if (trajModelDefs) {
797  holder->AddAtts(trajModel->CreateCurrentAttValues(), trajModelDefs);
798  }
799  // Load G4Atts from trajectory...
800  const G4VTrajectory* traj = trajModel->GetCurrentTrajectory();
801  if (traj) {
802  const std::map<G4String,G4AttDef>* trajDefs = traj->GetAttDefs();
803  if (trajDefs) {
804  holder->AddAtts(traj->CreateAttValues(), trajDefs);
805  }
806  G4int nPoints = traj->GetPointEntries();
807  for (G4int i = 0; i < nPoints; ++i) {
808  G4VTrajectoryPoint* trajPoint = traj->GetPoint(i);
809  if (trajPoint) {
810  const std::map<G4String,G4AttDef>* pointDefs = trajPoint->GetAttDefs();
811  if (pointDefs) {
812  holder->AddAtts(trajPoint->CreateAttValues(), pointDefs);
813  }
814  }
815  }
816  }
817  }
818 
819  G4HitsModel* hitsModel = dynamic_cast<G4HitsModel*>(fpModel);
820  if (hitsModel) {
821  // Load G4Atts from hit...
822  const G4VHit* hit = hitsModel->GetCurrentHit();
823  const std::map<G4String,G4AttDef>* hitsDefs = hit->GetAttDefs();
824  if (hitsDefs) {
825  holder->AddAtts(hit->CreateAttValues(), hitsDefs);
826  }
827  }
828 }
const G4VHit * GetCurrentHit() const
Definition: G4HitsModel.hh:58
const G4VisAttributes * GetVisAttributes() const
void AddAtts(const std::vector< G4AttValue > *values, const std::map< G4String, G4AttDef > *defs)
Definition: G4AttHolder.hh:65
std::vector< G4AttValue > * CreateCurrentAttValues() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
Definition: G4VHit.hh:60
virtual G4VTrajectoryPoint * GetPoint(G4int i) const =0
const std::map< G4String, G4AttDef > * GetAttDefs() const
std::vector< G4AttValue > * CreateCurrentAttValues() const
Definition: G4VHit.hh:48
int G4int
Definition: G4Types.hh:78
virtual std::vector< G4AttValue > * CreateAttValues() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual int GetPointEntries() const =0
virtual std::vector< G4AttValue > * CreateAttValues() const
const std::vector< G4AttValue > * CreateAttValues() const
virtual std::vector< G4AttValue > * CreateAttValues() const
Definition: G4VHit.hh:67
const G4VTrajectory * GetCurrentTrajectory() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
Here is the call graph for this function:

◆ operator=()

G4VSceneHandler& G4VSceneHandler::operator= ( const G4VSceneHandler )
private

◆ PostAddSolid()

void G4VSceneHandler::PostAddSolid ( )
virtual

Implements G4VGraphicsScene.

Reimplemented in G4XXXSGSceneHandler, G4HepRepSceneHandler, G4XXXStoredSceneHandler, and G4VTreeSceneHandler.

Definition at line 147 of file G4VSceneHandler.cc.

147  {
148  fpVisAttribs = 0;
149  fProcessingSolid = false;
150  if (fReadyForTransients) {
153  }
154 }
const G4VisAttributes * fpVisAttribs
G4bool fTransientsDrawnThisEvent
G4bool fTransientsDrawnThisRun
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PreAddSolid()

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

Implements G4VGraphicsScene.

Reimplemented in G4XXXSGSceneHandler, G4HepRepSceneHandler, G4XXXStoredSceneHandler, and G4VTreeSceneHandler.

Definition at line 140 of file G4VSceneHandler.cc.

141  {
142  fObjectTransformation = objectTransformation;
143  fpVisAttribs = &visAttribs;
144  fProcessingSolid = true;
145 }
G4Transform3D fObjectTransformation
const G4VisAttributes * fpVisAttribs
Here is the caller graph for this function:

◆ ProcessScene()

void G4VSceneHandler::ProcessScene ( )
protectedvirtual

Definition at line 511 of file G4VSceneHandler.cc.

511  {
512 
513  // Assumes graphics database store has already been cleared if
514  // relevant for the particular scene handler.
515 
516  if (!fpScene) return;
517 
518  G4VisManager* visManager = G4VisManager::GetInstance();
519 
520  if (!visManager->GetConcreteInstance()) return;
521 
522  G4VisManager::Verbosity verbosity = visManager->GetVerbosity();
523 
524  fReadyForTransients = false;
525 
526  // Reset fMarkForClearingTransientStore. (Leaving
527  // fMarkForClearingTransientStore true causes problems with
528  // recomputing transients below.) Restore it again at end...
529  G4bool tmpMarkForClearingTransientStore = fMarkForClearingTransientStore;
531 
532  // Traverse geometry tree and send drawing primitives to window(s).
533 
534  const std::vector<G4Scene::Model>& runDurationModelList =
535  fpScene -> GetRunDurationModelList ();
536 
537  if (runDurationModelList.size ()) {
538  if (verbosity >= G4VisManager::confirmations) {
539  G4cout << "Traversing scene data..." << G4endl;
540  }
541 
542  BeginModeling ();
543 
544  // Create modeling parameters from view parameters...
546 
547  for (size_t i = 0; i < runDurationModelList.size (); i++) {
548  if (runDurationModelList[i].fActive) {
549  G4VModel* pModel = runDurationModelList[i].fpModel;
550  // Note: this is not the place to take action on
551  // pModel->GetTransformation(). The model must take care of
552  // this in pModel->DescribeYourselfTo(*this). See, for example,
553  // G4PhysicalVolumeModel and /vis/scene/add/logo.
554  pModel -> SetModelingParameters (pMP);
555  SetModel (pModel); // Store for use by derived class.
556  pModel -> DescribeYourselfTo (*this);
557  pModel -> SetModelingParameters (0);
558  }
559  }
560 
561  delete pMP;
562  EndModeling ();
563  }
564 
565  fReadyForTransients = true;
566 
567  // Refresh event from end-of-event model list.
568  // Allow only in Idle or GeomClosed state...
570  G4ApplicationState state = stateManager->GetCurrentState();
571  if (state == G4State_Idle || state == G4State_GeomClosed) {
572 
573  visManager->SetEventRefreshing(true);
574 
575  if (visManager->GetRequestedEvent()) {
576  DrawEvent(visManager->GetRequestedEvent());
577 
578  } else {
579 
581 #ifdef G4MULTITHREADED
583  { runManager = G4MTRunManager::GetMasterRunManager(); }
584 #endif
585  if (runManager) {
586  const G4Run* run = runManager->GetCurrentRun();
587  const std::vector<const G4Event*>* events =
588  run? run->GetEventVector(): 0;
589  size_t nKeptEvents = 0;
590  if (events) nKeptEvents = events->size();
591  if (nKeptEvents) {
592 
594 
595  if (verbosity >= G4VisManager::confirmations) {
596  G4cout << "Refreshing event..." << G4endl;
597  }
598  const G4Event* event = 0;
599  if (events && events->size()) event = events->back();
600  if (event) DrawEvent(event);
601 
602  } else { // Accumulating events.
603 
604  if (verbosity >= G4VisManager::confirmations) {
605  G4cout << "Refreshing events in run..." << G4endl;
606  }
607  for (auto&& event: *events) {
608  if (event) DrawEvent(event);
609  }
610 
611  if (!fpScene->GetRefreshAtEndOfRun()) {
612  if (verbosity >= G4VisManager::warnings) {
613  G4cout <<
614  "WARNING: Cannot refresh events accumulated over more"
615  "\n than one runs. Refreshed just the last run."
616  << G4endl;
617  }
618  }
619  }
620  }
621  }
622  }
623  visManager->SetEventRefreshing(false);
624  }
625 
626  // Refresh end-of-run model list.
627  // Allow only in Idle or GeomClosed state...
628  if (state == G4State_Idle || state == G4State_GeomClosed) {
630  }
631 
632  fMarkForClearingTransientStore = tmpMarkForClearingTransientStore;
633 }
virtual void BeginModeling()
G4ModelingParameters * CreateModelingParameters()
static G4VVisManager * GetConcreteInstance()
void SetEventRefreshing(G4bool)
const G4Event * GetRequestedEvent() const
G4bool GetRefreshAtEndOfEvent() const
static G4StateManager * GetStateManager()
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
static G4MTRunManager * GetMasterRunManager()
static G4VisManager * GetInstance()
Definition: G4Run.hh:46
virtual void EndModeling()
const G4Run * GetCurrentRun() const
G4bool IsMultithreadedApplication()
Definition: G4Threading.cc:142
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
G4bool GetRefreshAtEndOfRun() const
G4bool fMarkForClearingTransientStore
void DrawEvent(const G4Event *)
static Verbosity GetVerbosity()
#define G4endl
Definition: G4ios.hh:61
void SetModel(G4VModel *)
G4ApplicationState GetCurrentState() const
G4ApplicationState
const std::vector< const G4Event * > * GetEventVector() const
Definition: G4Run.hh:115
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RemoveViewerFromList()

void G4VSceneHandler::RemoveViewerFromList ( G4VViewer pView)

Definition at line 476 of file G4VSceneHandler.cc.

476  {
477  fViewerList.remove(pViewer);
478 }
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:

◆ RequestPrimitives()

void G4VSceneHandler::RequestPrimitives ( const G4VSolid solid)
protectedvirtual

Reimplemented in G4ASCIITreeSceneHandler.

Definition at line 489 of file G4VSceneHandler.cc.

489  {
492  G4Polyhedron* pPolyhedron = solid.GetPolyhedron ();
494  if (pPolyhedron) {
495  pPolyhedron -> SetVisAttributes (fpVisAttribs);
496  AddPrimitive (*pPolyhedron);
497  }
498  else {
500  if (verbosity >= G4VisManager::errors) {
501  G4cerr <<
502  "ERROR: G4VSceneHandler::RequestPrimitives"
503  "\n Polyhedron not available for " << solid.GetName () <<
504  ".\n This means it cannot be visualized on most systems."
505  "\n Contact the Visualization Coordinator." << G4endl;
506  }
507  }
508  EndPrimitives ();
509 }
virtual void BeginPrimitives(const G4Transform3D &objectTransformation)
G4Transform3D fObjectTransformation
G4int GetNoOfSides(const G4VisAttributes *)
virtual void AddPrimitive(const G4Polyline &)=0
G4String GetName() const
virtual G4Polyhedron * GetPolyhedron() const
Definition: G4VSolid.cc:644
virtual void EndPrimitives()
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:
Here is the caller graph for this function:

◆ SetCurrentViewer()

void G4VSceneHandler::SetCurrentViewer ( G4VViewer )

◆ SetMarkForClearingTransientStore()

void G4VSceneHandler::SetMarkForClearingTransientStore ( G4bool  )
Here is the caller graph for this function:

◆ SetModel()

void G4VSceneHandler::SetModel ( G4VModel )
Here is the caller graph for this function:

◆ SetName()

void G4VSceneHandler::SetName ( const G4String )

◆ SetObjectTransformation()

void G4VSceneHandler::SetObjectTransformation ( const G4Transform3D )

◆ SetScene()

void G4VSceneHandler::SetScene ( G4Scene pScene)
virtual

Definition at line 480 of file G4VSceneHandler.cc.

480  {
481  fpScene = pScene;
482  // Notify all viewers that a kernel visit is required.
484  for (i = fViewerList.begin(); i != fViewerList.end(); i++) {
485  (*i) -> SetNeedKernelVisit (true);
486  }
487 }
G4ViewerList fViewerList
std::vector< G4VViewer * >::iterator G4ViewerListIterator
Definition: G4ViewerList.hh:43

◆ SetTransientsDrawnThisEvent()

void G4VSceneHandler::SetTransientsDrawnThisEvent ( G4bool  )
Here is the caller graph for this function:

◆ SetTransientsDrawnThisRun()

void G4VSceneHandler::SetTransientsDrawnThisRun ( G4bool  )
Here is the caller graph for this function:

◆ 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 945 of file G4VSceneHandler.cc.

945  {
946 
947  os << "Scene handler " << sh.fName << " has "
948  << sh.fViewerList.size () << " viewer(s):";
949  for (size_t i = 0; i < sh.fViewerList.size (); i++) {
950  os << "\n " << *(sh.fViewerList [i]);
951  }
952 
953  if (sh.fpScene) {
954  os << "\n " << *sh.fpScene;
955  }
956  else {
957  os << "\n This scene handler currently has no scene.";
958  }
959 
960  return os;
961 }

Member Data Documentation

◆ fIdentityTransformation

const G4Transform3D G4VSceneHandler::fIdentityTransformation
protected

Definition at line 346 of file G4VSceneHandler.hh.

◆ fMarkForClearingTransientStore

G4bool G4VSceneHandler::fMarkForClearingTransientStore
protected

Definition at line 334 of file G4VSceneHandler.hh.

◆ fName

G4String G4VSceneHandler::fName
protected

Definition at line 329 of file G4VSceneHandler.hh.

◆ fNestingDepth

G4int G4VSceneHandler::fNestingDepth
protected

Definition at line 344 of file G4VSceneHandler.hh.

◆ fObjectTransformation

G4Transform3D G4VSceneHandler::fObjectTransformation
protected

Definition at line 342 of file G4VSceneHandler.hh.

◆ fpModel

G4VModel* G4VSceneHandler::fpModel
protected

Definition at line 341 of file G4VSceneHandler.hh.

◆ fProcessing2D

G4bool G4VSceneHandler::fProcessing2D
protected

Definition at line 340 of file G4VSceneHandler.hh.

◆ fProcessingSolid

G4bool G4VSceneHandler::fProcessingSolid
protected

Definition at line 339 of file G4VSceneHandler.hh.

◆ fpScene

G4Scene* G4VSceneHandler::fpScene
protected

Definition at line 333 of file G4VSceneHandler.hh.

◆ fpViewer

G4VViewer* G4VSceneHandler::fpViewer
protected

Definition at line 332 of file G4VSceneHandler.hh.

◆ fpVisAttribs

const G4VisAttributes* G4VSceneHandler::fpVisAttribs
protected

Definition at line 345 of file G4VSceneHandler.hh.

◆ fReadyForTransients

G4bool G4VSceneHandler::fReadyForTransients
protected

Definition at line 335 of file G4VSceneHandler.hh.

◆ fSceneHandlerId

const G4int G4VSceneHandler::fSceneHandlerId
protected

Definition at line 328 of file G4VSceneHandler.hh.

◆ fSystem

G4VGraphicsSystem& G4VSceneHandler::fSystem
protected

Definition at line 327 of file G4VSceneHandler.hh.

◆ fTransientsDrawnThisEvent

G4bool G4VSceneHandler::fTransientsDrawnThisEvent
protected

Definition at line 337 of file G4VSceneHandler.hh.

◆ fTransientsDrawnThisRun

G4bool G4VSceneHandler::fTransientsDrawnThisRun
protected

Definition at line 338 of file G4VSceneHandler.hh.

◆ fViewCount

G4int G4VSceneHandler::fViewCount
protected

Definition at line 330 of file G4VSceneHandler.hh.

◆ fViewerList

G4ViewerList G4VSceneHandler::fViewerList
protected

Definition at line 331 of file G4VSceneHandler.hh.


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