|
||||
File indexing completed on 2025-01-18 09:59:04
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // 0027 // 0028 // 0029 // Scene John Allison 19th July 1996. 0030 // 0031 // Class Description: 0032 // 0033 // Defines the viewable scene. 0034 0035 #ifndef G4SCENE_HH 0036 #define G4SCENE_HH 0037 0038 #include "globals.hh" 0039 #include "G4ios.hh" 0040 0041 class G4VPhysicalVolume; 0042 0043 #include "G4VisExtent.hh" 0044 #include "G4Point3D.hh" 0045 #include "G4VModel.hh" 0046 #include <vector> 0047 0048 class G4Scene { 0049 0050 public: // With description 0051 0052 friend std::ostream& operator << (std::ostream& os, const G4Scene& d); 0053 0054 enum {UNLIMITED = -1}; 0055 0056 G4Scene (const G4String& name = "scene-with-unspecified-name"); 0057 ~G4Scene (); 0058 0059 // Makes use of default (compiler generated) copy constructor and 0060 // assignment operator. 0061 0062 G4bool operator == (const G4Scene&) const; 0063 G4bool operator != (const G4Scene&) const; 0064 0065 ////////////////////////////////////////////////////// 0066 // Get functions... 0067 0068 const G4String& GetName () const; 0069 0070 G4bool IsEmpty () const; 0071 0072 struct Model { 0073 Model(G4VModel* pModel): fActive(true), fpModel(pModel) {} 0074 G4bool fActive; 0075 G4VModel* fpModel; 0076 }; 0077 0078 const std::vector<Model>& GetRunDurationModelList () const; 0079 // Contains models which are expected to last for the duration of 0080 // the run, for example geometry volumes. 0081 0082 const std::vector<Model>& GetEndOfEventModelList () const; 0083 // Contains models which are described at the end of event when the 0084 // scene is current. 0085 0086 const std::vector<Model>& GetEndOfRunModelList () const; 0087 // Contains models which are described at the end of event when the 0088 // scene is current. 0089 0090 const G4VisExtent& GetExtent () const; 0091 // Overall extent of all objects in the scene. 0092 0093 const G4Point3D& GetStandardTargetPoint () const; 0094 // Usually centre of extent. See G4ViewParameters for definition. 0095 0096 G4bool GetRefreshAtEndOfEvent () const; 0097 // If true, the visualization manager will request viewer to refresh 0098 // "transient" objects, such as hits, at end of event. Otherwise 0099 // they will be accumulated. 0100 0101 G4int GetMaxNumberOfKeptEvents() const; 0102 // If RefreshAtEndOfEvent is false, events of the current run are 0103 // kept up to this maximum number. A negative value means all 0104 // events of current run are kept. The events are available for 0105 // viewing at the end of run, but are deleted just before the start 0106 // of the next run. 0107 0108 G4bool GetRefreshAtEndOfRun () const; 0109 // If true, the visualization manager will request viewer to refresh 0110 // "transient" objects, such as hits, at end of run. Otherwise 0111 // they will be accumulated. 0112 0113 ////////////////////////////////////////////// 0114 // Add and Set functions... 0115 0116 G4bool AddRunDurationModel (G4VModel*, G4bool warn = false); 0117 // Adds models of type which are expected to last for the duration 0118 // of the run, for example geometry volumes. 0119 // Returns false if model is already in the list. 0120 // Prints warnings if warn is true. 0121 0122 G4bool AddWorldIfEmpty (G4bool warn = false); 0123 // In some situations, if the user asks for a drawing and has not 0124 // yet set any run duration models it makes sense to put the "world" 0125 // in there by default. 0126 // Returns false if model is already in the list. 0127 // Prints warnings if warn is true. 0128 0129 G4bool AddEndOfEventModel (G4VModel*, G4bool warn = false); 0130 // Adds models of type which are described at the end of event when 0131 // the scene is current. 0132 // Returns false if model is already in the list. 0133 // Prints warnings if warn is true. 0134 0135 G4bool AddEndOfRunModel (G4VModel*, G4bool warn = false); 0136 // Adds models of type which are described at the end of run when 0137 // the scene is current. 0138 // Returns false if model is already in the list. 0139 // Prints warnings if warn is true. 0140 0141 void SetName (const G4String&); 0142 // Use with care. User normally sets scene name by vis commands. 0143 0144 std::vector<Model>& SetRunDurationModelList (); 0145 // Allows you to change the model list - do with care! 0146 0147 std::vector<Model>& SetEndOfEventModelList (); 0148 // Allows you to change the model list - do with care! 0149 0150 std::vector<Model>& SetEndOfRunModelList (); 0151 // Allows you to change the model list - do with care! 0152 0153 void SetRefreshAtEndOfEvent(G4bool); 0154 // If set true, the visualization manager will request viewer to 0155 // refresh "transient" objects, such as hits, at end of event. 0156 // Otherwise they will be accumulated. 0157 0158 void SetMaxNumberOfKeptEvents(G4int); 0159 // If RefreshAtEndOfEvent is false, events of the current run are 0160 // kept up to this maximum number. A negative value means all 0161 // events of current run are kept. The events are available for 0162 // viewing at the end of run, but are deleted just before the start 0163 // of the next run. 0164 0165 void SetRefreshAtEndOfRun(G4bool); 0166 // If set true, the visualization manager will request viewer to 0167 // refresh "transient" objects, such as hits, at end of run. 0168 // Otherwise they will be accumulated. 0169 0170 ////////////////////////////////////////////// 0171 // Other functions... 0172 0173 void CalculateExtent(); 0174 // (Re-)calculates the extent from the extents of its models. 0175 0176 private: 0177 G4String fName; 0178 std::vector<Model> fRunDurationModelList; 0179 std::vector<Model> fEndOfEventModelList; 0180 std::vector<Model> fEndOfRunModelList; 0181 G4VisExtent fExtent; 0182 G4Point3D fStandardTargetPoint; 0183 G4bool fRefreshAtEndOfEvent; 0184 G4bool fRefreshAtEndOfRun; 0185 G4int fMaxNumberOfKeptEvents; 0186 }; 0187 0188 #include "G4Scene.icc" 0189 0190 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |