Geant4 9.6.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 }
 

Public Member Functions

 G4VisAttributes ()
 
 G4VisAttributes (const G4VisAttributes &)
 
 G4VisAttributes (G4bool visibility)
 
 G4VisAttributes (const G4Colour &colour)
 
 G4VisAttributes (G4bool visibility, const G4Colour &colour)
 
 ~G4VisAttributes ()
 
G4VisAttributesoperator= (const G4VisAttributes &)
 
G4bool operator!= (const G4VisAttributes &a) const
 
G4bool operator== (const G4VisAttributes &a) const
 
void SetVisibility (G4bool)
 
void SetDaughtersInvisible (G4bool)
 
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)
 
void SetForceSolid (G4bool)
 
void SetForceAuxEdgeVisible (G4bool)
 
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
 
G4bool IsForceAuxEdgeVisible () 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 Public Attributes

static const G4VisAttributes Invisible = G4VisAttributes (false)
 

Friends

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

Detailed Description

Definition at line 65 of file G4VisAttributes.hh.

Member Enumeration Documentation

◆ ForcedDrawingStyle

Enumerator
wireframe 
solid 

Definition at line 72 of file G4VisAttributes.hh.

◆ LineStyle

Enumerator
unbroken 
dashed 
dotted 

Definition at line 71 of file G4VisAttributes.hh.

Constructor & Destructor Documentation

◆ G4VisAttributes() [1/5]

G4VisAttributes::G4VisAttributes ( )

Definition at line 58 of file G4VisAttributes.cc.

58 :
59fVisible (true),
60fDaughtersInvisible (false),
61fColour (G4Colour ()),
62fLineStyle (unbroken),
63fLineWidth (1.),
64fForceDrawingStyle (false),
65fForcedStyle (wireframe),
66fForceAuxEdgeVisible (false),
67fForcedLineSegmentsPerCircle (0), // <=0 means not forced.
68fStartTime (-DBL_MAX),
69fEndTime (DBL_MAX),
70fAttValues (0),
71fAttDefs (0)
72{}
#define DBL_MAX
Definition: templates.hh:83

◆ G4VisAttributes() [2/5]

G4VisAttributes::G4VisAttributes ( const G4VisAttributes va)

Definition at line 37 of file G4VisAttributes.cc.

37 :
38fVisible (va.fVisible),
39fDaughtersInvisible (va.fDaughtersInvisible),
40fColour (va.fColour),
41fLineStyle (va.fLineStyle),
42fLineWidth (va.fLineWidth),
43fForceDrawingStyle (va.fForceDrawingStyle),
44fForcedStyle (va.fForcedStyle),
45fForceAuxEdgeVisible (va.fForceAuxEdgeVisible),
46fForcedLineSegmentsPerCircle (va.fForcedLineSegmentsPerCircle),
47fStartTime (va.fStartTime),
48fEndTime (va.fEndTime),
49// AttValues are created afresh for each object (using the
50// CreateAttValues message), but deletion is the responsibility of
51// the creator. So just copy pointer.
52fAttValues (va.fAttValues),
53// AttDefs, if any, belong to the object from which they were obtained
54// (with a GetAttDefs message), so just copy pointer.
55fAttDefs (va.fAttDefs)
56{}

◆ G4VisAttributes() [3/5]

G4VisAttributes::G4VisAttributes ( G4bool  visibility)

Definition at line 74 of file G4VisAttributes.cc.

74 :
75fVisible (visibility),
76fDaughtersInvisible (false),
77fColour (G4Colour ()),
78fLineStyle (unbroken),
79fLineWidth (1.),
80fForceDrawingStyle (false),
81fForcedStyle (wireframe),
82fForceAuxEdgeVisible (false),
83fForcedLineSegmentsPerCircle (0), // <=0 means not forced.
84fStartTime (-DBL_MAX),
85fEndTime (DBL_MAX),
86fAttValues (0),
87fAttDefs (0)
88{}

