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

#include <G4VSceneHandler.hh>

+ Inheritance diagram for G4VSceneHandler:

Public Types

enum  MarkerSizeType { world , screen }
 

Public Member Functions

 G4VSceneHandler (G4VGraphicsSystem &system, G4int id, const G4String &name="")
 
virtual ~G4VSceneHandler ()
 
virtual void PreAddSolid (const G4Transform3D &objectTransformation, const G4VisAttributes &)
 
virtual void PostAddSolid ()
 
virtual void AddSolid (const G4Box &)
 
virtual void AddSolid (const G4Cons &)
 
virtual void AddSolid (const 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 void AddPrimitive (const G4NURBS &)=0
 
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 ()
 
virtual void PreAddSolid (const G4Transform3D &objectTransformation, const G4VisAttributes &visAttribs)=0
 
virtual void PostAddSolid ()=0
 
virtual void AddSolid (const G4Box &)=0
 
virtual void AddSolid (const G4Cons &)=0
 
virtual void AddSolid (const G4Tubs &)=0
 
virtual void AddSolid (const G4Trd &)=0
 
virtual void AddSolid (const G4Trap &)=0
 
virtual void AddSolid (const G4Sphere &)=0
 
virtual void AddSolid (const G4Para &)=0
 
virtual void AddSolid (const G4Torus &)=0
 
virtual void AddSolid (const G4Polycone &)=0
 
virtual void AddSolid (const G4Polyhedra &)=0
 
virtual void AddSolid (const G4VSolid &)=0
 
virtual void AddCompound (const G4VTrajectory &)=0
 
virtual void AddCompound (const G4VHit &)=0
 
virtual void AddCompound (const G4VDigi &)=0
 
virtual void AddCompound (const G4THitsMap< G4double > &)=0
 
virtual void BeginPrimitives (const G4Transform3D &objectTransformation=G4Transform3D())=0
 
virtual void EndPrimitives ()=0
 
virtual void BeginPrimitives2D (const G4Transform3D &objectTransformation=G4Transform3D())=0
 
virtual void EndPrimitives2D ()=0
 
virtual void AddPrimitive (const G4Polyline &)=0
 
virtual void AddPrimitive (const G4Scale &)=0
 
virtual void AddPrimitive (const G4Text &)=0
 
virtual void AddPrimitive (const G4Circle &)=0
 
virtual void AddPrimitive (const G4Square &)=0
 
virtual void AddPrimitive (const G4Polymarker &)=0
 
virtual void AddPrimitive (const G4Polyhedron &)=0
 
virtual void AddPrimitive (const G4NURBS &)=0
 

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

◆ MarkerSizeType

Enumerator
world 
screen 

Definition at line 68 of file G4VSceneHandler.hh.

Constructor & Destructor Documentation

◆ G4VSceneHandler()

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

Definition at line 88 of file G4VSceneHandler.cc.

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

◆ ~G4VSceneHandler()

G4VSceneHandler::~G4VSceneHandler ( )
virtual

Definition at line 119 of file G4VSceneHandler.cc.

119 {
120 G4VViewer* last;
121 while( ! fViewerList.empty() ) {
122 last = fViewerList.back();
123 fViewerList.pop_back();
124 delete last;
125 }
126}
G4ViewerList fViewerList

Member Function Documentation

◆ AddCompound() [1/4]

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

Implements G4VGraphicsScene.

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

Definition at line 284 of file G4VSceneHandler.cc.

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

◆ AddCompound() [2/4]

void G4VSceneHandler::AddCompound ( const G4VDigi digi)
virtual

Implements G4VGraphicsScene.

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

Definition at line 279 of file G4VSceneHandler.cc.

279 {
280 // Cast away const because Draw is non-const!!!!
281 const_cast<G4VDigi&>(digi).Draw();
282}

◆ AddCompound() [3/4]

void G4VSceneHandler::AddCompound ( const G4VHit hit)
virtual

Implements G4VGraphicsScene.

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

Definition at line 274 of file G4VSceneHandler.cc.

274 {
275 // Cast away const because Draw is non-const!!!!
276 const_cast<G4VHit&>(hit).Draw();
277}
Definition: G4VHit.hh:49

◆ AddCompound() [4/4]

void G4VSceneHandler::AddCompound ( const G4VTrajectory traj)
virtual

Implements G4VGraphicsScene.

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

Definition at line 259 of file G4VSceneHandler.cc.

259 {
260 G4TrajectoriesModel* trajectoriesModel =
261 dynamic_cast<G4TrajectoriesModel*>(fpModel);
262 if (!trajectoriesModel) G4Exception
263 ("G4VSceneHandler::AddCompound(const G4VTrajectory&)",
264 "visman0105", FatalException, "Not a G4TrajectoriesModel.");
265 else {
266 if (trajectoriesModel->IsDrawingModeSet()) {
267 traj.DrawTrajectory(trajectoriesModel->GetDrawingMode());
268 } else {
269 traj.DrawTrajectory();
270 }
271 }
272}
@ FatalException
G4bool IsDrawingModeSet() const
virtual void DrawTrajectory(G4int i_mode=0) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

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

◆ AddPrimitive() [1/8]

◆ AddPrimitive() [2/8]

◆ AddPrimitive() [3/8]

◆ AddPrimitive() [4/8]

◆ AddPrimitive() [5/8]

void G4VSceneHandler::AddPrimitive ( const G4Polymarker polymarker)
virtual

Implements G4VGraphicsScene.

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

Definition at line 432 of file G4VSceneHandler.cc.

432 {
433 switch (polymarker.GetMarkerType()) {
434 default:
436 {
437 for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
438 G4Circle dot (polymarker);
439 dot.SetPosition (polymarker[iPoint]);
440 dot.SetWorldSize (0.);
441 dot.SetScreenSize (0.1); // Very small circle.
442 AddPrimitive (dot);
443 }
444 }
445 break;
447 {
448 for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
449 G4Circle circle (polymarker);
450 circle.SetPosition (polymarker[iPoint]);
451 AddPrimitive (circle);
452 }
453 }
454 break;
456 {
457 for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
458 G4Square square (polymarker);
459 square.SetPosition (polymarker[iPoint]);
460 AddPrimitive (square);
461 }
462 }
463 break;
464 }
465}
MarkerType GetMarkerType() const
virtual void AddPrimitive(const G4Polyline &)=0

