Geant4-11
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | Friends
G4VisAttributes Class Reference

#include <G4VisAttributes.hh>

Public Types

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

Public Member Functions

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

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
 

Private Attributes

const std::map< G4String, G4AttDef > * fAttDefs
 
const std::vector< G4AttValue > * fAttValues
 
G4Colour fColour
 
G4bool fDaughtersInvisible
 
G4double fEndTime
 
G4bool fForceAuxEdgeVisible
 
G4bool fForcedAuxEdgeVisible
 
G4int fForcedLineSegmentsPerCircle
 
G4int fForcedNumberOfCloudPoints
 
G4bool fForceDrawingStyle
 
ForcedDrawingStyle fForcedStyle
 
LineStyle fLineStyle
 
G4double fLineWidth
 
G4double fStartTime
 
G4bool fVisible
 

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),
39fColour (G4Colour ()),
41fLineWidth (1.),
42fForceDrawingStyle (false),
44fForcedNumberOfCloudPoints (0), // <= 0 means under control of viewer
47fForcedLineSegmentsPerCircle (0), // <=0 means not forced.
50fAttValues (0),
51fAttDefs (0)
52{}
const std::vector< G4AttValue > * fAttValues
G4int fForcedLineSegmentsPerCircle
ForcedDrawingStyle fForcedStyle
static constexpr G4double fVeryLongTime
G4int fForcedNumberOfCloudPoints
G4bool fForcedAuxEdgeVisible
const std::map< G4String, G4AttDef > * fAttDefs

Referenced by GetInvisible().

◆ G4VisAttributes() [2/5]

G4VisAttributes::G4VisAttributes ( G4bool  visibility)

Definition at line 54 of file G4VisAttributes.cc.

54 :
55fVisible (visibility),
57fColour (G4Colour ()),
59fLineWidth (1.),
60fForceDrawingStyle (false),
62fForcedNumberOfCloudPoints (0), // <= 0 means under control of viewer
65fForcedLineSegmentsPerCircle (0), // <=0 means not forced.
68fAttValues (0),
69fAttDefs (0)
70{}

◆ G4VisAttributes() [3/5]

G4VisAttributes::G4VisAttributes ( const G4Colour colour)

Definition at line 72 of file G4VisAttributes.cc.

72 :
73fVisible (true),
75fColour (colour),
77fLineWidth (1.),
78fForceDrawingStyle (false),
80fForcedNumberOfCloudPoints (0), // <= 0 means under control of viewer
83fForcedLineSegmentsPerCircle (0), // <=0 means not forced.
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),
94fColour (colour),
96fLineWidth (1.),
97fForceDrawingStyle (false),
99fForcedNumberOfCloudPoints (0), // <= 0 means under control of viewer
102fForcedLineSegmentsPerCircle (0), // <=0 means not forced.
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),
112fColour (va.fColour),
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.
127// AttDefs, if any, belong to the object from which they were obtained
128// (with a GetAttDefs message), so just copy pointer.
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 221 of file G4VisAttributes.cc.

221 {
222 // Create an expendable copy on the heap...
223 return new std::vector<G4AttValue>(*fAttValues);
224}

References fAttValues.

Referenced by G4VSceneHandler::LoadAtts().

◆ GetAttDefs()

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

◆ GetColor()

const G4Color & G4VisAttributes::GetColor ( ) const

◆ GetColour()

const G4Colour & G4VisAttributes::GetColour ( ) const

◆ 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

◆ GetLineStyle()

LineStyle G4VisAttributes::GetLineStyle ( ) const

◆ GetLineWidth()

G4double G4VisAttributes::GetLineWidth ( ) const

◆ GetMinLineSegmentsPerCircle()

static G4int G4VisAttributes::GetMinLineSegmentsPerCircle ( )
static

◆ GetStartTime()

G4double G4VisAttributes::GetStartTime ( ) const

◆ IsDaughtersInvisible()

