Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VisAttributes Class Reference

#include <G4VisAttributes.hh>

Public Types

enum  LineStyle { unbroken , dashed , dotted }
 
enum  ForcedDrawingStyle { wireframe , solid , cloud }
 

Public Member Functions

 G4VisAttributes ()
 
 G4VisAttributes (G4bool visibility)
 
 G4VisAttributes (const G4Colour &colour)
 
 G4VisAttributes (G4bool visibility, const G4Colour &colour)
 
 G4VisAttributes (const G4VisAttributes &)=default
 
 ~G4VisAttributes ()=default
 
G4VisAttributesoperator= (const G4VisAttributes &)
 
G4bool operator!= (const G4VisAttributes &a) const
 
G4bool operator== (const G4VisAttributes &a) const
 
void SetVisibility (G4bool=true)
 
void SetDaughtersInvisible (G4bool=true)
 
void SetColour (const G4Colour &)
 
void SetColor (const G4Color &)
 
void SetColour (G4double red, G4double green, G4double blue, G4double alpha=1.)
 
void SetColor (G4double red, G4double green, G4double blue, G4double alpha=1.)
 
void SetLineStyle (LineStyle)
 
void SetLineWidth (G4double)
 
void SetForceWireframe (G4bool=true)
 
void SetForceSolid (G4bool=true)
 
void SetForceCloud (G4bool=true)
 
void SetForceNumberOfCloudPoints (G4int nPoints)
 
void SetForceAuxEdgeVisible (G4bool=true)
 
void SetForceLineSegmentsPerCircle (G4int nSegments)
 
void SetStartTime (G4double)
 
void SetEndTime (G4double)
 
void SetAttValues (const std::vector< G4AttValue > *)
 
void SetAttDefs (const std::map< G4String, G4AttDef > *)
 
G4bool IsVisible () const
 
G4bool IsDaughtersInvisible () const
 
const G4ColourGetColour () const
 
const G4ColorGetColor () const
 
LineStyle GetLineStyle () const
 
G4double GetLineWidth () const
 
G4bool IsForceDrawingStyle () const
 
ForcedDrawingStyle GetForcedDrawingStyle () const
 
G4int GetForcedNumberOfCloudPoints () const
 
G4bool IsForceAuxEdgeVisible () const
 
G4bool IsForcedAuxEdgeVisible () const
 
G4bool IsForceLineSegmentsPerCircle () const
 
G4int GetForcedLineSegmentsPerCircle () const
 
G4double GetStartTime () const
 
G4double GetEndTime () const
 
const std::vector< G4AttValue > * CreateAttValues () const
 
const std::map< G4String, G4AttDef > * GetAttDefs () const
 

Static Public Member Functions

static const G4VisAttributesGetInvisible ()
 
static G4int GetMinLineSegmentsPerCircle ()
 

Static Public Attributes

static constexpr G4int fMinLineSegmentsPerCircle = 3
 
static constexpr G4double fVeryLongTime = 1.e100 * CLHEP::ns
 

Friends

std::ostream & operator<< (std::ostream &os, const G4VisAttributes &a)
 

Detailed Description

Definition at line 69 of file G4VisAttributes.hh.

Member Enumeration Documentation

◆ ForcedDrawingStyle

Enumerator
wireframe 
solid 
cloud 

Definition at line 76 of file G4VisAttributes.hh.

◆ LineStyle

Enumerator
unbroken 
dashed 
dotted 

Definition at line 75 of file G4VisAttributes.hh.

Constructor & Destructor Documentation

◆ G4VisAttributes() [1/5]

G4VisAttributes::G4VisAttributes ( )

Definition at line 36 of file G4VisAttributes.cc.

