[834] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // |
---|
| 27 | // $Id: G4FukuiRendererSceneHandler.hh,v 1.15 2006/06/29 21:16:46 gunter Exp $ |
---|
[850] | 28 | // GEANT4 tag $Name: HEAD $ |
---|
[834] | 29 | // |
---|
| 30 | // |
---|
| 31 | // Satoshi TANAKA, Fri Jun 28 11:19:19 JST 1996 |
---|
| 32 | |
---|
| 33 | |
---|
| 34 | //=================// |
---|
| 35 | #ifdef G4VIS_BUILD_DAWN_DRIVER |
---|
| 36 | //=================// |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | #ifndef G4FUKUI_RENDERER_SCENE_HANDLER_HH |
---|
| 40 | #define G4FUKUI_RENDERER_SCENE_HANDLER_HH |
---|
| 41 | |
---|
| 42 | #include "globals.hh" |
---|
| 43 | |
---|
| 44 | #include "G4VSceneHandler.hh" |
---|
| 45 | |
---|
| 46 | #include "G4FRClientServer.hh" |
---|
| 47 | #include "G4FRConst.hh" |
---|
| 48 | |
---|
| 49 | class G4VisAttributes ; |
---|
| 50 | class G4FukuiRenderer; |
---|
| 51 | |
---|
| 52 | //----- |
---|
| 53 | class G4FukuiRendererSceneHandler: public G4VSceneHandler { |
---|
| 54 | |
---|
| 55 | public: |
---|
| 56 | |
---|
| 57 | //----- constructor and destructor |
---|
| 58 | G4FukuiRendererSceneHandler (G4FukuiRenderer& system, const G4String& name = ""); |
---|
| 59 | virtual ~G4FukuiRendererSceneHandler (); |
---|
| 60 | |
---|
| 61 | //----- overriding base class methods |
---|
| 62 | void AddPrimitive (const G4Polyline& line); |
---|
| 63 | void AddPrimitive (const G4Polyhedron& p); |
---|
| 64 | void AddPrimitive (const G4NURBS& nurb); |
---|
| 65 | void AddPrimitive (const G4Text&); |
---|
| 66 | void AddPrimitive (const G4Circle&); |
---|
| 67 | void AddPrimitive (const G4Square&); |
---|
| 68 | |
---|
| 69 | //----- explicitly invoke base class methods to avoid warnings about |
---|
| 70 | //----- hiding of base class methods. |
---|
| 71 | void AddPrimitive (const G4Polymarker& polymarker) |
---|
| 72 | { G4VSceneHandler::AddPrimitive (polymarker); } |
---|
| 73 | void AddPrimitive (const G4Scale& scale) |
---|
| 74 | { G4VSceneHandler::AddPrimitive (scale); } |
---|
| 75 | |
---|
| 76 | virtual void BeginModeling () { G4VSceneHandler::BeginModeling ();} |
---|
| 77 | virtual void EndModeling () { G4VSceneHandler::EndModeling ();} |
---|
| 78 | |
---|
| 79 | virtual void BeginPrimitives (const G4Transform3D& objectTransformation); |
---|
| 80 | virtual void EndPrimitives (); |
---|
| 81 | |
---|
| 82 | void AddSolid ( const G4Box& box ); |
---|
| 83 | void AddSolid ( const G4Cons& cons ); |
---|
| 84 | void AddSolid ( const G4Tubs& tubs ); |
---|
| 85 | void AddSolid ( const G4Trd& trd ); |
---|
| 86 | void AddSolid ( const G4Trap& trap ); |
---|
| 87 | void AddSolid ( const G4Sphere& sphere ); |
---|
| 88 | void AddSolid ( const G4Para& para ); |
---|
| 89 | void AddSolid ( const G4Torus& torus ); |
---|
| 90 | void AddSolid ( const G4Polycone& polycone) { |
---|
| 91 | G4VSceneHandler::AddSolid (polycone); |
---|
| 92 | } |
---|
| 93 | void AddSolid ( const G4Polyhedra& polyhedra) { |
---|
| 94 | G4VSceneHandler::AddSolid (polyhedra); |
---|
| 95 | } |
---|
| 96 | void AddSolid ( const G4VSolid& solid ); |
---|
| 97 | void AddCompound ( const G4VTrajectory& traj) { |
---|
| 98 | G4VSceneHandler::AddCompound(traj); |
---|
| 99 | } |
---|
| 100 | void AddCompound ( const G4VHit& hit) { |
---|
| 101 | G4VSceneHandler::AddCompound(hit); |
---|
| 102 | } |
---|
| 103 | |
---|
| 104 | void ClearTransientStore(); // Used for triggering detector re-drawing. |
---|
| 105 | |
---|
| 106 | //----- methods inherent to this class |
---|
| 107 | void FRBeginModeling () ; |
---|
| 108 | void FREndModeling () ; |
---|
| 109 | G4bool FRIsInModeling () { return FRflag_in_modeling ; } |
---|
| 110 | |
---|
| 111 | G4bool IsSavingG4Prim ( void ) { return flag_saving_g4_prim ; } |
---|
| 112 | void BeginSavingG4Prim( void ) |
---|
| 113 | { |
---|
| 114 | if( !IsSavingG4Prim() ) |
---|
| 115 | { |
---|
| 116 | SendStr( FR_SAVE ) ; |
---|
| 117 | SendStr( FR_G4_PRIM_HEADER ) ; |
---|
| 118 | flag_saving_g4_prim = true ; |
---|
| 119 | } |
---|
| 120 | } |
---|
| 121 | void EndSavingG4Prim ( void ) |
---|
| 122 | { if( IsSavingG4Prim() ) { SendStr( FR_END_SAVE ); flag_saving_g4_prim = false ; } } |
---|
| 123 | |
---|
| 124 | G4FRClientServer& GetPrimDest () { return fPrimDest ; } |
---|
| 125 | G4FukuiRenderer& GetSystem () { return fSystem ; } |
---|
| 126 | void SendBoundingBox ( void ); |
---|
| 127 | |
---|
| 128 | private: |
---|
| 129 | |
---|
| 130 | //----- Utilities etc |
---|
| 131 | G4bool SendVisAttributes ( const G4VisAttributes* pAV ); |
---|
| 132 | G4bool IsVisible ( void ) ; |
---|
| 133 | void SendTransformedCoordinates( void ) ; |
---|
| 134 | void SendPhysVolName ( void ) ; |
---|
| 135 | void SendNdiv ( void ) ; |
---|
| 136 | |
---|
| 137 | public: |
---|
| 138 | |
---|
| 139 | void SendStr ( const char* char_string ) ; |
---|
| 140 | void SendStrInt( const char* char_string , |
---|
| 141 | G4int ival ); |
---|
| 142 | void SendStrInt3( const char* char_string , |
---|
| 143 | G4int ival1 , |
---|
| 144 | G4int ival2 , |
---|
| 145 | G4int ival3 ); |
---|
| 146 | void SendStrInt4( const char* char_string , |
---|
| 147 | G4int ival1 , |
---|
| 148 | G4int ival2 , |
---|
| 149 | G4int ival3 , |
---|
| 150 | G4int ival4 ); |
---|
| 151 | void SendStrDouble( const char* char_string , |
---|
| 152 | G4double dval ); |
---|
| 153 | void SendStrDouble2( const char* char_string , |
---|
| 154 | G4double dval1 , |
---|
| 155 | G4double dval2 ); |
---|
| 156 | void SendStrDouble3( const char* char_string , |
---|
| 157 | G4double dval1 , |
---|
| 158 | G4double dval2 , |
---|
| 159 | G4double dval3 ); |
---|
| 160 | |
---|
| 161 | void SendStrDouble4( const char* char_string , |
---|
| 162 | G4double dval1 , |
---|
| 163 | G4double dval2 , |
---|
| 164 | G4double dval3 , |
---|
| 165 | G4double dval4 ); |
---|
| 166 | |
---|
| 167 | void SendStrDouble5( const char* char_string , |
---|
| 168 | G4double dval1 , |
---|
| 169 | G4double dval2 , |
---|
| 170 | G4double dval3 , |
---|
| 171 | G4double dval4 , |
---|
| 172 | G4double dval5 ); |
---|
| 173 | |
---|
| 174 | void SendStrDouble6( const char* char_string , |
---|
| 175 | G4double dval1 , |
---|
| 176 | G4double dval2 , |
---|
| 177 | G4double dval3 , |
---|
| 178 | G4double dval4 , |
---|
| 179 | G4double dval5 , |
---|
| 180 | G4double dval6 ); |
---|
| 181 | |
---|
| 182 | void SendStrDouble7( const char* char_string , |
---|
| 183 | G4double dval1 , |
---|
| 184 | G4double dval2 , |
---|
| 185 | G4double dval3 , |
---|
| 186 | G4double dval4 , |
---|
| 187 | G4double dval5 , |
---|
| 188 | G4double dval6 , |
---|
| 189 | G4double dval7 ); |
---|
| 190 | |
---|
| 191 | void SendStrDouble11( const char* char_string , |
---|
| 192 | G4double dval1 , |
---|
| 193 | G4double dval2 , |
---|
| 194 | G4double dval3 , |
---|
| 195 | G4double dval4 , |
---|
| 196 | G4double dval5 , |
---|
| 197 | G4double dval6 , |
---|
| 198 | G4double dval7 , |
---|
| 199 | G4double dval8 , |
---|
| 200 | G4double dval9 , |
---|
| 201 | G4double dval10 , |
---|
| 202 | G4double dval11 ) ; |
---|
| 203 | |
---|
| 204 | void SendIntDouble3( G4int ival , |
---|
| 205 | G4double dval1 , |
---|
| 206 | G4double dval2 , |
---|
| 207 | G4double dval3 ); |
---|
| 208 | void SendInt3Str( G4int ival1 , |
---|
| 209 | G4int ival2 , |
---|
| 210 | G4int ival3 , |
---|
| 211 | const char* char_string ); |
---|
| 212 | void SendInt4Str( G4int ival1 , |
---|
| 213 | G4int ival2 , |
---|
| 214 | G4int ival3 , |
---|
| 215 | G4int ival4 , |
---|
| 216 | const char* char_string ); |
---|
| 217 | |
---|
| 218 | void SendStrDouble6Str( const char* char_string1 , |
---|
| 219 | G4double dval1 , |
---|
| 220 | G4double dval2 , |
---|
| 221 | G4double dval3 , |
---|
| 222 | G4double dval4 , |
---|
| 223 | G4double dval5 , |
---|
| 224 | G4double dval6 , |
---|
| 225 | const char* char_string2 ); |
---|
| 226 | |
---|
| 227 | void SendInt ( G4int val ); |
---|
| 228 | void SendDouble( G4double val ); |
---|
| 229 | |
---|
| 230 | |
---|
| 231 | |
---|
| 232 | private: |
---|
| 233 | G4FukuiRenderer& fSystem; // Graphics system for this scene. |
---|
| 234 | static G4int fSceneIdCount; |
---|
| 235 | |
---|
| 236 | G4FRClientServer& fPrimDest ; // defined in G4FukuiRenderer |
---|
| 237 | G4bool FRflag_in_modeling ; |
---|
| 238 | // true: FR_BEGIN_MODELING has sent to DAWN, and |
---|
| 239 | // FR_END_MODELING has not sent yet. |
---|
| 240 | // false: otherwise |
---|
| 241 | // |
---|
| 242 | // FRflag_in_modeling is set to "true" |
---|
| 243 | // in FRBeginModeling(), and to "false" |
---|
| 244 | // in FREndModeling(). |
---|
| 245 | |
---|
| 246 | G4bool flag_saving_g4_prim ; |
---|
| 247 | |
---|
| 248 | const int COMMAND_BUF_SIZE ; |
---|
| 249 | |
---|
| 250 | G4int fPrec, fPrec2 ; |
---|
| 251 | |
---|
| 252 | }; |
---|
| 253 | |
---|
| 254 | #endif |
---|
| 255 | #endif //G4VIS_BUILD_DAWN_DRIVER |
---|