G4bool G4VisAttributes::IsDaughtersInvisible ( ) const

◆ IsForceAuxEdgeVisible()

G4bool G4VisAttributes::IsForceAuxEdgeVisible ( ) const

◆ IsForcedAuxEdgeVisible()

G4bool G4VisAttributes::IsForcedAuxEdgeVisible ( ) const

◆ IsForceDrawingStyle()

G4bool G4VisAttributes::IsForceDrawingStyle ( ) const

◆ IsForceLineSegmentsPerCircle()

G4bool G4VisAttributes::IsForceLineSegmentsPerCircle ( ) const

◆ IsVisible()

G4bool G4VisAttributes::IsVisible ( ) const

◆ operator!=()

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

Definition at line 300 of file G4VisAttributes.cc.

300 {
301
302 if (
303 (fVisible != a.fVisible) ||
305 (fColour != a.fColour) ||
306 (fLineStyle != a.fLineStyle) ||
307 (fLineWidth != a.fLineWidth) ||
311 (fStartTime != a.fStartTime) ||
312 (fEndTime != a.fEndTime) ||
313 (fAttValues != a.fAttValues) ||
314 (fAttDefs != a.fAttDefs)
315 )
316 return true;
317
318 if (fForceDrawingStyle) {
319 if (fForcedStyle != a.fForcedStyle) return true;
320 }
321
323 if (fForcedAuxEdgeVisible != a.fForcedAuxEdgeVisible) return true;
324 }
325
326 return false;
327}

References fAttDefs, fAttValues, fColour, fDaughtersInvisible, fEndTime, fForceAuxEdgeVisible, fForcedAuxEdgeVisible, fForcedLineSegmentsPerCircle, fForceDrawingStyle, fForcedStyle, fLineStyle, fLineWidth, fStartTime, and fVisible.

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;
140 fColour = rhs.fColour;
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.
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}

References fAttDefs, fAttValues, fColour, fDaughtersInvisible, fEndTime, fForceAuxEdgeVisible, fForcedAuxEdgeVisible, fForcedLineSegmentsPerCircle, fForcedNumberOfCloudPoints, fForceDrawingStyle, fForcedStyle, fLineStyle, fLineWidth, fStartTime, and fVisible.

◆ operator==()

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

Definition at line 329 of file G4VisAttributes.cc.

329 {
331}
G4bool operator!=(const G4VisAttributes &a) const

References operator!=().

◆ SetAttDefs()

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

Referenced by export_G4VisAttributes().

◆ SetAttValues()

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

Referenced by export_G4VisAttributes().

◆ 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]

void G4VisAttributes::SetColour ( const G4Colour )

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

◆ SetForceLineSegmentsPerCircle()

void G4VisAttributes::SetForceLineSegmentsPerCircle ( G4int  nSegments)

Definition at line 226 of file G4VisAttributes.cc.

226 {
227 const G4int nSegmentsMin = fMinLineSegmentsPerCircle;
228 if (nSegments > 0 && nSegments < nSegmentsMin) {
229 nSegments = nSegmentsMin;
230 G4cout <<
231 "G4VisAttributes::SetForcedLineSegmentsPerCircle: attempt to set the"
232 "\nnumber of line segments per circle < " << nSegmentsMin
233 << "; forced to " << nSegments << G4endl;
234 }
236}
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static constexpr G4int fMinLineSegmentsPerCircle

References fForcedLineSegmentsPerCircle, fMinLineSegmentsPerCircle, G4cout, and G4endl.

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

◆ SetForceNumberOfCloudPoints()

void G4VisAttributes::SetForceNumberOfCloudPoints ( G4int  nPoints)

Definition at line 193 of file G4VisAttributes.cc.

193 {
195 if (nPoints <= 0) {
196 G4cout <<
197 "G4VisAttributes::SetForceNumberOfCloudPoints: number of cloud points"
198 " set to " << fForcedNumberOfCloudPoints << '.' <<
199 "\n This means the viewer default will be used, typically controlled by"
200 "\n \"/vis/viewer/set/numberOfCloudPoints\""
201 << G4endl;
202 }
203}

