Geant4  10.01.p03
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 81056 2014-05-20 09:02:16Z 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:
89  };
90  typedef std::vector<PVNameCopyNo> PVNameCopyNoPath;
91  typedef PVNameCopyNoPath::const_iterator PVNameCopyNoPathConstIterator;
92 
94  public:
96  (const G4VisAttributes& visAtts,
97  VisAttributesSignifier signifier,
98  const PVNameCopyNoPath& path):
99  fVisAtts(visAtts), fSignifier(signifier), fPVNameCopyNoPath(path) {}
101  (const G4VisAttributes& visAtts,
102  VisAttributesSignifier signifier,
103  const std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>& path);
105  {return fVisAtts;}
107  {return fSignifier;}
108  const PVNameCopyNoPath& GetPVNameCopyNoPath() const
109  {return fPVNameCopyNoPath;}
112  {return !operator!=(rhs);}
113  private:
116  PVNameCopyNoPath fPVNameCopyNoPath;
117  };
118 
120 
121  G4ModelingParameters (const G4VisAttributes* pDefaultVisAttributes,
122  DrawingStyle drawingStyle,
123  G4bool isCulling,
124  G4bool isCullingInvisible,
125  G4bool isDensityCulling,
126  G4double visibleDensity,
127  G4bool isCullingCovered,
128  G4int noOfSides);
129  // Culling and clipping policy for G4PhysicalVolumeModel.
130 
132 
133  // Note: uses default assignment operator and copy constructor.
134 
136 
137  // Get and Is functions...
138  G4bool IsWarning () const;
140  DrawingStyle GetDrawingStyle () const;
141  G4bool IsCulling () const;
142  G4bool IsCullingInvisible () const;
143  G4bool IsDensityCulling () const;
144  G4double GetVisibleDensity () const;
145  G4bool IsCullingCovered () const;
146  G4bool IsExplode () const;
147  G4double GetExplodeFactor () const;
148  const G4Point3D& GetExplodeCentre () const;
149  G4int GetNoOfSides () const;
150  G4VSolid* GetSectionSolid () const;
151  G4VSolid* GetCutawaySolid () const;
152  const G4Event* GetEvent () const;
153  const std::vector<VisAttributesModifier>& GetVisAttributesModifiers() const;
154 
155  // Set functions...
156  void SetWarning (G4bool);
157  void SetDefaultVisAttributes (const G4VisAttributes* pDefaultVisAttributes);
159  void SetCulling (G4bool);
161  void SetDensityCulling (G4bool);
163  void SetCullingCovered (G4bool);
164  void SetExplodeFactor (G4double explodeFactor);
165  void SetExplodeCentre (const G4Point3D& explodeCentre);
166  G4int SetNoOfSides (G4int); // Returns actual number set.
167  void SetSectionSolid (G4VSolid* pSectionSolid);
168  void SetCutawaySolid (G4VSolid* pCutawaySolid);
169  void SetEvent (const G4Event* pEvent);
170  void SetVisAttributesModifiers(const std::vector<VisAttributesModifier>&);
171 
172  friend std::ostream& operator <<
173  (std::ostream& os, const G4ModelingParameters&);
174 
175  friend std::ostream& operator <<
176  (std::ostream& os, const PVNameCopyNoPath&);
177 
178  friend std::ostream& operator <<
179  (std::ostream& os,
180  const std::vector<VisAttributesModifier>&);
181 
182 private:
183 
184  // Data members...
185  G4bool fWarning; // Print warnings if true.
187  DrawingStyle fDrawingStyle; // Drawing style.
188  G4bool fCulling; // Culling requested.
189  G4bool fCullInvisible; // Cull (don't Draw) invisible objects.
190  G4bool fDensityCulling; // Density culling requested. If so...
191  G4double fVisibleDensity; // ...density lower than this not drawn.
192  G4bool fCullCovered; // Cull daughters covered by opaque mothers.
193  G4double fExplodeFactor; // Explode along radius by this factor...
194  G4Point3D fExplodeCentre; // ...about this centre.
195  G4int fNoOfSides; // ...if polygon approximates circle.
196  G4VSolid* fpSectionSolid; // For generic section (DCUT).
197  G4VSolid* fpCutawaySolid; // For generic cutaways.
198  const G4Event* fpEvent; // Event being processed.
199  std::vector<VisAttributesModifier> fVisAttributesModifiers;
200 };
201 
202 std::ostream& operator <<
203 (std::ostream& os, const G4ModelingParameters&);
204 
205 std::ostream& operator <<
206 (std::ostream& os, const G4ModelingParameters::PVNameCopyNoPath&);
207 
208 std::ostream& operator <<
209 (std::ostream& os,
210  const std::vector<G4ModelingParameters::VisAttributesModifier>&);
211 
212 #include "G4ModelingParameters.icc"
213 
214 #endif
G4VSolid * GetSectionSolid() const
const G4VisAttributes & GetVisAttributes() const
const G4Point3D & GetExplodeCentre() const
const G4VisAttributes * GetDefaultVisAttributes() const
G4String name
Definition: TRTMaterials.hh:40
void SetVisibleDensity(G4double)
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:35
G4bool IsExplode() const
G4VSolid * GetCutawaySolid() const
G4bool IsDensityCulling() const
int G4int
Definition: G4Types.hh:78
const G4VisAttributes * fpDefaultVisAttributes
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
std::vector< VisAttributesModifier > fVisAttributesModifiers
G4bool IsCullingCovered() const
void SetCulling(G4bool)
VisAttributesModifier(const G4VisAttributes &visAtts, VisAttributesSignifier signifier, const PVNameCopyNoPath &path)
G4bool IsCullingInvisible() const
void SetSectionSolid(G4VSolid *pSectionSolid)
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