Geant4.10
 All Data Structures 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 66373 2012-12-18 09:41:34Z 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 G4VSolid& solid );
95  void AddCompound ( const G4VTrajectory& traj) {
97  }
98  void AddCompound ( const G4VHit& hit) {
100  }
101  void AddCompound ( const G4VDigi& digi) {
103  }
104  void AddCompound ( const G4THitsMap<G4double> & hits) {
106  }
107 
108  void ClearTransientStore(); // Used for triggering detector re-drawing.
109 
110  //----- methods inherent to this class
111  void FRBeginModeling () ;
112  void FREndModeling () ;
113  G4bool FRIsInModeling () { return FRflag_in_modeling ; }
114 
115  G4bool IsSavingG4Prim ( void ) { return flag_saving_g4_prim ; }
116  void BeginSavingG4Prim( void )
117  {
118  if( !IsSavingG4Prim() )
119  {
120  SendStr( FR_SAVE ) ;
121  SendStr( FR_G4_PRIM_HEADER ) ;
122  flag_saving_g4_prim = true ;
123  }
124  }
125  void EndSavingG4Prim ( void )
126  { if( IsSavingG4Prim() ) { SendStr( FR_END_SAVE ); flag_saving_g4_prim = false ; } }
127 
128  G4FRClientServer& GetPrimDest () { return fPrimDest ; }
129  G4FukuiRenderer& GetSystem () { return fSystem ; }
130  void SendBoundingBox ( void );
131 
132 private:
133 
134  //----- Utilities etc
135  G4bool SendVisAttributes ( const G4VisAttributes* pAV );
136  G4bool IsVisible ( void ) ;
137  void SendTransformedCoordinates( void ) ;
138  void SendPhysVolName ( void ) ;
139  void SendNdiv ( void ) ;
140 
141 public:
142 
143  void SendStr ( const char* char_string ) ;
144  void SendStrInt( const char* char_string ,
145  G4int ival );
146  void SendStrInt3( const char* char_string ,
147  G4int ival1 ,
148  G4int ival2 ,
149  G4int ival3 );
150  void SendStrInt4( const char* char_string ,
151  G4int ival1 ,
152  G4int ival2 ,
153  G4int ival3 ,
154  G4int ival4 );
155  void SendStrDouble( const char* char_string ,
156  G4double dval );
157  void SendStrDouble2( const char* char_string ,
158  G4double dval1 ,
159  G4double dval2 );
160  void SendStrDouble3( const char* char_string ,
161  G4double dval1 ,
162  G4double dval2 ,
163  G4double dval3 );
164 
165  void SendStrDouble4( const char* char_string ,
166  G4double dval1 ,
167  G4double dval2 ,
168  G4double dval3 ,
169  G4double dval4 );
170 
171  void SendStrDouble5( const char* char_string ,
172  G4double dval1 ,
173  G4double dval2 ,
174  G4double dval3 ,
175  G4double dval4 ,
176  G4double dval5 );
177 
178  void SendStrDouble6( const char* char_string ,
179  G4double dval1 ,
180  G4double dval2 ,
181  G4double dval3 ,
182  G4double dval4 ,
183  G4double dval5 ,
184  G4double dval6 );
185 
186  void SendStrDouble7( const char* char_string ,
187  G4double dval1 ,
188  G4double dval2 ,
189  G4double dval3 ,
190  G4double dval4 ,
191  G4double dval5 ,
192  G4double dval6 ,
193  G4double dval7 );
194 
195  void SendStrDouble11( 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  G4double dval8 ,
204  G4double dval9 ,
205  G4double dval10 ,
206  G4double dval11 ) ;
207 
208  void SendIntDouble3( G4int ival ,
209  G4double dval1 ,
210  G4double dval2 ,
211  G4double dval3 );
212  void SendInt3Str( G4int ival1 ,
213  G4int ival2 ,
214  G4int ival3 ,
215  const char* char_string );
216  void SendInt4Str( G4int ival1 ,
217  G4int ival2 ,
218  G4int ival3 ,
219  G4int ival4 ,
220  const char* char_string );
221 
222  void SendStrDouble3Str( const char* char_string1 ,
223  G4double dval1 ,
224  G4double dval2 ,
225  G4double dval3 ,
226  const char* char_string2 );
227 
228  void SendStrDouble6Str( const char* char_string1 ,
229  G4double dval1 ,
230  G4double dval2 ,
231  G4double dval3 ,
232  G4double dval4 ,
233  G4double dval5 ,
234  G4double dval6 ,
235  const char* char_string2 );
236 
237  void SendInt ( G4int val );
238  void SendDouble( G4double val );
239 
240 
241 
242 private:
243  G4FukuiRenderer& fSystem; // Graphics system for this scene.
244  static G4int fSceneIdCount;
245 
246  G4FRClientServer& fPrimDest ; // defined in G4FukuiRenderer
247  G4bool FRflag_in_modeling ;
248  // true: FR_BEGIN_MODELING has sent to DAWN, and
249  // FR_END_MODELING has not sent yet.
250  // false: otherwise
251  //
252  // FRflag_in_modeling is set to "true"
253  // in FRBeginModeling(), and to "false"
254  // in FREndModeling().
255 
256  G4bool flag_saving_g4_prim ;
257 
258  const int COMMAND_BUF_SIZE ;
259 
260  G4int fPrec, fPrec2 ;
261 
262 };
263 
264 #endif
265 #endif //G4VIS_BUILD_DAWN_DRIVER
Definition: G4Para.hh:76
virtual void AddSolid(const G4Box &)
Definition: G4Text.hh:73
virtual void BeginModeling()
virtual void BeginPrimitives(const G4Transform3D &objectTransformation)
Definition: G4Box.hh:63
const char * p
Definition: xmltok.h:285
Definition: G4Tubs.hh:84
const XML_Char * name
Definition: G4VHit.hh:48
const char FR_G4_PRIM_HEADER[]
Definition: G4FRConst.hh:38
Definition: G4Trd.hh:71
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:82
virtual void EndModeling()
virtual void EndPrimitives()
virtual void AddCompound(const G4VTrajectory &)
double G4double
Definition: G4Types.hh:76
virtual void ClearTransientStore()
const char FR_SAVE[]
Definition: G4FRConst.hh:53
G4VGraphicsSystem & fSystem