Geant4  10.03.p03
 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: G4FukuiRendererSceneHandler.hh 99152 2016-09-07 08:04:30Z gcosmo $
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 G4Text&);
64  void AddPrimitive (const G4Circle&);
65  void AddPrimitive (const G4Square&);
66 
67  //----- explicitly invoke base class methods to avoid warnings about
68  //----- hiding of base class methods.
69  void AddPrimitive (const G4Polymarker& polymarker)
70  { G4VSceneHandler::AddPrimitive (polymarker); }
71  void AddPrimitive (const G4Scale& scale)
73 
74  virtual void BeginModeling () { G4VSceneHandler::BeginModeling ();}
75  virtual void EndModeling () { G4VSceneHandler::EndModeling ();}
76 
77  virtual void BeginPrimitives (const G4Transform3D& objectTransformation);
78  virtual void EndPrimitives ();
79 
80  void AddSolid ( const G4Box& box );
81  void AddSolid ( const G4Cons& cons );
82  void AddSolid ( const G4Tubs& tubs );
83  void AddSolid ( const G4Trd& trd );
84  void AddSolid ( const G4Trap& trap );
85  void AddSolid ( const G4Sphere& sphere );
86  void AddSolid ( const G4Para& para );
87  void AddSolid ( const G4Torus& torus );
88  void AddSolid ( const G4Polycone& polycone) {
89  G4VSceneHandler::AddSolid (polycone);
90  }
91  void AddSolid ( const G4Polyhedra& polyhedra) {
92  G4VSceneHandler::AddSolid (polyhedra);
93  }
94  void AddSolid ( const G4Orb& orb ) {
96  }
97  void AddSolid ( const G4Ellipsoid& ellipsoid) {
98  G4VSceneHandler::AddSolid (ellipsoid);
99  }
100  void AddSolid ( const G4VSolid& solid );
101  void AddCompound ( const G4VTrajectory& traj) {
103  }
104  void AddCompound ( const G4VHit& hit) {
106  }
107  void AddCompound ( const G4VDigi& digi) {
109  }
110  void AddCompound ( const G4THitsMap<G4double> & hits) {
112  }
113  void AddCompound ( const G4THitsMap<G4StatDouble> & hits) {
115  }
116 
117  void ClearTransientStore(); // Used for triggering detector re-drawing.
118 
119  //----- methods inherent to this class
120  void FRBeginModeling () ;
121  void FREndModeling () ;
122  G4bool FRIsInModeling () { return FRflag_in_modeling ; }
123 
124  G4bool IsSavingG4Prim ( void ) { return flag_saving_g4_prim ; }
125  void BeginSavingG4Prim( void )
126  {
127  if( !IsSavingG4Prim() )
128  {
129  SendStr( FR_SAVE ) ;
130  SendStr( FR_G4_PRIM_HEADER ) ;
131  flag_saving_g4_prim = true ;
132  }
133  }
134  void EndSavingG4Prim ( void )
135  { if( IsSavingG4Prim() ) { SendStr( FR_END_SAVE ); flag_saving_g4_prim = false ; } }
136 
137  G4FRClientServer& GetPrimDest () { return fPrimDest ; }
138  G4FukuiRenderer& GetSystem () { return fSystem ; }
139  void SendBoundingBox ( void );
140 
141 private:
142 
143  //----- Utilities etc
144  G4bool SendVisAttributes ( const G4VisAttributes* pAV );
145  G4bool IsVisible ( void ) ;
146  void SendTransformedCoordinates( void ) ;
147  void SendPhysVolName ( void ) ;
148  void SendNdiv ( void ) ;
149 
150 public:
151 
152  void SendStr ( const char* char_string ) ;
153  void SendStrInt( const char* char_string ,
154  G4int ival );
155  void SendStrInt3( const char* char_string ,
156  G4int ival1 ,
157  G4int ival2 ,
158  G4int ival3 );
159  void SendStrInt4( const char* char_string ,
160  G4int ival1 ,
161  G4int ival2 ,
162  G4int ival3 ,
163  G4int ival4 );
164  void SendStrDouble( const char* char_string ,
165  G4double dval );
166  void SendStrDouble2( const char* char_string ,
167  G4double dval1 ,
168  G4double dval2 );
169  void SendStrDouble3( const char* char_string ,
170  G4double dval1 ,
171  G4double dval2 ,
172  G4double dval3 );
173 
174  void SendStrDouble4( const char* char_string ,
175  G4double dval1 ,
176  G4double dval2 ,
177  G4double dval3 ,
178  G4double dval4 );
179 
180  void SendStrDouble5( const char* char_string ,
181  G4double dval1 ,
182  G4double dval2 ,
183  G4double dval3 ,
184  G4double dval4 ,
185  G4double dval5 );
186 
187  void SendStrDouble6( const char* char_string ,
188  G4double dval1 ,
189  G4double dval2 ,
190  G4double dval3 ,
191  G4double dval4 ,
192  G4double dval5 ,
193  G4double dval6 );
194 
195  void SendStrDouble7( const char* char_string ,
196  G4double dval1 ,
197  G4double dval2 ,
198  G4double dval3 ,
199  G4double dval4 ,
200  G4double dval5 ,
201  G4double dval6 ,
202  G4double dval7 );
203 
204  void SendStrDouble11( const char* char_string ,
205  G4double dval1 ,
206  G4double dval2 ,
207  G4double dval3 ,
208  G4double dval4 ,
209  G4double dval5 ,
210  G4double dval6 ,
211  G4double dval7 ,
212  G4double dval8 ,
213  G4double dval9 ,
214  G4double dval10 ,
215  G4double dval11 ) ;
216 
217  void SendIntDouble3( G4int ival ,
218  G4double dval1 ,
219  G4double dval2 ,
220  G4double dval3 );
221  void SendInt3Str( G4int ival1 ,
222  G4int ival2 ,
223  G4int ival3 ,
224  const char* char_string );
225  void SendInt4Str( G4int ival1 ,
226  G4int ival2 ,
227  G4int ival3 ,
228  G4int ival4 ,
229  const char* char_string );
230 
231  void SendStrDouble3Str( const char* char_string1 ,
232  G4double dval1 ,
233  G4double dval2 ,
234  G4double dval3 ,
235  const char* char_string2 );
236 
237  void SendStrDouble6Str( const char* char_string1 ,
238  G4double dval1 ,
239  G4double dval2 ,
240  G4double dval3 ,
241  G4double dval4 ,
242  G4double dval5 ,
243  G4double dval6 ,
244  const char* char_string2 );
245 
246  void SendInt ( G4int val );
247  void SendDouble( G4double val );
248 
249 
250 
251 private:
252  G4FukuiRenderer& fSystem; // Graphics system for this scene.
253  static G4int fSceneIdCount;
254 
255  G4FRClientServer& fPrimDest ; // defined in G4FukuiRenderer
256  G4bool FRflag_in_modeling ;
257  // true: FR_BEGIN_MODELING has sent to DAWN, and
258  // FR_END_MODELING has not sent yet.
259  // false: otherwise
260  //
261  // FRflag_in_modeling is set to "true"
262  // in FRBeginModeling(), and to "false"
263  // in FREndModeling().
264 
265  G4bool flag_saving_g4_prim ;
266 
267  const int COMMAND_BUF_SIZE ;
268 
269  G4int fPrec, fPrec2 ;
270 
271 };
272 
273 #endif
274 #endif //G4VIS_BUILD_DAWN_DRIVER
const XML_Char * name
Definition: expat.h:151
Definition: G4Para.hh:77
virtual void AddSolid(const G4Box &)
Definition: G4Text.hh:73
virtual void BeginModeling()
virtual void BeginPrimitives(const G4Transform3D &objectTransformation)
Definition: G4Box.hh:64
const char * p
Definition: xmltok.h:285
Definition: G4Tubs.hh:85
Definition: G4VHit.hh:48
const char FR_G4_PRIM_HEADER[]
Definition: G4FRConst.hh:38
Definition: G4Trd.hh:72
int G4int
Definition: G4Types.hh:78
virtual void AddPrimitive(const G4Polyline &)=0
const char FR_END_SAVE[]
Definition: G4FRConst.hh:54
bool G4bool
Definition: G4Types.hh:79
Definition: G4Cons.hh:83
virtual void EndModeling()
virtual void EndPrimitives()
Definition: G4Orb.hh:61
virtual void AddCompound(const G4VTrajectory &)
double G4double
Definition: G4Types.hh:76
virtual void ClearTransientStore()
const char FR_SAVE[]
Definition: G4FRConst.hh:53
G4VGraphicsSystem & fSystem