◆ AddPrimitive() [6/8]

void G4VSceneHandler::AddPrimitive ( const G4Scale scale)
virtual

Implements G4VGraphicsScene.

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

Definition at line 330 of file G4VSceneHandler.cc.

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

◆ AddPrimitive() [7/8]

◆ AddPrimitive() [8/8]

◆ AddSolid() [1/11]

void G4VSceneHandler::AddSolid ( const G4Box box)
virtual

Implements G4VGraphicsScene.

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

Definition at line 204 of file G4VSceneHandler.cc.

204 {
205 RequestPrimitives (box);
206// If your graphics system is sophisticated enough to handle a
207// particular solid shape as a primitive, in your derived class write a
208// function to override this. (Note: some compilers warn that your
209// function "hides" this one. That's OK.)
210// Your function might look like this...
211// void G4MyScene::AddSolid (const G4Box& box) {
212// Get parameters of appropriate object, e.g.:
213// G4double dx = box.GetXHalfLength ();
214// G4double dy = box.GetYHalfLength ();
215// G4double dz = box.GetZHalfLength ();
216// and Draw or Store in your display List.
217}
virtual void RequestPrimitives(const G4VSolid &solid)

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

◆ AddSolid() [2/11]

◆ AddSolid() [3/11]

◆ AddSolid() [4/11]

◆ AddSolid() [5/11]

◆ AddSolid() [6/11]

◆ AddSolid() [7/11]

◆ AddSolid() [8/11]

◆ AddSolid() [9/11]

◆ AddSolid() [10/11]

◆ AddSolid() [11/11]

◆ AddViewerToList()

void G4VSceneHandler::AddViewerToList ( G4VViewer pView)

Definition at line 326 of file G4VSceneHandler.cc.

326 {
327 fViewerList.push_back (pViewer);
328}

◆ BeginModeling()

◆ BeginPrimitives()

void G4VSceneHandler::BeginPrimitives ( const G4Transform3D objectTransformation)
virtual

Implements G4VGraphicsScene.

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

Definition at line 144 of file G4VSceneHandler.cc.