◆ G4VisAttributes() [4/5]

G4VisAttributes::G4VisAttributes ( const G4Colour colour)

Definition at line 90 of file G4VisAttributes.cc.

90 :
91fVisible (true),
92fDaughtersInvisible (false),
93fColour (colour),
94fLineStyle (unbroken),
95fLineWidth (1.),
96fForceDrawingStyle (false),
97fForcedStyle (wireframe),
98fForceAuxEdgeVisible (false),
99fForcedLineSegmentsPerCircle (0), // <=0 means not forced.
100fStartTime (-DBL_MAX),
101fEndTime (DBL_MAX),
102fAttValues (0),
103fAttDefs (0)
104{}

◆ G4VisAttributes() [5/5]

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

Definition at line 106 of file G4VisAttributes.cc.

107 :
108fVisible (visibility),
109fDaughtersInvisible (false),
110fColour (colour),
111fLineStyle (unbroken),
112fLineWidth (1.),
113fForceDrawingStyle (false),
114fForcedStyle (wireframe),
115fForceAuxEdgeVisible (false),
116fForcedLineSegmentsPerCircle (0), // <=0 means not forced.
117fStartTime (-DBL_MAX),
118fEndTime (DBL_MAX),
119fAttValues (0),
120fAttDefs (0)
121{}

◆ ~G4VisAttributes()

G4VisAttributes::~G4VisAttributes ( )

Definition at line 123 of file G4VisAttributes.cc.

124{
125}

Member Function Documentation

◆ CreateAttValues()

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

Definition at line 153 of file G4VisAttributes.cc.

153 {
154 // Create an expendable copy on the heap...
155 return new std::vector<G4AttValue>(*fAttValues);
156}

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()

◆ GetForcedLineSegmentsPerCircle()

◆ GetInvisible()

static const G4VisAttributes & G4VisAttributes::GetInvisible ( )
static

◆ GetLineStyle()

◆ GetLineWidth()

◆ GetStartTime()

G4double G4VisAttributes::GetStartTime ( ) const

◆ IsDaughtersInvisible()

◆ IsForceAuxEdgeVisible()

◆ IsForceDrawingStyle()

◆ IsForceLineSegmentsPerCircle()

G4bool G4VisAttributes::IsForceLineSegmentsPerCircle ( ) const

◆ IsVisible()

◆ operator!=()

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

Definition at line 229 of file G4VisAttributes.cc.

229 {
230
231 if (
232 (fVisible != a.fVisible) ||
233 (fDaughtersInvisible != a.fDaughtersInvisible) ||
234 (fColour != a.fColour) ||
235 (fLineStyle != a.fLineStyle) ||
236 (fLineWidth != a.fLineWidth) ||
237 (fForceDrawingStyle != a.fForceDrawingStyle) ||
238 (fForceAuxEdgeVisible!= a.fForceAuxEdgeVisible)||
239 (fForcedLineSegmentsPerCircle != a.fForcedLineSegmentsPerCircle) ||
240 (fStartTime != a.fStartTime) ||
241 (fEndTime != a.fEndTime) ||
242 (fAttValues != a.fAttValues) ||
243 (fAttDefs != a.fAttDefs)
244 )
245 return true;
246
247 if (fForceDrawingStyle) {
248 if (fForcedStyle != a.fForcedStyle) return true;
249 }
250
251 return false;
252}

Referenced by operator==().

◆ operator=()

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

Definition at line 127 of file G4VisAttributes.cc.

