Geant4 10.7.0
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 &)
 
 ~G4VisAttributes ()
 
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 const G4VisAttributes Invisible = G4VisAttributes (false)
 
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),
39fColour (G4Colour ()),
40fLineStyle (unbroken),
41fLineWidth (1.),
42fForceDrawingStyle (false),
43fForcedStyle (wireframe),
44fForcedNumberOfCloudPoints (0), // <= 0 means under control of viewer
45fForceAuxEdgeVisible (false),
46fForcedAuxEdgeVisible(false),
47fForcedLineSegmentsPerCircle (0), // <=0 means not forced.
48fStartTime (-fVeryLongTime),
49fEndTime (fVeryLongTime),
50fAttValues (0),
51fAttDefs (0)
52{}
static constexpr G4double fVeryLongTime

Referenced by GetInvisible().

◆ G4VisAttributes() [2/5]

G4VisAttributes::G4VisAttributes ( G4bool  visibility)

Definition at line 54 of file G4VisAttributes.cc.

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

◆ G4VisAttributes() [3/5]

G4VisAttributes::G4VisAttributes ( const G4Colour colour)

Definition at line 72 of file G4VisAttributes.cc.

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

◆ G4VisAttributes() [4/5]

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

Definition at line 90 of file G4VisAttributes.cc.

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

◆ G4VisAttributes() [5/5]

G4VisAttributes::G4VisAttributes ( const G4VisAttributes va)

Definition at line 109 of file G4VisAttributes.cc.

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

◆ ~G4VisAttributes()

G4VisAttributes::~G4VisAttributes ( )

Definition at line 132 of file G4VisAttributes.cc.

133{}

Member Function Documentation

◆ CreateAttValues()

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

Definition at line 225 of file G4VisAttributes.cc.

225 {
226 // Create an expendable copy on the heap...
227 return new std::vector<G4AttValue>(*fAttValues);
228}

Referenced by G4VSceneHandler::LoadAtts(), and G4XXXStoredSceneHandler::PreAddSolid().

◆ 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

Definition at line 215 of file G4VisAttributes.cc.

215 {
216 if (fForceDrawingStyle) return fForcedStyle;
217 else return G4VisAttributes::wireframe;
218}

Referenced by G4PhysicalVolumeModel::DescribeAndDescend(), G4ViewParameters::TouchableCommands(), G4RTSteppingAction::UserSteppingAction(), and G4TheRayTracer::ValidColour().

◆ GetForcedLineSegmentsPerCircle()

◆ GetForcedNumberOfCloudPoints()

G4int G4VisAttributes::GetForcedNumberOfCloudPoints ( ) const

◆ GetInvisible()

const G4VisAttributes & G4VisAttributes::GetInvisible ( )
static

Definition at line 166 of file G4VisAttributes.cc.

166 {
167 static const G4VisAttributes invisible = G4VisAttributes(false);
168 return invisible;
169}

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

◆ GetLineStyle()

LineStyle G4VisAttributes::GetLineStyle ( ) const

◆ GetLineWidth()

◆ GetMinLineSegmentsPerCircle()

static G4int G4VisAttributes::GetMinLineSegmentsPerCircle ( )
static

◆ GetStartTime()

G4double G4VisAttributes::GetStartTime ( ) const

◆ IsDaughtersInvisible()

G4bool G4VisAttributes::IsDaughtersInvisible ( ) const

◆ IsForceAuxEdgeVisible()

◆ IsForcedAuxEdgeVisible()

G4bool G4VisAttributes::IsForcedAuxEdgeVisible ( ) const

Definition at line 220 of file G4VisAttributes.cc.

220 {
221 if (fForceAuxEdgeVisible) return fForcedAuxEdgeVisible;
222 else return false;
223}

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 304 of file G4VisAttributes.cc.

304 {
305
306 if (
307 (fVisible != a.fVisible) ||
308 (fDaughtersInvisible != a.fDaughtersInvisible) ||
309 (fColour != a.fColour) ||
310 (fLineStyle != a.fLineStyle) ||
311 (fLineWidth != a.fLineWidth) ||
312 (fForceDrawingStyle != a.fForceDrawingStyle) ||
313 (fForceAuxEdgeVisible!= a.fForceAuxEdgeVisible) ||
314 (fForcedLineSegmentsPerCircle != a.fForcedLineSegmentsPerCircle) ||
315 (fStartTime != a.fStartTime) ||
316 (fEndTime != a.fEndTime) ||
317 (fAttValues != a.fAttValues) ||
318 (fAttDefs != a.fAttDefs)
319 )
320 return true;
321
322 if (fForceDrawingStyle) {
323 if (fForcedStyle != a.fForcedStyle) return true;
324 }
325
326 if (fForceAuxEdgeVisible) {
327 if (fForcedAuxEdgeVisible != a.fForcedAuxEdgeVisible) return true;
328 }
329
330 return false;
331}

Referenced by operator==().

◆ operator=()

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

Definition at line 135 of file G4VisAttributes.cc.