145 {
146 //static G4int count = 0;
147 //G4cout << "G4VSceneHandler::BeginPrimitives: " << count++ << G4endl;
149 if (fNestingDepth > 1)
151 ("G4VSceneHandler::BeginPrimitives",
152 "visman0101", FatalException,
153 "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
154 fObjectTransformation = objectTransformation;
155}
G4Transform3D fObjectTransformation

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

◆ BeginPrimitives2D()

void G4VSceneHandler::BeginPrimitives2D ( const G4Transform3D objectTransformation)
virtual

Implements G4VGraphicsScene.

Reimplemented in G4HepRepFileSceneHandler.

Definition at line 168 of file G4VSceneHandler.cc.

169 {
171 if (fNestingDepth > 1)
173 ("G4VSceneHandler::BeginPrimitives2D",
174 "visman0103", FatalException,
175 "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
176 fObjectTransformation = objectTransformation;
177 fProcessing2D = true;
178}

Referenced by G4HepRepFileSceneHandler::BeginPrimitives2D().

◆ ClearStore()

void G4VSceneHandler::ClearStore ( )
virtual

Reimplemented in G4XXXSGSceneHandler, and G4XXXStoredSceneHandler.

Definition at line 200 of file G4VSceneHandler.cc.

200{}

Referenced by G4VViewer::ProcessView().

◆ ClearTransientStore()

◆ CreateCutawaySolid()

G4VSolid * G4VSceneHandler::CreateCutawaySolid ( )
protectedvirtual

Definition at line 786 of file G4VSceneHandler.cc.

787{
788 return 0;
789}

Referenced by CreateModelingParameters().

◆ CreateModelingParameters()

G4ModelingParameters * G4VSceneHandler::CreateModelingParameters ( )

Definition at line 702 of file G4VSceneHandler.cc.

703{
704 // Create modeling parameters from View Parameters...
705 const G4ViewParameters& vp = fpViewer -> GetViewParameters ();
706
707 // Convert drawing styles...
708 G4ModelingParameters::DrawingStyle modelDrawingStyle =
710 switch (vp.GetDrawingStyle ()) {
711 default:
713 modelDrawingStyle = G4ModelingParameters::wf;
714 break;
716 modelDrawingStyle = G4ModelingParameters::hlr;
717 break;
719 modelDrawingStyle = G4ModelingParameters::hsr;
720 break;
722 modelDrawingStyle = G4ModelingParameters::hlhsr;
723 break;
724 }
725
726 // Decide if covered daughters are really to be culled...
727 G4bool reallyCullCovered =
728 vp.IsCullingCovered() // Culling daughters depends also on...
729 && !vp.IsSection () // Sections (DCUT) not requested.
730 && !vp.IsCutaway () // Cutaways not requested.
731 ;
732
733 G4ModelingParameters* pModelingParams = new G4ModelingParameters
735 modelDrawingStyle,
736 vp.IsCulling (),
737 vp.IsCullingInvisible (),
738 vp.IsDensityCulling (),
739 vp.GetVisibleDensity (),
740 reallyCullCovered,
741 vp.GetNoOfSides ()
742 );
743
744 pModelingParams->SetWarning
746
747 pModelingParams->SetExplodeFactor(vp.GetExplodeFactor());
748 pModelingParams->SetExplodeCentre(vp.GetExplodeCentre());
749
750 pModelingParams->SetSectionSolid(CreateSectionSolid());
751 pModelingParams->SetCutawaySolid(CreateCutawaySolid());
752 // The polyhedron objects are deleted in the modeling parameters destructor.
753
755
756 return pModelingParams;
757}
void SetVisAttributesModifiers(const std::vector< VisAttributesModifier >)
void SetCutawaySolid(G4VSolid *pCutawaySolid)
void SetSectionSolid(G4VSolid *pSectionSolid)
void SetWarning(G4bool)
void SetExplodeFactor(G4double explodeFactor)
void SetExplodeCentre(const G4Point3D &explodeCentre)
virtual G4VSolid * CreateSectionSolid()
virtual G4VSolid * CreateCutawaySolid()
const std::vector< G4ModelingParameters::VisAttributesModifier > & GetVisAttributesModifiers() const
G4int GetNoOfSides() const
G4double GetExplodeFactor() const
G4bool IsCutaway() const
G4bool IsSection() const
G4bool IsCulling() const
G4bool IsCullingInvisible() const
const G4VisAttributes * GetDefaultVisAttributes() const
G4bool IsDensityCulling() const
G4double GetVisibleDensity() const
const G4Point3D & GetExplodeCentre() const
G4bool IsCullingCovered() const
DrawingStyle GetDrawingStyle() const
static Verbosity GetVerbosity()

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

◆ CreateSectionSolid()

G4VSolid * G4VSceneHandler::CreateSectionSolid ( )
protectedvirtual

Definition at line 759 of file G4VSceneHandler.cc.

760{
761 G4VSolid* sectioner = 0;
763 if (vp.IsSection () ) {
765 G4double safe = radius + fpScene->GetExtent().GetExtentCentre().mag();
766 G4VSolid* sectionBox =
767 new G4Box("_sectioner", safe, safe, 1.e-5 * radius); // Thin in z-plane.
768 const G4Plane3D& sp = vp.GetSectionPlane ();
769 G4double a = sp.a();
770 G4double b = sp.b();
771 G4double c = sp.c();
772 G4double d = sp.d();
773 G4Transform3D transform = G4TranslateZ3D(-d);
774 const G4Normal3D normal(a,b,c);
775 if (normal != G4Normal3D(0,0,1)) {
776 const G4double angle = std::acos(normal.dot(G4Normal3D(0,0,1)));
777 const G4Vector3D axis = G4Normal3D(0,0,1).cross(normal);
778 transform = G4Rotate3D(angle, axis) * transform;
779 }
780 sectioner = new G4DisplacedSolid
781 ("_displaced_sectioning_box", sectionBox, transform);
782 }
783 return sectioner;
784}
HepGeom::Normal3D< G4double > G4Normal3D
Definition: G4Normal3D.hh:35
HepGeom::Rotate3D G4Rotate3D
HepGeom::TranslateZ3D G4TranslateZ3D
Definition: G4Box.hh:55
const G4ViewParameters & GetViewParameters() const
const G4Plane3D & GetSectionPlane() const
G4double GetExtentRadius() const
Definition: G4VisExtent.cc:73
const G4Point3D & GetExtentCentre() const
Definition: G4VisExtent.cc:63

Referenced by CreateModelingParameters().

◆ DrawEndOfRunModels()

void G4VSceneHandler::DrawEndOfRunModels ( )

Definition at line 680 of file G4VSceneHandler.cc.

681{
682 const std::vector<G4Scene::Model>& EORModelList =
683 fpScene -> GetEndOfRunModelList ();
684 size_t nModels = EORModelList.size();
685 if (nModels) {
687 pMP->SetEvent(0);
688 for (size_t i = 0; i < nModels; i++) {
689 if (EORModelList[i].fActive) {
690 G4VModel* pModel = EORModelList[i].fpModel;
691 pModel -> SetModelingParameters(pMP);
692 SetModel (pModel);
693 pModel -> DescribeYourselfTo (*this);
694 pModel -> SetModelingParameters(0);
695 }
696 }
697 delete pMP;
698 SetModel (0);
699 }
700}
void SetEvent(const G4Event *pEvent)
G4ModelingParameters * CreateModelingParameters()
void SetModel(G4VModel *)

Referenced by ProcessScene().

◆ DrawEvent()

void G4VSceneHandler::DrawEvent ( const G4Event event)

Definition at line 658 of file G4VSceneHandler.cc.

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

Referenced by ProcessScene().

◆ EndModeling()

◆ EndPrimitives()

◆ EndPrimitives2D()

void G4VSceneHandler::EndPrimitives2D ( )
virtual

Implements G4VGraphicsScene.

Reimplemented in G4HepRepFileSceneHandler.

Definition at line 180 of file G4VSceneHandler.cc.

180 {
181 if (fNestingDepth <= 0)
182 G4Exception("G4VSceneHandler::EndPrimitives2D",
183 "visman0104", FatalException, "Nesting error.");
188 }
189 fProcessing2D = false;
190}

