00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include <CLHEP/Units/SystemOfUnits.h>
00033
00034 #include "G4VisManager.hh"
00035
00036
00037
00038
00039 #define ADDTHIS_WITH_NAME(Solid) \
00040 fCurrentDEF = #Solid "_" + Solid.GetName(); \
00041 RequestPrimitives(Solid); \
00042 fCurrentDEF = "";
00043
00044
00045
00046 void G4VRML1SCENEHANDLER::AddSolid(const G4Trd& trd)
00047 {
00048 #if defined DEBUG_SCENE_FUNC
00049 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00050 G4cout << "***** AddSolid trd" << "\n" ;
00051 #endif
00052 VRMLBeginModeling () ;
00053 ADDTHIS_WITH_NAME(trd)
00054 }
00055
00056 void G4VRML1SCENEHANDLER::AddSolid(const G4Trap& trap)
00057 {
00058 #if defined DEBUG_SCENE_FUNC
00059 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00060 G4cout << "***** AddSolid trap" << "\n" ;
00061 #endif
00062 VRMLBeginModeling () ;
00063 ADDTHIS_WITH_NAME(trap)
00064 }
00065
00066 void G4VRML1SCENEHANDLER::AddSolid(const G4Para& para)
00067 {
00068 #if defined DEBUG_SCENE_FUNC
00069 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00070 G4cout << "***** AddSolid para" << "\n" ;
00071 #endif
00072 VRMLBeginModeling () ;
00073 ADDTHIS_WITH_NAME(para)
00074 }
00075
00076 void G4VRML1SCENEHANDLER::AddSolid(const G4Torus& torus )
00077 {
00078 #if defined DEBUG_SCENE_FUNC
00079 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00080 G4cout << "***** AddSolid torus" << "\n" ;
00081 #endif
00082 VRMLBeginModeling () ;
00083 ADDTHIS_WITH_NAME(torus)
00084 }
00085
00086
00087 void G4VRML1SCENEHANDLER::AddSolid(const G4VSolid& vsolid)
00088 {
00089 #if defined DEBUG_SCENE_FUNC
00090 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00091 G4cout << "***** AddSolid vsolid" << "\n" ;
00092 #endif
00093 VRMLBeginModeling () ;
00094 ADDTHIS_WITH_NAME(vsolid)
00095 }
00096
00097 void G4VRML1SCENEHANDLER::AddSolid(const G4Tubs& tubs)
00098 {
00099 #if defined DEBUG_SCENE_FUNC
00100 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00101 G4cout << "***** AddSolid tubs" << "\n" ;
00102 #endif
00103 VRMLBeginModeling () ;
00104
00105
00106 fCurrentDEF = "tubs_" + tubs.GetName();
00107
00108
00109 const G4double R = tubs.GetRMax();
00110 const G4double r = tubs.GetRMin();
00111 const G4double dz = tubs.GetDz();
00112 const G4double dp = tubs.GetDPhi();
00113
00114
00115 if ( r == 0.0 && dp >= 360. * CLHEP::deg ) {
00116
00117 fDest << "Separator {" << "\n";
00118 SendMatrixTransformNode( fObjectTransformation );
00119
00120 fDest << "\t" << "DEF " << fCurrentDEF << " Separator {" << "\n";
00121 SendMaterialNode();
00122 SendCylinderNode(R, dz * 2);
00123 fDest << "\t" << "}" << "\n";
00124 fDest << "}" << "\n";
00125 } else {
00126
00127 RequestPrimitives(tubs);
00128 }
00129
00130
00131 fCurrentDEF = "";
00132 }
00133
00134
00135 void G4VRML1SCENEHANDLER::AddSolid(const G4Cons& cons)
00136 {
00137 #if defined DEBUG_SCENE_FUNC
00138 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00139 G4cout << "***** AddSolid cons" << "\n" ;
00140 #endif
00141 VRMLBeginModeling () ;
00142
00143
00144 fCurrentDEF = "cons_" + cons.GetName();
00145
00146
00147 const G4double r1 = cons.GetRmin1();
00148 const G4double R1 = cons.GetRmax1();
00149 const G4double r2 = cons.GetRmin2();
00150 const G4double R2 = cons.GetRmax2();
00151 const G4double dz = cons.GetDz();
00152
00153 const G4double dp = cons.GetDPhi();
00154
00155
00156 if ( r1 == 0.0 && r2 == 0.0 && R1 == R2 && dp >= 360. * CLHEP::deg) {
00157
00158 fDest << "Separator {" << "\n";
00159 SendMatrixTransformNode( fObjectTransformation );
00160
00161 fDest << "\t" << "DEF " << fCurrentDEF << " Separator {" << "\n";
00162 SendMaterialNode();
00163 SendCylinderNode(R1, dz * 2);
00164 fDest << "\t" << "}" << "\n";
00165 fDest << "}" << "\n";
00166 } else {
00167
00168 RequestPrimitives(cons);
00169 }
00170
00171
00172 fCurrentDEF = "";
00173 }
00174
00175 void G4VRML1SCENEHANDLER::AddSolid(const G4Box& box)
00176 {
00177 #if defined DEBUG_SCENE_FUNC
00178 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00179 G4cout << "***** AddSolid box" << "\n" ;
00180 #endif
00181 VRMLBeginModeling () ;
00182
00183
00184 fCurrentDEF = "box_" + box.GetName();
00185
00186
00187 fDest << "Separator {" << "\n";
00188
00189
00190 SendMatrixTransformNode( fObjectTransformation );
00191
00192 fDest << "\t" << "DEF " << fCurrentDEF << " Separator {" << "\n";
00193 SendMaterialNode();
00194 SendCubeNode(box.GetXHalfLength() * 2, box.GetYHalfLength() * 2, box.GetZHalfLength() * 2);
00195 fDest << "\t" << "}" << "\n";
00196
00197 fDest << "}" << "\n";
00198
00199
00200 fCurrentDEF = "";
00201 }
00202
00203
00204 void G4VRML1SCENEHANDLER::AddSolid(const G4Sphere& sphere)
00205 {
00206 #if defined DEBUG_SCENE_FUNC
00207 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00208 G4cout << "***** AddSolid sphere" << "\n" ;
00209 #endif
00210 VRMLBeginModeling () ;
00211
00212
00213 fCurrentDEF = "sphere_" + sphere.GetName();
00214
00215
00216 G4double dphi = sphere.GetDPhi () ;
00217 G4double dtheta = sphere.GetDTheta() ;
00218 G4double rmax = sphere.GetRmax () ;
00219 G4double rmin = sphere.GetRmin () ;
00220
00221
00222 if ( (dphi >= 360. * CLHEP::deg) && (dtheta >= 180. * CLHEP::deg) && (rmin == 0.0) ) {
00223
00224 fDest << "Separator {" << "\n";
00225 SendMatrixTransformNode( fObjectTransformation );
00226
00227 fDest << "\t" << "DEF " << fCurrentDEF << " Separator {" << "\n";
00228 SendMaterialNode();
00229 SendSphereNode( rmax );
00230 fDest << "\t" << "}" << "\n";
00231 fDest << "}" << "\n";
00232 } else {
00233
00234 RequestPrimitives( sphere );
00235 }
00236
00237
00238 fCurrentDEF = "";
00239 }
00240
00241 void G4VRML1SCENEHANDLER::AddPrimitive(const G4Polyline& polyline)
00242 {
00243 #if defined DEBUG_SCENE_FUNC
00244 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00245 G4cout << "***** AddPrimitive polyline" << "\n" ;
00246 #endif
00247 if (fProcessing2D) {
00248 static G4bool warned = false;
00249 if (!warned) {
00250 warned = true;
00251 G4Exception
00252 ("G4VRML1SCENEHANDLER::AddPrimitive (const G4Polyline&)",
00253 "VRML-1001", JustWarning,
00254 "2D polylines not implemented. Ignored.");
00255 }
00256 return;
00257 }
00258
00259 VRMLBeginModeling () ;
00260
00261 fDest << "Separator {" << "\n";
00262
00263 SendMatrixTransformNode (fObjectTransformation );
00264
00265 SendMaterialNode( polyline.GetVisAttributes() );
00266
00267 fDest << "\t" << "Coordinate3 {" << "\n";
00268 fDest << "\t\t" << "point [" << "\n";
00269 G4int e, i;
00270 for (i = 0, e = polyline.size(); e; i++, e--) {
00271 fDest << "\t\t\t";
00272 fDest << polyline[i].x() << " ";
00273 fDest << polyline[i].y() << " ";
00274 fDest << polyline[i].z() << "," << "\n";
00275 }
00276 fDest << "\t\t" << "]" << "\n";
00277 fDest << "\t" << "}" << "\n";
00278
00279 fDest << "\t" << "IndexedLineSet {" << "\n";
00280 fDest << "\t\t" << "coordIndex [";
00281 for (i = 0, e = polyline.size(); e; i++, e--) {
00282 if (i % 10 == 0)
00283 fDest << "\n" << "\t\t\t";
00284 fDest << i << ", ";
00285 }
00286 fDest << "-1" << "\n";
00287 fDest << "\t\t" << "]" << "\n";
00288 fDest << "\t" << "}" << "\n";
00289
00290 fDest << "}" << "\n";
00291 }
00292
00293 void G4VRML1SCENEHANDLER::AddPrimitive(const G4Polyhedron& polyhedron)
00294 {
00295 #if defined DEBUG_SCENE_FUNC
00296 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00297 G4cout << "***** AddPrimitive(G4Polyhedron)" << "\n";
00298 #endif
00299
00300 if (polyhedron.GetNoFacets() == 0) return;
00301
00302 if (fProcessing2D) {
00303 static G4bool warned = false;
00304 if (!warned) {
00305 warned = true;
00306 G4Exception
00307 ("G4VRML1SCENEHANDLER::AddPrimitive (const G4Polyhedron&)",
00308 "VRML-1002", JustWarning,
00309 "2D polyhedra not implemented. Ignored.");
00310 }
00311 return;
00312 }
00313
00314 VRMLBeginModeling () ;
00315
00316 fDest << "Separator {" << "\n";
00317
00318 SendMatrixTransformNode( fObjectTransformation );
00319
00320 fDest << "\t";
00321 if (fCurrentDEF != "")
00322 fDest << "DEF " << fCurrentDEF << " ";
00323
00324 fDest << "Separator {" << "\n";
00325
00326
00327
00328 fDest << "\t\t" << "ShapeHints {" << "\n";
00329 fDest << "\t\t\t" << "vertexOrdering COUNTERCLOCKWISE" << "\n";
00330 fDest << "\t\t\t" << "shapeType SOLID" << "\n";
00331 fDest << "\t\t\t" << "faceType CONVEX" << "\n";
00332 fDest << "\t\t" << "}" << "\n";
00333
00334 SendMaterialNode();
00335
00336 fDest << "\t\t" << "Coordinate3 {" << "\n";
00337 fDest << "\t\t\t" << "point [" << "\n";
00338 G4int i, j;
00339 for (i = 1, j = polyhedron.GetNoVertices(); j; j--, i++) {
00340 G4Point3D point = polyhedron.GetVertex(i);
00341 fDest << "\t\t\t\t";
00342 fDest << point.x() << " ";
00343 fDest << point.y() << " ";
00344 fDest << point.z() << "," << "\n";
00345 }
00346 fDest << "\t\t\t" << "]" << "\n";
00347 fDest << "\t\t" << "}" << "\n";
00348
00349 fDest << "\t\t" << "IndexedFaceSet {" << "\n";
00350 fDest << "\t\t\t" << "coordIndex [" << "\n";
00351
00352
00353 G4int f;
00354 for (f = polyhedron.GetNoFacets(); f; f--) {
00355
00356
00357 G4bool notLastEdge;
00358 G4int index = -1, edgeFlag = 1;
00359 fDest << "\t\t\t\t";
00360 do {
00361 notLastEdge = polyhedron.GetNextVertexIndex(index, edgeFlag);
00362 fDest << index - 1 << ", ";
00363 } while (notLastEdge);
00364 fDest << "-1," << "\n";
00365 }
00366 fDest << "\t\t\t" << "]" << "\n";
00367 fDest << "\t\t" << "}" << "\n";
00368
00369 fDest << "\t" << "}" << "\n";
00370 fDest << "}" << "\n";
00371
00372 }
00373
00374
00375 void G4VRML1SCENEHANDLER::AddPrimitive(const G4NURBS&)
00376 {
00377 #if defined DEBUG_SCENE_FUNC
00378 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00379 G4cout << "***** AddPrimitive nurbs" << "\n" ;
00380 #endif
00381 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00382 G4cout << "G4VRML1File::AddPrimitive(G4NURBS&): not implemented. " << "\n" ;
00383 VRMLBeginModeling () ;
00384
00385 }
00386
00387 void G4VRML1SCENEHANDLER::AddPrimitive( const G4Text& )
00388 {
00389 #if defined DEBUG_SCENE_FUNC
00390 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00391 G4cout << "***** AddPrimitive text" << "\n" ;
00392 #endif
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00408 G4cout <<
00409 "***** void G4VRML1SCENEHANDLER::AddPrimitive( const G4Text& text )"
00410 " not implemented yet."
00411 << "\n";
00412
00413 VRMLBeginModeling () ;
00414 }
00415
00416 void G4VRML1SCENEHANDLER::AddPrimitive( const G4Circle& circle )
00417 {
00418 #if defined DEBUG_SCENE_FUNC
00419 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00420 G4cout << "***** AddPrimitive circle" << "\n" ;
00421 #endif
00422
00423 if (fProcessing2D) {
00424 static G4bool warned = false;
00425 if (!warned) {
00426 warned = true;
00427 G4Exception
00428 ("G4VRML1SCENEHANDLER::AddPrimitive (const G4Circle&)",
00429 "VRML-1004", JustWarning,
00430 "2D circles not implemented. Ignored.");
00431 }
00432 return;
00433 }
00434
00435 VRMLBeginModeling () ;
00436
00437
00438 fDest << "Separator {" << "\n";
00439
00440
00441 SendMarkerColor ( circle ) ;
00442
00443
00444 SendMarkerWorldPosition ( circle ) ;
00445
00446
00447 G4double size = GetMarkerHalfSize ( circle );
00448
00449
00450 fDest << "\t" << "Sphere {" << "\n";
00451 fDest << "\t\t" << "radius " << size << "\n";
00452 fDest << "\t" << "}" << "\n";
00453
00454
00455 fDest << "}" << "\n";
00456 }
00457
00458
00459 void G4VRML1SCENEHANDLER::AddPrimitive(const G4Square& square)
00460 {
00461 #if defined DEBUG_SCENE_FUNC
00462 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00463 G4cout << "***** AddPrimitive square" << "\n" ;
00464 #endif
00465
00466 if (fProcessing2D) {
00467 static G4bool warned = false;
00468 if (!warned) {
00469 warned = true;
00470 G4Exception
00471 ("G4VRML1SCENEHANDLER::AddPrimitive (const G4Square&)",
00472 "VRML-1005", JustWarning,
00473 "2D squares not implemented. Ignored.");
00474 }
00475 return;
00476 }
00477
00478 VRMLBeginModeling () ;
00479
00480
00481 fDest << "Separator {" << "\n";
00482
00483
00484 SendMarkerColor ( square );
00485
00486
00487 SendMarkerWorldPosition ( square );
00488
00489
00490 G4double size = GetMarkerHalfSize ( square );
00491 size *= 2.;
00492
00493
00494 fDest << "\t" << "Cube {" << "\n";
00495 fDest << "\t\t" << "width " << size << "\n";
00496 fDest << "\t\t" << "height " << size << "\n";
00497 fDest << "\t\t" << "depth " << size << "\n";
00498 fDest << "\t" << "}" << "\n";
00499
00500
00501 fDest << "}" << "\n";
00502 }
00503
00504 void G4VRML1SCENEHANDLER::BeginModeling()
00505 {
00506 #if defined DEBUG_SCENE_FUNC
00507 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00508 G4cout << "***** BeginModeling " << "\n" ;
00509 #endif
00510 G4VSceneHandler::BeginModeling();
00511 }
00512
00513 void G4VRML1SCENEHANDLER::EndModeling()
00514 {
00515 #if defined DEBUG_SCENE_FUNC
00516 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00517 G4cout << "***** EndModeling " << "\n" ;
00518 #endif
00519 G4VSceneHandler::EndModeling();
00520 }
00521
00522 void G4VRML1SCENEHANDLER::BeginPrimitives(const G4Transform3D& objectTransformation)
00523 {
00524 G4VSceneHandler::BeginPrimitives (objectTransformation);
00525 #if defined DEBUG_SCENE_FUNC
00526 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00527 G4cout << "***** BeginPrimitives " << "\n" ;
00528 #endif
00529 VRMLBeginModeling();
00530 }
00531
00532 void G4VRML1SCENEHANDLER::EndPrimitives()
00533 {
00534 #if defined DEBUG_SCENE_FUNC
00535 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00536 G4cout << "***** EndPrimitives " << "\n" ;
00537 #endif
00538 G4VSceneHandler::EndPrimitives();
00539 }
00540
00541 void G4VRML1SCENEHANDLER::SendMaterialNode( const G4VisAttributes* pVA )
00542 {
00543
00544 const double TRANSPARENCY = 0.5 ;
00545
00546 if (!pVA)
00547 return;
00548
00549 const G4Color& color = pVA->GetColor();
00550
00551 fDest << "\t\t" << "Material {" << "\n";
00552
00553 if (pVA->IsForceDrawingStyle() &&
00554 (pVA->GetForcedDrawingStyle() == G4VisAttributes::wireframe)) {
00555 fDest << "\t\t\t" << "transparency " << TRANSPARENCY << "\n";
00556 }
00557
00558 fDest << "\t\t\t" << "diffuseColor";
00559 fDest << " " << color.GetRed();
00560 fDest << " " << color.GetGreen();
00561 fDest << " " << color.GetBlue();
00562 fDest << "\n";
00563 fDest << "\t\t" << "}" << "\n";
00564 }
00565
00566
00567 void G4VRML1SCENEHANDLER::SendMaterialNode()
00568 {
00569 SendMaterialNode
00570 ( fpViewer->GetApplicableVisAttributes (fpVisAttribs) );
00571 }
00572
00573
00574 void G4VRML1SCENEHANDLER::SendMatrixTransformNode(const G4Transform3D& trans)
00575 {
00576 G4Point3D B (0.0, 0.0, 0.0);
00577
00578 G4Point3D x1 (1.0, 0.0, 0.0);
00579 G4Point3D y1 (0.0, 1.0, 0.0);
00580
00581 G4Vector3D e1 (1.0, 0.0, 0.0);
00582 G4Vector3D e2 (0.0, 1.0, 0.0);
00583 G4Vector3D e3 (0.0, 0.0, 1.0);
00584
00585
00586 B.transform(trans);
00587
00588
00589 x1.transform(trans);
00590 e1 = x1 - B;
00591
00592 y1.transform(trans);
00593 e2 = y1 - B;
00594
00595 e3 = e1.cross(e2);
00596
00597 e1 = e1.unit();
00598 e2 = e2.unit();
00599 e3 = e3.unit();
00600
00601 fDest << "\t" << "MatrixTransform {" << "\n";
00602 fDest << "\t\t" << "matrix ";
00603 fDest << e1.x() << " " << e1.y() << " " << e1.z() << " 0 ";
00604 fDest << e2.x() << " " << e2.y() << " " << e2.z() << " 0 ";
00605 fDest << e3.x() << " " << e3.y() << " " << e3.z() << " 0 ";
00606 fDest << B.x() << " " << B.y() << " " << B.z() << " 1" << "\n";
00607 fDest << "\t" << "}" << "\n";
00608 }
00609
00610 void G4VRML1SCENEHANDLER::SendCubeNode(G4double w, G4double h, G4double d)
00611 {
00612 fDest << "\t\t" << "Cube {" << "\n";
00613 fDest << "\t\t\t" << "width " << w << "\n";
00614 fDest << "\t\t\t" << "height " << h << "\n";
00615 fDest << "\t\t\t" << "depth " << d << "\n";
00616 fDest << "\t\t" << "}" << "\n";
00617 }
00618
00619 void G4VRML1SCENEHANDLER::SendCylinderNode(G4double R, G4double h)
00620 {
00621 fDest << "\t\t" << "Transform {" << "\n";
00622 fDest << "\t\t\t" << "rotation 1 0 0 " << (90. * CLHEP::deg) << "\n";
00623 fDest << "\t\t" << "}" << "\n";
00624
00625 fDest << "\t\t" << "Cylinder {" << "\n";
00626 fDest << "\t\t\t" << "radius " << R << "\n";
00627 fDest << "\t\t\t" << "height " << h << "\n";
00628 fDest << "\t\t" << "}" << "\n";
00629 }
00630
00631 void G4VRML1SCENEHANDLER::SendSphereNode(G4double R)
00632 {
00633 fDest << "\t\t" << "Sphere {" << "\n";
00634 fDest << "\t\t\t" << "radius " << R << "\n";
00635 fDest << "\t\t" << "}" << "\n";
00636 }
00637
00638 void G4VRML1SCENEHANDLER::VRMLBeginModeling()
00639 {
00640 if (!IS_CONNECTED ) {
00641 #if defined DEBUG_SCENE_FUNC
00642 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00643 G4cout << "***** VRMLBeginModeling() (started)" << "\n" ;
00644 #endif
00645 this->connectPort();
00646 fDest << "#VRML V1.0 ascii" << "\n";
00647 fDest << "# Generated by VRML 1.0 driver of GEANT4\n" << "\n";
00648 }
00649 }
00650
00651 void G4VRML1SCENEHANDLER::VRMLEndModeling()
00652 {
00653 if ( IS_CONNECTED ) {
00654 #if defined DEBUG_SCENE_FUNC
00655 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00656 G4cout << "***** VRMLEndModeling() (started)" << "\n" ;
00657 #endif
00658
00659 fDest << "#End of file." << "\n";
00660 this->closePort();
00661 }
00662 }
00663
00664 void G4VRML1SCENEHANDLER::SendMarkerColor ( const G4VMarker& mark )
00665 {
00666 const G4Color& color = GetColor( mark );
00667
00668 fDest << "\t" << "Material {" << "\n";
00669 fDest << "\t\t";
00670 fDest << "ambientColor [] ";
00671 fDest << "specularColor [] ";
00672 fDest << "\t\t" << "diffuseColor";
00673 fDest << " " << color.GetRed();
00674 fDest << " " << color.GetGreen();
00675 fDest << " " << color.GetBlue();
00676 fDest << "\n";
00677 fDest << "\t\t" << "emissiveColor";
00678 fDest << " " << color.GetRed();
00679 fDest << " " << color.GetGreen();
00680 fDest << " " << color.GetBlue();
00681 fDest << "\n";
00682 fDest << "\t" << "}" << "\n";
00683 }
00684
00685 void
00686 G4VRML1SCENEHANDLER::SendMarkerWorldPosition ( const G4VMarker& mark )
00687 {
00688 G4Point3D point = mark.GetPosition();
00689
00690 SendMatrixTransformNode( fObjectTransformation );
00691
00692 fDest << "\t\t" << "Transform {" << "\n";
00693 fDest << "\t\t\t" << "translation ";
00694 fDest << point.x() << " " << point.y() << " " << point.z() << "\n";
00695 fDest << "\t\t" << "}" << "\n" ;
00696 }
00697
00698
00699 G4double G4VRML1SCENEHANDLER::GetMarkerHalfSize ( const G4VMarker& mark )
00700 {
00701
00702 G4double size = 1.0 ;
00703
00704
00705 const double HALF_SCREEN_SIZE_2D = 300.0 ;
00706 double zoom_factor = fpViewer->GetViewParameters().GetZoomFactor() ;
00707 if ( zoom_factor <= 0.0 ) { zoom_factor = 1.0 ; }
00708 double extent_radius_3d = GetScene()->GetExtent().GetExtentRadius() ;
00709 if ( extent_radius_3d <= 0.0 ) { extent_radius_3d = 1.0 ; }
00710
00711
00712 if ( mark.GetWorldSize() > 0.0 ) {
00713
00714 size = 0.5 * mark.GetWorldSize() ;
00715
00716 } else if ( mark.GetScreenSize() > 0.0 ) {
00717
00718 double mark_radius_2d = 0.5 * mark.GetScreenSize() ;
00719
00720
00721 size \
00722 = extent_radius_3d * ( mark_radius_2d / HALF_SCREEN_SIZE_2D );
00723 size *= zoom_factor ;
00724
00725 } else {
00726
00727 double mark_radius_2d \
00728 = fpViewer->GetViewParameters().GetDefaultMarker().GetScreenSize();
00729 mark_radius_2d *= 0.1 ;
00730
00731
00732 size \
00733 = extent_radius_3d * ( mark_radius_2d / HALF_SCREEN_SIZE_2D );
00734 size *= zoom_factor ;
00735 }
00736
00737
00738 size *= fpViewer->GetViewParameters().GetGlobalMarkerScale();
00739
00740
00741 return size ;
00742
00743 }
00744
00745 void G4VRML1SCENEHANDLER::ClearTransientStore()
00746 {
00747
00748
00749
00750 if (fpViewer) {
00751 fpViewer -> SetView ();
00752 fpViewer -> ClearView ();
00753 fpViewer -> DrawView ();
00754 }
00755 }
00756
00757
00758
00759
00760