source: trunk/source/visualization/FukuiRenderer/include/G4DAWNFILESceneHandler.hh @ 1347

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

geant4 tag 9.4

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