Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
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"
42 #include "G4HepRepSceneHandler.hh"
43 //This
44 #include "G4HepRepViewer.hh"
45 
46 using namespace HEPREP;
47 using 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);
59  fDefaultVP.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
98  ProcessView();
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 }