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

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

update to CVS

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