34#define G4DAWNFILE_STRUCTURE_PRIORITY 1.
66 sceneHandler.IncrementViewCount (),
68 fSceneHandler (sceneHandler)
71 strcpy( fG4PrimViewer,
"dawn" );
72 if( getenv(
"G4DAWNFILE_VIEWER" ) != NULL ) {
73 strcpy( fG4PrimViewer, getenv(
"G4DAWNFILE_VIEWER" ) ) ;
77 if ( !strcmp( fG4PrimViewer,
"NONE" ) ) {
79 strcpy( fG4PrimViewerInvocation,
"" );
82 strcpy( fG4PrimViewerInvocation, fG4PrimViewer );
83 strcat( fG4PrimViewerInvocation,
" ");
89 strcpy( fPSViewer,
"gv" );
90 if( getenv(
"G4DAWNFILE_PS_VIEWER" ) != NULL ) {
91 strcpy( fPSViewer, getenv(
"G4DAWNFILE_PS_VIEWER" ) ) ;
103#if defined DEBUG_FR_VIEW
105 G4cout <<
"***** G4DAWNFILEViewer::SetView(): No effects" <<
G4endl;
116#if defined DEBUG_FR_VIEW
118 G4cout <<
"***** G4DAWNFILEViewer::ClearView (): No effects " <<
G4endl;
120 if (fSceneHandler.fPrimDest.
IsOpen()) {
121 fSceneHandler.fPrimDest.
Close();
123 fSceneHandler.fPrimDest.
Open(fSceneHandler.fG4PrimFileName);
125 fSceneHandler.FRflag_in_modeling =
false;
134#if defined DEBUG_FR_VIEW
136 G4cout <<
"***** G4DAWNFILEViewer::DrawView () " <<
G4endl;
154#if defined DEBUG_FR_VIEW
156 G4cout <<
"***** G4DAWNFILEViewer::ShowView () " <<
G4endl;
170 if ( !strcmp( fG4PrimViewer,
"NONE" ) ) {
172 strcpy( fG4PrimViewerInvocation,
"" );
175 strcpy( fG4PrimViewerInvocation, fG4PrimViewer );
176 strcat( fG4PrimViewerInvocation,
" ");
185 G4cout <<
"ERROR: Failed to generate file ";
217 enum { FR_WIREFRAME_STYLE = 1, FR_WF_STORED_STYLE = 2,
218 FR_HID_STYLE = 3, FR_HID2_STYLE = 4,
219 FR_HID3_STYLE = 5, FR_DRAWING_MODE_END_STYLE = 6 };
224 out << FR_WIREFRAME_STYLE <<
G4endl;
227 out << FR_HID2_STYLE <<
G4endl;
231 out << FR_HID_STYLE <<
G4endl;
234 out << FR_WIREFRAME_STYLE <<
G4endl;
249#if defined DEBUG_FR_VIEW
251 G4cout <<
"***** G4DAWNFILEViewer::SendViewParameters() ";
258 const G4double MIN_HALF_ANGLE = 0.01 ;
259 const G4double MAX_HALF_ANGLE = 0.499 * pi ;
267 if( half_view_angle > MAX_HALF_ANGLE ) {
268 half_view_angle = MAX_HALF_ANGLE ;
271 if( half_view_angle < MIN_HALF_ANGLE ) {
273 camera_distance = radius * HOW_FAR ;
276 camera_distance = radius / std::sin ( half_view_angle );
280 if ( camera_distance < radius ) {
283 G4cout <<
" Camera cannot enter inside objects" <<
G4endl;
285 camera_distance = radius ;
291 const G4double v_angle = (180.0 / pi) * camera_direction.theta() ;
292 const G4double h_angle = (180.0 / pi) * camera_direction.phi () ;
297 std::ofstream gui_out (
".DAWN_1.history") ;
302 gui_out << camera_distance <<
G4endl;
303 gui_out << v_angle <<
G4endl ;
304 gui_out << h_angle <<
G4endl ;
305 gui_out <<
"0" <<
G4endl ;
311 gui_out << target_point.
x() <<
G4endl ;
312 gui_out << target_point.
y() <<
G4endl ;
313 gui_out << target_point.
z() <<
G4endl ;
317 if( half_view_angle < MIN_HALF_ANGLE ) {
319 gui_out << zoom_factor <<
G4endl;
322 const G4double FR_HALF_SCREEN_SIZE = 0.5 ;
324 = FR_HALF_SCREEN_SIZE / std::tan( half_view_angle );
325 focal_distance *= zoom_factor ;
327 gui_out <<
"fd" << focal_distance <<
G4endl;
331 gui_out <<
"0.001" <<
G4endl ;
332 gui_out <<
"0" <<
G4endl ;
342 gui_out << 19.0 <<
G4endl;
343 gui_out << 71.0 <<
G4endl;
const char FR_ENV_MULTI_WINDOW2[]
const char FR_ENV_MULTI_WINDOW[]
const char FR_G4_PRIM_HEADER[]
G4DLLIMPORT 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