source: trunk/source/graphics_reps/include/G4VisAttributes.hh @ 1202

Last change on this file since 1202 was 1058, checked in by garnier, 15 years ago

file release beta

File size: 6.5 KB
Line 
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,v 1.19 2007/01/05 14:12:13 allison Exp $
28// GEANT4 tag $Name: geant4-09-02-ref-02 $
29//
30//
31// John Allison  23rd October 1996
32
33// Class Description:
34// Visualization attributes are a set of information associated with the
35// visualizable objects. This information is necessary only for
36// visualization, and is not included in geometrical information such
37// as shapes, position, and orientation.
38// A typical example of a visualization attribute is "colour".
39// For example, in visualizing a box, the Visualization Manager must know
40// its colour. If an object to be visualized has not been assigned a set of
41// visualization attributes, then a proper default set is used
42// automatically. A set of visualization attributes is held by an
43// instance of class G4VisAttributes defined in the graphics_reps
44// category. The followings are commonly-used attributes:
45//   - visibility
46//   - visibility of daughters
47//   - force wireframe style, force solid style
48//   - force auxiliary edge visibility, force line segments pe circle
49//   - colour
50// Class Description - End:
51
52
53#ifndef __G4VISATTRIBUTES_HH__
54#define __G4VISATTRIBUTES_HH__
55
56#include "globals.hh"
57#include <vector>
58#include <map>
59
60#include "G4Colour.hh"
61#include "G4Color.hh"
62
63class G4AttValue;
64class G4AttDef;
65
66class G4VisAttributes {
67
68  friend std::ostream& operator << (std::ostream& os, const G4VisAttributes& a);
69
70public: // With description
71
72  enum LineStyle {unbroken, dashed, dotted};
73  enum ForcedDrawingStyle {wireframe, solid};
74
75  G4VisAttributes ();
76  G4VisAttributes (G4bool visibility);
77  G4VisAttributes (const G4Colour& colour);
78  G4VisAttributes (G4bool visibility, const G4Colour& colour);
79
80  // Compiler defaults for copy constructor and assigment operator are OK.
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);
90  void SetDaughtersInvisible  (G4bool);
91  void SetColour              (const G4Colour&);
92  void SetColor               (const G4Color&);
93  void SetColour              (G4double red, G4double green, G4double blue,
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);
99  void SetForceWireframe      (G4bool);
100  void SetForceSolid          (G4bool);
101  void SetForceAuxEdgeVisible (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;
119  ForcedDrawingStyle GetForcedDrawingStyle       () const;
120  G4bool          IsForceAuxEdgeVisible          () const;
121  G4bool          IsForceLineSegmentsPerCircle   () const;
122  G4int           GetForcedLineSegmentsPerCircle () 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
130private:
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
Note: See TracBrowser for help on using the repository browser.