36 :
37fVisible (true),
38fDaughtersInvisible (false),
39fLineStyle (unbroken),
40fLineWidth (1.),
41fForceDrawingStyle (false),
42fForcedStyle (wireframe),
43fForcedNumberOfCloudPoints (0), // <= 0 means under control of viewer
44fForceAuxEdgeVisible (false),
45fForcedAuxEdgeVisible(false),
46fForcedLineSegmentsPerCircle (0), // <=0 means not forced.
47fStartTime (-fVeryLongTime),
48fEndTime (fVeryLongTime),
49fAttValues (nullptr),
50fAttDefs (nullptr)
51{}
static constexpr G4double fVeryLongTime

Referenced by GetInvisible().

◆ G4VisAttributes() [2/5]

G4VisAttributes::G4VisAttributes ( G4bool visibility)

Definition at line 53 of file G4VisAttributes.cc.

53 :
54fVisible (visibility),
55fDaughtersInvisible (false),
56
57fLineStyle (unbroken),
58fLineWidth (1.),
59fForceDrawingStyle (false),
60fForcedStyle (wireframe),
61fForcedNumberOfCloudPoints (0), // <= 0 means under control of viewer
62fForceAuxEdgeVisible (false),
63fForcedAuxEdgeVisible(false),
64fForcedLineSegmentsPerCircle (0), // <=0 means not forced.
65fStartTime (-fVeryLongTime),
66fEndTime (fVeryLongTime),
67fAttValues (nullptr),
68fAttDefs (nullptr)
69{}

◆ G4VisAttributes() [3/5]

G4VisAttributes::G4VisAttributes ( const G4Colour & colour)

Definition at line 71 of file G4VisAttributes.cc.

71 :
72fVisible (true),
73fDaughtersInvisible (false),
74fColour (colour),
75fLineStyle (unbroken),
76fLineWidth (1.),
77fForceDrawingStyle (false),
78fForcedStyle (wireframe),
79fForcedNumberOfCloudPoints (0), // <= 0 means under control of viewer
80fForceAuxEdgeVisible (false),
81fForcedAuxEdgeVisible(false),
82fForcedLineSegmentsPerCircle (0), // <=0 means not forced.
83fStartTime (-fVeryLongTime),
84fEndTime (fVeryLongTime),
85fAttValues (nullptr),
86fAttDefs (nullptr)
87{}

◆ G4VisAttributes() [4/5]

G4VisAttributes::G4VisAttributes ( G4bool visibility,
const G4Colour & colour )

Definition at line 89 of file G4VisAttributes.cc.

90 :
91fVisible (visibility),
92fDaughtersInvisible (false),
93fColour (colour),
94fLineStyle (unbroken),
95fLineWidth (1.),
96fForceDrawingStyle (false),
97fForcedStyle (wireframe),
98fForcedNumberOfCloudPoints (0), // <= 0 means under control of viewer
99fForceAuxEdgeVisible (false),
100fForcedAuxEdgeVisible(false),
101fForcedLineSegmentsPerCircle (0), // <=0 means not forced.
102fStartTime (-fVeryLongTime),
103fEndTime (fVeryLongTime),
104fAttValues (nullptr),
105fAttDefs (nullptr)
106{}

◆ G4VisAttributes() [5/5]

G4VisAttributes::G4VisAttributes ( const G4VisAttributes & )
default

◆ ~G4VisAttributes()

G4VisAttributes::~G4VisAttributes ( )
default

Member Function Documentation

◆ CreateAttValues()

const std::vector< G4AttValue > * G4VisAttributes::CreateAttValues ( ) const

Definition at line 195 of file G4VisAttributes.cc.

195 {
196 // Create an expendable copy on the heap...
197 return new std::vector<G4AttValue>(*fAttValues);
198}

Referenced by G4VSceneHandler::LoadAtts().

◆ GetAttDefs()

const std::map< G4String, G4AttDef > * G4VisAttributes::GetAttDefs ( ) const

◆ GetColor()

const G4Color & G4VisAttributes::GetColor ( ) const

◆ GetColour()

◆ GetEndTime()

G4double G4VisAttributes::GetEndTime ( ) const

◆ GetForcedDrawingStyle()

