Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ModelingParameters.hh
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 //
27 // $Id$
28 //
29 //
30 // John Allison 31st December 1997.
31 //
32 // Class Description:
33 //
34 // Parameters associated with the modeling of GEANT4 objects.
35 
36 #ifndef G4MODELINGPARAMETERS_HH
37 #define G4MODELINGPARAMETERS_HH
38 
39 #include "globals.hh"
40 #include "G4VisExtent.hh"
41 #include "G4VisAttributes.hh"
42 #include "G4PhysicalVolumeModel.hh"
43 
44 #include <vector>
45 #include <utility>
46 
47 class G4LogicalVolume;
48 class G4VisAttributes;
49 class G4VSolid;
50 class G4Event;
51 
53 
54 public: // With description
55 
56  // Currently requested drawing style.
57  enum DrawingStyle {
58  wf, // Draw edges - no hidden line removal (wireframe).
59  hlr, // Draw edges - hidden lines removed.
60  hsr, // Draw surfaces - hidden surfaces removed.
61  hlhsr // Draw surfaces and edges - hidden removed.
62  };
63 
64  // enums and nested class for communicating a modification to the vis
65  // attributes for a specfic touchable defined by PVNameCopyNoPath.
76  };
77  class PVNameCopyNo {
78  public:
80  fName(name), fCopyNo(copyNo) {}
81  const G4String& GetName() const {return fName;}
82  G4int GetCopyNo() const {return fCopyNo;}
83  private:
84  G4String fName;
85  G4int fCopyNo;
86  };
87  typedef std::vector<PVNameCopyNo> PVNameCopyNoPath;
88  typedef PVNameCopyNoPath::const_iterator PVNameCopyNoPathConstIterator;
90  public:
92  (const G4VisAttributes& visAtts,
93  VisAttributesSignifier signifier,
94  const PVNameCopyNoPath& path):
95  fVisAtts(visAtts), fSignifier(signifier), fPVNameCopyNoPath(path) {}
97  (const G4VisAttributes& visAtts,
98  VisAttributesSignifier signifier,
99  const std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>& path);
101  {return fVisAtts;}
103  {return fSignifier;}
105  {return fPVNameCopyNoPath;}
106  private:
107  G4VisAttributes fVisAtts;
108  VisAttributesSignifier fSignifier;
109  PVNameCopyNoPath fPVNameCopyNoPath;
110  };
111 
113 
114  G4ModelingParameters (const G4VisAttributes* pDefaultVisAttributes,
115  DrawingStyle drawingStyle,
116  G4bool isCulling,
117  G4bool isCullingInvisible,
118  G4bool isDensityCulling,
119  G4double visibleDensity,
120  G4bool isCullingCovered,
121  G4int noOfSides);
122  // Culling and clipping policy for G4PhysicalVolumeModel.
123 
125 
126  // Note: uses default assignment operator and copy constructor.
127 
129 
130  // Get and Is functions...
131  G4bool IsWarning () const;
133  DrawingStyle GetDrawingStyle () const;
134  G4bool IsCulling () const;
135  G4bool IsCullingInvisible () const;
136  G4bool IsDensityCulling () const;
137  G4double GetVisibleDensity () const;
138  G4bool IsCullingCovered () const;
139  G4bool IsExplode () const;
140  G4double GetExplodeFactor () const;
141  const G4Point3D& GetExplodeCentre () const;
142  G4int GetNoOfSides () const;
143  G4VSolid* GetSectionSolid () const;
144  G4VSolid* GetCutawaySolid () const;
145  const G4Event* GetEvent () const;
146  const std::vector<VisAttributesModifier>& GetVisAttributesModifiers() const;
147 
148  // Set functions...
149  void SetWarning (G4bool);
150  void SetDefaultVisAttributes (const G4VisAttributes* pDefaultVisAttributes);
152  void SetCulling (G4bool);
154  void SetDensityCulling (G4bool);
156  void SetCullingCovered (G4bool);
157  void SetExplodeFactor (G4double explodeFactor);
158  void SetExplodeCentre (const G4Point3D& explodeCentre);
159  G4int SetNoOfSides (G4int); // Returns actual number set.
160  void SetSectionSolid (G4VSolid* pSectionSolid);
161  void SetCutawaySolid (G4VSolid* pCutawaySolid);
162  void SetEvent (const G4Event* pEvent);
163  void SetVisAttributesModifiers(const std::vector<VisAttributesModifier>);
164 
166  (const PVNameCopyNoPath&,
167  const PVNameCopyNoPath&);
168 
169  static G4bool VAMSNotEqual
170  (const std::vector<VisAttributesModifier>&,
171  const std::vector<VisAttributesModifier>&);
172 
173  friend std::ostream& operator <<
174  (std::ostream& os, const G4ModelingParameters&);
175 
176  friend std::ostream& operator <<
177  (std::ostream& os, const PVNameCopyNoPath&);
178 
179  friend std::ostream& operator <<
180  (std::ostream& os,
181  const std::vector<VisAttributesModifier>&);
182 
183 private:
184 
185  // Data members...
186  G4bool fWarning; // Print warnings if true.
187  const G4VisAttributes* fpDefaultVisAttributes;
188  DrawingStyle fDrawingStyle; // Drawing style.
189  G4bool fCulling; // Culling requested.
190  G4bool fCullInvisible; // Cull (don't Draw) invisible objects.
191  G4bool fDensityCulling; // Density culling requested. If so...
192  G4double fVisibleDensity; // ...density lower than this not drawn.
193  G4bool fCullCovered; // Cull daughters covered by opaque mothers.
194  G4double fExplodeFactor; // Explode along radius by this factor...
195  G4Point3D fExplodeCentre; // ...about this centre.
196  G4int fNoOfSides; // ...if polygon approximates circle.
197  G4VSolid* fpSectionSolid; // For generic section (DCUT).
198  G4VSolid* fpCutawaySolid; // For generic cutaways.
199  const G4Event* fpEvent; // Event being processed.
200  std::vector<VisAttributesModifier> fVisAttributesModifiers;
201 };
202 
203 std::ostream& operator <<
204 (std::ostream& os, const G4ModelingParameters&);
205 
206 std::ostream& operator <<
207 (std::ostream& os, const G4ModelingParameters::PVNameCopyNoPath&);
208 
209 std::ostream& operator <<
210 (std::ostream& os,
211  const std::vector<G4ModelingParameters::VisAttributesModifier>&);
212 
213 #include "G4ModelingParameters.icc"
214 
215 #endif