G4VisAttributes.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 // 
00030 // John Allison  23rd October 1996
00031 
00032 // Class Description:
00033 // Visualization attributes are a set of information associated with the 
00034 // visualizable objects. This information is necessary only for 
00035 // visualization, and is not included in geometrical information such 
00036 // as shapes, position, and orientation. 
00037 // A typical example of a visualization attribute is "colour". 
00038 // For example, in visualizing a box, the Visualization Manager must know 
00039 // its colour. If an object to be visualized has not been assigned a set of 
00040 // visualization attributes, then a proper default set is used 
00041 // automatically. A set of visualization attributes is held by an 
00042 // instance of class G4VisAttributes defined in the graphics_reps 
00043 // category. The followings are commonly-used attributes:
00044 //   - visibility
00045 //   - visibility of daughters
00046 //   - force wireframe style, force solid style
00047 //   - force auxiliary edge visibility, force line segments pe circle
00048 //   - colour 
00049 // Class Description - End:
00050 
00051 
00052 #ifndef __G4VISATTRIBUTES_HH__
00053 #define __G4VISATTRIBUTES_HH__
00054 
00055 #include "globals.hh"
00056 #include <vector>
00057 #include <map>
00058 
00059 #include "G4Colour.hh"
00060 #include "G4Color.hh"
00061 
00062 class G4AttValue;
00063 class G4AttDef;
00064 
00065 class G4VisAttributes {
00066 
00067   friend std::ostream& operator << (std::ostream& os, const G4VisAttributes& a);
00068 
00069 public: // With description
00070 
00071   enum LineStyle {unbroken, dashed, dotted};
00072   enum ForcedDrawingStyle {wireframe, solid};
00073 
00074   G4VisAttributes ();
00075   G4VisAttributes (const G4VisAttributes&);
00076   G4VisAttributes (G4bool visibility);
00077   G4VisAttributes (const G4Colour& colour);
00078   G4VisAttributes (G4bool visibility, const G4Colour& colour);
00079   ~G4VisAttributes ();
00080   G4VisAttributes& operator= (const G4VisAttributes&);
00081 
00082   static const G4VisAttributes Invisible;
00083 
00084   static const G4VisAttributes& GetInvisible();
00085 
00086   G4bool operator != (const G4VisAttributes& a) const;
00087   G4bool operator == (const G4VisAttributes& a) const;
00088 
00089   void SetVisibility          (G4bool);
00090   void SetDaughtersInvisible  (G4bool);
00091   void SetColour              (const G4Colour&);
00092   void SetColor               (const G4Color&);
00093   void SetColour              (G4double red, G4double green, G4double blue,
00094                                G4double alpha = 1.);
00095   void SetColor               (G4double red, G4double green, G4double blue,
00096                                G4double alpha = 1.);
00097   void SetLineStyle           (LineStyle);
00098   void SetLineWidth           (G4double);
00099   void SetForceWireframe      (G4bool);
00100   void SetForceSolid          (G4bool);
00101   void SetForceAuxEdgeVisible (G4bool);
00102   void SetForceLineSegmentsPerCircle (G4int nSegments);
00103   // Allows choice of circle approximation.  A circle of 360 degrees
00104   // will be composed of nSegments line segments.  If your solid has
00105   // curves of D degrees that you need to divide into N segments,
00106   // specify nSegments = N * 360 / D.
00107   void SetStartTime           (G4double);
00108   void SetEndTime             (G4double);
00109   void SetAttValues           (const std::vector<G4AttValue>*);
00110   void SetAttDefs             (const std::map<G4String,G4AttDef>*);
00111 
00112   G4bool          IsVisible                      () const;
00113   G4bool          IsDaughtersInvisible           () const;
00114   const G4Colour& GetColour                      () const;
00115   const G4Color&  GetColor                       () const;
00116   LineStyle       GetLineStyle                   () const;
00117   G4double        GetLineWidth                   () const;
00118   G4bool          IsForceDrawingStyle            () const;
00119   ForcedDrawingStyle GetForcedDrawingStyle       () const;
00120   G4bool          IsForceAuxEdgeVisible          () const;
00121   G4bool          IsForceLineSegmentsPerCircle   () const;
00122   G4int           GetForcedLineSegmentsPerCircle () const;
00123   G4double        GetStartTime                   () const;
00124   G4double        GetEndTime                     () const;
00125   // Returns an expendable copy of the G4AttValues...
00126   const std::vector<G4AttValue>* CreateAttValues () const;
00127   // Returns the orginal long life G4AttDefs...
00128   const std::map<G4String,G4AttDef>* GetAttDefs  () const;
00129 
00130 private:
00131 
00132   G4bool      fVisible;            // Visibility flag
00133   G4bool      fDaughtersInvisible; // Make daughters invsibile.
00134   G4Colour    fColour;
00135   LineStyle   fLineStyle;
00136   G4double    fLineWidth;          // Units of "normal" device linewidth, e.g.,
00137                                    // pixels for screen, 0.1 mm for paper.
00138   G4bool      fForceDrawingStyle;  // To switch on forced drawing style.
00139   ForcedDrawingStyle fForcedStyle; // Value of forced drawing style.
00140   G4bool    fForceAuxEdgeVisible;  // Force drawing of auxilary edges. 
00141   G4int fForcedLineSegmentsPerCircle;  // Forced lines segments per
00142                                        // circle.  <=0 means not forced.
00143   G4double fStartTime, fEndTime;   // Time range.
00144   const std::vector<G4AttValue>*     fAttValues;  // For picking, etc.
00145   const std::map<G4String,G4AttDef>* fAttDefs;    // Corresponding definitions.
00146 };
00147 
00148 #include "G4VisAttributes.icc"
00149 
00150 #endif

Generated on Mon May 27 17:50:14 2013 for Geant4 by  doxygen 1.4.7