G4VisAttributes::ForcedDrawingStyle G4VisAttributes::GetForcedDrawingStyle ( ) const

◆ GetForcedLineSegmentsPerCircle()

G4int G4VisAttributes::GetForcedLineSegmentsPerCircle ( ) const

◆ GetForcedNumberOfCloudPoints()

G4int G4VisAttributes::GetForcedNumberOfCloudPoints ( ) const

◆ GetInvisible()

const G4VisAttributes & G4VisAttributes::GetInvisible ( )
static

Definition at line 135 of file G4VisAttributes.cc.

135 {
136 static const G4VisAttributes invisible = G4VisAttributes(false);
137 return invisible;
138}

Referenced by G4BuildGeom(), and G4GDMLReadStructure::GetWorldVolume().

◆ GetLineStyle()

◆ GetLineWidth()

◆ GetMinLineSegmentsPerCircle()

static G4int G4VisAttributes::GetMinLineSegmentsPerCircle ( )
static

◆ GetStartTime()

G4double G4VisAttributes::GetStartTime ( ) const

◆ IsDaughtersInvisible()

◆ IsForceAuxEdgeVisible()

◆ IsForcedAuxEdgeVisible()

G4bool G4VisAttributes::IsForcedAuxEdgeVisible ( ) const

Definition at line 190 of file G4VisAttributes.cc.

190 {
191 if (fForceAuxEdgeVisible) return fForcedAuxEdgeVisible;
192 return false;
193}

Referenced by G4PhysicalVolumeModel::DescribeAndDescend(), G4VSceneHandler::GetAuxEdgeVisible(), and G4ViewParameters::TouchableCommands().

◆ IsForceDrawingStyle()

◆ IsForceLineSegmentsPerCircle()

G4bool G4VisAttributes::IsForceLineSegmentsPerCircle ( ) const

◆ IsVisible()

◆ operator!=()

G4bool G4VisAttributes::operator!= ( const G4VisAttributes & a) const

Definition at line 275 of file G4VisAttributes.cc.

275 {
276
277 if (
278 (fVisible != a.fVisible) ||
279 (fDaughtersInvisible != a.fDaughtersInvisible) ||
280 (fColour != a.fColour) ||
281 (fLineStyle != a.fLineStyle) ||
282 (fLineWidth != a.fLineWidth) ||
283 (fForceDrawingStyle != a.fForceDrawingStyle) ||
284 (fForceAuxEdgeVisible!= a.fForceAuxEdgeVisible) ||
285 (fForcedLineSegmentsPerCircle != a.fForcedLineSegmentsPerCircle) ||
286 (fStartTime != a.fStartTime) ||
287 (fEndTime != a.fEndTime) ||
288 (fAttValues != a.fAttValues) ||
289 (fAttDefs != a.fAttDefs)
290 )
291 return true;
292
293 if (fForceDrawingStyle) {
294 if (fForcedStyle != a.fForcedStyle) return true;
295 }
296
297 if (fForceAuxEdgeVisible) {
298 if (fForcedAuxEdgeVisible != a.fForcedAuxEdgeVisible) return true;
299 }
300
301 return false;
302}

Referenced by operator==().

◆ operator=()

G4VisAttributes & G4VisAttributes::operator= ( const G4VisAttributes & rhs)

Definition at line 109 of file G4VisAttributes.cc.

