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