Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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$
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 
74  G4VisAttributes ();
76  G4VisAttributes (G4bool visibility);
77  G4VisAttributes (const G4Colour& colour);
78  G4VisAttributes (G4bool visibility, const G4Colour& colour);
81 
82  static const G4VisAttributes Invisible;
83 
84  static const G4VisAttributes& GetInvisible();
85 
86  G4bool operator != (const G4VisAttributes& a) const;
87  G4bool operator == (const G4VisAttributes& a) const;
88 
89  void SetVisibility (G4bool);
91  void SetColour (const G4Colour&);
92  void SetColor (const G4Color&);
94  G4double alpha = 1.);
95  void SetColor (G4double red, G4double green, G4double blue,
96  G4double alpha = 1.);
97  void SetLineStyle (LineStyle);
98  void SetLineWidth (G4double);
100  void SetForceSolid (G4bool);
102  void SetForceLineSegmentsPerCircle (G4int nSegments);
103  // Allows choice of circle approximation. A circle of 360 degrees
104  // will be composed of nSegments line segments. If your solid has
105  // curves of D degrees that you need to divide into N segments,
106  // specify nSegments = N * 360 / D.
107  void SetStartTime (G4double);
108  void SetEndTime (G4double);
109  void SetAttValues (const std::vector<G4AttValue>*);
110  void SetAttDefs (const std::map<G4String,G4AttDef>*);
111 
112  G4bool IsVisible () const;
113  G4bool IsDaughtersInvisible () const;
114  const G4Colour& GetColour () const;
115  const G4Color& GetColor () const;
116  LineStyle GetLineStyle () const;
117  G4double GetLineWidth () const;
118  G4bool IsForceDrawingStyle () const;
120  G4bool IsForceAuxEdgeVisible () const;
123  G4double GetStartTime () const;
124  G4double GetEndTime () const;
125  // Returns an expendable copy of the G4AttValues...
126  const std::vector<G4AttValue>* CreateAttValues () const;
127  // Returns the orginal long life G4AttDefs...
128  const std::map<G4String,G4AttDef>* GetAttDefs () const;
129 
130 private:
131 
132  G4bool fVisible; // Visibility flag
133  G4bool fDaughtersInvisible; // Make daughters invsibile.
134  G4Colour fColour;
135  LineStyle fLineStyle;
136  G4double fLineWidth; // Units of "normal" device linewidth, e.g.,
137  // pixels for screen, 0.1 mm for paper.
138  G4bool fForceDrawingStyle; // To switch on forced drawing style.
139  ForcedDrawingStyle fForcedStyle; // Value of forced drawing style.
140  G4bool fForceAuxEdgeVisible; // Force drawing of auxilary edges.
141  G4int fForcedLineSegmentsPerCircle; // Forced lines segments per
142  // circle. <=0 means not forced.
143  G4double fStartTime, fEndTime; // Time range.
144  const std::vector<G4AttValue>* fAttValues; // For picking, etc.
145  const std::map<G4String,G4AttDef>* fAttDefs; // Corresponding definitions.
146 };
147 
148 #include "G4VisAttributes.icc"
149 
150 #endif