source: trunk/source/visualization/management/include/G4Scene.hh @ 1346

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

before tag

  • Property svn:mime-type set to text/cpp
File size: 6.7 KB
Line 
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//
27// $Id: G4Scene.hh,v 1.19 2009/11/04 12:49:16 allison Exp $
28// GEANT4 tag $Name:  $
29//
30//
31// Scene  John Allison  19th July 1996.
32//
33// Class Description:
34//
35// Defines the viewable scene.
36
37#ifndef G4SCENE_HH
38#define G4SCENE_HH
39
40#include "globals.hh"
41#include "G4ios.hh"
42
43class G4VPhysicalVolume;
44
45#include "G4VisExtent.hh"
46#include "G4Point3D.hh"
47#include "G4VModel.hh"
48#include <vector>
49
50class G4Scene {
51
52public: // With description
53
54  friend std::ostream& operator << (std::ostream& os, const G4Scene& d);
55
56  enum {UNLIMITED = -1};
57
58  G4Scene (const G4String& name = "scene-with-unspecified-name");
59  ~G4Scene ();
60
61  // Makes use of default (compiler generated) copy constructor and
62  // assignment operator.
63
64  G4bool operator == (const G4Scene&) const;
65  G4bool operator != (const G4Scene&) const;
66
67  //////////////////////////////////////////////////////
68  // Get functions...
69
70  const G4String& GetName () const;
71
72  G4bool IsEmpty () const;
73
74  const std::vector<G4VModel*>& GetRunDurationModelList () const;
75  // Contains models which are expected to last for the duration of
76  // the run, for example geometry volumes.
77
78  const std::vector<G4VModel*>& GetEndOfEventModelList () const;
79  // Contains models which are described at the end of event when the
80  // scene is current.
81
82  const std::vector<G4VModel*>& GetEndOfRunModelList () const;
83  // Contains models which are described at the end of event when the
84  // scene is current.
85
86  const G4VisExtent& GetExtent () const;
87  // Overall extent of all objects in the scene.
88
89  const G4Point3D& GetStandardTargetPoint () const;
90  // Usually centre of extent.  See G4ViewParameters for definition.
91
92  G4bool GetRefreshAtEndOfEvent () const;
93  // If true, the visualization manager will request viewer to refresh
94  // "transient" objects, such as hits, at end of event.  Otherwise
95  // they will be accumulated.
96
97  G4int GetMaxNumberOfKeptEvents() const;
98  // If RefreshAtEndOfEvent is false, events of the current run are
99  // kept up to this maximum number.  A negative value means all
100  // events of current run are kept.  The events are available for
101  // viewing at the end of run, but are deleted just before the start
102  // of the next run.
103
104  G4bool GetRefreshAtEndOfRun () const;
105  // If true, the visualization manager will request viewer to refresh
106  // "transient" objects, such as hits, at end of run.  Otherwise
107  // they will be accumulated.
108
109  //////////////////////////////////////////////
110  // Add and Set functions...
111
112  G4bool AddRunDurationModel (G4VModel*, G4bool warn = false);
113  // Adds models of type which are expected to last for the duration
114  // of the run, for example geometry volumes.
115  // Returns false if model is already in the list.
116  // Prints warnings if warn is true.
117
118  G4bool AddWorldIfEmpty (G4bool warn = false);
119  // In some situations, if the user asks for a drawing and has not
120  // yet set any run duration models it makes sense to put the "world"
121  // in there by default.
122  // Returns false if model is already in the list.
123  // Prints warnings if warn is true.
124
125  G4bool AddEndOfEventModel (G4VModel*, G4bool warn = false);
126  // Adds models of type which are described at the end of event when
127  // the scene is current.
128  // Returns false if model is already in the list.
129  // Prints warnings if warn is true.
130
131  G4bool AddEndOfRunModel (G4VModel*, G4bool warn = false);
132  // Adds models of type which are described at the end of run when
133  // the scene is current.
134  // Returns false if model is already in the list.
135  // Prints warnings if warn is true.
136
137  std::vector<G4VModel*>& SetRunDurationModelList ();
138  // Allows you to change the model list - do with care!
139
140  std::vector<G4VModel*>& SetEndOfEventModelList ();
141  // Allows you to change the model list - do with care!
142
143  std::vector<G4VModel*>& SetEndOfRunModelList ();
144  // Allows you to change the model list - do with care!
145
146  void SetRefreshAtEndOfEvent(G4bool);
147  // If set true, the visualization manager will request viewer to
148  // refresh "transient" objects, such as hits, at end of event.
149  // Otherwise they will be accumulated.
150
151  void SetMaxNumberOfKeptEvents(G4int);
152  // If RefreshAtEndOfEvent is false, events of the current run are
153  // kept up to this maximum number.  A negative value means all
154  // events of current run are kept.  The events are available for
155  // viewing at the end of run, but are deleted just before the start
156  // of the next run.
157
158  void SetRefreshAtEndOfRun(G4bool);
159  // If set true, the visualization manager will request viewer to
160  // refresh "transient" objects, such as hits, at end of run.
161  // Otherwise they will be accumulated.
162
163  //////////////////////////////////////////////
164  // Other functions...
165
166  void CalculateExtent();
167  // (Re-)calculates the extent from the extents of its models.
168
169private:
170  G4String fName;
171  std::vector<G4VModel*> fRunDurationModelList;
172  std::vector<G4VModel*> fEndOfEventModelList;
173  std::vector<G4VModel*> fEndOfRunModelList;
174  G4VisExtent fExtent;
175  G4Point3D   fStandardTargetPoint;
176  G4bool      fRefreshAtEndOfEvent;
177  G4bool      fRefreshAtEndOfRun;
178  G4int       fMaxNumberOfKeptEvents;
179};
180
181#include "G4Scene.icc"
182
183#endif
Note: See TracBrowser for help on using the repository browser.