Import Geant4 1.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:28:20 +02:00
parent aaa409b6ee
commit ca1c8cb059
2995 changed files with 106830 additions and 299600 deletions
@@ -1,3 +1,29 @@
DAWN-V00-01-08
- Removed implicit casting from the previous updation
DAWN-V00-01-06 Satoshi TANAKA Nov 30, 1999
- Fixing improper definition of alpha1, alpha2
DAWN-V00-01-05 Satoshi TANAKA Nov 23, 1999
- Protection to special cases of G4Trap in AddThis()
DAWN-V00-01-04 Satoshi TANAKA Nov 02, 1999
- Protection to AddPrimitive( G4NURBS )
DAWN-V00-01-03 Satoshi TANAKA Nov 02, 1999
- Environmental variable G4DAWN_MULTI_WINDOW is
renamed to G4DAWNFILE_MULTI_WINDOW for DAWN-file driver.
(G4DAWN_MULTI_WINDOW still works for a while.)
DAWN-V00-01-02 Satoshi TANAKA Nov 01, 1999
- Separation of BeginModeling() and FRBeginModeling().
Co-workable with /run/beamOn with the new vis commands.
DAWN-V00-01-01 Satoshi TANAKA Aug 26, 1999
- Protection for invalid calling of BeginModeling
- .DAWN.history ==> .DAWN_1.history
**** It means DAWN version 3.80a or after is required ***
DAWN-00-03-06 Satoshi TANAKA Dec 04, 1998
- Maximun number of generated g4.prim files in the destination
directory is customizable as: "setenv G4DAWNFILE_MAX_FILE_NUM N"
+5 -6
View File
@@ -1,12 +1,11 @@
<< Portability >>
(1) --- Linux, DEC, HP, AIX, Solaris, IRIX ---
Compilation of DAWN-file and DAWN-network drivers
are confirmed at the following platforms:
Linux, DEC, HP, AIX, Solaris, IRIX
OK by default.
For Solaris, we assume that you use SUN-CC as G4SYSTEM.
For IRIX, we assume that you use SGI-CC as G4SYSTEM.
#endif
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4DAWNFILE.hh,v 1.4 1999/05/10 15:38:26 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4DAWNFILE.hh,v 1.4.8.1 1999/12/07 20:53:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
// Satoshi TANAKA
// DAWNFILE driver factory.
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4DAWNFILESceneHandler.hh,v 1.2 1999/05/10 15:38:27 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4DAWNFILESceneHandler.hh,v 1.3.4.1 1999/12/07 20:53:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
// Satoshi TANAKA
@@ -50,11 +50,12 @@ public:
void AddPrimitive (const G4Polymarker& polymarker)
{ G4VSceneHandler::AddPrimitive (polymarker); }
virtual void BeginModeling () ;
virtual void EndModeling () { G4VSceneHandler::EndModeling ();}
virtual void BeginModeling () { G4VSceneHandler::BeginModeling ();}
virtual void EndModeling () { G4VSceneHandler::EndModeling ();}
virtual void BeginPrimitives (const G4Transform3D& objectTransformation);
virtual void EndPrimitives ();
void AddThis ( const G4Box& box );
void AddThis ( const G4Cons& cons );
void AddThis ( const G4Tubs& tubs );
@@ -68,9 +69,10 @@ public:
void ClearStore (){}
//----- public methods inherent to this class
static G4int GetSceneCount ();
void FREndModeling () ;
G4bool IsInModeling () { return flag_in_modeling ; }
static G4int GetSceneCount ();
void FRBeginModeling () ;
void FREndModeling () ;
G4bool FRIsInModeling () { return FRflag_in_modeling ; }
G4bool IsSavingG4Prim ( void ) { return flag_saving_g4_prim ; }
void BeginSavingG4Prim( void );
@@ -87,13 +89,12 @@ private:
//----- Utilities etc (common to DAWN and DAWNFILE drivers )
G4bool SendVisAttributes ( const G4VisAttributes* pAV );
G4bool IsVisible ( void ) ;
G4bool InitializeFR ( void ) ;
void SendTransformedCoordinates( void ) ;
void SendPhysVolName ( void ) ;
void SendNdiv ( void ) ;
//----- public methods common to DAWN and DAWNFILE drivers
public:
void SendStr ( const char* char_string ) ;
void SendStrInt( const char* char_string ,
G4int ival );
@@ -191,15 +192,14 @@ private:
static G4int fSceneCount; // No. of existing scenes.
G4FRofstream fPrimDest ; // defined here
G4bool flag_in_modeling ;
G4bool FRflag_in_modeling ;
// true: FR_BEGIN_MODELING has sent to DAWN, and
// FR_END_MODELING has not sent yet.
// false: otherwise
//
// The flag flag_in_modeling is set to "true"
// in BeginModeling(), and to "false"
// FRflag_in_modeling is set to "true"
// in FRBeginModeling(), and to "false"
// in FREndModeling().
// ( EndModeling() is not used.)
G4bool flag_saving_g4_prim ;
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4DAWNFILEViewer.hh,v 1.3 1999/05/10 15:38:28 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4DAWNFILEViewer.hh,v 1.4.4.1 1999/12/07 20:53:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
// Satoshi TANAKA
// DAWNFILE viewer - opens window, hard copy, etc.
@@ -38,7 +38,6 @@ public:
void ClearView ();
void DrawView ();
void ShowView ();
void FlushView (); // ShowView() without calling Wait()
//---- methods inherent to this class
void SendViewParameters () ;
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FRClientServer.hh,v 1.2 1999/01/09 16:11:40 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4FRClientServer.hh,v 1.2.8.1 1999/12/07 20:53:09 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
// Satoshi TANAKA, Wed Jul 3 14:13:52 JST 1996
////////////////////////////////
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FRConst.hh,v 1.2 1999/01/09 16:11:41 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4FRConst.hh,v 1.3.4.1 1999/12/07 20:53:09 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
// Satoshi TANAKA, Tue Jul 2 15:30:49 JST 1996
///////////////////////////////////
@@ -51,6 +51,8 @@ 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 ;
const char FR_NDIV [] = "/Ndiv" ;
const char FR_NDIV_DEFAULT [] = "/Ndiv 24" ;
const char FR_NDIV_3 [] = "/Ndiv 3" ;
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FRFeatures.hh,v 1.2 1999/01/09 16:11:41 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4FRFeatures.hh,v 1.2.8.1 1999/12/07 20:53:09 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
#if !defined G4_FR_FEATURES_HH
#define G4_FR_FEATURES_HH
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FRSocketConfig.hh,v 1.2 1999/01/09 16:11:42 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4FRSocketConfig.hh,v 1.2.8.1 1999/12/07 20:53:09 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
////////////////////////////////
///// G4FRSocketConfig.h /////
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FRSocketMacro.hh,v 1.2 1999/01/09 16:11:42 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4FRSocketMacro.hh,v 1.2.8.1 1999/12/07 20:53:09 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
///////////////////////////////
///// G4FRSocketMacro.hh /////
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FRofstream.hh,v 1.2 1999/01/09 16:11:43 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4FRofstream.hh,v 1.2.8.1 1999/12/07 20:53:10 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
#include<fstream.h>
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FukuiRenderer.hh,v 1.4 1999/05/10 15:38:30 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4FukuiRenderer.hh,v 1.4.8.1 1999/12/07 20:53:10 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// Satoshi TANAKA
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FukuiRendererSceneHandler.hh,v 1.2 1999/05/10 15:38:31 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4FukuiRendererSceneHandler.hh,v 1.3.4.1 1999/12/07 20:53:10 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// Satoshi TANAKA, Fri Jun 28 11:19:19 JST 1996
@@ -30,73 +30,6 @@
class G4VisAttributes ;
class G4FukuiRenderer;
////////////////////////////////////////////////////////////////////////
//
// ===== About AddPrimitive() functions =====
//
// Any graphics driver should prepare AddPrimitive() functions
// for the following visualizable primitives:
//
// G4Polyline,
// G4NURBS (not supported by DAWN),
// G4Text, G4Circle, G4Square,
// G4Polyhedron
//
// A drawing function G4VisManager::Draw(...) is prepared for each
// of these primitives.
//
// These primitives have visualization attributes by themselves.
// AddPrimitive() functions use these assinged visualization attributes
// for visualization.
//
// Local coordinates to locate these primitives are set to the current in
// BeginPrimitive() functions.
// See G4VisManager::Draw( const G4Polyline&), for example.
//
//////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
//
// ========== About AddThis() functions =======
//
// AddThis() functions are usually used to visualize a physical volume.
// The are called when G4VisManager::Draw( void ) is used.
//
// Current local coordinates and current visualization attributes
// are set to the current in the inherited PreAddThis() function.
// PreAddThis() is called in G4PhysicalVolumeModel::DescribeAndDescend():
//
// // Make decision to Draw.
// G4bool thisToBeDrawn = !IsThisCulled (pLV);
// if (thisToBeDrawn) {
// scene.PreAddThis (theNewAT, *(pLV -> GetVisAttributes ()));
// pSol -> DescribeYourselfTo (scene);
// scene.PostAddThis ();
// }
//
// where G4VSolid::DescribeYourselfTo ( G4VSceneHandler& ) calls
// a proper AddThis() function. See G4Box.cc, for example.
//
// For shapes for which AddThis() functions are not prepered explicitly,
// AddThis (const G4VSolid& ) is called automatically.
// Then the following chain of calling is Done:
//
// AddThis ( const G4VSolid& )
// ==> G4VSceneHandler::AddThis ( const G4VSolid& )
// ==> G4VSceneHandler::RequestPrimitives( const G4VSolid& )
// ==> AddPrimitive ( const G4Polyhedron& )
//
// Therefore, AddPrimitive( const G4Polyhedron& ) is used for
// visualization finally. Note that G4Polyhedron is automatically
// created in G4VSceneHandler::RequestPrimitives( const G4VSolid& ) and
// current visualization attributes are assigned there.
//
///////////////////////////////////////////////////////////////////////
//-----
class G4FukuiRendererSceneHandler: public G4VSceneHandler {
@@ -116,11 +49,12 @@ public:
void AddPrimitive (const G4Polymarker& polymarker)
{ G4VSceneHandler::AddPrimitive (polymarker); }
virtual void BeginModeling () ;
virtual void EndModeling () { G4VSceneHandler::EndModeling ();}
virtual void BeginModeling () { G4VSceneHandler::BeginModeling ();}
virtual void EndModeling () { G4VSceneHandler::EndModeling ();}
virtual void BeginPrimitives (const G4Transform3D& objectTransformation);
virtual void EndPrimitives ();
void AddThis ( const G4Box& box );
void AddThis ( const G4Cons& cons );
void AddThis ( const G4Tubs& tubs );
@@ -134,9 +68,10 @@ public:
void ClearStore (){}
//----- methods inherent to this class
static G4int GetSceneCount ();
void FREndModeling () ;
G4bool IsInModeling () { return flag_in_modeling ; }
static G4int GetSceneCount ();
void FRBeginModeling () ;
void FREndModeling () ;
G4bool FRIsInModeling () { return FRflag_in_modeling ; }
G4bool IsSavingG4Prim ( void ) { return flag_saving_g4_prim ; }
void BeginSavingG4Prim( void )
@@ -160,9 +95,9 @@ private:
//----- Utilities etc
G4bool SendVisAttributes ( const G4VisAttributes* pAV );
G4bool IsVisible ( void ) ;
G4bool InitializeFR ( void ) ;
void SendTransformedCoordinates( void ) ;
void SendPhysVolName ( void ) ;
void SendNdiv ( void ) ;
public:
@@ -265,15 +200,14 @@ private:
static G4int fSceneCount; // No. of existing scenes.
G4FRClientServer& fPrimDest ; // defined in G4FukuiRenderer
G4bool flag_in_modeling ;
G4bool FRflag_in_modeling ;
// true: FR_BEGIN_MODELING has sent to DAWN, and
// FR_END_MODELING has not sent yet.
// false: otherwise
//
// The flag flag_in_modeling is set to "true"
// in BeginModeling(), and to "false"
// FRflag_in_modeling is set to "true"
// in FRBeginModeling(), and to "false"
// in FREndModeling().
// ( EndModeling() is not used.)
G4bool flag_saving_g4_prim ;
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FukuiRendererViewer.hh,v 1.3 1999/05/10 15:38:32 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4FukuiRendererViewer.hh,v 1.4.4.1 1999/12/07 20:53:10 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// Satoshi TANAKA, Fri Jun 28 12:10:14 JST 1996
@@ -25,11 +25,13 @@
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} ;
public:
//----- constructor and destructor
G4FukuiRendererViewer (G4FukuiRendererSceneHandler& scene, const G4String& name);
virtual ~G4FukuiRendererViewer ();
@@ -39,15 +41,16 @@ public:
void ClearView ();
void DrawView ();
void ShowView ();
void FlushView (); // ShowView() without calling Wait()
//---- methods inherent to this class
void Wait() ;
void SendViewParameters () ;
private:
void SendDevice( FRDEV dev );
void SendDrawingStyle() ;
private:
G4FukuiRendererSceneHandler& fSceneHandler; // Reference to Graphics Scene for this view.
};
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4DAWNFILE.cc,v 1.3 1999/01/11 00:47:20 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4DAWNFILE.cc,v 1.4.4.1 1999/12/07 20:53:10 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
// Satoshi TANAKA
// DAWNFILE factory.
@@ -15,6 +15,8 @@
#ifdef G4VIS_BUILD_DAWNFILE_DRIVER
//=================//
//#define DEBUG_FR_SYSTEM
#include "G4DAWNFILE.hh"
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4DAWNFILESceneHandler.cc,v 1.1 1999/01/09 16:11:47 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4DAWNFILESceneHandler.cc,v 1.2.4.1 1999/12/07 20:53:10 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
// Satoshi TANAKA
// DAWNFILE scene.
@@ -19,7 +19,7 @@
#define __G_ANSI_C__
//#define DEBUG_FR_SCENE
// #define DEBUG_FR_SCENE
//----- header files
#include <fstream.h>
@@ -61,7 +61,7 @@ G4DAWNFILESceneHandler::G4DAWNFILESceneHandler (G4DAWNFILE& system, const G4Stri
fSystem (system) ,
G4VSceneHandler (system, fSceneIdCount++, name) ,
fPrimDest () ,
flag_in_modeling (false) ,
FRflag_in_modeling (false) ,
flag_saving_g4_prim (false) ,
COMMAND_BUF_SIZE (G4FRofstream::SEND_BUFMAX)
{
@@ -102,6 +102,7 @@ G4DAWNFILESceneHandler::~G4DAWNFILESceneHandler ()
}
//-----
void G4DAWNFILESceneHandler::SetG4PrimFileName()
{
// g4.prim, g4_1.prim, ..., g4_MAX_FILE_INDEX.prim
@@ -155,10 +156,19 @@ void G4DAWNFILESceneHandler::SetG4PrimFileName()
} // G4DAWNFILESceneHandler::SetG4PrimFileName()
//-----
void G4DAWNFILESceneHandler::BeginSavingG4Prim( void )
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** BeginSavingG4Prim (called)\n";
#endif
if( !IsSavingG4Prim() )
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** (started) " ;
G4cerr << "(open g4.prim, ##)" << endl;
#endif
SetG4PrimFileName() ; // returned to fG4PrimFileName
fPrimDest.Open(fG4PrimFileName) ;
@@ -169,14 +179,59 @@ void G4DAWNFILESceneHandler::BeginSavingG4Prim( void )
void G4DAWNFILESceneHandler::EndSavingG4Prim ( void )
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** EndSavingG4Prim (called)\n";
#endif
if( IsSavingG4Prim() )
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** (started) (close g4.prim)" << endl;
#endif
fPrimDest.Close() ;
flag_saving_g4_prim = false ;
}
}
//-----
void G4DAWNFILESceneHandler::FRBeginModeling( void )
{
if( !FRIsInModeling() )
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** G4DAWNFILESceneHandler::FRBeginModeling (called & started)" << endl;
#endif
//----- Send saving command and heading comment
BeginSavingG4Prim();
//----- Send bounding box command
SendBoundingBox();
//----- send SET_CAMERA command
#if defined DEBUG_FR_SCENE
G4cerr << "***** (!SetCamera in FRBeginModeling())" << endl;
#endif
SendStr( FR_SET_CAMERA );
//----- open device
#if defined DEBUG_FR_SCENE
G4cerr << "***** (!OpenDevice in FRBeginModeling())" << endl;
#endif
SendStr( FR_OPEN_DEVICE );
//----- begin sending primitives
#if defined DEBUG_FR_SCENE
G4cerr << "***** (!BeginModeling in FRBeginModeling())" << endl;
#endif
SendStr( FR_BEGIN_MODELING ); FRflag_in_modeling = true ;
} // if
}
/////////////////////////////////////////
// Common to DAWN and DAWNFILE drivers //
/////////////////////////////////////////
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4DAWNFILEViewer.cc,v 1.2 1999/01/11 00:47:21 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4DAWNFILEViewer.cc,v 1.5.4.1 1999/12/07 20:53:10 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
// Satoshi TANAKA
// DAWNFILE view - opens window, hard copy, etc.
@@ -40,7 +40,8 @@
//----- constants
const char FR_ENV_MULTI_WINDOW[] = "G4DAWN_MULTI_WINDOW" ;
const char FR_ENV_MULTI_WINDOW [] = "G4DAWN_MULTI_WINDOW" ;
const char FR_ENV_MULTI_WINDOW2[] = "G4DAWNFILE_MULTI_WINDOW" ;
//----- G4DAWNFILEViewer, constructor
G4DAWNFILEViewer::G4DAWNFILEViewer (G4DAWNFILESceneHandler& scene,
@@ -80,7 +81,7 @@ G4DAWNFILEViewer::~G4DAWNFILEViewer ()
void G4DAWNFILEViewer::SetView ()
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4DAWNFILEViewer::SetView()\n";
G4cerr << "***** G4DAWNFILEViewer::SetView(): No effects" << endl;
#endif
// Do nothing, since DAWN is running as a different process.
// SendViewParameters () will do this job instead.
@@ -92,15 +93,9 @@ void
G4DAWNFILEViewer::ClearView( void )
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4DAWNFILEViewer::ClearView () " << endl;
G4cerr << "***** G4DAWNFILEViewer::ClearView (): No effects " << endl;
#endif
//----- Begin saving data to g4.prim
fSceneHandler.BeginSavingG4Prim();
//----- Clear old data
fSceneHandler.SendStr( FR_CLEAR_DATA );
}
@@ -110,24 +105,8 @@ void G4DAWNFILEViewer::DrawView ()
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4DAWNFILEViewer::DrawView () " << endl;
#endif
//----- Error recovery
if( fSceneHandler.IsInModeling() ) {
G4cerr << "WARNING from DAWNFILE driver:" << endl;
G4cerr << " You've invoked a drawing command before " << endl;
G4cerr << " completing your previous visualization." << endl;
// G4cerr << " You should have invoked command, /vis~/show/view," << endl;
// G4cerr << " to complete it." << endl;
FlushView();
}
//----- Begin Saving g4.prim file
fSceneHandler.BeginSavingG4Prim();
//----- set view if necessary
SendViewParameters();
// Camera data should be sent at every time, even if
// the setting is unchanged at GEANT 4 side.
//-----
fSceneHandler.FRBeginModeling() ;
//----- Always visit G4 kernel
NeedKernelVisit ();
@@ -146,21 +125,15 @@ void G4DAWNFILEViewer::ShowView( void )
G4cerr << "***** G4DAWNFILEViewer::ShowView () " << endl;
#endif
if( fSceneHandler.IsInModeling() ) // if( fSceneHandler.flag_in_modeling )
if( fSceneHandler.FRIsInModeling() )
{
//----- End of Data
//----- End of modeling
// !EndModeling, !DrawAll, !CloseDevice,
// close g4.prim
fSceneHandler.FREndModeling();
//----- Draw all
fSceneHandler.SendStr( FR_DRAW_ALL );
//----- Close device
fSceneHandler.SendStr( FR_CLOSE_DEVICE );
//----- End saving data to g4.prim
fSceneHandler.EndSavingG4Prim() ;
//----- Output DAWN GUI file
SendViewParameters();
//----- string for viewer invocation
if ( !strcmp( fG4PrimViewer, "NONE" ) ) {
@@ -198,24 +171,14 @@ void G4DAWNFILEViewer::ShowView( void )
} // G4DAWNFILEViewer::ShowView()
//----- G4DAWNFILEViewer::FlushView()
void G4DAWNFILEViewer::FlushView( void )
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4DAWNFILEViewer::Flush () " << endl;
#endif
ShowView();
}
//----- G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI( ostream& out )
void G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI( ostream& out )
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4DAWNFILEViewer::SendDrawingStyle() " << endl;
#endif
///////////////////////
//#if defined DEBUG_FR_VIEW
// G4cerr << "***** G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI()" << endl;
//#endif
//////////////////////
G4int style = fVP.GetDrawingStyle();
@@ -243,7 +206,7 @@ void G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI( ostream& out )
//----- G4DAWNFILEViewer::SendViewParameters ()
//-----
void G4DAWNFILEViewer::SendViewParameters ()
{
// Calculates view representation based on extent of object being
@@ -251,7 +214,8 @@ void G4DAWNFILEViewer::SendViewParameters ()
// later due to user interaction via visualization system's GUI.)
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4DAWNFILEViewer::SendViewParameters()\n";
G4cerr << "***** G4DAWNFILEViewer::SendViewParameters() ";
G4cerr << "(GUI parameters)" << endl;
#endif
//----- Magic number to decide camera distance automatically
@@ -259,9 +223,6 @@ void G4DAWNFILEViewer::SendViewParameters ()
const G4double MIN_HALF_ANGLE = 0.01 ;
const G4double MAX_HALF_ANGLE = 0.499 * M_PI ;
//----- Send Bounding Box
fSceneHandler.SendBoundingBox();
//----- CALC camera distance
//..... Note: Camera cannot enter inside object
G4double camera_distance ;
@@ -296,7 +257,7 @@ void G4DAWNFILEViewer::SendViewParameters ()
//########### Generation of the file .DAWN.history for DAWN GUI
//-----
ofstream gui_out (".DAWN.history") ;
ofstream gui_out (".DAWN_1.history") ;
// ######### P1
@@ -355,27 +316,26 @@ void G4DAWNFILEViewer::SendViewParameters ()
//######### P4
//----- drawing device
// enum {PS=1, XWIN=2, PS2=3, XWIN2=4, OPEN_GL=5, DEVICE_END=6};
if( ( getenv( FR_ENV_MULTI_WINDOW ) != NULL ) && \
( strcmp( getenv( FR_ENV_MULTI_WINDOW ),"0" ) ) )
if( ( ( getenv( FR_ENV_MULTI_WINDOW ) != NULL ) && \
( strcmp( getenv( FR_ENV_MULTI_WINDOW ),"0" ) ) ) || \
( ( getenv( FR_ENV_MULTI_WINDOW2 ) != NULL ) && \
( strcmp( getenv( FR_ENV_MULTI_WINDOW2 ),"0" ) ) ) )
{
gui_out << 2 << endl; // OpenWindow
} else {
gui_out << 1 << endl; // Invoke PS viewer
}
gui_out << GetPSViewer() << endl; // PS viewer
gui_out << 0; // Add showpage
gui_out << GetPSViewer() << endl; // PS viewer
gui_out << 0 << endl ; // Do not add showpage
gui_out << 0 << endl ; // Non-append mode
gui_out.close();
//########### end of generating file .DAWN.history
//----- SET CAMERA
fSceneHandler.SendStr( FR_SET_CAMERA );
} // G4DAWNFILEViewer::SendViewParameters ()
}
#endif // G4VIS_BUILD_DAWNFILE_DRIVER
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FRClientServer.cc,v 1.2 1999/01/09 16:11:49 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4FRClientServer.cc,v 1.2.8.1 1999/12/07 20:53:11 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
// Satoshi TANAKA, Wed Jul 3 14:14:29 JST 1996
////////////////////////////////
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FRSceneFunc.icc,v 1.3 1999/01/11 00:47:22 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4FRSceneFunc.icc,v 1.9.2.1 1999/12/07 20:53:11 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
@@ -19,7 +19,7 @@ void G4FRSCENE::AddPrimitive (const G4Polyline& polyline)
G4cerr << "***** AddPrimitive\n";
#endif
//----- Initialize Fukui Renderer IF NECESSARY
InitializeFR();
FRBeginModeling();
//----- local working variables
G4int nPoints = polyline.entries ();
@@ -65,6 +65,9 @@ void G4FRSCENE::AddPrimitive (const G4NURBS& nurb)
G4cerr << "***** AddPrimitive( G4NURBS )\n";
#endif
//----- Initialize DAWN IF NECESSARY
FRBeginModeling();
///////////////////////////////////////////////
// DAWN does not support NUBS visualizaition //
///////////////////////////////////////////////
@@ -80,7 +83,7 @@ void G4FRSCENE::AddPrimitive ( const G4Text& text )
G4cerr << "***** AddPrimitive( G4Text )\n";
#endif
//----- Initialize DAWN IF NECESSARY
InitializeFR();
FRBeginModeling();
//----- send color
const G4Color& color = GetTextColor (text) ;
@@ -153,7 +156,7 @@ void G4FRSCENE::AddPrimitive ( const G4Circle& mark_circle )
G4cerr << "***** AddPrimitive( G4Circle )\n";
#endif
//----- Initialize Fukui Renderer IF NECESSARY
InitializeFR();
FRBeginModeling();
//----- send color
const G4Color& color = GetColor (mark_circle) ;
@@ -196,7 +199,7 @@ void G4FRSCENE::AddPrimitive (const G4Square& mark_square )
G4cerr << "***** AddPrimitive( G4Square )\n";
#endif
//----- Initialize Fukui Renderer IF NECESSARY
InitializeFR();
FRBeginModeling();
//----- send color
const G4Color& color = GetColor (mark_square) ;
@@ -240,7 +243,7 @@ void G4FRSCENE::AddPrimitive ( const G4Polyhedron& polyhedron )
#endif
//----- Initialize Fukui Renderer IF NECESSARY
InitializeFR();
FRBeginModeling();
//----- Attributes
if(!SendVisAttributes( fpViewer->GetApplicableVisAttributes
@@ -293,46 +296,75 @@ void G4FRSCENE::AddPrimitive ( const G4Polyhedron& polyhedron )
} // G4FRSCENE::AddPrimitive (polyhedron)
//----- G4FRSCENE::BeginModeling ()
void G4FRSCENE::BeginModeling ()
//----- G4FRSCENE::SendNdiv ()
void G4FRSCENE::SendNdiv ( void )
{
//////////////////////////////////////////////////
//#if defined DEBUG_FR_SCENE
// G4cerr << "***** SendNdiv() (/Ndiv)" << endl;
//#endif
//////////////////////////////////////////////////
G4VSceneHandler::BeginModeling ();
//-----
#if defined DEBUG_FR_SCENE
G4cerr << "***** BeginModeling\n";
#endif
//----- local
G4int num_division ;
//----- open device
SendStr( FR_OPEN_DEVICE );
//----- begin sending primitives
SendStr( FR_BEGIN_MODELING ); flag_in_modeling = true ;
G4int num_division = FR_DEFALUT_NDIV_VALUE ;
//----- number used for dividing a curved surface, Ndiv
num_division = GetModel()->GetModelingParameters()->GetNoOfSides () ;
if ( GetModel() ) {
num_division = GetModel()->GetModelingParameters()->GetNoOfSides();
} else {
#if defined DEBUG_FR_SCENE
G4cerr << "WARNING: GetNoOfSides() failed. " ;
G4cerr << "The default value " << num_division ;
G4cerr << " is assigned." << endl;
#endif
}
//---------- Error recovery for too small Ndiv
num_division = ( num_division < 3 ? 3 : num_division );
//////////////////////////////////////////////////
//#if defined DEBUG_FR_SCENE
// G4cerr << "Ndiv = " << num_division << endl;
//#endif
//////////////////////////////////////////////////
//----- Send resultant Ndiv
this->SendStrInt( FR_NDIV, num_division );
} // G4FRSCENE::BeginModeling ()
}
//----- G4FRSCENE::FREndModeling ()
void G4FRSCENE::FREndModeling ()
{
//-----
#if defined DEBUG_FR_SCENE
G4cerr << "***** FREndModeling \n";
G4cerr << "***** FREndModeling (called)" << endl;
#endif
SendStr( FR_END_MODELING ); flag_in_modeling = false ;
if( FRIsInModeling() ) {
#if defined DEBUG_FR_SCENE
G4cerr << "***** FREndModeling (started) " ;
G4cerr << "(/EndModeling, /DrawAll, /CloseDevice)" << endl;
#endif
SendStr( "#--------------------" );
//----- !EndModeling
SendStr( FR_END_MODELING );
//----- !DrawAll
SendStr( FR_DRAW_ALL );
//----- !CloseDevice
SendStr( FR_CLOSE_DEVICE );
//----- End saving data to g4.prim
EndSavingG4Prim() ;
//------ Reset flag
FRflag_in_modeling = false ;
}
}
//----- G4FRSCENE::BeginPrimitives (const G4Transform3D&)
@@ -342,13 +374,11 @@ void G4FRSCENE::BeginPrimitives (const G4Transform3D& objectTransformation)
G4cerr << "***** BeginPrimitives \n";
#endif
FRBeginModeling();
G4VSceneHandler::BeginPrimitives (objectTransformation);
fpObjectTransformation = &objectTransformation;
#if defined DEBUG_FR_SCENE
G4cerr << "***** BeginPrimitives \n";
#endif
}
//----- G4FRSCENE::EndPrimitives ()
@@ -378,11 +408,14 @@ void G4FRSCENE::AddThis( const G4Box& box )
if( !IsVisible() ) { return ; }
//----- Initialize Fukui Renderer IF NECESSARY
InitializeFR();
FRBeginModeling();
//----- Send Name
SendPhysVolName();
//----- Send Ndiv
// SendNdiv();
//----- Attributes
if(!SendVisAttributes
( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
@@ -414,11 +447,14 @@ G4FRSCENE::AddThis( const G4Tubs& tubes )
if( !IsVisible() ) { return ; }
//----- Initialize Fukui Renderer IF NECESSARY
InitializeFR();
FRBeginModeling();
//----- Send Name
SendPhysVolName();
//----- Send Ndiv
SendNdiv();
//----- Attributes
if(!SendVisAttributes
( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
@@ -453,11 +489,14 @@ G4FRSCENE::AddThis( const G4Cons& cons )
if( !IsVisible() ) { return ; }
//----- Initialize Fukui Renderer IF NECESSARY
InitializeFR();
FRBeginModeling();
//----- Send Name
SendPhysVolName();
//----- Send Ndiv
SendNdiv();
//----- Attributes
if(!SendVisAttributes
( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
@@ -493,11 +532,14 @@ void G4FRSCENE::AddThis ( const G4Trd& trd )
if( !IsVisible() ) { return ; }
//----- Initialize Fukui Renderer IF NECESSARY
InitializeFR();
FRBeginModeling();
//----- Send Name
SendPhysVolName();
//----- Send Ndiv
// SendNdiv();
//----- Attributes
if(!SendVisAttributes
( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
@@ -530,11 +572,14 @@ void G4FRSCENE::AddThis ( const G4Sphere& sphere )
if( !IsVisible() ) { return ; }
//----- Initialize Fukui Renderer IF NECESSARY
InitializeFR();
FRBeginModeling();
//----- Send Name
SendPhysVolName();
//----- Send Ndiv
SendNdiv();
//----- Attributes
if(!SendVisAttributes
( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
@@ -588,11 +633,14 @@ void G4FRSCENE::AddThis (const G4Para& para)
if( !IsVisible() ) { return ; }
//----- Initialize Fukui Renderer IF NECESSARY
InitializeFR();
FRBeginModeling();
//----- Send Name
SendPhysVolName();
//----- Send Ndiv
// SendNdiv();
//----- Attributes
if(!SendVisAttributes
( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
@@ -641,11 +689,14 @@ void G4FRSCENE::AddThis (const G4Trap& trap)
if( !IsVisible() ) { return ; }
//----- Initialize Fukui Renderer IF NECESSARY
InitializeFR();
FRBeginModeling();
//----- Send Name
SendPhysVolName();
//----- Send Ndiv
// SendNdiv();
//----- Attributes
if(!SendVisAttributes
( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
@@ -670,8 +721,19 @@ void G4FRSCENE::AddThis (const G4Trap& trap)
//----- parameters (half lengths of box)
G4double dz = trap.GetZHalfLength ();
G4double theta = acos( cosTheta ) ;
G4double phi = atan2( ny, nx ) ; if( phi < 0.0 ) { phi += twopi ; }
// -PI < atan() < PI
G4double phi;
if ( ny==0. && nx ==0.) {
phi = 0.; // atan2(0.,0.) gives undefined value of phi
} else {
phi = atan2( ny, nx ) ; if( phi < 0. ) { phi += twopi ; }
// -PI < atan() < PI
}
/////////////////////////////////////////////////
// G4double phi = atan2( ny, nx ) ;
// if( phi < 0.0 ) { phi += twopi ; }
// // -PI < atan() < PI
/////////////////////////////////////////////////
G4double h1 = trap.GetYHalfLength1 ();
G4double bl1 = trap.GetXHalfLength1 ();
G4double tl1 = trap.GetXHalfLength2 ();
@@ -684,6 +746,11 @@ void G4FRSCENE::AddThis (const G4Trap& trap)
//----- send coordinates to Fukui Renderer
SendTransformedCoordinates();
//----- Change sign of alpha for compatibility
// with the DAWN format
G4double alpha_sign = -1.0 ;
alpha1 *= alpha_sign ; alpha2 *= alpha_sign ;
//----- send box to Fukui Renderer
SendStrDouble11( FR_TRAP ,
dz ,
@@ -712,11 +779,14 @@ G4FRSCENE::AddThis( const G4Torus& torus )
if( !IsVisible() ) { return ; }
//----- Initialize Fukui Renderer IF NECESSARY
InitializeFR();
FRBeginModeling();
//----- Send Name
SendPhysVolName();
//----- Send Ndiv
SendNdiv();
//----- Attributes
if(!SendVisAttributes
( fpViewer->GetApplicableVisAttributes( fpVisAttribs ) ) ) {
@@ -747,11 +817,13 @@ void G4FRSCENE::AddThis ( const G4VSolid& solid )
if( !IsVisible() ) { return ; }
//----- Initialize Fukui Renderer IF NECESSARY
InitializeFR();
FRBeginModeling();
//----- Send Name
SendPhysVolName() ;
//----- Send Ndiv
// SendNdiv();
//----- Send a primitive
G4VSceneHandler::AddThis( solid ) ;
@@ -800,12 +872,14 @@ G4FRSCENE::SendVisAttributes ( const G4VisAttributes* pAV )
//----- G4FRSCENE::IsVisible()
G4bool G4FRSCENE::IsVisible()
{
//-----
G4bool visibility = true ;
//-----
const G4VisAttributes* pVisAttribs =
fpViewer->GetApplicableVisAttributes( fpVisAttribs );
//-----
//-----
if( ( getenv( FR_ENV_CULL_INVISIBLE_OBJECTS ) != NULL ) && \
( strcmp( getenv( FR_ENV_CULL_INVISIBLE_OBJECTS ),"0" ) ) && \
( pVisAttribs ) )
@@ -813,6 +887,7 @@ G4bool G4FRSCENE::IsVisible()
visibility = pVisAttribs->IsVisible();
}
//-----
return visibility ;
} // G4FRSCENE::IsVisible()
@@ -821,6 +896,10 @@ G4bool G4FRSCENE::IsVisible()
//----- G4FRSCENE::SendBoundingBox()
void G4FRSCENE::SendBoundingBox( void )
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** SendBoundingBox () (/BoundingBox)" << endl;
#endif
//----- (1A) CALC bounding box of the bounding sphere
const G4VisExtent& extent = GetScene()->GetExtent();
const G4Point3D& center = extent.GetExtentCenter();
@@ -851,34 +930,6 @@ void G4FRSCENE::SendBoundingBox( void )
} // G4FRSCENE::SendBoundingBox()
//----- G4FRSCENE::InitializeFR()
G4bool
G4FRSCENE::InitializeFR( void )
{
if( !IsInModeling() ) // if( !flag_in_modeling )
{
//----- Send saving command and heading comment
BeginSavingG4Prim();
//----- Send bounding box command
SendBoundingBox();
//----- sen SET_CAMERA command
SendStr( FR_SET_CAMERA );
//----- send begin modeling
//..... (1) FR_OPEN_DEVICE
//..... (2) FR_BEGIN_MODELING
//..... (3) FR_NDIV
BeginModeling ();
}
return flag_in_modeling ;
} // G4FRSCENE::InitializeFR( void )
//----- G4FRSCENE::SendTransformedCoordinates()
void
G4FRSCENE::SendTransformedCoordinates()
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FukuiRenderer.cc,v 1.3 1999/01/11 00:47:23 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4FukuiRenderer.cc,v 1.3.8.1 1999/12/07 20:53:11 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// Satoshi TANAKA
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FukuiRendererSceneHandler.cc,v 1.1 1999/01/09 16:11:52 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4FukuiRendererSceneHandler.cc,v 1.2.4.1 1999/12/07 20:53:11 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// Satoshi TANAKA, Fri Jun 28 11:34:24 JST 1996
@@ -20,7 +20,7 @@
#define __G_ANSI_C__
//#define DEBUG_FR_SCENE
// #define DEBUG_FR_SCENE
//----- header files
#include <fstream.h>
@@ -47,8 +47,8 @@
#include "G4VPhysicalVolume.hh"
//----- constants
const char FR_ENV_CULL_INVISIBLE_OBJECTS [] = "G4DAWN_CULL_INVISIBLE_OBJECTS";
const char FR_ENV_CULL_INVISIBLE_OBJECTS [] = "G4DAWN_CULL_INVISIBLE_OBJECTS";
const char FR_ENV_MULTI_WINDOW[] = "G4DAWN_MULTI_WINDOW" ;
///////////////////////////
// Driver-dependent part //
@@ -61,7 +61,7 @@ G4FukuiRendererSceneHandler::G4FukuiRendererSceneHandler (G4FukuiRenderer& syste
fSystem (system) ,
G4VSceneHandler (system, fSceneIdCount++, name) ,
fPrimDest (system.GetPrimDest() ) ,
flag_in_modeling (false) ,
FRflag_in_modeling (false) ,
flag_saving_g4_prim (false) ,
COMMAND_BUF_SIZE (G4FRClientServer::SEND_BUFMAX)
{
@@ -103,6 +103,69 @@ G4FukuiRendererSceneHandler::~G4FukuiRendererSceneHandler ()
}
//-----
void G4FukuiRendererSceneHandler::FRBeginModeling( void )
{
if( !FRIsInModeling() )
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** G4FukuiRendererSceneHandler::FRBeginModeling (called & started)" << endl;
#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( ( getenv( FR_ENV_MULTI_WINDOW ) != NULL ) && \
( strcmp( 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
G4cerr << "***** (!SetCamera in FRBeginModeling())" << endl;
#endif
SendStr( FR_SET_CAMERA );
//----- open device
// !OpenDevice
#if defined DEBUG_FR_SCENE
G4cerr << "***** (!OpenDevice in FRBeginModeling())" << endl;
#endif
SendStr( FR_OPEN_DEVICE );
//----- begin sending primitives
// !BeginModeling
#if defined DEBUG_FR_SCENE
G4cerr << "***** (!BeginModeling in FRBeginModeling())" << endl;
#endif
SendStr( FR_BEGIN_MODELING ); FRflag_in_modeling = true ;
} // if
}
/////////////////////////////////////////
// Common to DAWN and DAWNFILE drivers //
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FukuiRendererViewer.cc,v 1.2 1999/01/11 00:47:24 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4FukuiRendererViewer.cc,v 1.3.4.1 1999/12/07 20:53:11 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// Satoshi TANAKA, Fri Jun 28 12:09:11 JST 1996
@@ -39,159 +39,82 @@
#include "G4FukuiRendererViewer.hh"
//----- constants
const char FR_ENV_MULTI_WINDOW[] = "G4DAWN_MULTI_WINDOW" ;
//----- G4FukuiRendererViewer, constructor
//----- Constructor
G4FukuiRendererViewer::G4FukuiRendererViewer (G4FukuiRendererSceneHandler& scene,
const G4String& name):
G4VViewer (scene, scene.IncrementViewCount (), name), fSceneHandler (scene)
{}
//----- G4FukuiRendererViewer, destructor
//----- Destructor
G4FukuiRendererViewer::~G4FukuiRendererViewer ()
{}
//----- G4FukuiRendererViewer::SetView ()
//-----
void G4FukuiRendererViewer::SetView ()
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4FukuiRendererViewer::SetView()\n";
G4cerr << "***** G4FukuiRendererViewer::SetView(): No effects" << endl;
#endif
// Do nothing, since DAWN is running as a different process.
// SendViewParameters () will do this job instead.
}
//----- G4FukuiRendererViewer::ClearView()
//-----
void
G4FukuiRendererViewer::ClearView( void )
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4FukuiRendererViewer::ClearView () " << endl;
G4cerr << "***** G4FukuiRendererViewer::ClearView (): No effects " << endl;
#endif
//----- Begin saving data to g4.prim
fSceneHandler.BeginSavingG4Prim();
//----- Clear old data
fSceneHandler.SendStr( FR_CLEAR_DATA );
}
//----- G4FukuiRendererViewer::DrawView ()
//-----
void G4FukuiRendererViewer::DrawView ()
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4FukuiRendererViewer::DrawView () " << endl;
#endif
//----- Error recovery
if( fSceneHandler.IsInModeling() ) {
G4cerr << "WARNING from FukuiRenderer (DAWN) driver:" << endl;
G4cerr << " You've invoked a drawing command before " << endl;
G4cerr << " completing your previous visualization." << endl;
// G4cerr << " You should have invoked command, /vis~/show/view," << endl;
// G4cerr << " to complete it." << endl;
FlushView();
}
//----- Begin modeling 3D
fSceneHandler.FRBeginModeling();
//----- Begin Saving g4.prim file
fSceneHandler.BeginSavingG4Prim();
//----- drawing device
if( ( getenv( FR_ENV_MULTI_WINDOW ) != NULL ) && \
( strcmp( getenv( FR_ENV_MULTI_WINDOW ),"0" ) ) )
{
SendDevice( FRDEV_XWIN ) ;
} else {
SendDevice( FRDEV_PS ) ;
}
//----- drawing style
SendDrawingStyle() ;
//----- set view if necessary
SendViewParameters();
// Camera data should be sent at every time, even if
// the setting is unchanged at GEANT 4 side.
//----- Always visit G4 kernel
//----- Always visit G4 kernel
NeedKernelVisit ();
//----- Draw
//----- Draw
ProcessView () ;
} // G4FukuiRendererViewer::DrawView ()
}
//----- G4FukuiRendererViewer::ShowView()
//-----
void G4FukuiRendererViewer::ShowView( void )
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4FukuiRendererViewer::ShowView () " << endl;
#endif
if( fSceneHandler.IsInModeling() ) // if( fSceneHandler.flag_in_modeling )
if( fSceneHandler.FRIsInModeling() )
{
//----- End of Data
//----- End of modeling
// !EndModeling, !DrawAll, !CloseDevice,
// close g4.prim
fSceneHandler.FREndModeling();
//----- Draw all
fSceneHandler.SendStr( FR_DRAW_ALL );
//----- Close device
fSceneHandler.SendStr( FR_CLOSE_DEVICE );
//----- End saving data to g4.prim
fSceneHandler.EndSavingG4Prim() ;
//----- Wait user clicks drawing Area
this->Wait();
}
} // G4FukuiRendererViewer::ShowView()
}
//----- G4FukuiRendererViewer::FlushView()
void G4FukuiRendererViewer::FlushView( void )
//-----
void G4FukuiRendererViewer::Wait()
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4FukuiRendererViewer::Flush () " << endl;
#endif
if( fSceneHandler.IsInModeling() ) // if( fSceneHandler.flag_in_modeling )
{
//----- End of Data
fSceneHandler.FREndModeling();
//----- Draw all
fSceneHandler.SendStr( FR_DRAW_ALL );
//----- Close device
fSceneHandler.SendStr( FR_CLOSE_DEVICE );
//----- End saving data to g4.prim
fSceneHandler.EndSavingG4Prim() ;
}
} // G4FukuiRendererViewer::FlushView()
//----- G4FukuiRendererViewer::Wait()
void
G4FukuiRendererViewer::Wait()
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4FukuiRendererViewer::Wait () " << endl;
G4cerr << "***** G4FukuiRendererViewer::Wait () : Begin" << endl;
#endif
fSceneHandler.SendStr ( FR_WAIT );
fSceneHandler.GetPrimDest().WaitSendBack( FR_WAIT );
@@ -202,7 +125,7 @@ G4FukuiRendererViewer::Wait()
}
//----- G4FukuiRendererViewer::SendDevice()
//-----
void
G4FukuiRendererViewer::SendDevice( FRDEV dev )
{
@@ -210,7 +133,6 @@ G4FukuiRendererViewer::SendDevice( FRDEV dev )
G4cerr << "***** G4FukuiRendererViewer::SendDevice() " << endl;
#endif
// enum {PS=1, XWIN=2, PS2=3, XWIN2=4, OPEN_GL=5, DEVICE_END=6};
if( dev >= FRDEV_PS || dev < FRDEV_DEVICE_END ) {
@@ -219,7 +141,7 @@ G4FukuiRendererViewer::SendDevice( FRDEV dev )
}
//----- G4FukuiRendererViewer::SendDrawingStyle()
//-----
void G4FukuiRendererViewer::SendDrawingStyle()
{
#if defined DEBUG_FR_VIEW
@@ -245,11 +167,10 @@ void G4FukuiRendererViewer::SendDrawingStyle()
break;
}
} // G4FukuiRendererViewer::SendDrawingStyle()
}
//----- G4FukuiRendererViewer::SendViewParameters ()
//-----
void G4FukuiRendererViewer::SendViewParameters ()
{
// Calculates view representation based on extent of object being
@@ -257,7 +178,7 @@ void G4FukuiRendererViewer::SendViewParameters ()
// later due to user interaction via visualization system's GUI.)
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4FukuiRendererViewer::SendViewParameters()\n";
G4cerr << "***** G4FukuiRendererViewer::SendViewParameters()" << endl;
#endif
//----- Magic number to decide camera distance automatically
@@ -265,9 +186,6 @@ void G4FukuiRendererViewer::SendViewParameters ()
const G4double MIN_HALF_ANGLE = 0.01 ;
const G4double MAX_HALF_ANGLE = 0.499 * M_PI ;
//----- Send Bounding Box
fSceneHandler.SendBoundingBox();
//----- (2A) CALC camera distance
//..... Note: Camera cannot enter inside object
G4double camera_distance ;
@@ -351,9 +269,8 @@ void G4FukuiRendererViewer::SendViewParameters ()
fSceneHandler.GetPrimDest().WaitSendBack( FR_GUI );
}
//----- SET CAMERA
fSceneHandler.SendStr( FR_SET_CAMERA );
} // G4FukuiRendererViewer::SendViewParameters ()
}
#endif // G4VIS_BUILD_DAWN_DRIVER