source: trunk/source/visualization/FukuiRenderer/include/G4FukuiRendererSceneHandler.hh @ 1294

Last change on this file since 1294 was 1294, checked in by garnier, 14 years ago

CVS update

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