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 // G4VModel is a base class for visualization models. A model is a 00035 // graphics-system-indepedent description of a Geant4 component. 00036 // The key fuctionality of a model is to know how to describe itself 00037 // to a scene handler. A scene is a collection of models. 00038 // A special case is made for G4PhysicalVolumeModel - a non-null pointer 00039 // is to be returned by G4PhysicalVolumeModel::GetG4PhysicalVolumeModel(). 00040 00041 #ifndef G4VMODEL_HH 00042 #define G4VMODEL_HH 00043 00044 #include "globals.hh" 00045 #include "G4VisExtent.hh" 00046 #include "G4Transform3D.hh" 00047 00048 class G4VGraphicsScene; 00049 class G4ModelingParameters; 00050 00051 class G4PhysicalVolumeModel; // Special case - see above. 00052 00053 class G4VModel { 00054 00055 public: // With description 00056 00057 friend std::ostream& operator << (std::ostream& os, const G4VModel&); 00058 00059 G4VModel 00060 (const G4Transform3D& modelTransformation = G4Transform3D(), 00061 const G4ModelingParameters* = 0); 00062 00063 virtual ~G4VModel (); 00064 00065 virtual void DescribeYourselfTo (G4VGraphicsScene&) = 0; 00066 // The main task of a model is to describe itself to the graphics scene. 00067 00068 const G4ModelingParameters* GetModelingParameters () const; 00069 00070 const G4String& GetType() const; 00071 // The sub-class should set its type, which could be the class 00072 // name, or, in the case of G4CallBackModel, it could be the type of 00073 // object it is coding. 00074 00075 virtual G4String GetCurrentDescription () const; 00076 // A description which depends on the current state of the model. 00077 00078 virtual G4String GetCurrentTag () const; 00079 // A tag which depends on the current state of the model. 00080 00081 const G4VisExtent& GetExtent () const; 00082 // Extent of visible objects in local coordinate system. 00083 00084 const G4String& GetGlobalDescription () const; 00085 // A description which does not change and lasts the life of the model. 00086 00087 const G4String& GetGlobalTag () const; 00088 // A tag which does not change and lasts the life of the model. 00089 00090 const G4Transform3D& GetTransformation () const; 00091 // Model transformation, i.e., position and orientation of model in 00092 // world. It is the responsibility of the model to apply this 00093 // transformation before passing items to the graphics scene. 00094 00095 // Set methods for above... 00096 void SetModelingParameters (const G4ModelingParameters*); 00097 void SetExtent (const G4VisExtent&); 00098 void SetType (const G4String&); 00099 void SetGlobalDescription (const G4String&); 00100 void SetGlobalTag (const G4String&); 00101 void SetTransformation (const G4Transform3D&); 00102 00103 virtual G4bool Validate (G4bool warn = true); 00104 // Validate, but allow internal changes (hence non-const function). 00105 00106 protected: 00107 00108 G4String fType; 00109 G4String fGlobalTag; 00110 G4String fGlobalDescription; 00111 G4VisExtent fExtent; 00112 G4Transform3D fTransform; 00113 const G4ModelingParameters* fpMP; 00114 00115 private: 00116 00117 // Private copy constructor and assigment operator - copying and 00118 // assignment not allowed. Keeps CodeWizard happy. 00119 G4VModel (const G4VModel&); 00120 G4VModel& operator = (const G4VModel&); 00121 }; 00122 00123 #include "G4VModel.icc" 00124 00125 #endif