source: trunk/source/visualization/HepRep/src/G4HepRepViewer.cc@ 1346

Last change on this file since 1346 was 1337, checked in by garnier, 15 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 4.0 KB
RevLine 
[834]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//
[1228]26// $Id: G4HepRepViewer.cc,v 1.27 2009/11/23 05:42:28 perl Exp $
[1337]27// GEANT4 tag $Name: geant4-09-04-beta-01 $
[834]28//
29
30/**
31 * @author Mark Donszelmann
32 */
33
34//HepRep
35#include "HEPREP/HepRep.h"
36
37//G4
38#include "G4Types.hh"
39//#include "G4VInteractorManager.hh"
40#include "G4Scene.hh"
41#include "G4HepRep.hh"
[1228]42#include "G4HepRepMessenger.hh"
[834]43#include "G4HepRepSceneHandler.hh"
44//This
45#include "G4HepRepViewer.hh"
46
47using namespace HEPREP;
48using namespace std;
49
[1228]50G4HepRepViewer::G4HepRepViewer (G4VSceneHandler& sceneHandler, const G4String& name)
[834]51 : G4VViewer (sceneHandler, sceneHandler.IncrementViewCount(), name),
[1228]52 geometryIncluded(false) {
[834]53
54#ifdef SDEBUG
55 cout << "G4HepRepViewer::G4HepRepViewer " << name << endl;
56#endif
57
58 // Make changes to view parameters for HepRep...
59 fVP.SetCulling(false);
60 fDefaultVP.SetCulling(false);
61}
62
63
64
65G4HepRepViewer::~G4HepRepViewer () {
66#ifdef SDEBUG
67 cout << "G4HepRepViewer::~G4HepRepViewer" << endl;
68#endif
69 dynamic_cast<G4HepRep*>(GetSceneHandler()->GetGraphicsSystem())->removeViewer();
70}
71
72
73void G4HepRepViewer::ClearView () {
74#ifdef SDEBUG
75 cout << "G4HepRepViewer::ClearView" << endl;
76#endif
77}
78
79void G4HepRepViewer::SetView () {
80#ifdef SDEBUG
81 cout << "G4HepRepViewer::SetView" << endl;
82#endif
83}
84
85
86/* NOTE:
87 /run/beamOn calls ShowView for every event (unless accumulate is set)
88 /vis/viewer/flush calls /vis/viewer/refresh followed by /vis/viewer/update
89 /vis/viewer/refresh calls SetView, ClearView, DrawView
90 /vis/viewer/update calls ShowView
91*/
92void G4HepRepViewer::DrawView () {
93#ifdef SDEBUG
94 cout << "G4HepRepViewer::DrawView" << endl;
95#endif
96 if (!geometryIncluded) {
97 // draws the geometry
98 NeedKernelVisit();
99 ProcessView();
100 geometryIncluded = true;
101 }
102}
103
104void G4HepRepViewer::ShowView () {
105#ifdef SDEBUG
106 cout << "G4HepRepViewer::ShowView" << endl;
107#endif
108 G4VViewer::ShowView();
109
110 G4HepRepSceneHandler* sceneHandler = dynamic_cast<G4HepRepSceneHandler*>(GetSceneHandler());
111 if (sceneHandler->closeHepRep()) {
112 sceneHandler->openHepRep();
[1228]113
114 G4HepRepMessenger* messenger = G4HepRepMessenger::GetInstance();
115 if (messenger->appendGeometry()) geometryIncluded = false;
[834]116 }
117}
118
119void G4HepRepViewer::FinishView () {
120#ifdef SDEBUG
121 cout << "G4HepRepViewer::FinishView" << endl;
122#endif
123 G4VViewer::FinishView();
124}
125
126void G4HepRepViewer::reset() {
127 geometryIncluded = false;
128}
Note: See TracBrowser for help on using the repository browser.