G4ModelingParameters.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  31st December 1997.
00031 //
00032 // Class Description:
00033 //
00034 // Parameters associated with the modeling of GEANT4 objects.
00035 
00036 #ifndef G4MODELINGPARAMETERS_HH
00037 #define G4MODELINGPARAMETERS_HH
00038 
00039 #include "globals.hh"
00040 #include "G4VisExtent.hh"
00041 #include "G4VisAttributes.hh"
00042 #include "G4PhysicalVolumeModel.hh"
00043 
00044 #include <vector>
00045 #include <utility>
00046 
00047 class G4LogicalVolume;
00048 class G4VisAttributes;
00049 class G4VSolid;
00050 class G4Event;
00051 
00052 class G4ModelingParameters {
00053 
00054 public: // With description
00055 
00056   // Currently requested drawing style.
00057   enum DrawingStyle {
00058     wf,         // Draw edges    - no hidden line removal (wireframe).
00059     hlr,        // Draw edges    - hidden lines removed.
00060     hsr,        // Draw surfaces - hidden surfaces removed.
00061     hlhsr       // Draw surfaces and edges - hidden removed.
00062   };
00063 
00064   // enums and nested class for communicating a modification to the vis
00065   // attributes for a specfic touchable defined by PVNameCopyNoPath.
00066   enum VisAttributesSignifier {
00067     VASVisibility,
00068     VASDaughtersInvisible,
00069     VASColour,
00070     VASLineStyle,
00071     VASLineWidth,
00072     VASForceWireframe,
00073     VASForceSolid,
00074     VASForceAuxEdgeVisible,
00075     VASForceLineSegmentsPerCircle
00076   };
00077   class PVNameCopyNo {
00078   public:
00079     PVNameCopyNo(G4String name, G4int copyNo):
00080     fName(name), fCopyNo(copyNo) {}
00081     const G4String& GetName() const {return fName;}
00082     G4int GetCopyNo() const {return fCopyNo;}
00083   private:
00084     G4String fName;
00085     G4int fCopyNo;
00086   };
00087   typedef std::vector<PVNameCopyNo> PVNameCopyNoPath;
00088   typedef PVNameCopyNoPath::const_iterator PVNameCopyNoPathConstIterator;
00089   class VisAttributesModifier {
00090   public:
00091     VisAttributesModifier
00092       (const G4VisAttributes& visAtts,
00093        VisAttributesSignifier signifier,
00094        const PVNameCopyNoPath& path):
00095       fVisAtts(visAtts), fSignifier(signifier), fPVNameCopyNoPath(path) {}
00096     VisAttributesModifier
00097       (const G4VisAttributes& visAtts,
00098        VisAttributesSignifier signifier,
00099        const std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>& path);
00100     const G4VisAttributes& GetVisAttributes() const
00101       {return fVisAtts;}
00102     VisAttributesSignifier GetVisAttributesSignifier() const
00103       {return fSignifier;}
00104     const PVNameCopyNoPath& GetPVNameCopyNoPath() const
00105       {return fPVNameCopyNoPath;}
00106   private:
00107     G4VisAttributes fVisAtts;
00108     VisAttributesSignifier fSignifier;
00109     PVNameCopyNoPath fPVNameCopyNoPath;
00110   };
00111   
00112   G4ModelingParameters ();
00113 
00114   G4ModelingParameters (const G4VisAttributes* pDefaultVisAttributes,
00115                         DrawingStyle drawingStyle,
00116                         G4bool isCulling,
00117                         G4bool isCullingInvisible,
00118                         G4bool isDensityCulling,
00119                         G4double visibleDensity,
00120                         G4bool isCullingCovered,
00121                         G4int noOfSides);
00122   // Culling and clipping policy for G4PhysicalVolumeModel.
00123 
00124   ~G4ModelingParameters ();
00125 
00126   // Note: uses default assignment operator and copy constructor.
00127 
00128   G4bool operator != (const G4ModelingParameters&) const;
00129 
00130   // Get and Is functions...
00131   G4bool           IsWarning                     () const;
00132   const G4VisAttributes* GetDefaultVisAttributes () const;
00133   DrawingStyle     GetDrawingStyle               () const;
00134   G4bool           IsCulling                     () const;
00135   G4bool           IsCullingInvisible            () const;
00136   G4bool           IsDensityCulling              () const;
00137   G4double         GetVisibleDensity             () const;
00138   G4bool           IsCullingCovered              () const;
00139   G4bool           IsExplode                     () const;
00140   G4double         GetExplodeFactor              () const;
00141   const G4Point3D& GetExplodeCentre              () const;
00142   G4int            GetNoOfSides                  () const;
00143   G4VSolid*        GetSectionSolid               () const;
00144   G4VSolid*        GetCutawaySolid               () const;
00145   const G4Event*   GetEvent                      () const;
00146   const std::vector<VisAttributesModifier>& GetVisAttributesModifiers() const;
00147 
00148   // Set functions...
00149   void SetWarning              (G4bool);
00150   void SetDefaultVisAttributes (const G4VisAttributes* pDefaultVisAttributes);
00151   void SetDrawingStyle         (DrawingStyle);
00152   void SetCulling              (G4bool);
00153   void SetCullingInvisible     (G4bool);
00154   void SetDensityCulling       (G4bool);
00155   void SetVisibleDensity       (G4double);
00156   void SetCullingCovered       (G4bool);
00157   void SetExplodeFactor        (G4double explodeFactor);
00158   void SetExplodeCentre        (const G4Point3D& explodeCentre);
00159   G4int SetNoOfSides           (G4int);  // Returns actual number set.
00160   void SetSectionSolid         (G4VSolid* pSectionSolid);
00161   void SetCutawaySolid         (G4VSolid* pCutawaySolid);
00162   void SetEvent                (const G4Event* pEvent);
00163   void SetVisAttributesModifiers(const std::vector<VisAttributesModifier>);
00164 
00165   static G4bool PVNameCopyNoPathNotEqual
00166   (const PVNameCopyNoPath&,
00167    const PVNameCopyNoPath&);
00168 
00169   static G4bool VAMSNotEqual
00170   (const std::vector<VisAttributesModifier>&,
00171    const std::vector<VisAttributesModifier>&);
00172 
00173   friend std::ostream& operator <<
00174   (std::ostream& os, const G4ModelingParameters&);
00175   
00176   friend std::ostream& operator <<
00177   (std::ostream& os, const PVNameCopyNoPath&);
00178 
00179   friend std::ostream& operator <<
00180   (std::ostream& os,
00181    const std::vector<VisAttributesModifier>&);
00182 
00183 private:
00184 
00185   // Data members...
00186   G4bool       fWarning;         // Print warnings if true.
00187   const G4VisAttributes* fpDefaultVisAttributes;
00188   DrawingStyle fDrawingStyle;    // Drawing style.
00189   G4bool       fCulling;         // Culling requested.
00190   G4bool       fCullInvisible;   // Cull (don't Draw) invisible objects.
00191   G4bool       fDensityCulling;  // Density culling requested.  If so...
00192   G4double     fVisibleDensity;  // ...density lower than this not drawn.
00193   G4bool       fCullCovered;     // Cull daughters covered by opaque mothers.
00194   G4double     fExplodeFactor;   // Explode along radius by this factor...
00195   G4Point3D    fExplodeCentre;   // ...about this centre.
00196   G4int        fNoOfSides;       // ...if polygon approximates circle.
00197   G4VSolid*    fpSectionSolid;   // For generic section (DCUT).
00198   G4VSolid*    fpCutawaySolid;   // For generic cutaways.
00199   const G4Event* fpEvent;        // Event being processed.
00200   std::vector<VisAttributesModifier> fVisAttributesModifiers;
00201 };
00202 
00203 std::ostream& operator <<
00204 (std::ostream& os, const G4ModelingParameters&);
00205 
00206 std::ostream& operator <<
00207 (std::ostream& os, const G4ModelingParameters::PVNameCopyNoPath&);
00208 
00209 std::ostream& operator <<
00210 (std::ostream& os,
00211  const std::vector<G4ModelingParameters::VisAttributesModifier>&);
00212 
00213 #include "G4ModelingParameters.icc"
00214 
00215 #endif

Generated on Mon May 27 17:48:52 2013 for Geant4 by  doxygen 1.4.7