Referenced by G4HepRepFileSceneHandler::EndPrimitives2D().

◆ GetAuxEdgeVisible()

G4bool G4VSceneHandler::GetAuxEdgeVisible ( const G4VisAttributes pVisAttribs)

Definition at line 912 of file G4VSceneHandler.cc.

912 {
913 G4bool isAuxEdgeVisible = fpViewer->GetViewParameters().IsAuxEdgeVisible ();
914 if (pVisAttribs -> IsForceAuxEdgeVisible()) isAuxEdgeVisible = true;
915 return isAuxEdgeVisible;
916}
G4bool IsAuxEdgeVisible() const

◆ GetColor()

const G4Colour & G4VSceneHandler::GetColor ( const G4Visible )

◆ GetColour()

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

Definition at line 847 of file G4VSceneHandler.cc.

847 {
848 // Colour is determined by the applicable vis attributes.
849 const G4Colour& colour = fpViewer ->
850 GetApplicableVisAttributes (visible.GetVisAttributes ()) -> GetColour ();
851 return colour;
852}
const G4Colour & GetColour(const G4Visible &)

Referenced by GetColour(), and GetTextColour().

◆ GetCurrentViewer()

G4VViewer * G4VSceneHandler::GetCurrentViewer ( ) const

◆ GetDrawingStyle()

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

Definition at line 872 of file G4VSceneHandler.cc.

873 {
874 // Drawing style is normally determined by the view parameters, but
875 // it can be overriddden by the ForceDrawingStyle flag in the vis
876 // attributes.
879 if (pVisAttribs -> IsForceDrawingStyle ()) {
881 pVisAttribs -> GetForcedDrawingStyle ();
882 // This is complicated because if hidden line and surface removal
883 // has been requested we wish to preserve this sometimes.
884 switch (forcedStyle) {
886 switch (style) {
889 break;
891 style = G4ViewParameters::hsr;
892 break;
895 default:
896 break;
897 }
898 break;
900 default:
901 // But if forced style is wireframe, do it, because one of its
902 // main uses is in displaying the consituent solids of a Boolean
903 // solid and their surfaces overlap with the resulting Booean
904 // solid, making a mess if hlr is specified.
906 break;
907 }
908 }
909 return style;
910}

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

◆ GetGraphicsSystem()

◆ GetLineWidth()

G4double G4VSceneHandler::GetLineWidth ( const G4VisAttributes pVisAttribs)

Definition at line 863 of file G4VSceneHandler.cc.

864{
865 G4double lineWidth = pVisAttribs->GetLineWidth();
866 if (lineWidth < 1.) lineWidth = 1.;
867 lineWidth *= fpViewer -> GetViewParameters().GetGlobalLineWidthScale();
868 if (lineWidth < 1.) lineWidth = 1.;
869 return lineWidth;
870}
G4double GetLineWidth() const

◆ GetMarkerDiameter()

