G4BoundingSphereScene.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  7th June 1997
00031 // An artificial scene to reuse G4VScene code to calculate a bounding sphere.
00032 
00033 #ifndef G4BOUNDINGSPHERESCENE_HH
00034 #define G4BOUNDINGSPHERESCENE_HH
00035 
00036 #include "G4VGraphicsScene.hh"
00037 #include "G4VisExtent.hh"
00038 #include "G4Box.hh"
00039 #include "G4Cons.hh"
00040 #include "G4Tubs.hh"
00041 #include "G4Trd.hh"
00042 #include "G4Trap.hh"
00043 #include "G4Sphere.hh"
00044 #include "G4Para.hh"
00045 #include "G4Torus.hh"
00046 #include "G4Polycone.hh"
00047 #include "G4Polyhedra.hh"
00048 
00049 class G4VModel;
00050 
00051 class G4BoundingSphereScene: public G4VGraphicsScene {
00052 
00053 public:
00054   G4BoundingSphereScene (G4VModel* pModel = 0);
00055   virtual ~G4BoundingSphereScene ();
00056   void PreAddSolid (const G4Transform3D& objectTransformation,
00057                     const G4VisAttributes&);
00058   void PostAddSolid () {}
00059   void AddSolid (const G4Box& solid) {Accrue (solid);}
00060   void AddSolid (const G4Cons& solid) {Accrue (solid);}
00061   void AddSolid (const G4Tubs& solid) {Accrue (solid);}
00062   void AddSolid (const G4Trd& solid) {Accrue (solid);}
00063   void AddSolid (const G4Trap& solid) {Accrue (solid);}
00064   void AddSolid (const G4Sphere& solid) {Accrue (solid);}
00065   void AddSolid (const G4Para& solid) {Accrue (solid);}
00066   void AddSolid (const G4Torus& solid) {Accrue (solid);}
00067   void AddSolid (const G4Polycone& solid) {Accrue (solid);}
00068   void AddSolid (const G4Polyhedra& solid) {Accrue (solid);}
00069   void AddSolid (const G4VSolid& solid) {Accrue (solid);}
00070   void AddCompound (const G4VTrajectory&) {}
00071   void AddCompound (const G4VHit&) {}
00072   void AddCompound (const G4VDigi&) {}
00073   void AddCompound (const G4THitsMap<G4double>&) {}
00074   G4VisExtent GetBoundingSphereExtent ();
00075   const G4Point3D& GetCentre() const {return fCentre;}
00076   G4double GetRadius() const {return fRadius;}
00077 
00078   void SetCentre(const G4Point3D& centre) {fCentre = centre;}
00079 
00081   // The following 2 functions can be used by any code which wishes to
00082   // accrue a bounding sphere.  Just instantiate a
00083   // G4BoundingSphereScene and use AccrueBoundingSphere.
00084 
00085   void ResetBoundingSphere ();
00086   void AccrueBoundingSphere (const G4Point3D& centre,
00087                              G4double radius);
00088 
00090   // Functions not used by required by the abstract interface.
00091 
00092   virtual void BeginPrimitives (const G4Transform3D&) {}
00093   virtual void EndPrimitives () {}
00094   virtual void BeginPrimitives2D (const G4Transform3D&) {}
00095   virtual void EndPrimitives2D () {}
00096   virtual void AddPrimitive (const G4Polyline&)   {}
00097   virtual void AddPrimitive (const G4Scale&)      {}
00098   virtual void AddPrimitive (const G4Text&)       {}
00099   virtual void AddPrimitive (const G4Circle&)     {}
00100   virtual void AddPrimitive (const G4Square&)     {}
00101   virtual void AddPrimitive (const G4Polymarker&) {}
00102   virtual void AddPrimitive (const G4Polyhedron&) {}
00103   virtual void AddPrimitive (const G4NURBS&)      {}
00104 
00105 private:
00106   void Accrue (const G4VSolid& solid);
00107   G4VModel* fpModel;  // Instantiating code may optionally set this.
00108   G4Point3D fCentre;
00109   G4double fRadius;
00110   const G4Transform3D* fpObjectTransformation;
00111 };
00112 
00113 #endif

Generated on Mon May 27 17:47:46 2013 for Geant4 by  doxygen 1.4.7