Geant4 Cross Reference |
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 // 28 // Satoshi TANAKA 29 30 #ifndef G4DAWNFILE_SCENE_HANDLER_HH 31 #define G4DAWNFILE_SCENE_HANDLER_HH 32 33 #include "globals.hh" 34 35 #include "G4VSceneHandler.hh" 36 37 #include "G4FRofstream.hh" 38 #include "G4FRConst.hh" 39 40 class G4VisAttributes; 41 class G4DAWNFILE; 42 43 //----- 44 class G4DAWNFILESceneHandler : public G4VSceneHandler 45 { 46 friend class G4DAWNFILEViewer; 47 48 public: 49 //----- constructor and destructor 50 G4DAWNFILESceneHandler(G4DAWNFILE& system, const G4String& name = ""); 51 virtual ~G4DAWNFILESceneHandler(); 52 53 //----- overriding base class methods 54 using G4VSceneHandler::AddPrimitive; 55 void AddPrimitive(const G4Polyline& line); 56 void AddPrimitive(const G4Polyhedron& p); 57 void AddPrimitive(const G4Text&); 58 void AddPrimitive(const G4Circle&); 59 void AddPrimitive(const G4Square&); 60 61 void BeginPrimitives(const G4Transform3D& objectTransformation); 62 void EndPrimitives(); 63 64 using G4VSceneHandler::AddSolid; 65 void AddSolid(const G4Box& box); 66 void AddSolid(const G4Cons& cons); 67 void AddSolid(const G4Tubs& tubs); 68 void AddSolid(const G4Trd& trd); 69 void AddSolid(const G4Trap& trap); 70 void AddSolid(const G4Sphere& sphere); 71 void AddSolid(const G4Para& para); 72 void AddSolid(const G4Torus& torus); 73 void AddSolid(const G4VSolid& solid); 74 75 void ClearTransientStore(); // Used for triggering detector re-drawing. 76 77 //----- public methods inherent to this class 78 void FRBeginModeling(); 79 void FREndModeling(); 80 G4bool FRIsInModeling() { return FRflag_in_modeling; } 81 82 G4bool IsSavingG4Prim(void) { return flag_saving_g4_prim; } 83 void BeginSavingG4Prim(void); 84 void EndSavingG4Prim(void); 85 void SetG4PrimFileName(); 86 87 G4DAWNFILE& GetSystem() { return fSystem; } 88 void SendBoundingBox(void); 89 const char* GetG4PrimFileName() { return fG4PrimFileName; } 90 91 private: 92 //----- Utilities etc (common to DAWN and DAWNFILE drivers ) 93 G4bool SendVisAttributes(const G4VisAttributes* pAV); 94 G4bool IsVisible(void); 95 void SendTransformedCoordinates(void); 96 void SendPhysVolName(void); 97 void SendNdiv(void); 98 99 //----- public methods common to DAWN and DAWNFILE drivers 100 public: 101 void SendStr(const char* char_string); 102 void SendStrInt(const char* char_string, G4int ival); 103 void SendStrInt3(const char* char_string, G4int ival1, G4int ival2, 104 G4int ival3); 105 void SendStrInt4(const char* char_string, G4int ival1, G4int ival2, 106 G4int ival3, G4int ival4); 107 void SendStrDouble(const char* char_string, G4double dval); 108 void SendStrDouble2(const char* char_string, G4double dval1, G4double dval2); 109 void SendStrDouble3(const char* char_string, G4double dval1, G4double dval2, 110 G4double dval3); 111 112 void SendStrDouble4(const char* char_string, G4double dval1, G4double dval2, 113 G4double dval3, G4double dval4); 114 115 void SendStrDouble5(const char* char_string, G4double dval1, G4double dval2, 116 G4double dval3, G4double dval4, G4double dval5); 117 118 void SendStrDouble6(const char* char_string, G4double dval1, G4double dval2, 119 G4double dval3, G4double dval4, G4double dval5, 120 G4double dval6); 121 122 void SendStrDouble7(const char* char_string, G4double dval1, G4double dval2, 123 G4double dval3, G4double dval4, G4double dval5, 124 G4double dval6, G4double dval7); 125 126 void SendStrDouble11(const char* char_string, G4double dval1, G4double dval2, 127 G4double dval3, G4double dval4, G4double dval5, 128 G4double dval6, G4double dval7, G4double dval8, 129 G4double dval9, G4double dval10, G4double dval11); 130 131 void SendIntDouble3(G4int ival, G4double dval1, G4double dval2, 132 G4double dval3); 133 void SendInt3Str(G4int ival1, G4int ival2, G4int ival3, 134 const char* char_string); 135 void SendInt4Str(G4int ival1, G4int ival2, G4int ival3, G4int ival4, 136 const char* char_string); 137 138 void SendStrDouble3Str(const char* char_string1, G4double dval1, 139 G4double dval2, G4double dval3, 140 const char* char_string2); 141 142 void SendStrDouble6Str(const char* char_string1, G4double dval1, 143 G4double dval2, G4double dval3, G4double dval4, 144 G4double dval5, G4double dval6, 145 const char* char_string2); 146 147 void SendInt(G4int val); 148 void SendDouble(G4double val); 149 150 private: 151 G4DAWNFILE& fSystem; // Graphics system for this scene. 152 static G4int fSceneIdCount; 153 154 G4FRofstream fPrimDest; // defined here 155 G4bool FRflag_in_modeling; 156 // true: FR_BEGIN_MODELING has sent to DAWN, and 157 // FR_END_MODELING has not sent yet. 158 // false: otherwise 159 // 160 // FRflag_in_modeling is set to "true" 161 // in FRBeginModeling(), and to "false" 162 // in FREndModeling(). 163 164 G4bool flag_saving_g4_prim; 165 166 const int COMMAND_BUF_SIZE; 167 168 char fG4PrimDestDir[256]; 169 char fG4PrimFileName[256]; 170 G4int fMaxFileNum; 171 172 G4int fPrec, fPrec2; 173 }; 174 175 #endif 176