Geant4-11
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//
28//
29// John Allison 31st December 1997.
30//
31// Class Description:
32//
33// Parameters associated with the modeling of GEANT4 objects.
34
35#ifndef G4MODELINGPARAMETERS_HH
36#define G4MODELINGPARAMETERS_HH
37
38#include "globals.hh"
39#include "G4VisExtent.hh"
40#include "G4VisAttributes.hh"
41#include "G4VPhysicalVolume.hh"
42
43#include <vector>
44#include <utility>
45
46class G4LogicalVolume;
47class G4VisAttributes;
48class G4VSolid;
50class G4Event;
51
53
54public: // With description
55
56 // Currently requested drawing style.
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 cloud // Draw as a cloud of points
63 };
64
65 // enums and nested class for communicating a modification to the vis
66 // attributes for a specfic touchable defined by PVNameCopyNoPath.
79 };
80
82 public:
83 // Normal constructor
85 : fName(name), fCopyNo(copyNo) {}
86 const G4String& GetName() const {return fName;}
87 G4int GetCopyNo() const {return fCopyNo;}
88 G4bool operator!=(const PVNameCopyNo&) const;
89 G4bool operator==(const PVNameCopyNo& rhs) const {return !operator!=(rhs);}
90 private:
93 };
94 typedef std::vector<PVNameCopyNo> PVNameCopyNoPath;
95 typedef PVNameCopyNoPath::const_iterator PVNameCopyNoPathConstIterator;
96
98 public:
99 // Normal constructor
101 : fpPV(pPV), fCopyNo(copyNo) {}
102 const G4String& GetName() const;
103 const G4VPhysicalVolume* GetPVPointer() const {return fpPV;}
104 G4int GetCopyNo() const {return fCopyNo;}
105 G4bool operator!=(const PVPointerCopyNo&) const;
106 G4bool operator==(const PVPointerCopyNo& rhs) const {return !operator!=(rhs);}
107 private:
110 };
111 typedef std::vector<PVPointerCopyNo> PVPointerCopyNoPath;
112 typedef PVPointerCopyNoPath::const_iterator PVPointerCopyNoPathConstIterator;
113
115 public:
117 (const G4VisAttributes& visAtts,
118 VisAttributesSignifier signifier,
119 const PVNameCopyNoPath& path):
120 fVisAtts(visAtts), fSignifier(signifier), fPVNameCopyNoPath(path) {}
122 {return fVisAtts;}
124 {return fSignifier;}
126 {return fPVNameCopyNoPath;}
128 {fVisAtts = visAtts;}
130 {fSignifier = signifier;}
135 {return !operator!=(rhs);}
136 private:
140 };
141
143
144 G4ModelingParameters (const G4VisAttributes* pDefaultVisAttributes,
145 DrawingStyle drawingStyle,
146 G4bool isCulling,
147 G4bool isCullingInvisible,
148 G4bool isDensityCulling,
149 G4double visibleDensity,
150 G4bool isCullingCovered,
151 G4int noOfSides);
152 // Culling and clipping policy for G4PhysicalVolumeModel.
153
155
156 // Note: uses default assignment operator and copy constructor.
157
159
160 // Get and Is functions...
171 const std::vector<G4double>& GetCBDParameters () const;
178 const G4Event* GetEvent () const;
179 const std::vector<VisAttributesModifier>& GetVisAttributesModifiers() const;
181 const std::vector<PVNameCopyNo>& GetSpecialMeshVolumes() const;
182
183 // Set functions...
185 void SetDefaultVisAttributes (const G4VisAttributes* pDefaultVisAttributes);
194 void SetCBDParameters (const std::vector<G4double>&);
195 void SetExplodeFactor (G4double explodeFactor);
196 void SetExplodeCentre (const G4Point3D& explodeCentre);
197 G4int SetNoOfSides (G4int); // Returns actual number set.
198 void SetSectionSolid (G4DisplacedSolid* pSectionSolid);
199 void SetCutawaySolid (G4DisplacedSolid* pCutawaySolid);
200 void SetEvent (const G4Event* pEvent);
201 void SetVisAttributesModifiers(const std::vector<VisAttributesModifier>&);
203 void SetSpecialMeshVolumes (const std::vector<PVNameCopyNo>&);
204
205 friend std::ostream& operator <<
206 (std::ostream& os, const G4ModelingParameters&);
207
208 friend std::ostream& operator <<
209 (std::ostream& os, const PVNameCopyNoPath&);
210
211 friend std::ostream& operator <<
212 (std::ostream& os, const PVPointerCopyNoPath&);
213
214 friend std::ostream& operator <<
215 (std::ostream& os,
216 const std::vector<VisAttributesModifier>&);
217
218private:
219
220 // Data members...
221 G4bool fWarning; // Print warnings if true.
223 DrawingStyle fDrawingStyle; // Drawing style.
224 G4int fNumberOfCloudPoints; // For drawing in cloud style.
225 // <= 0 means use viewer default.
226 G4bool fCulling; // Culling requested.
227 G4bool fCullInvisible; // Cull (don't Draw) invisible objects.
228 G4bool fDensityCulling; // Density culling requested. If so...
229 G4double fVisibleDensity; // ...density lower than this not drawn.
230 G4bool fCullCovered; // Cull daughters covered by opaque mothers.
231 G4int fCBDAlgorithmNumber; // Colour by density algorithm number.
232 std::vector<G4double> fCBDParameters; // Colour by density parameters.
233 G4double fExplodeFactor; // Explode along radius by this factor...
234 G4Point3D fExplodeCentre; // ...about this centre.
235 G4int fNoOfSides; // ...if polygon approximates circle.
236 G4DisplacedSolid* fpSectionSolid; // For generic section (DCUT).
237 G4DisplacedSolid* fpCutawaySolid; // For generic cutaways.
238 const G4Event* fpEvent; // Event being processed.
239 std::vector<VisAttributesModifier> fVisAttributesModifiers;
240 G4bool fSpecialMeshRendering; // Request special rendering of parameterised volumes
241 std::vector<PVNameCopyNo> fSpecialMeshVolumes; // If empty, all meshes.
242};
243
244std::ostream& operator <<
245(std::ostream& os, const G4ModelingParameters&);
246
247std::ostream& operator <<
248(std::ostream& os, const G4ModelingParameters::PVNameCopyNoPath&);
249
250std::ostream& operator <<
251(std::ostream& os, const G4ModelingParameters::PVPointerCopyNoPath&);
252
253std::ostream& operator <<
254(std::ostream& os,
255 const std::vector<G4ModelingParameters::VisAttributesModifier>&);
256
258
259#endif
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4bool operator==(const PVNameCopyNo &rhs) const
PVNameCopyNo(G4String name, G4int copyNo)
G4bool operator!=(const PVNameCopyNo &) const
G4bool operator!=(const PVPointerCopyNo &) const
PVPointerCopyNo(G4VPhysicalVolume *pPV, G4int copyNo)
const G4VPhysicalVolume * GetPVPointer() const
G4bool operator==(const PVPointerCopyNo &rhs) const
G4bool operator==(const VisAttributesModifier &rhs) const
const PVNameCopyNoPath & GetPVNameCopyNoPath() const
void SetVisAttributes(const G4VisAttributes &visAtts)
VisAttributesModifier(const G4VisAttributes &visAtts, VisAttributesSignifier signifier, const PVNameCopyNoPath &path)
void SetPVNameCopyNoPath(const PVNameCopyNoPath &PVNameCopyNoPath)
VisAttributesSignifier GetVisAttributesSignifier() const
const G4VisAttributes & GetVisAttributes() const
void SetVisAttributesSignifier(VisAttributesSignifier signifier)
G4bool operator!=(const VisAttributesModifier &) const
G4DisplacedSolid * fpSectionSolid
G4bool IsWarning() const
std::vector< G4double > fCBDParameters
void SetCBDParameters(const std::vector< G4double > &)
const G4VisAttributes * GetDefaultVisAttributes() const
const std::vector< VisAttributesModifier > & GetVisAttributesModifiers() const
const G4Event * GetEvent() const
void SetWarning(G4bool)
const G4Point3D & GetExplodeCentre() const
G4DisplacedSolid * fpCutawaySolid
const G4VisAttributes * fpDefaultVisAttributes
PVNameCopyNoPath::const_iterator PVNameCopyNoPathConstIterator
void SetNumberOfCloudPoints(G4int)
PVPointerCopyNoPath::const_iterator PVPointerCopyNoPathConstIterator
std::vector< PVNameCopyNo > PVNameCopyNoPath
G4int GetNumberOfCloudPoints() const
G4double GetVisibleDensity() const
G4bool IsCullingInvisible() const
const std::vector< PVNameCopyNo > & GetSpecialMeshVolumes() const
std::vector< PVPointerCopyNo > PVPointerCopyNoPath
void SetCBDAlgorithmNumber(G4int)
void SetExplodeFactor(G4double explodeFactor)
std::vector< VisAttributesModifier > fVisAttributesModifiers
void SetDrawingStyle(DrawingStyle)
void SetVisAttributesModifiers(const std::vector< VisAttributesModifier > &)
void SetExplodeCentre(const G4Point3D &explodeCentre)
void SetCullingCovered(G4bool)
G4bool IsExplode() const
G4bool IsCulling() const
const std::vector< G4double > & GetCBDParameters() const
G4int GetNoOfSides() const
G4bool IsDensityCulling() const
G4bool IsSpecialMeshRendering() const
void SetDefaultVisAttributes(const G4VisAttributes *pDefaultVisAttributes)
void SetCutawaySolid(G4DisplacedSolid *pCutawaySolid)
DrawingStyle GetDrawingStyle() const
void SetCulling(G4bool)
G4DisplacedSolid * GetSectionSolid() const
G4double GetExplodeFactor() const
void SetSectionSolid(G4DisplacedSolid *pSectionSolid)
void SetEvent(const G4Event *pEvent)
G4bool operator!=(const G4ModelingParameters &) const
G4DisplacedSolid * GetCutawaySolid() const
G4bool IsCullingCovered() const
void SetCullingInvisible(G4bool)
G4int GetCBDAlgorithmNumber() const
void SetVisibleDensity(G4double)
void SetSpecialMeshVolumes(const std::vector< PVNameCopyNo > &)
std::vector< PVNameCopyNo > fSpecialMeshVolumes
void SetSpecialMeshRendering(G4bool)
void SetDensityCulling(G4bool)
const char * name(G4int ptype)