G4VRML2FileSceneHandler.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 // G4VRML2FileSceneHandler.hh
00030 // Satoshi Tanaka & Yasuhide Sawada
00031 
00032 #ifndef G4VRML2FILE_SCENE_HANDLER_HH
00033 #define G4VRML2FILE_SCENE_HANDLER_HH
00034 
00035 #include <fstream>
00036 
00037 #include "globals.hh"
00038 #include "G4LogicalVolume.hh"
00039 #include "G4VSceneHandler.hh"
00040 
00041 
00042 class G4VRML2File;
00043 class G4VisAttributes;
00044 
00045 class G4VRML2FileSceneHandler: public G4VSceneHandler {
00046 
00047   friend class G4VRML2FileViewer;
00048 
00049 // methods (public) 
00050 public:
00051         G4VRML2FileSceneHandler(G4VRML2File& system, const G4String& name = "");
00052         virtual ~G4VRML2FileSceneHandler();
00053         void AddSolid(const G4Box&);
00054         void AddSolid(const G4Cons&);
00055         void AddSolid(const G4Tubs&);
00056         void AddSolid(const G4Trd&);
00057         void AddSolid(const G4Trap&);
00058         void AddSolid(const G4Sphere&);
00059         void AddSolid(const G4Para&);
00060         void AddSolid(const G4Torus&);
00061         void AddSolid ( const G4Polycone& polycone ) {
00062           G4VSceneHandler::AddSolid (polycone);
00063         }
00064         void AddSolid ( const G4Polyhedra& polyhedra) {
00065           G4VSceneHandler::AddSolid (polyhedra);
00066         }
00067         void AddSolid(const G4VSolid&);
00068         void AddCompound ( const G4VTrajectory& traj) {
00069           G4VSceneHandler::AddCompound(traj);
00070         }
00071         void AddCompound ( const G4VHit& hit) {
00072           G4VSceneHandler::AddCompound(hit);
00073         }
00074         void AddCompound ( const G4VDigi& digi) {
00075           G4VSceneHandler::AddCompound(digi);
00076         }
00077         void AddCompound ( const G4THitsMap<G4double> & hits) {
00078           G4VSceneHandler::AddCompound(hits);
00079         }
00080 
00081         void BeginPrimitives(const G4Transform3D& objectTransformation);
00082         void EndPrimitives();
00083 
00084         void AddPrimitive(const G4Polyline&);
00085         void AddPrimitive(const G4Polyhedron&);
00086         void AddPrimitive(const G4NURBS&); 
00087         void AddPrimitive(const G4Text&); 
00088         void AddPrimitive(const G4Circle&);
00089         void AddPrimitive(const G4Square&);
00090         void AddPrimitive (const G4Polymarker& polymarker)
00091                 { G4VSceneHandler::AddPrimitive (polymarker); }
00092         void AddPrimitive (const G4Scale& scale) 
00093                 { G4VSceneHandler::AddPrimitive (scale); }
00094 
00095         void ClearTransientStore();  // Used for triggering detector re-drawing.
00096 
00097         void BeginModeling();
00098         void EndModeling();
00099 
00100         void VRMLBeginModeling();
00101         void VRMLEndModeling();
00102 
00103         void connectPort();
00104         void closePort();
00105 
00106 // methods (private) 
00107 private:
00108 
00109         void      SendMaterialNode          ( const G4VisAttributes*  pAV ); 
00110         void      SendMaterialNode          ();
00111 
00112         void      SendLineColor             ( const G4VisAttributes*  pAV ); 
00113         void      SendMarkerColor           ( const G4VMarker&  mark ) ;
00114         void      SendMarkerWorldPosition   ( const G4VMarker&  mark ) ;
00115 
00116         G4double  GetMarkerHalfSize         ( const G4VMarker&  mark ) ;
00117         void      GetMarkerWorldPosition    (   const G4VMarker&  mark , 
00118                                                 double* pX             ,
00119                                                 double* pY             ,
00120                                                 double* pZ              ) ;
00121 
00122         G4bool    isConnected      () { return fFlagDestOpen ; }
00123 
00124         G4bool    IsPVPickable     ()                { return fPVPickable   ;}  
00125         void      SetPVPickability ( G4bool on_off ) { fPVPickable = on_off ;}  
00126         G4double  SetPVTransparency ()  ; 
00127         G4double  GetPVTransparency () { return fPVTransparency ; } 
00128 
00129 // data 
00130 private:
00131         char fVRMLFileDestDir[256] ; 
00132         char fVRMLFileName[256]    ; 
00133 
00134         G4VRML2File& fSystem;   // Graphics system for this scene.
00135         G4bool       fFlagDestOpen ;
00136 
00137         G4int        fMaxFileNum   ;    
00138 
00139         G4bool       fPVPickable ;
00140         G4double     fPVTransparency ;
00141 
00142         static G4int fSceneIdCount;
00143 
00144 public: 
00145         std::ofstream     fDest ;
00146 
00147 };
00148 
00149 #endif //G4VRML2FILE_SCENE_HANDLER_HH

Generated on Mon May 27 17:50:21 2013 for Geant4 by  doxygen 1.4.7