00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifdef G4VIS_BUILD_DAWN_DRIVER
00036
00037
00038
00039 #define __G_ANSI_C__
00040
00041
00042
00043
00044 #include <fstream>
00045 #include <string.h>
00046 #include "globals.hh"
00047 #include "G4VisManager.hh"
00048 #include "G4FRConst.hh"
00049 #include "G4FukuiRenderer.hh"
00050 #include "G4FukuiRendererSceneHandler.hh"
00051 #include "G4FukuiRendererViewer.hh"
00052 #include "G4Point3D.hh"
00053 #include "G4VisAttributes.hh"
00054 #include "G4Scene.hh"
00055 #include "G4Transform3D.hh"
00056 #include "G4Polyhedron.hh"
00057 #include "G4Box.hh"
00058 #include "G4Cons.hh"
00059 #include "G4Polyline.hh"
00060 #include "G4Trd.hh"
00061 #include "G4Tubs.hh"
00062 #include "G4Trap.hh"
00063 #include "G4Torus.hh"
00064 #include "G4Sphere.hh"
00065 #include "G4Para.hh"
00066 #include "G4Text.hh"
00067 #include "G4Circle.hh"
00068 #include "G4Square.hh"
00069 #include "G4VPhysicalVolume.hh"
00070
00071
00072 const char FR_ENV_CULL_INVISIBLE_OBJECTS [] = "G4DAWN_CULL_INVISIBLE_OBJECTS";
00073 const char FR_ENV_MULTI_WINDOW[] = "G4DAWN_MULTI_WINDOW" ;
00074
00076
00078
00079
00080
00081 G4FukuiRendererSceneHandler::G4FukuiRendererSceneHandler (G4FukuiRenderer& system,
00082 const G4String& name):
00083 G4VSceneHandler (system, fSceneIdCount++, name) ,
00084 fSystem (system) ,
00085 fPrimDest (system.GetPrimDest() ) ,
00086 FRflag_in_modeling (false) ,
00087 flag_saving_g4_prim (false) ,
00088 COMMAND_BUF_SIZE (G4FRClientServer::SEND_BUFMAX),
00089 fPrec (9), fPrec2 (16)
00090 {
00091
00092
00093 if( !fSystem.IsConnected() )
00094 {
00095 if ( getenv( FR_ENV_NAMED_PIPE_CONNECTION ) != NULL &&\
00096 strcmp( getenv( FR_ENV_NAMED_PIPE_CONNECTION ), "0" ) )
00097 {
00098
00099
00100 fSystem.UseBSDUnixDomainAuto();
00101 } else if( getenv( FR_ENV_SERVER_HOST_NAME ) == NULL )
00102 {
00103
00104
00105 fSystem.UseInetDomainAuto();
00106 } else {
00107
00108 fSystem.UseInetDomain();
00109 }
00110 }
00111
00112
00113 if( getenv( "G4DAWN_PRECISION" ) != NULL ) {
00114 sscanf( getenv("G4DAWN_PRECISION"), "%d", &fPrec ) ;
00115 } else {
00116 fPrec = 9 ;
00117 }
00118 fPrec2 = fPrec + 7 ;
00119
00120 }
00121
00122
00123
00124 G4FukuiRendererSceneHandler::~G4FukuiRendererSceneHandler ()
00125 {
00126 #if defined DEBUG_FR_SCENE
00127 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00128 G4cout << "***** ~G4FukuiRendererSceneHandler" << G4endl;
00129 #endif
00130 }
00131
00132
00133 void G4FukuiRendererSceneHandler::FRBeginModeling( void )
00134 {
00135 if( !FRIsInModeling() )
00136 {
00137 #if defined DEBUG_FR_SCENE
00138 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00139 G4cout << "***** G4FukuiRendererSceneHandler::FRBeginModeling (called & started)" << G4endl;
00140 #endif
00141
00142
00143
00144 BeginSavingG4Prim();
00145
00146
00147
00148 SendBoundingBox();
00149
00150
00151
00152
00153 if( ( getenv( FR_ENV_MULTI_WINDOW ) != NULL ) && \
00154 ( strcmp( getenv( FR_ENV_MULTI_WINDOW ),"0" ) ) )
00155 {
00156 ((G4FukuiRendererViewer*)fpViewer)->SendDevice( G4FukuiRendererViewer::FRDEV_XWIN ) ;
00157 } else {
00158 ((G4FukuiRendererViewer*)fpViewer)->SendDevice( G4FukuiRendererViewer::FRDEV_PS ) ;
00159 }
00160
00161
00162
00163
00164 ((G4FukuiRendererViewer*)fpViewer)->SendDrawingStyle() ;
00165
00166
00167
00168
00169
00170 ((G4FukuiRendererViewer*)fpViewer)->SendViewParameters();
00171
00172
00173
00174 #if defined DEBUG_FR_SCENE
00175 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00176 G4cout << "***** (!SetCamera in FRBeginModeling())" << G4endl;
00177 #endif
00178 SendStr( FR_SET_CAMERA );
00179
00180
00181
00182 #if defined DEBUG_FR_SCENE
00183 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00184 G4cout << "***** (!OpenDevice in FRBeginModeling())" << G4endl;
00185 #endif
00186 SendStr( FR_OPEN_DEVICE );
00187
00188
00189
00190 #if defined DEBUG_FR_SCENE
00191 if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
00192 G4cout << "***** (!BeginModeling in FRBeginModeling())" << G4endl;
00193 #endif
00194 SendStr( FR_BEGIN_MODELING ); FRflag_in_modeling = true ;
00195
00196 }
00197
00198 }
00199
00201
00203
00204 #define G4FRSCENEHANDLER G4FukuiRendererSceneHandler
00205 #include "G4FRSceneFunc.icc"
00206 #undef G4FRSCENEHANDLER
00207
00209
00211
00212
00213 G4int G4FukuiRendererSceneHandler::fSceneIdCount = 0;
00214
00215 #endif // G4VIS_BUILD_DAWN_DRIVER