G4FRSceneFunc.icc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 
00030 #include <CLHEP/Units/PhysicalConstants.h>
00031 
00032 #include "G4VisManager.hh"
00033 #include "G4PhysicalVolumeModel.hh"
00034 #include "G4LogicalVolume.hh"
00035 
00036 //========== AddPrimitive() functions ==========//
00037 
00038 //----- Add polyline 
00039 void G4FRSCENEHANDLER::AddPrimitive (const G4Polyline& polyline) 
00040 {
00041 #if defined DEBUG_FR_SCENE
00042   if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00043       G4cout << "***** AddPrimitive\n";
00044 #endif 
00045      if (fProcessing2D) {
00046           static G4bool warned = false;
00047           if (!warned) {
00048                warned = true;
00049                G4Exception
00050                ("G4FRSCENEHANDLER::AddPrimitive (const G4Polyline&)",
00051                 "dawn0001", JustWarning,
00052                 "2D polylines not implemented.  Ignored.");
00053           }
00054           return;
00055      }
00056                 //----- Initialize Fukui Renderer IF NECESSARY
00057      FRBeginModeling();
00058 
00059           //----- local working variables
00060      G4int            nPoints = polyline.size ();
00061      G4int            i ;  
00062      const            G4VisAttributes*  pVA =
00063        fpViewer->GetApplicableVisAttributes ( polyline.GetVisAttributes() ); 
00064 
00065                 //----- skip drawing invisible primitive
00066      if( pVA ){
00067         if( !(pVA->IsVisible()) ) { return ; }
00068      }
00069 
00070                 //----- Attributes   
00071      if(!SendVisAttributes( pVA ) ) {
00072        SendStr( FR_COLOR_RGB_RED ); // color 
00073      }
00074 
00075         //----- send coordinates to Fukui Renderer
00076      SendTransformedCoordinates();
00077 
00078         //----- send beginning of polyline
00079      SendStr( FR_POLYLINE );
00080 
00081         //----- vertices on polyline
00082      for ( i = 0; i < nPoints; i++ ) {
00083           SendStrDouble3( FR_PL_VERTEX   , \
00084                           polyline[i].x(), \
00085                           polyline[i].y(), \
00086                           polyline[i].z()   );
00087      }
00088 
00089         //----- send ending of polyline
00090      SendStr( FR_END_POLYLINE );
00091 
00092 } // G4FRSCENEHANDLER::AddPrimitive (polyline)
00093 
00094 
00095 //----- Add nurbes
00096 void G4FRSCENEHANDLER::AddPrimitive (const G4NURBS&)
00097 {
00098                 //----- 
00099 #if defined DEBUG_FR_SCENE
00100   if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00101         G4cout << "***** AddPrimitive( G4NURBS )\n";
00102 #endif
00103 
00104                 //----- Initialize DAWN IF NECESSARY
00105         FRBeginModeling();
00106         
00108         // DAWN does not support NUBS visualizaition //
00110 }
00111 
00112 
00113 
00114 //----- Add text
00115 void G4FRSCENEHANDLER::AddPrimitive ( const G4Text& text )
00116 {
00117                 //----- 
00118 #if defined DEBUG_FR_SCENE
00119   if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00120         G4cout << "***** AddPrimitive( G4Text )\n";
00121 #endif
00122                 //----- Initialize DAWN IF NECESSARY
00123         FRBeginModeling();
00124 
00125                 //----- send color
00126         const G4Color&  color     = GetTextColor (text) ;
00127         SendStrDouble3( FR_COLOR_RGB    ,
00128                         color.GetRed  (), 
00129                         color.GetGreen(),
00130                         color.GetBlue () );
00131 
00132                 //----- send body coordinates
00133         SendTransformedCoordinates();
00134 
00135                 //----- Calc size 
00136         MarkerSizeType size_type;
00137         G4double        fontsize  = GetMarkerDiameter( text , size_type );
00138 
00139                 //----- Calc position
00140         const G4Point3D&        position       = text.GetPosition  () ;
00141 
00142                 //----- offset
00143         G4double x_offset = text.GetXOffset();
00144         G4double y_offset = text.GetYOffset();
00145 
00146                 //----- get string to be visualized and Calc its length
00147         const char* vis_text    = text.GetText();
00148         const int   STR_LENGTH  = strlen ( vis_text );
00149 
00150                 //----- create buffer and copy the string there
00151         int   MAX_STR_LENGTH   =  COMMAND_BUF_SIZE - 100 ;
00152         if  ( MAX_STR_LENGTH <= 0 ) { 
00153           if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
00154                 G4cout << "ERROR (FukuiRenderer) : Not enough buffer size for data transferring." << G4endl;
00155                 G4cout << "                        G4Text Visualization is aborted" << G4endl;
00156           }
00157           return ;
00158         }
00159         char*  buf  = new char [ (MAX_STR_LENGTH + 1) ] ; 
00160         if  ( MAX_STR_LENGTH >= STR_LENGTH  ) {
00161                 strcpy  ( buf, vis_text ) ; 
00162         } else {
00163                 strncpy ( buf, vis_text, MAX_STR_LENGTH ) ;
00164         }
00165 
00166                 //----- select string command for 3D drawing
00167         char  text_command[32];
00168         switch (size_type) {
00169         case world:
00170                 strcpy ( text_command, FR_MARK_TEXT_2D  );
00171                 break;
00172         case screen:
00173         default:
00174                 strcpy ( text_command, FR_MARK_TEXT_2DS );
00175                 break;
00176         }
00177 
00178                 //----- Send string command 
00179         if (fProcessing2D) {
00180                 // Map -1<x<1, -1<y<1 to 10<x<200, 53<y<243
00181                 G4double x_mm = 95. * position.x() + 105.;
00182                 G4double y_mm = 95. * position.y() + 148.;
00183                 SendStrDouble3Str(      FR_TEXT_2DS,
00184                                         x_mm, y_mm , 
00185                                         fontsize   , 
00186                                         buf         );
00187         } else {
00188                 SendStrDouble6Str(      text_command, \
00189                                         position.x() , position.y() , position.z(), 
00190                                         fontsize     , x_offset     , y_offset    , 
00191                                         buf                                    );
00192         }
00193 
00194                 //----- delete buffer
00195         delete [] buf ;
00196 
00197 } // G4FRSCENEHANDLER::AddPrimitive ( text )
00198 
00199 
00200 //----- Add circle
00201 void G4FRSCENEHANDLER::AddPrimitive ( const G4Circle& mark_circle )
00202 {
00203                 //----- 
00204 #if defined DEBUG_FR_SCENE
00205   if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00206         G4cout << "***** AddPrimitive( G4Circle )\n";
00207 #endif
00208      if (fProcessing2D) {
00209           static G4bool warned = false;
00210           if (!warned) {
00211                warned = true;
00212                G4Exception
00213                ("G4FRSCENEHANDLER::AddPrimitive (const G4Circle&)",
00214                 "dawn0002", JustWarning,
00215                 "2D circles not implemented.  Ignored.");
00216           }
00217           return;
00218      }
00219                 //----- Initialize Fukui Renderer IF NECESSARY
00220         FRBeginModeling();
00221 
00222                 //----- send color
00223         const G4Color&  color     = GetColor (mark_circle) ;
00224         SendStrDouble3( FR_COLOR_RGB    ,
00225                         color.GetRed  (), 
00226                         color.GetGreen(),
00227                         color.GetBlue () );
00228 
00229                 //----- send body coordinates
00230         SendTransformedCoordinates();
00231 
00232                 //----- Calc position
00233         const G4Point3D&        position       = mark_circle.GetPosition  () ;
00234 
00235                 //----- Calc size 
00236         MarkerSizeType size_type;
00237         G4double        size = GetMarkerRadius( mark_circle , size_type );
00238 
00239                 //----- send mark
00240         switch (size_type) {
00241         case world:
00242                 SendStrDouble4( FR_MARK_CIRCLE_2D, \
00243                                 position.x() , position.y() , position.z(), size );
00244                 break;
00245         default:
00246         case screen:
00247                 SendStrDouble4( FR_MARK_CIRCLE_2DS, \
00248                                 position.x() , position.y() , position.z(), size );
00249                 break;
00250         }
00251 
00252 } // G4FRSCENEHANDLER::AddPrimitive ( mark_circle )
00253 
00254 
00255 //----- Add square
00256 void G4FRSCENEHANDLER::AddPrimitive (const G4Square& mark_square )
00257 {
00258                 //----- 
00259 #if defined DEBUG_FR_SCENE
00260   if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00261         G4cout << "***** AddPrimitive( G4Square )\n";
00262 #endif
00263      if (fProcessing2D) {
00264           static G4bool warned = false;
00265           if (!warned) {
00266                warned = true;
00267                G4Exception
00268                ("G4FRSCENEHANDLER::AddPrimitive (const G4Square&)",
00269                 "dawn0003", JustWarning,
00270                 "2D squares not implemented.  Ignored.");
00271           }
00272           return;
00273      }
00274                 //----- Initialize Fukui Renderer IF NECESSARY
00275         FRBeginModeling();
00276 
00277                 //----- send color
00278         const G4Color&  color     = GetColor (mark_square) ;
00279         SendStrDouble3( FR_COLOR_RGB    ,
00280                         color.GetRed  (), 
00281                         color.GetGreen(),
00282                         color.GetBlue () );
00283 
00284                 //----- send body coordinates 
00285         SendTransformedCoordinates();
00286 
00287                 //----- Calc position
00288         const G4Point3D&  position = mark_square.GetPosition  () ;
00289 
00290                 //----- Calc size 
00291         MarkerSizeType size_type;
00292         G4double        size = GetMarkerRadius( mark_square , size_type );
00293 
00294                 //----- send mark
00295         switch (size_type) {
00296         case world:
00297                 SendStrDouble4( FR_MARK_SQUARE_2D, \
00298                                 position.x() , position.y() , position.z(), size );
00299                 break;
00300         default:
00301         case screen:
00302                 SendStrDouble4( FR_MARK_SQUARE_2DS, \
00303                                 position.x() , position.y() , position.z(), size );
00304                 break;
00305         }
00306 
00307 } // G4FRSCENEHANDLER::AddPrimitive ( mark_square )
00308 
00309 
00310 //----- Add polyhedron
00311 void G4FRSCENEHANDLER::AddPrimitive ( const G4Polyhedron& polyhedron ) 
00312 {
00313                 //----- 
00314 #if defined DEBUG_FR_SCENE
00315   if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00316         G4cout << "***** AddPrimitive( G4Polyhedron )\n";
00317 #endif
00318      if (fProcessing2D) {
00319           static G4bool warned = false;
00320           if (!warned) {
00321                warned = true;
00322                G4Exception
00323                ("G4FRSCENEHANDLER::AddPrimitive (const G4Polyhedron&)",
00324                 "dawn0004", JustWarning,
00325                 "2D polyhedrons not implemented.  Ignored.");
00326           }
00327           return;
00328      }
00329 
00330         if (polyhedron.GetNoFacets() == 0) return;
00331 
00332                 //----- Initialize Fukui Renderer IF NECESSARY
00333         FRBeginModeling();
00334 
00335                 //----- Attributes
00336         if(!SendVisAttributes( fpViewer->GetApplicableVisAttributes
00337                                (polyhedron.GetVisAttributes() ) ) ) {
00338                   SendStr( FR_COLOR_RGB_RED ); // color 
00339         }
00340 
00341                 //----- Coordinates
00342         SendTransformedCoordinates();
00343 
00344                 //----- Brep data 
00345 
00346                 //---------- (1) Declare beginning of Brep data
00347         SendStr(FR_POLYHEDRON);
00348 
00349                 //---------- (2) Vertex block
00350         for (G4int i = 1, j = polyhedron.GetNoVertices(); j; j--, i++){
00351                 G4Point3D point = polyhedron.GetVertex(i);
00352                 SendStrDouble3( FR_VERTEX, point.x (), point.y (), point.z ());
00353         }
00354         
00355                 //---------- (3) Facet block
00356         for (G4int f = polyhedron.GetNoFacets(); f; f--){
00357                 G4int notLastEdge;
00358                 G4int index = -1; // initialization
00359                 G4int edgeFlag = 1;
00360                 //G4int preedgeFlag = 1;  Not used - comment out to prevent warnings (JA).
00361                 G4int work[4], i = 0;
00362                 do {
00363                         //preedgeFlag = edgeFlag;  Not used - comment out to prevent warnings (JA).
00364                         notLastEdge = polyhedron.GetNextVertexIndex(index, edgeFlag);
00365                         work[i++] = index;
00366                 }while (notLastEdge);
00367                 switch (i){
00368                 case 3:
00369                         SendStrInt3(FR_FACET, work[0], work[1], work[2] );
00370                         break;
00371                 case 4:
00372                         SendStrInt4(FR_FACET, work[0], work[1], work[2], work[3] );
00373                         break;
00374                 default:
00375                   if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00376                         G4cout <<
00377                           "ERROR G4FRSCENEHANDLER::AddPrimitive(G4Polyhedron)\n";
00378                   G4PhysicalVolumeModel* pPVModel =
00379                     dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
00380                   if (pPVModel)
00381                     if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
00382                       G4cout <<
00383                         "Volume " << pPVModel->GetCurrentPV()->GetName() <<
00384                         ", Solid " << pPVModel->GetCurrentLV()->GetSolid()->GetName() <<
00385                         " (" << pPVModel->GetCurrentLV()->GetSolid()->GetEntityType();
00386                       G4cout <<
00387                         "\nG4Polyhedron facet with " << i << " edges" << G4endl;
00388                     }
00389                 }
00390         }
00391 
00392                 //---------- (4) Declare ending of Brep data
00393         SendStr(FR_END_POLYHEDRON);
00394 
00395 } // G4FRSCENEHANDLER::AddPrimitive (polyhedron) 
00396 
00397 
00398 //----- 
00399 void G4FRSCENEHANDLER::SendNdiv ( void )
00400 {
00402 //#if defined DEBUG_FR_SCENE
00403 //      G4cout << "***** SendNdiv() (/Ndiv)" << G4endl;
00404 //#endif
00406 
00407                 //----- local
00408         G4int   num_division = FR_DEFALUT_NDIV_VALUE ;
00409 
00410                 //-----  number used for dividing a curved surface, Ndiv
00411         // if ( GetModel() ) {  ?? Why test for model.  Can be zero.  JA ??
00412            const G4VisAttributes* pVisAttribs =
00413              fpViewer -> GetApplicableVisAttributes (fpVisAttribs);
00414            num_division = GetNoOfSides(pVisAttribs);
00415         // } else {
00416 #if defined DEBUG_FR_SCENE
00417            if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
00418              G4cout << "WARNING: GetNoOfSides() failed. " ;
00419              G4cout << "The default value " << num_division ;
00420              G4cout << " is assigned." << G4endl;
00421            }
00422 #endif
00423         //}
00424 
00425                 //---------- Error recovery for too small Ndiv
00426         num_division = ( num_division < 3 ? 3 : num_division ); 
00427 
00429 //#if defined DEBUG_FR_SCENE
00430 //      G4cout << "Ndiv = " << num_division << G4endl;
00431 //#endif
00433 
00434                 //----- Send resultant Ndiv
00435         this->SendStrInt( FR_NDIV, num_division );
00436 
00437 
00438 }
00439 
00440 //----- 
00441 void G4FRSCENEHANDLER::FREndModeling ()
00442 {
00443                 //-----                 
00444 #if defined DEBUG_FR_SCENE
00445   if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00446         G4cout << "***** FREndModeling (called)" << G4endl;
00447 #endif
00448         if( FRIsInModeling() ) {
00449 
00450 #if defined DEBUG_FR_SCENE
00451           if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
00452                 G4cout << "***** FREndModeling (started) " ; 
00453                 G4cout << "(/EndModeling, /DrawAll, /CloseDevice)" << G4endl;
00454           }
00455 #endif
00456 
00457                 SendStr( "#--------------------" );     
00458 
00459                         //----- !EndModeling
00460                 SendStr( FR_END_MODELING );
00461 
00462                         //----- !DrawAll
00463                 SendStr( FR_DRAW_ALL );
00464 
00465                         //----- !CloseDevice
00466                 SendStr( FR_CLOSE_DEVICE );
00467 
00468                         //----- End saving data to g4.prim
00469                 EndSavingG4Prim() ;
00470 
00471                         //------ Reset flag 
00472                 FRflag_in_modeling = false ;
00473         }
00474 }
00475 
00476 
00477 //----- 
00478 void G4FRSCENEHANDLER::BeginPrimitives (const G4Transform3D& objectTransformation)
00479 {
00480 #if defined DEBUG_FR_SCENE
00481   if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00482         G4cout << "***** BeginPrimitives \n";
00483 #endif
00484 
00485   FRBeginModeling();
00486 
00487   G4VSceneHandler::BeginPrimitives (objectTransformation);
00488 }
00489 
00490 
00491 //----- 
00492 void G4FRSCENEHANDLER::EndPrimitives ()
00493 {
00494 #if defined DEBUG_FR_SCENE
00495   if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00496         G4cout << "***** EndPrimitives \n";
00497 #endif
00498   G4VSceneHandler::EndPrimitives ();
00499 }
00500 
00501 
00502 //========== AddSolid() functions ==========//
00503 
00504 //----- Add box
00505 void G4FRSCENEHANDLER::AddSolid( const G4Box& box )
00506 {
00507 #if defined DEBUG_FR_SCENE
00508   if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00509         G4cout << "***** AddSolid ( box )\n";
00510 #endif
00511                 //----- skip drawing invisible primitive
00512         if( !IsVisible() ) { return ; }
00513 
00514                 //----- Initialize Fukui Renderer IF NECESSARY
00515         FRBeginModeling();
00516 
00517                 //----- Send Name 
00518         SendPhysVolName();
00519 
00520                 //----- Send Ndiv
00521         // SendNdiv();
00522 
00523                 //----- Attributes
00524         if(!SendVisAttributes
00525            ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
00526           SendStr( FR_COLOR_RGB_GREEN ); // color 
00527         }
00528 
00529                 //----- parameters (half lengths of box)
00530         G4double dx = box.GetXHalfLength ();
00531         G4double dy = box.GetYHalfLength ();
00532         G4double dz = box.GetZHalfLength ();     
00533   
00534                 //----- send coordinates to Fukui Renderer
00535         SendTransformedCoordinates();
00536 
00537                 //----- send box to Fukui Renderer
00538         SendStrDouble3( FR_BOX, dx, dy, dz );
00539 
00540 } // void G4FRSCENEHANDLER::AddSolid( const G4Box& box )
00541 
00542 
00543 //----- Add tubes
00544 void 
00545 G4FRSCENEHANDLER::AddSolid( const G4Tubs& tubes )
00546 {
00547 #if defined DEBUG_FR_SCENE
00548   if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00549         G4cout << "***** AddSolid ( tubes )\n";
00550 #endif
00551                 //----- skip drawing invisible primitive
00552         if( !IsVisible() ) { return ; }
00553 
00554                 //----- Initialize Fukui Renderer IF NECESSARY
00555         FRBeginModeling();
00556 
00557                 //----- Send Name 
00558         SendPhysVolName();
00559 
00560                 //----- Send Ndiv
00561         SendNdiv();
00562 
00563                 //----- Attributes
00564         if(!SendVisAttributes
00565            ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
00566           SendStr( FR_COLOR_RGB_BLUE ); // color 
00567         }
00568 
00569                 //----- parameters
00570         const G4double  R    = tubes.GetRMax() ;     // outside radius
00571         const G4double  r    = tubes.GetRMin() ;     // inside radius
00572         const G4double  dz   = tubes.GetDz  () ;     // half length in z
00573         const G4double  sphi = tubes.GetSPhi() ;     // starting angle
00574         const G4double  dphi = tubes.GetDPhi() ;     // angle width
00575 
00576                 //----- send coordinates to Fukui Renderer
00577         SendTransformedCoordinates();
00578 
00579                 //----- send tubes to Fukui Renderer
00580         SendStrDouble5( FR_TUBS, r, R, dz , sphi, dphi );
00581 
00582 } // void G4FRSCENEHANDLER::AddSolid( const G4Tubs& )
00583 
00584 
00585 
00586 //----- Add cons
00587 void 
00588 G4FRSCENEHANDLER::AddSolid( const G4Cons& cons )
00589 {
00590 #if defined DEBUG_FR_SCENE
00591   if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00592         G4cout << "***** AddSolid ( cons )\n";
00593 #endif
00594                 //----- skip drawing invisible primitive
00595         if( !IsVisible() ) { return ; }
00596 
00597                 //----- Initialize Fukui Renderer IF NECESSARY
00598         FRBeginModeling();
00599 
00600                 //----- Send Name 
00601         SendPhysVolName();
00602 
00603                 //----- Send Ndiv
00604         SendNdiv();
00605 
00606                 //----- Attributes
00607         if(!SendVisAttributes
00608            ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
00609           SendStr( FR_COLOR_RGB_CYAN ); // color 
00610         }
00611 
00612                 //----- parameters
00613         const G4double  r1    = cons.GetRmin1() ; // inside radius  at -dz
00614         const G4double  R1    = cons.GetRmax1() ; // outside radius at -dz
00615         const G4double  r2    = cons.GetRmin2() ; // inside radius  at +dz
00616         const G4double  R2    = cons.GetRmax2() ; // outside radius at +dz
00617         const G4double  dz    = cons.GetDz  ()  ; // half length in z
00618         const G4double  sphi  = cons.GetSPhi()  ; // starting angle
00619         const G4double  dphi  = cons.GetDPhi()  ; // angle width
00620 
00621                 //----- send coordinates to Fukui Renderer
00622         SendTransformedCoordinates();
00623 
00624                 //----- send cons to Fukui Renderer
00625         SendStrDouble7( FR_CONS, r1, R1, r2, R2, dz , sphi, dphi );
00626 
00627 }// G4FRSCENEHANDLER::AddSolid( cons )
00628 
00629 
00630 //----- Add trd
00631 void G4FRSCENEHANDLER::AddSolid ( const G4Trd& trd )
00632 {
00633 #if defined DEBUG_FR_SCENE
00634   if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00635         G4cout << "***** AddSolid ( trd )\n";
00636 #endif
00637 
00638                 //----- skip drawing invisible primitive
00639         if( !IsVisible() ) { return ; }
00640 
00641                 //----- Initialize Fukui Renderer IF NECESSARY
00642         FRBeginModeling();
00643 
00644                 //----- Send Name 
00645         SendPhysVolName();
00646 
00647                 //----- Send Ndiv
00648         // SendNdiv();
00649 
00650                 //----- Attributes
00651         if(!SendVisAttributes
00652            ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
00653           SendStr( FR_COLOR_RGB_MAGENTA ); // color 
00654         }
00655 
00656                 //----- parameters
00657         G4double dx1 = trd.GetXHalfLength1 ();
00658         G4double dx2 = trd.GetXHalfLength2 ();
00659         G4double dy1 = trd.GetYHalfLength1 ();
00660         G4double dy2 = trd.GetYHalfLength2 ();
00661         G4double dz  = trd.GetZHalfLength  ();
00662   
00663                 //----- send coordinates to Fukui Renderer
00664         SendTransformedCoordinates();
00665 
00666                 //----- send trd to Fukui Renderer
00667         SendStrDouble5( FR_TRD, dx1, dx2, dy1, dy2, dz );
00668 
00669 } // G4FRSCENEHANDLER::AddSolid ( trd )
00670 
00671 
00672 //----- Add sphere
00673 void G4FRSCENEHANDLER::AddSolid ( const G4Sphere& sphere )
00674 {
00675 #if defined DEBUG_FR_SCENE
00676   if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00677         G4cout << "***** AddSolid ( sphere )\n";
00678 #endif
00679                 //----- skip drawing invisible primitive
00680         if( !IsVisible() ) { return ; }
00681 
00682                 //----- Initialize Fukui Renderer IF NECESSARY
00683         FRBeginModeling();
00684 
00685                 //----- Send Name 
00686         SendPhysVolName();
00687 
00688                 //----- Send Ndiv
00689         SendNdiv();
00690 
00691                 //----- Attributes
00692         if(!SendVisAttributes
00693            ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
00694           SendStr( FR_COLOR_RGB_YELLOW ); // color 
00695         }
00696 
00697                 //----- parameters
00698 //      const G4double  rmin    = sphere.GetRmin();
00699         const G4double  rmax    = sphere.GetRmax();
00700 //      const G4double  sphi    = sphere.GetSPhi();
00701         const G4double  dphi    = sphere.GetDPhi();
00702 //      const G4double  stheta  = sphere.GetSTheta();
00703         const G4double  dtheta  = sphere.GetDTheta();
00704 
00705                 //----- send coordinates to Fukui Renderer
00706         SendTransformedCoordinates();
00707 
00708                 //----- send sphere to Fukui Renderer
00709         const G4double PI_minus  = 0.9999 * CLHEP::pi ;
00710         const G4double PI2_minus = 1.9999 * CLHEP::pi ;
00711         if( dphi > PI2_minus    &&   dtheta > PI_minus ) {
00712                         //----- full sphere
00713                 SendStrDouble ( FR_SPHERE, rmax );
00714         } else {
00715 
00716                         //----- call AddPrimitives( G4Polyhedron )
00717                         //...... For sphere "segment", 
00718                         //...... G4Polyhedron is used for visualization.
00719                         //...... Visualization attributes and 
00720                         //...... local coordinates are resent and overwritten.
00721                 G4VSceneHandler::AddSolid( sphere ) ; 
00722 
00724 //                      //----- sphere segment
00725 //              SendStrDouble6( FR_SPHERE_SEG, rmin, rmax, stheta, dtheta, sphi, dphi );
00727                 
00728         }
00729 
00730 } // G4FRSCENEHANDLER::AddSolid ( sphere )
00731 
00732 
00733 //----- Add para
00734 void G4FRSCENEHANDLER::AddSolid (const G4Para& para)
00735 {
00736 #if defined DEBUG_FR_SCENE
00737   if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00738         G4cout << "***** AddSolid ( para )\n";
00739 #endif
00740 
00741                 //----- skip drawing invisible primitive
00742         if( !IsVisible() ) { return ; }
00743 
00744                 //----- Initialize Fukui Renderer IF NECESSARY
00745         FRBeginModeling();
00746 
00747                 //----- Send Name 
00748         SendPhysVolName();
00749 
00750                 //----- Send Ndiv
00751         // SendNdiv();
00752 
00753                 //----- Attributes
00754         if(!SendVisAttributes
00755            ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
00756           SendStr( FR_COLOR_RGB_RED ); // color 
00757         }
00758 
00759                 //----- local
00760         const G4double epsilon = 1.0e-5 ;
00761 
00762                 //----- parameters preprocessing
00763         G4double cosTheta                  = para.GetSymAxis().z() ;
00764         if( cosTheta < epsilon ) {
00765           if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
00766                 G4cout << "WARNING from FukuiRenderer (DAWN) driver:" << G4endl;
00767                 G4cout << "  Invalid parameter for parallelepiped."   << G4endl;
00768                 G4cout << "  Drawing is skipped."                     << G4endl;
00769           }
00770           return ;
00771         }
00772         G4double tanTheta_cosPhi_cosTheta  = para.GetSymAxis().x() ;
00773         G4double tanTheta_sinPhi_cosTheta  = para.GetSymAxis().y() ;
00774 
00775                 //----- parameters 
00776         G4double dx              = para.GetXHalfLength ();
00777         G4double dy              = para.GetYHalfLength ();
00778         G4double dz              = para.GetZHalfLength ();     
00779         G4double tanAlpha        = para.GetTanAlpha();
00780         G4double tanTheta_cosPhi = tanTheta_cosPhi_cosTheta / cosTheta ;
00781         G4double tanTheta_sinPhi = tanTheta_sinPhi_cosTheta / cosTheta ; 
00782 
00783                 //----- send coordinates to Fukui Renderer
00784         SendTransformedCoordinates();
00785 
00786                 //----- send data to Fukui Renderer
00787         SendStrDouble6  ( FR_PARA, dx, dy, dz, tanAlpha, tanTheta_cosPhi, tanTheta_sinPhi );
00788 
00789 } // G4FRSCENEHANDLER::AddSolid ( para )
00790 
00791 
00792 //----- Add trap
00793 void G4FRSCENEHANDLER::AddSolid (const G4Trap& trap)
00794 {
00795 #if defined DEBUG_FR_SCENE
00796   if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00797         G4cout << "***** AddSolid ( trap )\n";
00798 #endif
00799 
00800                 //----- skip drawing invisible primitive
00801         if( !IsVisible() ) { return ; }
00802 
00803                 //----- Initialize Fukui Renderer IF NECESSARY
00804         FRBeginModeling();
00805 
00806                 //----- Send Name 
00807         SendPhysVolName();
00808 
00809                 //----- Send Ndiv
00810         // SendNdiv();
00811 
00812                 //----- Attributes
00813         if(!SendVisAttributes
00814            ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
00815                   SendStr( FR_COLOR_RGB_GREEN ); // color 
00816         }
00817 
00818                 //----- local
00819         const G4double epsilon = 1.0e-5     ;
00820 
00821                 //----- parameters preprocessing
00822         G4double cosTheta                  = trap.GetSymAxis().z() ;
00823         if( cosTheta < epsilon ) {
00824           if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
00825                 G4cout << "WARNING from FukuiRenderer (DAWN) driver:" << G4endl;
00826                 G4cout << "  Invalid parameter for trap, 1" << G4endl;
00827                 G4cout << "  Drawing is skipped."           << G4endl;
00828           }
00829           return ;
00830         }
00831 
00832         G4double  nx = trap.GetSymAxis().x() ;
00833         G4double  ny = trap.GetSymAxis().y() ;
00834 
00835                 //----- parameters (half lengths of box)
00836         G4double  dz      = trap.GetZHalfLength ();     
00837         G4double  theta   = std::acos( cosTheta )      ;
00838         G4double  phi;
00839         if ( ny==0. && nx ==0.) { 
00840           phi     = 0.;   // std::atan2(0.,0.) gives undefined value of phi 
00841         } else {
00842           phi = std::atan2( ny, nx ) ;  if( phi < 0. ) { phi += CLHEP::twopi ; } 
00843                                         // -PI < std::atan() < PI 
00844         }
00846 //      G4double  phi     = std::atan2( ny, nx ) ;  
00847 //      if( phi < 0.0 ) { phi += CLHEP::twopi ; } 
00848 //                              // -PI < std::atan() < PI 
00850 
00851         G4double  h1      = trap.GetYHalfLength1 ();     
00852         G4double  bl1     = trap.GetXHalfLength1 (); 
00853         G4double  tl1     = trap.GetXHalfLength2 (); 
00854         G4double  alpha1  = std::atan( trap.GetTanAlpha1()) ;
00855         G4double  h2      = trap.GetYHalfLength2 ();     
00856         G4double  bl2     = trap.GetXHalfLength3 (); 
00857         G4double  tl2     = trap.GetXHalfLength4 (); 
00858         G4double  alpha2  = std::atan( trap.GetTanAlpha2()) ;
00859 
00860                 //----- send coordinates to Fukui Renderer
00861         SendTransformedCoordinates();
00862 
00863                 //----- Change sign of alpha for compatibility 
00864                 //      with the DAWN format
00865         G4double  alpha_sign = -1.0 ;
00866         alpha1 *= alpha_sign ;          alpha2 *= alpha_sign ;
00867 
00868                 //----- send box to Fukui Renderer
00869         SendStrDouble11(        FR_TRAP ,
00870                                 dz      , 
00871                                 theta   ,
00872                                 phi     ,
00873                                 h1      ,
00874                                 bl1     ,
00875                                 tl1     ,
00876                                 alpha1  ,
00877                                 h2      ,
00878                                 bl2     ,
00879                                 tl2     ,
00880                                 alpha2   );
00881 
00882 } // G4FRSCENEHANDLER::AddSolid (const G4Trap& trap)
00883 
00884 
00885 //----- Add torus
00886 void 
00887 G4FRSCENEHANDLER::AddSolid( const G4Torus& torus )
00888 {
00889 #if defined DEBUG_FR_SCENE
00890   if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00891         G4cout << "***** AddSolid ( torus )\n";
00892 #endif
00893                 //----- skip drawing invisible primitive
00894         if( !IsVisible() ) { return ; }
00895 
00896                 //----- Initialize Fukui Renderer IF NECESSARY
00897         FRBeginModeling();
00898 
00899                 //----- Send Name 
00900         SendPhysVolName();
00901 
00902                 //----- Send Ndiv
00903         SendNdiv();
00904 
00905                 //----- Attributes
00906         if(!SendVisAttributes
00907            ( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
00908                   SendStr( FR_COLOR_RGB_BLUE ); // color 
00909         }
00910 
00911                 //----- parameters
00912         const G4double  r    = torus.GetRmin() ; 
00913         const G4double  R    = torus.GetRmax() ; 
00914         const G4double  t    = torus.GetRtor() ; 
00915         const G4double  sphi = torus.GetSPhi() ; 
00916         const G4double  dphi = torus.GetDPhi() ; 
00917 
00918                 //----- send coordinates to Fukui Renderer
00919         SendTransformedCoordinates();
00920 
00921                 //----- send torus to Fukui Renderer
00922         SendStrDouble5( FR_TORUS, r, R, t , sphi, dphi );
00923 
00924 } // void G4FRSCENEHANDLER::AddSolid( const G4Torus& )
00925 
00926 
00927 
00928 //----- Add a shape which is not treated above
00929 void G4FRSCENEHANDLER::AddSolid ( const G4VSolid& solid  )
00930 {
00931                 //----- skip drawing invisible primitive
00932         if( !IsVisible() ) { return ; }
00933 
00934                 //----- Initialize Fukui Renderer IF NECESSARY
00935         FRBeginModeling();
00936 
00937                 //----- Send Name 
00938         SendPhysVolName() ; 
00939 
00940                 //----- Send Ndiv
00941         // SendNdiv();
00942 
00943                 //----- Send a primitive
00944         G4VSceneHandler::AddSolid( solid ) ; 
00945 
00946 } //G4FRSCENEHANDLER::AddSolid ( const G4VSolid& ) 
00947 
00948 
00949 //----- 
00950 G4bool
00951 G4FRSCENEHANDLER::SendVisAttributes ( const G4VisAttributes*  pAV )
00952 {
00953 
00954   // Have a look at G4VSceneHandler::GetDrawingStyle (const G4Visible&). (John)
00955 
00956   G4bool status = true ; // initialization
00957   const G4double ALPHA_MIN = 0.001 ; // min of alpha factor of color
00958 
00959   if( pAV == NULL ) { 
00960         // No attribute is given.
00961         // Do nothing. Status is "fail".
00962     status = false ; 
00963 
00964   } else {
00965         // Send attributes. Status is "success".
00966     status = true ;
00967     SendStrDouble3( FR_COLOR_RGB, 
00968                     pAV->GetColor().GetRed  (), 
00969                     pAV->GetColor().GetGreen(), 
00970                     pAV->GetColor().GetBlue () ); 
00971     if ( pAV->GetColor().GetAlpha() < ALPHA_MIN ) {
00972       SendStr( FR_FORCE_WIREFRAME_ON ) ;
00973     } 
00974     else if ( pAV->IsForceDrawingStyle () &&
00975               (pAV->GetForcedDrawingStyle () ==  G4VisAttributes::wireframe)) {
00976       SendStr( FR_FORCE_WIREFRAME_ON ) ;
00977     } else {
00978       SendStr( FR_FORCE_WIREFRAME_OFF ) ;
00979     }
00980   } 
00981 
00982   return status ;
00983 
00984 } // G4FRSCENEHANDLER::SendVisAttributes ()
00985 
00986 
00987 //----- 
00988 G4bool G4FRSCENEHANDLER::IsVisible()
00989 {
00990         //----- 
00991         G4bool  visibility  = true ;
00992 
00993         //----- 
00994         const G4VisAttributes* pVisAttribs =
00995           fpViewer->GetApplicableVisAttributes( fpVisAttribs );
00996 
00997         //----- 
00998         if( ( getenv( FR_ENV_CULL_INVISIBLE_OBJECTS ) != NULL      )   && \
00999             ( strcmp( getenv( FR_ENV_CULL_INVISIBLE_OBJECTS ),"0"  ) ) && \
01000             ( pVisAttribs )                                             ) 
01001         {
01002                 visibility = pVisAttribs->IsVisible();
01003         } 
01004 
01005         //----- 
01006         return visibility ;
01007 
01008 } // G4FRSCENEHANDLER::IsVisible()
01009 
01010 
01011 //----- 
01012 void G4FRSCENEHANDLER::SendBoundingBox( void )
01013 {
01014 #if defined DEBUG_FR_SCENE
01015   if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
01016         G4cout << "***** SendBoundingBox ()  (/BoundingBox)" << G4endl;
01017 #endif
01018 
01019                 //----- (1A) CALC bounding box of the bounding sphere
01020         const  G4VisExtent&  extent = GetScene()->GetExtent();
01021         const  G4Point3D&    center = extent.GetExtentCenter(); 
01022         const  G4double      radius = extent.GetExtentRadius();
01023 
01024         G4double xmin = center.x() - radius ; 
01025         G4double ymin = center.y() - radius ; 
01026         G4double zmin = center.z() - radius ; 
01027 
01028         G4double xmax = center.x() + radius ; 
01029         G4double ymax = center.y() + radius ; 
01030         G4double zmax = center.z() + radius ; 
01031 
01033 //      G4double xmin = extent.GetXmin ();
01034 //      G4double ymin = extent.GetYmin ();
01035 //      G4double zmin = extent.GetZmin ();
01036 //      G4double xmax = extent.GetXmax ();
01037 //      G4double ymax = extent.GetYmax ();
01038 //      G4double zmax = extent.GetZmax ();
01040 
01041                 //----- (1B) SEND bounding box
01042         SendStrDouble6( FR_BOUNDING_BOX, 
01043                         xmin, ymin, zmin,
01044                         xmax, ymax, zmax ); 
01045 
01046 } // G4FRSCENEHANDLER::SendBoundingBox()
01047 
01048 
01049 //----- 
01050 void 
01051 G4FRSCENEHANDLER::SendTransformedCoordinates()
01052 {
01053                 //----- coord info
01054         G4Point3D  zero ( 0.0 , 0.0 , 0.0 );    
01055         G4Point3D  x1   ( 1.0 , 0.0 , 0.0 ); 
01056         G4Point3D  y1   ( 0.0 , 1.0 , 0.0 ); 
01057         G4Vector3D x_unit_vec( 1.0 , 0.0 , 0.0 ); 
01058         G4Vector3D y_unit_vec( 0.0 , 1.0 , 0.0 ); 
01059 
01060                 //----- transformed origin
01061         zero.transform( fObjectTransformation );
01062 
01063                 //----- transformed base vectors
01064         x1.transform( fObjectTransformation );
01065         x_unit_vec = x1 - zero ;
01066         y1.transform( fObjectTransformation );
01067         y_unit_vec = y1 - zero ;
01068 
01069                 //----- send transformed origin
01070         SendStrDouble3( FR_ORIGIN ,  (zero.x()), (zero.y()), (zero.z()) ) ; 
01071 
01072                 //----- send transformed base vectors
01073         SendStrDouble6(          FR_BASE_VECTOR , \
01074                                 (x_unit_vec.x()), (x_unit_vec.y()), (x_unit_vec.z()) , \
01075                                 (y_unit_vec.x()), (y_unit_vec.y()), (y_unit_vec.z())     ) ; 
01076 
01077 } // G4FRSCENEHANDLER::SendTransformedCoordinates()
01078 
01079 
01080 //----- 
01081 void  G4FRSCENEHANDLER::SendPhysVolName ( void )
01082 {
01083         // Local 
01084         G4int i ;
01085 
01086         // Current Model
01087         const G4VModel* pv_model  = GetModel();
01088         if (!pv_model) { return ; } 
01089 
01090         G4PhysicalVolumeModel* pPVModel =
01091           dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
01092         if (!pPVModel) { return ; }
01093 
01094         // Current Physical volume name 
01095         G4String  pv_name  = pPVModel->GetCurrentTag() ;
01096 
01097         // Current depth of volume
01098         G4int cur_depth = pPVModel->GetCurrentDepth() ;
01099 
01100         // Make a string to be sent
01101         // e.g. experimental_Hall.1, where "1" is the copy number
01102         G4String name_comment ( FR_PHYSICAL_VOLUME_NAME );  
01103         name_comment += "     " ;
01104 
01105         for ( i = 0 ; i < cur_depth; i++) { 
01106                 // Make tree
01107                 name_comment += "     " ;
01108         }
01109         name_comment += pv_name ;
01110 
01111         // Send physical volume name 
01112         SendStr ( "#--------------------" );
01113         SendStr ( name_comment );
01114 
01115 } // G4FRSCENEHANDLER::SendPhysVolName ()
01116 
01117 
01118 //----- 
01119 void G4FRSCENEHANDLER::SendStr( const char* char_string )
01120 {
01121         fPrimDest.SendLine( char_string );
01122 } 
01123 
01124 
01125 //----- 
01126 void G4FRSCENEHANDLER::SendStrInt(      const char*     char_string ,
01127                                         G4int           ival    )
01128 {
01129                 //----- make command char_string and send 
01130         G4int   num_char ;
01131         char*   command = new char [ COMMAND_BUF_SIZE ];
01132 
01133         num_char  = sprintf( command, "%s  %d", char_string , ival ) ; 
01134         if( num_char < 0 ) { 
01135           if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
01136                 G4cout << "ERROR G4FRSCENEHANDLER::SendStrInt(), 1\n" ;
01137         }
01138         SendStr( command );
01139         delete [] command ;
01140 } // G4FRSCENEHANDLER::SendStrInt()
01141 
01142 
01143 //----- 
01144 void 
01145 G4FRSCENEHANDLER::SendStrInt3(  const char*     char_string ,
01146                                         G4int           ival1  ,
01147                                         G4int           ival2  ,
01148                                         G4int           ival3   )
01149 {
01150                 //----- make command char_string and send 
01151         G4int   num_char ;
01152         char*   command = new char [ COMMAND_BUF_SIZE ];
01153 
01154         num_char  = \
01155          sprintf( command, "%s  %d  %d  %d", char_string , ival1, ival2, ival3 ) ; 
01156 
01157         if( num_char < 0 ) { 
01158           if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
01159                 G4cout << "ERROR G4FRSCENEHANDLER::SendStrInt3(), 1\n" ;
01160         }
01161         SendStr( command );
01162         delete [] command ;
01163 
01164 } // G4FRSCENEHANDLER::SendStrInt3()
01165 
01166 
01167 //----- 
01168 void 
01169 G4FRSCENEHANDLER::SendStrInt4(  const char*     char_string ,
01170                                         G4int           ival1  ,
01171                                         G4int           ival2  ,
01172                                         G4int           ival3  ,
01173                                         G4int           ival4   )
01174 {
01175                 //----- make command char_string and send 
01176         G4int   num_char ;
01177         char*   command = new char [ COMMAND_BUF_SIZE ];
01178 
01179         num_char  = \
01180          sprintf( command, "%s  %d  %d  %d  %d", char_string , ival1, ival2, ival3, ival4 ) ; 
01181 
01182         if( num_char < 0 ) { 
01183           if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
01184                 G4cout << "ERROR G4FRSCENEHANDLER::SendStrInt4(), 1\n" ;
01185         }
01186         SendStr( command );
01187         delete [] command ;
01188 
01189 } // G4FRSCENEHANDLER::SendStrInt4()
01190 
01191 //----- 
01192 void G4FRSCENEHANDLER::SendStrDouble(   const char*     char_string ,
01193                                                 G4double        dval    )
01194 {
01195                 //----- make command char_string and send 
01196         G4int   num_char ;
01197         char*   command = new char [ COMMAND_BUF_SIZE ];
01198 
01199         num_char  = sprintf( command, "%s  %*.*g", \
01200                                         char_string , \
01201                                         fPrec2, fPrec, dval ) ; 
01202         if( num_char < 0 ) { 
01203           if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
01204                 G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble(), 1\n" ;
01205         }
01206         SendStr( command );
01207         delete [] command ;
01208 
01209 } // G4FRSCENEHANDLER::SendStrDouble()
01210 
01211 
01212 //----- 
01213 void 
01214 G4FRSCENEHANDLER::SendStrDouble2(       const char*     char_string ,
01215                                         G4double        dval1  ,
01216                                         G4double        dval2  )
01217 {
01218                 //----- make command char_string and send 
01219         G4int   num_char ;
01220         char*   command = new char [ COMMAND_BUF_SIZE ];
01221 
01222         num_char  = sprintf( command, "%s  %*.*g  %*.*g", char_string , \
01223                                         fPrec2, fPrec, dval1, \
01224                                         fPrec2, fPrec, dval2         ) ; 
01225         if( num_char < 0 ) { 
01226           if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
01227                 G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble2(), 1\n" ;
01228         }
01229         SendStr( command );
01230         delete [] command ;
01231 
01232 } // G4FRSCENEHANDLER::SendStrDouble2()
01233 
01234 
01235 //----- 
01236 void 
01237 G4FRSCENEHANDLER::SendStrDouble3(       const char*     char_string ,
01238                                         G4double        dval1  ,
01239                                         G4double        dval2  ,
01240                                         G4double        dval3   )
01241 {
01242                 //----- make command char_string and send 
01243         G4int   num_char ;
01244         char*   command = new char [ COMMAND_BUF_SIZE ];
01245 
01246         num_char  = sprintf( command, "%s  %*.*g  %*.*g  %*.*g", \
01247                                 char_string , \
01248                                 fPrec2, fPrec, dval1, \
01249                                 fPrec2, fPrec, dval2, \
01250                                 fPrec2, fPrec, dval3   ) ; 
01251         if( num_char < 0 ) { 
01252           if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
01253                 G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble3(), 1\n" ;
01254         }
01255         SendStr( command );
01256         delete [] command ;
01257 
01258 } // G4FRSCENEHANDLER::SendStrDouble3()
01259 
01260 
01261 //----- 
01262 void 
01263 G4FRSCENEHANDLER::SendStrDouble4(       const char*     char_string ,
01264                                         G4double        dval1  ,
01265                                         G4double        dval2  ,
01266                                         G4double        dval3  ,
01267                                         G4double        dval4  )
01268 {
01269                 //----- make command char_string and send 
01270         G4int   num_char ;
01271         char*   command = new char [ COMMAND_BUF_SIZE ];
01272 
01273         num_char  = sprintf( command, "%s  %*.*g  %*.*g  %*.*g  %*.*g", \
01274                                        char_string , \
01275                                         fPrec2, fPrec, dval1, \
01276                                         fPrec2, fPrec, dval2, \
01277                                         fPrec2, fPrec, dval3, \
01278                                         fPrec2, fPrec, dval4) ; 
01279         if( num_char < 0 ) { 
01280           if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
01281                 G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble4(), 1\n" ;
01282         }
01283         SendStr( command );
01284         delete [] command ;
01285 
01286 } // G4FRSCENEHANDLER::SendStrDouble4()
01287 
01288 
01289 //----- 
01290 void 
01291 G4FRSCENEHANDLER::SendStrDouble5(       const char*     char_string ,
01292                                         G4double        dval1  ,
01293                                         G4double        dval2  ,
01294                                         G4double        dval3  ,
01295                                         G4double        dval4  ,
01296                                         G4double        dval5  )
01297 {
01298                 //----- make command char_string and send 
01299         G4int   num_char ;
01300         char*   command = new char [ COMMAND_BUF_SIZE ];
01301 
01302         num_char  = sprintf( command, "%s  %*.*g  %*.*g  %*.*g  %*.*g  %*.*g", \
01303                                        char_string , \
01304                                         fPrec2, fPrec, dval1, \
01305                                         fPrec2, fPrec, dval2, \
01306                                         fPrec2, fPrec, dval3, \
01307                                         fPrec2, fPrec, dval4, \
01308                                         fPrec2, fPrec, dval5    ) ; 
01309         if( num_char < 0 ) { 
01310           if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
01311                 G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble5(), 1\n" ;
01312         }
01313         SendStr( command );
01314         delete [] command ;
01315 
01316 } // G4FRSCENEHANDLER::SendStrDouble5()
01317 
01318 
01319 //----- 
01320 void 
01321 G4FRSCENEHANDLER::SendStrDouble6(       const char*     char_string ,
01322                                         G4double        dval1  ,
01323                                         G4double        dval2  ,
01324                                         G4double        dval3  ,
01325                                         G4double        dval4  ,
01326                                         G4double        dval5  ,
01327                                         G4double        dval6   )
01328 {
01329                 //----- make command char_string and send 
01330         G4int   num_char ;
01331         char*   command = new char [ COMMAND_BUF_SIZE ];
01332 
01333         num_char  = sprintf( command, "%s  %*.*g  %*.*g  %*.*g  %*.*g  %*.*g  %*.*g", \
01334                                        char_string , \
01335                                         fPrec2, fPrec, dval1, \
01336                                         fPrec2, fPrec, dval2, \
01337                                         fPrec2, fPrec, dval3, \
01338                                         fPrec2, fPrec, dval4, \
01339                                         fPrec2, fPrec, dval5, \
01340                                         fPrec2, fPrec, dval6    ) ; 
01341         if( num_char < 0 ) { 
01342           if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
01343                 G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble6(), 1\n" ;
01344         }
01345         SendStr( command );
01346         delete [] command ;
01347 
01348 } // G4FRSCENEHANDLER::SendStrDouble6()
01349 
01350 
01351 //----- 
01352 void 
01353 G4FRSCENEHANDLER::SendStrDouble7(       const char*     char_string ,
01354                                         G4double        dval1  ,
01355                                         G4double        dval2  ,
01356                                         G4double        dval3  ,
01357                                         G4double        dval4  ,
01358                                         G4double        dval5  ,
01359                                         G4double        dval6  ,
01360                                         G4double        dval7   )
01361 {
01362                 //----- make command char_string and send 
01363         G4int   num_char ;
01364         char*   command = new char [ COMMAND_BUF_SIZE ];
01365 
01366         num_char  = sprintf( command, "%s  %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g", \
01367                              char_string , \
01368                                 fPrec2, fPrec, dval1,\
01369                                 fPrec2, fPrec, dval2,\
01370                                 fPrec2, fPrec, dval3,\
01371                                 fPrec2, fPrec, dval4,\
01372                                 fPrec2, fPrec, dval5,\
01373                                 fPrec2, fPrec, dval6,\
01374                                 fPrec2, fPrec, dval7  ) ; 
01375         if( num_char < 0 ) { 
01376           if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
01377                 G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble7(), 1\n" ;
01378         }
01379         SendStr( command );
01380         delete [] command ;
01381 
01382 } // G4FRSCENEHANDLER::SendStrDouble7()
01383 
01384 
01385 //----- 
01386 void 
01387 G4FRSCENEHANDLER::SendStrDouble11(      const char*     char_string ,
01388                                         G4double        dval1  ,
01389                                         G4double        dval2  ,
01390                                         G4double        dval3  ,
01391                                         G4double        dval4  ,
01392                                         G4double        dval5  ,
01393                                         G4double        dval6  ,
01394                                         G4double        dval7  ,
01395                                         G4double        dval8  ,
01396                                         G4double        dval9  ,
01397                                         G4double        dval10  ,
01398                                         G4double        dval11   )
01399 {
01400                 //----- make command char_string and send 
01401         G4int   num_char ;
01402         char*   command = new char [ COMMAND_BUF_SIZE ];
01403 
01404         num_char  = sprintf( command, "%s  %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g", \
01405                              char_string ,\
01406                                 fPrec2, fPrec, dval1, \
01407                                 fPrec2, fPrec, dval2, \
01408                                 fPrec2, fPrec, dval3, \
01409                                 fPrec2, fPrec, dval4, \
01410                                 fPrec2, fPrec, dval5, \
01411                                 fPrec2, fPrec, dval6, \
01412                                 fPrec2, fPrec, dval7, \
01413                                 fPrec2, fPrec, dval8, \
01414                                 fPrec2, fPrec, dval9, \
01415                                 fPrec2, fPrec, dval10,\
01416                                 fPrec2, fPrec, dval11 ) ; 
01417         if( num_char < 0 ) { 
01418           if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
01419                 G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble11(), 1\n" ;
01420         }
01421         SendStr( command );
01422         delete [] command ;
01423 
01424 } // G4FRSCENEHANDLER::SendStrDouble11()
01425 
01426 
01427 //----- 
01428 void 
01429 G4FRSCENEHANDLER::SendIntDouble3(       G4int           ival   ,
01430                                         G4double        dval1  ,
01431                                         G4double        dval2  ,
01432                                         G4double        dval3  )
01433 {
01434                 //----- make command char_string and send 
01435         G4int   num_char ;
01436         char*   command = new char [ COMMAND_BUF_SIZE ];
01437 
01438         num_char  = sprintf( command, "%d  %*.*g  %*.*g  %*.*g", \
01439                                        ival , \
01440                                         fPrec2, fPrec, dval1, \
01441                                         fPrec2, fPrec, dval2, \
01442                                         fPrec2, fPrec, dval3    ) ; 
01443         if( num_char < 0 ) { 
01444           if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
01445                 G4cout << "ERROR G4FRSCENEHANDLER::SendIntDouble3(),1\n" ;
01446         }
01447         SendStr( command );
01448         delete [] command ;
01449 }
01450 
01451 //----- 
01452 void 
01453 G4FRSCENEHANDLER::SendInt3Str(  G4int           ival1  ,
01454                                         G4int           ival2  ,
01455                                         G4int           ival3  ,
01456                                         const char*     char_string )
01457 {
01458                 //----- make command char_string and send 
01459         G4int   num_char ;
01460         char*   command = new char [ COMMAND_BUF_SIZE ];
01461 
01462         num_char  = sprintf( command, "%d %d %d %s", \
01463                                        ival1, ival2, ival3, char_string ) ; 
01464         if( num_char < 0 ) { 
01465           if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
01466                 G4cout << "ERROR G4FRSCENEHANDLER::SendInt3Str(),1\n" ;
01467         }
01468         SendStr( command );
01469         delete [] command ;
01470 }
01471 
01472 //----- 
01473 void 
01474 G4FRSCENEHANDLER::SendInt4Str(  G4int           ival1  ,
01475                                         G4int           ival2  ,
01476                                         G4int           ival3  ,
01477                                         G4int           ival4  ,
01478                                         const char*     char_string )
01479 {
01480                 //----- make command char_string and send 
01481         G4int   num_char ;
01482         char*   command = new char [ COMMAND_BUF_SIZE ];
01483 
01484         num_char  = sprintf( command, "%d %d %d %d %s", \
01485                                        ival1, ival2, ival3, ival4, char_string ) ; 
01486         if( num_char < 0 ) { 
01487           if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
01488                 G4cout << "ERROR G4FRSCENEHANDLER::SendInt4Str(),1\n" ;
01489         }
01490         SendStr( command );
01491         delete [] command ;
01492 }
01493 
01494 //----- 
01495 void 
01496 G4FRSCENEHANDLER::SendStrDouble3Str(    const char*     char_string1 ,
01497                                                 G4double        dval1  ,
01498                                                 G4double        dval2  ,
01499                                                 G4double        dval3  ,
01500                                                 const char*     char_string2 )
01501 {
01502                 //----- make command char_string and send 
01503         G4int   num_char ;
01504         char*   command = new char [ COMMAND_BUF_SIZE ];
01505 
01506         num_char  = sprintf(    command, "%s  %*.*g %*.*g %*.*g %s", \
01507                                 char_string1,\
01508                                 fPrec2, fPrec, dval1 , \
01509                                 fPrec2, fPrec, dval2 , \
01510                                 fPrec2, fPrec, dval3 , \
01511                                 char_string2              );
01512         if( num_char < 0 ) { 
01513           if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
01514                 G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble6Str(), 1\n" ;
01515         }
01516         SendStr( command );
01517         delete [] command ;
01518 
01519 } 
01520 
01521 
01522 //----- 
01523 void 
01524 G4FRSCENEHANDLER::SendStrDouble6Str(    const char*     char_string1 ,
01525                                                 G4double        dval1  ,
01526                                                 G4double        dval2  ,
01527                                                 G4double        dval3  ,
01528                                                 G4double        dval4  ,
01529                                                 G4double        dval5  ,
01530                                                 G4double        dval6  ,
01531                                                 const char*     char_string2 )
01532 {
01533                 //----- make command char_string and send 
01534         G4int   num_char ;
01535         char*   command = new char [ COMMAND_BUF_SIZE ];
01536 
01537         num_char  = sprintf(    command, "%s  %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %s", \
01538                                 char_string1,\
01539                                 fPrec2, fPrec, dval1 , \
01540                                 fPrec2, fPrec, dval2 , \
01541                                 fPrec2, fPrec, dval3 , \
01542                                 fPrec2, fPrec, dval4 , \
01543                                 fPrec2, fPrec, dval5 , \
01544                                 fPrec2, fPrec, dval6, \
01545                                 char_string2              );
01546         if( num_char < 0 ) { 
01547           if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
01548                 G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble6Str(), 1\n" ;
01549         }
01550         SendStr( command );
01551         delete [] command ;
01552 
01553 } 
01554 
01555 
01556 //----- 
01557 void G4FRSCENEHANDLER::SendInt( G4int           val    )
01558 {
01559                 //----- make command char_string and send 
01560         G4int   num_char ;
01561         char*   command = new char [ COMMAND_BUF_SIZE ];
01562 
01563         num_char  = sprintf( command, "%d", val ) ; 
01564         if( num_char < 0 ) { 
01565           if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
01566                 G4cout << "ERROR G4FRSCENEHANDLER::SendStrInt(), 1\n" ;
01567         }
01568         SendStr( command );
01569         delete [] command ;
01570 } // G4FRSCENEHANDLER::SendStrInt()
01571 
01572 
01573 //----- 
01574 void G4FRSCENEHANDLER::SendDouble( G4double     val    )
01575 {
01576                 //----- make command char_string and send 
01577         G4int   num_char ;
01578         char*   command = new char [ COMMAND_BUF_SIZE ];
01579 
01580         num_char  = sprintf( command, "%*.*g", fPrec2, fPrec, val ) ; 
01581         if( num_char < 0 ) { 
01582           if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
01583                 G4cout << "ERROR G4FRSCENEHANDLER::SendStrInt(), 1\n" ;
01584         }
01585         SendStr( command );
01586         delete [] command ;
01587 } // G4FRSCENEHANDLER::SendStrInt()
01588 
01589 //----- 
01590 void G4FRSCENEHANDLER::ClearTransientStore() 
01591 {
01592   // This is typically called after an update and before drawing hits
01593   // of the next event.  To simulate the clearing of "transients"
01594   // (hits, etc.) the detector is redrawn...
01595   if (fpViewer) {
01596     fpViewer -> SetView ();
01597     fpViewer -> ClearView ();
01598     fpViewer -> DrawView ();
01599   }
01600 }
01601 

Generated on Mon May 27 17:48:17 2013 for Geant4 by  doxygen 1.4.7