32#define G4DAWNFILE_STRUCTURE_PRIORITY 1.
61 :
G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name)
62 , fSceneHandler(sceneHandler)
65 strcpy(fG4PrimViewer,
"dawn");
66 if(std::getenv(
"G4DAWNFILE_VIEWER") != NULL)
68 strcpy(fG4PrimViewer, std::getenv(
"G4DAWNFILE_VIEWER"));
72 if(!strcmp(fG4PrimViewer,
"NONE"))
74 strcpy(fG4PrimViewerInvocation,
"");
78 strcpy(fG4PrimViewerInvocation, fG4PrimViewer);
79 strcat(fG4PrimViewerInvocation,
" ");
85 strcpy(fPSViewer,
"gv");
86 if(std::getenv(
"G4DAWNFILE_PS_VIEWER") != NULL)
88 strcpy(fPSViewer, std::getenv(
"G4DAWNFILE_PS_VIEWER"));
98#if defined DEBUG_FR_VIEW
100 G4cout <<
"***** G4DAWNFILEViewer::SetView(): No effects" <<
G4endl;
109#if defined DEBUG_FR_VIEW
111 G4cout <<
"***** G4DAWNFILEViewer::ClearView (): No effects " <<
G4endl;
113 if(fSceneHandler.fPrimDest.
IsOpen())
115 fSceneHandler.fPrimDest.
Close();
117 fSceneHandler.fPrimDest.
Open(fSceneHandler.fG4PrimFileName);
119 fSceneHandler.FRflag_in_modeling =
false;
127#if defined DEBUG_FR_VIEW
129 G4cout <<
"***** G4DAWNFILEViewer::DrawView () " <<
G4endl;
145#if defined DEBUG_FR_VIEW
147 G4cout <<
"***** G4DAWNFILEViewer::ShowView () " <<
G4endl;
161 if(!strcmp(fG4PrimViewer,
"NONE"))
163 strcpy(fG4PrimViewerInvocation,
"");
167 strcpy(fG4PrimViewerInvocation, fG4PrimViewer);
168 strcat(fG4PrimViewerInvocation,
" ");
176 G4cout <<
"ERROR: Failed to generate file ";
188 ed <<
"Error " << iErr <<
" when calling system with \""
217 FR_WIREFRAME_STYLE = 1,
218 FR_WF_STORED_STYLE = 2,
222 FR_DRAWING_MODE_END_STYLE = 6
228 out << FR_WIREFRAME_STYLE <<
G4endl;
231 out << FR_HID2_STYLE <<
G4endl;
235 out << FR_HID_STYLE <<
G4endl;
238 out << FR_WIREFRAME_STYLE <<
G4endl;
251#if defined DEBUG_FR_VIEW
254 G4cout <<
"***** G4DAWNFILEViewer::SendViewParameters() ";
261 const G4double MIN_HALF_ANGLE = 0.01;
262 const G4double MAX_HALF_ANGLE = 0.499 * pi;
270 if(half_view_angle > MAX_HALF_ANGLE)
272 half_view_angle = MAX_HALF_ANGLE;
275 if(half_view_angle < MIN_HALF_ANGLE)
278 camera_distance = radius * HOW_FAR;
283 camera_distance = radius / std::sin(half_view_angle);
287 if(camera_distance < radius)
292 G4cout <<
" Camera cannot enter inside objects" <<
G4endl;
294 camera_distance = radius;
299 const G4double v_angle = (180.0 / pi) * camera_direction.
theta();
300 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;
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;
330 const G4double FR_HALF_SCREEN_SIZE = 0.5;
331 G4double focal_distance = FR_HALF_SCREEN_SIZE / std::tan(half_view_angle);
332 focal_distance *= zoom_factor;
334 gui_out <<
"fd" << focal_distance <<
G4endl;
337 gui_out <<
"0.001" <<
G4endl;
347 gui_out << 19.0 <<
G4endl;
348 gui_out << 71.0 <<
G4endl;
355 gui_out << 70.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