110{
111 if (&rhs == this) return *this;
112 fVisible = rhs.fVisible;
113 fDaughtersInvisible = rhs.fDaughtersInvisible;
114 fColour = rhs.fColour;
115 fLineStyle = rhs.fLineStyle;
116 fLineWidth = rhs.fLineWidth;
117 fForceDrawingStyle = rhs.fForceDrawingStyle;
118 fForcedStyle = rhs.fForcedStyle;
119 fForcedNumberOfCloudPoints = rhs.fForcedNumberOfCloudPoints;
120 fForceAuxEdgeVisible = rhs.fForceAuxEdgeVisible;
121 fForcedAuxEdgeVisible = rhs.fForcedAuxEdgeVisible;
122 fForcedLineSegmentsPerCircle = rhs.fForcedLineSegmentsPerCircle;
123 fStartTime = rhs.fStartTime;
124 fEndTime = rhs.fEndTime;
125 // AttValues are created afresh for each object (using the
126 // CreateAttValues message), but deletion is the responsibility of
127 // the creator. So just copy pointer.
128 fAttValues = rhs.fAttValues;
129 // AttDefs, if any, belong to the object from which they were obtained
130 // (with a GetAttDefs message), so just copy pointer.
131 fAttDefs = rhs.fAttDefs;
132 return *this;
133}

◆ operator==()

G4bool G4VisAttributes::operator== ( const G4VisAttributes & a) const

Definition at line 304 of file G4VisAttributes.cc.

304 {
306}
G4bool operator!=(const G4VisAttributes &a) const

◆ SetAttDefs()

void G4VisAttributes::SetAttDefs ( const std::map< G4String, G4AttDef > * )

◆ SetAttValues()

void G4VisAttributes::SetAttValues ( const std::vector< G4AttValue > * )

◆ SetColor() [1/2]

void G4VisAttributes::SetColor ( const G4Color & )

◆ SetColor() [2/2]

void G4VisAttributes::SetColor ( G4double red,
G4double green,
G4double blue,
G4double alpha = 1. )

◆ SetColour() [1/2]

◆ SetColour() [2/2]

void G4VisAttributes::SetColour ( G4double red,
G4double green,
G4double blue,
G4double alpha = 1. )

◆ SetDaughtersInvisible()

void G4VisAttributes::SetDaughtersInvisible ( G4bool = true)

◆ SetEndTime()

void G4VisAttributes::SetEndTime ( G4double )

◆ SetForceAuxEdgeVisible()

void G4VisAttributes::SetForceAuxEdgeVisible ( G4bool visibility = true)

◆ SetForceCloud()

void G4VisAttributes::SetForceCloud ( G4bool force = true)

Definition at line 158 of file G4VisAttributes.cc.

158 {
159 if (force) {
160 fForceDrawingStyle = true;
161 fForcedStyle = G4VisAttributes::cloud;
162 } else {
163 fForceDrawingStyle = false;
164 }
165}

Referenced by G4PhysicalVolumeModel::DescribeAndDescend(), G4VisCommandGeometrySetForceCloudFunction::operator()(), and G4VisCommandsTouchableSet::SetNewValue().

◆ SetForceLineSegmentsPerCircle()

void G4VisAttributes::SetForceLineSegmentsPerCircle ( G4int nSegments)

Definition at line 200 of file G4VisAttributes.cc.

200 {
201 const G4int nSegmentsMin = fMinLineSegmentsPerCircle;
202 if (nSegments < nSegmentsMin) {
203 nSegments = nSegmentsMin;
204 G4cout <<
205 "G4VisAttributes::SetForcedLineSegmentsPerCircle: attempt to set the"
206 "\nnumber of line segments per circle < " << nSegmentsMin
207 << "; forced to " << nSegments << G4endl;
208 }
209 fForcedLineSegmentsPerCircle = nSegments;
210}
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
static constexpr G4int fMinLineSegmentsPerCircle

Referenced by G4PhysicalVolumeModel::DescribeAndDescend(), and G4VisCommandsTouchableSet::SetNewValue().

◆ SetForceNumberOfCloudPoints()

void G4VisAttributes::SetForceNumberOfCloudPoints ( G4int nPoints)

Definition at line 167 of file G4VisAttributes.cc.

167 {
168 fForcedNumberOfCloudPoints = nPoints;
169 if (nPoints <= 0) {
170 G4cout <<
171 "G4VisAttributes::SetForceNumberOfCloudPoints: number of cloud points"
172 " set to " << fForcedNumberOfCloudPoints << '.' <<
173 "\n This means the viewer default will be used, typically controlled by"
174 "\n \"/vis/viewer/set/numberOfCloudPoints\""
175 << G4endl;
176 }
177}

