Import Geant4 11.0.0 source tree
This commit is contained in:
committed by
Ben Morgan
parent
6399a014b6
commit
80e2389dd8
@@ -19,6 +19,9 @@ committal in the CVS repository !
|
||||
History file for visualization/FukuiRenderer sub-category
|
||||
---------------------------------------------------------
|
||||
|
||||
26 August 2021 Ben Morgan (DAWN-V10-07-02)
|
||||
- Remove obsolete network FukuiRenderer driver
|
||||
|
||||
07 June 2021 John Allison (DAWN-V10-07-01)
|
||||
- Fix hidden function warning.
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
<< Portability >>
|
||||
|
||||
Compilation of DAWN-file and DAWN-network drivers
|
||||
are confirmed at the following platforms:
|
||||
|
||||
Linux, DEC, HP, AIX, Solaris, IRIX
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -33,23 +33,19 @@
|
||||
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
|
||||
//----- prototype
|
||||
class G4VSceneHandler ;
|
||||
|
||||
//----------------------------//
|
||||
//----- class G4DAWNFILE -----//
|
||||
//----------------------------//
|
||||
class G4DAWNFILE: public G4VGraphicsSystem {
|
||||
|
||||
public:
|
||||
G4DAWNFILE ();
|
||||
virtual ~G4DAWNFILE ();
|
||||
G4VSceneHandler* CreateSceneHandler (const G4String& name = "");
|
||||
G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name = "");
|
||||
|
||||
private:
|
||||
|
||||
//----- prototype
|
||||
class G4VSceneHandler;
|
||||
|
||||
//----------------------------//
|
||||
//----- class G4DAWNFILE -----//
|
||||
//----------------------------//
|
||||
class G4DAWNFILE : public G4VGraphicsSystem
|
||||
{
|
||||
public:
|
||||
G4DAWNFILE();
|
||||
virtual ~G4DAWNFILE();
|
||||
G4VSceneHandler* CreateSceneHandler(const G4String& name = "");
|
||||
G4VViewer* CreateViewer(G4VSceneHandler&, const G4String& name = "");
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -37,193 +37,139 @@
|
||||
#include "G4FRofstream.hh"
|
||||
#include "G4FRConst.hh"
|
||||
|
||||
|
||||
class G4VisAttributes ;
|
||||
class G4VisAttributes;
|
||||
class G4DAWNFILE;
|
||||
|
||||
|
||||
//-----
|
||||
class G4DAWNFILESceneHandler: public G4VSceneHandler {
|
||||
|
||||
//-----
|
||||
class G4DAWNFILESceneHandler : public G4VSceneHandler
|
||||
{
|
||||
friend class G4DAWNFILEViewer;
|
||||
|
||||
public:
|
||||
public:
|
||||
//----- constructor and destructor
|
||||
G4DAWNFILESceneHandler(G4DAWNFILE& system, const G4String& name = "");
|
||||
virtual ~G4DAWNFILESceneHandler();
|
||||
|
||||
//----- constructor and destructor
|
||||
G4DAWNFILESceneHandler (G4DAWNFILE& system, const G4String& name = "");
|
||||
virtual ~G4DAWNFILESceneHandler ();
|
||||
|
||||
//----- overriding base class methods
|
||||
//----- overriding base class methods
|
||||
using G4VSceneHandler::AddPrimitive;
|
||||
void AddPrimitive (const G4Polyline& line);
|
||||
void AddPrimitive (const G4Polyhedron& p);
|
||||
void AddPrimitive (const G4Text&);
|
||||
void AddPrimitive (const G4Circle&);
|
||||
void AddPrimitive (const G4Square&);
|
||||
void AddPrimitive(const G4Polyline& line);
|
||||
void AddPrimitive(const G4Polyhedron& p);
|
||||
void AddPrimitive(const G4Text&);
|
||||
void AddPrimitive(const G4Circle&);
|
||||
void AddPrimitive(const G4Square&);
|
||||
|
||||
void BeginPrimitives (const G4Transform3D& objectTransformation);
|
||||
void EndPrimitives ();
|
||||
void BeginPrimitives(const G4Transform3D& objectTransformation);
|
||||
void EndPrimitives();
|
||||
|
||||
using G4VSceneHandler::AddSolid;
|
||||
void AddSolid ( const G4Box& box );
|
||||
void AddSolid ( const G4Cons& cons );
|
||||
void AddSolid ( const G4Tubs& tubs );
|
||||
void AddSolid ( const G4Trd& trd );
|
||||
void AddSolid ( const G4Trap& trap );
|
||||
void AddSolid ( const G4Sphere& sphere );
|
||||
void AddSolid ( const G4Para& para );
|
||||
void AddSolid ( const G4Torus& torus );
|
||||
void AddSolid ( const G4VSolid& solid );
|
||||
void AddSolid(const G4Box& box);
|
||||
void AddSolid(const G4Cons& cons);
|
||||
void AddSolid(const G4Tubs& tubs);
|
||||
void AddSolid(const G4Trd& trd);
|
||||
void AddSolid(const G4Trap& trap);
|
||||
void AddSolid(const G4Sphere& sphere);
|
||||
void AddSolid(const G4Para& para);
|
||||
void AddSolid(const G4Torus& torus);
|
||||
void AddSolid(const G4VSolid& solid);
|
||||
|
||||
void ClearTransientStore(); // Used for triggering detector re-drawing.
|
||||
|
||||
//----- public methods inherent to this class
|
||||
void FRBeginModeling () ;
|
||||
void FREndModeling () ;
|
||||
G4bool FRIsInModeling () { return FRflag_in_modeling ; }
|
||||
//----- public methods inherent to this class
|
||||
void FRBeginModeling();
|
||||
void FREndModeling();
|
||||
G4bool FRIsInModeling() { return FRflag_in_modeling; }
|
||||
|
||||
G4bool IsSavingG4Prim ( void ) { return flag_saving_g4_prim ; }
|
||||
void BeginSavingG4Prim( void );
|
||||
void EndSavingG4Prim ( void ) ;
|
||||
void SetG4PrimFileName() ;
|
||||
G4bool IsSavingG4Prim(void) { return flag_saving_g4_prim; }
|
||||
void BeginSavingG4Prim(void);
|
||||
void EndSavingG4Prim(void);
|
||||
void SetG4PrimFileName();
|
||||
|
||||
G4DAWNFILE& GetSystem () { return fSystem ; }
|
||||
void SendBoundingBox ( void );
|
||||
const char* GetG4PrimFileName () { return fG4PrimFileName ; }
|
||||
G4DAWNFILE& GetSystem() { return fSystem; }
|
||||
void SendBoundingBox(void);
|
||||
const char* GetG4PrimFileName() { return fG4PrimFileName; }
|
||||
|
||||
private:
|
||||
//----- Utilities etc (common to DAWN and DAWNFILE drivers )
|
||||
G4bool SendVisAttributes(const G4VisAttributes* pAV);
|
||||
G4bool IsVisible(void);
|
||||
void SendTransformedCoordinates(void);
|
||||
void SendPhysVolName(void);
|
||||
void SendNdiv(void);
|
||||
|
||||
private:
|
||||
//----- public methods common to DAWN and DAWNFILE drivers
|
||||
public:
|
||||
void SendStr(const char* char_string);
|
||||
void SendStrInt(const char* char_string, G4int ival);
|
||||
void SendStrInt3(const char* char_string, G4int ival1, G4int ival2,
|
||||
G4int ival3);
|
||||
void SendStrInt4(const char* char_string, G4int ival1, G4int ival2,
|
||||
G4int ival3, G4int ival4);
|
||||
void SendStrDouble(const char* char_string, G4double dval);
|
||||
void SendStrDouble2(const char* char_string, G4double dval1, G4double dval2);
|
||||
void SendStrDouble3(const char* char_string, G4double dval1, G4double dval2,
|
||||
G4double dval3);
|
||||
|
||||
//----- Utilities etc (common to DAWN and DAWNFILE drivers )
|
||||
G4bool SendVisAttributes ( const G4VisAttributes* pAV );
|
||||
G4bool IsVisible ( void ) ;
|
||||
void SendTransformedCoordinates( void ) ;
|
||||
void SendPhysVolName ( void ) ;
|
||||
void SendNdiv ( void ) ;
|
||||
void SendStrDouble4(const char* char_string, G4double dval1, G4double dval2,
|
||||
G4double dval3, G4double dval4);
|
||||
|
||||
//----- public methods common to DAWN and DAWNFILE drivers
|
||||
public:
|
||||
void SendStr ( const char* char_string ) ;
|
||||
void SendStrInt( const char* char_string ,
|
||||
G4int ival );
|
||||
void SendStrInt3( const char* char_string ,
|
||||
G4int ival1 ,
|
||||
G4int ival2 ,
|
||||
G4int ival3 );
|
||||
void SendStrInt4( const char* char_string ,
|
||||
G4int ival1 ,
|
||||
G4int ival2 ,
|
||||
G4int ival3 ,
|
||||
G4int ival4 );
|
||||
void SendStrDouble( const char* char_string ,
|
||||
G4double dval );
|
||||
void SendStrDouble2( const char* char_string ,
|
||||
G4double dval1 ,
|
||||
G4double dval2 );
|
||||
void SendStrDouble3( const char* char_string ,
|
||||
G4double dval1 ,
|
||||
G4double dval2 ,
|
||||
G4double dval3 );
|
||||
void SendStrDouble5(const char* char_string, G4double dval1, G4double dval2,
|
||||
G4double dval3, G4double dval4, G4double dval5);
|
||||
|
||||
void SendStrDouble4( const char* char_string ,
|
||||
G4double dval1 ,
|
||||
G4double dval2 ,
|
||||
G4double dval3 ,
|
||||
G4double dval4 );
|
||||
void SendStrDouble6(const char* char_string, G4double dval1, G4double dval2,
|
||||
G4double dval3, G4double dval4, G4double dval5,
|
||||
G4double dval6);
|
||||
|
||||
void SendStrDouble5( const char* char_string ,
|
||||
G4double dval1 ,
|
||||
G4double dval2 ,
|
||||
G4double dval3 ,
|
||||
G4double dval4 ,
|
||||
G4double dval5 );
|
||||
void SendStrDouble7(const char* char_string, G4double dval1, G4double dval2,
|
||||
G4double dval3, G4double dval4, G4double dval5,
|
||||
G4double dval6, G4double dval7);
|
||||
|
||||
void SendStrDouble6( const char* char_string ,
|
||||
G4double dval1 ,
|
||||
G4double dval2 ,
|
||||
G4double dval3 ,
|
||||
G4double dval4 ,
|
||||
G4double dval5 ,
|
||||
G4double dval6 );
|
||||
void SendStrDouble11(const char* char_string, G4double dval1, G4double dval2,
|
||||
G4double dval3, G4double dval4, G4double dval5,
|
||||
G4double dval6, G4double dval7, G4double dval8,
|
||||
G4double dval9, G4double dval10, G4double dval11);
|
||||
|
||||
void SendStrDouble7( const char* char_string ,
|
||||
G4double dval1 ,
|
||||
G4double dval2 ,
|
||||
G4double dval3 ,
|
||||
G4double dval4 ,
|
||||
G4double dval5 ,
|
||||
G4double dval6 ,
|
||||
G4double dval7 );
|
||||
void SendIntDouble3(G4int ival, G4double dval1, G4double dval2,
|
||||
G4double dval3);
|
||||
void SendInt3Str(G4int ival1, G4int ival2, G4int ival3,
|
||||
const char* char_string);
|
||||
void SendInt4Str(G4int ival1, G4int ival2, G4int ival3, G4int ival4,
|
||||
const char* char_string);
|
||||
|
||||
void SendStrDouble11( const char* char_string ,
|
||||
G4double dval1 ,
|
||||
G4double dval2 ,
|
||||
G4double dval3 ,
|
||||
G4double dval4 ,
|
||||
G4double dval5 ,
|
||||
G4double dval6 ,
|
||||
G4double dval7 ,
|
||||
G4double dval8 ,
|
||||
G4double dval9 ,
|
||||
G4double dval10 ,
|
||||
G4double dval11 ) ;
|
||||
void SendStrDouble3Str(const char* char_string1, G4double dval1,
|
||||
G4double dval2, G4double dval3,
|
||||
const char* char_string2);
|
||||
|
||||
void SendIntDouble3( G4int ival ,
|
||||
G4double dval1 ,
|
||||
G4double dval2 ,
|
||||
G4double dval3 );
|
||||
void SendInt3Str( G4int ival1 ,
|
||||
G4int ival2 ,
|
||||
G4int ival3 ,
|
||||
const char* char_string );
|
||||
void SendInt4Str( G4int ival1 ,
|
||||
G4int ival2 ,
|
||||
G4int ival3 ,
|
||||
G4int ival4 ,
|
||||
const char* char_string );
|
||||
void SendStrDouble6Str(const char* char_string1, G4double dval1,
|
||||
G4double dval2, G4double dval3, G4double dval4,
|
||||
G4double dval5, G4double dval6,
|
||||
const char* char_string2);
|
||||
|
||||
void SendStrDouble3Str( const char* char_string1 ,
|
||||
G4double dval1 ,
|
||||
G4double dval2 ,
|
||||
G4double dval3 ,
|
||||
const char* char_string2 );
|
||||
void SendInt(G4int val);
|
||||
void SendDouble(G4double val);
|
||||
|
||||
void SendStrDouble6Str( const char* char_string1 ,
|
||||
G4double dval1 ,
|
||||
G4double dval2 ,
|
||||
G4double dval3 ,
|
||||
G4double dval4 ,
|
||||
G4double dval5 ,
|
||||
G4double dval6 ,
|
||||
const char* char_string2 );
|
||||
private:
|
||||
G4DAWNFILE& fSystem; // Graphics system for this scene.
|
||||
static G4int fSceneIdCount;
|
||||
|
||||
void SendInt ( G4int val );
|
||||
void SendDouble( G4double val );
|
||||
G4FRofstream fPrimDest; // defined here
|
||||
G4bool FRflag_in_modeling;
|
||||
// true: FR_BEGIN_MODELING has sent to DAWN, and
|
||||
// FR_END_MODELING has not sent yet.
|
||||
// false: otherwise
|
||||
//
|
||||
// FRflag_in_modeling is set to "true"
|
||||
// in FRBeginModeling(), and to "false"
|
||||
// in FREndModeling().
|
||||
|
||||
private:
|
||||
G4DAWNFILE& fSystem; // Graphics system for this scene.
|
||||
static G4int fSceneIdCount;
|
||||
G4bool flag_saving_g4_prim;
|
||||
|
||||
G4FRofstream fPrimDest ; // defined here
|
||||
G4bool FRflag_in_modeling ;
|
||||
// true: FR_BEGIN_MODELING has sent to DAWN, and
|
||||
// FR_END_MODELING has not sent yet.
|
||||
// false: otherwise
|
||||
//
|
||||
// FRflag_in_modeling is set to "true"
|
||||
// in FRBeginModeling(), and to "false"
|
||||
// in FREndModeling().
|
||||
const int COMMAND_BUF_SIZE;
|
||||
|
||||
G4bool flag_saving_g4_prim ;
|
||||
char fG4PrimDestDir[256];
|
||||
char fG4PrimFileName[256];
|
||||
G4int fMaxFileNum;
|
||||
|
||||
const int COMMAND_BUF_SIZE ;
|
||||
|
||||
char fG4PrimDestDir [256] ;
|
||||
char fG4PrimFileName[256] ;
|
||||
G4int fMaxFileNum ;
|
||||
|
||||
G4int fPrec, fPrec2 ;
|
||||
|
||||
G4int fPrec, fPrec2;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -34,37 +34,45 @@
|
||||
#include "G4VViewer.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4DAWNFILESceneHandler ;
|
||||
class G4DAWNFILESceneHandler;
|
||||
|
||||
class G4DAWNFILEViewer: public G4VViewer {
|
||||
class G4DAWNFILEViewer : public G4VViewer
|
||||
{
|
||||
enum FRDEV
|
||||
{
|
||||
FRDEV_PS = 1,
|
||||
FRDEV_XWIN = 2,
|
||||
FRDEV_PS2 = 3,
|
||||
FRDEV_XWIN2 = 4,
|
||||
FRDEV_OPEN_GL = 5,
|
||||
FRDEV_DEVICE_END = 6
|
||||
};
|
||||
|
||||
enum FRDEV {FRDEV_PS=1, FRDEV_XWIN=2, FRDEV_PS2=3, FRDEV_XWIN2=4, FRDEV_OPEN_GL=5, FRDEV_DEVICE_END=6} ;
|
||||
public:
|
||||
//----- constructor and destructor
|
||||
G4DAWNFILEViewer(G4DAWNFILESceneHandler& scene, const G4String& name = "");
|
||||
virtual ~G4DAWNFILEViewer();
|
||||
|
||||
public:
|
||||
//----- constructor and destructor
|
||||
G4DAWNFILEViewer (G4DAWNFILESceneHandler& scene, const G4String& name = "");
|
||||
virtual ~G4DAWNFILEViewer ();
|
||||
//----- overriding base class methods
|
||||
void SetView(); // Do nothing. SendViewParameters will do its job.
|
||||
void ClearView();
|
||||
void DrawView();
|
||||
void ShowView();
|
||||
|
||||
//----- overriding base class methods
|
||||
void SetView (); // Do nothing. SendViewParameters will do its job.
|
||||
void ClearView ();
|
||||
void DrawView ();
|
||||
void ShowView ();
|
||||
//---- methods inherent to this class
|
||||
void SendViewParameters();
|
||||
const char* GetG4PrimViewer() { return fG4PrimViewer; }
|
||||
const char* GetG4PrimViewerInvocation() { return fG4PrimViewerInvocation; }
|
||||
const char* GetPSViewer() { return fPSViewer; }
|
||||
void SendDrawingStyleToDAWNGUI(std::ostream& out);
|
||||
|
||||
//---- methods inherent to this class
|
||||
void SendViewParameters () ;
|
||||
const char* GetG4PrimViewer () { return fG4PrimViewer ;}
|
||||
const char* GetG4PrimViewerInvocation() { return fG4PrimViewerInvocation ;}
|
||||
const char* GetPSViewer () { return fPSViewer ;}
|
||||
void SendDrawingStyleToDAWNGUI( std::ostream& out ) ;
|
||||
|
||||
private:
|
||||
G4DAWNFILESceneHandler& fSceneHandler; // Reference to Graphics Scene for this view.
|
||||
|
||||
char fG4PrimViewer [32] ;
|
||||
char fG4PrimViewerInvocation[64] ;
|
||||
char fPSViewer [32] ;
|
||||
private:
|
||||
G4DAWNFILESceneHandler&
|
||||
fSceneHandler; // Reference to Graphics Scene for this view.
|
||||
|
||||
char fG4PrimViewer[32];
|
||||
char fG4PrimViewerInvocation[64];
|
||||
char fPSViewer[32];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,141 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// Satoshi TANAKA, Wed Jul 3 14:13:52 JST 1996
|
||||
////////////////////////////////
|
||||
///// G4FRClientServer.h /////
|
||||
////////////////////////////////
|
||||
|
||||
//=================//
|
||||
#if defined (G4VIS_BUILD_DAWN_DRIVER) || defined (G4VIS_USE_DAWN)
|
||||
//=================//
|
||||
|
||||
|
||||
#if !defined G4FR_CLIENT_SERVER_H
|
||||
#define G4FR_CLIENT_SERVER_H
|
||||
|
||||
#include<sys/types.h>
|
||||
#include<sys/socket.h>
|
||||
#include<netinet/in.h>
|
||||
#include<arpa/inet.h>
|
||||
#include<netdb.h>
|
||||
#include<sys/un.h>
|
||||
#include<unistd.h>
|
||||
#include<stdio.h>
|
||||
#include<stdlib.h>
|
||||
#include<string.h>
|
||||
#include"G4ios.hh"
|
||||
|
||||
|
||||
//----- constants
|
||||
const char FR_ENV_SERVER_HOST_NAME[] = "G4DAWN_HOST_NAME" ;
|
||||
const char FR_ENV_NAMED_PIPE_CONNECTION[] = "G4DAWN_NAMED_PIPE" ;
|
||||
|
||||
//-----------------------------------//
|
||||
//----- class G4FRClientServer -----//
|
||||
//-----------------------------------//
|
||||
|
||||
class G4FRClientServer {
|
||||
public:
|
||||
enum { SEND_BUFMAX = 1024 , RECV_BUFMAX = 1024 };
|
||||
enum { SUN_PATH_MAX = 16 };
|
||||
|
||||
protected:
|
||||
const char TERMINATOR ;
|
||||
const char END_OF_LINE;
|
||||
char SUN_PATH[ SUN_PATH_MAX ];
|
||||
int PORT_NUMBER ;
|
||||
int fSocketFd ;
|
||||
|
||||
char fReceivedMessage [ RECV_BUFMAX ];
|
||||
char fSendingMessage [ SEND_BUFMAX ];
|
||||
|
||||
protected:
|
||||
|
||||
void Err( const char* message ) { perror(message) ;}
|
||||
void SetSendingMessage( const char* message )
|
||||
{ strcpy( fSendingMessage, message );}
|
||||
void Send() ; // send command in fSendingMessage
|
||||
|
||||
public:
|
||||
//----- Server
|
||||
int AcceptUnix(){ return 0;} // made unfunctioned
|
||||
int AcceptINET(){ return 0 ;} // made unfunctioned
|
||||
|
||||
//----- Client
|
||||
int ConnectUnix();
|
||||
int ConnectINET();
|
||||
|
||||
//----- Common to server and client
|
||||
|
||||
//---------- (1)
|
||||
G4FRClientServer ( char terminator = '.' ,
|
||||
char end_line = '\n' ) ;
|
||||
virtual ~G4FRClientServer () {;}
|
||||
void SetSunPath( const char* sun_path )
|
||||
{ strcpy ( SUN_PATH, sun_path ); }
|
||||
void SetPortNumber( int port_num )
|
||||
{ PORT_NUMBER = port_num ; }
|
||||
void IncrementPortNumber( int incr = 1 )
|
||||
{ PORT_NUMBER += incr ; }
|
||||
const char* GetSendingMessage() const
|
||||
{ return fSendingMessage ;}
|
||||
int GetSendingMessageLength() const
|
||||
{ return strlen(fSendingMessage) ;}
|
||||
void SetReceivedMessage( const char* message )
|
||||
{ strcpy( fReceivedMessage, message );}
|
||||
const char* GetReceivedMessage() const
|
||||
{ return fReceivedMessage ;}
|
||||
int GetReceivedMessageLength() const
|
||||
{ return strlen(fReceivedMessage) ;}
|
||||
int GetSofd() const { return fSocketFd ; }
|
||||
int GetPortNumber () const { return PORT_NUMBER ; }
|
||||
void ClearReceivedMessage ()
|
||||
{ memset(fReceivedMessage, '\0', RECV_BUFMAX) ; }
|
||||
|
||||
int IsTerminator(char ch ) { return ( ch == TERMINATOR ); }
|
||||
char GetTerminator() const { return TERMINATOR ; }
|
||||
int IsEndOfLine (char ch ) { return ( ch == END_OF_LINE ); }
|
||||
char GetEndOfLine() const { return END_OF_LINE ; }
|
||||
void DisConnect();
|
||||
void Clear();
|
||||
void WaitSendBack( const char* command_string ) ;
|
||||
|
||||
//---------- (2) send and receive
|
||||
virtual void Send ( const char* message ) ;
|
||||
virtual void SendLine ( const char* message ) ;
|
||||
// Add END_OF_LINE if the message does not
|
||||
// Terminate with it. And then send the message.
|
||||
virtual void Receive() ;
|
||||
virtual void ReceiveLine() ;
|
||||
|
||||
}; // G4FRClientServer
|
||||
|
||||
|
||||
#endif
|
||||
#endif //G4VIS_BUILD_DAWN_DRIVER
|
||||
|
||||
@@ -30,166 +30,166 @@
|
||||
///// G4FRConst.hh /////
|
||||
///////////////////////////////////
|
||||
|
||||
#if !defined G4_FR_COMMAND_LIST_HH
|
||||
#ifndef G4_FR_COMMAND_LIST_HH
|
||||
#define G4_FR_COMMAND_LIST_HH
|
||||
|
||||
//----- Header comment
|
||||
const char FR_G4_PRIM_HEADER [] = "##G4.PRIM-FORMAT-2.4" ;
|
||||
//const char FR_PHYSICAL_VOLUME_NAME [] = "#/PhysicalVolumeName" ;
|
||||
const char FR_PHYSICAL_VOLUME_NAME [] = "#/PVName" ;
|
||||
//----- Header comment
|
||||
const char FR_G4_PRIM_HEADER[] = "##G4.PRIM-FORMAT-2.4";
|
||||
// const char FR_PHYSICAL_VOLUME_NAME [] = "#/PhysicalVolumeName" ;
|
||||
const char FR_PHYSICAL_VOLUME_NAME[] = "#/PVName";
|
||||
|
||||
//----- Execution control (beginning with !)
|
||||
const char FR_GUI [] = "!GraphicalUserInterface" ;
|
||||
const char FR_DEVICE [] = "!Device" ;
|
||||
const char FR_SET_CAMERA [] = "!SetCamera" ;
|
||||
const char FR_OPEN_DEVICE [] = "!OpenDevice" ;
|
||||
const char FR_CLOSE_DEVICE [] = "!CloseDevice" ;
|
||||
const char FR_DRAW_ALL [] = "!DrawAll" ;
|
||||
const char FR_CLEAR_DATA [] = "!ClearData" ;
|
||||
const char FR_QUIT [] = "!Quit" ;
|
||||
const char FR_DISCONNECT_DAWND [] = "!DisconnectDawnd" ;
|
||||
const char FR_TERMINATE_DAWND [] = "!TerminateDawnd" ;
|
||||
const char FR_SAVE [] = "!Save" ;
|
||||
const char FR_END_SAVE [] = "!EndSave" ;
|
||||
const char FR_WAIT [] = "!Wait" ;
|
||||
const char FR_PAUSE [] = "!Pause" ;
|
||||
//----- Execution control (beginning with !)
|
||||
const char FR_GUI[] = "!GraphicalUserInterface";
|
||||
const char FR_DEVICE[] = "!Device";
|
||||
const char FR_SET_CAMERA[] = "!SetCamera";
|
||||
const char FR_OPEN_DEVICE[] = "!OpenDevice";
|
||||
const char FR_CLOSE_DEVICE[] = "!CloseDevice";
|
||||
const char FR_DRAW_ALL[] = "!DrawAll";
|
||||
const char FR_CLEAR_DATA[] = "!ClearData";
|
||||
const char FR_QUIT[] = "!Quit";
|
||||
const char FR_DISCONNECT_DAWND[] = "!DisconnectDawnd";
|
||||
const char FR_TERMINATE_DAWND[] = "!TerminateDawnd";
|
||||
const char FR_SAVE[] = "!Save";
|
||||
const char FR_END_SAVE[] = "!EndSave";
|
||||
const char FR_WAIT[] = "!Wait";
|
||||
const char FR_PAUSE[] = "!Pause";
|
||||
|
||||
//----- Drawing Style
|
||||
const char FR_WIREFRAME [] = "/Wireframe" ;
|
||||
const char FR_SURFACE [] = "/Surface" ;
|
||||
const char FR_LINES [] = "/Lines" ;
|
||||
//----- Drawing Style
|
||||
const char FR_WIREFRAME[] = "/Wireframe";
|
||||
const char FR_SURFACE[] = "/Surface";
|
||||
const char FR_LINES[] = "/Lines";
|
||||
|
||||
//----- Begin and End of Modeling
|
||||
const char FR_BEGIN_MODELING [] = "!BeginModeling" ;
|
||||
const char FR_END_MODELING [] = "!EndModeling" ;
|
||||
//----- Begin and End of Modeling
|
||||
const char FR_BEGIN_MODELING[] = "!BeginModeling";
|
||||
const char FR_END_MODELING[] = "!EndModeling";
|
||||
|
||||
//----- Bounding box
|
||||
const char FR_BOUNDING_BOX [] = "/BoundingBox" ;
|
||||
const char FR_BOUNDING_BOX_UNIT [] = "/BoundingBox -0.5 -0.5 -0.5 0.5 0.5 0.5" ;
|
||||
//----- Bounding box
|
||||
const char FR_BOUNDING_BOX[] = "/BoundingBox";
|
||||
const char FR_BOUNDING_BOX_UNIT[] = "/BoundingBox -0.5 -0.5 -0.5 0.5 0.5 0.5";
|
||||
|
||||
//----- Number of divising curved surface
|
||||
const int FR_DEFALUT_NDIV_VALUE = 24 ;
|
||||
//----- Number of divising curved surface
|
||||
const int FR_DEFALUT_NDIV_VALUE = 24;
|
||||
|
||||
const char FR_NDIV [] = "/Ndiv" ;
|
||||
const char FR_NDIV_DEFAULT [] = "/Ndiv 24" ;
|
||||
const char FR_NDIV_3 [] = "/Ndiv 3" ;
|
||||
const char FR_NDIV_4 [] = "/Ndiv 4" ;
|
||||
const char FR_NDIV_8 [] = "/Ndiv 8" ;
|
||||
const char FR_NDIV_16 [] = "/Ndiv 16" ;
|
||||
const char FR_NDIV_24 [] = "/Ndiv 24" ;
|
||||
const char FR_NDIV_48 [] = "/Ndiv 48" ;
|
||||
const char FR_NDIV_96 [] = "/Ndiv 96" ;
|
||||
const char FR_NDIV[] = "/Ndiv";
|
||||
const char FR_NDIV_DEFAULT[] = "/Ndiv 24";
|
||||
const char FR_NDIV_3[] = "/Ndiv 3";
|
||||
const char FR_NDIV_4[] = "/Ndiv 4";
|
||||
const char FR_NDIV_8[] = "/Ndiv 8";
|
||||
const char FR_NDIV_16[] = "/Ndiv 16";
|
||||
const char FR_NDIV_24[] = "/Ndiv 24";
|
||||
const char FR_NDIV_48[] = "/Ndiv 48";
|
||||
const char FR_NDIV_96[] = "/Ndiv 96";
|
||||
|
||||
//----- Camera information
|
||||
const char FR_CAMERA_POSITION[] = "/CameraPosition" ;
|
||||
const char FR_CAMERA_POSITION_DEFAULT[] = "/CameraPosition 100000.0 0.0 0.0" ;
|
||||
// see from far upward position
|
||||
const char FR_TARGET_POINT [] = "/TargetPoint";
|
||||
const char FR_ZOOM_FACTOR [] = "/ZoomFactor";
|
||||
const char FR_SCALE [] = "/Scale";
|
||||
const char FR_FOCAL_DISTANCE [] = "/FocalDistance";
|
||||
//----- Camera information
|
||||
const char FR_CAMERA_POSITION[] = "/CameraPosition";
|
||||
const char FR_CAMERA_POSITION_DEFAULT[] = "/CameraPosition 100000.0 0.0 0.0";
|
||||
// see from far upward position
|
||||
const char FR_TARGET_POINT[] = "/TargetPoint";
|
||||
const char FR_ZOOM_FACTOR[] = "/ZoomFactor";
|
||||
const char FR_SCALE[] = "/Scale";
|
||||
const char FR_FOCAL_DISTANCE[] = "/FocalDistance";
|
||||
|
||||
//----- Body coordinate information
|
||||
const char FR_BASE_VECTOR [] = "/BaseVector" ;
|
||||
// Give e1 and e2. Then e3 is calculated.
|
||||
const char FR_BASE_VECTOR_DEFAULT [] = "/BaseVector 1.0 0.0 0.0 0.0 1.0 0.0" ;
|
||||
const char FR_ORIGIN [] = "/Origin" ;
|
||||
const char FR_ORIGIN_DEFAULT [] = "/Origin 0.0 0.0 0.0" ;
|
||||
//----- Body coordinate information
|
||||
const char FR_BASE_VECTOR[] = "/BaseVector";
|
||||
// Give e1 and e2. Then e3 is calculated.
|
||||
const char FR_BASE_VECTOR_DEFAULT[] = "/BaseVector 1.0 0.0 0.0 0.0 1.0 0.0";
|
||||
const char FR_ORIGIN[] = "/Origin";
|
||||
const char FR_ORIGIN_DEFAULT[] = "/Origin 0.0 0.0 0.0";
|
||||
|
||||
//----- Attribute information
|
||||
const char FR_DIFFUSE_RGB [] = "/DiffuseRGB" ;
|
||||
// old name of /ColorRGB
|
||||
//----- Attribute information
|
||||
const char FR_DIFFUSE_RGB[] = "/DiffuseRGB";
|
||||
// old name of /ColorRGB
|
||||
|
||||
const char FR_COLOR_RGB [] = "/ColorRGB" ;
|
||||
const char FR_COLOR_RGB_DEFAULT [] = "/ColorRGB 1.0 1.0 1.0" ;
|
||||
const char FR_COLOR_RGB_WHITE [] = "/ColorRGB 1.0 1.0 1.0" ;
|
||||
const char FR_COLOR_RGB[] = "/ColorRGB";
|
||||
const char FR_COLOR_RGB_DEFAULT[] = "/ColorRGB 1.0 1.0 1.0";
|
||||
const char FR_COLOR_RGB_WHITE[] = "/ColorRGB 1.0 1.0 1.0";
|
||||
|
||||
const char FR_COLOR_RGB_RED [] = "/ColorRGB 1.0 0.0 0.0" ;
|
||||
const char FR_COLOR_RGB_GREEN [] = "/ColorRGB 0.0 1.0 0.0" ;
|
||||
const char FR_COLOR_RGB_BLUE [] = "/ColorRGB 0.0 0.0 1.0" ;
|
||||
const char FR_COLOR_RGB_RED[] = "/ColorRGB 1.0 0.0 0.0";
|
||||
const char FR_COLOR_RGB_GREEN[] = "/ColorRGB 0.0 1.0 0.0";
|
||||
const char FR_COLOR_RGB_BLUE[] = "/ColorRGB 0.0 0.0 1.0";
|
||||
|
||||
const char FR_COLOR_RGB_CYAN [] = "/ColorRGB 0.0 1.0 1.0" ;
|
||||
const char FR_COLOR_RGB_MAGENTA [] = "/ColorRGB 1.0 0.0 1.0" ;
|
||||
const char FR_COLOR_RGB_YELLOW [] = "/ColorRGB 1.0 1.0 0.0" ;
|
||||
const char FR_COLOR_RGB_CYAN[] = "/ColorRGB 0.0 1.0 1.0";
|
||||
const char FR_COLOR_RGB_MAGENTA[] = "/ColorRGB 1.0 0.0 1.0";
|
||||
const char FR_COLOR_RGB_YELLOW[] = "/ColorRGB 1.0 1.0 0.0";
|
||||
|
||||
const char FR_SPECULAR_RGB [] = "/SpecularRGB" ;
|
||||
const char FR_SPECULAR_RGB_DEFAULT [] = "/SpecularRGB 1.0 1.0 1.0" ;
|
||||
const char FR_SPECULAR_RGB_WHITE [] = "/SpecularRGB 1.0 1.0 1.0" ;
|
||||
const char FR_SPECULAR_RGB[] = "/SpecularRGB";
|
||||
const char FR_SPECULAR_RGB_DEFAULT[] = "/SpecularRGB 1.0 1.0 1.0";
|
||||
const char FR_SPECULAR_RGB_WHITE[] = "/SpecularRGB 1.0 1.0 1.0";
|
||||
|
||||
const char FR_PHONG_POWER [] = "/PhongPower" ;
|
||||
const char FR_PHONG_POWER_DEFAULT [] = "/PhongPower 3" ;
|
||||
const char FR_PHONG_POWER[] = "/PhongPower";
|
||||
const char FR_PHONG_POWER_DEFAULT[] = "/PhongPower 3";
|
||||
|
||||
const char FR_TRANSPARENCY [] = "/Transparency" ;
|
||||
const char FR_TRANSPARENCY_ON [] = "/Transparency 1 " ; // transparent
|
||||
const char FR_TRANSPARENCY_OFF [] = "/Transparency 0 " ; // non-transparent
|
||||
const char FR_TRANSPARENCY[] = "/Transparency";
|
||||
const char FR_TRANSPARENCY_ON[] = "/Transparency 1 "; // transparent
|
||||
const char FR_TRANSPARENCY_OFF[] = "/Transparency 0 "; // non-transparent
|
||||
|
||||
const char FR_FORCE_WIREFRAME [] = "/ForceWireframe" ;
|
||||
const char FR_FORCE_WIREFRAME_ON [] = "/ForceWireframe 1" ;
|
||||
const char FR_FORCE_WIREFRAME_OFF [] = "/ForceWireframe 0" ;
|
||||
const char FR_FORCE_WIREFRAME[] = "/ForceWireframe";
|
||||
const char FR_FORCE_WIREFRAME_ON[] = "/ForceWireframe 1";
|
||||
const char FR_FORCE_WIREFRAME_OFF[] = "/ForceWireframe 0";
|
||||
|
||||
const char FR_VISIBILITY [] = "/Visibility" ;
|
||||
const char FR_VISIBILITY_ON [] = "/Visibility 1" ; // visible
|
||||
const char FR_VISIBILITY_OFF [] = "/Visibility 0" ; // invisible
|
||||
const char FR_VISIBILITY[] = "/Visibility";
|
||||
const char FR_VISIBILITY_ON[] = "/Visibility 1"; // visible
|
||||
const char FR_VISIBILITY_OFF[] = "/Visibility 0"; // invisible
|
||||
|
||||
//----- 3D Primitives
|
||||
const char FR_POLYHEDRON [] = "/Polyhedron" ;
|
||||
const char FR_VERTEX [] = "/Vertex" ;
|
||||
const char FR_FACET [] = "/Facet" ;
|
||||
const char FR_END_POLYHEDRON [] = "/EndPolyhedron" ;
|
||||
//----- 3D Primitives
|
||||
const char FR_POLYHEDRON[] = "/Polyhedron";
|
||||
const char FR_VERTEX[] = "/Vertex";
|
||||
const char FR_FACET[] = "/Facet";
|
||||
const char FR_END_POLYHEDRON[] = "/EndPolyhedron";
|
||||
|
||||
const char FR_BOX [] = "/Box" ;
|
||||
const char FR_BOX_UNIT [] = "/Box 0.5 0.5 0.5" ; // dx, dy, dz
|
||||
const char FR_BOX[] = "/Box";
|
||||
const char FR_BOX_UNIT[] = "/Box 0.5 0.5 0.5"; // dx, dy, dz
|
||||
|
||||
const char FR_COLUMN [] = "/Column" ;
|
||||
const char FR_COLUMN_UNIT [] = "/Column 0.5 0.5" ; // R dz
|
||||
const char FR_COLUMN[] = "/Column";
|
||||
const char FR_COLUMN_UNIT[] = "/Column 0.5 0.5"; // R dz
|
||||
|
||||
const char FR_POLYLINE [] = "/Polyline" ;
|
||||
const char FR_PL_VERTEX [] = "/PLVertex" ;
|
||||
const char FR_PL_VERTEX_OLD [] = "PLVertex" ;
|
||||
const char FR_END_POLYLINE [] = "/EndPolyline" ;
|
||||
const char FR_POLYLINE[] = "/Polyline";
|
||||
const char FR_PL_VERTEX[] = "/PLVertex";
|
||||
const char FR_PL_VERTEX_OLD[] = "PLVertex";
|
||||
const char FR_END_POLYLINE[] = "/EndPolyline";
|
||||
|
||||
const char FR_TRD [] = "/Trd" ;
|
||||
// /Trd dx1 dx2 dy1 dy2 dz ;
|
||||
const char FR_TRAP [] = "/Trap" ;
|
||||
// /Trap dz theta phi h1 bl1 tl1 alpha1 h2 bl2 tl2 alpha2
|
||||
const char FR_TUBS [] = "/Tubs" ;
|
||||
// /Tubs rmin rmax dz sphi dphi
|
||||
const char FR_CONS [] = "/Cons" ;
|
||||
// /Cons rmin1 rmax1 rmin2 rmax2 dz sphi dphi
|
||||
const char FR_SPHERE [] = "/Sphere" ;
|
||||
// /Sphere R
|
||||
const char FR_SPHERE_SEG [] = "/SphereSeg" ;
|
||||
// /SphereSeg rmin rmax s_theta d_theta s_phi d_phi
|
||||
const char FR_PARA [] = "/Parallelepiped" ;
|
||||
// /Parallelepiped dx dy dz tanAlpha tanTheta_cosPhi tanTheta_sinPhi
|
||||
const char FR_PCON [] = "/PolyCone" ;
|
||||
// /PolyCone sphi dphi nz z[nz] rmin[nz] rmax[nz]
|
||||
const char FR_PGON [] = "/PolyGon" ;
|
||||
// /PolyGon sphi dphi ndiv nz z[nz] rmin[nz] rmax[nz]
|
||||
const char FR_TORUS [] = "/Torus" ;
|
||||
// /PolyGon sphi dphi ndiv nz z[nz] rmin[nz] rmax[nz]
|
||||
const char FR_TRD[] = "/Trd";
|
||||
// /Trd dx1 dx2 dy1 dy2 dz ;
|
||||
const char FR_TRAP[] = "/Trap";
|
||||
// /Trap dz theta phi h1 bl1 tl1 alpha1 h2 bl2 tl2 alpha2
|
||||
const char FR_TUBS[] = "/Tubs";
|
||||
// /Tubs rmin rmax dz sphi dphi
|
||||
const char FR_CONS[] = "/Cons";
|
||||
// /Cons rmin1 rmax1 rmin2 rmax2 dz sphi dphi
|
||||
const char FR_SPHERE[] = "/Sphere";
|
||||
// /Sphere R
|
||||
const char FR_SPHERE_SEG[] = "/SphereSeg";
|
||||
// /SphereSeg rmin rmax s_theta d_theta s_phi d_phi
|
||||
const char FR_PARA[] = "/Parallelepiped";
|
||||
// /Parallelepiped dx dy dz tanAlpha tanTheta_cosPhi tanTheta_sinPhi
|
||||
const char FR_PCON[] = "/PolyCone";
|
||||
// /PolyCone sphi dphi nz z[nz] rmin[nz] rmax[nz]
|
||||
const char FR_PGON[] = "/PolyGon";
|
||||
// /PolyGon sphi dphi ndiv nz z[nz] rmin[nz] rmax[nz]
|
||||
const char FR_TORUS[] = "/Torus";
|
||||
// /PolyGon sphi dphi ndiv nz z[nz] rmin[nz] rmax[nz]
|
||||
|
||||
//----- Marks I (arg: x y z half_size_3d)
|
||||
const char FR_FONT_NAME [] = "/FontName" ;
|
||||
const char FR_FONT_NAME[] = "/FontName";
|
||||
|
||||
//----- Marks I (arg: x y z half_size_3d)
|
||||
const char FR_MARK_CIRCLE_2D [] = "/MarkCircle2D" ;
|
||||
const char FR_MARK_SQUARE_2D [] = "/MarkSquare2D" ;
|
||||
const char FR_MARK_TEXT_2D [] = "/MarkText2D" ;
|
||||
// /MarkText2D x y z size_world x_offset_world y_offset_world string
|
||||
const char FR_MARK_CIRCLE_2D[] = "/MarkCircle2D";
|
||||
const char FR_MARK_SQUARE_2D[] = "/MarkSquare2D";
|
||||
const char FR_MARK_TEXT_2D[] = "/MarkText2D";
|
||||
// /MarkText2D x y z size_world x_offset_world y_offset_world string
|
||||
|
||||
//----- Marks II (arg: x y z half_size_2d)
|
||||
const char FR_MARK_CIRCLE_2DS [] = "/MarkCircle2DS" ;
|
||||
const char FR_MARK_SQUARE_2DS [] = "/MarkSquare2DS" ;
|
||||
const char FR_MARK_TEXT_2DS [] = "/MarkText2DS" ;
|
||||
// /MarkText2DS x y z size_pt x_offset_pt y_offset_pt string
|
||||
const char FR_MARK_CIRCLE_2DS[] = "/MarkCircle2DS";
|
||||
const char FR_MARK_SQUARE_2DS[] = "/MarkSquare2DS";
|
||||
const char FR_MARK_TEXT_2DS[] = "/MarkText2DS";
|
||||
// /MarkText2DS x y z size_pt x_offset_pt y_offset_pt string
|
||||
|
||||
//----- Text
|
||||
const char FR_TEXT_2DS [] = "/Text2DS" ;
|
||||
const char FR_TEXT_2DS[] = "/Text2DS";
|
||||
|
||||
//----- For DAWNCUT
|
||||
const char FR_CLIPPING_PLANE [] = "/ClippingPlane" ;
|
||||
// /ClippingPlaneMarkCross2D a b c d
|
||||
// for plane ax + by + cz + d = 0
|
||||
const char FR_CLIPPING_PLANE[] = "/ClippingPlane";
|
||||
// /ClippingPlaneMarkCross2D a b c d
|
||||
// for plane ax + by + cz + d = 0
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
#if !defined G4_FR_FEATURES_HH
|
||||
#define G4_FR_FEATURES_HH
|
||||
|
||||
|
||||
const char FR_DAWN_FEATURES[] = "High quality technical renderer.\
|
||||
\n Features: exact hidden line, hidden surface algorithms.\
|
||||
\n high (unlimited) resolution.\
|
||||
\n renders to PostScript for viewing and/or hardcopy.\
|
||||
\n remote rendering.\
|
||||
\n off-line rendering.\
|
||||
\n graphical user interface.\
|
||||
\n connection via TCP/IP socket or named pipe Fukui Renderer DAWN.\
|
||||
\n Disadvantages: compute intensive, takes time (use a fast graphics\
|
||||
\n system, such as OpenGL, to select view, then copy\
|
||||
\n to this renderer - /vis~/copy/view, /vis~/set/view).";
|
||||
|
||||
|
||||
const char FR_DAWNFILE_FEATURES[] ="High quality technical renderer.\
|
||||
\n Features: exact hidden line, hidden surface algorithms.\
|
||||
\n high (unlimited) resolution.\
|
||||
\n renders to PostScript for viewing and/or hardcopy.\
|
||||
\n remote rendering.\
|
||||
\n off-line rendering.\
|
||||
\n graphical user interface.\
|
||||
\n connection via g4.prim file to Fukui Renderer DAWN,\
|
||||
\n DAVID (DAwn's Visual Intersection Debugger, etc.\
|
||||
\n Disadvantages: compute intensive, takes time (use a fast graphics\
|
||||
\n system, such as OpenGL, to select view, then copy\
|
||||
\n to this renderer - /vis~/copy/view, /vis~/set/view).";
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -25,100 +25,92 @@
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef G4_FR_OFSTREAM_HH
|
||||
#define G4_FR_OFSTREAM_HH
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#if !defined G4_FR_OFSTREAM_HH
|
||||
#define G4_FR_OFSTREAM_HH
|
||||
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
/////////////////////
|
||||
//typedef int G4bool ;
|
||||
//#define false 0 ;
|
||||
//#define true 1 ;
|
||||
////////////////////
|
||||
|
||||
class G4FRofstream {
|
||||
class G4FRofstream
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
SEND_BUFMAX = 1024
|
||||
};
|
||||
|
||||
public:
|
||||
enum { SEND_BUFMAX = 1024 };
|
||||
// constructors
|
||||
G4FRofstream() { flag_file_open = false; }
|
||||
G4FRofstream(const char* filename);
|
||||
|
||||
public:
|
||||
|
||||
// constructors
|
||||
G4FRofstream () { flag_file_open = false ; }
|
||||
G4FRofstream ( const char* filename ) ;
|
||||
// destructor
|
||||
virtual ~G4FRofstream();
|
||||
|
||||
// destructor
|
||||
virtual ~G4FRofstream ();
|
||||
// open and close
|
||||
void Open(const char* filename);
|
||||
void Close();
|
||||
G4bool IsOpen() { return flag_file_open; }
|
||||
|
||||
// open and close
|
||||
void Open ( const char* filename );
|
||||
void Close() ;
|
||||
G4bool IsOpen() { return flag_file_open ;}
|
||||
// utilities
|
||||
void SendLine(const char* string); // save string with new line
|
||||
|
||||
// utilities
|
||||
void SendLine( const char* string ) ; // save string with new line
|
||||
|
||||
// static functions
|
||||
static G4bool DoesFileExist( const char* filename ) ;
|
||||
// static functions
|
||||
static G4bool DoesFileExist(const char* filename);
|
||||
|
||||
protected:
|
||||
G4bool flag_file_open ;
|
||||
std::ofstream fout ;
|
||||
} ;
|
||||
G4bool flag_file_open;
|
||||
std::ofstream fout;
|
||||
};
|
||||
|
||||
|
||||
inline void G4FRofstream::Open ( const char* filename )
|
||||
{
|
||||
if( !IsOpen() ) {
|
||||
fout.open( filename ) ;
|
||||
flag_file_open = true ;
|
||||
}
|
||||
inline void G4FRofstream::Open(const char* filename)
|
||||
{
|
||||
if(!IsOpen())
|
||||
{
|
||||
fout.open(filename);
|
||||
flag_file_open = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void G4FRofstream::Close ()
|
||||
{
|
||||
if( IsOpen() ) {
|
||||
fout.close();
|
||||
flag_file_open = false ;
|
||||
}
|
||||
inline void G4FRofstream::Close()
|
||||
{
|
||||
if(IsOpen())
|
||||
{
|
||||
fout.close();
|
||||
flag_file_open = false;
|
||||
}
|
||||
}
|
||||
|
||||
inline void G4FRofstream::SendLine ( const char* message )
|
||||
inline void G4FRofstream::SendLine(const char* message)
|
||||
{
|
||||
if ( IsOpen() ) {
|
||||
fout << message << G4endl;
|
||||
}
|
||||
if(IsOpen())
|
||||
{
|
||||
fout << message << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline G4bool G4FRofstream::DoesFileExist ( const char* filename )
|
||||
inline G4bool G4FRofstream::DoesFileExist(const char* filename)
|
||||
{
|
||||
G4bool status = false ;
|
||||
G4bool status = false;
|
||||
|
||||
std::ifstream fout_tmp( filename ) ;
|
||||
if( fout_tmp ) { status = true ; }
|
||||
fout_tmp.close();
|
||||
std::ifstream fout_tmp(filename);
|
||||
if(fout_tmp)
|
||||
{
|
||||
status = true;
|
||||
}
|
||||
fout_tmp.close();
|
||||
|
||||
return status ;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
G4FRofstream::G4FRofstream ( const char* filename )
|
||||
inline G4FRofstream::G4FRofstream(const char* filename)
|
||||
{
|
||||
flag_file_open = false ;
|
||||
Open( filename );
|
||||
}
|
||||
|
||||
inline
|
||||
G4FRofstream::~G4FRofstream ()
|
||||
{
|
||||
Close() ;
|
||||
}
|
||||
flag_file_open = false;
|
||||
Open(filename);
|
||||
}
|
||||
|
||||
inline G4FRofstream::~G4FRofstream() { Close(); }
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Satoshi TANAKA
|
||||
// Fukui Renderer factory.
|
||||
|
||||
//=================//
|
||||
#if defined (G4VIS_BUILD_DAWN_DRIVER) || defined (G4VIS_USE_DAWN)
|
||||
//=================//
|
||||
|
||||
#ifndef G4FUKUI_RENDERER_HH
|
||||
#define G4FUKUI_RENDERER_HH
|
||||
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
#include "G4FRClientServer.hh"
|
||||
|
||||
//----- prototype
|
||||
class G4VSceneHandler ;
|
||||
|
||||
//---------------------------------//
|
||||
//----- class G4FukuiRenderer -----//
|
||||
//---------------------------------//
|
||||
class G4FukuiRenderer: public G4VGraphicsSystem {
|
||||
|
||||
public:
|
||||
G4FukuiRenderer ();
|
||||
virtual ~G4FukuiRenderer ();
|
||||
G4VSceneHandler* CreateSceneHandler (const G4String& name = "");
|
||||
G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name = "");
|
||||
|
||||
G4FRClientServer& GetPrimDest() { return fPrimDest ; }
|
||||
|
||||
//----- inter-process communication
|
||||
enum { IP_UNIX, IP_INET };
|
||||
enum { FR_MAX_PORT_INCR = 10 };
|
||||
G4bool IsUnixDomain() const { return (fIPMode == G4FukuiRenderer::IP_UNIX); }
|
||||
G4bool IsInetDomain() const { return (fIPMode == G4FukuiRenderer::IP_INET); }
|
||||
void UseInetDomainAuto();
|
||||
void UseInetDomain();
|
||||
void UseBSDUnixDomainAuto();
|
||||
void ConnectPort( int max_port_incr = FR_MAX_PORT_INCR);
|
||||
|
||||
G4bool IsGUIMode (void) { return flag_use_gui ; }
|
||||
G4bool IsConnected (void) { return flag_connected ; }
|
||||
|
||||
public:
|
||||
//----- inter-process communication
|
||||
G4FRClientServer fPrimDest ;
|
||||
|
||||
private:
|
||||
int fIPMode ;
|
||||
G4bool flag_use_gui ;
|
||||
G4int flag_connected ;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif //G4VIS_BUILD_DAWN_DRIVER
|
||||
@@ -1,238 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Satoshi TANAKA, Fri Jun 28 11:19:19 JST 1996
|
||||
|
||||
|
||||
//=================//
|
||||
#ifdef G4VIS_BUILD_DAWN_DRIVER
|
||||
//=================//
|
||||
|
||||
|
||||
#ifndef G4FUKUI_RENDERER_SCENE_HANDLER_HH
|
||||
#define G4FUKUI_RENDERER_SCENE_HANDLER_HH
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G4VSceneHandler.hh"
|
||||
|
||||
#include "G4FRClientServer.hh"
|
||||
#include "G4FRConst.hh"
|
||||
|
||||
class G4VisAttributes ;
|
||||
class G4FukuiRenderer;
|
||||
|
||||
//-----
|
||||
class G4FukuiRendererSceneHandler: public G4VSceneHandler {
|
||||
|
||||
public:
|
||||
|
||||
//----- constructor and destructor
|
||||
G4FukuiRendererSceneHandler (G4FukuiRenderer& system, const G4String& name = "");
|
||||
virtual ~G4FukuiRendererSceneHandler ();
|
||||
|
||||
//----- overriding base class methods
|
||||
using G4VSceneHandler::AddPrimitive;
|
||||
void AddPrimitive (const G4Polyline& line);
|
||||
void AddPrimitive (const G4Polyhedron& p);
|
||||
void AddPrimitive (const G4Text&);
|
||||
void AddPrimitive (const G4Circle&);
|
||||
void AddPrimitive (const G4Square&);
|
||||
|
||||
void BeginPrimitives (const G4Transform3D& objectTransformation);
|
||||
void EndPrimitives ();
|
||||
|
||||
using G4VSceneHandler::AddSolid;
|
||||
void AddSolid ( const G4Box& box );
|
||||
void AddSolid ( const G4Cons& cons );
|
||||
void AddSolid ( const G4Tubs& tubs );
|
||||
void AddSolid ( const G4Trd& trd );
|
||||
void AddSolid ( const G4Trap& trap );
|
||||
void AddSolid ( const G4Sphere& sphere );
|
||||
void AddSolid ( const G4Para& para );
|
||||
void AddSolid ( const G4Torus& torus );
|
||||
void AddSolid ( const G4VSolid& solid );
|
||||
|
||||
void ClearTransientStore(); // Used for triggering detector re-drawing.
|
||||
|
||||
//----- methods inherent to this class
|
||||
void FRBeginModeling () ;
|
||||
void FREndModeling () ;
|
||||
G4bool FRIsInModeling () { return FRflag_in_modeling ; }
|
||||
|
||||
G4bool IsSavingG4Prim ( void ) { return flag_saving_g4_prim ; }
|
||||
void BeginSavingG4Prim( void )
|
||||
{
|
||||
if( !IsSavingG4Prim() )
|
||||
{
|
||||
SendStr( FR_SAVE ) ;
|
||||
SendStr( FR_G4_PRIM_HEADER ) ;
|
||||
flag_saving_g4_prim = true ;
|
||||
}
|
||||
}
|
||||
void EndSavingG4Prim ( void )
|
||||
{ if( IsSavingG4Prim() ) { SendStr( FR_END_SAVE ); flag_saving_g4_prim = false ; } }
|
||||
|
||||
G4FRClientServer& GetPrimDest () { return fPrimDest ; }
|
||||
G4FukuiRenderer& GetSystem () { return fSystem ; }
|
||||
void SendBoundingBox ( void );
|
||||
|
||||
private:
|
||||
|
||||
//----- Utilities etc
|
||||
G4bool SendVisAttributes ( const G4VisAttributes* pAV );
|
||||
G4bool IsVisible ( void ) ;
|
||||
void SendTransformedCoordinates( void ) ;
|
||||
void SendPhysVolName ( void ) ;
|
||||
void SendNdiv ( void ) ;
|
||||
|
||||
public:
|
||||
|
||||
void SendStr ( const char* char_string ) ;
|
||||
void SendStrInt( const char* char_string ,
|
||||
G4int ival );
|
||||
void SendStrInt3( const char* char_string ,
|
||||
G4int ival1 ,
|
||||
G4int ival2 ,
|
||||
G4int ival3 );
|
||||
void SendStrInt4( const char* char_string ,
|
||||
G4int ival1 ,
|
||||
G4int ival2 ,
|
||||
G4int ival3 ,
|
||||
G4int ival4 );
|
||||
void SendStrDouble( const char* char_string ,
|
||||
G4double dval );
|
||||
void SendStrDouble2( const char* char_string ,
|
||||
G4double dval1 ,
|
||||
G4double dval2 );
|
||||
void SendStrDouble3( const char* char_string ,
|
||||
G4double dval1 ,
|
||||
G4double dval2 ,
|
||||
G4double dval3 );
|
||||
|
||||
void SendStrDouble4( const char* char_string ,
|
||||
G4double dval1 ,
|
||||
G4double dval2 ,
|
||||
G4double dval3 ,
|
||||
G4double dval4 );
|
||||
|
||||
void SendStrDouble5( const char* char_string ,
|
||||
G4double dval1 ,
|
||||
G4double dval2 ,
|
||||
G4double dval3 ,
|
||||
G4double dval4 ,
|
||||
G4double dval5 );
|
||||
|
||||
void SendStrDouble6( const char* char_string ,
|
||||
G4double dval1 ,
|
||||
G4double dval2 ,
|
||||
G4double dval3 ,
|
||||
G4double dval4 ,
|
||||
G4double dval5 ,
|
||||
G4double dval6 );
|
||||
|
||||
void SendStrDouble7( const char* char_string ,
|
||||
G4double dval1 ,
|
||||
G4double dval2 ,
|
||||
G4double dval3 ,
|
||||
G4double dval4 ,
|
||||
G4double dval5 ,
|
||||
G4double dval6 ,
|
||||
G4double dval7 );
|
||||
|
||||
void SendStrDouble11( const char* char_string ,
|
||||
G4double dval1 ,
|
||||
G4double dval2 ,
|
||||
G4double dval3 ,
|
||||
G4double dval4 ,
|
||||
G4double dval5 ,
|
||||
G4double dval6 ,
|
||||
G4double dval7 ,
|
||||
G4double dval8 ,
|
||||
G4double dval9 ,
|
||||
G4double dval10 ,
|
||||
G4double dval11 ) ;
|
||||
|
||||
void SendIntDouble3( G4int ival ,
|
||||
G4double dval1 ,
|
||||
G4double dval2 ,
|
||||
G4double dval3 );
|
||||
void SendInt3Str( G4int ival1 ,
|
||||
G4int ival2 ,
|
||||
G4int ival3 ,
|
||||
const char* char_string );
|
||||
void SendInt4Str( G4int ival1 ,
|
||||
G4int ival2 ,
|
||||
G4int ival3 ,
|
||||
G4int ival4 ,
|
||||
const char* char_string );
|
||||
|
||||
void SendStrDouble3Str( const char* char_string1 ,
|
||||
G4double dval1 ,
|
||||
G4double dval2 ,
|
||||
G4double dval3 ,
|
||||
const char* char_string2 );
|
||||
|
||||
void SendStrDouble6Str( const char* char_string1 ,
|
||||
G4double dval1 ,
|
||||
G4double dval2 ,
|
||||
G4double dval3 ,
|
||||
G4double dval4 ,
|
||||
G4double dval5 ,
|
||||
G4double dval6 ,
|
||||
const char* char_string2 );
|
||||
|
||||
void SendInt ( G4int val );
|
||||
void SendDouble( G4double val );
|
||||
|
||||
|
||||
|
||||
private:
|
||||
G4FukuiRenderer& fSystem; // Graphics system for this scene.
|
||||
static G4int fSceneIdCount;
|
||||
|
||||
G4FRClientServer& fPrimDest ; // defined in G4FukuiRenderer
|
||||
G4bool FRflag_in_modeling ;
|
||||
// true: FR_BEGIN_MODELING has sent to DAWN, and
|
||||
// FR_END_MODELING has not sent yet.
|
||||
// false: otherwise
|
||||
//
|
||||
// FRflag_in_modeling is set to "true"
|
||||
// in FRBeginModeling(), and to "false"
|
||||
// in FREndModeling().
|
||||
|
||||
G4bool flag_saving_g4_prim ;
|
||||
|
||||
const int COMMAND_BUF_SIZE ;
|
||||
|
||||
G4int fPrec, fPrec2 ;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif //G4VIS_BUILD_DAWN_DRIVER
|
||||
@@ -1,75 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Satoshi TANAKA, Fri Jun 28 12:10:14 JST 1996
|
||||
// FukuiRenderer viewer - opens window, hard copy, etc.
|
||||
|
||||
//=================//
|
||||
#ifdef G4VIS_BUILD_DAWN_DRIVER
|
||||
//=================//
|
||||
|
||||
|
||||
#ifndef G4FUKUI_RENDERER_VIEWER_HH
|
||||
#define G4FUKUI_RENDERER_VIEWER_HH
|
||||
|
||||
#include "G4VViewer.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4FukuiRendererSceneHandler ;
|
||||
|
||||
|
||||
class G4FukuiRendererViewer: public G4VViewer {
|
||||
|
||||
public:
|
||||
|
||||
enum FRDEV {FRDEV_PS=1, FRDEV_XWIN=2, FRDEV_PS2=3, FRDEV_XWIN2=4, FRDEV_OPEN_GL=5, FRDEV_DEVICE_END=6} ;
|
||||
|
||||
//----- constructor and destructor
|
||||
G4FukuiRendererViewer (G4FukuiRendererSceneHandler& scene, const G4String& name);
|
||||
virtual ~G4FukuiRendererViewer ();
|
||||
|
||||
//----- overriding base class methods
|
||||
void SetView (); // Do nothing. SendViewParameters will do its job.
|
||||
void ClearView ();
|
||||
void DrawView ();
|
||||
void ShowView ();
|
||||
|
||||
//---- methods inherent to this class
|
||||
void Wait() ;
|
||||
void SendViewParameters () ;
|
||||
|
||||
void SendDevice( FRDEV dev );
|
||||
void SendDrawingStyle() ;
|
||||
|
||||
private:
|
||||
|
||||
G4FukuiRendererSceneHandler& fSceneHandler; // Reference to Graphics Scene for this view.
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif //G4VIS_BUILD_DAWN_DRIVER
|
||||
@@ -30,6 +30,6 @@
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
G4String G4VisFeaturesOfDAWNFILE ();
|
||||
G4String G4VisFeaturesOfDAWNFILE();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef G4VISFEATURESOFFUKUIRENDERER_HH
|
||||
#define G4VISFEATURESOFFUKUIRENDERER_HH
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
G4String G4VisFeaturesOfFukuiRenderer ();
|
||||
|
||||
#endif
|
||||
@@ -1,50 +1,20 @@
|
||||
# - G4FR module build definition
|
||||
|
||||
# Module has optional sources
|
||||
# List those always built
|
||||
set(G4VIS_DAWN_MODULE_HEADERS
|
||||
G4DAWNFILE.hh
|
||||
G4DAWNFILESceneHandler.hh
|
||||
G4DAWNFILEViewer.hh
|
||||
G4FRConst.hh
|
||||
G4FRFeatures.hh
|
||||
G4FRSceneFunc.icc
|
||||
G4FRofstream.hh
|
||||
G4VisFeaturesOfDAWNFILE.hh
|
||||
G4VisFeaturesOfFukuiRenderer.hh)
|
||||
|
||||
set(G4VIS_DAWN_MODULE_SOURCES
|
||||
G4DAWNFILE.cc
|
||||
G4DAWNFILESceneHandler.cc
|
||||
G4DAWNFILEViewer.cc
|
||||
G4VisFeaturesOfDAWNFILE.cc
|
||||
G4VisFeaturesOfFukuiRenderer.cc)
|
||||
|
||||
# DAWN Network driver only built if user selected
|
||||
if(GEANT4_USE_NETWORKDAWN)
|
||||
list(APPEND G4VIS_DAWN_MODULE_HEADERS
|
||||
G4FRClientServer.hh
|
||||
G4FukuiRenderer.hh
|
||||
G4FukuiRendererSceneHandler.hh
|
||||
G4FukuiRendererViewer.hh)
|
||||
|
||||
list(APPEND G4VIS_DAWN_MODULE_SOURCES
|
||||
G4FRClientServer.cc
|
||||
G4FukuiRenderer.cc
|
||||
G4FukuiRendererSceneHandler.cc
|
||||
G4FukuiRendererViewer.cc)
|
||||
|
||||
# To activate the Fukui Renderer Network component, we need an
|
||||
# extra compile definition
|
||||
add_definitions(-DG4VIS_BUILD_DAWN_DRIVER)
|
||||
endif()
|
||||
|
||||
# Define the Geant4 Module.
|
||||
geant4_add_module(G4FR
|
||||
PUBLIC_HEADERS
|
||||
${G4VIS_DAWN_MODULE_HEADERS}
|
||||
G4DAWNFILE.hh
|
||||
G4DAWNFILESceneHandler.hh
|
||||
G4DAWNFILEViewer.hh
|
||||
G4FRConst.hh
|
||||
G4FRSceneFunc.icc
|
||||
G4FRofstream.hh
|
||||
G4VisFeaturesOfDAWNFILE.hh
|
||||
SOURCES
|
||||
${G4VIS_DAWN_MODULE_SOURCES})
|
||||
G4DAWNFILE.cc
|
||||
G4DAWNFILESceneHandler.cc
|
||||
G4DAWNFILEViewer.cc
|
||||
G4VisFeaturesOfDAWNFILE.cc)
|
||||
|
||||
geant4_module_link_libraries(G4FR
|
||||
PUBLIC
|
||||
|
||||
@@ -28,46 +28,39 @@
|
||||
// Satoshi TANAKA
|
||||
// DAWNFILE factory.
|
||||
|
||||
|
||||
//#define DEBUG_FR_SYSTEM
|
||||
|
||||
|
||||
#include "G4DAWNFILE.hh"
|
||||
|
||||
#define __G_ANSI_C__
|
||||
|
||||
//#include "G4VisFeaturesOfDAWNFILE.hh"
|
||||
#include "G4FRFeatures.hh"
|
||||
#include "G4VisFeaturesOfDAWNFILE.hh"
|
||||
#include "G4VSceneHandler.hh"
|
||||
#include "G4DAWNFILESceneHandler.hh"
|
||||
#include "G4DAWNFILEViewer.hh"
|
||||
#include "G4FRConst.hh"
|
||||
|
||||
|
||||
//----- G4DAWNFILE, constructor
|
||||
G4DAWNFILE::G4DAWNFILE ():
|
||||
G4VGraphicsSystem ("DAWNFILE",
|
||||
"DAWNFILE",
|
||||
FR_DAWNFILE_FEATURES,
|
||||
G4VGraphicsSystem::fileWriter)
|
||||
//----- G4DAWNFILE, constructor
|
||||
G4DAWNFILE::G4DAWNFILE()
|
||||
: G4VGraphicsSystem("DAWNFILE", "DAWNFILE", G4VisFeaturesOfDAWNFILE(),
|
||||
G4VGraphicsSystem::fileWriter)
|
||||
{}
|
||||
|
||||
//----- G4DAWNFILE, destructor
|
||||
G4DAWNFILE::~G4DAWNFILE ()
|
||||
{}
|
||||
//----- G4DAWNFILE, destructor
|
||||
G4DAWNFILE::~G4DAWNFILE() {}
|
||||
|
||||
|
||||
//----- G4DAWNFILE::CreateSceneHandler (const G4String& name)
|
||||
G4VSceneHandler* G4DAWNFILE::CreateSceneHandler (const G4String& name)
|
||||
//----- G4DAWNFILE::CreateSceneHandler (const G4String& name)
|
||||
G4VSceneHandler* G4DAWNFILE::CreateSceneHandler(const G4String& name)
|
||||
{
|
||||
G4VSceneHandler* p = new G4DAWNFILESceneHandler (*this, name);
|
||||
return p;
|
||||
G4VSceneHandler* p = new G4DAWNFILESceneHandler(*this, name);
|
||||
return p;
|
||||
}
|
||||
|
||||
//----- G4DAWNFILE::CreateViewer ()
|
||||
G4VViewer* G4DAWNFILE::CreateViewer (G4VSceneHandler& scene, const G4String& name)
|
||||
//----- G4DAWNFILE::CreateViewer ()
|
||||
G4VViewer* G4DAWNFILE::CreateViewer(G4VSceneHandler& scene,
|
||||
const G4String& name)
|
||||
{
|
||||
G4VViewer* pView =
|
||||
new G4DAWNFILEViewer ((G4DAWNFILESceneHandler&) scene, name);
|
||||
return pView;
|
||||
G4VViewer* pView =
|
||||
new G4DAWNFILEViewer((G4DAWNFILESceneHandler&) scene, name);
|
||||
return pView;
|
||||
}
|
||||
|
||||
@@ -28,12 +28,11 @@
|
||||
// Satoshi TANAKA
|
||||
// DAWNFILE scene.
|
||||
|
||||
|
||||
#define __G_ANSI_C__
|
||||
|
||||
// #define DEBUG_FR_SCENE
|
||||
|
||||
//----- header files
|
||||
//----- header files
|
||||
#include <fstream>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -65,243 +64,251 @@
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
|
||||
//----- constants
|
||||
const char FR_ENV_CULL_INVISIBLE_OBJECTS [] = "G4DAWN_CULL_INVISIBLE_OBJECTS";
|
||||
const char G4PRIM_FILE_HEADER [] = "g4_";
|
||||
const char DEFAULT_G4PRIM_FILE_NAME[] = "g4_0000.prim";
|
||||
|
||||
// const int FR_MAX_FILE_NUM = 1 ;
|
||||
// const int FR_MAX_FILE_NUM = 5 ;
|
||||
// const int FR_MAX_FILE_NUM = 10 ;
|
||||
// const int FR_MAX_FILE_NUM = 15 ;
|
||||
// const int FR_MAX_FILE_NUM = 20 ;
|
||||
const int FR_MAX_FILE_NUM = 100 ;
|
||||
|
||||
const char FR_ENV_CULL_INVISIBLE_OBJECTS[] = "G4DAWN_CULL_INVISIBLE_OBJECTS";
|
||||
const char G4PRIM_FILE_HEADER[] = "g4_";
|
||||
const char DEFAULT_G4PRIM_FILE_NAME[] = "g4_0000.prim";
|
||||
const int FR_MAX_FILE_NUM = 100;
|
||||
|
||||
///////////////////////////
|
||||
// Driver-dependent part //
|
||||
///////////////////////////
|
||||
|
||||
|
||||
//----- G4DAWNFILESceneHandler, constructor
|
||||
G4DAWNFILESceneHandler::G4DAWNFILESceneHandler (G4DAWNFILE& system, const G4String& name):
|
||||
G4VSceneHandler (system, fSceneIdCount++, name) ,
|
||||
fSystem (system) ,
|
||||
fPrimDest () ,
|
||||
FRflag_in_modeling (false) ,
|
||||
flag_saving_g4_prim (false) ,
|
||||
COMMAND_BUF_SIZE (G4FRofstream::SEND_BUFMAX),
|
||||
fPrec (9), fPrec2 (16)
|
||||
//----- G4DAWNFILESceneHandler, constructor
|
||||
G4DAWNFILESceneHandler::G4DAWNFILESceneHandler(G4DAWNFILE& system,
|
||||
const G4String& name)
|
||||
: G4VSceneHandler(system, fSceneIdCount++, name)
|
||||
, fSystem(system)
|
||||
, fPrimDest()
|
||||
, FRflag_in_modeling(false)
|
||||
, flag_saving_g4_prim(false)
|
||||
, COMMAND_BUF_SIZE(G4FRofstream::SEND_BUFMAX)
|
||||
, fPrec(9)
|
||||
, fPrec2(16)
|
||||
{
|
||||
// g4.prim filename and its directory
|
||||
if ( std::getenv( "G4DAWNFILE_DEST_DIR" ) == NULL ) {
|
||||
strcpy( fG4PrimDestDir , "" ) ; // output dir
|
||||
strcpy( fG4PrimFileName, DEFAULT_G4PRIM_FILE_NAME ); // filename
|
||||
} else {
|
||||
strcpy( fG4PrimDestDir , std::getenv( "G4DAWNFILE_DEST_DIR" ) ); // output dir
|
||||
strcpy( fG4PrimFileName, DEFAULT_G4PRIM_FILE_NAME ); // filename
|
||||
}
|
||||
|
||||
// maximum number of g4.prim files in the dest directory
|
||||
fMaxFileNum = FR_MAX_FILE_NUM ; // initialization
|
||||
if ( std::getenv( "G4DAWNFILE_MAX_FILE_NUM" ) != NULL ) {
|
||||
|
||||
sscanf( std::getenv("G4DAWNFILE_MAX_FILE_NUM"), "%d", &fMaxFileNum ) ;
|
||||
// g4.prim filename and its directory
|
||||
if(std::getenv("G4DAWNFILE_DEST_DIR") == NULL)
|
||||
{
|
||||
strcpy(fG4PrimDestDir, ""); // output dir
|
||||
strcpy(fG4PrimFileName, DEFAULT_G4PRIM_FILE_NAME); // filename
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(fG4PrimDestDir, std::getenv("G4DAWNFILE_DEST_DIR")); // output dir
|
||||
strcpy(fG4PrimFileName, DEFAULT_G4PRIM_FILE_NAME); // filename
|
||||
}
|
||||
|
||||
} else {
|
||||
fMaxFileNum = FR_MAX_FILE_NUM ;
|
||||
}
|
||||
if( fMaxFileNum < 1 ) { fMaxFileNum = 1 ; }
|
||||
// maximum number of g4.prim files in the dest directory
|
||||
fMaxFileNum = FR_MAX_FILE_NUM; // initialization
|
||||
if(std::getenv("G4DAWNFILE_MAX_FILE_NUM") != NULL)
|
||||
{
|
||||
sscanf(std::getenv("G4DAWNFILE_MAX_FILE_NUM"), "%d", &fMaxFileNum);
|
||||
}
|
||||
else
|
||||
{
|
||||
fMaxFileNum = FR_MAX_FILE_NUM;
|
||||
}
|
||||
if(fMaxFileNum < 1)
|
||||
{
|
||||
fMaxFileNum = 1;
|
||||
}
|
||||
|
||||
//----- precision control
|
||||
if(std::getenv("G4DAWNFILE_PRECISION") != NULL)
|
||||
{
|
||||
sscanf(std::getenv("G4DAWNFILE_PRECISION"), "%d", &fPrec);
|
||||
}
|
||||
else
|
||||
{
|
||||
fPrec = 9;
|
||||
}
|
||||
fPrec2 = fPrec + 7;
|
||||
}
|
||||
|
||||
//----- precision control
|
||||
if( std::getenv( "G4DAWNFILE_PRECISION" ) != NULL ) {
|
||||
sscanf( std::getenv("G4DAWNFILE_PRECISION"), "%d", &fPrec ) ;
|
||||
} else {
|
||||
fPrec = 9 ;
|
||||
}
|
||||
fPrec2 = fPrec + 7 ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//----- G4DAWNFILESceneHandler, destructor
|
||||
G4DAWNFILESceneHandler::~G4DAWNFILESceneHandler ()
|
||||
//----- G4DAWNFILESceneHandler, destructor
|
||||
G4DAWNFILESceneHandler::~G4DAWNFILESceneHandler()
|
||||
{
|
||||
#if defined DEBUG_FR_SCENE
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** ~G4DAWNFILESceneHandler" << G4endl;
|
||||
#endif
|
||||
if (fPrimDest.IsOpen())
|
||||
{
|
||||
//----- End of modeling
|
||||
// !EndModeling, !DrawAll, !CloseDevice,
|
||||
// close g4.prim
|
||||
FREndModeling();
|
||||
}
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** ~G4DAWNFILESceneHandler" << G4endl;
|
||||
#endif
|
||||
if(fPrimDest.IsOpen())
|
||||
{
|
||||
//----- End of modeling
|
||||
// !EndModeling, !DrawAll, !CloseDevice,
|
||||
// close g4.prim
|
||||
FREndModeling();
|
||||
}
|
||||
}
|
||||
|
||||
//-----
|
||||
void G4DAWNFILESceneHandler::SetG4PrimFileName()
|
||||
void G4DAWNFILESceneHandler::SetG4PrimFileName()
|
||||
{
|
||||
// g4_0000.prim, g4_0001.prim, ..., g4_MAX_FILE_INDEX.prim
|
||||
const int MAX_FILE_INDEX = fMaxFileNum - 1 ;
|
||||
// g4_0000.prim, g4_0001.prim, ..., g4_MAX_FILE_INDEX.prim
|
||||
const int MAX_FILE_INDEX = fMaxFileNum - 1;
|
||||
|
||||
// dest directory (null if no environmental variables is set)
|
||||
strcpy ( fG4PrimFileName, fG4PrimDestDir) ;
|
||||
// dest directory (null if no environmental variables is set)
|
||||
strcpy(fG4PrimFileName, fG4PrimDestDir);
|
||||
|
||||
// create full path name (default)
|
||||
strcat ( fG4PrimFileName, DEFAULT_G4PRIM_FILE_NAME );
|
||||
// create full path name (default)
|
||||
strcat(fG4PrimFileName, DEFAULT_G4PRIM_FILE_NAME);
|
||||
|
||||
// Automatic updation of file names
|
||||
for( int i = 0 ; i < fMaxFileNum ; i++) {
|
||||
// Automatic updation of file names
|
||||
for(int i = 0; i < fMaxFileNum; i++)
|
||||
{
|
||||
// Message in the final execution
|
||||
if(i == MAX_FILE_INDEX)
|
||||
{
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
{
|
||||
G4cout << "===========================================" << G4endl;
|
||||
G4cout << "WARNING MESSAGE from DAWNFILE driver: " << G4endl;
|
||||
G4cout << " This file name is the final one in the " << G4endl;
|
||||
G4cout << " automatic updation of the output file name." << G4endl;
|
||||
G4cout << " You may overwrite existing files, i.e. " << G4endl;
|
||||
G4cout << " g4_XXXX.prim and g4_XXXX.eps " << G4endl;
|
||||
G4cout << "===========================================" << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Message in the final execution
|
||||
if( i == MAX_FILE_INDEX )
|
||||
{
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
|
||||
G4cout << "===========================================" << G4endl;
|
||||
G4cout << "WARNING MESSAGE from DAWNFILE driver: " << G4endl;
|
||||
G4cout << " This file name is the final one in the " << G4endl;
|
||||
G4cout << " automatic updation of the output file name." << G4endl;
|
||||
G4cout << " You may overwrite existing files, i.e. " << G4endl;
|
||||
G4cout << " g4_XXXX.prim and g4_XXXX.eps " << G4endl;
|
||||
G4cout << "===========================================" << G4endl;
|
||||
}
|
||||
}
|
||||
// re-determine file name as G4DAWNFILE_DEST_DIR/g4_XXXX.prim
|
||||
std::ostringstream filename;
|
||||
filename << fG4PrimDestDir << G4PRIM_FILE_HEADER << std::setw(4)
|
||||
<< std::setfill('0') << i << ".prim";
|
||||
strncpy(fG4PrimFileName, filename.str().c_str(),
|
||||
sizeof(fG4PrimFileName) - 1);
|
||||
fG4PrimFileName[sizeof(fG4PrimFileName) - 1] = '\0';
|
||||
|
||||
// re-determine file name as G4DAWNFILE_DEST_DIR/g4_XXXX.prim
|
||||
std::ostringstream filename; filename
|
||||
<< fG4PrimDestDir << G4PRIM_FILE_HEADER
|
||||
<< std::setw(4) << std::setfill('0') << i << ".prim";
|
||||
strncpy(fG4PrimFileName,filename.str().c_str(),sizeof(fG4PrimFileName)-1);
|
||||
fG4PrimFileName[sizeof(fG4PrimFileName)-1] = '\0';
|
||||
// check validity of the file name
|
||||
std::ifstream fin;
|
||||
fin.open(fG4PrimFileName);
|
||||
if(!fin)
|
||||
{
|
||||
// new file
|
||||
fin.close();
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
// already exists (try next)
|
||||
fin.close();
|
||||
}
|
||||
|
||||
// check validity of the file name
|
||||
std::ifstream fin ;
|
||||
fin.open(fG4PrimFileName) ;
|
||||
if(!fin) {
|
||||
// new file
|
||||
fin.close();
|
||||
break;
|
||||
} else {
|
||||
// already exists (try next)
|
||||
fin.close();
|
||||
}
|
||||
} // for
|
||||
|
||||
} // for
|
||||
|
||||
G4cout << "=========================================== " << G4endl;
|
||||
G4cout << "Output file: " << fG4PrimFileName << G4endl;
|
||||
G4cout << "Destination directory (current dir if NULL): " << fG4PrimDestDir << G4endl;
|
||||
G4cout << "Maximal number of files in the destination directory: " << fMaxFileNum << G4endl;
|
||||
G4cout << "Note: " << G4endl;
|
||||
G4cout << " * The maximal number is customizable as: " << G4endl;
|
||||
G4cout << " % setenv G4DAWNFILE_MAX_FILE_NUM number " << G4endl;
|
||||
G4cout << " * The destination directory is customizable as:" << G4endl;
|
||||
G4cout << " % setenv G4DAWNFILE_DEST_DIR dir_name/ " << G4endl;
|
||||
G4cout << " ** Do not forget \"/\" at the end of the " << G4endl;
|
||||
G4cout << " dir_name, e.g. \"./tmp/\". " << G4endl;
|
||||
G4cout << "=========================================== " << G4endl;
|
||||
|
||||
} // G4DAWNFILESceneHandler::SetG4PrimFileName()
|
||||
G4cout << "=========================================== " << G4endl;
|
||||
G4cout << "Output file: " << fG4PrimFileName << G4endl;
|
||||
G4cout << "Destination directory (current dir if NULL): " << fG4PrimDestDir
|
||||
<< G4endl;
|
||||
G4cout << "Maximal number of files in the destination directory: "
|
||||
<< fMaxFileNum << G4endl;
|
||||
G4cout << "Note: " << G4endl;
|
||||
G4cout << " * The maximal number is customizable as: " << G4endl;
|
||||
G4cout << " % setenv G4DAWNFILE_MAX_FILE_NUM number " << G4endl;
|
||||
G4cout << " * The destination directory is customizable as:" << G4endl;
|
||||
G4cout << " % setenv G4DAWNFILE_DEST_DIR dir_name/ " << G4endl;
|
||||
G4cout << " ** Do not forget \"/\" at the end of the " << G4endl;
|
||||
G4cout << " dir_name, e.g. \"./tmp/\". " << G4endl;
|
||||
G4cout << "=========================================== " << G4endl;
|
||||
|
||||
} // G4DAWNFILESceneHandler::SetG4PrimFileName()
|
||||
|
||||
//-----
|
||||
void G4DAWNFILESceneHandler::BeginSavingG4Prim( void )
|
||||
void G4DAWNFILESceneHandler::BeginSavingG4Prim(void)
|
||||
{
|
||||
#if defined DEBUG_FR_SCENE
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** BeginSavingG4Prim (called)\n";
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** BeginSavingG4Prim (called)\n";
|
||||
#endif
|
||||
|
||||
if( !IsSavingG4Prim() )
|
||||
{
|
||||
if(!IsSavingG4Prim())
|
||||
{
|
||||
#if defined DEBUG_FR_SCENE
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
|
||||
G4cout << "***** (started) " ;
|
||||
G4cout << "(open g4.prim, ##)" << G4endl;
|
||||
}
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
{
|
||||
G4cout << "***** (started) ";
|
||||
G4cout << "(open g4.prim, ##)" << G4endl;
|
||||
}
|
||||
#endif
|
||||
SetG4PrimFileName() ; // result set to fG4PrimFileName
|
||||
fPrimDest.Open(fG4PrimFileName) ;
|
||||
SetG4PrimFileName(); // result set to fG4PrimFileName
|
||||
fPrimDest.Open(fG4PrimFileName);
|
||||
|
||||
SendStr( FR_G4_PRIM_HEADER ) ;
|
||||
flag_saving_g4_prim = true ;
|
||||
}
|
||||
SendStr(FR_G4_PRIM_HEADER);
|
||||
flag_saving_g4_prim = true;
|
||||
}
|
||||
}
|
||||
|
||||
void G4DAWNFILESceneHandler::EndSavingG4Prim ( void )
|
||||
void G4DAWNFILESceneHandler::EndSavingG4Prim(void)
|
||||
{
|
||||
#if defined DEBUG_FR_SCENE
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** EndSavingG4Prim (called)\n";
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** EndSavingG4Prim (called)\n";
|
||||
#endif
|
||||
|
||||
if( IsSavingG4Prim() )
|
||||
{
|
||||
if(IsSavingG4Prim())
|
||||
{
|
||||
#if defined DEBUG_FR_SCENE
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** (started) (close g4.prim)" << G4endl;
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** (started) (close g4.prim)" << G4endl;
|
||||
#endif
|
||||
fPrimDest.Close() ;
|
||||
flag_saving_g4_prim = false ;
|
||||
}
|
||||
fPrimDest.Close();
|
||||
flag_saving_g4_prim = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----
|
||||
void G4DAWNFILESceneHandler::FRBeginModeling( void )
|
||||
//-----
|
||||
void G4DAWNFILESceneHandler::FRBeginModeling(void)
|
||||
{
|
||||
if( !FRIsInModeling() )
|
||||
{
|
||||
if(!FRIsInModeling())
|
||||
{
|
||||
#if defined DEBUG_FR_SCENE
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** G4DAWNFILESceneHandler::FRBeginModeling (called & started)" << G4endl;
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout
|
||||
<< "***** G4DAWNFILESceneHandler::FRBeginModeling (called & started)"
|
||||
<< G4endl;
|
||||
#endif
|
||||
|
||||
//----- Send saving command and heading comment
|
||||
BeginSavingG4Prim();
|
||||
//----- Send saving command and heading comment
|
||||
BeginSavingG4Prim();
|
||||
|
||||
//----- Send bounding box command
|
||||
SendBoundingBox();
|
||||
//----- Send bounding box command
|
||||
SendBoundingBox();
|
||||
|
||||
//----- send SET_CAMERA command
|
||||
//----- send SET_CAMERA command
|
||||
#if defined DEBUG_FR_SCENE
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** (!SetCamera in FRBeginModeling())" << G4endl;
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** (!SetCamera in FRBeginModeling())" << G4endl;
|
||||
#endif
|
||||
SendStr( FR_SET_CAMERA );
|
||||
SendStr(FR_SET_CAMERA);
|
||||
|
||||
//----- open device
|
||||
//----- open device
|
||||
#if defined DEBUG_FR_SCENE
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** (!OpenDevice in FRBeginModeling())" << G4endl;
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** (!OpenDevice in FRBeginModeling())" << G4endl;
|
||||
#endif
|
||||
SendStr( FR_OPEN_DEVICE );
|
||||
SendStr(FR_OPEN_DEVICE);
|
||||
|
||||
//----- begin sending primitives
|
||||
//----- begin sending primitives
|
||||
#if defined DEBUG_FR_SCENE
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** (!BeginModeling in FRBeginModeling())" << G4endl;
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** (!BeginModeling in FRBeginModeling())" << G4endl;
|
||||
#endif
|
||||
SendStr( FR_BEGIN_MODELING ); FRflag_in_modeling = true ;
|
||||
|
||||
} // if
|
||||
|
||||
}
|
||||
SendStr(FR_BEGIN_MODELING);
|
||||
FRflag_in_modeling = true;
|
||||
|
||||
} // if
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
// Common to DAWN and DAWNFILE drivers //
|
||||
/////////////////////////////////////////
|
||||
|
||||
#define G4FRSCENEHANDLER G4DAWNFILESceneHandler
|
||||
#define G4FRSCENEHANDLER G4DAWNFILESceneHandler
|
||||
#include "G4FRSceneFunc.icc"
|
||||
#undef G4FRSCENEHANDLER
|
||||
#undef G4FRSCENEHANDLER
|
||||
|
||||
//////////////////////
|
||||
// static variables //
|
||||
//////////////////////
|
||||
|
||||
//----- static variables
|
||||
G4int G4DAWNFILESceneHandler::fSceneIdCount = 0;
|
||||
//----- static variables
|
||||
G4int G4DAWNFILESceneHandler::fSceneIdCount = 0;
|
||||
|
||||
@@ -28,9 +28,8 @@
|
||||
// Satoshi TANAKA
|
||||
// DAWNFILE view - opens window, hard copy, etc.
|
||||
|
||||
|
||||
#define __G_ANSI_C__
|
||||
#define G4DAWNFILE_STRUCTURE_PRIORITY 1.
|
||||
#define G4DAWNFILE_STRUCTURE_PRIORITY 1.
|
||||
|
||||
// #define DEBUG_FR_VIEW
|
||||
|
||||
@@ -52,332 +51,331 @@
|
||||
#include "G4DAWNFILESceneHandler.hh"
|
||||
#include "G4DAWNFILEViewer.hh"
|
||||
|
||||
//----- constants
|
||||
const char FR_ENV_MULTI_WINDOW[] = "G4DAWN_MULTI_WINDOW";
|
||||
const char FR_ENV_MULTI_WINDOW2[] = "G4DAWNFILE_MULTI_WINDOW";
|
||||
|
||||
|
||||
//----- constants
|
||||
const char FR_ENV_MULTI_WINDOW [] = "G4DAWN_MULTI_WINDOW" ;
|
||||
const char FR_ENV_MULTI_WINDOW2[] = "G4DAWNFILE_MULTI_WINDOW" ;
|
||||
|
||||
//----- G4DAWNFILEViewer, constructor
|
||||
G4DAWNFILEViewer::G4DAWNFILEViewer (G4DAWNFILESceneHandler& sceneHandler,
|
||||
const G4String& name):
|
||||
G4VViewer (sceneHandler,
|
||||
sceneHandler.IncrementViewCount (),
|
||||
name),
|
||||
fSceneHandler (sceneHandler)
|
||||
//----- G4DAWNFILEViewer, constructor
|
||||
G4DAWNFILEViewer::G4DAWNFILEViewer(G4DAWNFILESceneHandler& sceneHandler,
|
||||
const G4String& name)
|
||||
: G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name)
|
||||
, fSceneHandler(sceneHandler)
|
||||
{
|
||||
// Set a g4.prim-file viewer
|
||||
strcpy( fG4PrimViewer, "dawn" );
|
||||
if( std::getenv( "G4DAWNFILE_VIEWER" ) != NULL ) {
|
||||
strcpy( fG4PrimViewer, std::getenv( "G4DAWNFILE_VIEWER" ) ) ;
|
||||
}
|
||||
// Set a g4.prim-file viewer
|
||||
strcpy(fG4PrimViewer, "dawn");
|
||||
if(std::getenv("G4DAWNFILE_VIEWER") != NULL)
|
||||
{
|
||||
strcpy(fG4PrimViewer, std::getenv("G4DAWNFILE_VIEWER"));
|
||||
}
|
||||
|
||||
// string for viewer invocation
|
||||
if ( !strcmp( fG4PrimViewer, "NONE" ) ) {
|
||||
|
||||
strcpy( fG4PrimViewerInvocation, "" );
|
||||
} else {
|
||||
|
||||
strcpy( fG4PrimViewerInvocation, fG4PrimViewer );
|
||||
strcat( fG4PrimViewerInvocation, " ");
|
||||
strcat( fG4PrimViewerInvocation, fSceneHandler.GetG4PrimFileName() );
|
||||
}
|
||||
|
||||
// Set a PostScript Viewer
|
||||
// strcpy( fPSViewer, "ghostview" );
|
||||
strcpy( fPSViewer, "gv" );
|
||||
if( std::getenv( "G4DAWNFILE_PS_VIEWER" ) != NULL ) {
|
||||
strcpy( fPSViewer, std::getenv( "G4DAWNFILE_PS_VIEWER" ) ) ;
|
||||
}
|
||||
// string for viewer invocation
|
||||
if(!strcmp(fG4PrimViewer, "NONE"))
|
||||
{
|
||||
strcpy(fG4PrimViewerInvocation, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(fG4PrimViewerInvocation, fG4PrimViewer);
|
||||
strcat(fG4PrimViewerInvocation, " ");
|
||||
strcat(fG4PrimViewerInvocation, fSceneHandler.GetG4PrimFileName());
|
||||
}
|
||||
|
||||
// Set a PostScript Viewer
|
||||
// strcpy( fPSViewer, "ghostview" );
|
||||
strcpy(fPSViewer, "gv");
|
||||
if(std::getenv("G4DAWNFILE_PS_VIEWER") != NULL)
|
||||
{
|
||||
strcpy(fPSViewer, std::getenv("G4DAWNFILE_PS_VIEWER"));
|
||||
}
|
||||
}
|
||||
|
||||
//----- G4DAWNFILEViewer, destructor
|
||||
G4DAWNFILEViewer::~G4DAWNFILEViewer ()
|
||||
{}
|
||||
//----- G4DAWNFILEViewer, destructor
|
||||
G4DAWNFILEViewer::~G4DAWNFILEViewer() {}
|
||||
|
||||
//----- G4DAWNFILEViewer::SetView ()
|
||||
void G4DAWNFILEViewer::SetView ()
|
||||
//----- G4DAWNFILEViewer::SetView ()
|
||||
void G4DAWNFILEViewer::SetView()
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** G4DAWNFILEViewer::SetView(): No effects" << G4endl;
|
||||
#endif
|
||||
// Do nothing, since DAWN is running as a different process.
|
||||
// SendViewParameters () will do this job instead.
|
||||
#endif
|
||||
// Do nothing, since DAWN is running as a different process.
|
||||
// SendViewParameters () will do this job instead.
|
||||
}
|
||||
|
||||
|
||||
//----- G4DAWNFILEViewer::ClearView()
|
||||
void
|
||||
G4DAWNFILEViewer::ClearView( void )
|
||||
//----- G4DAWNFILEViewer::ClearView()
|
||||
void G4DAWNFILEViewer::ClearView(void)
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** G4DAWNFILEViewer::ClearView (): No effects " << G4endl;
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** G4DAWNFILEViewer::ClearView (): No effects " << G4endl;
|
||||
#endif
|
||||
if (fSceneHandler.fPrimDest.IsOpen()) {
|
||||
fSceneHandler.fPrimDest.Close();
|
||||
// Re-open with same filename...
|
||||
fSceneHandler.fPrimDest.Open(fSceneHandler.fG4PrimFileName);
|
||||
fSceneHandler.SendStr( FR_G4_PRIM_HEADER );
|
||||
fSceneHandler.FRflag_in_modeling = false;
|
||||
fSceneHandler.FRBeginModeling();
|
||||
}
|
||||
if(fSceneHandler.fPrimDest.IsOpen())
|
||||
{
|
||||
fSceneHandler.fPrimDest.Close();
|
||||
// Re-open with same filename...
|
||||
fSceneHandler.fPrimDest.Open(fSceneHandler.fG4PrimFileName);
|
||||
fSceneHandler.SendStr(FR_G4_PRIM_HEADER);
|
||||
fSceneHandler.FRflag_in_modeling = false;
|
||||
fSceneHandler.FRBeginModeling();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//----- G4DAWNFILEViewer::DrawView ()
|
||||
void G4DAWNFILEViewer::DrawView ()
|
||||
//----- G4DAWNFILEViewer::DrawView ()
|
||||
void G4DAWNFILEViewer::DrawView()
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** G4DAWNFILEViewer::DrawView () " << G4endl;
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** G4DAWNFILEViewer::DrawView () " << G4endl;
|
||||
#endif
|
||||
//-----
|
||||
fSceneHandler.FRBeginModeling() ;
|
||||
//-----
|
||||
fSceneHandler.FRBeginModeling();
|
||||
|
||||
//----- Always visit G4 kernel
|
||||
NeedKernelVisit ();
|
||||
|
||||
//----- Draw
|
||||
ProcessView () ;
|
||||
//----- Always visit G4 kernel
|
||||
NeedKernelVisit();
|
||||
|
||||
} // G4DAWNFILEViewer::DrawView ()
|
||||
//----- Draw
|
||||
ProcessView();
|
||||
|
||||
} // G4DAWNFILEViewer::DrawView ()
|
||||
|
||||
|
||||
//----- G4DAWNFILEViewer::ShowView()
|
||||
void G4DAWNFILEViewer::ShowView( void )
|
||||
//----- G4DAWNFILEViewer::ShowView()
|
||||
void G4DAWNFILEViewer::ShowView(void)
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** G4DAWNFILEViewer::ShowView () " << G4endl;
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** G4DAWNFILEViewer::ShowView () " << G4endl;
|
||||
#endif
|
||||
|
||||
if( fSceneHandler.FRIsInModeling() )
|
||||
{
|
||||
//----- End of modeling
|
||||
// !EndModeling, !DrawAll, !CloseDevice,
|
||||
// close g4.prim
|
||||
fSceneHandler.FREndModeling();
|
||||
if(fSceneHandler.FRIsInModeling())
|
||||
{
|
||||
//----- End of modeling
|
||||
// !EndModeling, !DrawAll, !CloseDevice,
|
||||
// close g4.prim
|
||||
fSceneHandler.FREndModeling();
|
||||
|
||||
//----- Output DAWN GUI file
|
||||
SendViewParameters();
|
||||
//----- Output DAWN GUI file
|
||||
SendViewParameters();
|
||||
|
||||
//----- string for viewer invocation
|
||||
if ( !strcmp( fG4PrimViewer, "NONE" ) ) {
|
||||
|
||||
strcpy( fG4PrimViewerInvocation, "" );
|
||||
} else {
|
||||
//----- string for viewer invocation
|
||||
if(!strcmp(fG4PrimViewer, "NONE"))
|
||||
{
|
||||
strcpy(fG4PrimViewerInvocation, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(fG4PrimViewerInvocation, fG4PrimViewer);
|
||||
strcat(fG4PrimViewerInvocation, " ");
|
||||
strcat(fG4PrimViewerInvocation, fSceneHandler.GetG4PrimFileName());
|
||||
}
|
||||
|
||||
strcpy( fG4PrimViewerInvocation, fG4PrimViewer );
|
||||
strcat( fG4PrimViewerInvocation, " ");
|
||||
strcat( fG4PrimViewerInvocation, fSceneHandler.GetG4PrimFileName() );
|
||||
}
|
||||
//----- Invoke DAWN
|
||||
G4cout << G4endl;
|
||||
if(false == G4FRofstream::DoesFileExist(fSceneHandler.GetG4PrimFileName()))
|
||||
{
|
||||
G4cout << "ERROR: Failed to generate file ";
|
||||
G4cout << fSceneHandler.GetG4PrimFileName() << G4endl;
|
||||
}
|
||||
else if(strcmp(GetG4PrimViewerInvocation(), ""))
|
||||
{
|
||||
G4cout << "File " << fSceneHandler.GetG4PrimFileName();
|
||||
G4cout << " is generated." << G4endl;
|
||||
G4cout << GetG4PrimViewerInvocation() << G4endl;
|
||||
int iErr = system(GetG4PrimViewerInvocation());
|
||||
if(iErr != 0)
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Error " << iErr << " when calling system with \""
|
||||
<< GetG4PrimViewerInvocation() << "\".";
|
||||
G4Exception("G4DAWNFILEViewer::ShowView()", "dawn0005", JustWarning,
|
||||
ed);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // no view, i.e., only file generation
|
||||
G4cout << "File " << fSceneHandler.GetG4PrimFileName();
|
||||
G4cout << " is generated." << G4endl;
|
||||
G4cout << "No viewer is invoked." << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
} // G4DAWNFILEViewer::ShowView()
|
||||
|
||||
//----- Invoke DAWN
|
||||
G4cout << G4endl ;
|
||||
if( false == G4FRofstream::DoesFileExist( fSceneHandler.GetG4PrimFileName() ) )
|
||||
{
|
||||
G4cout << "ERROR: Failed to generate file ";
|
||||
G4cout << fSceneHandler.GetG4PrimFileName() << G4endl;
|
||||
|
||||
} else if( strcmp( GetG4PrimViewerInvocation(), "" ) )
|
||||
{
|
||||
G4cout << "File " << fSceneHandler.GetG4PrimFileName() ;
|
||||
G4cout << " is generated." << G4endl;
|
||||
G4cout << GetG4PrimViewerInvocation() << G4endl;
|
||||
int iErr = system( GetG4PrimViewerInvocation() );
|
||||
if ( iErr != 0) {
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Error " << iErr
|
||||
<< " when calling system with \"" << GetG4PrimViewerInvocation()
|
||||
<< "\".";
|
||||
G4Exception("G4DAWNFILEViewer::ShowView()",
|
||||
"dawn0005", JustWarning, ed);
|
||||
}
|
||||
|
||||
} else { // no view, i.e., only file generation
|
||||
G4cout << "File " << fSceneHandler.GetG4PrimFileName() ;
|
||||
G4cout << " is generated." << G4endl;
|
||||
G4cout << "No viewer is invoked." << G4endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // G4DAWNFILEViewer::ShowView()
|
||||
|
||||
|
||||
//----- G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI( std::ostream& out )
|
||||
void G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI( std::ostream& out )
|
||||
//----- G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI( std::ostream& out )
|
||||
void G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI(std::ostream& out)
|
||||
{
|
||||
///////////////////////
|
||||
//#if defined DEBUG_FR_VIEW
|
||||
// G4cout << "***** G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI()" << G4endl;
|
||||
//#endif
|
||||
//////////////////////
|
||||
///////////////////////
|
||||
//#if defined DEBUG_FR_VIEW
|
||||
// G4cout << "***** G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI()" << G4endl;
|
||||
//#endif
|
||||
//////////////////////
|
||||
|
||||
G4int style = fVP.GetDrawingStyle();
|
||||
G4int style = fVP.GetDrawingStyle();
|
||||
|
||||
enum { FR_WIREFRAME_STYLE = 1, FR_WF_STORED_STYLE = 2,
|
||||
FR_HID_STYLE = 3, FR_HID2_STYLE = 4,
|
||||
FR_HID3_STYLE = 5, FR_DRAWING_MODE_END_STYLE = 6 };
|
||||
enum
|
||||
{
|
||||
FR_WIREFRAME_STYLE = 1,
|
||||
FR_WF_STORED_STYLE = 2,
|
||||
FR_HID_STYLE = 3,
|
||||
FR_HID2_STYLE = 4,
|
||||
FR_HID3_STYLE = 5,
|
||||
FR_DRAWING_MODE_END_STYLE = 6
|
||||
};
|
||||
|
||||
switch( style )
|
||||
{
|
||||
case G4ViewParameters::wireframe:
|
||||
out << FR_WIREFRAME_STYLE << G4endl;
|
||||
break;
|
||||
case G4ViewParameters::hlr:
|
||||
out << FR_HID2_STYLE << G4endl; // LINE
|
||||
break;
|
||||
case G4ViewParameters::hsr:
|
||||
case G4ViewParameters::hlhsr:
|
||||
out << FR_HID_STYLE << G4endl; // SURFACE
|
||||
break;
|
||||
default:
|
||||
out << FR_WIREFRAME_STYLE << G4endl;
|
||||
break;
|
||||
}
|
||||
switch(style)
|
||||
{
|
||||
case G4ViewParameters::wireframe:
|
||||
out << FR_WIREFRAME_STYLE << G4endl;
|
||||
break;
|
||||
case G4ViewParameters::hlr:
|
||||
out << FR_HID2_STYLE << G4endl; // LINE
|
||||
break;
|
||||
case G4ViewParameters::hsr:
|
||||
case G4ViewParameters::hlhsr:
|
||||
out << FR_HID_STYLE << G4endl; // SURFACE
|
||||
break;
|
||||
default:
|
||||
out << FR_WIREFRAME_STYLE << G4endl;
|
||||
break;
|
||||
}
|
||||
|
||||
} // G4DAWNFILEViewer::SendDrawingStyle()
|
||||
} // G4DAWNFILEViewer::SendDrawingStyle()
|
||||
|
||||
|
||||
|
||||
//-----
|
||||
void G4DAWNFILEViewer::SendViewParameters ()
|
||||
//-----
|
||||
void G4DAWNFILEViewer::SendViewParameters()
|
||||
{
|
||||
// Calculates view representation based on extent of object being
|
||||
// viewed and (initial) direction of camera. (Note: it can change
|
||||
// later due to user interaction via visualization system's GUI.)
|
||||
|
||||
#if defined DEBUG_FR_VIEW
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
|
||||
G4cout << "***** G4DAWNFILEViewer::SendViewParameters() ";
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
{
|
||||
G4cout << "***** G4DAWNFILEViewer::SendViewParameters() ";
|
||||
G4cout << "(GUI parameters)" << G4endl;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//----- Magic number to decide camera distance automatically
|
||||
const G4double HOW_FAR = 1000.0 ; // to define "infinity"
|
||||
const G4double MIN_HALF_ANGLE = 0.01 ;
|
||||
const G4double MAX_HALF_ANGLE = 0.499 * pi ;
|
||||
//----- Magic number to decide camera distance automatically
|
||||
const G4double HOW_FAR = 1000.0; // to define "infinity"
|
||||
const G4double MIN_HALF_ANGLE = 0.01;
|
||||
const G4double MAX_HALF_ANGLE = 0.499 * pi;
|
||||
|
||||
//----- CALC camera distance
|
||||
//..... Note: Camera cannot enter inside object
|
||||
G4double camera_distance ;
|
||||
G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
|
||||
//----- CALC camera distance
|
||||
//..... Note: Camera cannot enter inside object
|
||||
G4double camera_distance;
|
||||
G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
|
||||
|
||||
G4double half_view_angle = std::fabs ( fVP.GetFieldHalfAngle () ) ;
|
||||
if( half_view_angle > MAX_HALF_ANGLE ) {
|
||||
half_view_angle = MAX_HALF_ANGLE ;
|
||||
}
|
||||
G4double half_view_angle = std::fabs(fVP.GetFieldHalfAngle());
|
||||
if(half_view_angle > MAX_HALF_ANGLE)
|
||||
{
|
||||
half_view_angle = MAX_HALF_ANGLE;
|
||||
}
|
||||
|
||||
if( half_view_angle < MIN_HALF_ANGLE ) {
|
||||
//----- infinity (or ortho projection)
|
||||
camera_distance = radius * HOW_FAR ;
|
||||
} else {
|
||||
//----- Calc camera distance from half view angle
|
||||
camera_distance = radius / std::sin ( half_view_angle );
|
||||
camera_distance -= fVP.GetDolly();
|
||||
}
|
||||
if(half_view_angle < MIN_HALF_ANGLE)
|
||||
{
|
||||
//----- infinity (or ortho projection)
|
||||
camera_distance = radius * HOW_FAR;
|
||||
}
|
||||
else
|
||||
{
|
||||
//----- Calc camera distance from half view angle
|
||||
camera_distance = radius / std::sin(half_view_angle);
|
||||
camera_distance -= fVP.GetDolly();
|
||||
}
|
||||
|
||||
if ( camera_distance < radius ) {
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
|
||||
G4cout << "WARNING from DAWNFILE driver:" << G4endl;
|
||||
G4cout << " Camera cannot enter inside objects" << G4endl;
|
||||
}
|
||||
camera_distance = radius ;
|
||||
}
|
||||
if(camera_distance < radius)
|
||||
{
|
||||
if(G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
{
|
||||
G4cout << "WARNING from DAWNFILE driver:" << G4endl;
|
||||
G4cout << " Camera cannot enter inside objects" << G4endl;
|
||||
}
|
||||
camera_distance = radius;
|
||||
}
|
||||
|
||||
//----- CALC camera direction
|
||||
const G4Vector3D& camera_direction \
|
||||
= fVP.GetViewpointDirection().unit();
|
||||
const G4double v_angle = (180.0 / pi) * camera_direction.theta() ;
|
||||
const G4double h_angle = (180.0 / pi) * camera_direction.phi () ;
|
||||
//----- CALC camera direction
|
||||
const G4Vector3D& camera_direction = fVP.GetViewpointDirection().unit();
|
||||
const G4double v_angle = (180.0 / pi) * camera_direction.theta();
|
||||
const G4double h_angle = (180.0 / pi) * camera_direction.phi();
|
||||
|
||||
//########### Generation of the file .DAWN.history for DAWN GUI
|
||||
//-----
|
||||
std::ofstream gui_out(".DAWN_1.history");
|
||||
|
||||
//########### Generation of the file .DAWN.history for DAWN GUI
|
||||
//-----
|
||||
std::ofstream gui_out (".DAWN_1.history") ;
|
||||
// ######### P1
|
||||
|
||||
// ######### P1
|
||||
//----- camera position
|
||||
gui_out << camera_distance << G4endl;
|
||||
gui_out << v_angle << G4endl;
|
||||
gui_out << h_angle << G4endl;
|
||||
gui_out << "0" << G4endl; // auto target
|
||||
|
||||
//----- camera position
|
||||
gui_out << camera_distance << G4endl;
|
||||
gui_out << v_angle << G4endl ;
|
||||
gui_out << h_angle << G4endl ;
|
||||
gui_out << "0" << G4endl ; // auto target
|
||||
//----- target point
|
||||
const G4Point3D& target_point =
|
||||
fSceneHandler.GetScene()->GetStandardTargetPoint() +
|
||||
fVP.GetCurrentTargetPoint();
|
||||
gui_out << target_point.x() << G4endl;
|
||||
gui_out << target_point.y() << G4endl;
|
||||
gui_out << target_point.z() << G4endl;
|
||||
|
||||
//----- target point
|
||||
const G4Point3D& target_point
|
||||
= fSceneHandler.GetScene()->GetStandardTargetPoint()
|
||||
+ fVP.GetCurrentTargetPoint();
|
||||
gui_out << target_point.x() << G4endl ;
|
||||
gui_out << target_point.y() << G4endl ;
|
||||
gui_out << target_point.z() << G4endl ;
|
||||
//----- Magnification
|
||||
const G4double zoom_factor = fVP.GetZoomFactor();
|
||||
if(half_view_angle < MIN_HALF_ANGLE)
|
||||
{
|
||||
gui_out << zoom_factor << G4endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
const G4double FR_HALF_SCREEN_SIZE = 0.5;
|
||||
G4double focal_distance = FR_HALF_SCREEN_SIZE / std::tan(half_view_angle);
|
||||
focal_distance *= zoom_factor;
|
||||
|
||||
//----- Magnification
|
||||
const G4double zoom_factor = fVP.GetZoomFactor();
|
||||
if( half_view_angle < MIN_HALF_ANGLE ) {
|
||||
gui_out << "fd" << focal_distance << G4endl;
|
||||
}
|
||||
SendDrawingStyleToDAWNGUI(gui_out); // gui_out, viewing mode
|
||||
gui_out << "0.001" << G4endl; // 3D Tolerance
|
||||
gui_out << "0" << G4endl; // not display parameters
|
||||
|
||||
gui_out << zoom_factor << G4endl;
|
||||
// ######### P2
|
||||
gui_out << 1 << G4endl; // Source light
|
||||
gui_out << 1 << G4endl;
|
||||
gui_out << 1 << G4endl;
|
||||
gui_out << 0.5 << G4endl; // Ambient light
|
||||
gui_out << 0.5 << G4endl;
|
||||
gui_out << 0.5 << G4endl;
|
||||
gui_out << 19.0 << G4endl; // Light direction (Polar)
|
||||
gui_out << 71.0 << G4endl; // Light direction (Azimuthal)
|
||||
|
||||
} else {
|
||||
const G4double FR_HALF_SCREEN_SIZE = 0.5 ;
|
||||
G4double focal_distance \
|
||||
= FR_HALF_SCREEN_SIZE / std::tan( half_view_angle );
|
||||
focal_distance *= zoom_factor ;
|
||||
// ######### P3
|
||||
gui_out << 0.1 << G4endl; // Real edge width
|
||||
gui_out << 0.1 << G4endl; // outline width
|
||||
gui_out << 0.1 << G4endl; // aux edge width
|
||||
gui_out << 3 << G4endl; // aux edge style
|
||||
gui_out << 70.0 << G4endl; // aux-edge threshold angle
|
||||
gui_out << 0.1 << G4endl; // line width
|
||||
gui_out << 0 << G4endl; // haloing
|
||||
gui_out << 1 << G4endl; // Dashed edged for back faces
|
||||
|
||||
gui_out << "fd" << focal_distance << G4endl;
|
||||
|
||||
}
|
||||
SendDrawingStyleToDAWNGUI( gui_out ) ; // gui_out, viewing mode
|
||||
gui_out << "0.001" << G4endl ; // 3D Tolerance
|
||||
gui_out << "0" << G4endl ; // not display parameters
|
||||
|
||||
|
||||
// ######### P2
|
||||
gui_out << 1 << G4endl; // Source light
|
||||
gui_out << 1 << G4endl;
|
||||
gui_out << 1 << G4endl;
|
||||
gui_out << 0.5 << G4endl; // Ambient light
|
||||
gui_out << 0.5 << G4endl;
|
||||
gui_out << 0.5 << G4endl;
|
||||
gui_out << 19.0 << G4endl; // Light direction (Polar)
|
||||
gui_out << 71.0 << G4endl; // Light direction (Azimuthal)
|
||||
|
||||
// ######### P3
|
||||
gui_out << 0.1 << G4endl; // Real edge width
|
||||
gui_out << 0.1 << G4endl; // outline width
|
||||
gui_out << 0.1 << G4endl; // aux edge width
|
||||
gui_out << 3 << G4endl; // aux edge style
|
||||
gui_out << 70.0<< G4endl; // aux-edge threshold angle
|
||||
gui_out << 0.1 << G4endl; // line width
|
||||
gui_out << 0 << G4endl; // haloing
|
||||
gui_out << 1 << G4endl; // Dashed edged for back faces
|
||||
|
||||
//######### P4
|
||||
//----- drawing device
|
||||
//######### P4
|
||||
//----- drawing device
|
||||
// enum {PS=1, XWIN=2, PS2=3, XWIN2=4, OPEN_GL=5, DEVICE_END=6};
|
||||
if( ( ( std::getenv( FR_ENV_MULTI_WINDOW ) != NULL ) && \
|
||||
( strcmp( std::getenv( FR_ENV_MULTI_WINDOW ),"0" ) ) ) || \
|
||||
( ( std::getenv( FR_ENV_MULTI_WINDOW2 ) != NULL ) && \
|
||||
( strcmp( std::getenv( FR_ENV_MULTI_WINDOW2 ),"0" ) ) ) )
|
||||
{
|
||||
gui_out << 2 << G4endl; // OpenWindow
|
||||
} else {
|
||||
gui_out << 1 << G4endl; // Invoke PS viewer
|
||||
}
|
||||
if(((std::getenv(FR_ENV_MULTI_WINDOW) != NULL) &&
|
||||
(strcmp(std::getenv(FR_ENV_MULTI_WINDOW), "0"))) ||
|
||||
((std::getenv(FR_ENV_MULTI_WINDOW2) != NULL) &&
|
||||
(strcmp(std::getenv(FR_ENV_MULTI_WINDOW2), "0"))))
|
||||
{
|
||||
gui_out << 2 << G4endl; // OpenWindow
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_out << 1 << G4endl; // Invoke PS viewer
|
||||
}
|
||||
|
||||
gui_out << GetPSViewer() << G4endl; // PS viewer
|
||||
gui_out << 1 << G4endl ; // Do not add showpage
|
||||
gui_out << 0 << G4endl ; // Non-append mode
|
||||
gui_out << GetPSViewer() << G4endl; // PS viewer
|
||||
gui_out << 1 << G4endl; // Do not add showpage
|
||||
gui_out << 0 << G4endl; // Non-append mode
|
||||
|
||||
gui_out.close();
|
||||
//########### end of generating file .DAWN.history
|
||||
|
||||
|
||||
}
|
||||
gui_out.close();
|
||||
//########### end of generating file .DAWN.history
|
||||
}
|
||||
|
||||
@@ -1,319 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// Satoshi TANAKA, Wed Jul 3 14:14:29 JST 1996
|
||||
////////////////////////////////
|
||||
///// G4FRClientServer.cc /////
|
||||
////////////////////////////////
|
||||
|
||||
|
||||
//=================//
|
||||
#ifdef G4VIS_BUILD_DAWN_DRIVER
|
||||
//=================//
|
||||
|
||||
#include "G4VisManager.hh"
|
||||
#include "G4FRClientServer.hh"
|
||||
|
||||
// #define DEBUG_CLIENT_SERVER
|
||||
|
||||
#include<sys/param.h>
|
||||
|
||||
//----- const
|
||||
const char DEFAULT_SUN_PATH[] = "FR_TMP3" ;
|
||||
const int DEFAULT_PORT_NUMBER = 40701 ;
|
||||
//const char FR_ENV_SERVER_HOST_NAME[] = "G4DAWN_HOST_NAME" ; // moved to .hh
|
||||
const int MAX_CONNECT_TRIAL = 10 ;
|
||||
const char FR_DEFAULT_HOST_NAME[] = "localhost" ;
|
||||
|
||||
//----- G4FRClientServer::G4FRClientServer ()
|
||||
G4FRClientServer::G4FRClientServer ( char terminator , char end_line ) :
|
||||
TERMINATOR ( terminator ) ,
|
||||
END_OF_LINE( end_line ) ,
|
||||
fSocketFd ( -1 )
|
||||
{
|
||||
SetSunPath ( DEFAULT_SUN_PATH ) ; // for Unix domain
|
||||
SetPortNumber ( DEFAULT_PORT_NUMBER ) ;
|
||||
ClearReceivedMessage () ;
|
||||
}
|
||||
|
||||
|
||||
//----- G4FRClientServer::ConnectUnix()
|
||||
int G4FRClientServer::ConnectUnix()
|
||||
{
|
||||
//----- local
|
||||
int flag_connected = 0 ;
|
||||
struct sockaddr_un server_address ;
|
||||
|
||||
//----- make socket
|
||||
fSocketFd = socket( AF_UNIX, SOCK_STREAM, 0 );
|
||||
if( fSocketFd < 0 ) { Err("G4FRClientServer::ConnectUnix(),socket"); }
|
||||
|
||||
//----- set server address
|
||||
memset( (char *)&server_address, '\0', sizeof(server_address)) ;
|
||||
server_address.sun_family = AF_UNIX ;
|
||||
strcpy( server_address.sun_path, SUN_PATH );
|
||||
|
||||
//----- connection
|
||||
int connection_status = -1 ;
|
||||
int num_trial = 0 ;
|
||||
while( connection_status < 0 && num_trial <= MAX_CONNECT_TRIAL ) {
|
||||
num_trial++ ;
|
||||
connection_status = connect( fSocketFd, (struct sockaddr * )(&server_address), sizeof( server_address ) ) ;
|
||||
if( connection_status <0 )
|
||||
{
|
||||
#if defined DEBUG_CLIENT_SERVER
|
||||
Err("G4FRClientServer::ConnectUnix(),connect => RETRY");
|
||||
#endif
|
||||
flag_connected = 0 ;
|
||||
} else {
|
||||
flag_connected = 1 ;
|
||||
break ;
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
|
||||
} // while(connection_status...)
|
||||
|
||||
//----- return status of connection
|
||||
return flag_connected ;
|
||||
|
||||
} // G4FRClientServer::ConnectUnix()
|
||||
|
||||
|
||||
//----- G4FRClientServer::Receive()
|
||||
void G4FRClientServer::Receive()
|
||||
{
|
||||
//-----
|
||||
ClearReceivedMessage () ;
|
||||
if( recv( fSocketFd, fReceivedMessage, G4FRClientServer::RECV_BUFMAX , 0 ) < 0 )
|
||||
{
|
||||
Err("G4FRClientServer::Receive(), recv");
|
||||
}
|
||||
|
||||
#if defined DEBUG_CLIENT_SERVER
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << ">>>>> receivedMessage = " << fReceivedMessage << G4endl;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
//----- G4FRClientServer::ReceiveLine()
|
||||
void G4FRClientServer::ReceiveLine()
|
||||
{
|
||||
//----- local
|
||||
char buf[1];
|
||||
int index = 0 ;
|
||||
|
||||
//----- receive a line (until newline)
|
||||
memset(fReceivedMessage, '\0', RECV_BUFMAX) ;
|
||||
while( read( fSocketFd, buf, 1 ) == 1 ) {
|
||||
fReceivedMessage[index++] = buf[0];
|
||||
if( IsEndOfLine(buf[0]) ) { break ;}
|
||||
}
|
||||
} // G4FRClientServer::ReceiveLine()
|
||||
|
||||
|
||||
//----- G4FRClientServer::Send()
|
||||
void G4FRClientServer::Send()
|
||||
{
|
||||
if( send( fSocketFd, fSendingMessage, strlen(fSendingMessage) , 0 ) < 0 )
|
||||
{
|
||||
Err("G4FRClientServer::Send(), send");
|
||||
}
|
||||
|
||||
#if defined DEBUG_CLIENT_SERVER
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "<<<<< SentMessage = " << fSendingMessage << G4endl;
|
||||
#endif
|
||||
|
||||
} // G4FRClientServer::Send()
|
||||
|
||||
|
||||
//----- G4FRClientServer::Send( message )
|
||||
void G4FRClientServer::Send( const char* message )
|
||||
{
|
||||
this->SetSendingMessage( message ) ;
|
||||
this->Send();
|
||||
|
||||
} // G4FRClientServer::Send( message )
|
||||
|
||||
|
||||
//----- G4FRClientServer::SendLine()
|
||||
void G4FRClientServer::SendLine( const char* message )
|
||||
{
|
||||
//----- local
|
||||
int smsg_length ;
|
||||
|
||||
//----- set message to sending buf
|
||||
this->SetSendingMessage( message ) ;
|
||||
smsg_length = GetSendingMessageLength() ;
|
||||
|
||||
//----- add newline if necessary
|
||||
if( !IsEndOfLine( fSendingMessage[ (smsg_length - 1)] ) ) {
|
||||
fSendingMessage[ smsg_length ] = GetEndOfLine() ;
|
||||
fSendingMessage[ (smsg_length +1) ] = '\0' ;
|
||||
smsg_length = GetSendingMessageLength();
|
||||
}
|
||||
|
||||
//----- send
|
||||
this->Send();
|
||||
|
||||
}// G4FRClientServer::SendLine()
|
||||
|
||||
|
||||
//----- G4FRClientServer::DisConnect()
|
||||
void G4FRClientServer::DisConnect()
|
||||
{
|
||||
//----- close connection
|
||||
if( shutdown(fSocketFd,2) < 0 ) {
|
||||
Err("G4FRClientServer::DisConnect,shutdown");
|
||||
}
|
||||
close( fSocketFd );
|
||||
|
||||
this->Clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//----- G4FRClientServer::Clear()
|
||||
void G4FRClientServer::Clear()
|
||||
{
|
||||
unlink(SUN_PATH) ;
|
||||
fSocketFd = -1 ;
|
||||
}
|
||||
|
||||
|
||||
//----- G4FRClientServer::ConnectINET()
|
||||
int G4FRClientServer::ConnectINET()
|
||||
{
|
||||
//----- local
|
||||
int flag_connected = 0 ;
|
||||
sockaddr_in server_address ;
|
||||
char server_hostname[32] ;
|
||||
hostent* server_host_p ;
|
||||
|
||||
//----- make socket
|
||||
fSocketFd = socket( AF_INET, SOCK_STREAM, 0 );
|
||||
if( fSocketFd < 0 ) {
|
||||
#if defined DEBUG_CLIENT_SERVER
|
||||
Err("G4FRClientServer::ConnectINET(),socket");
|
||||
#endif
|
||||
}
|
||||
|
||||
//----- get IP address of server from its name
|
||||
if( std::getenv( FR_ENV_SERVER_HOST_NAME ) != NULL )
|
||||
{
|
||||
//----- get server name
|
||||
strcpy( server_hostname, std::getenv( FR_ENV_SERVER_HOST_NAME ) );
|
||||
|
||||
//----- get IP address of server from its name,
|
||||
//..... reading /etc/hosts
|
||||
server_host_p = gethostbyname( server_hostname ) ;
|
||||
|
||||
//----- If the host specified by FR_ENV_SERVER_HOST_NAME
|
||||
//..... is not written in /etc/hosts,
|
||||
//...... server host is set to the same as the
|
||||
//...... client host
|
||||
if( !server_host_p ) {
|
||||
#if defined DEBUG_CLIENT_SERVER
|
||||
Err("G4FRClientServer::ConnectINET(), gethostbyname");
|
||||
#endif
|
||||
server_host_p = gethostbyname( FR_DEFAULT_HOST_NAME ) ;
|
||||
}
|
||||
|
||||
} else {
|
||||
server_host_p = gethostbyname( FR_DEFAULT_HOST_NAME ) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// #if defined DEBUG_CLIENT_SERVER
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** Trying connection to " << server_hostname << G4endl;
|
||||
// #endif
|
||||
|
||||
|
||||
//----- connection and binding
|
||||
memset( (char *)&server_address, '\0', sizeof(server_address)) ;
|
||||
// clear server_address
|
||||
server_address.sin_family = AF_INET ;
|
||||
server_address.sin_port = htons( PORT_NUMBER );
|
||||
memcpy( (char *)(&server_address.sin_addr ),
|
||||
(char *)( server_host_p->h_addr ),
|
||||
server_host_p->h_length );
|
||||
|
||||
int connection_status = -1 ;
|
||||
int num_trial = 0 ;
|
||||
while( connection_status < 0 && num_trial <= MAX_CONNECT_TRIAL ) {
|
||||
num_trial++ ;
|
||||
connection_status = connect( fSocketFd, (struct sockaddr * )(&server_address), sizeof( server_address ) ) ;
|
||||
if( connection_status <0 )
|
||||
{
|
||||
#if defined DEBUG_CLIENT_SERVER
|
||||
Err("G4FRClientServer::ConnectINET(),connect => RETRY");
|
||||
#endif
|
||||
flag_connected = 0 ;
|
||||
} else {
|
||||
flag_connected = 1 ;
|
||||
break ;
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
|
||||
} // while(connection_status...)
|
||||
|
||||
//----- return status of connection
|
||||
return flag_connected ;
|
||||
|
||||
} // G4FRClientServer::ConnectINET()
|
||||
|
||||
|
||||
//----- G4FRClientServer::WaitSendBack()
|
||||
void G4FRClientServer::WaitSendBack( const char* command_string )
|
||||
{
|
||||
//----- wait for sending back
|
||||
while(1) {
|
||||
this->ReceiveLine();
|
||||
|
||||
if( !strncmp( this->GetReceivedMessage(), \
|
||||
command_string , \
|
||||
(strlen(command_string)) ) )
|
||||
{
|
||||
break;
|
||||
} else {
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
} // while
|
||||
|
||||
//----- clear buffer to receive message
|
||||
this->ClearReceivedMessage();
|
||||
|
||||
} // G4FRClientServer::WaitSendBack()
|
||||
|
||||
#endif // G4VIS_BUILD_DAWN_DRIVER
|
||||
@@ -1,271 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Satoshi TANAKA
|
||||
// FukuiRenderer factory.
|
||||
|
||||
//=================//
|
||||
#ifdef G4VIS_BUILD_DAWN_DRIVER
|
||||
//=================//
|
||||
|
||||
//#define DEBUG_FR_SYSTEM
|
||||
|
||||
|
||||
#include "G4FukuiRenderer.hh"
|
||||
|
||||
#define __G_ANSI_C__
|
||||
|
||||
#include "G4VisManager.hh"
|
||||
//#include "G4VisFeaturesOfFukuiRenderer.hh"
|
||||
#include "G4VSceneHandler.hh"
|
||||
#include "G4FukuiRendererSceneHandler.hh"
|
||||
#include "G4FukuiRendererViewer.hh"
|
||||
#include "G4FRClientServer.hh"
|
||||
#include "G4FRConst.hh"
|
||||
#include "G4FRFeatures.hh"
|
||||
|
||||
//----- constant
|
||||
const int FR_DEFAULT_CONNECTION_TIME = 5 ;
|
||||
const char FR_ENV_CONNECTION_TIME [] = "G4DAWN_CONNECTION_TIME";
|
||||
const char FR_ENV_DAWN_GUI_ALWAYS [] = "G4DAWN_GUI_ALWAYS";
|
||||
|
||||
//----- G4FukuiRenderer, constructor
|
||||
G4FukuiRenderer::G4FukuiRenderer ():
|
||||
G4VGraphicsSystem ("FukuiRenderer",
|
||||
"DAWN",
|
||||
FR_DAWNFILE_FEATURES,
|
||||
G4VGraphicsSystem::threeD),
|
||||
fPrimDest() ,
|
||||
fIPMode( G4FukuiRenderer::IP_UNIX ),
|
||||
flag_use_gui (false) ,
|
||||
flag_connected (0)
|
||||
{
|
||||
//----- sorting of objects
|
||||
if( ( std::getenv( FR_ENV_DAWN_GUI_ALWAYS ) != NULL ) && \
|
||||
( strcmp( std::getenv( FR_ENV_DAWN_GUI_ALWAYS ),"0" ) ) )
|
||||
{
|
||||
flag_use_gui = true ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//----- G4FukuiRenderer, destructor
|
||||
G4FukuiRenderer::~G4FukuiRenderer ()
|
||||
{
|
||||
if( flag_connected ) {
|
||||
//----- Terminate FukuiRenderer
|
||||
fPrimDest.SendLine( FR_TERMINATE_DAWND ) ;
|
||||
|
||||
//----- disconnection
|
||||
fPrimDest.DisConnect();
|
||||
flag_connected = 0 ;
|
||||
}
|
||||
}
|
||||
|
||||
//----- G4FukuiRenderer::CreateSceneHandler ()
|
||||
G4VSceneHandler* G4FukuiRenderer::CreateSceneHandler (const G4String& name)
|
||||
{
|
||||
G4VSceneHandler* p = new G4FukuiRendererSceneHandler (*this, name);
|
||||
|
||||
if(!flag_connected) { delete p ; p = NULL ; }
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
//----- G4FukuiRenderer::CreateViewer ()
|
||||
G4VViewer* G4FukuiRenderer::CreateViewer (G4VSceneHandler& scene, const G4String& name)
|
||||
{
|
||||
if(!flag_connected) return NULL;
|
||||
G4VViewer* pView =
|
||||
new G4FukuiRendererViewer ((G4FukuiRendererSceneHandler&) scene, name);
|
||||
return pView;
|
||||
}
|
||||
|
||||
//----- G4FukuiRenderer::UseInetDomainAuto()
|
||||
void G4FukuiRenderer::UseInetDomainAuto()
|
||||
{
|
||||
int pid ;
|
||||
|
||||
#if defined DEBUG_FR_SYSTEM
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** Unix Inet Domain (AUTO mode)" << G4endl;
|
||||
#endif
|
||||
fIPMode = G4FukuiRenderer::IP_UNIX ;
|
||||
|
||||
if( ( pid = fork() ) == 0 ) { // child
|
||||
if ( execlp ( "dawn", "dawn", "-G" , (char *)0 ) < 0 )
|
||||
{
|
||||
perror("dawn") ;
|
||||
}
|
||||
} else { // parent
|
||||
|
||||
//----- Set waiting time to ensure connection
|
||||
int connection_time = FR_DEFAULT_CONNECTION_TIME ;
|
||||
if( std::getenv( FR_ENV_CONNECTION_TIME ) != NULL ) {
|
||||
int sscanf_status = \
|
||||
sscanf( std::getenv( FR_ENV_CONNECTION_TIME ), "%d", &connection_time) ;
|
||||
if ( sscanf_status == EOF ) {
|
||||
connection_time = FR_DEFAULT_CONNECTION_TIME ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//----- Wait for starting up of FukuiRenderer
|
||||
sleep(connection_time);
|
||||
|
||||
//----- establish connection
|
||||
this->ConnectPort();
|
||||
}
|
||||
|
||||
if(!flag_connected) {
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** ERROR: Connection failed" << G4endl;
|
||||
}
|
||||
else {
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
|
||||
G4cout << "***** GEANT4 is connected to FukuiRenderer DAWN ";
|
||||
G4cout << "in the same host" << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
} // G4FukuiRenderer::UseInetDomainAuto()
|
||||
|
||||
|
||||
//----- G4FukuiRenderer::UseInetDomain()
|
||||
void
|
||||
G4FukuiRenderer::UseInetDomain()
|
||||
{
|
||||
#if defined DEBUG_FR_SYSTEM
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** INET Domain " << G4endl;
|
||||
#endif
|
||||
fIPMode = G4FukuiRenderer::IP_INET ;
|
||||
|
||||
this->ConnectPort();
|
||||
|
||||
if(!flag_connected) {
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** ERROR: Connection failed" << G4endl;
|
||||
}
|
||||
else {
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
|
||||
G4cout << "GEANT4 is connected to FukuiRenderer DAWN via socket" ;
|
||||
G4cout << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
} // G4FukuiRenderer::UseInetDomain()
|
||||
|
||||
void
|
||||
G4FukuiRenderer::ConnectPort( int max_port_incr )
|
||||
{
|
||||
//----- establish connection
|
||||
int connect_trial = 0 ;
|
||||
while(1) {
|
||||
if ( ++connect_trial > max_port_incr ) {
|
||||
this->flag_connected = 0 ;
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
|
||||
G4cout << "***** INET Connection failed." << G4endl;
|
||||
G4cout << " Maybe, you have not invoked DAWN yet," << G4endl;
|
||||
G4cout << " or too many DAWN's are already running" << G4endl;
|
||||
G4cout << " in the server host." << G4endl;
|
||||
}
|
||||
fPrimDest.IncrementPortNumber( (- FR_MAX_PORT_INCR) );
|
||||
return ;
|
||||
} else if ( fPrimDest.ConnectINET() ) {
|
||||
// INET domain connection is established
|
||||
this->flag_connected = 1 ;
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
|
||||
G4cout << "***** GEANT4 is connected to port " ;
|
||||
G4cout << fPrimDest.GetPortNumber() ;
|
||||
G4cout << " of server" << G4endl;
|
||||
}
|
||||
break ;
|
||||
} else {
|
||||
// Connection failed. Try the next port.
|
||||
this->flag_connected = 0 ;
|
||||
fPrimDest.IncrementPortNumber();
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
|
||||
G4cout << "***** GEANT4 incremented targeting port to " ;
|
||||
G4cout << fPrimDest.GetPortNumber() << G4endl;
|
||||
}
|
||||
|
||||
} // if-elseif-else
|
||||
|
||||
} // while (1)
|
||||
}
|
||||
|
||||
|
||||
//----- G4FukuiRenderer::UseBSDUnixDomainAuto()
|
||||
void G4FukuiRenderer::UseBSDUnixDomainAuto()
|
||||
{
|
||||
int pid ;
|
||||
|
||||
#if defined DEBUG_FR_SYSTEM
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** UseBSDUnixDomainAuto " << G4endl;
|
||||
#endif
|
||||
fIPMode = G4FukuiRenderer::IP_UNIX ; // Unix domain
|
||||
|
||||
if( ( pid = fork() ) == 0 ) { // child
|
||||
if ( execlp ( "dawn", "dawn", "-g" , (char *)0 ) < 0 )
|
||||
{
|
||||
perror("dawn") ;
|
||||
}
|
||||
} else { // parent
|
||||
|
||||
//----- Sleep for a while to make sure that
|
||||
//..... FukuiRenderer is ready
|
||||
int connection_time = FR_DEFAULT_CONNECTION_TIME ;
|
||||
if( std::getenv( FR_ENV_CONNECTION_TIME ) != NULL ) {
|
||||
int sscanf_status = \
|
||||
sscanf( std::getenv( FR_ENV_CONNECTION_TIME ), "%d", &connection_time) ;
|
||||
if ( sscanf_status == EOF ) { connection_time = FR_DEFAULT_CONNECTION_TIME ;}
|
||||
}
|
||||
sleep(connection_time);
|
||||
|
||||
//----- connect GEANT4 to FukuiRenderer
|
||||
this->flag_connected = fPrimDest.ConnectUnix();
|
||||
|
||||
//----- display status
|
||||
if(!flag_connected) {
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** ERROR: Connection failed" << G4endl;
|
||||
} else {
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
|
||||
G4cout << "*** GEANT4 is connected to FukuiRenderer DAWN ";
|
||||
G4cout << "in the same host" << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
} // if--else
|
||||
|
||||
}// G4FukuiRenderer::UseBSDUnixDomainAuto()
|
||||
|
||||
|
||||
#endif // G4VIS_BUILD_DAWN_DRIVER
|
||||
@@ -1,214 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Satoshi TANAKA, Fri Jun 28 11:34:24 JST 1996
|
||||
// FukuiRenderer scene.
|
||||
|
||||
|
||||
//=================//
|
||||
#ifdef G4VIS_BUILD_DAWN_DRIVER
|
||||
//=================//
|
||||
|
||||
|
||||
#define __G_ANSI_C__
|
||||
|
||||
// #define DEBUG_FR_SCENE
|
||||
|
||||
//----- header files
|
||||
#include <fstream>
|
||||
#include <string.h>
|
||||
#include "globals.hh"
|
||||
#include "G4VisManager.hh"
|
||||
#include "G4FRConst.hh"
|
||||
#include "G4FukuiRenderer.hh"
|
||||
#include "G4FukuiRendererSceneHandler.hh"
|
||||
#include "G4FukuiRendererViewer.hh"
|
||||
#include "G4Point3D.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Scene.hh"
|
||||
#include "G4Transform3D.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Cons.hh"
|
||||
#include "G4Polyline.hh"
|
||||
#include "G4Trd.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4Trap.hh"
|
||||
#include "G4Torus.hh"
|
||||
#include "G4Sphere.hh"
|
||||
#include "G4Para.hh"
|
||||
#include "G4Text.hh"
|
||||
#include "G4Circle.hh"
|
||||
#include "G4Square.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
|
||||
//----- constants
|
||||
const char FR_ENV_CULL_INVISIBLE_OBJECTS [] = "G4DAWN_CULL_INVISIBLE_OBJECTS";
|
||||
const char FR_ENV_MULTI_WINDOW[] = "G4DAWN_MULTI_WINDOW" ;
|
||||
|
||||
///////////////////////////
|
||||
// Driver-dependent part //
|
||||
///////////////////////////
|
||||
|
||||
|
||||
//----- G4FukuiRendererSceneHandler, constructor
|
||||
G4FukuiRendererSceneHandler::G4FukuiRendererSceneHandler (G4FukuiRenderer& system,
|
||||
const G4String& name):
|
||||
G4VSceneHandler (system, fSceneIdCount++, name) ,
|
||||
fSystem (system) ,
|
||||
fPrimDest (system.GetPrimDest() ) ,
|
||||
FRflag_in_modeling (false) ,
|
||||
flag_saving_g4_prim (false) ,
|
||||
COMMAND_BUF_SIZE (G4FRClientServer::SEND_BUFMAX),
|
||||
fPrec (9), fPrec2 (16)
|
||||
{
|
||||
|
||||
//----- Connection to FukuiRenderer is set in the first scene
|
||||
if( !fSystem.IsConnected() )
|
||||
{
|
||||
if ( std::getenv( FR_ENV_NAMED_PIPE_CONNECTION ) != NULL &&\
|
||||
strcmp( std::getenv( FR_ENV_NAMED_PIPE_CONNECTION ), "0" ) )
|
||||
{
|
||||
// Invoke DAWN locally and make connection
|
||||
// via named pipe (not supported in AIX etc)
|
||||
fSystem.UseBSDUnixDomainAuto();
|
||||
} else if( std::getenv( FR_ENV_SERVER_HOST_NAME ) == NULL )
|
||||
{
|
||||
// Invoke DAWN locally and make connection
|
||||
// via socket
|
||||
fSystem.UseInetDomainAuto();
|
||||
} else {
|
||||
// Connect to remote DAWN via socket
|
||||
fSystem.UseInetDomain();
|
||||
}
|
||||
}
|
||||
|
||||
//----- precision control
|
||||
if( std::getenv( "G4DAWN_PRECISION" ) != NULL ) {
|
||||
sscanf( std::getenv("G4DAWN_PRECISION"), "%d", &fPrec ) ;
|
||||
} else {
|
||||
fPrec = 9 ;
|
||||
}
|
||||
fPrec2 = fPrec + 7 ;
|
||||
|
||||
} // G4FukuiRendererSceneHandler, constructor
|
||||
|
||||
|
||||
//----- G4FukuiRendererSceneHandler, destructor
|
||||
G4FukuiRendererSceneHandler::~G4FukuiRendererSceneHandler ()
|
||||
{
|
||||
#if defined DEBUG_FR_SCENE
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** ~G4FukuiRendererSceneHandler" << G4endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----
|
||||
void G4FukuiRendererSceneHandler::FRBeginModeling( void )
|
||||
{
|
||||
if( !FRIsInModeling() )
|
||||
{
|
||||
#if defined DEBUG_FR_SCENE
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** G4FukuiRendererSceneHandler::FRBeginModeling (called & started)" << G4endl;
|
||||
#endif
|
||||
|
||||
//----- Begin Saving g4.prim file
|
||||
// open g4.prim, ##
|
||||
BeginSavingG4Prim();
|
||||
|
||||
//----- Send Bounding Box
|
||||
// /BoundingBox
|
||||
SendBoundingBox();
|
||||
|
||||
//----- drawing device
|
||||
// !Device
|
||||
// (Note: Not saved in g4.prim)
|
||||
if( ( std::getenv( FR_ENV_MULTI_WINDOW ) != NULL ) && \
|
||||
( strcmp( std::getenv( FR_ENV_MULTI_WINDOW ),"0" ) ) )
|
||||
{
|
||||
((G4FukuiRendererViewer*)fpViewer)->SendDevice( G4FukuiRendererViewer::FRDEV_XWIN ) ;
|
||||
} else {
|
||||
((G4FukuiRendererViewer*)fpViewer)->SendDevice( G4FukuiRendererViewer::FRDEV_PS ) ;
|
||||
}
|
||||
|
||||
//----- drawing style
|
||||
// /WireFrame, /Surface etc
|
||||
// (Note: Not saved in g4.prim)
|
||||
((G4FukuiRendererViewer*)fpViewer)->SendDrawingStyle() ;
|
||||
|
||||
//----- set view parameters
|
||||
// /CameraPosition, /TargetPoint,
|
||||
// /ZoomFactor, /FocalDistance,
|
||||
// !GraphicalUserInterface
|
||||
((G4FukuiRendererViewer*)fpViewer)->SendViewParameters();
|
||||
|
||||
//----- send SET_CAMERA command
|
||||
// !SetCamera
|
||||
#if defined DEBUG_FR_SCENE
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** (!SetCamera in FRBeginModeling())" << G4endl;
|
||||
#endif
|
||||
SendStr( FR_SET_CAMERA );
|
||||
|
||||
//----- open device
|
||||
// !OpenDevice
|
||||
#if defined DEBUG_FR_SCENE
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** (!OpenDevice in FRBeginModeling())" << G4endl;
|
||||
#endif
|
||||
SendStr( FR_OPEN_DEVICE );
|
||||
|
||||
//----- begin sending primitives
|
||||
// !BeginModeling
|
||||
#if defined DEBUG_FR_SCENE
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** (!BeginModeling in FRBeginModeling())" << G4endl;
|
||||
#endif
|
||||
SendStr( FR_BEGIN_MODELING ); FRflag_in_modeling = true ;
|
||||
|
||||
} // if
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
// Common to DAWN and DAWNFILE drivers //
|
||||
/////////////////////////////////////////
|
||||
|
||||
#define G4FRSCENEHANDLER G4FukuiRendererSceneHandler
|
||||
#include "G4FRSceneFunc.icc"
|
||||
#undef G4FRSCENEHANDLER
|
||||
|
||||
//////////////////////
|
||||
// static variables //
|
||||
//////////////////////
|
||||
|
||||
//----- static variables
|
||||
G4int G4FukuiRendererSceneHandler::fSceneIdCount = 0;
|
||||
|
||||
#endif // G4VIS_BUILD_DAWN_DRIVER
|
||||
@@ -1,311 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Satoshi TANAKA, Fri Jun 28 12:09:11 JST 1996
|
||||
// FukuiRenderer view - opens window, hard copy, etc.
|
||||
|
||||
|
||||
//=================//
|
||||
#ifdef G4VIS_BUILD_DAWN_DRIVER
|
||||
//=================//
|
||||
|
||||
#define __G_ANSI_C__
|
||||
#define G4FukuiRenderer_STRUCTURE_PRIORITY 1.
|
||||
|
||||
// #define DEBUG_FR_VIEW
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "G4VisManager.hh"
|
||||
#include "G4Scene.hh"
|
||||
#include "G4Vector3D.hh"
|
||||
#include "G4VisExtent.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
|
||||
#include "G4FRConst.hh"
|
||||
#include "G4FukuiRenderer.hh"
|
||||
#include "G4FukuiRendererSceneHandler.hh"
|
||||
#include "G4FukuiRendererViewer.hh"
|
||||
|
||||
|
||||
//----- Constructor
|
||||
G4FukuiRendererViewer::G4FukuiRendererViewer (G4FukuiRendererSceneHandler& sceneHandler,
|
||||
const G4String& name):
|
||||
G4VViewer (sceneHandler,
|
||||
sceneHandler.IncrementViewCount (),
|
||||
name),
|
||||
fSceneHandler (sceneHandler)
|
||||
{}
|
||||
|
||||
//----- Destructor
|
||||
G4FukuiRendererViewer::~G4FukuiRendererViewer ()
|
||||
{}
|
||||
|
||||
//-----
|
||||
void G4FukuiRendererViewer::SetView ()
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** G4FukuiRendererViewer::SetView(): No effects" << G4endl;
|
||||
#endif
|
||||
// Do nothing, since DAWN is running as a different process.
|
||||
// SendViewParameters () will do this job instead.
|
||||
}
|
||||
|
||||
//-----
|
||||
void
|
||||
G4FukuiRendererViewer::ClearView( void )
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** G4FukuiRendererViewer::ClearView (): No effects " << G4endl;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-----
|
||||
void G4FukuiRendererViewer::DrawView ()
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** G4FukuiRendererViewer::DrawView () " << G4endl;
|
||||
#endif
|
||||
|
||||
//----- Begin modeling 3D
|
||||
fSceneHandler.FRBeginModeling();
|
||||
|
||||
//----- Always visit G4 kernel
|
||||
NeedKernelVisit ();
|
||||
|
||||
//----- Draw
|
||||
ProcessView () ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-----
|
||||
void G4FukuiRendererViewer::ShowView( void )
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** G4FukuiRendererViewer::ShowView () " << G4endl;
|
||||
#endif
|
||||
|
||||
if( fSceneHandler.FRIsInModeling() )
|
||||
{
|
||||
//----- End of modeling
|
||||
// !EndModeling, !DrawAll, !CloseDevice,
|
||||
// close g4.prim
|
||||
fSceneHandler.FREndModeling();
|
||||
|
||||
//----- Wait user clicks drawing Area
|
||||
this->Wait();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-----
|
||||
void G4FukuiRendererViewer::Wait()
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** G4FukuiRendererViewer::Wait () : Begin" << G4endl;
|
||||
#endif
|
||||
fSceneHandler.SendStr ( FR_WAIT );
|
||||
fSceneHandler.GetPrimDest().WaitSendBack( FR_WAIT );
|
||||
#if defined DEBUG_FR_VIEW
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** G4FukuiRendererViewer::Wait () : end" << G4endl;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-----
|
||||
void
|
||||
G4FukuiRendererViewer::SendDevice( FRDEV dev )
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** G4FukuiRendererViewer::SendDevice() " << G4endl;
|
||||
#endif
|
||||
|
||||
// enum {PS=1, XWIN=2, PS2=3, XWIN2=4, OPEN_GL=5, DEVICE_END=6};
|
||||
|
||||
if( dev >= FRDEV_PS && dev < FRDEV_DEVICE_END ) {
|
||||
fSceneHandler.SendStrInt ( FR_DEVICE, dev );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----
|
||||
void G4FukuiRendererViewer::SendDrawingStyle()
|
||||
{
|
||||
#if defined DEBUG_FR_VIEW
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** G4FukuiRendererViewer::SendDrawingStyle() " << G4endl;
|
||||
#endif
|
||||
|
||||
G4int style = fVP.GetDrawingStyle();
|
||||
|
||||
switch( style )
|
||||
{
|
||||
case G4ViewParameters::wireframe:
|
||||
fSceneHandler.SendStr( FR_WIREFRAME );
|
||||
break;
|
||||
case G4ViewParameters::hlr:
|
||||
fSceneHandler.SendStr( FR_LINES );
|
||||
break;
|
||||
case G4ViewParameters::hsr:
|
||||
case G4ViewParameters::hlhsr:
|
||||
fSceneHandler.SendStr( FR_SURFACE );
|
||||
break;
|
||||
default:
|
||||
fSceneHandler.SendStr( FR_WIREFRAME );
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-----
|
||||
void G4FukuiRendererViewer::SendViewParameters ()
|
||||
{
|
||||
// Calculates view representation based on extent of object being
|
||||
// viewed and (initial) direction of camera. (Note: it can change
|
||||
// later due to user interaction via visualization system's GUI.)
|
||||
|
||||
#if defined DEBUG_FR_VIEW
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
|
||||
G4cout << "***** G4FukuiRendererViewer::SendViewParameters()" << G4endl;
|
||||
#endif
|
||||
|
||||
//----- Magic number to decide camera distance automatically
|
||||
const G4double HOW_FAR = 1000.0 ; // to define "infinity"
|
||||
const G4double MIN_HALF_ANGLE = 0.01 ;
|
||||
const G4double MAX_HALF_ANGLE = 0.499 * pi ;
|
||||
|
||||
//----- (2A) CALC camera distance
|
||||
//..... Note: Camera cannot enter inside object
|
||||
G4double camera_distance ;
|
||||
G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
|
||||
|
||||
G4double half_view_angle = std::fabs ( fVP.GetFieldHalfAngle () ) ;
|
||||
if( half_view_angle > MAX_HALF_ANGLE ) {
|
||||
half_view_angle = MAX_HALF_ANGLE ;
|
||||
}
|
||||
|
||||
if( half_view_angle < MIN_HALF_ANGLE ) {
|
||||
//----- infinity (or ortho projection)
|
||||
camera_distance = radius * HOW_FAR ;
|
||||
} else {
|
||||
//----- Calc camera distance from half view angle
|
||||
camera_distance = radius / std::sin ( half_view_angle );
|
||||
camera_distance -= fVP.GetDolly();
|
||||
}
|
||||
|
||||
if ( camera_distance < radius ) {
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
|
||||
G4cout << "WARNING from FukuiRenderer (DAWN) driver:" << G4endl;
|
||||
G4cout << " Camera cannot enter inside objects" << G4endl;
|
||||
}
|
||||
camera_distance = radius ;
|
||||
}
|
||||
|
||||
//----- (3A) CALC camera direction
|
||||
const G4Vector3D& camera_direction \
|
||||
= fVP.GetViewpointDirection().unit();
|
||||
const G4double v_angle = (180.0 / pi) * camera_direction.theta() ;
|
||||
const G4double h_angle = (180.0 / pi) * camera_direction.phi () ;
|
||||
|
||||
//----- (2B), (3B) SEND camera position
|
||||
fSceneHandler.SendStrDouble3( FR_CAMERA_POSITION,
|
||||
camera_distance,
|
||||
v_angle,
|
||||
h_angle );
|
||||
|
||||
//----- (4A) CALC target point
|
||||
const G4Point3D& target_point
|
||||
= fSceneHandler.GetScene()->GetStandardTargetPoint()
|
||||
+ fVP.GetCurrentTargetPoint();
|
||||
|
||||
//----- (4B) SEND target point
|
||||
fSceneHandler.SendStrDouble3( FR_TARGET_POINT,
|
||||
target_point.x(),
|
||||
target_point.y(),
|
||||
target_point.z() );
|
||||
|
||||
//----- (5A) CALC zoom factor
|
||||
const G4double zoom_factor = fVP.GetZoomFactor();
|
||||
|
||||
//----- (5B) SEND zoom factor or focal length
|
||||
if( half_view_angle < MIN_HALF_ANGLE ) {
|
||||
|
||||
const G4Point3D& std_target_point \
|
||||
= fSceneHandler.GetScene()->GetStandardTargetPoint();
|
||||
|
||||
fSceneHandler.SendStrDouble4( FR_ZOOM_FACTOR,
|
||||
zoom_factor ,
|
||||
std_target_point.x(),
|
||||
std_target_point.y(),
|
||||
std_target_point.z());
|
||||
// Note that target point, camera position,
|
||||
// and bounding box have already been sent above.
|
||||
// The std_target_point is necessary to
|
||||
// Calc focal distance from the zoom factor.
|
||||
} else {
|
||||
const G4double FR_HALF_SCREEN_SIZE = 0.5 ;
|
||||
G4double focal_distance \
|
||||
= FR_HALF_SCREEN_SIZE / std::tan( half_view_angle );
|
||||
focal_distance *= zoom_factor ;
|
||||
fSceneHandler.SendStrDouble ( FR_FOCAL_DISTANCE, focal_distance );
|
||||
}
|
||||
|
||||
//----- INVOKE GUI: not executed in the default setting
|
||||
if( fSceneHandler.GetSystem().IsGUIMode() ) {
|
||||
//----- send GUI command
|
||||
fSceneHandler.SendStr( FR_GUI );
|
||||
|
||||
//----- wait the same command is sent back:
|
||||
//..... This avoids to send many data before
|
||||
//..... GUI session is over.
|
||||
fSceneHandler.GetPrimDest().WaitSendBack( FR_GUI );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // G4VIS_BUILD_DAWN_DRIVER
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
//
|
||||
#include "G4VisFeaturesOfDAWNFILE.hh"
|
||||
|
||||
//clang-format off
|
||||
|
||||
G4String G4VisFeaturesOfDAWNFILE () {
|
||||
return
|
||||
"High quality technical renderer."
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "G4VisFeaturesOfFukuiRenderer.hh"
|
||||
|
||||
G4String G4VisFeaturesOfFukuiRenderer () {
|
||||
return
|
||||
"High quality technical renderer."
|
||||
"\n Features: exact hidden line, hidden surface algorithms."
|
||||
"\n high (unlimited) resolution."
|
||||
"\n renders to PostScript for viewing and/or hardcopy."
|
||||
"\n remote rendering."
|
||||
"\n off-line rendering."
|
||||
"\n graphical user interface."
|
||||
"\n Disadvantages: compute intensive, takes time (use a fast graphics"
|
||||
"\n system, such as OpenGL, to select view, then copy"
|
||||
"\n to this renderer - /vis~/copy/view, /vis~/set/view).";
|
||||
}
|
||||
Reference in New Issue
Block a user