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: G4FRSceneFunc.icc,v 1.16 2010/11/11 01:13:42 akimura Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-04-ref-00 $ |
---|
29 | // |
---|
30 | |
---|
31 | #include "G4VisManager.hh" |
---|
32 | #include "G4PhysicalVolumeModel.hh" |
---|
33 | #include "G4LogicalVolume.hh" |
---|
34 | |
---|
35 | //========== AddPrimitive() functions ==========// |
---|
36 | |
---|
37 | //----- Add polyline |
---|
38 | void G4FRSCENEHANDLER::AddPrimitive (const G4Polyline& polyline) |
---|
39 | { |
---|
40 | #if defined DEBUG_FR_SCENE |
---|
41 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
42 | G4cout << "***** AddPrimitive\n"; |
---|
43 | #endif |
---|
44 | //----- Initialize Fukui Renderer IF NECESSARY |
---|
45 | FRBeginModeling(); |
---|
46 | |
---|
47 | //----- local working variables |
---|
48 | G4int nPoints = polyline.size (); |
---|
49 | G4int i ; |
---|
50 | const G4VisAttributes* pVA = |
---|
51 | fpViewer->GetApplicableVisAttributes ( polyline.GetVisAttributes() ); |
---|
52 | |
---|
53 | //----- skip drawing invisible primitive |
---|
54 | if( pVA ){ |
---|
55 | if( !(pVA->IsVisible()) ) { return ; } |
---|
56 | } |
---|
57 | |
---|
58 | //----- Attributes |
---|
59 | if(!SendVisAttributes( pVA ) ) { |
---|
60 | SendStr( FR_COLOR_RGB_RED ); // color |
---|
61 | } |
---|
62 | |
---|
63 | //----- send coordinates to Fukui Renderer |
---|
64 | SendTransformedCoordinates(); |
---|
65 | |
---|
66 | //----- send beginning of polyline |
---|
67 | SendStr( FR_POLYLINE ); |
---|
68 | |
---|
69 | //----- vertices on polyline |
---|
70 | for ( i = 0; i < nPoints; i++ ) { |
---|
71 | SendStrDouble3( FR_PL_VERTEX , \ |
---|
72 | polyline[i].x(), \ |
---|
73 | polyline[i].y(), \ |
---|
74 | polyline[i].z() ); |
---|
75 | } |
---|
76 | |
---|
77 | //----- send ending of polyline |
---|
78 | SendStr( FR_END_POLYLINE ); |
---|
79 | |
---|
80 | } // G4FRSCENEHANDLER::AddPrimitive (polyline) |
---|
81 | |
---|
82 | |
---|
83 | //----- Add nurbes |
---|
84 | void G4FRSCENEHANDLER::AddPrimitive (const G4NURBS&) |
---|
85 | { |
---|
86 | //----- |
---|
87 | #if defined DEBUG_FR_SCENE |
---|
88 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
89 | G4cout << "***** AddPrimitive( G4NURBS )\n"; |
---|
90 | #endif |
---|
91 | |
---|
92 | //----- Initialize DAWN IF NECESSARY |
---|
93 | FRBeginModeling(); |
---|
94 | |
---|
95 | /////////////////////////////////////////////// |
---|
96 | // DAWN does not support NUBS visualizaition // |
---|
97 | /////////////////////////////////////////////// |
---|
98 | } |
---|
99 | |
---|
100 | |
---|
101 | |
---|
102 | //----- Add text |
---|
103 | void G4FRSCENEHANDLER::AddPrimitive ( const G4Text& text ) |
---|
104 | { |
---|
105 | //----- |
---|
106 | #if defined DEBUG_FR_SCENE |
---|
107 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
108 | G4cout << "***** AddPrimitive( G4Text )\n"; |
---|
109 | #endif |
---|
110 | //----- Initialize DAWN IF NECESSARY |
---|
111 | FRBeginModeling(); |
---|
112 | |
---|
113 | //----- send color |
---|
114 | const G4Color& color = GetTextColor (text) ; |
---|
115 | SendStrDouble3( FR_COLOR_RGB , |
---|
116 | color.GetRed (), |
---|
117 | color.GetGreen(), |
---|
118 | color.GetBlue () ); |
---|
119 | |
---|
120 | //----- send body coordinates |
---|
121 | SendTransformedCoordinates(); |
---|
122 | |
---|
123 | //----- Calc size |
---|
124 | MarkerSizeType size_type; |
---|
125 | G4double fontsize = GetMarkerDiameter( text , size_type ); |
---|
126 | |
---|
127 | //----- Calc position |
---|
128 | const G4Point3D& position = text.GetPosition () ; |
---|
129 | |
---|
130 | //----- offset |
---|
131 | G4double x_offset = text.GetXOffset(); |
---|
132 | G4double y_offset = text.GetYOffset(); |
---|
133 | |
---|
134 | //----- get string to be visualized and Calc its length |
---|
135 | const char* vis_text = text.GetText(); |
---|
136 | const int STR_LENGTH = strlen ( vis_text ); |
---|
137 | |
---|
138 | //----- create buffer and copy the string there |
---|
139 | int MAX_STR_LENGTH = COMMAND_BUF_SIZE - 100 ; |
---|
140 | if ( MAX_STR_LENGTH <= 0 ) { |
---|
141 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) { |
---|
142 | G4cout << "ERROR (FukuiRenderer) : Not enough buffer size for data transferring." << G4endl; |
---|
143 | G4cout << " G4Text Visualization is aborted" << G4endl; |
---|
144 | } |
---|
145 | return ; |
---|
146 | } |
---|
147 | char* buf = new char [ (MAX_STR_LENGTH + 1) ] ; |
---|
148 | if ( MAX_STR_LENGTH >= STR_LENGTH ) { |
---|
149 | strcpy ( buf, vis_text ) ; |
---|
150 | } else { |
---|
151 | strncpy ( buf, vis_text, MAX_STR_LENGTH ) ; |
---|
152 | } |
---|
153 | |
---|
154 | //----- select string command |
---|
155 | char text_command[32]; |
---|
156 | switch (size_type) { |
---|
157 | case world: |
---|
158 | strcpy ( text_command, FR_MARK_TEXT_2D ); |
---|
159 | break; |
---|
160 | case screen: |
---|
161 | default: |
---|
162 | strcpy ( text_command, FR_MARK_TEXT_2DS ); |
---|
163 | break; |
---|
164 | } |
---|
165 | |
---|
166 | //----- Send string command |
---|
167 | SendStrDouble6Str( text_command, \ |
---|
168 | position.x() , position.y() , position.z(), |
---|
169 | fontsize , x_offset , y_offset , |
---|
170 | buf ); |
---|
171 | |
---|
172 | //----- delete buffer |
---|
173 | delete [] buf ; |
---|
174 | |
---|
175 | } // G4FRSCENEHANDLER::AddPrimitive ( text ) |
---|
176 | |
---|
177 | |
---|
178 | //----- Add circle |
---|
179 | void G4FRSCENEHANDLER::AddPrimitive ( const G4Circle& mark_circle ) |
---|
180 | { |
---|
181 | //----- |
---|
182 | #if defined DEBUG_FR_SCENE |
---|
183 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
184 | G4cout << "***** AddPrimitive( G4Circle )\n"; |
---|
185 | #endif |
---|
186 | //----- Initialize Fukui Renderer IF NECESSARY |
---|
187 | FRBeginModeling(); |
---|
188 | |
---|
189 | //----- send color |
---|
190 | const G4Color& color = GetColor (mark_circle) ; |
---|
191 | SendStrDouble3( FR_COLOR_RGB , |
---|
192 | color.GetRed (), |
---|
193 | color.GetGreen(), |
---|
194 | color.GetBlue () ); |
---|
195 | |
---|
196 | //----- send body coordinates |
---|
197 | SendTransformedCoordinates(); |
---|
198 | |
---|
199 | //----- Calc position |
---|
200 | const G4Point3D& position = mark_circle.GetPosition () ; |
---|
201 | |
---|
202 | //----- Calc size |
---|
203 | MarkerSizeType size_type; |
---|
204 | G4double size = GetMarkerRadius( mark_circle , size_type ); |
---|
205 | |
---|
206 | //----- send mark |
---|
207 | switch (size_type) { |
---|
208 | case world: |
---|
209 | SendStrDouble4( FR_MARK_CIRCLE_2D, \ |
---|
210 | position.x() , position.y() , position.z(), size ); |
---|
211 | break; |
---|
212 | default: |
---|
213 | case screen: |
---|
214 | SendStrDouble4( FR_MARK_CIRCLE_2DS, \ |
---|
215 | position.x() , position.y() , position.z(), size ); |
---|
216 | break; |
---|
217 | } |
---|
218 | |
---|
219 | } // G4FRSCENEHANDLER::AddPrimitive ( mark_circle ) |
---|
220 | |
---|
221 | |
---|
222 | //----- Add square |
---|
223 | void G4FRSCENEHANDLER::AddPrimitive (const G4Square& mark_square ) |
---|
224 | { |
---|
225 | //----- |
---|
226 | #if defined DEBUG_FR_SCENE |
---|
227 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
228 | G4cout << "***** AddPrimitive( G4Square )\n"; |
---|
229 | #endif |
---|
230 | //----- Initialize Fukui Renderer IF NECESSARY |
---|
231 | FRBeginModeling(); |
---|
232 | |
---|
233 | //----- send color |
---|
234 | const G4Color& color = GetColor (mark_square) ; |
---|
235 | SendStrDouble3( FR_COLOR_RGB , |
---|
236 | color.GetRed (), |
---|
237 | color.GetGreen(), |
---|
238 | color.GetBlue () ); |
---|
239 | |
---|
240 | //----- send body coordinates |
---|
241 | SendTransformedCoordinates(); |
---|
242 | |
---|
243 | //----- Calc position |
---|
244 | const G4Point3D& position = mark_square.GetPosition () ; |
---|
245 | |
---|
246 | //----- Calc size |
---|
247 | MarkerSizeType size_type; |
---|
248 | G4double size = GetMarkerRadius( mark_square , size_type ); |
---|
249 | |
---|
250 | //----- send mark |
---|
251 | switch (size_type) { |
---|
252 | case world: |
---|
253 | SendStrDouble4( FR_MARK_SQUARE_2D, \ |
---|
254 | position.x() , position.y() , position.z(), size ); |
---|
255 | break; |
---|
256 | default: |
---|
257 | case screen: |
---|
258 | SendStrDouble4( FR_MARK_SQUARE_2DS, \ |
---|
259 | position.x() , position.y() , position.z(), size ); |
---|
260 | break; |
---|
261 | } |
---|
262 | |
---|
263 | } // G4FRSCENEHANDLER::AddPrimitive ( mark_square ) |
---|
264 | |
---|
265 | |
---|
266 | //----- Add polyhedron |
---|
267 | void G4FRSCENEHANDLER::AddPrimitive ( const G4Polyhedron& polyhedron ) |
---|
268 | { |
---|
269 | //----- |
---|
270 | #if defined DEBUG_FR_SCENE |
---|
271 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
272 | G4cout << "***** AddPrimitive( G4Polyhedron )\n"; |
---|
273 | #endif |
---|
274 | |
---|
275 | if (polyhedron.GetNoFacets() == 0) return; |
---|
276 | |
---|
277 | //----- Initialize Fukui Renderer IF NECESSARY |
---|
278 | FRBeginModeling(); |
---|
279 | |
---|
280 | //----- Attributes |
---|
281 | if(!SendVisAttributes( fpViewer->GetApplicableVisAttributes |
---|
282 | (polyhedron.GetVisAttributes() ) ) ) { |
---|
283 | SendStr( FR_COLOR_RGB_RED ); // color |
---|
284 | } |
---|
285 | |
---|
286 | //----- Coordinates |
---|
287 | SendTransformedCoordinates(); |
---|
288 | |
---|
289 | //----- Brep data |
---|
290 | |
---|
291 | //---------- (1) Declare beginning of Brep data |
---|
292 | SendStr(FR_POLYHEDRON); |
---|
293 | |
---|
294 | //---------- (2) Vertex block |
---|
295 | G4int i, j; |
---|
296 | for (i = 1, j = polyhedron.GetNoVertices(); j; j--, i++){ |
---|
297 | G4Point3D point = polyhedron.GetVertex(i); |
---|
298 | SendStrDouble3( FR_VERTEX, point.x (), point.y (), point.z ()); |
---|
299 | } |
---|
300 | |
---|
301 | //---------- (3) Facet block |
---|
302 | for (int f = polyhedron.GetNoFacets(); f; f--){ |
---|
303 | G4int notLastEdge; |
---|
304 | G4int index = -1; // initialization |
---|
305 | G4int edgeFlag = 1; |
---|
306 | G4int preedgeFlag = 1; |
---|
307 | G4int work[4], i = 0; |
---|
308 | do { |
---|
309 | preedgeFlag = edgeFlag; |
---|
310 | notLastEdge = polyhedron.GetNextVertexIndex(index, edgeFlag); |
---|
311 | work[i++] = index; |
---|
312 | }while (notLastEdge); |
---|
313 | switch (i){ |
---|
314 | case 3: |
---|
315 | SendStrInt3(FR_FACET, work[0], work[1], work[2] ); |
---|
316 | break; |
---|
317 | case 4: |
---|
318 | SendStrInt4(FR_FACET, work[0], work[1], work[2], work[3] ); |
---|
319 | break; |
---|
320 | default: |
---|
321 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
322 | G4cout << |
---|
323 | "ERROR G4FRSCENEHANDLER::AddPrimitive(G4Polyhedron)\n"; |
---|
324 | G4PhysicalVolumeModel* pPVModel = |
---|
325 | dynamic_cast<G4PhysicalVolumeModel*>(fpModel); |
---|
326 | if (pPVModel) |
---|
327 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) { |
---|
328 | G4cout << |
---|
329 | "Volume " << pPVModel->GetCurrentPV()->GetName() << |
---|
330 | ", Solid " << pPVModel->GetCurrentLV()->GetSolid()->GetName() << |
---|
331 | " (" << pPVModel->GetCurrentLV()->GetSolid()->GetEntityType(); |
---|
332 | G4cout << |
---|
333 | "\nG4Polyhedron facet with " << i << " edges" << G4endl; |
---|
334 | } |
---|
335 | } |
---|
336 | } |
---|
337 | |
---|
338 | //---------- (4) Declare ending of Brep data |
---|
339 | SendStr(FR_END_POLYHEDRON); |
---|
340 | |
---|
341 | } // G4FRSCENEHANDLER::AddPrimitive (polyhedron) |
---|
342 | |
---|
343 | |
---|
344 | //----- |
---|
345 | void G4FRSCENEHANDLER::SendNdiv ( void ) |
---|
346 | { |
---|
347 | ////////////////////////////////////////////////// |
---|
348 | //#if defined DEBUG_FR_SCENE |
---|
349 | // G4cout << "***** SendNdiv() (/Ndiv)" << G4endl; |
---|
350 | //#endif |
---|
351 | ////////////////////////////////////////////////// |
---|
352 | |
---|
353 | //----- local |
---|
354 | G4int num_division = FR_DEFALUT_NDIV_VALUE ; |
---|
355 | |
---|
356 | //----- number used for dividing a curved surface, Ndiv |
---|
357 | // if ( GetModel() ) { ?? Why test for model. Can be zero. JA ?? |
---|
358 | const G4VisAttributes* pVisAttribs = |
---|
359 | fpViewer -> GetApplicableVisAttributes (fpVisAttribs); |
---|
360 | num_division = GetNoOfSides(pVisAttribs); |
---|
361 | // } else { |
---|
362 | #if defined DEBUG_FR_SCENE |
---|
363 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) { |
---|
364 | G4cout << "WARNING: GetNoOfSides() failed. " ; |
---|
365 | G4cout << "The default value " << num_division ; |
---|
366 | G4cout << " is assigned." << G4endl; |
---|
367 | } |
---|
368 | #endif |
---|
369 | //} |
---|
370 | |
---|
371 | //---------- Error recovery for too small Ndiv |
---|
372 | num_division = ( num_division < 3 ? 3 : num_division ); |
---|
373 | |
---|
374 | ////////////////////////////////////////////////// |
---|
375 | //#if defined DEBUG_FR_SCENE |
---|
376 | // G4cout << "Ndiv = " << num_division << G4endl; |
---|
377 | //#endif |
---|
378 | ////////////////////////////////////////////////// |
---|
379 | |
---|
380 | //----- Send resultant Ndiv |
---|
381 | this->SendStrInt( FR_NDIV, num_division ); |
---|
382 | |
---|
383 | |
---|
384 | } |
---|
385 | |
---|
386 | //----- |
---|
387 | void G4FRSCENEHANDLER::FREndModeling () |
---|
388 | { |
---|
389 | //----- |
---|
390 | #if defined DEBUG_FR_SCENE |
---|
391 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
392 | G4cout << "***** FREndModeling (called)" << G4endl; |
---|
393 | #endif |
---|
394 | if( FRIsInModeling() ) { |
---|
395 | |
---|
396 | #if defined DEBUG_FR_SCENE |
---|
397 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) { |
---|
398 | G4cout << "***** FREndModeling (started) " ; |
---|
399 | G4cout << "(/EndModeling, /DrawAll, /CloseDevice)" << G4endl; |
---|
400 | } |
---|
401 | #endif |
---|
402 | |
---|
403 | SendStr( "#--------------------" ); |
---|
404 | |
---|
405 | //----- !EndModeling |
---|
406 | SendStr( FR_END_MODELING ); |
---|
407 | |
---|
408 | //----- !DrawAll |
---|
409 | SendStr( FR_DRAW_ALL ); |
---|
410 | |
---|
411 | //----- !CloseDevice |
---|
412 | SendStr( FR_CLOSE_DEVICE ); |
---|
413 | |
---|
414 | //----- End saving data to g4.prim |
---|
415 | EndSavingG4Prim() ; |
---|
416 | |
---|
417 | //------ Reset flag |
---|
418 | FRflag_in_modeling = false ; |
---|
419 | } |
---|
420 | } |
---|
421 | |
---|
422 | |
---|
423 | //----- |
---|
424 | void G4FRSCENEHANDLER::BeginPrimitives (const G4Transform3D& objectTransformation) |
---|
425 | { |
---|
426 | #if defined DEBUG_FR_SCENE |
---|
427 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
428 | G4cout << "***** BeginPrimitives \n"; |
---|
429 | #endif |
---|
430 | |
---|
431 | FRBeginModeling(); |
---|
432 | |
---|
433 | G4VSceneHandler::BeginPrimitives (objectTransformation); |
---|
434 | fpObjectTransformation = &objectTransformation; |
---|
435 | |
---|
436 | } |
---|
437 | |
---|
438 | |
---|
439 | //----- |
---|
440 | void G4FRSCENEHANDLER::EndPrimitives () |
---|
441 | { |
---|
442 | #if defined DEBUG_FR_SCENE |
---|
443 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
444 | G4cout << "***** EndPrimitives \n"; |
---|
445 | #endif |
---|
446 | G4VSceneHandler::EndPrimitives (); |
---|
447 | } |
---|
448 | |
---|
449 | |
---|
450 | //========== AddSolid() functions ==========// |
---|
451 | |
---|
452 | //----- Add box |
---|
453 | void G4FRSCENEHANDLER::AddSolid( const G4Box& box ) |
---|
454 | { |
---|
455 | #if defined DEBUG_FR_SCENE |
---|
456 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
457 | G4cout << "***** AddSolid ( box )\n"; |
---|
458 | #endif |
---|
459 | //----- skip drawing invisible primitive |
---|
460 | if( !IsVisible() ) { return ; } |
---|
461 | |
---|
462 | //----- Initialize Fukui Renderer IF NECESSARY |
---|
463 | FRBeginModeling(); |
---|
464 | |
---|
465 | //----- Send Name |
---|
466 | SendPhysVolName(); |
---|
467 | |
---|
468 | //----- Send Ndiv |
---|
469 | // SendNdiv(); |
---|
470 | |
---|
471 | //----- Attributes |
---|
472 | if(!SendVisAttributes |
---|
473 | ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) { |
---|
474 | SendStr( FR_COLOR_RGB_GREEN ); // color |
---|
475 | } |
---|
476 | |
---|
477 | //----- parameters (half lengths of box) |
---|
478 | G4double dx = box.GetXHalfLength (); |
---|
479 | G4double dy = box.GetYHalfLength (); |
---|
480 | G4double dz = box.GetZHalfLength (); |
---|
481 | |
---|
482 | //----- send coordinates to Fukui Renderer |
---|
483 | SendTransformedCoordinates(); |
---|
484 | |
---|
485 | //----- send box to Fukui Renderer |
---|
486 | SendStrDouble3( FR_BOX, dx, dy, dz ); |
---|
487 | |
---|
488 | } // void G4FRSCENEHANDLER::AddSolid( const G4Box& box ) |
---|
489 | |
---|
490 | |
---|
491 | //----- Add tubes |
---|
492 | void |
---|
493 | G4FRSCENEHANDLER::AddSolid( const G4Tubs& tubes ) |
---|
494 | { |
---|
495 | #if defined DEBUG_FR_SCENE |
---|
496 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
497 | G4cout << "***** AddSolid ( tubes )\n"; |
---|
498 | #endif |
---|
499 | //----- skip drawing invisible primitive |
---|
500 | if( !IsVisible() ) { return ; } |
---|
501 | |
---|
502 | //----- Initialize Fukui Renderer IF NECESSARY |
---|
503 | FRBeginModeling(); |
---|
504 | |
---|
505 | //----- Send Name |
---|
506 | SendPhysVolName(); |
---|
507 | |
---|
508 | //----- Send Ndiv |
---|
509 | SendNdiv(); |
---|
510 | |
---|
511 | //----- Attributes |
---|
512 | if(!SendVisAttributes |
---|
513 | ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) { |
---|
514 | SendStr( FR_COLOR_RGB_BLUE ); // color |
---|
515 | } |
---|
516 | |
---|
517 | //----- parameters |
---|
518 | const G4double R = tubes.GetRMax() ; // outside radius |
---|
519 | const G4double r = tubes.GetRMin() ; // inside radius |
---|
520 | const G4double dz = tubes.GetDz () ; // half length in z |
---|
521 | const G4double sphi = tubes.GetSPhi() ; // starting angle |
---|
522 | const G4double dphi = tubes.GetDPhi() ; // angle width |
---|
523 | |
---|
524 | //----- send coordinates to Fukui Renderer |
---|
525 | SendTransformedCoordinates(); |
---|
526 | |
---|
527 | //----- send tubes to Fukui Renderer |
---|
528 | SendStrDouble5( FR_TUBS, r, R, dz , sphi, dphi ); |
---|
529 | |
---|
530 | } // void G4FRSCENEHANDLER::AddSolid( const G4Tubs& ) |
---|
531 | |
---|
532 | |
---|
533 | |
---|
534 | //----- Add cons |
---|
535 | void |
---|
536 | G4FRSCENEHANDLER::AddSolid( const G4Cons& cons ) |
---|
537 | { |
---|
538 | #if defined DEBUG_FR_SCENE |
---|
539 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
540 | G4cout << "***** AddSolid ( cons )\n"; |
---|
541 | #endif |
---|
542 | //----- skip drawing invisible primitive |
---|
543 | if( !IsVisible() ) { return ; } |
---|
544 | |
---|
545 | //----- Initialize Fukui Renderer IF NECESSARY |
---|
546 | FRBeginModeling(); |
---|
547 | |
---|
548 | //----- Send Name |
---|
549 | SendPhysVolName(); |
---|
550 | |
---|
551 | //----- Send Ndiv |
---|
552 | SendNdiv(); |
---|
553 | |
---|
554 | //----- Attributes |
---|
555 | if(!SendVisAttributes |
---|
556 | ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) { |
---|
557 | SendStr( FR_COLOR_RGB_CYAN ); // color |
---|
558 | } |
---|
559 | |
---|
560 | //----- parameters |
---|
561 | const G4double r1 = cons.GetRmin1() ; // inside radius at -dz |
---|
562 | const G4double R1 = cons.GetRmax1() ; // outside radius at -dz |
---|
563 | const G4double r2 = cons.GetRmin2() ; // inside radius at +dz |
---|
564 | const G4double R2 = cons.GetRmax2() ; // outside radius at +dz |
---|
565 | const G4double dz = cons.GetDz () ; // half length in z |
---|
566 | const G4double sphi = cons.GetSPhi() ; // starting angle |
---|
567 | const G4double dphi = cons.GetDPhi() ; // angle width |
---|
568 | |
---|
569 | //----- send coordinates to Fukui Renderer |
---|
570 | SendTransformedCoordinates(); |
---|
571 | |
---|
572 | //----- send cons to Fukui Renderer |
---|
573 | SendStrDouble7( FR_CONS, r1, R1, r2, R2, dz , sphi, dphi ); |
---|
574 | |
---|
575 | }// G4FRSCENEHANDLER::AddSolid( cons ) |
---|
576 | |
---|
577 | |
---|
578 | //----- Add trd |
---|
579 | void G4FRSCENEHANDLER::AddSolid ( const G4Trd& trd ) |
---|
580 | { |
---|
581 | #if defined DEBUG_FR_SCENE |
---|
582 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
583 | G4cout << "***** AddSolid ( trd )\n"; |
---|
584 | #endif |
---|
585 | |
---|
586 | //----- skip drawing invisible primitive |
---|
587 | if( !IsVisible() ) { return ; } |
---|
588 | |
---|
589 | //----- Initialize Fukui Renderer IF NECESSARY |
---|
590 | FRBeginModeling(); |
---|
591 | |
---|
592 | //----- Send Name |
---|
593 | SendPhysVolName(); |
---|
594 | |
---|
595 | //----- Send Ndiv |
---|
596 | // SendNdiv(); |
---|
597 | |
---|
598 | //----- Attributes |
---|
599 | if(!SendVisAttributes |
---|
600 | ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) { |
---|
601 | SendStr( FR_COLOR_RGB_MAGENTA ); // color |
---|
602 | } |
---|
603 | |
---|
604 | //----- parameters |
---|
605 | G4double dx1 = trd.GetXHalfLength1 (); |
---|
606 | G4double dx2 = trd.GetXHalfLength2 (); |
---|
607 | G4double dy1 = trd.GetYHalfLength1 (); |
---|
608 | G4double dy2 = trd.GetYHalfLength2 (); |
---|
609 | G4double dz = trd.GetZHalfLength (); |
---|
610 | |
---|
611 | //----- send coordinates to Fukui Renderer |
---|
612 | SendTransformedCoordinates(); |
---|
613 | |
---|
614 | //----- send trd to Fukui Renderer |
---|
615 | SendStrDouble5( FR_TRD, dx1, dx2, dy1, dy2, dz ); |
---|
616 | |
---|
617 | } // G4FRSCENEHANDLER::AddSolid ( trd ) |
---|
618 | |
---|
619 | |
---|
620 | //----- Add sphere |
---|
621 | void G4FRSCENEHANDLER::AddSolid ( const G4Sphere& sphere ) |
---|
622 | { |
---|
623 | #if defined DEBUG_FR_SCENE |
---|
624 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
625 | G4cout << "***** AddSolid ( sphere )\n"; |
---|
626 | #endif |
---|
627 | //----- skip drawing invisible primitive |
---|
628 | if( !IsVisible() ) { return ; } |
---|
629 | |
---|
630 | //----- Initialize Fukui Renderer IF NECESSARY |
---|
631 | FRBeginModeling(); |
---|
632 | |
---|
633 | //----- Send Name |
---|
634 | SendPhysVolName(); |
---|
635 | |
---|
636 | //----- Send Ndiv |
---|
637 | SendNdiv(); |
---|
638 | |
---|
639 | //----- Attributes |
---|
640 | if(!SendVisAttributes |
---|
641 | ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) { |
---|
642 | SendStr( FR_COLOR_RGB_YELLOW ); // color |
---|
643 | } |
---|
644 | |
---|
645 | //----- parameters |
---|
646 | // const G4double rmin = sphere.GetRmin(); |
---|
647 | const G4double rmax = sphere.GetRmax(); |
---|
648 | // const G4double sphi = sphere.GetSPhi(); |
---|
649 | const G4double dphi = sphere.GetDPhi(); |
---|
650 | // const G4double stheta = sphere.GetSTheta(); |
---|
651 | const G4double dtheta = sphere.GetDTheta(); |
---|
652 | |
---|
653 | //----- send coordinates to Fukui Renderer |
---|
654 | SendTransformedCoordinates(); |
---|
655 | |
---|
656 | //----- send sphere to Fukui Renderer |
---|
657 | const G4double PI_minus = 0.9999 * pi ; |
---|
658 | const G4double PI2_minus = 1.9999 * pi ; |
---|
659 | if( dphi > PI2_minus && dtheta > PI_minus ) { |
---|
660 | //----- full sphere |
---|
661 | SendStrDouble ( FR_SPHERE, rmax ); |
---|
662 | } else { |
---|
663 | |
---|
664 | //----- call AddPrimitives( G4Polyhedron ) |
---|
665 | //...... For sphere "segment", |
---|
666 | //...... G4Polyhedron is used for visualization. |
---|
667 | //...... Visualization attributes and |
---|
668 | //...... local coordinates are resent and overwritten. |
---|
669 | G4VSceneHandler::AddSolid( sphere ) ; |
---|
670 | |
---|
671 | //////////////////////////////////////////////////////////////// |
---|
672 | // //----- sphere segment |
---|
673 | // SendStrDouble6( FR_SPHERE_SEG, rmin, rmax, stheta, dtheta, sphi, dphi ); |
---|
674 | //////////////////////////////////////////////////////////////// |
---|
675 | |
---|
676 | } |
---|
677 | |
---|
678 | } // G4FRSCENEHANDLER::AddSolid ( sphere ) |
---|
679 | |
---|
680 | |
---|
681 | //----- Add para |
---|
682 | void G4FRSCENEHANDLER::AddSolid (const G4Para& para) |
---|
683 | { |
---|
684 | #if defined DEBUG_FR_SCENE |
---|
685 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
686 | G4cout << "***** AddSolid ( para )\n"; |
---|
687 | #endif |
---|
688 | |
---|
689 | //----- skip drawing invisible primitive |
---|
690 | if( !IsVisible() ) { return ; } |
---|
691 | |
---|
692 | //----- Initialize Fukui Renderer IF NECESSARY |
---|
693 | FRBeginModeling(); |
---|
694 | |
---|
695 | //----- Send Name |
---|
696 | SendPhysVolName(); |
---|
697 | |
---|
698 | //----- Send Ndiv |
---|
699 | // SendNdiv(); |
---|
700 | |
---|
701 | //----- Attributes |
---|
702 | if(!SendVisAttributes |
---|
703 | ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) { |
---|
704 | SendStr( FR_COLOR_RGB_RED ); // color |
---|
705 | } |
---|
706 | |
---|
707 | //----- local |
---|
708 | const G4double epsilon = 1.0e-5 ; |
---|
709 | |
---|
710 | //----- parameters preprocessing |
---|
711 | G4double cosTheta = para.GetSymAxis().z() ; |
---|
712 | if( cosTheta < epsilon ) { |
---|
713 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) { |
---|
714 | G4cout << "WARNING from FukuiRenderer (DAWN) driver:" << G4endl; |
---|
715 | G4cout << " Invalid parameter for parallelepiped." << G4endl; |
---|
716 | G4cout << " Drawing is skipped." << G4endl; |
---|
717 | } |
---|
718 | return ; |
---|
719 | } |
---|
720 | G4double tanTheta_cosPhi_cosTheta = para.GetSymAxis().x() ; |
---|
721 | G4double tanTheta_sinPhi_cosTheta = para.GetSymAxis().y() ; |
---|
722 | |
---|
723 | //----- parameters |
---|
724 | G4double dx = para.GetXHalfLength (); |
---|
725 | G4double dy = para.GetYHalfLength (); |
---|
726 | G4double dz = para.GetZHalfLength (); |
---|
727 | G4double tanAlpha = para.GetTanAlpha(); |
---|
728 | G4double tanTheta_cosPhi = tanTheta_cosPhi_cosTheta / cosTheta ; |
---|
729 | G4double tanTheta_sinPhi = tanTheta_sinPhi_cosTheta / cosTheta ; |
---|
730 | |
---|
731 | //----- send coordinates to Fukui Renderer |
---|
732 | SendTransformedCoordinates(); |
---|
733 | |
---|
734 | //----- send data to Fukui Renderer |
---|
735 | SendStrDouble6 ( FR_PARA, dx, dy, dz, tanAlpha, tanTheta_cosPhi, tanTheta_sinPhi ); |
---|
736 | |
---|
737 | } // G4FRSCENEHANDLER::AddSolid ( para ) |
---|
738 | |
---|
739 | |
---|
740 | //----- Add trap |
---|
741 | void G4FRSCENEHANDLER::AddSolid (const G4Trap& trap) |
---|
742 | { |
---|
743 | #if defined DEBUG_FR_SCENE |
---|
744 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
745 | G4cout << "***** AddSolid ( trap )\n"; |
---|
746 | #endif |
---|
747 | |
---|
748 | //----- skip drawing invisible primitive |
---|
749 | if( !IsVisible() ) { return ; } |
---|
750 | |
---|
751 | //----- Initialize Fukui Renderer IF NECESSARY |
---|
752 | FRBeginModeling(); |
---|
753 | |
---|
754 | //----- Send Name |
---|
755 | SendPhysVolName(); |
---|
756 | |
---|
757 | //----- Send Ndiv |
---|
758 | // SendNdiv(); |
---|
759 | |
---|
760 | //----- Attributes |
---|
761 | if(!SendVisAttributes |
---|
762 | ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) { |
---|
763 | SendStr( FR_COLOR_RGB_GREEN ); // color |
---|
764 | } |
---|
765 | |
---|
766 | //----- local |
---|
767 | const G4double epsilon = 1.0e-5 ; |
---|
768 | |
---|
769 | //----- parameters preprocessing |
---|
770 | G4double cosTheta = trap.GetSymAxis().z() ; |
---|
771 | if( cosTheta < epsilon ) { |
---|
772 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) { |
---|
773 | G4cout << "WARNING from FukuiRenderer (DAWN) driver:" << G4endl; |
---|
774 | G4cout << " Invalid parameter for trap, 1" << G4endl; |
---|
775 | G4cout << " Drawing is skipped." << G4endl; |
---|
776 | } |
---|
777 | return ; |
---|
778 | } |
---|
779 | |
---|
780 | G4double nx = trap.GetSymAxis().x() ; |
---|
781 | G4double ny = trap.GetSymAxis().y() ; |
---|
782 | |
---|
783 | //----- parameters (half lengths of box) |
---|
784 | G4double dz = trap.GetZHalfLength (); |
---|
785 | G4double theta = std::acos( cosTheta ) ; |
---|
786 | G4double phi; |
---|
787 | if ( ny==0. && nx ==0.) { |
---|
788 | phi = 0.; // std::atan2(0.,0.) gives undefined value of phi |
---|
789 | } else { |
---|
790 | phi = std::atan2( ny, nx ) ; if( phi < 0. ) { phi += twopi ; } |
---|
791 | // -PI < std::atan() < PI |
---|
792 | } |
---|
793 | ///////////////////////////////////////////////// |
---|
794 | // G4double phi = std::atan2( ny, nx ) ; |
---|
795 | // if( phi < 0.0 ) { phi += twopi ; } |
---|
796 | // // -PI < std::atan() < PI |
---|
797 | ///////////////////////////////////////////////// |
---|
798 | |
---|
799 | G4double h1 = trap.GetYHalfLength1 (); |
---|
800 | G4double bl1 = trap.GetXHalfLength1 (); |
---|
801 | G4double tl1 = trap.GetXHalfLength2 (); |
---|
802 | G4double alpha1 = std::atan( trap.GetTanAlpha1()) ; |
---|
803 | G4double h2 = trap.GetYHalfLength2 (); |
---|
804 | G4double bl2 = trap.GetXHalfLength3 (); |
---|
805 | G4double tl2 = trap.GetXHalfLength4 (); |
---|
806 | G4double alpha2 = std::atan( trap.GetTanAlpha2()) ; |
---|
807 | |
---|
808 | //----- send coordinates to Fukui Renderer |
---|
809 | SendTransformedCoordinates(); |
---|
810 | |
---|
811 | //----- Change sign of alpha for compatibility |
---|
812 | // with the DAWN format |
---|
813 | G4double alpha_sign = -1.0 ; |
---|
814 | alpha1 *= alpha_sign ; alpha2 *= alpha_sign ; |
---|
815 | |
---|
816 | //----- send box to Fukui Renderer |
---|
817 | SendStrDouble11( FR_TRAP , |
---|
818 | dz , |
---|
819 | theta , |
---|
820 | phi , |
---|
821 | h1 , |
---|
822 | bl1 , |
---|
823 | tl1 , |
---|
824 | alpha1 , |
---|
825 | h2 , |
---|
826 | bl2 , |
---|
827 | tl2 , |
---|
828 | alpha2 ); |
---|
829 | |
---|
830 | } // G4FRSCENEHANDLER::AddSolid (const G4Trap& trap) |
---|
831 | |
---|
832 | |
---|
833 | //----- Add torus |
---|
834 | void |
---|
835 | G4FRSCENEHANDLER::AddSolid( const G4Torus& torus ) |
---|
836 | { |
---|
837 | #if defined DEBUG_FR_SCENE |
---|
838 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
839 | G4cout << "***** AddSolid ( torus )\n"; |
---|
840 | #endif |
---|
841 | //----- skip drawing invisible primitive |
---|
842 | if( !IsVisible() ) { return ; } |
---|
843 | |
---|
844 | //----- Initialize Fukui Renderer IF NECESSARY |
---|
845 | FRBeginModeling(); |
---|
846 | |
---|
847 | //----- Send Name |
---|
848 | SendPhysVolName(); |
---|
849 | |
---|
850 | //----- Send Ndiv |
---|
851 | SendNdiv(); |
---|
852 | |
---|
853 | //----- Attributes |
---|
854 | if(!SendVisAttributes |
---|
855 | ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) { |
---|
856 | SendStr( FR_COLOR_RGB_BLUE ); // color |
---|
857 | } |
---|
858 | |
---|
859 | //----- parameters |
---|
860 | const G4double r = torus.GetRmin() ; |
---|
861 | const G4double R = torus.GetRmax() ; |
---|
862 | const G4double t = torus.GetRtor() ; |
---|
863 | const G4double sphi = torus.GetSPhi() ; |
---|
864 | const G4double dphi = torus.GetDPhi() ; |
---|
865 | |
---|
866 | //----- send coordinates to Fukui Renderer |
---|
867 | SendTransformedCoordinates(); |
---|
868 | |
---|
869 | //----- send torus to Fukui Renderer |
---|
870 | SendStrDouble5( FR_TORUS, r, R, t , sphi, dphi ); |
---|
871 | |
---|
872 | } // void G4FRSCENEHANDLER::AddSolid( const G4Torus& ) |
---|
873 | |
---|
874 | |
---|
875 | |
---|
876 | //----- Add a shape which is not treated above |
---|
877 | void G4FRSCENEHANDLER::AddSolid ( const G4VSolid& solid ) |
---|
878 | { |
---|
879 | //----- skip drawing invisible primitive |
---|
880 | if( !IsVisible() ) { return ; } |
---|
881 | |
---|
882 | //----- Initialize Fukui Renderer IF NECESSARY |
---|
883 | FRBeginModeling(); |
---|
884 | |
---|
885 | //----- Send Name |
---|
886 | SendPhysVolName() ; |
---|
887 | |
---|
888 | //----- Send Ndiv |
---|
889 | // SendNdiv(); |
---|
890 | |
---|
891 | //----- Send a primitive |
---|
892 | G4VSceneHandler::AddSolid( solid ) ; |
---|
893 | |
---|
894 | } //G4FRSCENEHANDLER::AddSolid ( const G4VSolid& ) |
---|
895 | |
---|
896 | |
---|
897 | //----- |
---|
898 | G4bool |
---|
899 | G4FRSCENEHANDLER::SendVisAttributes ( const G4VisAttributes* pAV ) |
---|
900 | { |
---|
901 | |
---|
902 | // Have a look at G4VSceneHandler::GetDrawingStyle (const G4Visible&). (John) |
---|
903 | |
---|
904 | G4bool status = true ; // initialization |
---|
905 | const G4double ALPHA_MIN = 0.001 ; // min of alpha factor of color |
---|
906 | |
---|
907 | if( pAV == NULL ) { |
---|
908 | // No attribute is given. |
---|
909 | // Do nothing. Status is "fail". |
---|
910 | status = false ; |
---|
911 | |
---|
912 | } else { |
---|
913 | // Send attributes. Status is "success". |
---|
914 | status = true ; |
---|
915 | SendStrDouble3( FR_COLOR_RGB, |
---|
916 | pAV->GetColor().GetRed (), |
---|
917 | pAV->GetColor().GetGreen(), |
---|
918 | pAV->GetColor().GetBlue () ); |
---|
919 | if ( pAV->GetColor().GetAlpha() < ALPHA_MIN ) { |
---|
920 | SendStr( FR_FORCE_WIREFRAME_ON ) ; |
---|
921 | } |
---|
922 | else if ( pAV->IsForceDrawingStyle () && |
---|
923 | (pAV->GetForcedDrawingStyle () == G4VisAttributes::wireframe)) { |
---|
924 | SendStr( FR_FORCE_WIREFRAME_ON ) ; |
---|
925 | } else { |
---|
926 | SendStr( FR_FORCE_WIREFRAME_OFF ) ; |
---|
927 | } |
---|
928 | } |
---|
929 | |
---|
930 | return status ; |
---|
931 | |
---|
932 | } // G4FRSCENEHANDLER::SendVisAttributes () |
---|
933 | |
---|
934 | |
---|
935 | //----- |
---|
936 | G4bool G4FRSCENEHANDLER::IsVisible() |
---|
937 | { |
---|
938 | //----- |
---|
939 | G4bool visibility = true ; |
---|
940 | |
---|
941 | //----- |
---|
942 | const G4VisAttributes* pVisAttribs = |
---|
943 | fpViewer->GetApplicableVisAttributes( fpVisAttribs ); |
---|
944 | |
---|
945 | //----- |
---|
946 | if( ( getenv( FR_ENV_CULL_INVISIBLE_OBJECTS ) != NULL ) && \ |
---|
947 | ( strcmp( getenv( FR_ENV_CULL_INVISIBLE_OBJECTS ),"0" ) ) && \ |
---|
948 | ( pVisAttribs ) ) |
---|
949 | { |
---|
950 | visibility = pVisAttribs->IsVisible(); |
---|
951 | } |
---|
952 | |
---|
953 | //----- |
---|
954 | return visibility ; |
---|
955 | |
---|
956 | } // G4FRSCENEHANDLER::IsVisible() |
---|
957 | |
---|
958 | |
---|
959 | //----- |
---|
960 | void G4FRSCENEHANDLER::SendBoundingBox( void ) |
---|
961 | { |
---|
962 | #if defined DEBUG_FR_SCENE |
---|
963 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
964 | G4cout << "***** SendBoundingBox () (/BoundingBox)" << G4endl; |
---|
965 | #endif |
---|
966 | |
---|
967 | //----- (1A) CALC bounding box of the bounding sphere |
---|
968 | const G4VisExtent& extent = GetScene()->GetExtent(); |
---|
969 | const G4Point3D& center = extent.GetExtentCenter(); |
---|
970 | const G4double radius = extent.GetExtentRadius(); |
---|
971 | |
---|
972 | G4double xmin = center.x() - radius ; |
---|
973 | G4double ymin = center.y() - radius ; |
---|
974 | G4double zmin = center.z() - radius ; |
---|
975 | |
---|
976 | G4double xmax = center.x() + radius ; |
---|
977 | G4double ymax = center.y() + radius ; |
---|
978 | G4double zmax = center.z() + radius ; |
---|
979 | |
---|
980 | //////////////////////////////////////////// |
---|
981 | // G4double xmin = extent.GetXmin (); |
---|
982 | // G4double ymin = extent.GetYmin (); |
---|
983 | // G4double zmin = extent.GetZmin (); |
---|
984 | // G4double xmax = extent.GetXmax (); |
---|
985 | // G4double ymax = extent.GetYmax (); |
---|
986 | // G4double zmax = extent.GetZmax (); |
---|
987 | //////////////////////////////////////////// |
---|
988 | |
---|
989 | //----- (1B) SEND bounding box |
---|
990 | SendStrDouble6( FR_BOUNDING_BOX, |
---|
991 | xmin, ymin, zmin, |
---|
992 | xmax, ymax, zmax ); |
---|
993 | |
---|
994 | } // G4FRSCENEHANDLER::SendBoundingBox() |
---|
995 | |
---|
996 | |
---|
997 | //----- |
---|
998 | void |
---|
999 | G4FRSCENEHANDLER::SendTransformedCoordinates() |
---|
1000 | { |
---|
1001 | //----- coord info |
---|
1002 | G4Point3D zero ( 0.0 , 0.0 , 0.0 ); |
---|
1003 | G4Point3D x1 ( 1.0 , 0.0 , 0.0 ); |
---|
1004 | G4Point3D y1 ( 0.0 , 1.0 , 0.0 ); |
---|
1005 | G4Vector3D x_unit_vec( 1.0 , 0.0 , 0.0 ); |
---|
1006 | G4Vector3D y_unit_vec( 0.0 , 1.0 , 0.0 ); |
---|
1007 | |
---|
1008 | //----- transformed origin |
---|
1009 | zero.transform( *fpObjectTransformation ); |
---|
1010 | |
---|
1011 | //----- transformed base vectors |
---|
1012 | x1.transform( *fpObjectTransformation ); |
---|
1013 | x_unit_vec = x1 - zero ; |
---|
1014 | y1.transform( *fpObjectTransformation ); |
---|
1015 | y_unit_vec = y1 - zero ; |
---|
1016 | |
---|
1017 | //----- send transformed origin |
---|
1018 | SendStrDouble3( FR_ORIGIN , (zero.x()), (zero.y()), (zero.z()) ) ; |
---|
1019 | |
---|
1020 | //----- send transformed base vectors |
---|
1021 | SendStrDouble6( FR_BASE_VECTOR , \ |
---|
1022 | (x_unit_vec.x()), (x_unit_vec.y()), (x_unit_vec.z()) , \ |
---|
1023 | (y_unit_vec.x()), (y_unit_vec.y()), (y_unit_vec.z()) ) ; |
---|
1024 | |
---|
1025 | } // G4FRSCENEHANDLER::SendTransformedCoordinates() |
---|
1026 | |
---|
1027 | |
---|
1028 | //----- |
---|
1029 | void G4FRSCENEHANDLER::SendPhysVolName ( void ) |
---|
1030 | { |
---|
1031 | // Local |
---|
1032 | G4int i ; |
---|
1033 | |
---|
1034 | // Current Model |
---|
1035 | const G4VModel* pv_model = GetModel(); |
---|
1036 | if (!pv_model) { return ; } |
---|
1037 | |
---|
1038 | G4PhysicalVolumeModel* pPVModel = |
---|
1039 | dynamic_cast<G4PhysicalVolumeModel*>(fpModel); |
---|
1040 | if (!pPVModel) { return ; } |
---|
1041 | |
---|
1042 | // Current Physical volume name |
---|
1043 | G4String pv_name = pPVModel->GetCurrentTag() ; |
---|
1044 | |
---|
1045 | // Current depth of volume |
---|
1046 | G4int cur_depth = pPVModel->GetCurrentDepth() ; |
---|
1047 | |
---|
1048 | // Make a string to be sent |
---|
1049 | // e.g. experimental_Hall.1, where "1" is the copy number |
---|
1050 | G4String name_comment ( FR_PHYSICAL_VOLUME_NAME ); |
---|
1051 | name_comment += " " ; |
---|
1052 | |
---|
1053 | for ( i = 0 ; i < cur_depth; i++) { |
---|
1054 | // Make tree |
---|
1055 | name_comment += " " ; |
---|
1056 | } |
---|
1057 | name_comment += pv_name ; |
---|
1058 | |
---|
1059 | // Send physical volume name |
---|
1060 | SendStr ( "#--------------------" ); |
---|
1061 | SendStr ( name_comment ); |
---|
1062 | |
---|
1063 | } // G4FRSCENEHANDLER::SendPhysVolName () |
---|
1064 | |
---|
1065 | |
---|
1066 | //----- |
---|
1067 | void G4FRSCENEHANDLER::SendStr( const char* char_string ) |
---|
1068 | { |
---|
1069 | fPrimDest.SendLine( char_string ); |
---|
1070 | } |
---|
1071 | |
---|
1072 | |
---|
1073 | //----- |
---|
1074 | void G4FRSCENEHANDLER::SendStrInt( const char* char_string , |
---|
1075 | G4int ival ) |
---|
1076 | { |
---|
1077 | //----- make command char_string and send |
---|
1078 | G4int num_char ; |
---|
1079 | char* command = new char [ COMMAND_BUF_SIZE ]; |
---|
1080 | |
---|
1081 | num_char = sprintf( command, "%s %d", char_string , ival ) ; |
---|
1082 | if( num_char < 0 ) { |
---|
1083 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
1084 | G4cout << "ERROR G4FRSCENEHANDLER::SendStrInt(), 1\n" ; |
---|
1085 | } |
---|
1086 | SendStr( command ); |
---|
1087 | delete [] command ; |
---|
1088 | } // G4FRSCENEHANDLER::SendStrInt() |
---|
1089 | |
---|
1090 | |
---|
1091 | //----- |
---|
1092 | void |
---|
1093 | G4FRSCENEHANDLER::SendStrInt3( const char* char_string , |
---|
1094 | G4int ival1 , |
---|
1095 | G4int ival2 , |
---|
1096 | G4int ival3 ) |
---|
1097 | { |
---|
1098 | //----- make command char_string and send |
---|
1099 | G4int num_char ; |
---|
1100 | char* command = new char [ COMMAND_BUF_SIZE ]; |
---|
1101 | |
---|
1102 | num_char = \ |
---|
1103 | sprintf( command, "%s %d %d %d", char_string , ival1, ival2, ival3 ) ; |
---|
1104 | |
---|
1105 | if( num_char < 0 ) { |
---|
1106 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
1107 | G4cout << "ERROR G4FRSCENEHANDLER::SendStrInt3(), 1\n" ; |
---|
1108 | } |
---|
1109 | SendStr( command ); |
---|
1110 | delete [] command ; |
---|
1111 | |
---|
1112 | } // G4FRSCENEHANDLER::SendStrInt3() |
---|
1113 | |
---|
1114 | |
---|
1115 | //----- |
---|
1116 | void |
---|
1117 | G4FRSCENEHANDLER::SendStrInt4( const char* char_string , |
---|
1118 | G4int ival1 , |
---|
1119 | G4int ival2 , |
---|
1120 | G4int ival3 , |
---|
1121 | G4int ival4 ) |
---|
1122 | { |
---|
1123 | //----- make command char_string and send |
---|
1124 | G4int num_char ; |
---|
1125 | char* command = new char [ COMMAND_BUF_SIZE ]; |
---|
1126 | |
---|
1127 | num_char = \ |
---|
1128 | sprintf( command, "%s %d %d %d %d", char_string , ival1, ival2, ival3, ival4 ) ; |
---|
1129 | |
---|
1130 | if( num_char < 0 ) { |
---|
1131 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
1132 | G4cout << "ERROR G4FRSCENEHANDLER::SendStrInt4(), 1\n" ; |
---|
1133 | } |
---|
1134 | SendStr( command ); |
---|
1135 | delete [] command ; |
---|
1136 | |
---|
1137 | } // G4FRSCENEHANDLER::SendStrInt4() |
---|
1138 | |
---|
1139 | //----- |
---|
1140 | void G4FRSCENEHANDLER::SendStrDouble( const char* char_string , |
---|
1141 | G4double dval ) |
---|
1142 | { |
---|
1143 | //----- make command char_string and send |
---|
1144 | G4int num_char ; |
---|
1145 | char* command = new char [ COMMAND_BUF_SIZE ]; |
---|
1146 | |
---|
1147 | num_char = sprintf( command, "%s %*.*g", \ |
---|
1148 | char_string , \ |
---|
1149 | fPrec2, fPrec, dval ) ; |
---|
1150 | if( num_char < 0 ) { |
---|
1151 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
1152 | G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble(), 1\n" ; |
---|
1153 | } |
---|
1154 | SendStr( command ); |
---|
1155 | delete [] command ; |
---|
1156 | |
---|
1157 | } // G4FRSCENEHANDLER::SendStrDouble() |
---|
1158 | |
---|
1159 | |
---|
1160 | //----- |
---|
1161 | void |
---|
1162 | G4FRSCENEHANDLER::SendStrDouble2( const char* char_string , |
---|
1163 | G4double dval1 , |
---|
1164 | G4double dval2 ) |
---|
1165 | { |
---|
1166 | //----- make command char_string and send |
---|
1167 | G4int num_char ; |
---|
1168 | char* command = new char [ COMMAND_BUF_SIZE ]; |
---|
1169 | |
---|
1170 | num_char = sprintf( command, "%s %*.*g %*.*g", char_string , \ |
---|
1171 | fPrec2, fPrec, dval1, \ |
---|
1172 | fPrec2, fPrec, dval2 ) ; |
---|
1173 | if( num_char < 0 ) { |
---|
1174 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
1175 | G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble2(), 1\n" ; |
---|
1176 | } |
---|
1177 | SendStr( command ); |
---|
1178 | delete [] command ; |
---|
1179 | |
---|
1180 | } // G4FRSCENEHANDLER::SendStrDouble2() |
---|
1181 | |
---|
1182 | |
---|
1183 | //----- |
---|
1184 | void |
---|
1185 | G4FRSCENEHANDLER::SendStrDouble3( const char* char_string , |
---|
1186 | G4double dval1 , |
---|
1187 | G4double dval2 , |
---|
1188 | G4double dval3 ) |
---|
1189 | { |
---|
1190 | //----- make command char_string and send |
---|
1191 | G4int num_char ; |
---|
1192 | char* command = new char [ COMMAND_BUF_SIZE ]; |
---|
1193 | |
---|
1194 | num_char = sprintf( command, "%s %*.*g %*.*g %*.*g", \ |
---|
1195 | char_string , \ |
---|
1196 | fPrec2, fPrec, dval1, \ |
---|
1197 | fPrec2, fPrec, dval2, \ |
---|
1198 | fPrec2, fPrec, dval3 ) ; |
---|
1199 | if( num_char < 0 ) { |
---|
1200 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
1201 | G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble3(), 1\n" ; |
---|
1202 | } |
---|
1203 | SendStr( command ); |
---|
1204 | delete [] command ; |
---|
1205 | |
---|
1206 | } // G4FRSCENEHANDLER::SendStrDouble3() |
---|
1207 | |
---|
1208 | |
---|
1209 | //----- |
---|
1210 | void |
---|
1211 | G4FRSCENEHANDLER::SendStrDouble4( const char* char_string , |
---|
1212 | G4double dval1 , |
---|
1213 | G4double dval2 , |
---|
1214 | G4double dval3 , |
---|
1215 | G4double dval4 ) |
---|
1216 | { |
---|
1217 | //----- make command char_string and send |
---|
1218 | G4int num_char ; |
---|
1219 | char* command = new char [ COMMAND_BUF_SIZE ]; |
---|
1220 | |
---|
1221 | num_char = sprintf( command, "%s %*.*g %*.*g %*.*g %*.*g", \ |
---|
1222 | char_string , \ |
---|
1223 | fPrec2, fPrec, dval1, \ |
---|
1224 | fPrec2, fPrec, dval2, \ |
---|
1225 | fPrec2, fPrec, dval3, \ |
---|
1226 | fPrec2, fPrec, dval4) ; |
---|
1227 | if( num_char < 0 ) { |
---|
1228 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
1229 | G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble4(), 1\n" ; |
---|
1230 | } |
---|
1231 | SendStr( command ); |
---|
1232 | delete [] command ; |
---|
1233 | |
---|
1234 | } // G4FRSCENEHANDLER::SendStrDouble4() |
---|
1235 | |
---|
1236 | |
---|
1237 | //----- |
---|
1238 | void |
---|
1239 | G4FRSCENEHANDLER::SendStrDouble5( const char* char_string , |
---|
1240 | G4double dval1 , |
---|
1241 | G4double dval2 , |
---|
1242 | G4double dval3 , |
---|
1243 | G4double dval4 , |
---|
1244 | G4double dval5 ) |
---|
1245 | { |
---|
1246 | //----- make command char_string and send |
---|
1247 | G4int num_char ; |
---|
1248 | char* command = new char [ COMMAND_BUF_SIZE ]; |
---|
1249 | |
---|
1250 | num_char = sprintf( command, "%s %*.*g %*.*g %*.*g %*.*g %*.*g", \ |
---|
1251 | char_string , \ |
---|
1252 | fPrec2, fPrec, dval1, \ |
---|
1253 | fPrec2, fPrec, dval2, \ |
---|
1254 | fPrec2, fPrec, dval3, \ |
---|
1255 | fPrec2, fPrec, dval4, \ |
---|
1256 | fPrec2, fPrec, dval5 ) ; |
---|
1257 | if( num_char < 0 ) { |
---|
1258 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
1259 | G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble5(), 1\n" ; |
---|
1260 | } |
---|
1261 | SendStr( command ); |
---|
1262 | delete [] command ; |
---|
1263 | |
---|
1264 | } // G4FRSCENEHANDLER::SendStrDouble5() |
---|
1265 | |
---|
1266 | |
---|
1267 | //----- |
---|
1268 | void |
---|
1269 | G4FRSCENEHANDLER::SendStrDouble6( const char* char_string , |
---|
1270 | G4double dval1 , |
---|
1271 | G4double dval2 , |
---|
1272 | G4double dval3 , |
---|
1273 | G4double dval4 , |
---|
1274 | G4double dval5 , |
---|
1275 | G4double dval6 ) |
---|
1276 | { |
---|
1277 | //----- make command char_string and send |
---|
1278 | G4int num_char ; |
---|
1279 | char* command = new char [ COMMAND_BUF_SIZE ]; |
---|
1280 | |
---|
1281 | num_char = sprintf( command, "%s %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g", \ |
---|
1282 | char_string , \ |
---|
1283 | fPrec2, fPrec, dval1, \ |
---|
1284 | fPrec2, fPrec, dval2, \ |
---|
1285 | fPrec2, fPrec, dval3, \ |
---|
1286 | fPrec2, fPrec, dval4, \ |
---|
1287 | fPrec2, fPrec, dval5, \ |
---|
1288 | fPrec2, fPrec, dval6 ) ; |
---|
1289 | if( num_char < 0 ) { |
---|
1290 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
1291 | G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble6(), 1\n" ; |
---|
1292 | } |
---|
1293 | SendStr( command ); |
---|
1294 | delete [] command ; |
---|
1295 | |
---|
1296 | } // G4FRSCENEHANDLER::SendStrDouble6() |
---|
1297 | |
---|
1298 | |
---|
1299 | //----- |
---|
1300 | void |
---|
1301 | G4FRSCENEHANDLER::SendStrDouble7( const char* char_string , |
---|
1302 | G4double dval1 , |
---|
1303 | G4double dval2 , |
---|
1304 | G4double dval3 , |
---|
1305 | G4double dval4 , |
---|
1306 | G4double dval5 , |
---|
1307 | G4double dval6 , |
---|
1308 | G4double dval7 ) |
---|
1309 | { |
---|
1310 | //----- make command char_string and send |
---|
1311 | G4int num_char ; |
---|
1312 | char* command = new char [ COMMAND_BUF_SIZE ]; |
---|
1313 | |
---|
1314 | num_char = sprintf( command, "%s %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g", \ |
---|
1315 | char_string , \ |
---|
1316 | fPrec2, fPrec, dval1,\ |
---|
1317 | fPrec2, fPrec, dval2,\ |
---|
1318 | fPrec2, fPrec, dval3,\ |
---|
1319 | fPrec2, fPrec, dval4,\ |
---|
1320 | fPrec2, fPrec, dval5,\ |
---|
1321 | fPrec2, fPrec, dval6,\ |
---|
1322 | fPrec2, fPrec, dval7 ) ; |
---|
1323 | if( num_char < 0 ) { |
---|
1324 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
1325 | G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble7(), 1\n" ; |
---|
1326 | } |
---|
1327 | SendStr( command ); |
---|
1328 | delete [] command ; |
---|
1329 | |
---|
1330 | } // G4FRSCENEHANDLER::SendStrDouble7() |
---|
1331 | |
---|
1332 | |
---|
1333 | //----- |
---|
1334 | void |
---|
1335 | G4FRSCENEHANDLER::SendStrDouble11( const char* char_string , |
---|
1336 | G4double dval1 , |
---|
1337 | G4double dval2 , |
---|
1338 | G4double dval3 , |
---|
1339 | G4double dval4 , |
---|
1340 | G4double dval5 , |
---|
1341 | G4double dval6 , |
---|
1342 | G4double dval7 , |
---|
1343 | G4double dval8 , |
---|
1344 | G4double dval9 , |
---|
1345 | G4double dval10 , |
---|
1346 | G4double dval11 ) |
---|
1347 | { |
---|
1348 | //----- make command char_string and send |
---|
1349 | G4int num_char ; |
---|
1350 | char* command = new char [ COMMAND_BUF_SIZE ]; |
---|
1351 | |
---|
1352 | num_char = sprintf( command, "%s %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g", \ |
---|
1353 | char_string ,\ |
---|
1354 | fPrec2, fPrec, dval1, \ |
---|
1355 | fPrec2, fPrec, dval2, \ |
---|
1356 | fPrec2, fPrec, dval3, \ |
---|
1357 | fPrec2, fPrec, dval4, \ |
---|
1358 | fPrec2, fPrec, dval5, \ |
---|
1359 | fPrec2, fPrec, dval6, \ |
---|
1360 | fPrec2, fPrec, dval7, \ |
---|
1361 | fPrec2, fPrec, dval8, \ |
---|
1362 | fPrec2, fPrec, dval9, \ |
---|
1363 | fPrec2, fPrec, dval10,\ |
---|
1364 | fPrec2, fPrec, dval11 ) ; |
---|
1365 | if( num_char < 0 ) { |
---|
1366 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
1367 | G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble11(), 1\n" ; |
---|
1368 | } |
---|
1369 | SendStr( command ); |
---|
1370 | delete [] command ; |
---|
1371 | |
---|
1372 | } // G4FRSCENEHANDLER::SendStrDouble11() |
---|
1373 | |
---|
1374 | |
---|
1375 | //----- |
---|
1376 | void |
---|
1377 | G4FRSCENEHANDLER::SendIntDouble3( G4int ival , |
---|
1378 | G4double dval1 , |
---|
1379 | G4double dval2 , |
---|
1380 | G4double dval3 ) |
---|
1381 | { |
---|
1382 | //----- make command char_string and send |
---|
1383 | G4int num_char ; |
---|
1384 | char* command = new char [ COMMAND_BUF_SIZE ]; |
---|
1385 | |
---|
1386 | num_char = sprintf( command, "%d %*.*g %*.*g %*.*g", \ |
---|
1387 | ival , \ |
---|
1388 | fPrec2, fPrec, dval1, \ |
---|
1389 | fPrec2, fPrec, dval2, \ |
---|
1390 | fPrec2, fPrec, dval3 ) ; |
---|
1391 | if( num_char < 0 ) { |
---|
1392 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
1393 | G4cout << "ERROR G4FRSCENEHANDLER::SendIntDouble3(),1\n" ; |
---|
1394 | } |
---|
1395 | SendStr( command ); |
---|
1396 | delete [] command ; |
---|
1397 | } |
---|
1398 | |
---|
1399 | //----- |
---|
1400 | void |
---|
1401 | G4FRSCENEHANDLER::SendInt3Str( G4int ival1 , |
---|
1402 | G4int ival2 , |
---|
1403 | G4int ival3 , |
---|
1404 | const char* char_string ) |
---|
1405 | { |
---|
1406 | //----- make command char_string and send |
---|
1407 | G4int num_char ; |
---|
1408 | char* command = new char [ COMMAND_BUF_SIZE ]; |
---|
1409 | |
---|
1410 | num_char = sprintf( command, "%d %d %d %s", \ |
---|
1411 | ival1, ival2, ival3, char_string ) ; |
---|
1412 | if( num_char < 0 ) { |
---|
1413 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
1414 | G4cout << "ERROR G4FRSCENEHANDLER::SendInt3Str(),1\n" ; |
---|
1415 | } |
---|
1416 | SendStr( command ); |
---|
1417 | delete [] command ; |
---|
1418 | } |
---|
1419 | |
---|
1420 | //----- |
---|
1421 | void |
---|
1422 | G4FRSCENEHANDLER::SendInt4Str( G4int ival1 , |
---|
1423 | G4int ival2 , |
---|
1424 | G4int ival3 , |
---|
1425 | G4int ival4 , |
---|
1426 | const char* char_string ) |
---|
1427 | { |
---|
1428 | //----- make command char_string and send |
---|
1429 | G4int num_char ; |
---|
1430 | char* command = new char [ COMMAND_BUF_SIZE ]; |
---|
1431 | |
---|
1432 | num_char = sprintf( command, "%d %d %d %d %s", \ |
---|
1433 | ival1, ival2, ival3, ival4, char_string ) ; |
---|
1434 | if( num_char < 0 ) { |
---|
1435 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
1436 | G4cout << "ERROR G4FRSCENEHANDLER::SendInt4Str(),1\n" ; |
---|
1437 | } |
---|
1438 | SendStr( command ); |
---|
1439 | delete [] command ; |
---|
1440 | } |
---|
1441 | |
---|
1442 | //----- |
---|
1443 | void |
---|
1444 | G4FRSCENEHANDLER::SendStrDouble6Str( const char* char_string1 , |
---|
1445 | G4double dval1 , |
---|
1446 | G4double dval2 , |
---|
1447 | G4double dval3 , |
---|
1448 | G4double dval4 , |
---|
1449 | G4double dval5 , |
---|
1450 | G4double dval6 , |
---|
1451 | const char* char_string2 ) |
---|
1452 | { |
---|
1453 | //----- make command char_string and send |
---|
1454 | G4int num_char ; |
---|
1455 | char* command = new char [ COMMAND_BUF_SIZE ]; |
---|
1456 | |
---|
1457 | num_char = sprintf( command, "%s %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %s", \ |
---|
1458 | char_string1,\ |
---|
1459 | fPrec2, fPrec, dval1 , \ |
---|
1460 | fPrec2, fPrec, dval2 , \ |
---|
1461 | fPrec2, fPrec, dval3 , \ |
---|
1462 | fPrec2, fPrec, dval4 , \ |
---|
1463 | fPrec2, fPrec, dval5 , \ |
---|
1464 | fPrec2, fPrec, dval6, \ |
---|
1465 | char_string2 ); |
---|
1466 | if( num_char < 0 ) { |
---|
1467 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
1468 | G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble6Str(), 1\n" ; |
---|
1469 | } |
---|
1470 | SendStr( command ); |
---|
1471 | delete [] command ; |
---|
1472 | |
---|
1473 | } |
---|
1474 | |
---|
1475 | |
---|
1476 | //----- |
---|
1477 | void G4FRSCENEHANDLER::SendInt( G4int val ) |
---|
1478 | { |
---|
1479 | //----- make command char_string and send |
---|
1480 | G4int num_char ; |
---|
1481 | char* command = new char [ COMMAND_BUF_SIZE ]; |
---|
1482 | |
---|
1483 | num_char = sprintf( command, "%d", val ) ; |
---|
1484 | if( num_char < 0 ) { |
---|
1485 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
1486 | G4cout << "ERROR G4FRSCENEHANDLER::SendStrInt(), 1\n" ; |
---|
1487 | } |
---|
1488 | SendStr( command ); |
---|
1489 | delete [] command ; |
---|
1490 | } // G4FRSCENEHANDLER::SendStrInt() |
---|
1491 | |
---|
1492 | |
---|
1493 | //----- |
---|
1494 | void G4FRSCENEHANDLER::SendDouble( G4double val ) |
---|
1495 | { |
---|
1496 | //----- make command char_string and send |
---|
1497 | G4int num_char ; |
---|
1498 | char* command = new char [ COMMAND_BUF_SIZE ]; |
---|
1499 | |
---|
1500 | num_char = sprintf( command, "%*.*g", fPrec2, fPrec, val ) ; |
---|
1501 | if( num_char < 0 ) { |
---|
1502 | if (G4VisManager::GetVerbosity() >= G4VisManager::errors) |
---|
1503 | G4cout << "ERROR G4FRSCENEHANDLER::SendStrInt(), 1\n" ; |
---|
1504 | } |
---|
1505 | SendStr( command ); |
---|
1506 | delete [] command ; |
---|
1507 | } // G4FRSCENEHANDLER::SendStrInt() |
---|
1508 | |
---|
1509 | //----- |
---|
1510 | void G4FRSCENEHANDLER::ClearTransientStore() |
---|
1511 | { |
---|
1512 | G4VSceneHandler::ClearTransientStore (); |
---|
1513 | // This is typically called after an update and before drawing hits |
---|
1514 | // of the next event. To simulate the clearing of "transients" |
---|
1515 | // (hits, etc.) the detector is redrawn... |
---|
1516 | if (fpViewer) { |
---|
1517 | fpViewer -> SetView (); |
---|
1518 | fpViewer -> ClearView (); |
---|
1519 | fpViewer -> DrawView (); |
---|
1520 | } |
---|
1521 | } |
---|
1522 | |
---|