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