Geant4  10.03.p03
 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: G4ModelingParameters.hh 99418 2016-09-21 09:18:42Z gcosmo $
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 
78  class PVNameCopyNo {
79  public:
81  fName(name), fCopyNo(copyNo) {}
82  const G4String& GetName() const {return fName;}
83  G4int GetCopyNo() const {return fCopyNo;}
84  G4bool operator!=(const PVNameCopyNo&) const;
85  G4bool operator==(const PVNameCopyNo& rhs) const {return !operator!=(rhs);}
86  private:
87  G4String fName;
88  G4int fCopyNo;
89  };
90 
91  typedef std::vector<PVNameCopyNo> PVNameCopyNoPath;
92  typedef PVNameCopyNoPath::const_iterator PVNameCopyNoPathConstIterator;
93 
95  public:
97  (const G4VisAttributes& visAtts,
98  VisAttributesSignifier signifier,
99  const PVNameCopyNoPath& path):
100  fVisAtts(visAtts), fSignifier(signifier), fPVNameCopyNoPath(path) {}
102  (const G4VisAttributes& visAtts,
103  VisAttributesSignifier signifier,
104  const std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>& path);
106  {return fVisAtts;}
108  {return fSignifier;}
110  {return fPVNameCopyNoPath;}
111  void SetVisAttributes(const G4VisAttributes& visAtts)
112  {fVisAtts = visAtts;}
114  {fSignifier = signifier;}
116  {fPVNameCopyNoPath = PVNameCopyNoPath;}
119  {return !operator!=(rhs);}
120  private:
121  G4VisAttributes fVisAtts;
122  VisAttributesSignifier fSignifier;
123  PVNameCopyNoPath fPVNameCopyNoPath;
124  };
125 
127 
128  G4ModelingParameters (const G4VisAttributes* pDefaultVisAttributes,
129  DrawingStyle drawingStyle,
130  G4bool isCulling,
131  G4bool isCullingInvisible,
132  G4bool isDensityCulling,
133  G4double visibleDensity,
134  G4bool isCullingCovered,
135  G4int noOfSides);
136  // Culling and clipping policy for G4PhysicalVolumeModel.
137 
139 
140  // Note: uses default assignment operator and copy constructor.
141 
143 
144  // Get and Is functions...
145  G4bool IsWarning () const;
147  DrawingStyle GetDrawingStyle () const;
148  G4bool IsCulling () const;
149  G4bool IsCullingInvisible () const;
150  G4bool IsDensityCulling () const;
151  G4double GetVisibleDensity () const;
152  G4bool IsCullingCovered () const;
153  G4bool IsExplode () const;
154  G4double GetExplodeFactor () const;
155  const G4Point3D& GetExplodeCentre () const;
156  G4int GetNoOfSides () const;
157  G4VSolid* GetSectionSolid () const;
158  G4VSolid* GetCutawaySolid () const;
159  const G4Event* GetEvent () const;
160  const std::vector<VisAttributesModifier>& GetVisAttributesModifiers() const;
161 
162  // Set functions...
163  void SetWarning (G4bool);
164  void SetDefaultVisAttributes (const G4VisAttributes* pDefaultVisAttributes);
166  void SetCulling (G4bool);
168  void SetDensityCulling (G4bool);
170  void SetCullingCovered (G4bool);
171  void SetExplodeFactor (G4double explodeFactor);
172  void SetExplodeCentre (const G4Point3D& explodeCentre);
173  G4int SetNoOfSides (G4int); // Returns actual number set.
174  void SetSectionSolid (G4VSolid* pSectionSolid);
175  void SetCutawaySolid (G4VSolid* pCutawaySolid);
176  void SetEvent (const G4Event* pEvent);
177  void SetVisAttributesModifiers(const std::vector<VisAttributesModifier>&);
178 
179  friend std::ostream& operator <<
180  (std::ostream& os, const G4ModelingParameters&);
181 
182  friend std::ostream& operator <<
183  (std::ostream& os, const PVNameCopyNoPath&);
184 
185  friend std::ostream& operator <<
186  (std::ostream& os,
187  const std::vector<VisAttributesModifier>&);
188 
189 private:
190 
191  // Data members...
192  G4bool fWarning; // Print warnings if true.
193  const G4VisAttributes* fpDefaultVisAttributes;
194  DrawingStyle fDrawingStyle; // Drawing style.
195  G4bool fCulling; // Culling requested.
196  G4bool fCullInvisible; // Cull (don't Draw) invisible objects.
197  G4bool fDensityCulling; // Density culling requested. If so...
198  G4double fVisibleDensity; // ...density lower than this not drawn.
199  G4bool fCullCovered; // Cull daughters covered by opaque mothers.
200  G4double fExplodeFactor; // Explode along radius by this factor...
201  G4Point3D fExplodeCentre; // ...about this centre.
202  G4int fNoOfSides; // ...if polygon approximates circle.
203  G4VSolid* fpSectionSolid; // For generic section (DCUT).
204  G4VSolid* fpCutawaySolid; // For generic cutaways.
205  const G4Event* fpEvent; // Event being processed.
206  std::vector<VisAttributesModifier> fVisAttributesModifiers;
207 };
208 
209 std::ostream& operator <<
210 (std::ostream& os, const G4ModelingParameters&);
211 
212 std::ostream& operator <<
213 (std::ostream& os, const G4ModelingParameters::PVNameCopyNoPath&);
214 
215 std::ostream& operator <<
216 (std::ostream& os,
217  const std::vector<G4ModelingParameters::VisAttributesModifier>&);
218 
219 #include "G4ModelingParameters.icc"
220 
221 #endif
const XML_Char * name
Definition: expat.h:151
G4VSolid * GetSectionSolid() const
const G4VisAttributes & GetVisAttributes() const
const G4Point3D & GetExplodeCentre() const
const G4VisAttributes * GetDefaultVisAttributes() const
void SetVisibleDensity(G4double)
void SetPVNameCopyNoPath(const PVNameCopyNoPath &PVNameCopyNoPath)
G4bool IsExplode() const
G4VSolid * GetCutawaySolid() const
G4bool IsDensityCulling() const
int G4int
Definition: G4Types.hh:78
void SetCutawaySolid(G4VSolid *pCutawaySolid)
void SetCullingCovered(G4bool)
void SetCullingInvisible(G4bool)
const G4Event * GetEvent() const
void SetEvent(const G4Event *pEvent)
bool G4bool
Definition: G4Types.hh:79
G4int GetNoOfSides() const
void SetVisAttributes(const G4VisAttributes &visAtts)
G4bool IsCullingCovered() const
void SetCulling(G4bool)
VisAttributesModifier(const G4VisAttributes &visAtts, VisAttributesSignifier signifier, const PVNameCopyNoPath &path)
G4bool IsCullingInvisible() const
void SetSectionSolid(G4VSolid *pSectionSolid)
void SetVisAttributesSignifier(VisAttributesSignifier signifier)
void SetVisAttributesModifiers(const std::vector< VisAttributesModifier > &)
std::vector< PVNameCopyNo > PVNameCopyNoPath
G4double GetExplodeFactor() const
const PVNameCopyNoPath & GetPVNameCopyNoPath() const
G4bool IsCulling() const
void SetWarning(G4bool)
void SetDensityCulling(G4bool)
G4bool operator!=(const PVNameCopyNo &) const
void SetExplodeFactor(G4double explodeFactor)
G4double GetVisibleDensity() const
double G4double
Definition: G4Types.hh:76
PVNameCopyNo(G4String name, G4int copyNo)
void SetExplodeCentre(const G4Point3D &explodeCentre)
G4bool operator!=(const VisAttributesModifier &) const
void SetDefaultVisAttributes(const G4VisAttributes *pDefaultVisAttributes)
G4bool operator!=(const G4ModelingParameters &) const
VisAttributesSignifier GetVisAttributesSignifier() const
G4bool operator==(const VisAttributesModifier &rhs) const
void SetDrawingStyle(DrawingStyle)
G4bool operator==(const PVNameCopyNo &rhs) const
PVNameCopyNoPath::const_iterator PVNameCopyNoPathConstIterator
DrawingStyle GetDrawingStyle() const
G4bool IsWarning() const
const std::vector< VisAttributesModifier > & GetVisAttributesModifiers() const