Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:22

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 //
0028 //
0029 // John Allison  23rd October 1996
0030 
0031 // Class Description:
0032 // Visualization attributes are a set of information associated with the
0033 // visualizable objects. This information is necessary only for
0034 // visualization, and is not included in geometrical information such
0035 // as shapes, position, and orientation.
0036 // A typical example of a visualization attribute is "colour".
0037 // For example, in visualizing a box, the Visualization Manager must know
0038 // its colour. If an object to be visualized has not been assigned a set of
0039 // visualization attributes, then a proper default set is used
0040 // automatically. A set of visualization attributes is held by an
0041 // instance of class G4VisAttributes defined in the graphics_reps
0042 // category. The followings are commonly-used attributes:
0043 //   - visibility
0044 //   - visibility of daughters
0045 //   - force style
0046 //   - force auxiliary edge visibility
0047 //   - force line segments per circle
0048 //   - colour
0049 // Class Description - End:
0050 
0051 
0052 #ifndef __G4VISATTRIBUTES_HH__
0053 #define __G4VISATTRIBUTES_HH__
0054 
0055 #include "globals.hh"
0056 #include <vector>
0057 #include <map>
0058 
0059 #include "graphics_reps_defs.hh"
0060 
0061 #include "G4Colour.hh"
0062 #include "G4Color.hh"
0063 
0064 class G4AttValue;
0065 class G4AttDef;
0066 
0067 #include <CLHEP/Units/SystemOfUnits.h>
0068 
0069 class G4VisAttributes {
0070 
0071   friend std::ostream& operator << (std::ostream& os, const G4VisAttributes& a);
0072 
0073 public: // With description
0074 
0075   enum LineStyle {unbroken, dashed, dotted};
0076   enum ForcedDrawingStyle {wireframe, solid, cloud};
0077 
0078   G4VisAttributes ();
0079   G4VisAttributes (G4bool visibility);
0080   G4VisAttributes (const G4Colour& colour);
0081   G4VisAttributes (G4bool visibility, const G4Colour& colour);
0082   G4VisAttributes (const G4VisAttributes&) = default;
0083   ~G4VisAttributes () = default;
0084   G4VisAttributes& operator= (const G4VisAttributes&);
0085 
0086   static const G4VisAttributes& GetInvisible();
0087 
0088   G4bool operator != (const G4VisAttributes& a) const;
0089   G4bool operator == (const G4VisAttributes& a) const;
0090 
0091   void SetVisibility          (G4bool = true);
0092   void SetDaughtersInvisible  (G4bool = true);
0093   void SetColour              (const G4Colour&);
0094   void SetColor               (const G4Color&);
0095   void SetColour              (G4double red, G4double green, G4double blue,
0096                                G4double alpha = 1.);
0097   void SetColor               (G4double red, G4double green, G4double blue,
0098                                G4double alpha = 1.);
0099   void SetLineStyle           (LineStyle);
0100   void SetLineWidth           (G4double);
0101   void SetForceWireframe      (G4bool = true);
0102   void SetForceSolid          (G4bool = true);
0103   void SetForceCloud          (G4bool = true);
0104   void SetForceNumberOfCloudPoints (G4int nPoints);
0105   // nPoints <= 0 means under control of viewer
0106   void SetForceAuxEdgeVisible (G4bool = true);
0107   void SetForceLineSegmentsPerCircle (G4int nSegments);
0108   // Allows choice of circle approximation.  A circle of 360 degrees
0109   // will be composed of nSegments line segments.  If your solid has
0110   // curves of D degrees that you need to divide into N segments,
0111   // specify nSegments = N * 360 / D.
0112   void SetStartTime           (G4double);
0113   void SetEndTime             (G4double);
0114   void SetAttValues           (const std::vector<G4AttValue>*);
0115   void SetAttDefs             (const std::map<G4String,G4AttDef>*);
0116 
0117   G4bool          IsVisible                      () const;
0118   G4bool          IsDaughtersInvisible           () const;
0119   const G4Colour& GetColour                      () const;
0120   const G4Color&  GetColor                       () const;
0121   LineStyle       GetLineStyle                   () const;
0122   G4double        GetLineWidth                   () const;
0123   G4bool          IsForceDrawingStyle            () const;
0124   ForcedDrawingStyle GetForcedDrawingStyle       () const;
0125   G4int           GetForcedNumberOfCloudPoints   () const;
0126   G4bool          IsForceAuxEdgeVisible          () const;
0127   G4bool          IsForcedAuxEdgeVisible         () const;
0128   G4bool          IsForceLineSegmentsPerCircle   () const;
0129   G4int           GetForcedLineSegmentsPerCircle () const;
0130   G4double        GetStartTime                   () const;
0131   G4double        GetEndTime                     () const;
0132   static G4int    GetMinLineSegmentsPerCircle    ();
0133   // Returns an expendable copy of the G4AttValues...
0134   const std::vector<G4AttValue>* CreateAttValues () const;
0135   // Returns the orginal long life G4AttDefs...
0136   const std::map<G4String,G4AttDef>* GetAttDefs  () const;
0137 
0138   static constexpr G4int fMinLineSegmentsPerCircle = 3;
0139   // Minumum number of sides per circle
0140 
0141   static constexpr G4double fVeryLongTime = 1.e100 * CLHEP::ns;
0142   // About 1.e75 billion years!! Used as default for start and end time.
0143 
0144 private:
0145 
0146   G4bool      fVisible;            // Visibility flag
0147   G4bool      fDaughtersInvisible; // Make daughters invsibile.
0148   G4Colour    fColour;
0149   LineStyle   fLineStyle;
0150   G4double    fLineWidth;          // Units of "normal" device linewidth, e.g.,
0151                                    // pixels for screen, 0.1 mm for paper.
0152   G4bool      fForceDrawingStyle;  // To switch on forced drawing style.
0153   ForcedDrawingStyle fForcedStyle; // Value of forced drawing style.
0154   G4int       fForcedNumberOfCloudPoints;  // Number of points used for cloud style.
0155                                            // <=0 means take viewer default
0156   G4bool      fForceAuxEdgeVisible;   // To switch on a forced auxiliary edge mode.
0157   G4bool      fForcedAuxEdgeVisible;  // Whether aux edges are visible or not.
0158   G4int fForcedLineSegmentsPerCircle;  // Forced lines segments per
0159                                        // circle.  <=0 means not forced.
0160   G4double fStartTime, fEndTime;   // Time range.
0161   const std::vector<G4AttValue>*     fAttValues;  // For picking, etc.
0162   const std::map<G4String,G4AttDef>* fAttDefs;    // Corresponding definitions.
0163 };
0164 
0165 #include "G4VisAttributes.icc"
0166 
0167 #endif