Geant4  10.00.p01
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 77479 2013-11-25 10:01:22Z 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  class PVNameCopyNo {
78  public:
80  fName(name), fCopyNo(copyNo) {}
81  const G4String& GetName() const {return fName;}
82  G4int GetCopyNo() const {return fCopyNo;}
83  G4bool operator!=(const PVNameCopyNo&) const;
84  G4bool operator==(const PVNameCopyNo& rhs) const {return !operator!=(rhs);}
85  private:
88  };
89  typedef std::vector<PVNameCopyNo> PVNameCopyNoPath;
90  typedef PVNameCopyNoPath::const_iterator PVNameCopyNoPathConstIterator;
92  public:
94  (const G4VisAttributes& visAtts,
95  VisAttributesSignifier signifier,
96  const PVNameCopyNoPath& path):
97  fVisAtts(visAtts), fSignifier(signifier), fPVNameCopyNoPath(path) {}
99  (const G4VisAttributes& visAtts,
100  VisAttributesSignifier signifier,
101  const std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>& path);
103  {return fVisAtts;}
105  {return fSignifier;}
106  const PVNameCopyNoPath& GetPVNameCopyNoPath() const
107  {return fPVNameCopyNoPath;}
110  {return !operator!=(rhs);}
111  private:
114  PVNameCopyNoPath fPVNameCopyNoPath;
115  };
116 
118 
119  G4ModelingParameters (const G4VisAttributes* pDefaultVisAttributes,
120  DrawingStyle drawingStyle,
121  G4bool isCulling,
122  G4bool isCullingInvisible,
123  G4bool isDensityCulling,
124  G4double visibleDensity,
125  G4bool isCullingCovered,
126  G4int noOfSides);
127  // Culling and clipping policy for G4PhysicalVolumeModel.
128 
130 
131  // Note: uses default assignment operator and copy constructor.
132 
134 
135  // Get and Is functions...
136  G4bool IsWarning () const;
138  DrawingStyle GetDrawingStyle () const;
139  G4bool IsCulling () const;
140  G4bool IsCullingInvisible () const;
141  G4bool IsDensityCulling () const;
142  G4double GetVisibleDensity () const;
143  G4bool IsCullingCovered () const;
144  G4bool IsExplode () const;
145  G4double GetExplodeFactor () const;
146  const G4Point3D& GetExplodeCentre () const;
147  G4int GetNoOfSides () const;
148  G4VSolid* GetSectionSolid () const;
149  G4VSolid* GetCutawaySolid () const;
150  const G4Event* GetEvent () const;
151  const std::vector<VisAttributesModifier>& GetVisAttributesModifiers() const;
152 
153  // Set functions...
154  void SetWarning (G4bool);
155  void SetDefaultVisAttributes (const G4VisAttributes* pDefaultVisAttributes);
157  void SetCulling (G4bool);
159  void SetDensityCulling (G4bool);
161  void SetCullingCovered (G4bool);
162  void SetExplodeFactor (G4double explodeFactor);
163  void SetExplodeCentre (const G4Point3D& explodeCentre);
164  G4int SetNoOfSides (G4int); // Returns actual number set.
165  void SetSectionSolid (G4VSolid* pSectionSolid);
166  void SetCutawaySolid (G4VSolid* pCutawaySolid);
167  void SetEvent (const G4Event* pEvent);
168  void SetVisAttributesModifiers(const std::vector<VisAttributesModifier>&);
169 
170  friend std::ostream& operator <<
171  (std::ostream& os, const G4ModelingParameters&);
172 
173  friend std::ostream& operator <<
174  (std::ostream& os, const PVNameCopyNoPath&);
175 
176  friend std::ostream& operator <<
177  (std::ostream& os,
178  const std::vector<VisAttributesModifier>&);
179 
180 private:
181 
182  // Data members...
183  G4bool fWarning; // Print warnings if true.
185  DrawingStyle fDrawingStyle; // Drawing style.
186  G4bool fCulling; // Culling requested.
187  G4bool fCullInvisible; // Cull (don't Draw) invisible objects.
188  G4bool fDensityCulling; // Density culling requested. If so...
189  G4double fVisibleDensity; // ...density lower than this not drawn.
190  G4bool fCullCovered; // Cull daughters covered by opaque mothers.
191  G4double fExplodeFactor; // Explode along radius by this factor...
192  G4Point3D fExplodeCentre; // ...about this centre.
193  G4int fNoOfSides; // ...if polygon approximates circle.
194  G4VSolid* fpSectionSolid; // For generic section (DCUT).
195  G4VSolid* fpCutawaySolid; // For generic cutaways.
196  const G4Event* fpEvent; // Event being processed.
197  std::vector<VisAttributesModifier> fVisAttributesModifiers;
198 };
199 
200 std::ostream& operator <<
201 (std::ostream& os, const G4ModelingParameters&);
202 
203 std::ostream& operator <<
204 (std::ostream& os, const G4ModelingParameters::PVNameCopyNoPath&);
205 
206 std::ostream& operator <<
207 (std::ostream& os,
208  const std::vector<G4ModelingParameters::VisAttributesModifier>&);
209 
210 #include "G4ModelingParameters.icc"
211 
212 #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