G4VRML1SceneHandler.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 // G4VRML1SceneHandler.hh
00030 // Yasuhide Sawada & Satoshi Tanaka
00031 
00032 #ifndef WIN32
00033 
00034 
00035 #ifdef  G4VIS_BUILD_VRML_DRIVER
00036 
00037 #ifndef G4VRML1_SCENE_HANDLER_HH
00038 #define G4VRML1_SCENE_HANDLER_HH
00039 
00040 
00041 #include "globals.hh"
00042 #include "G4LogicalVolume.hh"
00043 #include "G4VSceneHandler.hh"
00044 
00045 #include "G4FRClient.hh"
00046 
00047 class G4VRML1;
00048 class G4VisAttributes;
00049 
00050 class G4VRML1SceneHandler: public G4VSceneHandler {
00051 
00052         enum { MAX_CONNECTION_TRIAL = 10 } ;
00053 
00054 // methods (public) 
00055 public:
00056         G4VRML1SceneHandler(G4VRML1& system, const G4String& name = "");
00057         virtual ~G4VRML1SceneHandler();
00058         void AddSolid(const G4Box&);
00059         void AddSolid(const G4Cons&);
00060         void AddSolid(const G4Tubs&);
00061         void AddSolid(const G4Trd&);
00062         void AddSolid(const G4Trap&);
00063         void AddSolid(const G4Sphere&);
00064         void AddSolid(const G4Para&);
00065         void AddSolid(const G4Torus&);
00066         void AddSolid ( const G4Polycone& polycone ) {
00067           G4VSceneHandler::AddSolid (polycone);
00068         }
00069         void AddSolid ( const G4Polyhedra& polyhedra) {
00070           G4VSceneHandler::AddSolid (polyhedra);
00071         }
00072         void AddSolid(const G4VSolid&);
00073         void AddCompound ( const G4VTrajectory& traj) {
00074           G4VSceneHandler::AddCompound(traj);
00075         }
00076         void AddCompound ( const G4VHit& hit) {
00077           G4VSceneHandler::AddCompound(hit);
00078         }
00079         void AddCompound ( const G4VDigi& digi) {
00080           G4VSceneHandler::AddCompound(digi);
00081         }
00082         void AddCompound ( const G4THitsMap<G4double> & hits) {
00083           G4VSceneHandler::AddCompound(hits);
00084         }
00085 
00086         void BeginPrimitives(const G4Transform3D& objectTransformation);
00087         void EndPrimitives();
00088 
00089         void AddPrimitive(const G4Polyline&);
00090         void AddPrimitive(const G4Polyhedron&);
00091         void AddPrimitive(const G4NURBS&); 
00092         void AddPrimitive(const G4Text&); 
00093         void AddPrimitive(const G4Circle&);
00094         void AddPrimitive(const G4Square&);
00095         void AddPrimitive (const G4Polymarker& polymarker)
00096                 { G4VSceneHandler::AddPrimitive (polymarker); }
00097         void AddPrimitive (const G4Scale& scale) 
00098                 { G4VSceneHandler::AddPrimitive (scale); }
00099 
00100         void ClearTransientStore();  // Used for triggering detector re-drawing.
00101 
00102         void BeginModeling();
00103         void EndModeling();
00104 
00105         void VRMLBeginModeling();
00106         void VRMLEndModeling();
00107 
00108         void connectPort(int max_trial = MAX_CONNECTION_TRIAL );
00109         void closePort();
00110 
00111 // methods (private) 
00112 private:
00113         void SendMaterialNode( const G4VisAttributes*  pAV ); 
00114         void SendMaterialNode();
00115         void SendMatrixTransformNode(const G4Transform3D &);
00116         void SendCubeNode(G4double, G4double, G4double);
00117         void SendCylinderNode(G4double, G4double);
00118         void SendSphereNode(G4double);
00119 
00120         void      SendMarkerColor         ( const G4VMarker&  mark ) ;
00121         void      SendMarkerWorldPosition ( const G4VMarker&  mark ) ;
00122         G4double  GetMarkerHalfSize       ( const G4VMarker&  mark ) ;
00123 
00124 // data 
00125 private:
00126         G4String fCurrentDEF;
00127 
00128         G4VRML1& fSystem;       // Graphics system for this scene.
00129         G4FRClient fDest ;
00130 
00131         static G4int fSceneIdCount;
00132 
00133 };
00134 
00135 #endif //G4VRML1_SCENE_HH
00136 #endif //G4VIS_BUILD_VRML_DRIVER
00137 #endif //WIN32

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