Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // >> 27 // $Id: G4DAWNFILEViewer.cc,v 1.21 2010-11-11 01:13:42 akimura Exp $ >> 28 // GEANT4 tag $Name: geant4-09-04-patch-01 $ 27 // 29 // 28 // Satoshi TANAKA 30 // Satoshi TANAKA 29 // DAWNFILE view - opens window, hard copy, et 31 // DAWNFILE view - opens window, hard copy, etc. 30 32 >> 33 31 #define __G_ANSI_C__ 34 #define __G_ANSI_C__ 32 #define G4DAWNFILE_STRUCTURE_PRIORITY 1. << 35 #define G4DAWNFILE_STRUCTURE_PRIORITY 1. 33 36 34 // #define DEBUG_FR_VIEW 37 // #define DEBUG_FR_VIEW 35 38 36 #include "G4ios.hh" 39 #include "G4ios.hh" 37 #include <stdio.h> 40 #include <stdio.h> 38 #include <string.h> 41 #include <string.h> 39 #include <assert.h> 42 #include <assert.h> 40 43 41 #include "G4VisManager.hh" 44 #include "G4VisManager.hh" 42 #include "G4Scene.hh" 45 #include "G4Scene.hh" 43 #include "G4Vector3D.hh" 46 #include "G4Vector3D.hh" 44 #include "G4VisExtent.hh" 47 #include "G4VisExtent.hh" 45 #include "G4LogicalVolume.hh" 48 #include "G4LogicalVolume.hh" 46 #include "G4VSolid.hh" 49 #include "G4VSolid.hh" 47 #include "G4PhysicalConstants.hh" << 48 50 49 #include "G4FRConst.hh" 51 #include "G4FRConst.hh" 50 #include "G4DAWNFILE.hh" 52 #include "G4DAWNFILE.hh" 51 #include "G4DAWNFILESceneHandler.hh" 53 #include "G4DAWNFILESceneHandler.hh" 52 #include "G4DAWNFILEViewer.hh" 54 #include "G4DAWNFILEViewer.hh" 53 55 54 //----- constants << 55 const char FR_ENV_MULTI_WINDOW[] = "G4DAWN_MU << 56 const char FR_ENV_MULTI_WINDOW2[] = "G4DAWNFIL << 57 << 58 //----- G4DAWNFILEViewer, constructor << 59 G4DAWNFILEViewer::G4DAWNFILEViewer(G4DAWNFILES << 60 const G4Str << 61 : G4VViewer(sceneHandler, sceneHandler.Incre << 62 , fSceneHandler(sceneHandler) << 63 { << 64 // Set a g4.prim-file viewer << 65 strcpy(fG4PrimViewer, "dawn"); << 66 if(std::getenv("G4DAWNFILE_VIEWER") != NULL) << 67 { << 68 strcpy(fG4PrimViewer, std::getenv("G4DAWNF << 69 } << 70 56 71 // string for viewer invocation << 72 if(!strcmp(fG4PrimViewer, "NONE")) << 73 { << 74 strcpy(fG4PrimViewerInvocation, ""); << 75 } << 76 else << 77 { << 78 strcpy(fG4PrimViewerInvocation, fG4PrimVie << 79 strcat(fG4PrimViewerInvocation, " "); << 80 strcat(fG4PrimViewerInvocation, fSceneHand << 81 } << 82 57 83 // Set a PostScript Viewer << 58 //----- constants 84 // strcpy( fPSViewer, "ghostview" ); << 59 const char FR_ENV_MULTI_WINDOW [] = "G4DAWN_MULTI_WINDOW" ; 85 strcpy(fPSViewer, "gv"); << 60 const char FR_ENV_MULTI_WINDOW2[] = "G4DAWNFILE_MULTI_WINDOW" ; 86 if(std::getenv("G4DAWNFILE_PS_VIEWER") != NU << 61 87 { << 62 //----- G4DAWNFILEViewer, constructor 88 strcpy(fPSViewer, std::getenv("G4DAWNFILE_ << 63 G4DAWNFILEViewer::G4DAWNFILEViewer (G4DAWNFILESceneHandler& sceneHandler, 89 } << 64 const G4String& name): >> 65 G4VViewer (sceneHandler, >> 66 sceneHandler.IncrementViewCount (), >> 67 name), >> 68 fSceneHandler (sceneHandler) >> 69 { >> 70 // Set a g4.prim-file viewer >> 71 strcpy( fG4PrimViewer, "dawn" ); >> 72 if( getenv( "G4DAWNFILE_VIEWER" ) != NULL ) { >> 73 strcpy( fG4PrimViewer, getenv( "G4DAWNFILE_VIEWER" ) ) ; >> 74 } >> 75 >> 76 // string for viewer invocation >> 77 if ( !strcmp( fG4PrimViewer, "NONE" ) ) { >> 78 >> 79 strcpy( fG4PrimViewerInvocation, "" ); >> 80 } else { >> 81 >> 82 strcpy( fG4PrimViewerInvocation, fG4PrimViewer ); >> 83 strcat( fG4PrimViewerInvocation, " "); >> 84 strcat( fG4PrimViewerInvocation, fSceneHandler.GetG4PrimFileName() ); >> 85 } >> 86 >> 87 // Set a PostScript Viewer >> 88 // strcpy( fPSViewer, "ghostview" ); >> 89 strcpy( fPSViewer, "gv" ); >> 90 if( getenv( "G4DAWNFILE_PS_VIEWER" ) != NULL ) { >> 91 strcpy( fPSViewer, getenv( "G4DAWNFILE_PS_VIEWER" ) ) ; >> 92 } >> 93 90 } 94 } 91 95 92 //----- G4DAWNFILEViewer, destructor << 96 //----- G4DAWNFILEViewer, destructor 93 G4DAWNFILEViewer::~G4DAWNFILEViewer() {} << 97 G4DAWNFILEViewer::~G4DAWNFILEViewer () >> 98 {} 94 99 95 //----- G4DAWNFILEViewer::SetView () << 100 //----- G4DAWNFILEViewer::SetView () 96 void G4DAWNFILEViewer::SetView() << 101 void G4DAWNFILEViewer::SetView () 97 { 102 { 98 #if defined DEBUG_FR_VIEW 103 #if defined DEBUG_FR_VIEW 99 if(G4VisManager::GetVerbosity() >= G4VisMana << 104 if (G4VisManager::GetVerbosity() >= G4VisManager::errors) 100 G4cout << "***** G4DAWNFILEViewer::SetView 105 G4cout << "***** G4DAWNFILEViewer::SetView(): No effects" << G4endl; 101 #endif << 106 #endif 102 // Do nothing, since DAWN is running as a di << 107 // Do nothing, since DAWN is running as a different process. 103 // SendViewParameters () will do this job in << 108 // SendViewParameters () will do this job instead. 104 } 109 } 105 110 106 //----- G4DAWNFILEViewer::ClearView() << 111 107 void G4DAWNFILEViewer::ClearView(void) << 112 //----- G4DAWNFILEViewer::ClearView() >> 113 void >> 114 G4DAWNFILEViewer::ClearView( void ) 108 { 115 { 109 #if defined DEBUG_FR_VIEW 116 #if defined DEBUG_FR_VIEW 110 if(G4VisManager::GetVerbosity() >= G4VisMana << 117 if (G4VisManager::GetVerbosity() >= G4VisManager::errors) 111 G4cout << "***** G4DAWNFILEViewer::ClearVi << 118 G4cout << "***** G4DAWNFILEViewer::ClearView (): No effects " << G4endl; 112 #endif 119 #endif 113 if(fSceneHandler.fPrimDest.IsOpen()) << 120 if (fSceneHandler.fPrimDest.IsOpen()) { 114 { << 121 fSceneHandler.fPrimDest.Close(); 115 fSceneHandler.fPrimDest.Close(); << 122 // Re-open with same filename... 116 // Re-open with same filename... << 123 fSceneHandler.fPrimDest.Open(fSceneHandler.fG4PrimFileName); 117 fSceneHandler.fPrimDest.Open(fSceneHandler << 124 fSceneHandler.SendStr( FR_G4_PRIM_HEADER ); 118 fSceneHandler.SendStr(FR_G4_PRIM_HEADER); << 125 fSceneHandler.FRflag_in_modeling = false; 119 fSceneHandler.FRflag_in_modeling = false; << 126 fSceneHandler.FRBeginModeling(); 120 fSceneHandler.FRBeginModeling(); << 127 } 121 } << 122 } 128 } 123 129 124 //----- G4DAWNFILEViewer::DrawView () << 130 125 void G4DAWNFILEViewer::DrawView() << 131 //----- G4DAWNFILEViewer::DrawView () >> 132 void G4DAWNFILEViewer::DrawView () 126 { 133 { 127 #if defined DEBUG_FR_VIEW 134 #if defined DEBUG_FR_VIEW 128 if(G4VisManager::GetVerbosity() >= G4VisMana << 135 if (G4VisManager::GetVerbosity() >= G4VisManager::errors) 129 G4cout << "***** G4DAWNFILEViewer::DrawVie << 136 G4cout << "***** G4DAWNFILEViewer::DrawView () " << G4endl; 130 #endif 137 #endif 131 //----- << 138 //----- 132 fSceneHandler.FRBeginModeling(); << 139 fSceneHandler.FRBeginModeling() ; >> 140 >> 141 //----- Always visit G4 kernel >> 142 NeedKernelVisit (); >> 143 >> 144 //----- Draw >> 145 ProcessView () ; 133 146 134 //----- Always visit G4 kernel << 147 } // G4DAWNFILEViewer::DrawView () 135 NeedKernelVisit(); << 136 148 137 //----- Draw << 138 ProcessView(); << 139 149 140 } // G4DAWNFILEViewer::DrawView () << 141 150 142 //----- G4DAWNFILEViewer::ShowView() << 151 //----- G4DAWNFILEViewer::ShowView() 143 void G4DAWNFILEViewer::ShowView(void) << 152 void G4DAWNFILEViewer::ShowView( void ) 144 { 153 { 145 #if defined DEBUG_FR_VIEW 154 #if defined DEBUG_FR_VIEW 146 if(G4VisManager::GetVerbosity() >= G4VisMana << 155 if (G4VisManager::GetVerbosity() >= G4VisManager::errors) 147 G4cout << "***** G4DAWNFILEViewer::ShowVie << 156 G4cout << "***** G4DAWNFILEViewer::ShowView () " << G4endl; 148 #endif 157 #endif 149 158 150 if(fSceneHandler.FRIsInModeling()) << 159 if( fSceneHandler.FRIsInModeling() ) 151 { << 160 { 152 //----- End of modeling << 161 //----- End of modeling 153 // !EndModeling, !DrawAll, !CloseDevice, << 162 // !EndModeling, !DrawAll, !CloseDevice, 154 // close g4.prim << 163 // close g4.prim 155 fSceneHandler.FREndModeling(); << 164 fSceneHandler.FREndModeling(); 156 << 165 157 //----- Output DAWN GUI file << 166 //----- Output DAWN GUI file 158 SendViewParameters(); << 167 SendViewParameters(); 159 << 168 160 //----- string for viewer invocation << 169 //----- string for viewer invocation 161 if(!strcmp(fG4PrimViewer, "NONE")) << 170 if ( !strcmp( fG4PrimViewer, "NONE" ) ) { 162 { << 171 163 strcpy(fG4PrimViewerInvocation, ""); << 172 strcpy( fG4PrimViewerInvocation, "" ); 164 } << 173 } else { 165 else << 174 166 { << 175 strcpy( fG4PrimViewerInvocation, fG4PrimViewer ); 167 strcpy(fG4PrimViewerInvocation, fG4PrimV << 176 strcat( fG4PrimViewerInvocation, " "); 168 strcat(fG4PrimViewerInvocation, " "); << 177 strcat( fG4PrimViewerInvocation, fSceneHandler.GetG4PrimFileName() ); 169 strcat(fG4PrimViewerInvocation, fSceneHa << 178 } 170 } << 179 171 << 180 172 //----- Invoke DAWN << 181 //----- Invoke DAWN 173 G4cout << G4endl; << 182 G4cout << G4endl ; 174 if(false == G4FRofstream::DoesFileExist(fS << 183 if( false == G4FRofstream::DoesFileExist( fSceneHandler.GetG4PrimFileName() ) ) 175 { << 184 { 176 G4cout << "ERROR: Failed to generate fil << 185 G4cout << "ERROR: Failed to generate file "; 177 G4cout << fSceneHandler.GetG4PrimFileNam << 186 G4cout << fSceneHandler.GetG4PrimFileName() << G4endl; 178 } << 187 179 else if(strcmp(GetG4PrimViewerInvocation() << 188 } else if( strcmp( GetG4PrimViewerInvocation(), "" ) ) 180 { << 189 { 181 G4cout << "File " << fSceneHandler.GetG << 190 G4cout << "File " << fSceneHandler.GetG4PrimFileName() ; 182 G4cout << " is generated." << G4endl; << 191 G4cout << " is generated." << G4endl; 183 G4cout << GetG4PrimViewerInvocation() << << 192 G4cout << GetG4PrimViewerInvocation() << G4endl; 184 int iErr = system(GetG4PrimViewerInvocat << 193 system( GetG4PrimViewerInvocation() ); 185 if(iErr != 0) << 194 186 { << 195 } else { // no view, i.e., only file generation 187 G4ExceptionDescription ed; << 196 G4cout << "File " << fSceneHandler.GetG4PrimFileName() ; 188 ed << "Error " << iErr << " when calli << 197 G4cout << " is generated." << G4endl; 189 << GetG4PrimViewerInvocation() << " << 198 G4cout << "No viewer is invoked." << G4endl; 190 G4Exception("G4DAWNFILEViewer::ShowVie << 199 } 191 ed); << 200 192 } << 201 } 193 } << 194 else << 195 { // no view, i.e., only file generation << 196 G4cout << "File " << fSceneHandler.GetG << 197 G4cout << " is generated." << G4endl; << 198 G4cout << "No viewer is invoked." << G4e << 199 } << 200 } << 201 202 202 } // G4DAWNFILEViewer::ShowView() << 203 } // G4DAWNFILEViewer::ShowView() 203 204 204 //----- G4DAWNFILEViewer::SendDrawingStyleToDA << 205 205 void G4DAWNFILEViewer::SendDrawingStyleToDAWNG << 206 //----- G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI( std::ostream& out ) >> 207 void G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI( std::ostream& out ) 206 { 208 { 207 /////////////////////// << 209 /////////////////////// 208 //#if defined DEBUG_FR_VIEW << 210 //#if defined DEBUG_FR_VIEW 209 // G4cout << "***** G4DAWNFILEViewer::SendD << 211 // G4cout << "***** G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI()" << G4endl; 210 //#endif << 212 //#endif 211 ////////////////////// << 213 ////////////////////// 212 << 214 213 G4int style = fVP.GetDrawingStyle(); << 215 G4int style = fVP.GetDrawingStyle(); 214 << 216 215 enum << 217 enum { FR_WIREFRAME = 1, FR_WF_STORED = 2, FR_HID =3 , \ 216 { << 218 FR_HID2 = 4, FR_HID3 = 5, FR_DRAWING_MODE_END = 6 }; 217 FR_WIREFRAME_STYLE = 1, << 219 218 FR_WF_STORED_STYLE = 2, << 220 switch( style ) 219 FR_HID_STYLE = 3, << 221 { 220 FR_HID2_STYLE = 4, << 222 case G4ViewParameters::wireframe: 221 FR_HID3_STYLE = 5, << 223 out << FR_WIREFRAME << G4endl; 222 FR_DRAWING_MODE_END_STYLE = 6 << 224 break; 223 }; << 225 case G4ViewParameters::hlr: 224 << 226 out << FR_HID2 << G4endl; // LINE 225 switch(style) << 227 break; 226 { << 228 case G4ViewParameters::hsr: 227 case G4ViewParameters::wireframe: << 229 case G4ViewParameters::hlhsr: 228 out << FR_WIREFRAME_STYLE << G4endl; << 230 out << FR_HID << G4endl; // SURFACE 229 break; << 231 break; 230 case G4ViewParameters::hlr: << 232 default: 231 out << FR_HID2_STYLE << G4endl; // LINE << 233 out << FR_WIREFRAME << G4endl; 232 break; << 234 break; 233 case G4ViewParameters::hsr: << 235 } 234 case G4ViewParameters::hlhsr: << 235 out << FR_HID_STYLE << G4endl; // SURFA << 236 break; << 237 default: << 238 out << FR_WIREFRAME_STYLE << G4endl; << 239 break; << 240 } << 241 236 242 } // G4DAWNFILEViewer::SendDrawingStyle() << 237 } // G4DAWNFILEViewer::SendDrawingStyle() 243 238 244 //----- << 239 245 void G4DAWNFILEViewer::SendViewParameters() << 240 >> 241 //----- >> 242 void G4DAWNFILEViewer::SendViewParameters () 246 { 243 { 247 // Calculates view representation based on e 244 // Calculates view representation based on extent of object being 248 // viewed and (initial) direction of camera. 245 // viewed and (initial) direction of camera. (Note: it can change 249 // later due to user interaction via visuali 246 // later due to user interaction via visualization system's GUI.) 250 247 251 #if defined DEBUG_FR_VIEW 248 #if defined DEBUG_FR_VIEW 252 if(G4VisManager::GetVerbosity() >= G4VisMana << 249 if (G4VisManager::GetVerbosity() >= G4VisManager::errors) { 253 { << 250 G4cout << "***** G4DAWNFILEViewer::SendViewParameters() "; 254 G4cout << "***** G4DAWNFILEViewer::SendVie << 255 G4cout << "(GUI parameters)" << G4endl; 251 G4cout << "(GUI parameters)" << G4endl; 256 } 252 } 257 #endif << 253 #endif 258 << 259 //----- Magic number to decide camera distan << 260 const G4double HOW_FAR = 1000.0; // << 261 const G4double MIN_HALF_ANGLE = 0.01; << 262 const G4double MAX_HALF_ANGLE = 0.499 * pi; << 263 << 264 //----- CALC camera distance << 265 //..... Note: Camera cannot enter inside obj << 266 G4double camera_distance; << 267 G4double radius = fSceneHandler.GetScene()-> << 268 << 269 G4double half_view_angle = std::fabs(fVP.Get << 270 if(half_view_angle > MAX_HALF_ANGLE) << 271 { << 272 half_view_angle = MAX_HALF_ANGLE; << 273 } << 274 254 275 if(half_view_angle < MIN_HALF_ANGLE) << 255 //----- Magic number to decide camera distance automatically 276 { << 256 const G4double HOW_FAR = 1000.0 ; // to define "infinity" 277 //----- infinity (or ortho projection) << 257 const G4double MIN_HALF_ANGLE = 0.01 ; 278 camera_distance = radius * HOW_FAR; << 258 const G4double MAX_HALF_ANGLE = 0.499 * pi ; 279 } << 259 280 else << 260 //----- CALC camera distance 281 { << 261 //..... Note: Camera cannot enter inside object 282 //----- Calc camera distance from half vie << 262 G4double camera_distance ; 283 camera_distance = radius / std::sin(half_v << 263 G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius(); 284 camera_distance -= fVP.GetDolly(); << 264 285 } << 265 G4double half_view_angle = std::fabs ( fVP.GetFieldHalfAngle () ) ; 286 << 266 if( half_view_angle > MAX_HALF_ANGLE ) { 287 if(camera_distance < radius) << 267 half_view_angle = MAX_HALF_ANGLE ; 288 { << 268 } 289 if(G4VisManager::GetVerbosity() >= G4VisMa << 269 290 { << 270 if( half_view_angle < MIN_HALF_ANGLE ) { 291 G4cout << "WARNING from DAWNFILE driver: << 271 //----- infinity (or ortho projection) 292 G4cout << " Camera cannot enter inside << 272 camera_distance = radius * HOW_FAR ; 293 } << 273 } else { 294 camera_distance = radius; << 274 //----- Calc camera distance from half view angle 295 } << 275 camera_distance = radius / std::sin ( half_view_angle ); >> 276 camera_distance -= fVP.GetDolly(); >> 277 } >> 278 >> 279 if ( camera_distance < radius ) { >> 280 if (G4VisManager::GetVerbosity() >= G4VisManager::errors) { >> 281 G4cout << "WARNING from DAWNFILE driver:" << G4endl; >> 282 G4cout << " Camera cannot enter inside objects" << G4endl; >> 283 } >> 284 camera_distance = radius ; >> 285 } >> 286 >> 287 //----- CALC camera direction >> 288 const G4Vector3D& camera_direction \ >> 289 = fVP.GetViewpointDirection().unit(); >> 290 const G4double v_angle = (180.0 / pi) * camera_direction.theta() ; >> 291 const G4double h_angle = (180.0 / pi) * camera_direction.phi () ; >> 292 >> 293 >> 294 //########### Generation of the file .DAWN.history for DAWN GUI >> 295 //----- >> 296 std::ofstream gui_out (".DAWN_1.history") ; >> 297 >> 298 // ######### P1 >> 299 >> 300 //----- camera position >> 301 gui_out << camera_distance << G4endl; >> 302 gui_out << v_angle << G4endl ; >> 303 gui_out << h_angle << G4endl ; >> 304 gui_out << "0" << G4endl ; // auto target >> 305 >> 306 //----- target point >> 307 const G4Point3D& target_point >> 308 = fSceneHandler.GetScene()->GetStandardTargetPoint() >> 309 + fVP.GetCurrentTargetPoint(); >> 310 gui_out << target_point.x() << G4endl ; >> 311 gui_out << target_point.y() << G4endl ; >> 312 gui_out << target_point.z() << G4endl ; >> 313 >> 314 //----- Magnification >> 315 const G4double zoom_factor = fVP.GetZoomFactor(); >> 316 if( half_view_angle < MIN_HALF_ANGLE ) { >> 317 >> 318 gui_out << zoom_factor << G4endl; >> 319 >> 320 } else { >> 321 const G4double FR_HALF_SCREEN_SIZE = 0.5 ; >> 322 G4double focal_distance \ >> 323 = FR_HALF_SCREEN_SIZE / std::tan( half_view_angle ); >> 324 focal_distance *= zoom_factor ; >> 325 >> 326 gui_out << "fd" << focal_distance << G4endl; >> 327 >> 328 } >> 329 SendDrawingStyleToDAWNGUI( gui_out ) ; // gui_out, viewing mode >> 330 gui_out << "0.001" << G4endl ; // 3D Tolerance >> 331 gui_out << "0" << G4endl ; // not display parameters >> 332 >> 333 >> 334 // ######### P2 >> 335 gui_out << 1 << G4endl; // Source light >> 336 gui_out << 1 << G4endl; >> 337 gui_out << 1 << G4endl; >> 338 gui_out << 0.5 << G4endl; // Ambient light >> 339 gui_out << 0.5 << G4endl; >> 340 gui_out << 0.5 << G4endl; >> 341 gui_out << 19.0 << G4endl; // Light direction (Polar) >> 342 gui_out << 71.0 << G4endl; // Light direction (Azimuthal) >> 343 >> 344 // ######### P3 >> 345 gui_out << 0.1 << G4endl; // Real edge width >> 346 gui_out << 0.1 << G4endl; // outline width >> 347 gui_out << 0.1 << G4endl; // aux edge width >> 348 gui_out << 3 << G4endl; // aux edge style >> 349 gui_out << 70.0<< G4endl; // aux-edge threshold angle >> 350 gui_out << 0.1 << G4endl; // line width >> 351 gui_out << 0 << G4endl; // haloing >> 352 gui_out << 1 << G4endl; // Dashed edged for back faces 296 353 297 //----- CALC camera direction << 354 //######### P4 298 const G4Vector3D& camera_direction = fVP.Get << 355 //----- drawing device 299 const G4double v_angle = (180.0 << 300 const G4double h_angle = (180.0 << 301 << 302 //########### Generation of the file .DAWN.h << 303 //----- << 304 std::ofstream gui_out(".DAWN_1.history"); << 305 << 306 // ######### P1 << 307 << 308 //----- camera position << 309 gui_out << camera_distance << G4endl; << 310 gui_out << v_angle << G4endl; << 311 gui_out << h_angle << G4endl; << 312 gui_out << "0" << G4endl; // auto target << 313 << 314 //----- target point << 315 const G4Point3D& target_point = << 316 fSceneHandler.GetScene()->GetStandardTarge << 317 fVP.GetCurrentTargetPoint(); << 318 gui_out << target_point.x() << G4endl; << 319 gui_out << target_point.y() << G4endl; << 320 gui_out << target_point.z() << G4endl; << 321 << 322 //----- Magnification << 323 const G4double zoom_factor = fVP.GetZoomFact << 324 if(half_view_angle < MIN_HALF_ANGLE) << 325 { << 326 gui_out << zoom_factor << G4endl; << 327 } << 328 else << 329 { << 330 const G4double FR_HALF_SCREEN_SIZE = 0.5; << 331 G4double focal_distance = FR_HALF_SCREEN_S << 332 focal_distance *= zoom_factor; << 333 << 334 gui_out << "fd" << focal_distance << G4end << 335 } << 336 SendDrawingStyleToDAWNGUI(gui_out); // gui_ << 337 gui_out << "0.001" << G4endl; // 3D T << 338 gui_out << "0" << G4endl; // not << 339 << 340 // ######### P2 << 341 gui_out << 1 << G4endl; // Source light << 342 gui_out << 1 << G4endl; << 343 gui_out << 1 << G4endl; << 344 gui_out << 0.5 << G4endl; // Ambient light << 345 gui_out << 0.5 << G4endl; << 346 gui_out << 0.5 << G4endl; << 347 gui_out << 19.0 << G4endl; // Light directi << 348 gui_out << 71.0 << G4endl; // Light directi << 349 << 350 // ######### P3 << 351 gui_out << 0.1 << G4endl; // Real edge wid << 352 gui_out << 0.1 << G4endl; // outline wid << 353 gui_out << 0.1 << G4endl; // aux edge wid << 354 gui_out << 3 << G4endl; // aux edge sty << 355 gui_out << 70.0 << G4endl; // aux-edge thre << 356 gui_out << 0.1 << G4endl; // line width << 357 gui_out << 0 << G4endl; // haloing << 358 gui_out << 1 << G4endl; // Dashed edged << 359 << 360 //######### P4 << 361 //----- drawing device << 362 // enum {PS=1, XWIN=2, PS2=3, XWIN2=4, OPEN 356 // enum {PS=1, XWIN=2, PS2=3, XWIN2=4, OPEN_GL=5, DEVICE_END=6}; 363 if(((std::getenv(FR_ENV_MULTI_WINDOW) != NUL << 357 if( ( ( getenv( FR_ENV_MULTI_WINDOW ) != NULL ) && \ 364 (strcmp(std::getenv(FR_ENV_MULTI_WINDOW) << 358 ( strcmp( getenv( FR_ENV_MULTI_WINDOW ),"0" ) ) ) || \ 365 ((std::getenv(FR_ENV_MULTI_WINDOW2) != NU << 359 ( ( getenv( FR_ENV_MULTI_WINDOW2 ) != NULL ) && \ 366 (strcmp(std::getenv(FR_ENV_MULTI_WINDOW2 << 360 ( strcmp( getenv( FR_ENV_MULTI_WINDOW2 ),"0" ) ) ) ) 367 { << 361 { 368 gui_out << 2 << G4endl; // OpenWindow << 362 gui_out << 2 << G4endl; // OpenWindow 369 } << 363 } else { 370 else << 364 gui_out << 1 << G4endl; // Invoke PS viewer 371 { << 365 } 372 gui_out << 1 << G4endl; // Invoke PS view << 366 373 } << 367 gui_out << GetPSViewer() << G4endl; // PS viewer >> 368 gui_out << 1 << G4endl ; // Do not add showpage >> 369 gui_out << 0 << G4endl ; // Non-append mode 374 370 375 gui_out << GetPSViewer() << G4endl; // PS v << 371 gui_out.close(); 376 gui_out << 1 << G4endl; // Do n << 372 //########### end of generating file .DAWN.history 377 gui_out << 0 << G4endl; // Non- << 378 373 379 gui_out.close(); << 374 380 //########### end of generating file .DAWN.h << 375 } 381 } << 382 376