G4double G4VSceneHandler::GetMarkerDiameter ( const G4VMarker ,
MarkerSizeType  
)

◆ GetMarkerRadius()

G4double G4VSceneHandler::GetMarkerRadius ( const G4VMarker ,
MarkerSizeType  
)

◆ GetMarkerSize()

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

Definition at line 918 of file G4VSceneHandler.cc.

921{
922 G4bool userSpecified = marker.GetWorldSize() || marker.GetScreenSize();
923 const G4VMarker& defaultMarker =
924 fpViewer -> GetViewParameters().GetDefaultMarker();
925 G4double size = userSpecified ?
926 marker.GetWorldSize() : defaultMarker.GetWorldSize();
927 if (size) {
928 // Draw in world coordinates.
929 markerSizeType = world;
930 }
931 else {
932 size = userSpecified ?
933 marker.GetScreenSize() : defaultMarker.GetScreenSize();
934 // Draw in screen coordinates.
935 markerSizeType = screen;
936 }
937 size *= fpViewer -> GetViewParameters().GetGlobalMarkerScale();
938 if (markerSizeType == screen && size < 1.) size = 1.;
939 return size;
940}
G4double GetScreenSize() const
G4double GetWorldSize() const

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

◆ GetMarkForClearingTransientStore()

G4bool G4VSceneHandler::GetMarkForClearingTransientStore ( ) const

◆ GetModel()

G4VModel * G4VSceneHandler::GetModel ( ) const

◆ GetName()

◆ GetNoOfSides()

G4int G4VSceneHandler::GetNoOfSides ( const G4VisAttributes pVisAttribs)

Definition at line 942 of file G4VSceneHandler.cc.

943{
944 // No. of sides (lines segments per circle) is normally determined
945 // by the view parameters, but it can be overriddden by the
946 // ForceLineSegmentsPerCircle in the vis attributes.
947 G4int lineSegmentsPerCircle = fpViewer->GetViewParameters().GetNoOfSides();
948 if (pVisAttribs) {
949 if (pVisAttribs->IsForceLineSegmentsPerCircle())
950 lineSegmentsPerCircle = pVisAttribs->GetForcedLineSegmentsPerCircle();
951 const G4int nSegmentsMin = 12;
952 if (lineSegmentsPerCircle < nSegmentsMin) {
953 lineSegmentsPerCircle = nSegmentsMin;
954 G4cout <<
955 "G4VSceneHandler::GetNoOfSides: attempt to set the"
956 "\nnumber of line segements per circle < " << nSegmentsMin
957 << "; forced to " << lineSegmentsPerCircle << G4endl;
958 }
959 }
960 return lineSegmentsPerCircle;
961}
int G4int
Definition: G4Types.hh:66
G4bool IsForceLineSegmentsPerCircle() const
G4int GetForcedLineSegmentsPerCircle() const

Referenced by RequestPrimitives().

◆ GetObjectTransformation()

const G4Transform3D & G4VSceneHandler::GetObjectTransformation ( ) const

◆ GetScene()

◆ GetSceneHandlerId()

G4int G4VSceneHandler::GetSceneHandlerId ( ) const

◆ GetTextColor()

const G4Colour & G4VSceneHandler::GetTextColor ( const G4Text )

◆ GetTextColour()

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

Definition at line 854 of file G4VSceneHandler.cc.

854 {
855 const G4VisAttributes* pVA = text.GetVisAttributes ();
856 if (!pVA) {
857 pVA = fpViewer -> GetViewParameters (). GetDefaultTextVisAttributes ();
858 }
859 const G4Colour& colour = pVA -> GetColour ();
860 return colour;
861}

Referenced by G4HepRepFileSceneHandler::AddPrimitive().

◆ GetTransientsDrawnThisEvent()

G4bool G4VSceneHandler::GetTransientsDrawnThisEvent ( ) const

◆ GetTransientsDrawnThisRun()

G4bool G4VSceneHandler::GetTransientsDrawnThisRun ( ) const

◆ GetViewCount()

G4int G4VSceneHandler::GetViewCount ( ) const

◆ GetViewerList()

const G4ViewerList & G4VSceneHandler::GetViewerList ( ) const

◆ IncrementViewCount()

G4int G4VSceneHandler::IncrementViewCount ( )

◆ IsReadyForTransients()

G4bool G4VSceneHandler::IsReadyForTransients ( ) const

◆ LoadAtts()

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

Definition at line 791 of file G4VSceneHandler.cc.

