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