G4VRML1FileSceneHandler.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 // G4VRML1FileSceneHandler.hh
00030 // Satoshi Tanaka & Yasuhide Sawada
00031 
00032 #ifndef G4VRML1FILE_SCENE_HANDLER_HH
00033 #define G4VRML1FILE_SCENE_HANDLER_HH
00034 
00035 #include <fstream>
00036 
00037 #include "globals.hh"
00038 #include "G4LogicalVolume.hh"
00039 #include "G4VSceneHandler.hh"
00040 
00041 
00042 class G4VRML1File;
00043 class G4VisAttributes;
00044 
00045 class G4VRML1FileSceneHandler: public G4VSceneHandler {
00046 
00047   friend class G4VRML1FileViewer;
00048 
00049 // methods (public) 
00050 public:
00051         G4VRML1FileSceneHandler(G4VRML1File& system, const G4String& name = "");
00052         virtual ~G4VRML1FileSceneHandler();
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 ); // NEW NEW NEW
00110         void SendMaterialNode();
00111         void SendMatrixTransformNode(const G4Transform3D &);
00112         void SendCubeNode(G4double, G4double, G4double);
00113         void SendCylinderNode(G4double, G4double);
00114         void SendSphereNode(G4double);
00115 
00116         void      SendMarkerColor         ( const G4VMarker&  mark ) ;
00117         void      SendMarkerWorldPosition ( const G4VMarker&  mark ) ;
00118         G4double  GetMarkerHalfSize       ( const G4VMarker&  mark ) ;
00119 
00120         G4bool    isConnected      () { return fFlagDestOpen ; }
00121 
00122 // data 
00123 private:
00124         char fVRMLFileDestDir[256] ; 
00125         char fVRMLFileName[256]    ; 
00126 
00127         G4String fCurrentDEF;
00128 
00129         G4VRML1File& fSystem;   // Graphics system for this scene.
00130         std::ofstream     fDest ;
00131         G4bool       fFlagDestOpen ;
00132 
00133         G4int        fMaxFileNum   ;    
00134 
00135         static G4int fSceneIdCount;
00136 
00137 };
00138 
00139 #endif //G4VRML1FILE_SCENE_HANDLER_HH
00140 

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