Geant4_10
G4BoundingSphereScene.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4BoundingSphereScene.hh 66373 2012-12-18 09:41:34Z gcosmo $
28 //
29 //
30 // John Allison 7th June 1997
31 // An artificial scene to reuse G4VScene code to calculate a bounding sphere.
32 
33 #ifndef G4BOUNDINGSPHERESCENE_HH
34 #define G4BOUNDINGSPHERESCENE_HH
35 
36 #include "G4VGraphicsScene.hh"
37 #include "G4VisExtent.hh"
38 #include "G4Box.hh"
39 #include "G4Cons.hh"
40 #include "G4Tubs.hh"
41 #include "G4Trd.hh"
42 #include "G4Trap.hh"
43 #include "G4Sphere.hh"
44 #include "G4Para.hh"
45 #include "G4Torus.hh"
46 #include "G4Polycone.hh"
47 #include "G4Polyhedra.hh"
48 
49 class G4VModel;
50 
52 
53 public:
54  G4BoundingSphereScene (G4VModel* pModel = 0);
55  virtual ~G4BoundingSphereScene ();
56  void PreAddSolid (const G4Transform3D& objectTransformation,
57  const G4VisAttributes&);
58  void PostAddSolid () {}
59  void AddSolid (const G4Box& solid) {Accrue (solid);}
60  void AddSolid (const G4Cons& solid) {Accrue (solid);}
61  void AddSolid (const G4Tubs& solid) {Accrue (solid);}
62  void AddSolid (const G4Trd& solid) {Accrue (solid);}
63  void AddSolid (const G4Trap& solid) {Accrue (solid);}
64  void AddSolid (const G4Sphere& solid) {Accrue (solid);}
65  void AddSolid (const G4Para& solid) {Accrue (solid);}
66  void AddSolid (const G4Torus& solid) {Accrue (solid);}
67  void AddSolid (const G4Polycone& solid) {Accrue (solid);}
68  void AddSolid (const G4Polyhedra& solid) {Accrue (solid);}
69  void AddSolid (const G4VSolid& solid) {Accrue (solid);}
70  void AddCompound (const G4VTrajectory&) {}
71  void AddCompound (const G4VHit&) {}
72  void AddCompound (const G4VDigi&) {}
75  const G4Point3D& GetCentre() const {return fCentre;}
76  G4double GetRadius() const {return fRadius;}
77 
78  void SetCentre(const G4Point3D& centre) {fCentre = centre;}
79 
81  // The following 2 functions can be used by any code which wishes to
82  // accrue a bounding sphere. Just instantiate a
83  // G4BoundingSphereScene and use AccrueBoundingSphere.
84 
85  void ResetBoundingSphere ();
86  void AccrueBoundingSphere (const G4Point3D& centre,
87  G4double radius);
88 
90  // Functions not used by required by the abstract interface.
91 
92  virtual void BeginPrimitives (const G4Transform3D&) {}
93  virtual void EndPrimitives () {}
94  virtual void BeginPrimitives2D (const G4Transform3D&) {}
95  virtual void EndPrimitives2D () {}
96  virtual void AddPrimitive (const G4Polyline&) {}
97  virtual void AddPrimitive (const G4Scale&) {}
98  virtual void AddPrimitive (const G4Text&) {}
99  virtual void AddPrimitive (const G4Circle&) {}
100  virtual void AddPrimitive (const G4Square&) {}
101  virtual void AddPrimitive (const G4Polymarker&) {}
102  virtual void AddPrimitive (const G4Polyhedron&) {}
103 
104 private:
105  void Accrue (const G4VSolid& solid);
106  G4VModel* fpModel; // Instantiating code may optionally set this.
107  G4Point3D fCentre;
108  G4double fRadius;
109  const G4Transform3D* fpObjectTransformation;
110 };
111 
112 #endif
Definition: G4Para.hh:76
Definition: G4Text.hh:73
void AddSolid(const G4Para &solid)
G4BoundingSphereScene(G4VModel *pModel=0)
virtual void AddPrimitive(const G4Scale &)
void AddSolid(const G4Sphere &solid)
Definition: G4Box.hh:63
virtual void AddPrimitive(const G4Text &)
Definition: G4Tubs.hh:84
void AddSolid(const G4Trd &solid)
void AddSolid(const G4Polyhedra &solid)
Definition: G4VHit.hh:48
void AddSolid(const G4Torus &solid)
const G4Point3D & GetCentre() const
Definition: G4Trd.hh:71
void AddCompound(const G4VDigi &)
virtual void AddPrimitive(const G4Circle &)
void AddSolid(const G4VSolid &solid)
void AddSolid(const G4Trap &solid)
virtual void AddPrimitive(const G4Square &)
Definition: G4Cons.hh:82
G4VisExtent GetBoundingSphereExtent()
virtual void BeginPrimitives2D(const G4Transform3D &)
void PreAddSolid(const G4Transform3D &objectTransformation, const G4VisAttributes &)
void AddCompound(const G4THitsMap< G4double > &)
virtual void BeginPrimitives(const G4Transform3D &)
virtual void AddPrimitive(const G4Polyhedron &)
virtual void AddPrimitive(const G4Polyline &)
void AddSolid(const G4Tubs &solid)
void AddCompound(const G4VTrajectory &)
void SetCentre(const G4Point3D &centre)
void AccrueBoundingSphere(const G4Point3D &centre, G4double radius)
void AddSolid(const G4Polycone &solid)
void AddCompound(const G4VHit &)
double G4double
Definition: G4Types.hh:76
virtual void AddPrimitive(const G4Polymarker &)
void AddSolid(const G4Box &solid)
void AddSolid(const G4Cons &solid)