Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4DAWNFILESceneHandler.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: G4DAWNFILESceneHandler.hh 99152 2016-09-07 08:04:30Z gcosmo $
28 //
29 // Satoshi TANAKA
30 
31 #ifndef G4DAWNFILE_SCENE_HANDLER_HH
32 #define G4DAWNFILE_SCENE_HANDLER_HH
33 
34 #include "globals.hh"
35 
36 #include "G4VSceneHandler.hh"
37 
38 #include "G4FRofstream.hh"
39 #include "G4FRConst.hh"
40 
41 
42 class G4VisAttributes ;
43 class G4DAWNFILE;
44 
45 
46  //-----
48 
49  friend class G4DAWNFILEViewer;
50 
51 public:
52 
53  //----- constructor and destructor
54  G4DAWNFILESceneHandler (G4DAWNFILE& system, const G4String& name = "");
55  virtual ~G4DAWNFILESceneHandler ();
56 
57  //----- overriding base class methods
58  void AddPrimitive (const G4Polyline& line);
59  void AddPrimitive (const G4Polyhedron& p);
60  void AddPrimitive (const G4Text&);
61  void AddPrimitive (const G4Circle&);
62  void AddPrimitive (const G4Square&);
63 
64  //----- explicitly invoke base class methods to avoid warnings about
65  //----- hiding of base class methods.
66  void AddPrimitive (const G4Polymarker& polymarker)
67  { G4VSceneHandler::AddPrimitive (polymarker); }
68  void AddPrimitive (const G4Scale& scale)
70 
73 
74  virtual void BeginPrimitives (const G4Transform3D& objectTransformation);
75  virtual void EndPrimitives ();
76 
77  void AddSolid ( const G4Box& box );
78  void AddSolid ( const G4Cons& cons );
79  void AddSolid ( const G4Tubs& tubs );
80  void AddSolid ( const G4Trd& trd );
81  void AddSolid ( const G4Trap& trap );
82  void AddSolid ( const G4Sphere& sphere );
83  void AddSolid ( const G4Para& para );
84  void AddSolid ( const G4Torus& torus );
85  void AddSolid ( const G4Polycone& polycone ) {
86  G4VSceneHandler::AddSolid (polycone);
87  }
88  void AddSolid ( const G4Polyhedra& polyhedra) {
89  G4VSceneHandler::AddSolid (polyhedra);
90  }
91  void AddSolid ( const G4Orb& orb ) {
93  }
94  void AddSolid ( const G4Ellipsoid& ellipsoid) {
95  G4VSceneHandler::AddSolid (ellipsoid);
96  }
97  void AddSolid ( const G4VSolid& solid );
98  void AddCompound ( const G4VTrajectory& traj) {
100  }
101  void AddCompound ( const G4VHit& hit) {
103  }
104  void AddCompound ( const G4VDigi& digi) {
106  }
107  void AddCompound ( const G4THitsMap<G4double> & hits) {
109  }
110  void AddCompound ( const G4THitsMap<G4StatDouble> & hits) {
112  }
113 
114  void ClearTransientStore(); // Used for triggering detector re-drawing.
115 
116  //----- public methods inherent to this class
117  void FRBeginModeling () ;
118  void FREndModeling () ;
119  G4bool FRIsInModeling () { return FRflag_in_modeling ; }
120 
121  G4bool IsSavingG4Prim ( void ) { return flag_saving_g4_prim ; }
122  void BeginSavingG4Prim( void );
123  void EndSavingG4Prim ( void ) ;
124  void SetG4PrimFileName() ;
125 
126  G4DAWNFILE& GetSystem () { return fSystem ; }
127  void SendBoundingBox ( void );
128  const char* GetG4PrimFileName () { return fG4PrimFileName ; }
129 
130 
131 private:
132 
133  //----- Utilities etc (common to DAWN and DAWNFILE drivers )
134  G4bool SendVisAttributes ( const G4VisAttributes* pAV );
135  G4bool IsVisible ( void ) ;
136  void SendTransformedCoordinates( void ) ;
137  void SendPhysVolName ( void ) ;
138  void SendNdiv ( void ) ;
139 
140  //----- public methods common to DAWN and DAWNFILE drivers
141 public:
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 SendStrDouble3Str( const char* char_string1 ,
222  G4double dval1 ,
223  G4double dval2 ,
224  G4double dval3 ,
225  const char* char_string2 );
226 
227  void SendStrDouble6Str( const char* char_string1 ,
228  G4double dval1 ,
229  G4double dval2 ,
230  G4double dval3 ,
231  G4double dval4 ,
232  G4double dval5 ,
233  G4double dval6 ,
234  const char* char_string2 );
235 
236  void SendInt ( G4int val );
237  void SendDouble( G4double val );
238 
239 private:
240  G4DAWNFILE& fSystem; // Graphics system for this scene.
241  static G4int fSceneIdCount;
242 
243  G4FRofstream fPrimDest ; // defined here
244  G4bool FRflag_in_modeling ;
245  // true: FR_BEGIN_MODELING has sent to DAWN, and
246  // FR_END_MODELING has not sent yet.
247  // false: otherwise
248  //
249  // FRflag_in_modeling is set to "true"
250  // in FRBeginModeling(), and to "false"
251  // in FREndModeling().
252 
253  G4bool flag_saving_g4_prim ;
254 
255  const int COMMAND_BUF_SIZE ;
256 
257  char fG4PrimDestDir [256] ;
258  char fG4PrimFileName[256] ;
259  G4int fMaxFileNum ;
260 
261  G4int fPrec, fPrec2 ;
262 
263 };
264 
265 #endif
void SendStr(const char *char_string)
G4DAWNFILESceneHandler(G4DAWNFILE &system, const G4String &name="")
const XML_Char * name
Definition: expat.h:151
void AddCompound(const G4VHit &hit)
Definition: G4Para.hh:77
virtual void AddSolid(const G4Box &)
Definition: G4Text.hh:73
void SendInt3Str(G4int ival1, G4int ival2, G4int ival3, const char *char_string)
virtual void BeginModeling()
void AddPrimitive(const G4Polyline &line)
void AddCompound(const G4VDigi &digi)
void SendStrDouble5(const char *char_string, G4double dval1, G4double dval2, G4double dval3, G4double dval4, G4double dval5)
void SendInt4Str(G4int ival1, G4int ival2, G4int ival3, G4int ival4, const char *char_string)
void SendStrDouble(const char *char_string, G4double dval)
Definition: G4Box.hh:64
void SendInt(G4int val)
void AddPrimitive(const G4Polymarker &polymarker)
const char * p
Definition: xmltok.h:285
void AddSolid(const G4Orb &orb)
Definition: G4Tubs.hh:85
void AddSolid(const G4Ellipsoid &ellipsoid)
void SendStrDouble4(const char *char_string, G4double dval1, G4double dval2, G4double dval3, G4double dval4)
Definition: G4VHit.hh:48
Definition: G4Trd.hh:72
void SendStrDouble6(const char *char_string, G4double dval1, G4double dval2, G4double dval3, G4double dval4, G4double dval5, G4double dval6)
void AddCompound(const G4THitsMap< G4StatDouble > &hits)
int G4int
Definition: G4Types.hh:78
virtual void AddPrimitive(const G4Polyline &)=0
void SendStrInt4(const char *char_string, G4int ival1, G4int ival2, G4int ival3, G4int ival4)
void AddCompound(const G4THitsMap< G4double > &hits)
void SendStrInt3(const char *char_string, G4int ival1, G4int ival2, G4int ival3)
virtual void BeginPrimitives(const G4Transform3D &objectTransformation)
void SendStrDouble6Str(const char *char_string1, G4double dval1, G4double dval2, G4double dval3, G4double dval4, G4double dval5, G4double dval6, const char *char_string2)
void SendStrDouble2(const char *char_string, G4double dval1, G4double dval2)
bool G4bool
Definition: G4Types.hh:79
void SendStrDouble3(const char *char_string, G4double dval1, G4double dval2, G4double dval3)
void AddSolid(const G4Polyhedra &polyhedra)
Definition: G4Cons.hh:83
virtual void EndModeling()
void AddSolid(const G4Polycone &polycone)
Definition: G4Orb.hh:61
void SendStrDouble11(const char *char_string, G4double dval1, G4double dval2, G4double dval3, G4double dval4, G4double dval5, G4double dval6, G4double dval7, G4double dval8, G4double dval9, G4double dval10, G4double dval11)
virtual void AddCompound(const G4VTrajectory &)
void AddSolid(const G4Box &box)
void AddPrimitive(const G4Scale &scale)
void SendStrDouble3Str(const char *char_string1, G4double dval1, G4double dval2, G4double dval3, const char *char_string2)
void AddCompound(const G4VTrajectory &traj)
double G4double
Definition: G4Types.hh:76
virtual void EndPrimitives()
void SendStrDouble7(const char *char_string, G4double dval1, G4double dval2, G4double dval3, G4double dval4, G4double dval5, G4double dval6, G4double dval7)
void SendStrInt(const char *char_string, G4int ival)
void SendBoundingBox(void)
void SendIntDouble3(G4int ival, G4double dval1, G4double dval2, G4double dval3)
void SendDouble(G4double val)