| [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 | //
|
|---|
| 26 | // $Id: G4HepRepViewer.cc,v 1.26 2006/06/29 21:17:34 gunter Exp $
|
|---|
| [944] | 27 | // GEANT4 tag $Name: $
|
|---|
| [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"
|
|---|
| 42 | #include "G4HepRepSceneHandler.hh"
|
|---|
| 43 | //This
|
|---|
| 44 | #include "G4HepRepViewer.hh"
|
|---|
| 45 |
|
|---|
| 46 | using namespace HEPREP;
|
|---|
| 47 | using namespace std;
|
|---|
| 48 |
|
|---|
| 49 | G4HepRepViewer::G4HepRepViewer (G4VSceneHandler& sceneHandler, G4HepRepMessenger& heprepMessenger, const G4String& name)
|
|---|
| 50 | : G4VViewer (sceneHandler, sceneHandler.IncrementViewCount(), name),
|
|---|
| 51 | geometryIncluded(false),
|
|---|
| 52 | messenger(heprepMessenger) {
|
|---|
| 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 |
|
|---|
| 65 | G4HepRepViewer::~G4HepRepViewer () {
|
|---|
| 66 | #ifdef SDEBUG
|
|---|
| 67 | cout << "G4HepRepViewer::~G4HepRepViewer" << endl;
|
|---|
| 68 | #endif
|
|---|
| 69 | dynamic_cast<G4HepRep*>(GetSceneHandler()->GetGraphicsSystem())->removeViewer();
|
|---|
| 70 | }
|
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 | void G4HepRepViewer::ClearView () {
|
|---|
| 74 | #ifdef SDEBUG
|
|---|
| 75 | cout << "G4HepRepViewer::ClearView" << endl;
|
|---|
| 76 | #endif
|
|---|
| 77 | }
|
|---|
| 78 |
|
|---|
| 79 | void 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 | */
|
|---|
| 92 | void 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 |
|
|---|
| 104 | void 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();
|
|---|
| 113 | if (messenger.appendGeometry()) geometryIncluded = false;
|
|---|
| 114 | }
|
|---|
| 115 | }
|
|---|
| 116 |
|
|---|
| 117 | void G4HepRepViewer::FinishView () {
|
|---|
| 118 | #ifdef SDEBUG
|
|---|
| 119 | cout << "G4HepRepViewer::FinishView" << endl;
|
|---|
| 120 | #endif
|
|---|
| 121 | G4VViewer::FinishView();
|
|---|
| 122 | }
|
|---|
| 123 |
|
|---|
| 124 | void G4HepRepViewer::reset() {
|
|---|
| 125 | geometryIncluded = false;
|
|---|
| 126 | }
|
|---|