Referenced by G4PhysicalVolumeModel::DescribeAndDescend(), G4VisCommandGeometrySetForceCloudFunction::operator()(), and G4VisCommandsTouchableSet::SetNewValue().

◆ SetForceSolid()

void G4VisAttributes::SetForceSolid ( G4bool force = true)

◆ SetForceWireframe()

void G4VisAttributes::SetForceWireframe ( G4bool force = true)

Definition at line 140 of file G4VisAttributes.cc.

140 {
141 if (force) {
142 fForceDrawingStyle = true;
143 fForcedStyle = G4VisAttributes::wireframe;
144 } else {
145 fForceDrawingStyle = false;
146 }
147}

Referenced by G4PhysicalVolumeModel::DescribeAndDescend(), G4LogicalVolumeModel::DescribeSolid(), G4VisCommandsTouchable::SetNewValue(), G4VisCommandsTouchableSet::SetNewValue(), and G4VSceneHandler::StandardSpecialMeshRendering().

◆ SetLineStyle()

void G4VisAttributes::SetLineStyle ( LineStyle )

◆ SetLineWidth()

◆ SetStartTime()

void G4VisAttributes::SetStartTime ( G4double )

◆ SetVisibility()

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const G4VisAttributes & a )
friend

Definition at line 212 of file G4VisAttributes.cc.

213{
214 os << std::defaultfloat;
215 os << "G4VisAttributes: ";
216 if (!a.fVisible) os << "in";
217 os << "visible, daughters ";
218 if (a.fDaughtersInvisible) os << "in";
219 os << "visible, colour: " << a.fColour;
220 os << "\n linestyle: ";
221 switch (a.fLineStyle) {
223 os << "solid"; break;
225 os << "dashed"; break;
226 case G4VisAttributes::dotted: os << "dotted"; break;
227 default: os << "unrecognised"; break;
228 }
229 os << ", line width: " << a.fLineWidth;
230 os << ", min line segments per circle: " << a.GetMinLineSegmentsPerCircle();
231 os << "\n drawing style: ";
232 if (a.fForceDrawingStyle) {
233 os << "forced to ";
234 switch (a.fForcedStyle) {
236 os << "wireframe"; break;
238 os << "solid"; break;
239 default: os << "unrecognised"; break;
240 }
241 }
242 else {
243 os << "not forced";
244 }
245 os << ", auxiliary edge visibility: ";
246 if (a.fForceAuxEdgeVisible) {
247 os << "forced to ";
248 if (!a.fForcedAuxEdgeVisible) {
249 os << "not ";
250 }
251 os << "visible";
252 } else {
253 os << "not forced";
254 }
255 os << "\n line segments per circle: ";
256 if (a.fForcedLineSegmentsPerCircle > 0) {
257 os << "forced to " << a.fForcedLineSegmentsPerCircle;
258 } else {
259 os << "not forced.";
260 }
261 os << "\n time range: (" << a.fStartTime << ',' << a.fEndTime << ')';
262 os << "\n G4AttValue pointer is ";
263 if (a.fAttValues != nullptr) {
264 os << "non-";
265 }
266 os << "zero";
267 os << ", G4AttDef pointer is ";
268 if (a.fAttDefs != nullptr) {
269 os << "non-";
270 }
271 os << "zero";
272 return os;
273}
static G4int GetMinLineSegmentsPerCircle()

Member Data Documentation

◆ fMinLineSegmentsPerCircle

G4int G4VisAttributes::fMinLineSegmentsPerCircle = 3
staticconstexpr

Definition at line 138 of file G4VisAttributes.hh.

Referenced by SetForceLineSegmentsPerCircle().

◆ fVeryLongTime

G4double G4VisAttributes::fVeryLongTime = 1.e100 * CLHEP::ns
staticconstexpr

The documentation for this class was generated from the following files: