Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4HepRepViewer.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// $Id$
27//
28
29/**
30 * @author Mark Donszelmann
31 */
32
33//HepRep
34#include "HEPREP/HepRep.h"
35
36//G4
37#include "G4Types.hh"
38//#include "G4VInteractorManager.hh"
39#include "G4Scene.hh"
40#include "G4HepRep.hh"
41#include "G4HepRepMessenger.hh"
43//This
44#include "G4HepRepViewer.hh"
45
46using namespace HEPREP;
47using namespace std;
48
50 : G4VViewer (sceneHandler, sceneHandler.IncrementViewCount(), name),
51 geometryIncluded(false) {
52
53#ifdef SDEBUG
54 cout << "G4HepRepViewer::G4HepRepViewer " << name << endl;
55#endif
56
57 // Make changes to view parameters for HepRep...
58 fVP.SetCulling(false);
60}
61
62
63
65#ifdef SDEBUG
66 cout << "G4HepRepViewer::~G4HepRepViewer" << endl;
67#endif
68 dynamic_cast<G4HepRep*>(GetSceneHandler()->GetGraphicsSystem())->removeViewer();
69}
70
71
73#ifdef SDEBUG
74 cout << "G4HepRepViewer::ClearView" << endl;
75#endif
76}
77
79#ifdef SDEBUG
80 cout << "G4HepRepViewer::SetView" << endl;
81#endif
82}
83
84
85/* NOTE:
86 /run/beamOn calls ShowView for every event (unless accumulate is set)
87 /vis/viewer/flush calls /vis/viewer/refresh followed by /vis/viewer/update
88 /vis/viewer/refresh calls SetView, ClearView, DrawView
89 /vis/viewer/update calls ShowView
90*/
92#ifdef SDEBUG
93 cout << "G4HepRepViewer::DrawView" << endl;
94#endif
95 if (!geometryIncluded) {
96 // draws the geometry
99 geometryIncluded = true;
100 }
101}
102
104#ifdef SDEBUG
105 cout << "G4HepRepViewer::ShowView" << endl;
106#endif
108
109 G4HepRepSceneHandler* sceneHandler = dynamic_cast<G4HepRepSceneHandler*>(GetSceneHandler());
110 if (sceneHandler->closeHepRep()) {
111 sceneHandler->openHepRep();
112
114 if (messenger->appendGeometry()) geometryIncluded = false;
115 }
116}
117
119#ifdef SDEBUG
120 cout << "G4HepRepViewer::FinishView" << endl;
121#endif
123}
124
126 geometryIncluded = false;
127}
virtual G4bool appendGeometry()
static G4HepRepMessenger * GetInstance()
bool closeHepRep(bool final=false)
virtual ~G4HepRepViewer()
G4HepRepViewer(G4VSceneHandler &scene, const G4String &name="")
G4VGraphicsSystem * GetGraphicsSystem() const
void ProcessView()
Definition: G4VViewer.cc:115
void NeedKernelVisit()
Definition: G4VViewer.cc:86
G4ViewParameters fDefaultVP
Definition: G4VViewer.hh:138
G4ViewParameters fVP
Definition: G4VViewer.hh:137
virtual void FinishView()
Definition: G4VViewer.cc:111
virtual void ShowView()
Definition: G4VViewer.cc:113
G4VSceneHandler * GetSceneHandler() const
void SetCulling(G4bool)