792{
793 // Load G4Atts from G4VisAttributes, if any...
794 const G4VisAttributes* va = visible.GetVisAttributes();
795 if (va) {
796 const std::map<G4String,G4AttDef>* vaDefs =
797 va->GetAttDefs();
798 if (vaDefs) {
799 holder->AddAtts(visible.GetVisAttributes()->CreateAttValues(), vaDefs);
800 }
801 }
802
803 G4PhysicalVolumeModel* pPVModel =
804 dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
805 if (pPVModel) {
806 // Load G4Atts from G4PhysicalVolumeModel...
807 const std::map<G4String,G4AttDef>* pvDefs = pPVModel->GetAttDefs();
808 if (pvDefs) {
809 holder->AddAtts(pPVModel->CreateCurrentAttValues(), pvDefs);
810 }
811 }
812
813 G4TrajectoriesModel* trajModel = dynamic_cast<G4TrajectoriesModel*>(fpModel);
814 if (trajModel) {
815 // Load G4Atts from trajectory model...
816 const std::map<G4String,G4AttDef>* trajModelDefs = trajModel->GetAttDefs();
817 if (trajModelDefs) {
818 holder->AddAtts(trajModel->CreateCurrentAttValues(), trajModelDefs);
819 }
820 // Load G4Atts from trajectory...
821 const G4VTrajectory* traj = trajModel->GetCurrentTrajectory();
822 const std::map<G4String,G4AttDef>* trajDefs = traj->GetAttDefs();
823 if (trajDefs) {
824 holder->AddAtts(traj->CreateAttValues(), trajDefs);
825 }
826 G4int nPoints = traj->GetPointEntries();
827 for (G4int i = 0; i < nPoints; ++i) {
828 G4VTrajectoryPoint* trajPoint = traj->GetPoint(i);
829 const std::map<G4String,G4AttDef>* pointDefs = trajPoint->GetAttDefs();
830 if (pointDefs) {
831 holder->AddAtts(trajPoint->CreateAttValues(), pointDefs);
832 }
833 }
834 }
835
836 G4HitsModel* hitsModel = dynamic_cast<G4HitsModel*>(fpModel);
837 if (hitsModel) {
838 // Load G4Atts from hit...
839 const G4VHit* hit = hitsModel->GetCurrentHit();
840 const std::map<G4String,G4AttDef>* hitsDefs = hit->GetAttDefs();
841 if (hitsDefs) {
842 holder->AddAtts(hit->CreateAttValues(), hitsDefs);
843 }
844 }
845}
void AddAtts(const std::vector< G4AttValue > *values, const std::map< G4String, G4AttDef > *defs)
Definition: G4AttHolder.hh:65
const G4VHit * GetCurrentHit() const
Definition: G4HitsModel.hh:58
std::vector< G4AttValue > * CreateCurrentAttValues() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
const G4VTrajectory * GetCurrentTrajectory() const
std::vector< G4AttValue > * CreateCurrentAttValues() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual std::vector< G4AttValue > * CreateAttValues() const
Definition: G4VHit.hh:67
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
Definition: G4VHit.hh:60
virtual std::vector< G4AttValue > * CreateAttValues() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual G4VTrajectoryPoint * GetPoint(G4int i) const =0
virtual int GetPointEntries() const =0
virtual std::vector< G4AttValue > * CreateAttValues() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
const std::vector< G4AttValue > * CreateAttValues() const

◆ PostAddSolid()

void G4VSceneHandler::PostAddSolid ( )
virtual

◆ PreAddSolid()

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

◆ ProcessScene()

void G4VSceneHandler::ProcessScene ( )
protectedvirtual

Definition at line 537 of file G4VSceneHandler.cc.

