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 | // G4InteractiveSolid.hh |
---|
28 | // |
---|
29 | // A messenger that allows one to construct a solid interactively |
---|
30 | // (i.e. via command line) |
---|
31 | // |
---|
32 | // The solid thus created can be recovered using the G4SolidQuery |
---|
33 | // method GetSolid. |
---|
34 | // |
---|
35 | // Notes: |
---|
36 | // * The G4UIcommand design is somewhat inflexible. It would have |
---|
37 | // been much better to specify each command argument as a |
---|
38 | // class of it's own (with input methods, help methods, etc.) |
---|
39 | // then to create the monolithic monstrosities like G4UICmdWith****. |
---|
40 | // Alas, I'm tempted to fix this, but for the sake of expediency |
---|
41 | // I will cheat and use my own string interpretator. The |
---|
42 | // side effect is that interactive help is much compromised. |
---|
43 | // |
---|
44 | |
---|
45 | #ifndef G4InteractiveSolid_hh |
---|
46 | #define G4InteractiveSolid_hh |
---|
47 | |
---|
48 | #include "G4UImessenger.hh" |
---|
49 | #include "G4SolidQuery.hh" |
---|
50 | |
---|
51 | class G4UIdirectory; |
---|
52 | class G4UIcommand; |
---|
53 | class G4UIcmdWithPargs; |
---|
54 | class G4UIcmdParg; |
---|
55 | |
---|
56 | class G4InteractiveSolid : public G4UImessenger, public G4SolidQuery { |
---|
57 | public: |
---|
58 | G4InteractiveSolid( const G4String &commandPrefix ); |
---|
59 | virtual ~G4InteractiveSolid(); |
---|
60 | |
---|
61 | inline G4VSolid *GetSolid() const { return solid; } |
---|
62 | |
---|
63 | void SetNewValue( G4UIcommand *command, G4String newValues ); |
---|
64 | G4String GetCurrentValue( G4UIcommand *command ); |
---|
65 | |
---|
66 | protected: |
---|
67 | void DeleteArgArray( G4UIcmdParg **array, const G4int nItem ); |
---|
68 | G4String ConvertArgsToString( G4UIcmdParg **array, const G4int nItem ); |
---|
69 | |
---|
70 | G4VSolid *solid; |
---|
71 | |
---|
72 | G4UIdirectory *volumeDirectory; |
---|
73 | |
---|
74 | G4UIcmdParg *boxArgs[3]; |
---|
75 | G4UIcmdWithPargs *boxCmd; |
---|
76 | void MakeMeABox( G4String values ); |
---|
77 | |
---|
78 | G4UIcmdParg *consArgs[7]; |
---|
79 | G4UIcmdWithPargs *consCmd; |
---|
80 | void MakeMeACons( G4String values ); |
---|
81 | |
---|
82 | G4UIcmdParg *orbArgs[1]; |
---|
83 | G4UIcmdWithPargs *orbCmd; |
---|
84 | void MakeMeAnOrb( G4String values ); |
---|
85 | |
---|
86 | G4UIcmdParg *paraArgs[6]; |
---|
87 | G4UIcmdWithPargs *paraCmd; |
---|
88 | void MakeMeAPara( G4String values ); |
---|
89 | |
---|
90 | G4UIcmdParg *sphereArgs[6]; |
---|
91 | G4UIcmdWithPargs *sphereCmd; |
---|
92 | void MakeMeASphere( G4String values ); |
---|
93 | |
---|
94 | G4UIcmdParg *torusArgs[5]; |
---|
95 | G4UIcmdWithPargs *torusCmd; |
---|
96 | void MakeMeATorus( G4String values ); |
---|
97 | |
---|
98 | G4UIcmdParg *trapArgs[11]; |
---|
99 | G4UIcmdWithPargs *trapCmd; |
---|
100 | void MakeMeATrap( G4String values ); |
---|
101 | |
---|
102 | G4UIcmdParg *trdArgs[5]; |
---|
103 | G4UIcmdWithPargs *trdCmd; |
---|
104 | void MakeMeATrd( G4String values ); |
---|
105 | |
---|
106 | G4UIcmdParg *tubsArgs[5]; |
---|
107 | G4UIcmdWithPargs *tubsCmd; |
---|
108 | void MakeMeATubs( G4String values ); |
---|
109 | |
---|
110 | G4UIcmdParg *ellipsoidArgs[5]; |
---|
111 | G4UIcmdWithPargs *ellipsoidCmd; |
---|
112 | void MakeMeAnEllipsoid( G4String values ); |
---|
113 | |
---|
114 | G4UIcmdParg *elConeArgs[4]; |
---|
115 | G4UIcmdWithPargs *elConeCmd; |
---|
116 | void MakeMeAnEllipticalCone( G4String values ); |
---|
117 | |
---|
118 | G4UIcmdParg *elTubeArgs[6]; |
---|
119 | G4UIcmdWithPargs *elTubeCmd; |
---|
120 | void MakeMeAnEllipticalTube( G4String values ); |
---|
121 | |
---|
122 | G4UIcmdParg *extrudedArgs[8]; |
---|
123 | G4UIcmdWithPargs *extrudedCmd; |
---|
124 | void MakeMeAnExtrudedSolid( G4String values ); |
---|
125 | |
---|
126 | G4UIcmdParg *hypeArgs[5]; |
---|
127 | G4UIcmdWithPargs *hypeCmd; |
---|
128 | void MakeMeAHype( G4String values ); |
---|
129 | |
---|
130 | G4UIcmdParg *polyconeArgs[5]; |
---|
131 | G4UIcmdWithPargs *polyconeCmd; |
---|
132 | void MakeMeAPolycone( G4String values ); |
---|
133 | |
---|
134 | G4UIcmdParg *polycone2Args[6]; |
---|
135 | G4UIcmdWithPargs *polycone2Cmd; |
---|
136 | void MakeMeAPolycone2( G4String values ); |
---|
137 | |
---|
138 | G4UIcmdParg *polyhedraArgs[6]; |
---|
139 | G4UIcmdWithPargs *polyhedraCmd; |
---|
140 | void MakeMeAPolyhedra( G4String values ); |
---|
141 | |
---|
142 | G4UIcmdParg *polyhedra2Args[7]; |
---|
143 | G4UIcmdWithPargs *polyhedra2Cmd; |
---|
144 | void MakeMeAPolyhedra2( G4String values ); |
---|
145 | |
---|
146 | G4UIcmdParg *tesselArgs[9]; |
---|
147 | G4UIcmdWithPargs *tesselCmd; |
---|
148 | void MakeMeATessellatedSolid( G4String values ); |
---|
149 | |
---|
150 | G4UIcmdParg *tessel2Args[8]; |
---|
151 | G4UIcmdWithPargs *tessel2Cmd; |
---|
152 | void MakeMeATessellatedSolid2( G4String values ); |
---|
153 | |
---|
154 | G4UIcmdParg *tetArgs[4]; |
---|
155 | G4UIcmdWithPargs *tetCmd; |
---|
156 | void MakeMeATet( G4String values ); |
---|
157 | |
---|
158 | G4UIcmdParg *twistedBoxArgs[4]; |
---|
159 | G4UIcmdWithPargs *twistedBoxCmd; |
---|
160 | void MakeMeATwistedBox( G4String values ); |
---|
161 | |
---|
162 | G4UIcmdParg *twistedTrapArgs[5]; |
---|
163 | G4UIcmdWithPargs *twistedTrapCmd; |
---|
164 | void MakeMeATwistedTrap( G4String values ); |
---|
165 | |
---|
166 | G4UIcmdParg *twistedTrap2Args[11]; |
---|
167 | G4UIcmdWithPargs *twistedTrap2Cmd; |
---|
168 | void MakeMeATwistedTrap2( G4String values ); |
---|
169 | |
---|
170 | G4UIcmdParg *twistedTrdArgs[6]; |
---|
171 | G4UIcmdWithPargs *twistedTrdCmd; |
---|
172 | void MakeMeATwistedTrd( G4String values ); |
---|
173 | |
---|
174 | G4UIcmdParg *twistedTubsArgs[7]; |
---|
175 | G4UIcmdWithPargs *twistedTubsCmd; |
---|
176 | void MakeMeATwistedTubs( G4String values ); |
---|
177 | |
---|
178 | G4UIcmdWithPargs *dircTestCmd; |
---|
179 | void MakeMeDircTest(); |
---|
180 | |
---|
181 | |
---|
182 | |
---|
183 | typedef enum BooleanOp { |
---|
184 | INTERSECTION, |
---|
185 | SUBTRACTION, |
---|
186 | UNION |
---|
187 | } BooleanOp; |
---|
188 | |
---|
189 | G4UIcmdWithPargs *BooleanSolid1Cmd; |
---|
190 | void MakeMeBooleanSolid1(G4String values); |
---|
191 | |
---|
192 | /* Here add new commands and functions to create solids */ |
---|
193 | |
---|
194 | }; |
---|
195 | |
---|
196 | |
---|
197 | #endif |
---|