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

Last change on this file since 1202 was 1140, checked in by garnier, 15 years ago

update to CVS

File size: 7.7 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.17 2009/10/21 14:59:17 allison Exp $
28// GEANT4 tag $Name:  $
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 G4THitsMap<G4double> & hits) {
101    G4VSceneHandler::AddCompound(hits);
102  }
103
104  void ClearTransientStore();  // Used for triggering detector re-drawing.
105
106        //----- public methods inherent to this class
107  void         FRBeginModeling () ;
108  void         FREndModeling   () ;
109  G4bool       FRIsInModeling  () { return FRflag_in_modeling ; }
110
111  G4bool IsSavingG4Prim   ( void ) { return flag_saving_g4_prim ;       }
112  void  BeginSavingG4Prim( void ); 
113  void  EndSavingG4Prim  ( void ) ;
114  void  SetG4PrimFileName() ;
115
116  G4DAWNFILE&  GetSystem   () { return fSystem   ; }
117  void         SendBoundingBox   ( void );
118  const char*  GetG4PrimFileName () { return fG4PrimFileName ; }
119
120
121private:
122
123        //----- Utilities etc (common to DAWN and DAWNFILE drivers )
124  G4bool    SendVisAttributes ( const G4VisAttributes*  pAV );
125  G4bool    IsVisible     ( void ) ;
126  void      SendTransformedCoordinates( void ) ;
127  void      SendPhysVolName           ( void ) ;
128  void      SendNdiv                  ( void ) ;
129
130        //----- public methods common to DAWN and DAWNFILE drivers
131public:
132  void   SendStr   (    const char*     char_string ) ;
133  void   SendStrInt(    const char*     char_string ,
134                        G4int           ival    );
135  void   SendStrInt3(   const char*     char_string ,
136                        G4int           ival1  ,
137                        G4int           ival2  ,
138                        G4int           ival3   );
139  void   SendStrInt4(   const char*     char_string ,
140                        G4int           ival1  ,
141                        G4int           ival2  ,
142                        G4int           ival3  ,
143                        G4int           ival4   );
144  void   SendStrDouble( const char*     char_string ,
145                        G4double        dval   );
146  void   SendStrDouble2(        const char*     char_string ,
147                                G4double        dval1  ,
148                                G4double        dval2  );
149  void   SendStrDouble3(        const char*     char_string ,
150                                G4double        dval1  ,
151                                G4double        dval2  ,
152                                G4double        dval3   );
153
154  void   SendStrDouble4(        const char*     char_string ,
155                                G4double        dval1  ,
156                                G4double        dval2  ,
157                                G4double        dval3  ,
158                                G4double        dval4  );
159
160  void   SendStrDouble5(        const char*     char_string ,
161                                G4double        dval1  ,
162                                G4double        dval2  ,
163                                G4double        dval3  ,
164                                G4double        dval4  ,
165                                G4double        dval5  );
166
167  void   SendStrDouble6(        const char*     char_string ,
168                                G4double        dval1  ,
169                                G4double        dval2  ,
170                                G4double        dval3  ,
171                                G4double        dval4  ,
172                                G4double        dval5  ,
173                                G4double        dval6   );
174
175  void   SendStrDouble7(        const char*     char_string ,
176                                G4double        dval1  ,
177                                G4double        dval2  ,
178                                G4double        dval3  ,
179                                G4double        dval4  ,
180                                G4double        dval5  ,
181                                G4double        dval6  ,
182                                G4double        dval7   );
183
184  void  SendStrDouble11(        const char*     char_string ,
185                                G4double        dval1  ,
186                                G4double        dval2  ,
187                                G4double        dval3  ,
188                                G4double        dval4  ,
189                                G4double        dval5  ,
190                                G4double        dval6  ,
191                                G4double        dval7  ,
192                                G4double        dval8  ,
193                                G4double        dval9  ,
194                                G4double        dval10  ,
195                                G4double        dval11   ) ;
196
197  void   SendIntDouble3(        G4int           ival   ,
198                                G4double        dval1  ,
199                                G4double        dval2  ,
200                                G4double        dval3  );
201  void   SendInt3Str(   G4int           ival1  ,
202                        G4int           ival2  ,
203                        G4int           ival3  ,
204                        const char*     char_string );
205  void   SendInt4Str(   G4int           ival1  ,
206                        G4int           ival2  ,
207                        G4int           ival3  ,
208                        G4int           ival4  ,
209                        const char*     char_string );
210
211  void  SendStrDouble6Str(      const char*     char_string1 ,
212                                G4double        dval1  ,
213                                G4double        dval2  ,
214                                G4double        dval3  ,
215                                G4double        dval4  ,
216                                G4double        dval5  ,
217                                G4double        dval6  ,
218                                const char*     char_string2 );
219
220  void  SendInt   (     G4int           val );
221  void  SendDouble(     G4double        val );
222
223private:
224  G4DAWNFILE&   fSystem;     // Graphics system for this scene.
225  static G4int  fSceneIdCount;
226
227  G4FRofstream  fPrimDest    ;  // defined here
228  G4bool        FRflag_in_modeling ;   
229                // true:  FR_BEGIN_MODELING has sent to DAWN, and
230                //        FR_END_MODELING   has not sent yet.
231                // false:  otherwise
232                //
233                // FRflag_in_modeling is set to "true"
234                // in FRBeginModeling(), and to "false"
235                // in FREndModeling().
236
237  G4bool        flag_saving_g4_prim ;   
238
239  const int     COMMAND_BUF_SIZE    ;
240
241  char          fG4PrimDestDir [256] ; 
242  char          fG4PrimFileName[256] ;
243  G4int         fMaxFileNum           ;
244
245  G4int         fPrec, fPrec2 ;
246       
247};
248
249#endif
Note: See TracBrowser for help on using the repository browser.