537 {
538
539 // Assumes graphics database store has already been cleared if
540 // relevant for the particular scene handler.
541
542 if (!fpScene) return;
543
544 G4VisManager* visManager = G4VisManager::GetInstance();
545
546 if (!visManager->GetConcreteInstance()) return;
547
548 G4VisManager::Verbosity verbosity = visManager->GetVerbosity();
549
550 fReadyForTransients = false;
551
552 // Reset fMarkForClearingTransientStore. (Leaving
553 // fMarkForClearingTransientStore true causes problems with
554 // recomputing transients below.) Restore it again at end...
555 G4bool tmpMarkForClearingTransientStore = fMarkForClearingTransientStore;
557
558 // Traverse geometry tree and send drawing primitives to window(s).
559
560 const std::vector<G4Scene::Model>& runDurationModelList =
561 fpScene -> GetRunDurationModelList ();
562
563 if (runDurationModelList.size ()) {
564 if (verbosity >= G4VisManager::confirmations) {
565 G4cout << "Traversing scene data..." << G4endl;
566 }
567
568 BeginModeling ();
569
570 // Create modeling parameters from view parameters...
572
573 for (size_t i = 0; i < runDurationModelList.size (); i++) {
574 if (runDurationModelList[i].fActive) {
575 G4VModel* pModel = runDurationModelList[i].fpModel;
576 // Note: this is not the place to take action on
577 // pModel->GetTransformation(). The model must take care of
578 // this in pModel->DescribeYourselfTo(*this). See, for example,
579 // G4PhysicalVolumeModel and /vis/scene/add/logo.
580 pModel -> SetModelingParameters (pMP);
581 SetModel (pModel); // Store for use by derived class.
582 pModel -> DescribeYourselfTo (*this);
583 pModel -> SetModelingParameters (0);
584 }
585 }
586
587 delete pMP;
588 EndModeling ();
589 }
590
591 fReadyForTransients = true;
592
593 // Refresh event from end-of-event model list.
594 // Allow only in Idle or GeomClosed state...
596 G4ApplicationState state = stateManager->GetCurrentState();
597 if (state == G4State_Idle || state == G4State_GeomClosed) {
598
599 visManager->SetEventRefreshing(true);
600
601 if (visManager->GetRequestedEvent()) {
602 DrawEvent(visManager->GetRequestedEvent());
603
604 } else {
605
607 if (runManager) {
608 const G4Run* run = runManager->GetCurrentRun();
609 const std::vector<const G4Event*>* events =
610 run? run->GetEventVector(): 0;
611 size_t nKeptEvents = 0;
612 if (events) nKeptEvents = events->size();
613 if (nKeptEvents) {
614
616
617 if (verbosity >= G4VisManager::confirmations) {
618 G4cout << "Refreshing event..." << G4endl;
619 }
620 const G4Event* event = 0;
621 if (events && events->size()) event = events->back();
622 if (event) DrawEvent(event);
623
624 } else { // Accumulating events.
625
626 if (verbosity >= G4VisManager::confirmations) {
627 G4cout << "Refreshing events in run..." << G4endl;
628 }
629 for (size_t i = 0; i < nKeptEvents; ++i) {
630 const G4Event* event = (*events)[i];
631 if (event) DrawEvent(event);
632 }
633
635 if (verbosity >= G4VisManager::warnings) {
636 G4cout <<
637 "WARNING: Cannot refresh events accumulated over more"
638 "\n than one runs. Refreshed just the last run."
639 << G4endl;
640 }
641 }
642 }
643 }
644 }
645 }
646 visManager->SetEventRefreshing(false);
647 }
648
649 // Refresh end-of-run model list.
650 // Allow only in Idle or GeomClosed state...
651 if (state == G4State_Idle || state == G4State_GeomClosed) {
653 }
654
655 fMarkForClearingTransientStore = tmpMarkForClearingTransientStore;
656}
G4ApplicationState
@ G4State_Idle
@ G4State_GeomClosed
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:62
const G4Run * GetCurrentRun() const
Definition: G4Run.hh:47
const std::vector< const G4Event * > * GetEventVector() const
Definition: G4Run.hh:112
G4bool GetRefreshAtEndOfEvent() const
G4bool GetRefreshAtEndOfRun() const
G4ApplicationState GetCurrentState() const
static G4StateManager * GetStateManager()
virtual void BeginModeling()
void DrawEvent(const G4Event *)
virtual void EndModeling()
static G4VVisManager * GetConcreteInstance()
void SetEventRefreshing(G4bool)
const G4Event * GetRequestedEvent() const

Referenced by G4VViewer::ProcessView().

◆ RemoveViewerFromList()

void G4VSceneHandler::RemoveViewerFromList ( G4VViewer pView)

Definition at line 467 of file G4VSceneHandler.cc.

467 {
468 fViewerList.remove(pViewer);
469}
void remove(G4VViewer *)
Definition: G4ViewerList.cc:31

Referenced by G4VViewer::~G4VViewer().

◆ RequestPrimitives()

void G4VSceneHandler::RequestPrimitives ( const G4VSolid solid)
protectedvirtual

Reimplemented in G4ASCIITreeSceneHandler.

Definition at line 480 of file G4VSceneHandler.cc.

480 {
482 G4NURBS* pNURBS = 0;
483 G4Polyhedron* pPolyhedron = 0;
484 switch (fpViewer -> GetViewParameters () . GetRepStyle ()) {
486 pNURBS = solid.CreateNURBS ();
487 if (pNURBS) {
488 static G4bool warned = false;
489 if (!warned) {
490 warned = true;
491 G4cout <<
492 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
493 "!!!!! NURBS are deprecated and will be removed in the next major release."
494 "\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
495 << G4endl;
496 }
497 pNURBS -> SetVisAttributes (fpVisAttribs);
498 AddPrimitive (*pNURBS);
499 delete pNURBS;
500 break;
501 }
502 else {
504 if (verbosity >= G4VisManager::errors) {
505 G4cout <<
506 "ERROR: G4VSceneHandler::RequestPrimitives"
507 "\n NURBS not available for "
508 << solid.GetName () << G4endl;
509 G4cout << "Trying polyhedron." << G4endl;
510 }
511 }
512 // Dropping through to polyhedron...
514 default:
516 pPolyhedron = solid.GetPolyhedron ();
518 if (pPolyhedron) {
519 pPolyhedron -> SetVisAttributes (fpVisAttribs);
520 AddPrimitive (*pPolyhedron);
521 }
522 else {
524 if (verbosity >= G4VisManager::errors) {
525 G4cout <<
526 "ERROR: G4VSceneHandler::RequestPrimitives"
527 "\n Polyhedron not available for " << solid.GetName () <<
528 ".\n This means it cannot be visualized on most systems."
529 "\n Contact the Visualization Coordinator." << G4endl;
530 }
531 }
532 break;
533 }
534 EndPrimitives ();
535}
G4int GetNoOfSides(const G4VisAttributes *)
virtual void EndPrimitives()
virtual void BeginPrimitives(const G4Transform3D &objectTransformation)
G4String GetName() const
virtual G4NURBS * CreateNURBS() const
Definition: G4VSolid.cc:642
virtual G4Polyhedron * GetPolyhedron() const
Definition: G4VSolid.cc:647
static void SetNumberOfRotationSteps(G4int n)
static void ResetNumberOfRotationSteps()