References fForcedNumberOfCloudPoints, G4cout, and G4endl.

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

◆ SetForceSolid()

void G4VisAttributes::SetForceSolid ( G4bool  force = true)

◆ SetForceWireframe()

void G4VisAttributes::SetForceWireframe ( G4bool  force = true)

◆ SetLineStyle()

void G4VisAttributes::SetLineStyle ( LineStyle  )

◆ SetLineWidth()

void G4VisAttributes::SetLineWidth ( G4double  )

◆ SetStartTime()

void G4VisAttributes::SetStartTime ( G4double  )

◆ SetVisibility()

void G4VisAttributes::SetVisibility ( G4bool  = true)

Friends And Related Function Documentation

◆ operator<<

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

Definition at line 238 of file G4VisAttributes.cc.

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

Field Documentation

◆ fAttDefs

const std::map<G4String,G4AttDef>* G4VisAttributes::fAttDefs
private

Definition at line 162 of file G4VisAttributes.hh.

Referenced by operator!=(), and operator=().

◆ fAttValues

const std::vector<G4AttValue>* G4VisAttributes::fAttValues
private

Definition at line 161 of file G4VisAttributes.hh.

Referenced by CreateAttValues(), operator!=(), and operator=().

◆ fColour

G4Colour G4VisAttributes::fColour
private

Definition at line 148 of file G4VisAttributes.hh.

Referenced by operator!=(), and operator=().

◆ fDaughtersInvisible

G4bool G4VisAttributes::fDaughtersInvisible
private

Definition at line 147 of file G4VisAttributes.hh.

Referenced by operator!=(), and operator=().

◆ fEndTime

G4double G4VisAttributes::fEndTime
private

Definition at line 160 of file G4VisAttributes.hh.

Referenced by operator!=(), and operator=().

◆ fForceAuxEdgeVisible

G4bool G4VisAttributes::fForceAuxEdgeVisible
private

◆ fForcedAuxEdgeVisible

G4bool G4VisAttributes::fForcedAuxEdgeVisible
private

◆ fForcedLineSegmentsPerCircle

G4int G4VisAttributes::fForcedLineSegmentsPerCircle
private

Definition at line 158 of file G4VisAttributes.hh.

Referenced by operator!=(), operator=(), and SetForceLineSegmentsPerCircle().

◆ fForcedNumberOfCloudPoints

G4int G4VisAttributes::fForcedNumberOfCloudPoints
private

Definition at line 154 of file G4VisAttributes.hh.

Referenced by operator=(), and SetForceNumberOfCloudPoints().

◆ fForceDrawingStyle

G4bool G4VisAttributes::fForceDrawingStyle
private

◆ fForcedStyle

ForcedDrawingStyle G4VisAttributes::fForcedStyle
private

◆ fLineStyle

LineStyle G4VisAttributes::fLineStyle
private

Definition at line 149 of file G4VisAttributes.hh.

Referenced by operator!=(), and operator=().

◆ fLineWidth

G4double G4VisAttributes::fLineWidth
private

Definition at line 150 of file G4VisAttributes.hh.

Referenced by operator!=(), and operator=().

◆ fMinLineSegmentsPerCircle

constexpr G4int G4VisAttributes::fMinLineSegmentsPerCircle = 3
staticconstexpr

Definition at line 138 of file G4VisAttributes.hh.

Referenced by SetForceLineSegmentsPerCircle().

◆ fStartTime

G4double G4VisAttributes::fStartTime
private

Definition at line 160 of file G4VisAttributes.hh.

Referenced by operator!=(), and operator=().

◆ fVeryLongTime

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

◆ fVisible

G4bool G4VisAttributes::fVisible
private

Definition at line 146 of file G4VisAttributes.hh.

Referenced by operator!=(), and operator=().


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