G4DAWNFILESceneHandler.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 // Satoshi TANAKA
00030 
00031 #ifndef G4DAWNFILE_SCENE_HANDLER_HH
00032 #define G4DAWNFILE_SCENE_HANDLER_HH
00033 
00034 #include "globals.hh"
00035 
00036 #include "G4VSceneHandler.hh"
00037 
00038 #include "G4FRofstream.hh"
00039 #include "G4FRConst.hh"
00040 
00041 
00042 class G4VisAttributes ;
00043 class G4DAWNFILE;
00044 
00045 
00046         //-----
00047 class G4DAWNFILESceneHandler: public G4VSceneHandler {
00048 
00049   friend class G4DAWNFILEViewer;
00050 
00051 public:
00052 
00053         //----- constructor and destructor
00054   G4DAWNFILESceneHandler (G4DAWNFILE& system, const G4String& name = "");
00055   virtual ~G4DAWNFILESceneHandler ();
00056 
00057         //----- overriding base class methods
00058   void AddPrimitive (const G4Polyline& line);
00059   void AddPrimitive (const G4Polyhedron& p);
00060   void AddPrimitive (const G4NURBS& nurb);
00061   void AddPrimitive (const G4Text&);
00062   void AddPrimitive (const G4Circle&);
00063   void AddPrimitive (const G4Square&);
00064 
00065         //----- explicitly invoke base class methods to avoid warnings about
00066         //----- hiding of base class methods.
00067   void AddPrimitive (const G4Polymarker& polymarker) 
00068        { G4VSceneHandler::AddPrimitive (polymarker); }
00069   void AddPrimitive (const G4Scale& scale) 
00070        { G4VSceneHandler::AddPrimitive (scale); }
00071 
00072   virtual void BeginModeling () { G4VSceneHandler::BeginModeling ();} 
00073   virtual void EndModeling   () { G4VSceneHandler::EndModeling   ();}
00074 
00075   virtual void BeginPrimitives (const G4Transform3D& objectTransformation);
00076   virtual void EndPrimitives ();
00077 
00078   void AddSolid ( const G4Box&    box    );
00079   void AddSolid ( const G4Cons&   cons   );
00080   void AddSolid ( const G4Tubs&   tubs   );
00081   void AddSolid ( const G4Trd&    trd    );
00082   void AddSolid ( const G4Trap&   trap   );
00083   void AddSolid ( const G4Sphere& sphere );
00084   void AddSolid ( const G4Para&   para   );
00085   void AddSolid ( const G4Torus&  torus  );
00086   void AddSolid ( const G4Polycone& polycone ) {
00087     G4VSceneHandler::AddSolid (polycone);
00088   }
00089   void AddSolid ( const G4Polyhedra& polyhedra) {
00090     G4VSceneHandler::AddSolid (polyhedra);
00091   }
00092   void AddSolid ( const G4VSolid& solid  );
00093   void AddCompound ( const G4VTrajectory& traj) {
00094     G4VSceneHandler::AddCompound(traj);
00095   }
00096   void AddCompound ( const G4VHit& hit) {
00097     G4VSceneHandler::AddCompound(hit);
00098   }
00099   void AddCompound ( const G4VDigi& digi) {
00100     G4VSceneHandler::AddCompound(digi);
00101   }
00102   void AddCompound ( const G4THitsMap<G4double> & hits) {
00103     G4VSceneHandler::AddCompound(hits);
00104   }
00105 
00106   void ClearTransientStore();  // Used for triggering detector re-drawing.
00107 
00108         //----- public methods inherent to this class
00109   void         FRBeginModeling () ;
00110   void         FREndModeling   () ;
00111   G4bool       FRIsInModeling  () { return FRflag_in_modeling ; }
00112 
00113   G4bool IsSavingG4Prim   ( void ) { return flag_saving_g4_prim ;       }
00114   void  BeginSavingG4Prim( void ); 
00115   void  EndSavingG4Prim  ( void ) ;
00116   void  SetG4PrimFileName() ;
00117 
00118   G4DAWNFILE&  GetSystem   () { return fSystem   ; }
00119   void         SendBoundingBox   ( void );
00120   const char*  GetG4PrimFileName () { return fG4PrimFileName ; }
00121 
00122 
00123 private:
00124 
00125         //----- Utilities etc (common to DAWN and DAWNFILE drivers )
00126   G4bool    SendVisAttributes ( const G4VisAttributes*  pAV );
00127   G4bool    IsVisible     ( void ) ;
00128   void      SendTransformedCoordinates( void ) ;
00129   void      SendPhysVolName           ( void ) ;
00130   void      SendNdiv                  ( void ) ;
00131 
00132         //----- public methods common to DAWN and DAWNFILE drivers
00133 public:
00134   void   SendStr   (    const char*     char_string ) ;
00135   void   SendStrInt(    const char*     char_string ,
00136                         G4int           ival    );
00137   void   SendStrInt3(   const char*     char_string ,
00138                         G4int           ival1  ,
00139                         G4int           ival2  ,
00140                         G4int           ival3   );
00141   void   SendStrInt4(   const char*     char_string ,
00142                         G4int           ival1  ,
00143                         G4int           ival2  ,
00144                         G4int           ival3  ,
00145                         G4int           ival4   );
00146   void   SendStrDouble( const char*     char_string ,
00147                         G4double        dval   );
00148   void   SendStrDouble2(        const char*     char_string ,
00149                                 G4double        dval1  ,
00150                                 G4double        dval2  );
00151   void   SendStrDouble3(        const char*     char_string ,
00152                                 G4double        dval1  ,
00153                                 G4double        dval2  ,
00154                                 G4double        dval3   );
00155 
00156   void   SendStrDouble4(        const char*     char_string ,
00157                                 G4double        dval1  ,
00158                                 G4double        dval2  ,
00159                                 G4double        dval3  ,
00160                                 G4double        dval4  );
00161 
00162   void   SendStrDouble5(        const char*     char_string ,
00163                                 G4double        dval1  ,
00164                                 G4double        dval2  ,
00165                                 G4double        dval3  ,
00166                                 G4double        dval4  ,
00167                                 G4double        dval5  );
00168 
00169   void   SendStrDouble6(        const char*     char_string ,
00170                                 G4double        dval1  ,
00171                                 G4double        dval2  ,
00172                                 G4double        dval3  ,
00173                                 G4double        dval4  ,
00174                                 G4double        dval5  ,
00175                                 G4double        dval6   );
00176 
00177   void   SendStrDouble7(        const char*     char_string ,
00178                                 G4double        dval1  ,
00179                                 G4double        dval2  ,
00180                                 G4double        dval3  ,
00181                                 G4double        dval4  ,
00182                                 G4double        dval5  ,
00183                                 G4double        dval6  ,
00184                                 G4double        dval7   );
00185 
00186   void  SendStrDouble11(        const char*     char_string ,
00187                                 G4double        dval1  ,
00188                                 G4double        dval2  ,
00189                                 G4double        dval3  ,
00190                                 G4double        dval4  ,
00191                                 G4double        dval5  ,
00192                                 G4double        dval6  ,
00193                                 G4double        dval7  ,
00194                                 G4double        dval8  ,
00195                                 G4double        dval9  ,
00196                                 G4double        dval10  ,
00197                                 G4double        dval11   ) ;
00198 
00199   void   SendIntDouble3(        G4int           ival   ,
00200                                 G4double        dval1  ,
00201                                 G4double        dval2  ,
00202                                 G4double        dval3  );
00203   void   SendInt3Str(   G4int           ival1  ,
00204                         G4int           ival2  ,
00205                         G4int           ival3  ,
00206                         const char*     char_string );
00207   void   SendInt4Str(   G4int           ival1  ,
00208                         G4int           ival2  ,
00209                         G4int           ival3  ,
00210                         G4int           ival4  ,
00211                         const char*     char_string );
00212 
00213   void  SendStrDouble3Str(      const char*     char_string1 ,
00214                                 G4double        dval1  ,
00215                                 G4double        dval2  ,
00216                                 G4double        dval3  ,
00217                                 const char*     char_string2 );
00218 
00219   void  SendStrDouble6Str(      const char*     char_string1 ,
00220                                 G4double        dval1  ,
00221                                 G4double        dval2  ,
00222                                 G4double        dval3  ,
00223                                 G4double        dval4  ,
00224                                 G4double        dval5  ,
00225                                 G4double        dval6  ,
00226                                 const char*     char_string2 );
00227 
00228   void  SendInt   (     G4int           val );
00229   void  SendDouble(     G4double        val );
00230 
00231 private:
00232   G4DAWNFILE&   fSystem;     // Graphics system for this scene.
00233   static G4int  fSceneIdCount;
00234 
00235   G4FRofstream  fPrimDest    ;  // defined here
00236   G4bool        FRflag_in_modeling ;    
00237                 // true:  FR_BEGIN_MODELING has sent to DAWN, and
00238                 //        FR_END_MODELING   has not sent yet.
00239                 // false:  otherwise
00240                 // 
00241                 // FRflag_in_modeling is set to "true"
00242                 // in FRBeginModeling(), and to "false" 
00243                 // in FREndModeling().
00244 
00245   G4bool        flag_saving_g4_prim ;   
00246 
00247   const int     COMMAND_BUF_SIZE    ;
00248 
00249   char          fG4PrimDestDir [256] ; 
00250   char          fG4PrimFileName[256] ;
00251   G4int         fMaxFileNum           ;
00252 
00253   G4int         fPrec, fPrec2 ;
00254         
00255 };
00256 
00257 #endif

Generated on Mon May 27 17:47:59 2013 for Geant4 by  doxygen 1.4.7