source: trunk/source/visualization/modeling/include/G4BoundingSphereScene.hh @ 1346

Last change on this file since 1346 was 1346, checked in by garnier, 13 years ago

before tag

File size: 4.6 KB
Line 
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,v 1.20 2010/05/30 11:23:25 allison Exp $
28// GEANT4 tag $Name:  $
29//
30//
31// John Allison  7th June 1997
32// An artificial scene to reuse G4VScene code to calculate a bounding sphere.
33
34#ifndef G4BOUNDINGSPHERESCENE_HH
35#define G4BOUNDINGSPHERESCENE_HH
36
37#include "G4VGraphicsScene.hh"
38#include "G4VisExtent.hh"
39#include "G4Box.hh"
40#include "G4Cons.hh"
41#include "G4Tubs.hh"
42#include "G4Trd.hh"
43#include "G4Trap.hh"
44#include "G4Sphere.hh"
45#include "G4Para.hh"
46#include "G4Torus.hh"
47#include "G4Polycone.hh"
48#include "G4Polyhedra.hh"
49
50class G4VModel;
51
52class G4BoundingSphereScene: public G4VGraphicsScene {
53
54public:
55  G4BoundingSphereScene (G4VModel* pModel = 0);
56  virtual ~G4BoundingSphereScene ();
57  void PreAddSolid (const G4Transform3D& objectTransformation,
58                    const G4VisAttributes&);
59  void PostAddSolid () {}
60  void AddSolid (const G4Box& s) {Accrue (s);}
61  void AddSolid (const G4Cons& s) {Accrue (s);}
62  void AddSolid (const G4Tubs& s) {Accrue (s);}
63  void AddSolid (const G4Trd& s) {Accrue (s);}
64  void AddSolid (const G4Trap& s) {Accrue (s);}
65  void AddSolid (const G4Sphere& s) {Accrue (s);}
66  void AddSolid (const G4Para& s) {Accrue (s);}
67  void AddSolid (const G4Torus& s) {Accrue (s);}
68  void AddSolid (const G4Polycone& s) {Accrue (s);}
69  void AddSolid (const G4Polyhedra& s) {Accrue (s);}
70  void AddSolid (const G4VSolid& s) {Accrue (s);}
71  void AddCompound (const G4VTrajectory&) {}
72  void AddCompound (const G4VHit&) {}
73  void AddCompound (const G4VDigi&) {}
74  void AddCompound (const G4THitsMap<G4double>&) {}
75  G4VisExtent GetBoundingSphereExtent ();
76  const G4Point3D& GetCentre() const {return fCentre;}
77  G4double GetRadius() const {return fRadius;}
78
79  void SetCentre(const G4Point3D& centre) {fCentre = centre;}
80
81  ////////////////////////////////////////////////////////////////
82  // The following 2 functions can be used by any code which wishes to
83  // accrue a bounding sphere.  Just instantiate a
84  // G4BoundingSphereScene and use AccrueBoundingSphere.
85
86  void ResetBoundingSphere ();
87  void AccrueBoundingSphere (const G4Point3D& centre,
88                             G4double radius);
89
90  ////////////////////////////////////////////////////////////////
91  // Functions not used by required by the abstract interface.
92
93  virtual void BeginPrimitives (const G4Transform3D&) {}
94  virtual void EndPrimitives () {}
95  virtual void BeginPrimitives2D (const G4Transform3D&) {}
96  virtual void EndPrimitives2D () {}
97  virtual void AddPrimitive (const G4Polyline&)   {}
98  virtual void AddPrimitive (const G4Scale&)      {}
99  virtual void AddPrimitive (const G4Text&)       {}
100  virtual void AddPrimitive (const G4Circle&)     {}
101  virtual void AddPrimitive (const G4Square&)     {}
102  virtual void AddPrimitive (const G4Polymarker&) {}
103  virtual void AddPrimitive (const G4Polyhedron&) {}
104  virtual void AddPrimitive (const G4NURBS&)      {}
105
106private:
107  void Accrue (const G4VSolid& solid);
108  G4VModel* fpModel;  // Instantiating code may optionally set this.
109  G4Point3D fCentre;
110  G4double fRadius;
111  const G4Transform3D* fpObjectTransformation;
112};
113
114#endif
Note: See TracBrowser for help on using the repository browser.