Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4DAWNFILESceneHandler.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$
28 //
29 // Satoshi TANAKA
30 
31 #ifndef G4DAWNFILE_SCENE_HANDLER_HH
32 #define G4DAWNFILE_SCENE_HANDLER_HH
33 
34 #include "globals.hh"
35 
36 #include "G4VSceneHandler.hh"
37 
38 #include "G4FRofstream.hh"
39 #include "G4FRConst.hh"
40 
41 
42 class G4VisAttributes ;
43 class G4DAWNFILE;
44 
45 
46  //-----
48 
49  friend class G4DAWNFILEViewer;
50 
51 public:
52 
53  //----- constructor and destructor
54  G4DAWNFILESceneHandler (G4DAWNFILE& system, const G4String& name = "");
55  virtual ~G4DAWNFILESceneHandler ();
56 
57  //----- overriding base class methods
58  void AddPrimitive (const G4Polyline& line);
59  void AddPrimitive (const G4Polyhedron& p);
60  void AddPrimitive (const G4NURBS& nurb);
61  void AddPrimitive (const G4Text&);
62  void AddPrimitive (const G4Circle&);
63  void AddPrimitive (const G4Square&);
64 
65  //----- explicitly invoke base class methods to avoid warnings about
66  //----- hiding of base class methods.
67  void AddPrimitive (const G4Polymarker& polymarker)
68  { G4VSceneHandler::AddPrimitive (polymarker); }
69  void AddPrimitive (const G4Scale& scale)
71 
74 
75  virtual void BeginPrimitives (const G4Transform3D& objectTransformation);
76  virtual void EndPrimitives ();
77 
78  void AddSolid ( const G4Box& box );
79  void AddSolid ( const G4Cons& cons );
80  void AddSolid ( const G4Tubs& tubs );
81  void AddSolid ( const G4Trd& trd );
82  void AddSolid ( const G4Trap& trap );
83  void AddSolid ( const G4Sphere& sphere );
84  void AddSolid ( const G4Para& para );
85  void AddSolid ( const G4Torus& torus );
86  void AddSolid ( const G4Polycone& polycone ) {
87  G4VSceneHandler::AddSolid (polycone);
88  }
89  void AddSolid ( const G4Polyhedra& polyhedra) {
90  G4VSceneHandler::AddSolid (polyhedra);
91  }
92  void AddSolid ( const G4VSolid& solid );
93  void AddCompound ( const G4VTrajectory& traj) {
95  }
96  void AddCompound ( const G4VHit& hit) {
98  }
99  void AddCompound ( const G4VDigi& digi) {
101  }
104  }
105 
106  void ClearTransientStore(); // Used for triggering detector re-drawing.
107 
108  //----- public methods inherent to this class
109  void FRBeginModeling () ;
110  void FREndModeling () ;
111  G4bool FRIsInModeling () { return FRflag_in_modeling ; }
112 
113  G4bool IsSavingG4Prim ( void ) { return flag_saving_g4_prim ; }
114  void BeginSavingG4Prim( void );
115  void EndSavingG4Prim ( void ) ;
116  void SetG4PrimFileName() ;
117 
118  G4DAWNFILE& GetSystem () { return fSystem ; }
119  void SendBoundingBox ( void );
120  const char* GetG4PrimFileName () { return fG4PrimFileName ; }
121 
122 
123 private:
124 
125  //----- Utilities etc (common to DAWN and DAWNFILE drivers )
126  G4bool SendVisAttributes ( const G4VisAttributes* pAV );
127  G4bool IsVisible ( void ) ;
128  void SendTransformedCoordinates( void ) ;
129  void SendPhysVolName ( void ) ;
130  void SendNdiv ( void ) ;
131 
132  //----- public methods common to DAWN and DAWNFILE drivers
133 public:
134  void SendStr ( const char* char_string ) ;
135  void SendStrInt( const char* char_string ,
136  G4int ival );
137  void SendStrInt3( const char* char_string ,
138  G4int ival1 ,
139  G4int ival2 ,
140  G4int ival3 );
141  void SendStrInt4( const char* char_string ,
142  G4int ival1 ,
143  G4int ival2 ,
144  G4int ival3 ,
145  G4int ival4 );
146  void SendStrDouble( const char* char_string ,
147  G4double dval );
148  void SendStrDouble2( const char* char_string ,
149  G4double dval1 ,
150  G4double dval2 );
151  void SendStrDouble3( const char* char_string ,
152  G4double dval1 ,
153  G4double dval2 ,
154  G4double dval3 );
155 
156  void SendStrDouble4( const char* char_string ,
157  G4double dval1 ,
158  G4double dval2 ,
159  G4double dval3 ,
160  G4double dval4 );
161 
162  void SendStrDouble5( const char* char_string ,
163  G4double dval1 ,
164  G4double dval2 ,
165  G4double dval3 ,
166  G4double dval4 ,
167  G4double dval5 );
168 
169  void SendStrDouble6( const char* char_string ,
170  G4double dval1 ,
171  G4double dval2 ,
172  G4double dval3 ,
173  G4double dval4 ,
174  G4double dval5 ,
175  G4double dval6 );
176 
177  void SendStrDouble7( const char* char_string ,
178  G4double dval1 ,
179  G4double dval2 ,
180  G4double dval3 ,
181  G4double dval4 ,
182  G4double dval5 ,
183  G4double dval6 ,
184  G4double dval7 );
185 
186  void SendStrDouble11( const char* char_string ,
187  G4double dval1 ,
188  G4double dval2 ,
189  G4double dval3 ,
190  G4double dval4 ,
191  G4double dval5 ,
192  G4double dval6 ,
193  G4double dval7 ,
194  G4double dval8 ,
195  G4double dval9 ,
196  G4double dval10 ,
197  G4double dval11 ) ;
198 
199  void SendIntDouble3( G4int ival ,
200  G4double dval1 ,
201  G4double dval2 ,
202  G4double dval3 );
203  void SendInt3Str( G4int ival1 ,
204  G4int ival2 ,
205  G4int ival3 ,
206  const char* char_string );
207  void SendInt4Str( G4int ival1 ,
208  G4int ival2 ,
209  G4int ival3 ,
210  G4int ival4 ,
211  const char* char_string );
212 
213  void SendStrDouble3Str( const char* char_string1 ,
214  G4double dval1 ,
215  G4double dval2 ,
216  G4double dval3 ,
217  const char* char_string2 );
218 
219  void SendStrDouble6Str( const char* char_string1 ,
220  G4double dval1 ,
221  G4double dval2 ,
222  G4double dval3 ,
223  G4double dval4 ,
224  G4double dval5 ,
225  G4double dval6 ,
226  const char* char_string2 );
227 
228  void SendInt ( G4int val );
229  void SendDouble( G4double val );
230 
231 private:
232  G4DAWNFILE& fSystem; // Graphics system for this scene.
233  static G4int fSceneIdCount;
234 
235  G4FRofstream fPrimDest ; // defined here
236  G4bool FRflag_in_modeling ;
237  // true: FR_BEGIN_MODELING has sent to DAWN, and
238  // FR_END_MODELING has not sent yet.
239  // false: otherwise
240  //
241  // FRflag_in_modeling is set to "true"
242  // in FRBeginModeling(), and to "false"
243  // in FREndModeling().
244 
245  G4bool flag_saving_g4_prim ;
246 
247  const int COMMAND_BUF_SIZE ;
248 
249  char fG4PrimDestDir [256] ;
250  char fG4PrimFileName[256] ;
251  G4int fMaxFileNum ;
252 
253  G4int fPrec, fPrec2 ;
254 
255 };
256 
257 #endif