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