128{
129 if (&rhs == this) return *this;
130 fVisible = rhs.fVisible;
131 fDaughtersInvisible = rhs.fDaughtersInvisible;
132 fColour = rhs.fColour;
133 fLineStyle = rhs.fLineStyle;
134 fLineWidth = rhs.fLineWidth;
135 fForceDrawingStyle = rhs.fForceDrawingStyle;
136 fForcedStyle = rhs.fForcedStyle;
137 fForceAuxEdgeVisible = rhs.fForceAuxEdgeVisible;
138 fForcedLineSegmentsPerCircle = rhs.fForcedLineSegmentsPerCircle;
139 fStartTime = rhs.fStartTime;
140 fEndTime = rhs.fEndTime;
141 // AttValues are created afresh for each object (using the
142 // CreateAttValues message), but deletion is the responsibility of
143 // the creator. So just copy pointer.
144 fAttValues = rhs.fAttValues;
145 // AttDefs, if any, belong to the object from which they were obtained
146 // (with a GetAttDefs message), so just copy pointer.
147 fAttDefs = rhs.fAttDefs;
148 return *this;
149}

◆ operator==()

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

Definition at line 254 of file G4VisAttributes.cc.

254 {
256}
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  )

◆ SetEndTime()

void G4VisAttributes::SetEndTime ( G4double  )

◆ SetForceAuxEdgeVisible()

◆ SetForceLineSegmentsPerCircle()

void G4VisAttributes::SetForceLineSegmentsPerCircle ( G4int  nSegments)

Definition at line 158 of file G4VisAttributes.cc.

158 {
159 const G4int nSegmentsMin = 12;
160 if (nSegments > 0 && nSegments < nSegmentsMin) {
161 nSegments = nSegmentsMin;
162 G4cout <<
163 "G4VisAttributes::SetForcedLineSegmentsPerCircle: attempt to set the"
164 "\nnumber of line segements per circle < " << nSegmentsMin
165 << "; forced to " << nSegments << G4endl;
166 }
167 fForcedLineSegmentsPerCircle = nSegments;
168}
int G4int
Definition: G4Types.hh:66
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout

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

◆ SetForceSolid()

◆ SetForceWireframe()

◆ SetLineStyle()

void G4VisAttributes::SetLineStyle ( LineStyle  )

◆ SetLineWidth()

void G4VisAttributes::SetLineWidth ( G4double  )

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

170 {
171
172 os << "G4VisAttributes: ";
173 if (&a){
174 if (!a.fVisible) os << "in";
175 os << "visible, daughters ";
176 if (a.fDaughtersInvisible) os << "in";
177 os << "visible, colour: " << a.fColour;
178 os << "\n linestyle: ";
179 switch (a.fLineStyle) {
181 os << "solid"; break;
183 os << "dashed"; break;
184 case G4VisAttributes::dotted: os << "dotted"; break;
185 default: os << "unrecognised"; break;
186 }
187 os << ", line width: " << a.fLineWidth;
188 os << "\n drawing style: ";
189 if (a.fForceDrawingStyle) {
190 os << "forced to: ";
191 switch (a.fForcedStyle) {
193 os << "wireframe"; break;
195 os << "solid"; break;
196 default: os << "unrecognised"; break;
197 }
198 }
199 else {
200 os << "not forced";
201 }
202 os << ", auxiliary edge visibility: ";
203 if (!a.fForceAuxEdgeVisible) {
204 os << "not ";
205 }
206 os << "forced";
207 os << "\n line segments per circle: ";
208 if (a.fForcedLineSegmentsPerCircle > 0) {
209 os << "forced to " << a.fForcedLineSegmentsPerCircle;
210 } else {
211 os << "not forced.";
212 }
213 os << "\n time range: (" << a.fStartTime << ',' << a.fEndTime << ')';
214 os << "\n G4AttValue pointer is ";
215 if (a.fAttValues) {
216 os << "non-";
217 }
218 os << "zero";
219 os << ", G4AttDef pointer is ";
220 if (a.fAttDefs) {
221 os << "non-";
222 }
223 os << "zero";
224 }
225 else os << " zero G4VisAttributes pointer";
226 return os;
227}

Member Data Documentation

◆ Invisible

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

Definition at line 82 of file G4VisAttributes.hh.

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


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