Referenced by AddSolid().

◆ SetCurrentViewer()

void G4VSceneHandler::SetCurrentViewer ( G4VViewer )

◆ SetMarkForClearingTransientStore()

◆ SetModel()

void G4VSceneHandler::SetModel ( G4VModel )

◆ SetName()

void G4VSceneHandler::SetName ( const G4String )

◆ SetObjectTransformation()

void G4VSceneHandler::SetObjectTransformation ( const G4Transform3D )

◆ SetScene()

void G4VSceneHandler::SetScene ( G4Scene pScene)
virtual

Definition at line 471 of file G4VSceneHandler.cc.

471 {
472 fpScene = pScene;
473 // Notify all viewers that a kernel visit is required.
475 for (i = fViewerList.begin(); i != fViewerList.end(); i++) {
476 (*i) -> SetNeedKernelVisit (true);
477 }
478}
std::vector< G4VViewer * >::iterator G4ViewerListIterator
Definition: G4ViewerList.hh:43

◆ SetTransientsDrawnThisEvent()

void G4VSceneHandler::SetTransientsDrawnThisEvent ( G4bool  )

◆ SetTransientsDrawnThisRun()

void G4VSceneHandler::SetTransientsDrawnThisRun ( G4bool  )

◆ SetViewerList()

G4ViewerList & G4VSceneHandler::SetViewerList ( )

Friends And Related Function Documentation

◆ G4VViewer

friend class G4VViewer
friend

Definition at line 63 of file G4VSceneHandler.hh.

◆ operator<<

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

Definition at line 963 of file G4VSceneHandler.cc.

963 {
964
965 os << "Scene handler " << sh.fName << " has "
966 << sh.fViewerList.size () << " viewer(s):";
967 for (size_t i = 0; i < sh.fViewerList.size (); i++) {
968 os << "\n " << *(sh.fViewerList [i]);
969 }
970
971 if (sh.fpScene) {
972 os << "\n " << *sh.fpScene;
973 }
974 else {
975 os << "\n This scene handler currently has no scene.";
976 }
977
978 return os;
979}

Member Data Documentation

◆ fIdentityTransformation

const G4Transform3D G4VSceneHandler::fIdentityTransformation
protected

Definition at line 345 of file G4VSceneHandler.hh.

◆ fMarkForClearingTransientStore

G4bool G4VSceneHandler::fMarkForClearingTransientStore
protected

Definition at line 333 of file G4VSceneHandler.hh.

Referenced by ProcessScene().

◆ fName

G4String G4VSceneHandler::fName
protected

Definition at line 328 of file G4VSceneHandler.hh.

Referenced by G4VSceneHandler().

◆ fNestingDepth

G4int G4VSceneHandler::fNestingDepth
protected

◆ fObjectTransformation

◆ fpModel

◆ fProcessing2D

G4bool G4VSceneHandler::fProcessing2D
protected

◆ fProcessingSolid

G4bool G4VSceneHandler::fProcessingSolid
protected

◆ fpScene

◆ fpViewer

◆ fpVisAttribs

◆ fReadyForTransients

◆ fSceneHandlerId

const G4int G4VSceneHandler::fSceneHandlerId
protected

Definition at line 327 of file G4VSceneHandler.hh.

Referenced by G4VSceneHandler().

◆ fSystem

G4VGraphicsSystem& G4VSceneHandler::fSystem
protected

Definition at line 326 of file G4VSceneHandler.hh.

Referenced by G4VSceneHandler().

◆ fTransientsDrawnThisEvent

G4bool G4VSceneHandler::fTransientsDrawnThisEvent
protected

Definition at line 336 of file G4VSceneHandler.hh.

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

◆ fTransientsDrawnThisRun

G4bool G4VSceneHandler::fTransientsDrawnThisRun
protected

Definition at line 337 of file G4VSceneHandler.hh.

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

◆ fViewCount

G4int G4VSceneHandler::fViewCount
protected

Definition at line 329 of file G4VSceneHandler.hh.

◆ fViewerList

G4ViewerList G4VSceneHandler::fViewerList
protected

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