Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-21 09:10:33

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  31st December 1997.
0030 //
0031 // Class Description:
0032 //
0033 // G4VModel is a base class for visualization models.  A model is a
0034 // graphics-system-indepedent description of a Geant4 component.
0035 // The key fuctionality of a model is to know how to describe itself
0036 // to a scene handler.  A scene is a collection of models.
0037 //
0038 // The static data member const fpCurrentMP is provided so that it
0039 // can be access statically: G4VModel::GetCurrentModelingParameters().
0040 // Its value is expected to be identical to fpMP set in the scene
0041 // handler, but to avoid linking problems, it must *not* be set on
0042 // the vis side; it must be set in modeling by any model that
0043 // requires it, G4TrajectoriesModel.
0044 
0045 #ifndef G4VMODEL_HH
0046 #define G4VMODEL_HH
0047 
0048 #include "globals.hh"
0049 #include "G4VisExtent.hh"
0050 
0051 class G4VGraphicsScene;
0052 class G4ModelingParameters;
0053 
0054 class G4VModel {
0055 
0056 public: // With description
0057 
0058   friend std::ostream& operator << (std::ostream& os, const G4VModel&);
0059 
0060   G4VModel(const G4ModelingParameters* = 0);
0061    
0062   virtual ~G4VModel ();
0063 
0064   virtual void DescribeYourselfTo (G4VGraphicsScene&) = 0;
0065   // The main task of a model is to describe itself to the graphics scene.
0066 
0067   const G4ModelingParameters* GetModelingParameters () const;
0068   static const G4ModelingParameters* GetCurrentModelingParameters ();
0069   // The latter for static access
0070 
0071   const G4String& GetType() const;
0072   // The sub-class should set its type, which could be the class
0073   // name, or, in the case of G4CallBackModel, it could be the type of
0074   // object it is coding.
0075 
0076   virtual G4String GetCurrentDescription () const;
0077   // A description which depends on the current state of the model.
0078 
0079   virtual G4String GetCurrentTag () const;
0080   // A tag which depends on the current state of the model.
0081 
0082   const G4VisExtent& GetExtent () const;
0083   // Extent of visible objects in local coordinate system.
0084 
0085   const G4String& GetGlobalDescription () const;
0086   // A description which does not change and lasts the life of the model.
0087 
0088   const G4String& GetGlobalTag () const;
0089   // A tag which does not change and lasts the life of the model.
0090 
0091   // Set methods for above...
0092   void SetModelingParameters (const G4ModelingParameters*);
0093   static void SetCurrentModelingParameters (const G4ModelingParameters*);
0094   void SetExtent (const G4VisExtent&);
0095   void SetType (const G4String&);
0096   void SetGlobalDescription (const G4String&);
0097   void SetGlobalTag (const G4String&);
0098 
0099   virtual G4bool Validate (G4bool warn = true);
0100   // Validate, but allow internal changes (hence non-const function).
0101 
0102 protected:
0103 
0104   G4String                    fType;
0105   G4String                    fGlobalTag;
0106   G4String                    fGlobalDescription;
0107   G4VisExtent                 fExtent;
0108   const G4ModelingParameters* fpMP;
0109 
0110 private:
0111 
0112   // Private copy constructor and assigment operator - copying and
0113   // assignment not allowed.  Keeps CodeWizard happy.
0114   G4VModel (const G4VModel&);
0115   G4VModel& operator = (const G4VModel&);
0116 
0117   static const G4ModelingParameters* fpCurrentMP;
0118 };
0119 
0120 #include "G4VModel.icc"
0121 
0122 #endif