Geant4  10.02.p02
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 85261 2014-10-27 08:54:57Z 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 ();
77  G4VisAttributes (G4bool visibility);
78  G4VisAttributes (const G4Colour& colour);
79  G4VisAttributes (G4bool visibility, const G4Colour& colour);
82 
83  static const G4VisAttributes Invisible;
84 
85  static const G4VisAttributes& GetInvisible();
86 
87  G4bool operator != (const G4VisAttributes& a) const;
88  G4bool operator == (const G4VisAttributes& a) const;
89 
90  void SetVisibility (G4bool);
92  void SetColour (const G4Colour&);
93  void SetColor (const G4Color&);
95  G4double alpha = 1.);
96  void SetColor (G4double red, G4double green, G4double blue,
97  G4double alpha = 1.);
98  void SetLineStyle (LineStyle);
99  void SetLineWidth (G4double);
100  void SetForceWireframe (G4bool);
101  void SetForceSolid (G4bool);
103  void SetForceLineSegmentsPerCircle (G4int nSegments);
104  // Allows choice of circle approximation. A circle of 360 degrees
105  // will be composed of nSegments line segments. If your solid has
106  // curves of D degrees that you need to divide into N segments,
107  // specify nSegments = N * 360 / D.
108  void SetStartTime (G4double);
109  void SetEndTime (G4double);
110  void SetAttValues (const std::vector<G4AttValue>*);
111  void SetAttDefs (const std::map<G4String,G4AttDef>*);
112 
113  G4bool IsVisible () const;
114  G4bool IsDaughtersInvisible () const;
115  const G4Colour& GetColour () const;
116  const G4Color& GetColor () const;
117  LineStyle GetLineStyle () const;
118  G4double GetLineWidth () const;
119  G4bool IsForceDrawingStyle () const;
121  G4bool IsForceAuxEdgeVisible () const;
124  G4double GetStartTime () const;
125  G4double GetEndTime () const;
128  };
129  // Returns an expendable copy of the G4AttValues...
130  const std::vector<G4AttValue>* CreateAttValues () const;
131  // Returns the orginal long life G4AttDefs...
132  const std::map<G4String,G4AttDef>* GetAttDefs () const;
133 
134 private:
135 
136  G4bool fVisible; // Visibility flag
137  G4bool fDaughtersInvisible; // Make daughters invsibile.
140  G4double fLineWidth; // Units of "normal" device linewidth, e.g.,
141  // pixels for screen, 0.1 mm for paper.
142  G4bool fForceDrawingStyle; // To switch on forced drawing style.
143  ForcedDrawingStyle fForcedStyle; // Value of forced drawing style.
144  G4bool fForceAuxEdgeVisible; // Force drawing of auxilary edges.
145  G4int fForcedLineSegmentsPerCircle; // Forced lines segments per
146  // circle. <=0 means not forced.
147  G4double fStartTime, fEndTime; // Time range.
148  const std::vector<G4AttValue>* fAttValues; // For picking, etc.
149  const std::map<G4String,G4AttDef>* fAttDefs; // Corresponding definitions.
150 };
151 
152 #include "G4VisAttributes.icc"
153 
154 #endif
static const G4VisAttributes & GetInvisible()
G4bool IsForceAuxEdgeVisible() const
G4double GetStartTime() const
G4bool operator!=(const G4VisAttributes &a) const
const std::map< G4String, G4AttDef > * fAttDefs
void SetColour(const G4Colour &)
void SetForceWireframe(G4bool)
Definition: test07.cc:36
void SetColor(const G4Color &)
G4double GetLineWidth() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
void SetLineStyle(LineStyle)
void SetLineWidth(G4double)
void SetVisibility(G4bool)
G4bool IsVisible() const
const G4Colour & GetColour() const
void SetStartTime(G4double)
G4double a
Definition: TRTMaterials.hh:39
void SetForceSolid(G4bool)
Definition: test07.cc:36
int G4int
Definition: G4Types.hh:78
void SetEndTime(G4double)
LineStyle GetLineStyle() const
ForcedDrawingStyle fForcedStyle
void SetAttValues(const std::vector< G4AttValue > *)
G4VisAttributes & operator=(const G4VisAttributes &)
static G4int GetMinLineSegmentsPerCircle()
G4bool IsDaughtersInvisible() const
bool G4bool
Definition: G4Types.hh:79
void SetAttDefs(const std::map< G4String, G4AttDef > *)
const std::vector< G4AttValue > * fAttValues
void SetForceAuxEdgeVisible(G4bool)
G4int GetForcedLineSegmentsPerCircle() const
const G4Color & GetColor() const
const std::vector< G4AttValue > * CreateAttValues() const
G4bool IsForceDrawingStyle() const
G4double GetEndTime() const
static const G4VisAttributes Invisible
friend std::ostream & operator<<(std::ostream &os, const G4VisAttributes &a)
double G4double
Definition: G4Types.hh:76
G4bool IsForceLineSegmentsPerCircle() const
G4int fForcedLineSegmentsPerCircle
static const G4double alpha
void SetDaughtersInvisible(G4bool)
ForcedDrawingStyle GetForcedDrawingStyle() const
G4bool operator==(const G4VisAttributes &a) const
void SetForceLineSegmentsPerCircle(G4int nSegments)