G4FukuiRendererSceneHandler.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 // 
00030 // Satoshi TANAKA, Fri Jun 28 11:19:19 JST 1996
00031 
00032 
00033 //=================//
00034 #ifdef G4VIS_BUILD_DAWN_DRIVER
00035 //=================//
00036 
00037 
00038 #ifndef G4FUKUI_RENDERER_SCENE_HANDLER_HH
00039 #define G4FUKUI_RENDERER_SCENE_HANDLER_HH
00040 
00041 #include "globals.hh"
00042 
00043 #include "G4VSceneHandler.hh"
00044 
00045 #include "G4FRClientServer.hh"
00046 #include "G4FRConst.hh"
00047 
00048 class G4VisAttributes ;
00049 class G4FukuiRenderer;
00050 
00051         //-----
00052 class G4FukuiRendererSceneHandler: public G4VSceneHandler {
00053 
00054 public:
00055 
00056         //----- constructor and destructor
00057   G4FukuiRendererSceneHandler (G4FukuiRenderer& system, const G4String& name = "");
00058   virtual ~G4FukuiRendererSceneHandler ();
00059 
00060         //----- overriding base class methods
00061   void AddPrimitive (const G4Polyline& line);
00062   void AddPrimitive (const G4Polyhedron& p);
00063   void AddPrimitive (const G4NURBS& nurb);
00064   void AddPrimitive (const G4Text&);
00065   void AddPrimitive (const G4Circle&);
00066   void AddPrimitive (const G4Square&);
00067 
00068         //----- explicitly invoke base class methods to avoid warnings about
00069         //----- hiding of base class methods.
00070   void AddPrimitive (const G4Polymarker& polymarker) 
00071        { G4VSceneHandler::AddPrimitive (polymarker); }
00072   void AddPrimitive (const G4Scale& scale) 
00073        { G4VSceneHandler::AddPrimitive (scale); }
00074 
00075   virtual void BeginModeling () { G4VSceneHandler::BeginModeling ();} 
00076   virtual void EndModeling   () { G4VSceneHandler::EndModeling   ();}
00077 
00078   virtual void BeginPrimitives (const G4Transform3D& objectTransformation);
00079   virtual void EndPrimitives ();
00080 
00081   void AddSolid ( const G4Box&    box    );
00082   void AddSolid ( const G4Cons&   cons   );
00083   void AddSolid ( const G4Tubs&   tubs   );
00084   void AddSolid ( const G4Trd&    trd    );
00085   void AddSolid ( const G4Trap&   trap   );
00086   void AddSolid ( const G4Sphere& sphere );
00087   void AddSolid ( const G4Para&   para   );
00088   void AddSolid ( const G4Torus&  torus  );
00089   void AddSolid ( const G4Polycone& polycone) {
00090     G4VSceneHandler::AddSolid (polycone);
00091   }
00092   void AddSolid ( const G4Polyhedra& polyhedra) {
00093     G4VSceneHandler::AddSolid (polyhedra);
00094   }
00095   void AddSolid ( const G4VSolid& solid  );
00096   void AddCompound ( const G4VTrajectory& traj) {
00097     G4VSceneHandler::AddCompound(traj);
00098   }
00099   void AddCompound ( const G4VHit& hit) {
00100     G4VSceneHandler::AddCompound(hit);
00101   }
00102   void AddCompound ( const G4VDigi& digi) {
00103     G4VSceneHandler::AddCompound(digi);
00104   }
00105   void AddCompound ( const G4THitsMap<G4double> & hits) {
00106     G4VSceneHandler::AddCompound(hits);
00107   }
00108 
00109   void ClearTransientStore();  // Used for triggering detector re-drawing.
00110 
00111         //----- methods inherent to this class
00112   void         FRBeginModeling () ;
00113   void         FREndModeling   () ;
00114   G4bool       FRIsInModeling    () { return FRflag_in_modeling ; }
00115 
00116   G4bool IsSavingG4Prim   ( void ) { return flag_saving_g4_prim ;       }
00117   void   BeginSavingG4Prim( void ) 
00118         {
00119                 if( !IsSavingG4Prim() ) 
00120                 { 
00121                         SendStr( FR_SAVE )    ; 
00122                         SendStr( FR_G4_PRIM_HEADER   )    ; 
00123                         flag_saving_g4_prim = true  ; 
00124                 } 
00125         }
00126   void   EndSavingG4Prim  ( void ) 
00127          { if(  IsSavingG4Prim() ) { SendStr( FR_END_SAVE ); flag_saving_g4_prim = false ; } }
00128 
00129   G4FRClientServer& GetPrimDest () { return fPrimDest ; }
00130   G4FukuiRenderer&  GetSystem   () { return fSystem   ; }
00131   void              SendBoundingBox   ( void );
00132 
00133 private:
00134 
00135         //----- Utilities etc
00136   G4bool    SendVisAttributes ( const G4VisAttributes*  pAV );
00137   G4bool    IsVisible     ( void ) ;
00138   void      SendTransformedCoordinates( void ) ;
00139   void      SendPhysVolName           ( void ) ;
00140   void      SendNdiv                  ( void ) ;
00141 
00142 public:
00143 
00144   void   SendStr   (    const char*     char_string ) ;
00145   void   SendStrInt(    const char*     char_string ,
00146                         G4int           ival    );
00147   void   SendStrInt3(   const char*     char_string ,
00148                         G4int           ival1  ,
00149                         G4int           ival2  ,
00150                         G4int           ival3   );
00151   void   SendStrInt4(   const char*     char_string ,
00152                         G4int           ival1  ,
00153                         G4int           ival2  ,
00154                         G4int           ival3  ,
00155                         G4int           ival4   );
00156   void   SendStrDouble( const char*     char_string ,
00157                         G4double        dval   );
00158   void   SendStrDouble2(        const char*     char_string ,
00159                                 G4double        dval1  ,
00160                                 G4double        dval2  );
00161   void   SendStrDouble3(        const char*     char_string ,
00162                                 G4double        dval1  ,
00163                                 G4double        dval2  ,
00164                                 G4double        dval3   );
00165 
00166   void   SendStrDouble4(        const char*     char_string ,
00167                                 G4double        dval1  ,
00168                                 G4double        dval2  ,
00169                                 G4double        dval3  ,
00170                                 G4double        dval4  );
00171 
00172   void   SendStrDouble5(        const char*     char_string ,
00173                                 G4double        dval1  ,
00174                                 G4double        dval2  ,
00175                                 G4double        dval3  ,
00176                                 G4double        dval4  ,
00177                                 G4double        dval5  );
00178 
00179   void   SendStrDouble6(        const char*     char_string ,
00180                                 G4double        dval1  ,
00181                                 G4double        dval2  ,
00182                                 G4double        dval3  ,
00183                                 G4double        dval4  ,
00184                                 G4double        dval5  ,
00185                                 G4double        dval6   );
00186 
00187   void   SendStrDouble7(        const char*     char_string ,
00188                                 G4double        dval1  ,
00189                                 G4double        dval2  ,
00190                                 G4double        dval3  ,
00191                                 G4double        dval4  ,
00192                                 G4double        dval5  ,
00193                                 G4double        dval6  ,
00194                                 G4double        dval7   );
00195 
00196   void  SendStrDouble11(        const char*     char_string ,
00197                                 G4double        dval1  ,
00198                                 G4double        dval2  ,
00199                                 G4double        dval3  ,
00200                                 G4double        dval4  ,
00201                                 G4double        dval5  ,
00202                                 G4double        dval6  ,
00203                                 G4double        dval7  ,
00204                                 G4double        dval8  ,
00205                                 G4double        dval9  ,
00206                                 G4double        dval10  ,
00207                                 G4double        dval11   ) ;
00208 
00209   void   SendIntDouble3(        G4int           ival   ,
00210                                 G4double        dval1  ,
00211                                 G4double        dval2  ,
00212                                 G4double        dval3  );
00213   void   SendInt3Str(   G4int           ival1  ,
00214                         G4int           ival2  ,
00215                         G4int           ival3  ,
00216                         const char*     char_string );
00217   void   SendInt4Str(   G4int           ival1  ,
00218                         G4int           ival2  ,
00219                         G4int           ival3  ,
00220                         G4int           ival4  ,
00221                         const char*     char_string );
00222 
00223   void  SendStrDouble3Str(      const char*     char_string1 ,
00224                                 G4double        dval1  ,
00225                                 G4double        dval2  ,
00226                                 G4double        dval3  ,
00227                                 const char*     char_string2 );
00228 
00229   void  SendStrDouble6Str(      const char*     char_string1 ,
00230                                 G4double        dval1  ,
00231                                 G4double        dval2  ,
00232                                 G4double        dval3  ,
00233                                 G4double        dval4  ,
00234                                 G4double        dval5  ,
00235                                 G4double        dval6  ,
00236                                 const char*     char_string2 );
00237 
00238   void  SendInt   (     G4int           val );
00239   void  SendDouble(     G4double        val );
00240 
00241 
00242 
00243 private:
00244   G4FukuiRenderer& fSystem;     // Graphics system for this scene.
00245   static G4int  fSceneIdCount;
00246 
00247   G4FRClientServer&     fPrimDest    ;  // defined in G4FukuiRenderer
00248   G4bool                FRflag_in_modeling ;    
00249                 // true:  FR_BEGIN_MODELING has sent to DAWN, and
00250                 //        FR_END_MODELING   has not sent yet.
00251                 // false:  otherwise
00252                 // 
00253                 // FRflag_in_modeling is set to "true"
00254                 // in FRBeginModeling(), and to "false" 
00255                 // in FREndModeling().
00256 
00257   G4bool                flag_saving_g4_prim ;   
00258 
00259   const int             COMMAND_BUF_SIZE    ;
00260 
00261   G4int                 fPrec, fPrec2 ;
00262 
00263 };
00264 
00265 #endif
00266 #endif //G4VIS_BUILD_DAWN_DRIVER

Generated on Mon May 27 17:48:18 2013 for Geant4 by  doxygen 1.4.7