33#define G4DAWNFILE_STRUCTURE_PRIORITY 1.
65 sceneHandler.IncrementViewCount (),
67 fSceneHandler (sceneHandler)
70 strcpy( fG4PrimViewer,
"dawn" );
71 if( std::getenv(
"G4DAWNFILE_VIEWER" ) != NULL ) {
72 strcpy( fG4PrimViewer, std::getenv(
"G4DAWNFILE_VIEWER" ) ) ;
76 if ( !strcmp( fG4PrimViewer,
"NONE" ) ) {
78 strcpy( fG4PrimViewerInvocation,
"" );
81 strcpy( fG4PrimViewerInvocation, fG4PrimViewer );
82 strcat( fG4PrimViewerInvocation,
" ");
88 strcpy( fPSViewer,
"gv" );
89 if( std::getenv(
"G4DAWNFILE_PS_VIEWER" ) != NULL ) {
90 strcpy( fPSViewer, std::getenv(
"G4DAWNFILE_PS_VIEWER" ) ) ;
102#if defined DEBUG_FR_VIEW
104 G4cout <<
"***** G4DAWNFILEViewer::SetView(): No effects" <<
G4endl;
115#if defined DEBUG_FR_VIEW
117 G4cout <<
"***** G4DAWNFILEViewer::ClearView (): No effects " <<
G4endl;
119 if (fSceneHandler.fPrimDest.
IsOpen()) {
120 fSceneHandler.fPrimDest.
Close();
122 fSceneHandler.fPrimDest.
Open(fSceneHandler.fG4PrimFileName);
124 fSceneHandler.FRflag_in_modeling =
false;
133#if defined DEBUG_FR_VIEW
135 G4cout <<
"***** G4DAWNFILEViewer::DrawView () " <<
G4endl;
153#if defined DEBUG_FR_VIEW
155 G4cout <<
"***** G4DAWNFILEViewer::ShowView () " <<
G4endl;
169 if ( !strcmp( fG4PrimViewer,
"NONE" ) ) {
171 strcpy( fG4PrimViewerInvocation,
"" );
174 strcpy( fG4PrimViewerInvocation, fG4PrimViewer );
175 strcat( fG4PrimViewerInvocation,
" ");
184 G4cout <<
"ERROR: Failed to generate file ";
195 ed <<
"Error " << iErr
224 enum { FR_WIREFRAME_STYLE = 1, FR_WF_STORED_STYLE = 2,
225 FR_HID_STYLE = 3, FR_HID2_STYLE = 4,
226 FR_HID3_STYLE = 5, FR_DRAWING_MODE_END_STYLE = 6 };
231 out << FR_WIREFRAME_STYLE <<
G4endl;
234 out << FR_HID2_STYLE <<
G4endl;
238 out << FR_HID_STYLE <<
G4endl;
241 out << FR_WIREFRAME_STYLE <<
G4endl;
256#if defined DEBUG_FR_VIEW
258 G4cout <<
"***** G4DAWNFILEViewer::SendViewParameters() ";
265 const G4double MIN_HALF_ANGLE = 0.01 ;
266 const G4double MAX_HALF_ANGLE = 0.499 * pi ;
274 if( half_view_angle > MAX_HALF_ANGLE ) {
275 half_view_angle = MAX_HALF_ANGLE ;
278 if( half_view_angle < MIN_HALF_ANGLE ) {
280 camera_distance = radius * HOW_FAR ;
283 camera_distance = radius / std::sin ( half_view_angle );
287 if ( camera_distance < radius ) {
290 G4cout <<
" Camera cannot enter inside objects" <<
G4endl;
292 camera_distance = radius ;
298 const G4double v_angle = (180.0 / pi) * camera_direction.theta() ;
299 const G4double h_angle = (180.0 / pi) * camera_direction.phi () ;
304 std::ofstream gui_out (
".DAWN_1.history") ;
309 gui_out << camera_distance <<
G4endl;
310 gui_out << v_angle <<
G4endl ;
311 gui_out << h_angle <<
G4endl ;
312 gui_out <<
"0" <<
G4endl ;
318 gui_out << target_point.
x() <<
G4endl ;
319 gui_out << target_point.
y() <<
G4endl ;
320 gui_out << target_point.
z() <<
G4endl ;
324 if( half_view_angle < MIN_HALF_ANGLE ) {
326 gui_out << zoom_factor <<
G4endl;
329 const G4double FR_HALF_SCREEN_SIZE = 0.5 ;
331 = FR_HALF_SCREEN_SIZE / std::tan( half_view_angle );
332 focal_distance *= zoom_factor ;
334 gui_out <<
"fd" << focal_distance <<
G4endl;
338 gui_out <<
"0.001" <<
G4endl ;
339 gui_out <<
"0" <<
G4endl ;
349 gui_out << 19.0 <<
G4endl;
350 gui_out << 71.0 <<
G4endl;
const char FR_ENV_MULTI_WINDOW2[]
const char FR_ENV_MULTI_WINDOW[]
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
const char FR_G4_PRIM_HEADER[]
G4GLOB_DLL std::ostream G4cout
void SendStr(const char *char_string)
const char * GetG4PrimFileName()
void SendViewParameters()
G4DAWNFILEViewer(G4DAWNFILESceneHandler &scene, const G4String &name="")
virtual ~G4DAWNFILEViewer()
const char * GetG4PrimViewerInvocation()
void SendDrawingStyleToDAWNGUI(std::ostream &out)
const char * GetPSViewer()
void Open(const char *filename)
static G4bool DoesFileExist(const char *filename)
const G4VisExtent & GetExtent() const
const G4Point3D & GetStandardTargetPoint() const
G4Scene * GetScene() const
const G4Vector3D & GetViewpointDirection() const
const G4Point3D & GetCurrentTargetPoint() const
G4double GetFieldHalfAngle() const
G4double GetZoomFactor() const
DrawingStyle GetDrawingStyle() const
G4double GetDolly() const
G4double GetExtentRadius() const
static Verbosity GetVerbosity()
BasicVector3D< T > unit() const