Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4VisAttributes.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 // $Id: G4VisAttributes.hh 98730 2016-08-09 10:47:54Z gcosmo $
28 //
29 //
30 // John Allison 23rd October 1996
31 
32 // Class Description:
33 // Visualization attributes are a set of information associated with the
34 // visualizable objects. This information is necessary only for
35 // visualization, and is not included in geometrical information such
36 // as shapes, position, and orientation.
37 // A typical example of a visualization attribute is "colour".
38 // For example, in visualizing a box, the Visualization Manager must know
39 // its colour. If an object to be visualized has not been assigned a set of
40 // visualization attributes, then a proper default set is used
41 // automatically. A set of visualization attributes is held by an
42 // instance of class G4VisAttributes defined in the graphics_reps
43 // category. The followings are commonly-used attributes:
44 // - visibility
45 // - visibility of daughters
46 // - force wireframe style, force solid style
47 // - force auxiliary edge visibility, force line segments pe circle
48 // - colour
49 // Class Description - End:
50 
51 
52 #ifndef __G4VISATTRIBUTES_HH__
53 #define __G4VISATTRIBUTES_HH__
54 
55 #include "globals.hh"
56 #include <vector>
57 #include <map>
58 
59 #include "G4Colour.hh"
60 #include "G4Color.hh"
61 
62 class G4AttValue;
63 class G4AttDef;
64 
66 
67  friend std::ostream& operator << (std::ostream& os, const G4VisAttributes& a);
68 
69 public: // With description
70 
73  enum {fMinLineSegmentsPerCircle = 3}; // number of sides per circle
74 
75  G4VisAttributes ();
76  G4VisAttributes (G4bool visibility);
77  G4VisAttributes (const G4Colour& colour);
78  G4VisAttributes (G4bool visibility, const G4Colour& colour);
82 
83  // Deprecated 14 July 2016 JA
84  // Use GetInvisible() instead. E.g.:
85  // logical_volume->SetVisAttributes(G4VisAttributes::GetInvisible());
86  // or use one of the above constructors or SetVisibility and
87  // logical_volume->SetVisAttributes(my_vis_attributes);
88  static const G4VisAttributes Invisible;
89 
90  static const G4VisAttributes& GetInvisible();
91 
92  G4bool operator != (const G4VisAttributes& a) const;
93  G4bool operator == (const G4VisAttributes& a) const;
94 
95  void SetVisibility (G4bool = true);
96  void SetDaughtersInvisible (G4bool = true);
97  void SetColour (const G4Colour&);
98  void SetColor (const G4Color&);
99  void SetColour (G4double red, G4double green, G4double blue,
100  G4double alpha = 1.);
101  void SetColor (G4double red, G4double green, G4double blue,
102  G4double alpha = 1.);
103  void SetLineStyle (LineStyle);
104  void SetLineWidth (G4double);
105  void SetForceWireframe (G4bool = true);
106  void SetForceSolid (G4bool = true);
107  void SetForceAuxEdgeVisible (G4bool = true);
108  void SetForceLineSegmentsPerCircle (G4int nSegments);
109  // Allows choice of circle approximation. A circle of 360 degrees
110  // will be composed of nSegments line segments. If your solid has
111  // curves of D degrees that you need to divide into N segments,
112  // specify nSegments = N * 360 / D.
113  void SetStartTime (G4double);
114  void SetEndTime (G4double);
115  void SetAttValues (const std::vector<G4AttValue>*);
116  void SetAttDefs (const std::map<G4String,G4AttDef>*);
117 
118  G4bool IsVisible () const;
119  G4bool IsDaughtersInvisible () const;
120  const G4Colour& GetColour () const;
121  const G4Color& GetColor () const;
122  LineStyle GetLineStyle () const;
123  G4double GetLineWidth () const;
124  G4bool IsForceDrawingStyle () const;
126  G4bool IsForceAuxEdgeVisible () const;
130  G4double GetStartTime () const;
131  G4double GetEndTime () const;
133  // Returns an expendable copy of the G4AttValues...
134  const std::vector<G4AttValue>* CreateAttValues () const;
135  // Returns the orginal long life G4AttDefs...
136  const std::map<G4String,G4AttDef>* GetAttDefs () const;
137 
138 private:
139 
140  G4bool fVisible; // Visibility flag
141  G4bool fDaughtersInvisible; // Make daughters invsibile.
142  G4Colour fColour;
143  LineStyle fLineStyle;
144  G4double fLineWidth; // Units of "normal" device linewidth, e.g.,
145  // pixels for screen, 0.1 mm for paper.
146  G4bool fForceDrawingStyle; // To switch on forced drawing style.
147  ForcedDrawingStyle fForcedStyle; // Value of forced drawing style.
148  G4bool fForceAuxEdgeVisible; // To switch on a forced auxiliary edge mode.
149  G4bool fForcedAuxEdgeVisible; // Whether aux edges are visible or not.
150  G4int fForcedLineSegmentsPerCircle; // Forced lines segments per
151  // circle. <=0 means not forced.
152  G4double fStartTime, fEndTime; // Time range.
153  const std::vector<G4AttValue>* fAttValues; // For picking, etc.
154  const std::map<G4String,G4AttDef>* fAttDefs; // Corresponding definitions.
155 };
156 
157 #include "G4VisAttributes.icc"
158 
159 #endif
G4bool IsForceAuxEdgeVisible() const
G4double GetStartTime() const
G4bool operator!=(const G4VisAttributes &a) const
void SetColour(const G4Colour &)
void SetColor(const G4Color &)
G4double GetLineWidth() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
void SetLineStyle(LineStyle)
void SetLineWidth(G4double)
G4bool IsVisible() const
const G4Colour & GetColour() const
void SetStartTime(G4double)
int G4int
Definition: G4Types.hh:78
void SetEndTime(G4double)
void SetForceSolid(G4bool=true)
LineStyle GetLineStyle() const
void SetAttValues(const std::vector< G4AttValue > *)
G4VisAttributes & operator=(const G4VisAttributes &)
static G4int GetMinLineSegmentsPerCircle()
G4bool IsDaughtersInvisible() const
void SetVisibility(G4bool=true)
bool G4bool
Definition: G4Types.hh:79
void SetAttDefs(const std::map< G4String, G4AttDef > *)
G4bool IsForcedAuxEdgeVisible() const
void SetDaughtersInvisible(G4bool=true)
G4int GetForcedLineSegmentsPerCircle() const
const G4Color & GetColor() const
const std::vector< G4AttValue > * CreateAttValues() const
G4bool IsForceDrawingStyle() const
G4double GetEndTime() const
static const G4VisAttributes Invisible
void SetForceAuxEdgeVisible(G4bool=true)
friend std::ostream & operator<<(std::ostream &os, const G4VisAttributes &a)
double G4double
Definition: G4Types.hh:76
G4bool IsForceLineSegmentsPerCircle() const
static const G4double alpha
static const G4VisAttributes & GetInvisible()
void SetForceWireframe(G4bool=true)
ForcedDrawingStyle GetForcedDrawingStyle() const
G4bool operator==(const G4VisAttributes &a) const
void SetForceLineSegmentsPerCircle(G4int nSegments)