]>
Commit | Line | Data |
---|---|---|
240601e9 | 1 | // $Id$ |
2 | // Category: geometry | |
240601e9 | 3 | // |
499b353a | 4 | // Author: I. Hrivnacova, 27.07.2000 |
5 | // | |
6 | // Class TG4XMLConvertor | |
7 | // --------------------- | |
8 | // The class provides methods for conversion of G4 basic geometry objects | |
240601e9 | 9 | // to XML defined by AGDD.dtd |
10 | // (ATLAS Generic Detector Description) | |
11 | ||
12 | #ifndef TG4_XML_CONVERTOR_H | |
13 | #define TG4_XML_CONVERTOR_H | |
14 | ||
15 | #include "TG4VXMLConvertor.h" | |
16 | #include "TG4Globals.h" | |
17 | ||
18 | #include <globals.hh> | |
19 | #include <g4std/fstream> | |
499b353a | 20 | #include <g4std/vector> |
240601e9 | 21 | |
22 | class G4Material; | |
23 | class G4VSolid; | |
24 | class G4LogicalVolume; | |
c24553ac | 25 | class G4PVReplica; |
240601e9 | 26 | class G4Box; |
27 | class G4Tubs; | |
c24553ac | 28 | class G4Cons; |
240601e9 | 29 | class G4Trd; |
4032dc03 | 30 | class G4Trap; |
5d22ddb7 | 31 | class G4Para; |
c24553ac | 32 | class G4Polycone; |
33 | class G4Polyhedra; | |
240601e9 | 34 | |
35 | class TG4XMLConvertor : public TG4VXMLConvertor | |
36 | { | |
499b353a | 37 | typedef G4std::vector<const G4RotationMatrix*> RotationMatrixVector; |
38 | ||
240601e9 | 39 | public: |
40 | TG4XMLConvertor(G4std::ofstream& outFile); | |
41 | virtual ~TG4XMLConvertor(); | |
42 | ||
43 | // methods | |
509c89ec | 44 | virtual void OpenMaterials(const G4String& version, const G4String& date, |
45 | const G4String& author, const G4String dtdVersion); | |
240601e9 | 46 | virtual void OpenSection(const G4String& name, const G4String& version, |
47 | const G4String& date, const G4String& author, | |
48 | const G4String& topVolume); | |
49 | virtual void OpenComposition(const G4String& name); | |
509c89ec | 50 | virtual void CloseMaterials(); |
240601e9 | 51 | virtual void CloseSection(); |
52 | virtual void CloseComposition(); | |
53 | ||
54 | virtual void WriteMaterial(const G4Material* material); | |
4032dc03 | 55 | virtual void WriteSolid(G4String lvName, const G4VSolid* solid, |
56 | G4String materialName); | |
240601e9 | 57 | virtual void WriteRotation(const G4RotationMatrix* rotation); |
4032dc03 | 58 | virtual void WritePosition(G4String lvName, G4ThreeVector position); |
240601e9 | 59 | virtual void WritePositionWithRotation( |
4032dc03 | 60 | G4String lvName, G4ThreeVector position, |
c24553ac | 61 | const G4RotationMatrix* rotation); |
62 | virtual void WriteReplica(G4String lvName, G4PVReplica* pvr); | |
240601e9 | 63 | virtual void WriteEmptyLine(); |
509c89ec | 64 | virtual void IncreaseIndention(); |
65 | virtual void DecreaseIndention(); | |
60c3961b | 66 | |
67 | // set methods | |
68 | void SetNumWidth(G4int width); | |
69 | void SetNumPrecision(G4int precision); | |
240601e9 | 70 | |
71 | private: | |
72 | //methods | |
73 | void CutName(G4String& name) const; | |
74 | void CutName(G4String& name, G4int size) const; | |
75 | void PutName(G4String& element, G4String name, G4String templ) const; | |
c24553ac | 76 | |
77 | // writing solids | |
4032dc03 | 78 | void WriteBox (G4String lvName, const G4Box* box, G4String materialName); |
79 | void WriteTubs(G4String lvName, const G4Tubs* tubs, G4String materialName); | |
c24553ac | 80 | void WriteCons(G4String lvName, const G4Cons* cons, G4String materialName); |
4032dc03 | 81 | void WriteTrd (G4String lvName, const G4Trd* trd, G4String materialName); |
82 | void WriteTrap(G4String lvName, const G4Trap* trap, G4String materialName); | |
5d22ddb7 | 83 | void WritePara(G4String lvName, const G4Para* para, G4String materialName); |
c24553ac | 84 | void WritePolycone(G4String lvName, const G4Polycone* polycone, |
85 | G4String materialName); | |
86 | void WritePolyhedra(G4String lvName, const G4Polyhedra* polyhedra, | |
87 | G4String materialName); | |
240601e9 | 88 | |
89 | // static data members | |
4b062c78 | 90 | static const G4int fgkMaxVolumeNameLength; //maximal volume name length |
91 | static const G4int fgkMaxMaterialNameLength;//maximal material name length | |
60c3961b | 92 | static const G4int fgkDefaultNumWidth; //default output numbers width |
93 | static const G4int fgkDefaultNumPrecision; //default output numbers precision | |
240601e9 | 94 | |
95 | // data members | |
509c89ec | 96 | G4std::ofstream& fOutFile; //output file |
4b062c78 | 97 | const G4String fkBasicIndention; //basic indention |
509c89ec | 98 | G4String fIndention; //indention string |
60c3961b | 99 | G4int fNW; //output numbers width |
100 | G4int fNP; //output numbers precision | |
4032dc03 | 101 | G4int fRotationCounter; //counter of rotations |
499b353a | 102 | RotationMatrixVector fRotations; //vector of rot matrices |
240601e9 | 103 | }; |
104 | ||
60c3961b | 105 | inline void TG4XMLConvertor::SetNumWidth(G4int width) |
106 | { fNW = width; } | |
107 | ||
108 | inline void TG4XMLConvertor::SetNumPrecision(G4int precision) | |
109 | { fNP = precision; } | |
110 | ||
240601e9 | 111 | #endif //TG4_XML_CONVERTOR_H |
112 |