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