136{
137 if (&rhs == this) return *this;
138 fVisible = rhs.fVisible;
139 fDaughtersInvisible = rhs.fDaughtersInvisible;
140 fColour = rhs.fColour;
141 fLineStyle = rhs.fLineStyle;
142 fLineWidth = rhs.fLineWidth;
143 fForceDrawingStyle = rhs.fForceDrawingStyle;
144 fForcedStyle = rhs.fForcedStyle;
145 fForcedNumberOfCloudPoints = rhs.fForcedNumberOfCloudPoints;
146 fForceAuxEdgeVisible = rhs.fForceAuxEdgeVisible;
147 fForcedAuxEdgeVisible = rhs.fForcedAuxEdgeVisible;
148 fForcedLineSegmentsPerCircle = rhs.fForcedLineSegmentsPerCircle;
149 fStartTime = rhs.fStartTime;
150 fEndTime = rhs.fEndTime;
151 // AttValues are created afresh for each object (using the
152 // CreateAttValues message), but deletion is the responsibility of
153 // the creator. So just copy pointer.
154 fAttValues = rhs.fAttValues;
155 // AttDefs, if any, belong to the object from which they were obtained
156 // (with a GetAttDefs message), so just copy pointer.
157 fAttDefs = rhs.fAttDefs;
158 return *this;
159}

◆ operator==()

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

Definition at line 333 of file G4VisAttributes.cc.

333 {
335}
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 189 of file G4VisAttributes.cc.

189 {
190 if (force) {
191 fForceDrawingStyle = true;
192 fForcedStyle = G4VisAttributes::cloud;
193 } else {
194 fForceDrawingStyle = false;
195 }
196}

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

◆ SetForceLineSegmentsPerCircle()

void G4VisAttributes::SetForceLineSegmentsPerCircle ( G4int  nSegments)

Definition at line 230 of file G4VisAttributes.cc.

230 {
231 const G4int nSegmentsMin = fMinLineSegmentsPerCircle;
232 if (nSegments > 0 && nSegments < nSegmentsMin) {
233 nSegments = nSegmentsMin;
234 G4cout <<
235 "G4VisAttributes::SetForcedLineSegmentsPerCircle: attempt to set the"
236 "\nnumber of line segments per circle < " << nSegmentsMin
237 << "; forced to " << nSegments << G4endl;
238 }
239 fForcedLineSegmentsPerCircle = nSegments;
240}
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
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 198 of file G4VisAttributes.cc.

198 {
199 fForcedNumberOfCloudPoints = nPoints;
200 if (nPoints <= 0) {
201 G4cout <<
202 "G4VisAttributes::SetForceNumberOfCloudPoints: number of cloud points"
203 "set to " << fForcedNumberOfCloudPoints
204 << ". This means the viewer default will be used."
205 << G4endl;
206 }
207}

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 171 of file G4VisAttributes.cc.

171 {
172 if (force) {
173 fForceDrawingStyle = true;
174 fForcedStyle = G4VisAttributes::wireframe;
175 } else {
176 fForceDrawingStyle = false;
177 }
178}

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

◆ SetLineStyle()

void G4VisAttributes::SetLineStyle ( LineStyle  )

◆ SetLineWidth()

◆ SetStartTime()

void G4VisAttributes::SetStartTime ( G4double  )

◆ SetVisibility()

Friends And Related Function Documentation

◆ operator<<

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

Definition at line 242 of file G4VisAttributes.cc.

243{
244 os << "G4VisAttributes: ";
245 if (!a.fVisible) os << "in";
246 os << "visible, daughters ";
247 if (a.fDaughtersInvisible) os << "in";
248 os << "visible, colour: " << a.fColour;
249 os << "\n linestyle: ";
250 switch (a.fLineStyle) {
252 os << "solid"; break;
254 os << "dashed"; break;
255 case G4VisAttributes::dotted: os << "dotted"; break;
256 default: os << "unrecognised"; break;
257 }
258 os << ", line width: " << a.fLineWidth;
259 os << ", min line segments per circle: " << a.GetMinLineSegmentsPerCircle();
260 os << "\n drawing style: ";
261 if (a.fForceDrawingStyle) {
262 os << "forced to ";
263 switch (a.fForcedStyle) {
265 os << "wireframe"; break;
267 os << "solid"; break;
268 default: os << "unrecognised"; break;
269 }
270 }
271 else {
272 os << "not forced";
273 }
274 os << ", auxiliary edge visibility: ";
275 if (a.fForceAuxEdgeVisible) {
276 os << "forced to ";
277 if (!a.fForcedAuxEdgeVisible) {
278 os << "not ";
279 }
280 os << "visible";
281 } else {
282 os << "not forced";
283 }
284 os << "\n line segments per circle: ";
285 if (a.fForcedLineSegmentsPerCircle > 0) {
286 os << "forced to " << a.fForcedLineSegmentsPerCircle;
287 } else {
288 os << "not forced.";
289 }
290 os << "\n time range: (" << a.fStartTime << ',' << a.fEndTime << ')';
291 os << "\n G4AttValue pointer is ";
292 if (a.fAttValues) {
293 os << "non-";
294 }
295 os << "zero";
296 os << ", G4AttDef pointer is ";
297 if (a.fAttDefs) {
298 os << "non-";
299 }
300 os << "zero";
301 return os;
302}
static G4int GetMinLineSegmentsPerCircle()

Member Data Documentation

◆ fMinLineSegmentsPerCircle

constexpr G4int G4VisAttributes::fMinLineSegmentsPerCircle = 3
staticconstexpr

Definition at line 147 of file G4VisAttributes.hh.

Referenced by SetForceLineSegmentsPerCircle().

◆ fVeryLongTime

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

Definition at line 150 of file G4VisAttributes.hh.

Referenced by G4VisCommandsViewerSet::G4VisCommandsViewerSet().

◆ Invisible

const G4VisAttributes G4VisAttributes::Invisible = G4VisAttributes (false)
static

Definition at line 92 of file G4VisAttributes.hh.


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