Import Geant4 9.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:25:56 +02:00
parent 74cad5e589
commit 89a9605df1
4440 changed files with 379508 additions and 189225 deletions
+38
View File
@@ -0,0 +1,38 @@
#------------------------------------------------------------------------------
# CMakeLists.txt
# Module : G4visualization
# Package: Geant4.src.G4visualization
#
# Intermediate level CMakeLists.txt - just process subdirectories
#
# Generated on : 24/9/2010
#
# $Id: CMakeLists.txt,v 1.1 2010/09/29 19:11:25 bmorgan Exp $
#
#------------------------------------------------------------------------------
add_subdirectory(FukuiRenderer)
add_subdirectory(HepRep)
add_subdirectory(RayTracer)
add_subdirectory(Tree)
add_subdirectory(VRML)
add_subdirectory(XXX)
add_subdirectory(externals)
add_subdirectory(gMocren)
add_subdirectory(management)
add_subdirectory(modeling)
#
# OpenGL is optional depending on user selection
#
if(GEANT4_USE_OPENGL)
add_subdirectory(OpenGL)
endif()
#
# OpenInventor is optional depending on user selection
#
if(GEANT4_USE_INVENTOR)
add_subdirectory(OpenInventor)
endif()
@@ -0,0 +1,20 @@
#------------------------------------------------------------------------------
# CMakeLists.txt
# Module : G4FR
# Package: Geant4.src.G4visualization.G4FR
#
# CMakeLists.txt for single level library that may be build global or granular
#
# Generated on : 24/9/2010
#
# $Id: CMakeLists.txt,v 1.1 2010/09/29 19:11:33 bmorgan Exp $
#
#------------------------------------------------------------------------------
include(Geant4MacroLibraryTargets)
if(GEANT4_BUILD_GRANULAR_LIBS)
GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
else()
GEANT4_GLOBAL_LIBRARY_TARGET(COMPONENTS sources.cmake)
endif()
+8 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.27 2009/10/21 14:59:17 allison Exp $
$Id: History,v 1.29 2010/11/11 01:13:42 akimura Exp $
-------------------------------------------------------------------
=========================================================
@@ -20,6 +20,13 @@ committal in the CVS repository !
History file for visualization/FukuiRenderer sub-category
---------------------------------------------------------
11 November 2010 Akinori Kimura (DAWN-V09-03-01)
- Replaced G4cerr with G4cout and added the following line before G4cout.
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
30th May 2010 John Allison (DAWN-V09-03-00)
- G4DAWN/FukuiRendererSceneHandler: Added AddCompound(const G4VDigi&).
21st October 2009 John Allison (DAWN-V09-02-00 coworks greps-V09-02-02)
- Added default AddCompound (const G4THitsMap<G4double>&) methods.
o Prevents warnings about hiding - calls G4VSceneHandler base class.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4DAWNFILESceneHandler.hh,v 1.17 2009/10/21 14:59:17 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4DAWNFILESceneHandler.hh,v 1.18 2010/05/30 10:18:32 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
// Satoshi TANAKA
@@ -97,6 +97,9 @@ public:
void AddCompound ( const G4VHit& hit) {
G4VSceneHandler::AddCompound(hit);
}
void AddCompound ( const G4VDigi& digi) {
G4VSceneHandler::AddCompound(digi);
}
void AddCompound ( const G4THitsMap<G4double> & hits) {
G4VSceneHandler::AddCompound(hits);
}
@@ -24,10 +24,11 @@
// ********************************************************************
//
//
// $Id: G4FRSceneFunc.icc,v 1.15 2006/07/10 15:31:45 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4FRSceneFunc.icc,v 1.16 2010/11/11 01:13:42 akimura Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
#include "G4VisManager.hh"
#include "G4PhysicalVolumeModel.hh"
#include "G4LogicalVolume.hh"
@@ -37,7 +38,8 @@
void G4FRSCENEHANDLER::AddPrimitive (const G4Polyline& polyline)
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** AddPrimitive\n";
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddPrimitive\n";
#endif
//----- Initialize Fukui Renderer IF NECESSARY
FRBeginModeling();
@@ -83,7 +85,8 @@ void G4FRSCENEHANDLER::AddPrimitive (const G4NURBS&)
{
//-----
#if defined DEBUG_FR_SCENE
G4cerr << "***** AddPrimitive( G4NURBS )\n";
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddPrimitive( G4NURBS )\n";
#endif
//----- Initialize DAWN IF NECESSARY
@@ -101,7 +104,8 @@ void G4FRSCENEHANDLER::AddPrimitive ( const G4Text& text )
{
//-----
#if defined DEBUG_FR_SCENE
G4cerr << "***** AddPrimitive( G4Text )\n";
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddPrimitive( G4Text )\n";
#endif
//----- Initialize DAWN IF NECESSARY
FRBeginModeling();
@@ -134,9 +138,11 @@ void G4FRSCENEHANDLER::AddPrimitive ( const G4Text& text )
//----- create buffer and copy the string there
int MAX_STR_LENGTH = COMMAND_BUF_SIZE - 100 ;
if ( MAX_STR_LENGTH <= 0 ) {
G4cerr << "ERROR (FukuiRenderer) : Not enough buffer size for data transferring." << G4endl;
G4cerr << " G4Text Visualization is aborted" << G4endl;
return ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "ERROR (FukuiRenderer) : Not enough buffer size for data transferring." << G4endl;
G4cout << " G4Text Visualization is aborted" << G4endl;
}
return ;
}
char* buf = new char [ (MAX_STR_LENGTH + 1) ] ;
if ( MAX_STR_LENGTH >= STR_LENGTH ) {
@@ -174,7 +180,8 @@ void G4FRSCENEHANDLER::AddPrimitive ( const G4Circle& mark_circle )
{
//-----
#if defined DEBUG_FR_SCENE
G4cerr << "***** AddPrimitive( G4Circle )\n";
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddPrimitive( G4Circle )\n";
#endif
//----- Initialize Fukui Renderer IF NECESSARY
FRBeginModeling();
@@ -217,7 +224,8 @@ void G4FRSCENEHANDLER::AddPrimitive (const G4Square& mark_square )
{
//-----
#if defined DEBUG_FR_SCENE
G4cerr << "***** AddPrimitive( G4Square )\n";
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddPrimitive( G4Square )\n";
#endif
//----- Initialize Fukui Renderer IF NECESSARY
FRBeginModeling();
@@ -260,7 +268,8 @@ void G4FRSCENEHANDLER::AddPrimitive ( const G4Polyhedron& polyhedron )
{
//-----
#if defined DEBUG_FR_SCENE
G4cerr << "***** AddPrimitive( G4Polyhedron )\n";
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddPrimitive( G4Polyhedron )\n";
#endif
if (polyhedron.GetNoFacets() == 0) return;
@@ -309,16 +318,20 @@ void G4FRSCENEHANDLER::AddPrimitive ( const G4Polyhedron& polyhedron )
SendStrInt4(FR_FACET, work[0], work[1], work[2], work[3] );
break;
default:
G4cerr <<
"ERROR G4FRSCENEHANDLER::AddPrimitive(G4Polyhedron)\n";
G4PhysicalVolumeModel* pPVModel =
dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
if (pPVModel) G4cerr <<
"Volume " << pPVModel->GetCurrentPV()->GetName() <<
", Solid " << pPVModel->GetCurrentLV()->GetSolid()->GetName() <<
" (" << pPVModel->GetCurrentLV()->GetSolid()->GetEntityType();
G4cerr <<
"\nG4Polyhedron facet with " << i << " edges" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout <<
"ERROR G4FRSCENEHANDLER::AddPrimitive(G4Polyhedron)\n";
G4PhysicalVolumeModel* pPVModel =
dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
if (pPVModel)
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout <<
"Volume " << pPVModel->GetCurrentPV()->GetName() <<
", Solid " << pPVModel->GetCurrentLV()->GetSolid()->GetName() <<
" (" << pPVModel->GetCurrentLV()->GetSolid()->GetEntityType();
G4cout <<
"\nG4Polyhedron facet with " << i << " edges" << G4endl;
}
}
}
@@ -333,7 +346,7 @@ void G4FRSCENEHANDLER::SendNdiv ( void )
{
//////////////////////////////////////////////////
//#if defined DEBUG_FR_SCENE
// G4cerr << "***** SendNdiv() (/Ndiv)" << G4endl;
// G4cout << "***** SendNdiv() (/Ndiv)" << G4endl;
//#endif
//////////////////////////////////////////////////
@@ -347,9 +360,11 @@ void G4FRSCENEHANDLER::SendNdiv ( void )
num_division = GetNoOfSides(pVisAttribs);
// } else {
#if defined DEBUG_FR_SCENE
G4cerr << "WARNING: GetNoOfSides() failed. " ;
G4cerr << "The default value " << num_division ;
G4cerr << " is assigned." << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "WARNING: GetNoOfSides() failed. " ;
G4cout << "The default value " << num_division ;
G4cout << " is assigned." << G4endl;
}
#endif
//}
@@ -358,7 +373,7 @@ void G4FRSCENEHANDLER::SendNdiv ( void )
//////////////////////////////////////////////////
//#if defined DEBUG_FR_SCENE
// G4cerr << "Ndiv = " << num_division << G4endl;
// G4cout << "Ndiv = " << num_division << G4endl;
//#endif
//////////////////////////////////////////////////
@@ -373,13 +388,16 @@ void G4FRSCENEHANDLER::FREndModeling ()
{
//-----
#if defined DEBUG_FR_SCENE
G4cerr << "***** FREndModeling (called)" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** FREndModeling (called)" << G4endl;
#endif
if( FRIsInModeling() ) {
#if defined DEBUG_FR_SCENE
G4cerr << "***** FREndModeling (started) " ;
G4cerr << "(/EndModeling, /DrawAll, /CloseDevice)" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "***** FREndModeling (started) " ;
G4cout << "(/EndModeling, /DrawAll, /CloseDevice)" << G4endl;
}
#endif
SendStr( "#--------------------" );
@@ -406,7 +424,8 @@ void G4FRSCENEHANDLER::FREndModeling ()
void G4FRSCENEHANDLER::BeginPrimitives (const G4Transform3D& objectTransformation)
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** BeginPrimitives \n";
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** BeginPrimitives \n";
#endif
FRBeginModeling();
@@ -421,7 +440,8 @@ void G4FRSCENEHANDLER::BeginPrimitives (const G4Transform3D& objectTransformatio
void G4FRSCENEHANDLER::EndPrimitives ()
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** EndPrimitives \n";
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** EndPrimitives \n";
#endif
G4VSceneHandler::EndPrimitives ();
}
@@ -433,7 +453,8 @@ void G4FRSCENEHANDLER::EndPrimitives ()
void G4FRSCENEHANDLER::AddSolid( const G4Box& box )
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** AddSolid ( box )\n";
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid ( box )\n";
#endif
//----- skip drawing invisible primitive
if( !IsVisible() ) { return ; }
@@ -472,7 +493,8 @@ void
G4FRSCENEHANDLER::AddSolid( const G4Tubs& tubes )
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** AddSolid ( tubes )\n";
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid ( tubes )\n";
#endif
//----- skip drawing invisible primitive
if( !IsVisible() ) { return ; }
@@ -514,7 +536,8 @@ void
G4FRSCENEHANDLER::AddSolid( const G4Cons& cons )
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** AddSolid ( cons )\n";
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid ( cons )\n";
#endif
//----- skip drawing invisible primitive
if( !IsVisible() ) { return ; }
@@ -556,7 +579,8 @@ G4FRSCENEHANDLER::AddSolid( const G4Cons& cons )
void G4FRSCENEHANDLER::AddSolid ( const G4Trd& trd )
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** AddSolid ( trd )\n";
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid ( trd )\n";
#endif
//----- skip drawing invisible primitive
@@ -597,7 +621,8 @@ void G4FRSCENEHANDLER::AddSolid ( const G4Trd& trd )
void G4FRSCENEHANDLER::AddSolid ( const G4Sphere& sphere )
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** AddSolid ( sphere )\n";
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid ( sphere )\n";
#endif
//----- skip drawing invisible primitive
if( !IsVisible() ) { return ; }
@@ -657,7 +682,8 @@ void G4FRSCENEHANDLER::AddSolid ( const G4Sphere& sphere )
void G4FRSCENEHANDLER::AddSolid (const G4Para& para)
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** AddSolid ( para )\n";
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid ( para )\n";
#endif
//----- skip drawing invisible primitive
@@ -684,10 +710,12 @@ void G4FRSCENEHANDLER::AddSolid (const G4Para& para)
//----- parameters preprocessing
G4double cosTheta = para.GetSymAxis().z() ;
if( cosTheta < epsilon ) {
G4cerr << "WARNING from FukuiRenderer (DAWN) driver:" << G4endl;
G4cerr << " Invalid parameter for parallelepiped." << G4endl;
G4cerr << " Drawing is skipped." << G4endl;
return ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "WARNING from FukuiRenderer (DAWN) driver:" << G4endl;
G4cout << " Invalid parameter for parallelepiped." << G4endl;
G4cout << " Drawing is skipped." << G4endl;
}
return ;
}
G4double tanTheta_cosPhi_cosTheta = para.GetSymAxis().x() ;
G4double tanTheta_sinPhi_cosTheta = para.GetSymAxis().y() ;
@@ -713,7 +741,8 @@ void G4FRSCENEHANDLER::AddSolid (const G4Para& para)
void G4FRSCENEHANDLER::AddSolid (const G4Trap& trap)
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** AddSolid ( trap )\n";
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid ( trap )\n";
#endif
//----- skip drawing invisible primitive
@@ -740,10 +769,12 @@ void G4FRSCENEHANDLER::AddSolid (const G4Trap& trap)
//----- parameters preprocessing
G4double cosTheta = trap.GetSymAxis().z() ;
if( cosTheta < epsilon ) {
G4cerr << "WARNING from FukuiRenderer (DAWN) driver:" << G4endl;
G4cerr << " Invalid parameter for trap, 1" << G4endl;
G4cerr << " Drawing is skipped." << G4endl;
return ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "WARNING from FukuiRenderer (DAWN) driver:" << G4endl;
G4cout << " Invalid parameter for trap, 1" << G4endl;
G4cout << " Drawing is skipped." << G4endl;
}
return ;
}
G4double nx = trap.GetSymAxis().x() ;
@@ -804,7 +835,8 @@ void
G4FRSCENEHANDLER::AddSolid( const G4Torus& torus )
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** AddSolid ( torus )\n";
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid ( torus )\n";
#endif
//----- skip drawing invisible primitive
if( !IsVisible() ) { return ; }
@@ -928,7 +960,8 @@ G4bool G4FRSCENEHANDLER::IsVisible()
void G4FRSCENEHANDLER::SendBoundingBox( void )
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** SendBoundingBox () (/BoundingBox)" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** SendBoundingBox () (/BoundingBox)" << G4endl;
#endif
//----- (1A) CALC bounding box of the bounding sphere
@@ -1047,7 +1080,8 @@ void G4FRSCENEHANDLER::SendStrInt( const char* char_string ,
num_char = sprintf( command, "%s %d", char_string , ival ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrInt(), 1\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "ERROR G4FRSCENEHANDLER::SendStrInt(), 1\n" ;
}
SendStr( command );
delete [] command ;
@@ -1069,7 +1103,8 @@ G4FRSCENEHANDLER::SendStrInt3( const char* char_string ,
sprintf( command, "%s %d %d %d", char_string , ival1, ival2, ival3 ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrInt3(), 1\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "ERROR G4FRSCENEHANDLER::SendStrInt3(), 1\n" ;
}
SendStr( command );
delete [] command ;
@@ -1093,7 +1128,8 @@ G4FRSCENEHANDLER::SendStrInt4( const char* char_string ,
sprintf( command, "%s %d %d %d %d", char_string , ival1, ival2, ival3, ival4 ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrInt4(), 1\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "ERROR G4FRSCENEHANDLER::SendStrInt4(), 1\n" ;
}
SendStr( command );
delete [] command ;
@@ -1112,7 +1148,8 @@ void G4FRSCENEHANDLER::SendStrDouble( const char* char_string ,
char_string , \
fPrec2, fPrec, dval ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble(), 1\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble(), 1\n" ;
}
SendStr( command );
delete [] command ;
@@ -1134,7 +1171,8 @@ G4FRSCENEHANDLER::SendStrDouble2( const char* char_string ,
fPrec2, fPrec, dval1, \
fPrec2, fPrec, dval2 ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble2(), 1\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble2(), 1\n" ;
}
SendStr( command );
delete [] command ;
@@ -1159,7 +1197,8 @@ G4FRSCENEHANDLER::SendStrDouble3( const char* char_string ,
fPrec2, fPrec, dval2, \
fPrec2, fPrec, dval3 ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble3(), 1\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble3(), 1\n" ;
}
SendStr( command );
delete [] command ;
@@ -1186,7 +1225,8 @@ G4FRSCENEHANDLER::SendStrDouble4( const char* char_string ,
fPrec2, fPrec, dval3, \
fPrec2, fPrec, dval4) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble4(), 1\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble4(), 1\n" ;
}
SendStr( command );
delete [] command ;
@@ -1215,7 +1255,8 @@ G4FRSCENEHANDLER::SendStrDouble5( const char* char_string ,
fPrec2, fPrec, dval4, \
fPrec2, fPrec, dval5 ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble5(), 1\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble5(), 1\n" ;
}
SendStr( command );
delete [] command ;
@@ -1246,7 +1287,8 @@ G4FRSCENEHANDLER::SendStrDouble6( const char* char_string ,
fPrec2, fPrec, dval5, \
fPrec2, fPrec, dval6 ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble6(), 1\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble6(), 1\n" ;
}
SendStr( command );
delete [] command ;
@@ -1279,7 +1321,8 @@ G4FRSCENEHANDLER::SendStrDouble7( const char* char_string ,
fPrec2, fPrec, dval6,\
fPrec2, fPrec, dval7 ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble7(), 1\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble7(), 1\n" ;
}
SendStr( command );
delete [] command ;
@@ -1320,7 +1363,8 @@ G4FRSCENEHANDLER::SendStrDouble11( const char* char_string ,
fPrec2, fPrec, dval10,\
fPrec2, fPrec, dval11 ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble11(), 1\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble11(), 1\n" ;
}
SendStr( command );
delete [] command ;
@@ -1345,7 +1389,8 @@ G4FRSCENEHANDLER::SendIntDouble3( G4int ival ,
fPrec2, fPrec, dval2, \
fPrec2, fPrec, dval3 ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendIntDouble3(),1\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "ERROR G4FRSCENEHANDLER::SendIntDouble3(),1\n" ;
}
SendStr( command );
delete [] command ;
@@ -1365,7 +1410,8 @@ G4FRSCENEHANDLER::SendInt3Str( G4int ival1 ,
num_char = sprintf( command, "%d %d %d %s", \
ival1, ival2, ival3, char_string ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendInt3Str(),1\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "ERROR G4FRSCENEHANDLER::SendInt3Str(),1\n" ;
}
SendStr( command );
delete [] command ;
@@ -1386,7 +1432,8 @@ G4FRSCENEHANDLER::SendInt4Str( G4int ival1 ,
num_char = sprintf( command, "%d %d %d %d %s", \
ival1, ival2, ival3, ival4, char_string ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendInt4Str(),1\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "ERROR G4FRSCENEHANDLER::SendInt4Str(),1\n" ;
}
SendStr( command );
delete [] command ;
@@ -1417,7 +1464,8 @@ G4FRSCENEHANDLER::SendStrDouble6Str( const char* char_string1 ,
fPrec2, fPrec, dval6, \
char_string2 );
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble6Str(), 1\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "ERROR G4FRSCENEHANDLER::SendStrDouble6Str(), 1\n" ;
}
SendStr( command );
delete [] command ;
@@ -1434,7 +1482,8 @@ void G4FRSCENEHANDLER::SendInt( G4int val )
num_char = sprintf( command, "%d", val ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrInt(), 1\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "ERROR G4FRSCENEHANDLER::SendStrInt(), 1\n" ;
}
SendStr( command );
delete [] command ;
@@ -1450,7 +1499,8 @@ void G4FRSCENEHANDLER::SendDouble( G4double val )
num_char = sprintf( command, "%*.*g", fPrec2, fPrec, val ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrInt(), 1\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "ERROR G4FRSCENEHANDLER::SendStrInt(), 1\n" ;
}
SendStr( command );
delete [] command ;
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4FukuiRendererSceneHandler.hh,v 1.16 2009/10/21 14:59:17 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4FukuiRendererSceneHandler.hh,v 1.17 2010/05/30 10:18:32 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
// Satoshi TANAKA, Fri Jun 28 11:19:19 JST 1996
@@ -100,6 +100,9 @@ public:
void AddCompound ( const G4VHit& hit) {
G4VSceneHandler::AddCompound(hit);
}
void AddCompound ( const G4VDigi& digi) {
G4VSceneHandler::AddCompound(digi);
}
void AddCompound ( const G4THitsMap<G4double> & hits) {
G4VSceneHandler::AddCompound(hits);
}
@@ -0,0 +1,106 @@
#------------------------------------------------------------------------------
# sources.cmake
# Module : G4FR
# Package: Geant4.src.G4visualization.G4FR
#
# Sources description for a library.
# Lists the sources and headers of the code explicitely.
# Lists include paths needed.
# Lists the internal granular and global dependencies of the library.
# Source specific properties should be added at the end.
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake,v 1.1 2010/09/29 19:11:41 bmorgan Exp $
#
#------------------------------------------------------------------------------
# List external includes needed.
include_directories(${CLHEP_INCLUDE_DIRS})
# List internal includes needed.
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/hits/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/solids/CSG/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/solids/specific/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPGeometry/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/graphics_reps/include)
include_directories(${CMAKE_SOURCE_DIR}/source/intercoms/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/modeling/include)
#
# 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)
set(G4VIS_DAWN_MODULE_SOURCES
G4DAWNFILE.cc
G4DAWNFILESceneHandler.cc
G4DAWNFILEViewer.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)
#
# Add extra needed defs here
#
endif()
#
# Define the Geant4 Module.
#
include(Geant4MacroDefineModule)
GEANT4_DEFINE_MODULE(NAME G4FR
HEADERS
${G4VIS_DAWN_MODULE_HEADERS}
SOURCES
${G4VIS_DAWN_MODULE_SOURCES}
GRANULAR_DEPENDENCIES
G4csg
G4geometrymng
G4globman
G4graphics_reps
G4hits
G4intercoms
G4modeling
G4specsolids
G4vis_management
GLOBAL_DEPENDENCIES
G4digits_hits
G4geometry
G4global
G4graphics_reps
G4intercoms
G4modeling
G4vis_management
LINK_LIBRARIES
)
# List any source specific properties here
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4DAWNFILESceneHandler.cc,v 1.18 2006/06/29 21:16:52 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4DAWNFILESceneHandler.cc,v 1.19 2010/11/11 01:13:42 akimura Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// Satoshi TANAKA
// DAWNFILE scene.
@@ -40,6 +40,7 @@
#include <stdlib.h>
#include <string.h>
#include "globals.hh"
#include "G4VisManager.hh"
#include "G4FRConst.hh"
#include "G4DAWNFILE.hh"
#include "G4DAWNFILESceneHandler.hh"
@@ -127,7 +128,8 @@ fPrec (9), fPrec2 (16)
G4DAWNFILESceneHandler::~G4DAWNFILESceneHandler ()
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** ~G4DAWNFILESceneHandler" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** ~G4DAWNFILESceneHandler" << G4endl;
#endif
if (fPrimDest.IsOpen())
{
@@ -157,13 +159,15 @@ void G4DAWNFILESceneHandler::SetG4PrimFileName()
// Message in the final execution
if( i == MAX_FILE_INDEX )
{
G4cerr << "===========================================" << G4endl;
G4cerr << "WARNING MESSAGE from DAWNFILE driver: " << G4endl;
G4cerr << " This file name is the final one in the " << G4endl;
G4cerr << " automatic updation of the output file name." << G4endl;
G4cerr << " You may overwrite existing files, i.e. " << G4endl;
G4cerr << " g4_XX.prim and g4_XX.eps " << G4endl;
G4cerr << "===========================================" << G4endl;
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_XX.prim and g4_XX.eps " << G4endl;
G4cout << "===========================================" << G4endl;
}
}
// re-determine file name as G4DAWNFILE_DEST_DIR/g4_XX.prim
@@ -187,18 +191,18 @@ void G4DAWNFILESceneHandler::SetG4PrimFileName()
} // for
G4cerr << "=========================================== " << G4endl;
G4cerr << "Output file: " << fG4PrimFileName << G4endl;
G4cerr << "Destination directory (current dir if NULL): " << fG4PrimDestDir << G4endl;
G4cerr << "Maximal number of files in the destination directory: " << fMaxFileNum << G4endl;
G4cerr << "Note: " << G4endl;
G4cerr << " * The maximal number is customizable as: " << G4endl;
G4cerr << " % setenv G4DAWNFILE_MAX_FILE_NUM number " << G4endl;
G4cerr << " * The destination directory is customizable as:" << G4endl;
G4cerr << " % setenv G4DAWNFILE_DEST_DIR dir_name/ " << G4endl;
G4cerr << " ** Do not forget \"/\" at the end of the " << G4endl;
G4cerr << " dir_name, e.g. \"./tmp/\". " << G4endl;
G4cerr << "=========================================== " << G4endl;
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()
@@ -207,14 +211,17 @@ void G4DAWNFILESceneHandler::SetG4PrimFileName()
void G4DAWNFILESceneHandler::BeginSavingG4Prim( void )
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** BeginSavingG4Prim (called)\n";
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** BeginSavingG4Prim (called)\n";
#endif
if( !IsSavingG4Prim() )
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** (started) " ;
G4cerr << "(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) ;
@@ -227,13 +234,15 @@ void G4DAWNFILESceneHandler::BeginSavingG4Prim( void )
void G4DAWNFILESceneHandler::EndSavingG4Prim ( void )
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** EndSavingG4Prim (called)\n";
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** EndSavingG4Prim (called)\n";
#endif
if( IsSavingG4Prim() )
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** (started) (close g4.prim)" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** (started) (close g4.prim)" << G4endl;
#endif
fPrimDest.Close() ;
flag_saving_g4_prim = false ;
@@ -247,7 +256,8 @@ void G4DAWNFILESceneHandler::FRBeginModeling( void )
if( !FRIsInModeling() )
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** G4DAWNFILESceneHandler::FRBeginModeling (called & started)" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4DAWNFILESceneHandler::FRBeginModeling (called & started)" << G4endl;
#endif
//----- Send saving command and heading comment
@@ -258,19 +268,22 @@ void G4DAWNFILESceneHandler::FRBeginModeling( void )
//----- send SET_CAMERA command
#if defined DEBUG_FR_SCENE
G4cerr << "***** (!SetCamera in FRBeginModeling())" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** (!SetCamera in FRBeginModeling())" << G4endl;
#endif
SendStr( FR_SET_CAMERA );
//----- open device
#if defined DEBUG_FR_SCENE
G4cerr << "***** (!OpenDevice in FRBeginModeling())" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** (!OpenDevice in FRBeginModeling())" << G4endl;
#endif
SendStr( FR_OPEN_DEVICE );
//----- begin sending primitives
#if defined DEBUG_FR_SCENE
G4cerr << "***** (!BeginModeling in FRBeginModeling())" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** (!BeginModeling in FRBeginModeling())" << G4endl;
#endif
SendStr( FR_BEGIN_MODELING ); FRflag_in_modeling = true ;
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4DAWNFILEViewer.cc,v 1.20 2006/06/29 21:16:54 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4DAWNFILEViewer.cc,v 1.21 2010/11/11 01:13:42 akimura Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// Satoshi TANAKA
// DAWNFILE view - opens window, hard copy, etc.
@@ -41,6 +41,7 @@
#include <string.h>
#include <assert.h>
#include "G4VisManager.hh"
#include "G4Scene.hh"
#include "G4Vector3D.hh"
#include "G4VisExtent.hh"
@@ -100,7 +101,8 @@ G4DAWNFILEViewer::~G4DAWNFILEViewer ()
void G4DAWNFILEViewer::SetView ()
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4DAWNFILEViewer::SetView(): No effects" << G4endl;
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.
@@ -112,7 +114,8 @@ void
G4DAWNFILEViewer::ClearView( void )
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4DAWNFILEViewer::ClearView (): No effects " << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4DAWNFILEViewer::ClearView (): No effects " << G4endl;
#endif
if (fSceneHandler.fPrimDest.IsOpen()) {
fSceneHandler.fPrimDest.Close();
@@ -129,7 +132,8 @@ G4DAWNFILEViewer::ClearView( void )
void G4DAWNFILEViewer::DrawView ()
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4DAWNFILEViewer::DrawView () " << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4DAWNFILEViewer::DrawView () " << G4endl;
#endif
//-----
fSceneHandler.FRBeginModeling() ;
@@ -148,7 +152,8 @@ void G4DAWNFILEViewer::DrawView ()
void G4DAWNFILEViewer::ShowView( void )
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4DAWNFILEViewer::ShowView () " << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4DAWNFILEViewer::ShowView () " << G4endl;
#endif
if( fSceneHandler.FRIsInModeling() )
@@ -203,7 +208,7 @@ void G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI( std::ostream& out )
{
///////////////////////
//#if defined DEBUG_FR_VIEW
// G4cerr << "***** G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI()" << G4endl;
// G4cout << "***** G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI()" << G4endl;
//#endif
//////////////////////
@@ -241,8 +246,10 @@ void G4DAWNFILEViewer::SendViewParameters ()
// later due to user interaction via visualization system's GUI.)
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4DAWNFILEViewer::SendViewParameters() ";
G4cerr << "(GUI parameters)" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "***** G4DAWNFILEViewer::SendViewParameters() ";
G4cout << "(GUI parameters)" << G4endl;
}
#endif
//----- Magic number to decide camera distance automatically
@@ -270,8 +277,10 @@ void G4DAWNFILEViewer::SendViewParameters ()
}
if ( camera_distance < radius ) {
G4cerr << "WARNING from DAWNFILE driver:" << G4endl;
G4cerr << " Camera cannot enter inside objects" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "WARNING from DAWNFILE driver:" << G4endl;
G4cout << " Camera cannot enter inside objects" << G4endl;
}
camera_distance = radius ;
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4FRClientServer.cc,v 1.6 2006/06/29 21:16:56 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4FRClientServer.cc,v 1.7 2010/11/11 01:13:42 akimura Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// Satoshi TANAKA, Wed Jul 3 14:14:29 JST 1996
////////////////////////////////
@@ -37,6 +37,7 @@
#ifdef G4VIS_BUILD_DAWN_DRIVER
//=================//
#include "G4VisManager.hh"
#include "G4FRClientServer.hh"
// #define DEBUG_CLIENT_SERVER
@@ -118,7 +119,8 @@ void G4FRClientServer::Receive()
}
#if defined DEBUG_CLIENT_SERVER
G4cerr << ">>>>> receivedMessage = " << fReceivedMessage << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << ">>>>> receivedMessage = " << fReceivedMessage << G4endl;
#endif
}
@@ -149,7 +151,8 @@ void G4FRClientServer::Send()
}
#if defined DEBUG_CLIENT_SERVER
G4cerr << "<<<<< SentMessage = " << fSendingMessage << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "<<<<< SentMessage = " << fSendingMessage << G4endl;
#endif
} // G4FRClientServer::Send()
@@ -254,7 +257,8 @@ int G4FRClientServer::ConnectINET()
// #if defined DEBUG_CLIENT_SERVER
G4cerr << "***** Trying connection to " << server_hostname << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** Trying connection to " << server_hostname << G4endl;
// #endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4FukuiRenderer.cc,v 1.9 2006/06/29 21:16:58 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4FukuiRenderer.cc,v 1.10 2010/11/11 01:13:42 akimura Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
// Satoshi TANAKA
@@ -42,6 +42,7 @@
#define __G_ANSI_C__
#include "G4VisManager.hh"
//#include "G4VisFeaturesOfFukuiRenderer.hh"
#include "G4VSceneHandler.hh"
#include "G4FukuiRendererSceneHandler.hh"
@@ -113,7 +114,8 @@ void G4FukuiRenderer::UseInetDomainAuto()
int pid ;
#if defined DEBUG_FR_SYSTEM
G4cerr << "***** Unix Inet Domain (AUTO mode)" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** Unix Inet Domain (AUTO mode)" << G4endl;
#endif
fIPMode = G4FukuiRenderer::IP_UNIX ;
@@ -143,11 +145,14 @@ void G4FukuiRenderer::UseInetDomainAuto()
}
if(!flag_connected) {
G4cerr << "***** ERROR: Connection failed" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** ERROR: Connection failed" << G4endl;
}
else {
G4cerr << "***** GEANT4 is connected to FukuiRenderer DAWN ";
G4cerr << "in the same host" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "***** GEANT4 is connected to FukuiRenderer DAWN ";
G4cout << "in the same host" << G4endl;
}
}
} // G4FukuiRenderer::UseInetDomainAuto()
@@ -158,18 +163,22 @@ void
G4FukuiRenderer::UseInetDomain()
{
#if defined DEBUG_FR_SYSTEM
G4cerr << "***** INET Domain " << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** INET Domain " << G4endl;
#endif
fIPMode = G4FukuiRenderer::IP_INET ;
this->ConnectPort();
if(!flag_connected) {
G4cerr << "***** ERROR: Connection failed" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** ERROR: Connection failed" << G4endl;
}
else {
G4cerr << "GEANT4 is connected to FukuiRenderer DAWN via socket" ;
G4cerr << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "GEANT4 is connected to FukuiRenderer DAWN via socket" ;
G4cout << G4endl;
}
}
} // G4FukuiRenderer::UseInetDomain()
@@ -182,25 +191,31 @@ G4FukuiRenderer::ConnectPort( int max_port_incr )
while(1) {
if ( ++connect_trial > max_port_incr ) {
this->flag_connected = 0 ;
G4cerr << "***** INET Connection failed." << G4endl;
G4cerr << " Maybe, you have not invoked DAWN yet," << G4endl;
G4cerr << " or too many DAWN's are already running" << G4endl;
G4cerr << " in the server host." << G4endl;
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 ;
G4cerr << "***** GEANT4 is connected to port " ;
G4cerr << fPrimDest.GetPortNumber() ;
G4cerr << " of server" << G4endl;
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();
G4cerr << "***** GEANT4 incremented targeting port to " ;
G4cerr << fPrimDest.GetPortNumber() << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "***** GEANT4 incremented targeting port to " ;
G4cout << fPrimDest.GetPortNumber() << G4endl;
}
} // if-elseif-else
@@ -214,7 +229,8 @@ void G4FukuiRenderer::UseBSDUnixDomainAuto()
int pid ;
#if defined DEBUG_FR_SYSTEM
G4cerr << "***** UseBSDUnixDomainAuto " << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** UseBSDUnixDomainAuto " << G4endl;
#endif
fIPMode = G4FukuiRenderer::IP_UNIX ; // Unix domain
@@ -240,10 +256,13 @@ void G4FukuiRenderer::UseBSDUnixDomainAuto()
//----- display status
if(!flag_connected) {
G4cerr << "***** ERROR: Connection failed" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** ERROR: Connection failed" << G4endl;
} else {
G4cerr << "*** GEANT4 is connected to FukuiRenderer DAWN ";
G4cerr << "in the same host" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "*** GEANT4 is connected to FukuiRenderer DAWN ";
G4cout << "in the same host" << G4endl;
}
}
} // if--else
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4FukuiRendererSceneHandler.cc,v 1.14 2006/06/29 21:17:00 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4FukuiRendererSceneHandler.cc,v 1.15 2010/11/11 01:13:42 akimura Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
// Satoshi TANAKA, Fri Jun 28 11:34:24 JST 1996
@@ -45,6 +45,7 @@
#include <fstream>
#include <string.h>
#include "globals.hh"
#include "G4VisManager.hh"
#include "G4FRConst.hh"
#include "G4FukuiRenderer.hh"
#include "G4FukuiRendererSceneHandler.hh"
@@ -124,7 +125,8 @@ fPrec (9), fPrec2 (16)
G4FukuiRendererSceneHandler::~G4FukuiRendererSceneHandler ()
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** ~G4FukuiRendererSceneHandler" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** ~G4FukuiRendererSceneHandler" << G4endl;
#endif
ClearStore (); // clear current scene
@@ -136,7 +138,8 @@ void G4FukuiRendererSceneHandler::FRBeginModeling( void )
if( !FRIsInModeling() )
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** G4FukuiRendererSceneHandler::FRBeginModeling (called & started)" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4FukuiRendererSceneHandler::FRBeginModeling (called & started)" << G4endl;
#endif
//----- Begin Saving g4.prim file
@@ -172,21 +175,24 @@ void G4FukuiRendererSceneHandler::FRBeginModeling( void )
//----- send SET_CAMERA command
// !SetCamera
#if defined DEBUG_FR_SCENE
G4cerr << "***** (!SetCamera in FRBeginModeling())" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** (!SetCamera in FRBeginModeling())" << G4endl;
#endif
SendStr( FR_SET_CAMERA );
//----- open device
// !OpenDevice
#if defined DEBUG_FR_SCENE
G4cerr << "***** (!OpenDevice in FRBeginModeling())" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** (!OpenDevice in FRBeginModeling())" << G4endl;
#endif
SendStr( FR_OPEN_DEVICE );
//----- begin sending primitives
// !BeginModeling
#if defined DEBUG_FR_SCENE
G4cerr << "***** (!BeginModeling in FRBeginModeling())" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** (!BeginModeling in FRBeginModeling())" << G4endl;
#endif
SendStr( FR_BEGIN_MODELING ); FRflag_in_modeling = true ;
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4FukuiRendererViewer.cc,v 1.11 2006/06/29 21:17:02 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4FukuiRendererViewer.cc,v 1.12 2010/11/11 01:13:42 akimura Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
// Satoshi TANAKA, Fri Jun 28 12:09:11 JST 1996
@@ -46,6 +46,7 @@
#include <string.h>
#include <assert.h>
#include "G4VisManager.hh"
#include "G4Scene.hh"
#include "G4Vector3D.hh"
#include "G4VisExtent.hh"
@@ -75,7 +76,8 @@ G4FukuiRendererViewer::~G4FukuiRendererViewer ()
void G4FukuiRendererViewer::SetView ()
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4FukuiRendererViewer::SetView(): No effects" << G4endl;
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.
@@ -86,7 +88,8 @@ void
G4FukuiRendererViewer::ClearView( void )
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4FukuiRendererViewer::ClearView (): No effects " << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4FukuiRendererViewer::ClearView (): No effects " << G4endl;
#endif
}
@@ -96,7 +99,8 @@ G4FukuiRendererViewer::ClearView( void )
void G4FukuiRendererViewer::DrawView ()
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4FukuiRendererViewer::DrawView () " << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4FukuiRendererViewer::DrawView () " << G4endl;
#endif
//----- Begin modeling 3D
@@ -115,7 +119,8 @@ void G4FukuiRendererViewer::DrawView ()
void G4FukuiRendererViewer::ShowView( void )
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4FukuiRendererViewer::ShowView () " << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4FukuiRendererViewer::ShowView () " << G4endl;
#endif
if( fSceneHandler.FRIsInModeling() )
@@ -136,12 +141,14 @@ void G4FukuiRendererViewer::ShowView( void )
void G4FukuiRendererViewer::Wait()
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4FukuiRendererViewer::Wait () : Begin" << G4endl;
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
G4cerr << "***** G4FukuiRendererViewer::Wait () : end" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4FukuiRendererViewer::Wait () : end" << G4endl;
#endif
}
@@ -152,7 +159,8 @@ void
G4FukuiRendererViewer::SendDevice( FRDEV dev )
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4FukuiRendererViewer::SendDevice() " << G4endl;
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};
@@ -167,7 +175,8 @@ G4FukuiRendererViewer::SendDevice( FRDEV dev )
void G4FukuiRendererViewer::SendDrawingStyle()
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4FukuiRendererViewer::SendDrawingStyle() " << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4FukuiRendererViewer::SendDrawingStyle() " << G4endl;
#endif
G4int style = fVP.GetDrawingStyle();
@@ -200,7 +209,8 @@ void G4FukuiRendererViewer::SendViewParameters ()
// later due to user interaction via visualization system's GUI.)
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4FukuiRendererViewer::SendViewParameters()" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4FukuiRendererViewer::SendViewParameters()" << G4endl;
#endif
//----- Magic number to decide camera distance automatically
@@ -228,8 +238,10 @@ void G4FukuiRendererViewer::SendViewParameters ()
}
if ( camera_distance < radius ) {
G4cerr << "WARNING from FukuiRenderer (DAWN) driver:" << G4endl;
G4cerr << " Camera cannot enter inside objects" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "WARNING from FukuiRenderer (DAWN) driver:" << G4endl;
G4cout << " Camera cannot enter inside objects" << G4endl;
}
camera_distance = radius ;
}
+5 -2
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.26 2009/11/17 11:31:20 gcosmo Exp $
# $Id: GNUmakefile,v 1.27 2010/09/30 09:29:34 gcosmo Exp $
# -----------------------------------------------------------------------
# GNUmakefile for visualization and modeling. John Allison, 5/7/95.
# Modeling is always made. Others by environment. John Allison 4/7/98.
@@ -62,10 +62,13 @@ ifdef G4VIS_BUILD_OI_DRIVER
endif
endif #G4VIS_BUILD
.PHONY: granular glob global clean
.PHONY: granular obj glob global clean
glob global: granular
obj:
@for dir in $(SUBDIRS); do (cd $$dir; $(MAKE) obj); done
granular:
@for dir in $(SUBDIRS); do (cd $$dir; $(MAKE)); done
@@ -0,0 +1,20 @@
#------------------------------------------------------------------------------
# CMakeLists.txt
# Module : G4visHepRep
# Package: Geant4.src.G4visualization.G4visHepRep
#
# CMakeLists.txt for single level library that may be build global or granular
#
# Generated on : 24/9/2010
#
# $Id: CMakeLists.txt,v 1.1 2010/09/29 19:11:49 bmorgan Exp $
#
#------------------------------------------------------------------------------
include(Geant4MacroLibraryTargets)
if(GEANT4_BUILD_GRANULAR_LIBS)
GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
else()
GEANT4_GLOBAL_LIBRARY_TARGET(COMPONENTS sources.cmake)
endif()
+14 -1
View File
@@ -1,4 +1,4 @@
.$Id: History,v 1.132 2009/11/23 05:42:28 perl Exp $
.$Id: History,v 1.136 2010/11/07 22:29:30 perl Exp $
-------------------------------------------------------------------
=========================================================
@@ -20,6 +20,19 @@ committal in the CVS repository !
History file for visualization/HepRep sub-category
--------------------------------------------------
7th November 2010 Joseph Perl (vis-HepRep-V09-03-04)
- G4HepRepFileSceneHandler.hh: Fix coverity warning about uninitialized variables. Turns out they were unneeded.
20th June 2010 Joseph Perl (vis-HepRep-V09-03-03)
- G4HepRepMessenger: Correct default of new option renderCylAsPolygons
4th June 2010 Joseph Perl (vis-HepRep-V09-03-02)
- G4HepRepMessenger: Add command renderCylAsPolygons
- G4HepRepFileSceneHandler: Use new command
30th May 2010 John Allison (vis-HepRep-V09-03-00)
- G4HepRep[File}SceneHandler: Added AddCompound(const G4VDigi&).
22nd November 2009 Joseph Perl (vis-HepRep-V09-02-03)
- Changed messenger to a singleton.
- Added messenger commands to HepRepFile.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4HepRepFileSceneHandler.hh,v 1.31 2009/10/21 15:08:35 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4HepRepFileSceneHandler.hh,v 1.33 2010/11/07 22:29:30 perl Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
// Joseph Perl 27th January 2002
@@ -84,6 +84,9 @@ public:
void AddCompound (const G4THitsMap<G4double>& hits) {
G4VSceneHandler::AddCompound(hits);
}
void AddCompound (const G4VDigi& digi) {
G4VSceneHandler::AddCompound(digi);
}
// void PreAddSolid(const G4Transform3D& objectTransformation,
// const G4VisAttributes&);
// void PostAddSolid();
@@ -140,17 +143,12 @@ private:
const G4Visible visible);
void CheckFileOpen();
int fileCounter;
char fileDir[256];
char fileName[256];
G4bool fileOverwrite;
G4bool cullInvisibleObjects;
G4bool haveVisible;
G4bool inPrimitives2D;
G4bool warnedAbout3DText;
G4bool warnedAbout2DMarkers;
G4bool drawingTraj;
G4bool doneInitTraj;
G4bool drawTrajPts;
G4bool drawingHit;
G4bool doneInitHit;
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HepRepMessenger.hh,v 1.8 2009/11/23 05:42:28 perl Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4HepRepMessenger.hh,v 1.9 2010/06/05 06:25:03 perl Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
#ifndef G4HepRepMessenger_HH
@@ -50,6 +50,7 @@ class G4HepRepMessenger : public G4UImessenger {
virtual G4String getFileName();
virtual G4bool getOverwrite();
virtual G4bool getCullInvisibles();
virtual G4bool renderCylAsPolygons();
// Used by HepRepXML
virtual G4String getEventNumberSuffix();
@@ -75,7 +76,10 @@ class G4HepRepMessenger : public G4UImessenger {
G4bool cullInvisibles;
G4UIcmdWithABool* setCullInvisiblesCommand;
G4bool cylAsPolygons;
G4UIcmdWithABool* renderCylAsPolygonsCommand;
G4String suffix;
G4UIcmdWithAString* setEventNumberSuffixCommand;
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HepRepSceneHandler.hh,v 1.44 2009/11/23 05:42:28 perl Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4HepRepSceneHandler.hh,v 1.45 2010/05/30 10:28:02 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
/**
@@ -82,6 +82,9 @@ class G4HepRepSceneHandler: public G4VSceneHandler {
void AddCompound (const G4VTrajectory&);
void AddCompound (const G4VHit& hit);
void AddCompound (const G4VDigi& digi) {
G4VSceneHandler::AddCompound(digi);
}
void AddCompound (const G4THitsMap<G4double>& hits) {
G4VSceneHandler::AddCompound(hits);
}
+110
View File
@@ -0,0 +1,110 @@
#------------------------------------------------------------------------------
# sources.cmake
# Module : G4visHepRep
# Package: Geant4.src.G4visualization.G4visHepRep
#
# Sources description for a library.
# Lists the sources and headers of the code explicitely.
# Lists include paths needed.
# Lists the internal granular and global dependencies of the library.
# Source specific properties should be added at the end.
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake,v 1.2 2010/09/30 13:50:34 bmorgan Exp $
#
#------------------------------------------------------------------------------
# List external includes needed.
include_directories(${CLHEP_INCLUDE_DIRS})
# List internal includes needed.
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/hits/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/solids/CSG/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/solids/specific/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPGeometry/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/graphics_reps/include)
include_directories(${CMAKE_SOURCE_DIR}/source/intercoms/include)
include_directories(${CMAKE_SOURCE_DIR}/source/materials/include)
include_directories(${CMAKE_SOURCE_DIR}/source/tracking/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/externals/zlib/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/modeling/include)
#
# Define the Geant4 Module.
#
include(Geant4MacroDefineModule)
GEANT4_DEFINE_MODULE(NAME G4visHepRep
HEADERS
G4HepRep.hh
G4HepRepFile.hh
G4HepRepFileSceneHandler.hh
G4HepRepFileViewer.hh
G4HepRepFileXMLWriter.hh
G4HepRepMessenger.hh
G4HepRepSceneHandler.hh
G4HepRepViewer.hh
SOURCES
BHepRepWriter.cc
DefaultHepRep.cc
DefaultHepRepAction.cc
DefaultHepRepAttDef.cc
DefaultHepRepAttValue.cc
DefaultHepRepAttribute.cc
DefaultHepRepDefinition.cc
DefaultHepRepFactory.cc
DefaultHepRepInstance.cc
DefaultHepRepInstanceTree.cc
DefaultHepRepPoint.cc
DefaultHepRepTreeID.cc
DefaultHepRepType.cc
DefaultHepRepTypeTree.cc
DeflateOutputStreamBuffer.cc
G4HepRep.cc
G4HepRepFile.cc
G4HepRepFileSceneHandler.cc
G4HepRepFileViewer.cc
G4HepRepFileXMLWriter.cc
G4HepRepMessenger.cc
G4HepRepSceneHandler.cc
G4HepRepViewer.cc
GZIPOutputStream.cc
GZIPOutputStreamBuffer.cc
IndentPrintWriter.cc
XMLHepRepFactory.cc
XMLHepRepWriter.cc
XMLWriter.cc
ZipOutputStream.cc
ZipOutputStreamBuffer.cc
GRANULAR_DEPENDENCIES
G4csg
G4geometrymng
G4globman
G4graphics_reps
G4hits
G4intercoms
G4materials
G4modeling
G4specsolids
G4tracking
G4vis_management
G4zlib
GLOBAL_DEPENDENCIES
G4digits_hits
G4geometry
G4global
G4graphics_reps
G4intercoms
G4materials
G4modeling
G4tracking
G4vis_management
G4zlib
LINK_LIBRARIES
)
# List any source specific properties here
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HepRepFileSceneHandler.cc,v 1.68 2009/12/16 17:51:21 gunter Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4HepRepFileSceneHandler.cc,v 1.69 2010/06/05 06:25:03 perl Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
// Joseph Perl 27th January 2002
@@ -209,10 +209,24 @@ void G4HepRepFileSceneHandler::AddSolid(const G4Cons& cons) {
PrintThings();
#endif
// HepRApp does not correctly represent the end faces of cones at
// non-standard angles, let the base class convert these solids to polygons.
CLHEP::HepRotation r = fpObjectTransformation->getRotation();
G4bool linedUpWithAnAxis = (std::fabs(r.phiX())<=.001 ||
std::fabs(r.phiY())<=.001 ||
std::fabs(r.phiZ())<=.001 ||
std::fabs(r.phiX()-pi)<=.001 ||
std::fabs(r.phiY()-pi)<=.001 ||
std::fabs(r.phiZ()-pi)<=.001);
//G4cout << "Angle X:" << r.phiX() << ", Angle Y:" << r.phiY() << ", Angle Z:" << r.phiZ() << G4endl;
//G4cout << "linedUpWithAnAxis:" << linedUpWithAnAxis << G4endl;
// HepRep does not have a primitive for a cut cone,
// so if this cone is cut, let the base class convert this
// solid to polygons.
if (cons.GetDeltaPhiAngle() < twopi) {
G4HepRepMessenger* messenger = G4HepRepMessenger::GetInstance();
if (cons.GetDeltaPhiAngle() < twopi || !linedUpWithAnAxis || messenger->renderCylAsPolygons())
{
G4VSceneHandler::AddSolid(cons); // Invoke default action.
} else {
@@ -277,7 +291,8 @@ void G4HepRepFileSceneHandler::AddSolid(const G4Tubs& tubs) {
// HepRep does not have a primitive for a cut cylinder,
// so if this cylinder is cut, let the base class convert this
// solid to polygons.
if (tubs.GetDeltaPhiAngle() < twopi || !linedUpWithAnAxis)
G4HepRepMessenger* messenger = G4HepRepMessenger::GetInstance();
if (tubs.GetDeltaPhiAngle() < twopi || !linedUpWithAnAxis || messenger->renderCylAsPolygons())
{
G4VSceneHandler::AddSolid(tubs); // Invoke default action.
} else {
@@ -291,8 +306,6 @@ void G4HepRepFileSceneHandler::AddSolid(const G4Tubs& tubs) {
haveVisible = false;
AddHepRepInstance("Cylinder", NULL);
G4HepRepMessenger* messenger = G4HepRepMessenger::GetInstance();
if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && messenger->getCullInvisibles())
return;
@@ -474,7 +487,6 @@ void G4HepRepFileSceneHandler::AddCompound (const G4VTrajectory& traj) {
dynamic_cast<G4TrajectoriesModel*>(fpModel);
if (!pTrModel) G4Exception
("G4HepRepFileSceneHandler::AddCompound(const G4VTrajectory&): Not a G4TrajectoriesModel.");
G4int drawingMode = pTrModel->GetDrawingMode();
// Pointers to hold trajectory attribute values and definitions.
std::vector<G4AttValue>* rawTrajAttValues = traj.CreateAttValues();
@@ -550,7 +562,7 @@ void G4HepRepFileSceneHandler::AddCompound (const G4VTrajectory& traj) {
// Take all TrajectoryPoint attDefs from first point of first trajectory.
// Would rather be able to get these attDefs without needing a reference from any
// particular point, but don't know how to do that.
if ((drawingMode!=0 || trajContext->GetDrawStepPts() || trajContext->GetDrawAuxPts())
if ((trajContext->GetDrawStepPts() || trajContext->GetDrawAuxPts())
&& traj.GetPointEntries()>0) {
G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(0);
@@ -625,7 +637,7 @@ void G4HepRepFileSceneHandler::AddCompound (const G4VTrajectory& traj) {
drawingTraj = false;
// Draw step points.
if (drawingMode!=0 || trajContext->GetDrawStepPts()) {
if (trajContext->GetDrawStepPts()) {
if (!doneInitTraj)
InitTrajectory();
// Create Trajectory Points as a subType of Trajectories.
@@ -641,22 +653,13 @@ void G4HepRepFileSceneHandler::AddCompound (const G4VTrajectory& traj) {
G4int markSize;
G4bool visible;
G4bool square;
if (drawingMode==0) {
G4Colour colour = trajContext->GetStepPtsColour();
redness = colour.GetRed();
greenness = colour.GetGreen();
blueness = colour.GetBlue();
markSize = (G4int) trajContext->GetStepPtsSize();
visible = (G4int) trajContext->GetStepPtsVisible();
square = (trajContext->GetStepPtsType()==G4Polymarker::squares);
} else {
redness = 1.;
greenness = 1.;
blueness = 1.;
markSize = std::abs(drawingMode/1000);
visible = true;
square = false;
}
G4Colour colour = trajContext->GetStepPtsColour();
redness = colour.GetRed();
greenness = colour.GetGreen();
blueness = colour.GetBlue();
markSize = (G4int) trajContext->GetStepPtsSize();
visible = (G4int) trajContext->GetStepPtsVisible();
square = (trajContext->GetStepPtsType()==G4Polymarker::squares);
// Avoiding drawing anything black on black.
if (redness==0. && greenness==0. && blueness==0.) {
@@ -734,7 +737,7 @@ void G4HepRepFileSceneHandler::AddCompound (const G4VTrajectory& traj) {
}
// Draw Auxiliary Points
if (drawingMode!=0 || trajContext->GetDrawAuxPts()) {
if (trajContext->GetDrawAuxPts()) {
if (!doneInitTraj)
InitTrajectory();
// Create Trajectory Points as a subType of Trajectories.
@@ -750,22 +753,13 @@ void G4HepRepFileSceneHandler::AddCompound (const G4VTrajectory& traj) {
G4int markSize;
G4bool visible;
G4bool square;
if (drawingMode==0) {
G4Colour colour = trajContext->GetAuxPtsColour();
redness = colour.GetRed();
greenness = colour.GetGreen();
blueness = colour.GetBlue();
markSize = (G4int) trajContext->GetAuxPtsSize();
visible = (G4int) trajContext->GetAuxPtsVisible();
square = (trajContext->GetAuxPtsType()==G4Polymarker::squares);
} else {
redness = 1.;
greenness = 1.;
blueness = 1.;
markSize = std::abs(drawingMode/1000);
visible = true;
square = false;
}
G4Colour colour = trajContext->GetAuxPtsColour();
redness = colour.GetRed();
greenness = colour.GetGreen();
blueness = colour.GetBlue();
markSize = (G4int) trajContext->GetAuxPtsSize();
visible = (G4int) trajContext->GetAuxPtsVisible();
square = (trajContext->GetAuxPtsType()==G4Polymarker::squares);
// Avoiding drawing anything black on black.
if (redness==0. && greenness==0. && blueness==0.) {
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HepRepMessenger.cc,v 1.11 2009/11/23 05:42:28 perl Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4HepRepMessenger.cc,v 1.13 2010/06/21 04:43:07 perl Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
#include "G4HepRepMessenger.hh"
@@ -43,6 +43,7 @@ G4HepRepMessenger::G4HepRepMessenger() :
fileName("G4Data"),
overwrite(false),
cullInvisibles(false),
cylAsPolygons(false),
suffix (""),
geometry(true),
solids(true),
@@ -100,6 +101,13 @@ G4HepRepMessenger::G4HepRepMessenger() :
}
setCullInvisiblesCommand->AvailableForStates(G4State_Idle);
renderCylAsPolygonsCommand = new G4UIcmdWithABool("/vis/heprep/renderCylAsPolygons", this);
renderCylAsPolygonsCommand->SetGuidance("Render cylinders and cones as polygons.");
renderCylAsPolygonsCommand->SetGuidance("This command is used by HepRepFile, not by HepRepXML.");
renderCylAsPolygonsCommand->SetParameterName("flag",false);
renderCylAsPolygonsCommand->SetDefaultValue(false);
renderCylAsPolygonsCommand->AvailableForStates(G4State_Idle);
setEventNumberSuffixCommand = new G4UIcmdWithAString("/vis/heprep/setEventNumberSuffix", this);
setEventNumberSuffixCommand->SetGuidance("Write separate event files, appended with given suffix.");
setEventNumberSuffixCommand->SetGuidance("Define the suffix with a pattern such as '-0000'.");
@@ -121,13 +129,13 @@ G4HepRepMessenger::G4HepRepMessenger() :
addPointAttributesCommand->SetParameterName("flag",false);
addPointAttributesCommand->SetDefaultValue(false);
addPointAttributesCommand->AvailableForStates(G4State_Idle);
useSolidsCommand = new G4UIcmdWithABool("/vis/heprep/useSolids", this);
useSolidsCommand->SetGuidance("Use HepRep Solids, rather than Geant4 Primitives.");
useSolidsCommand->SetGuidance("This command is used by HepRepXML, not by HepRepFile.");
useSolidsCommand->SetParameterName("flag",false);
useSolidsCommand->SetDefaultValue(true);
useSolidsCommand->AvailableForStates(G4State_Idle);
useSolidsCommand = new G4UIcmdWithABool("/vis/heprep/useSolids", this);
useSolidsCommand->SetGuidance("Use HepRep Solids, rather than Geant4 Primitives.");
useSolidsCommand->SetGuidance("This command is used by HepRepXML, not by HepRepFile..");
useSolidsCommand->SetParameterName("flag",false);
useSolidsCommand->SetDefaultValue(true);
useSolidsCommand->AvailableForStates(G4State_Idle);
}
G4HepRepMessenger::~G4HepRepMessenger() {
@@ -135,6 +143,7 @@ G4HepRepMessenger::~G4HepRepMessenger() {
delete setFileNameCommand;
delete setOverwriteCommand;
delete setCullInvisiblesCommand;
delete renderCylAsPolygonsCommand;
delete setEventNumberSuffixCommand;
delete appendGeometryCommand;
delete addPointAttributesCommand;
@@ -151,6 +160,8 @@ G4String G4HepRepMessenger::GetCurrentValue(G4UIcommand * command) {
return overwrite;
} else if (command==setCullInvisiblesCommand) {
return cullInvisibles;
} else if (command==renderCylAsPolygonsCommand) {
return renderCylAsPolygonsCommand->ConvertToString(cylAsPolygons);
} else if (command==setEventNumberSuffixCommand) {
return suffix;
} else if (command==appendGeometryCommand) {
@@ -173,6 +184,8 @@ void G4HepRepMessenger::SetNewValue(G4UIcommand * command, G4String newValue) {
overwrite = setOverwriteCommand->GetNewBoolValue(newValue);
} else if (command==setCullInvisiblesCommand) {
cullInvisibles = setCullInvisiblesCommand->GetNewBoolValue(newValue);
} else if (command==renderCylAsPolygonsCommand) {
cylAsPolygons = renderCylAsPolygonsCommand->GetNewBoolValue(newValue);
} else if (command==setEventNumberSuffixCommand) {
suffix = newValue;
} else if (command==appendGeometryCommand) {
@@ -200,6 +213,10 @@ G4bool G4HepRepMessenger::getCullInvisibles() {
return cullInvisibles;
}
G4bool G4HepRepMessenger::renderCylAsPolygons() {
return cylAsPolygons;
}
G4String G4HepRepMessenger::getEventNumberSuffix() {
return suffix;
}
+144 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.460 2009/11/23 05:56:37 perl Exp $
$Id: History,v 1.493 2010/11/16 01:58:41 perl Exp $
-------------------------------------------------------------------
=========================================================
@@ -24,6 +24,149 @@ committal in the CVS repository !
History file for visualization category
---------------------------------------
15th November 2010 Joseph Perl (vis-V09-03-13)
- Global Vis Tag. Candidate for Geant4 release 9.4
- modeling-V09-03-05 - Fix for time-slicing problem.
13th November 2010 Joseph Perl ((vis-V09-03-12)
- Global Vis Tag. Candidate for Geant4 release 9.4
13th November 2010 John Allison
- opengl-V09-03-10: Added verbosity control.
- visexternal-V09-03-03: Fix for VC++.
- visman-V09-03-15: Code tidying.
- vistree-V09-03-00: Tagged inclusion of CMake stuff.
- All tags include CMake stuff.
11th November 2010 Akinori Kimura
- DAWN-V09-03-01, gMocren-V09-03-05, VRML-V09-03-01:
o Replaced G4cerr with G4cout and added verbosity control.
10th November 2010 John Allison
- openinventor-V09-03-02: Protected output with G4VisManager::confirmations.
8th November 2010 John Allison (vis-V09-03-11)
- opengl-V09-03-09: Tidied display list limit.
7th November 2010 John Allison (vis-V09-03-10)
- visman-V09-03-14:
o G4VisExecutive.icc: Inlined constructor.
o Fixed Coverity warnings.
- visexternal-V09-03-02: Fixed Linux warnings.
- vis-HepRep-V09-03-04: Fixed Linux warnings (Joseph).
5th November 2010, John Allison
- modeling-V09-03-04: Fixed Coverity warnings.
- visman-V09-03-13: Fixed Coverity warnings.
- visexternal-V09-03-01: Update gl2ps to 1.3.5 (Laurent).
27th October 2010 John Allison
- vistest-V09-03-01: Replaced MyPhysicsList by QGSP_BERT.
- raytracer-V09-03-03/4: Changes to GNUmakefile (Gabriele Cosmo).
8th October 2010 John Allison (vis-V09-03-09 with co-working tags...)
- Co-working tags: interfaces-V09-03-12 + config-V09-03-08
- visman-V09-03-12:
o Added /vis/viewer/set/defaultColour and defaultTextColour.
- opengl-V09-03-07/08:
o Improved kernel visit trigger.
o Time-slices fade to background colour.
o Many improvements to Qt.
- openinventor-V09-03-01:
o Improved kernel visit trigger.
- visXXX-V08-03-00:
o Improved kernel visit trigger.
- visexternal-V09-03-00:
o G4OpenGL2PSAction : add new method to set viewport.
- gMocren-V09-03-04:
o Added missing inclusion of <sstream>.
15th June 2010 John Allison (vis-V09-03-08)
- visman-V09-03-10:
o Added virtual destructors to fix compilation warnings.
o Improved action after "/vis/geometry/..." commands.
- raytracer-V09-03-02 (Gabriele Cosmo):
o Added virtual destructors to fix compilation warnings.
4th June 2010 Joseph Perl (vis-V09-03-07)
- vis-HepRep-V09-03-02
o Added command renderCylAsPolygon - opengl-V09-03-07
o G4OpenGLImmediate/StoredQtViewer : Add protection against multiple
repaint call. Add protection against resizeGl with bad values
3rd June 2010 John Allison
- opengl-V09-03-06:
o Restored all behaviour-sensitive changes to geant4-09-03.
- visman-V09-03-09:
o Fixed unchecked pointer.
o Changed /vis/scene/add/digiti[sz]ations to /vis/scene/add/digis.
- opengl-V09-03-05:
o Restored some changes to geant4-09-03 to preserve behaviour.
1st June 2010 John Allison
- modeling-V09-03-03: Added default colours to G4TrajectoryDrawByParticleID.
1st June 2010 John Allison (vis-V09-03-06)
- visman-V09-03-07:
o Made fVerbosity and GetVerbosity static (saves having to get vis
manager pointer).
- gMocren-V09-03-03: Removed dependency on G4VisManager.
30th May 2010 John Allison (vis-V09-03-05)
- Co-works greps-V09-03-02.
- modeling-V09-03-02: Added G4DigiModel and G4DigiFilterFactories.
- visman-V09-03-06:
o Added /vis/scene/add/digiti[sz]ations and /vis/filtering/digi.
o Added AddCompound(const G4VDigi&).
- opengl-V09-03-04, gMocren-V09-03-02, VRML-V09-03-00, DAWN-V09-03-00,
raytracer-V09-03-01, vis-HepRep-V09-03-00:
o Added AddCompound(const G4VDigi&).
29th May 2010 John Allison (vis-V09-03-04)
- Co-works greps-V09-03-01 and tracking-V09-03-03.
- visman-V09-03-05:
o Introduced DispatchToModel without i_mode.
o Moved i-mode deprecation warnings to G4VTrajectory.
o Improved /vis/viewer/rebuild.
- opengl-V09-03-03: Improvements.
- raytracer-V09-03-00: Added DrawTrajectory() ready for i_mode migration.
28th May 2010 John Allison (vis-V09-03-03)
- Co-works interfaces-V09-03-04.
- visman-V09-03-03: Change order of flags to follow G4UIExecutive.
- visman-V09-03-04: G4VisManager, G4VisExecutive:
Introduced optional verbosity string argument in constructor. You
can now write, for example:
G4VisManager* visManager = new G4VisExecutive("quiet");
Note that the default is "warnings":
G4VisManager* visManager = new G4VisExecutive;
- modeling-V09-03-01: Fixed unused parameter 'i_mode' warning.
26th May 2010 John Allison (vis-V09-03-02)
- Co-working: intercoms-V09-03-01, interfaces-V09-03-03, greps-V09-03-00.
- visman-V09-03-02: Added generic drivers: OGL, OGLI, OGLS, OI.
- openinventor-V09-03-00: Protection against repeated initialisation.
- opengl-V09-03-02: Some improvments with auto rotation mode.
20th May 2010 John Allison (vis-V09-03-01)
- Co-working tags: intercoms-V09-03-01, interfaces-V09-03-02
- opengl-V09-03-01:
o GNUMakefile, G4OpenGLQtViewer : Better inclusion of new tabs in UI part
- visman-V09-03-01:
o Restore previous viewer after /vis/drawTree.
11th May 2010 John Allison (vis-V09-03-00)
- visman-09-03-00: Print i_mode warnings.
- modeling-V09-03-00:
o Replace polyhedra with solids for sections and cutaways.
o Trap use of i_mode and print warning.
- opengl-V09-03-00:
o Many improvements to OpenGL Qt.
o Speed improvements for polymarkers (e.g., trajectories).
o Use generic section and cutaway algorithm.
- gMocren-V09-03-01: printing improvement.
- vistest-V09-03-00: Added printEPS to test19.g4m, as suggested by Laurent.
22nd November 2009 Joseph Perl (vis-V09-02-12)
- vis-HepRep-V09-02-03
o Changed messenger to a singleton.
@@ -0,0 +1,20 @@
#------------------------------------------------------------------------------
# CMakeLists.txt
# Module : G4OpenGL
# Package: Geant4.src.G4visualization.G4OpenGL
#
# CMakeLists.txt for single level library that may be build global or granular
#
# Generated on : 24/9/2010
#
# $Id: CMakeLists.txt,v 1.1 2010/09/29 19:12:06 bmorgan Exp $
#
#------------------------------------------------------------------------------
include(Geant4MacroLibraryTargets)
if(GEANT4_BUILD_GRANULAR_LIBS)
GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
else()
GEANT4_GLOBAL_LIBRARY_TARGET(COMPONENTS sources.cmake)
endif()
+3 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.11 2009/11/17 11:32:38 gcosmo Exp $
# $Id: GNUmakefile,v 1.13 2010/05/20 07:09:33 lgarnier Exp $
name := G4OpenGL
@@ -21,6 +21,7 @@ GLOBLIBS += libG4intercoms.lib libG4global.lib
include $(G4INSTALL)/config/architecture.gmk
include $(G4INSTALL)/config/G4VIS_BUILD.gmk
include $(G4INSTALL)/config/G4UI_BUILD.gmk
include $(G4INSTALL)/config/interactivity.gmk
CPPFLAGS += -I$(G4BASE)/visualization/externals/gl2ps/include
@@ -34,6 +35,7 @@ CPPFLAGS += -I$(G4BASE)/graphics_reps/include
CPPFLAGS += -I$(G4BASE)/geometry/management/include
CPPFLAGS += -I$(G4BASE)/intercoms/include
CPPFLAGS += -I$(G4BASE)/interfaces/common/include
CPPFLAGS += -I$(G4BASE)/interfaces/basic/include
CPPFLAGS += -I$(G4BASE)/tracking/include
CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include
+149 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.161 2009/11/17 17:21:11 allison Exp $
$Id: History,v 1.193 2010/11/13 10:28:40 allison Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,154 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
13th November 2010 John Allison (opengl-V09-03-10)
- Tagged.
10th November 2010 John Allison
- G4OpenGLStoredSceneHandler.cc: Added commented out debug lines.
- G4OpenGLStoredSceneHandler.hh: Corrected misleading comment lines.
- G4OpenGLXViewer.cc: Protected output with G4VisManager::GetVerbosity.
8th November 2010 John Allison (opengl-V09-03-09)
- G4OpenGLStoredSceneHandler:
o Removed fDisplayListBase (not needed; display list ids ARE re-used).
o Improved display list limit message.
7th November 2010 John Allison
- G4OpenGLViewerMessenger.cc: Improved messages.
6th November 2010 John Allison
- G4OpenGLViewerMessenger.cc: displayListLimit>=10000.
- G4OpenGLStoredSceneHandler:
o Made all display list management variables static.
o Bug fix: reset fMemoryForDisplayLists flag.
5th November 2010 John Allison
- G4OpenGLStoredSceneHandler, G4OpenGLViewerMessenger:
o Introduced a display list limit to avoid memory exhaustion.
o Introduced /vis/ogl/set/displayListLimit.
8th October 2010 Laurent Garnier
- G4OpenGQtViewer.cc:
o Add menu for changing text color, default color, background color
o Toogle projection now call directly command instead of redefinding it
6th October 2010 John Allison (opengl-V09-03-08 with co-working tags...)
- Co-working tags: interfaces-V09-03-12 + config-V09-03-08
- G4OpenGLStoredViewer.cc:
o Added default colour and default text colour to list of parameters
that trigger a kernel visit.
5th October 2010 John Allison
- G4OpenGLStoredViewer.cc: Time-slices fade to background colour.
5th October 2010 Laurent Garnier
- Change lots of shortcuts in Qt
- Add 'google earth like' rotation
23th June 2010 Laurent Garnier
- G4OpenGLImmediate/StoredQtViewer : Fix compilation warnings
- G4OpenGLQtViewer : Add protection on Vis Tab without UI Qt
4th June 2010 Laurent Garnier (opengl-V09-03-07)
- G4OpenGLImmediate/StoredQtViewer : Add protection against multiple
repaint call. Add protection against resizeGl with bad values
3rd June 2010 John Allison (opengl-V09-03-06)
- G4OpenGLImmediateSceneHandler: Re-instate
// Make sure screen corresponds to graphical database...
if (fpViewer) {
fpViewer -> SetView ();
fpViewer -> ClearView ();
fpViewer -> DrawView ();
}
I was wrong - it *is* necessary. If not there, events are not refreshed.
So this and similar changes below are all back to geant4-09-03, including
glFlush, which is still a big performance penalty on Mac's Snow Leopard.
3rd June 2010 John Allison (opengl-V09-03-05)
- Restored following files to geant4-09-03 in interests of stable behaviour:
o G4OpenGLStoredSceneHandler.cc
Restored code removed in opengl-V09-03-03:
// Make sure screen corresponds to graphical database...
if (fpViewer) {
fpViewer -> SetView ();
fpViewer -> ClearView ();
fpViewer -> DrawView ();
}
o G4OpenGLStoredXViewer.cc:
Restore to geant4-09-03. Restored code removed in opengl-V09-03-03:
} else { // ADD TO AVOID KernelVisit=1 and nothing to display
DrawDisplayLists ();
FinishView ();
- Note: G4OpenGLImmediateSceneHandler: Same code commented out. I think
it's not necessary for immediate mode.
30th May 2010 John Allison (opengl-V09-03-04)
- G4OpenGLSceneHandler: Added AddCompound(const G4VDigi&).
29th May 2010 John Allison (opengl-V09-03-03)
- G4OpenGLImmediateSceneHandler.cc, G4OpenGLStoredSceneHandler.cc:
Removed the following from ClearTransientStrore (was causing
unnecessary drawing and flipping buffers?):
// Make sure screen corresponds to graphical database...
if (fpViewer) {
fpViewer -> SetView ();
fpViewer -> ClearView ();
fpViewer -> DrawView ();
}
- G4OpenGLStoredXViewer.cc:
Commented out as follows in DrawView (was causing extra buffer swap,
thus showing bad picture; can't recall why it was introduced):
} else { // ADD TO AVOID KernelVisit=1 and nothing to display
//DrawDisplayLists (); ????????? (JA)
//FinishView (); ????????? (JA)
26th May 2010 Laurent Garnier (opengl-V09-03-02)
- G4OpenGLQtViewer : Some improvments with auto rotation mode.
20th May 2010 Laurent Garnier (opengl-V09-03-01)
Co-working tag : intercoms-V09-03-01, interfaces-V09-03-02
- GNUMakefile, G4OpenGLQtViewer : Better inclusion of new tabs in UI part
11th May 2010 John Allison (opengl-V09-03-00)
- G4OpenGLSceneHandler:
o Use generic section and cutaway algorithm.
o Follow change in generic section and cutaway interface.
- G4OpenGLViewer.cc:
o Use generic section and cutaway algorithm.
o Fix compiler warning (*p++).
o Replace strdup by local inline code.
29th April 2010 Laurent Garnier
- G4OpenGLSceneHandler : Speed Improvment by drawing vector of
markers instead one by one
27th April 2010 Laurent Garnier
- G4OpenGLStoredXmViewer : remove viewer form list at destruction
- G4OpenGLViewer : Fix a problem when printing in gl2ps
9th March 2010 Laurent Garnier
- G4OpenGLViewer : Fix clipping when resizing non square size windows
Remove error message when no scene present.
- G4OpenGLImmediateQtViewer, G4OpenGLStoredQtViewer :
- Add some protections if viewer is in tab
- fix some redraw probems when focus was outside frame
- Add ShowView() and paintEvent() methods
- DrawView method is now the same in Store and Immediate mode
- G4OpenGLQtViewer : Add things for viewer in tabs
3rd March 2010 Laurent Garnier
- G4OpenGLViewer : Add protection against null pointer scene
27th January 2010 Gabriele Cosmo
- Fixed compilation warnings on G4OpenGLQtViewer and corrected compilation
error when using Qt-3.
6th January 2010 Laurent Garnier (needs interfaces-V09-02-07 + laurent-QtUI_with_tabs_v1)
- GNUMakefile : Add include for interfaces/basic
- G4OpenGLQtWiewer : Integration into QtUI Tab
17th November 2009 John Allison (opengl-V09-02-10)
- Tagged for vis tag.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLImmediateQtViewer.hh,v 1.6 2009/10/14 13:27:30 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenGLImmediateQtViewer.hh,v 1.7 2010/03/10 11:03:46 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
// Class G4OpenGLImmediateQtViewer : a class derived from
@@ -55,13 +55,13 @@ public:
void Initialise ();
void initializeGL ();
void DrawView ();
void FinishView ();
void resizeGL(int width,int height);
void paintGL();
void updateQWidget();
void ShowView ();
protected:
void showEvent(QShowEvent * event );
void wheelEvent(QWheelEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
@@ -69,6 +69,7 @@ protected:
void mouseReleaseEvent(QMouseEvent *event);
void contextMenuEvent(QContextMenuEvent *e);
void keyPressEvent (QKeyEvent * event);
void paintEvent(QPaintEvent *event);
private:
void ComputeView ();
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLQtViewer.hh,v 1.20 2009/10/21 08:14:44 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenGLQtViewer.hh,v 1.25 2010/10/08 10:07:31 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
// G4OpenGLQtViewer : Class to provide WindowsNT specific
@@ -44,6 +44,7 @@
#include <qpoint.h>
class G4OpenGLSceneHandler;
class G4UImanager;
class QGLWidget;
class QDialog;
@@ -114,25 +115,27 @@ protected:
void G4keyPressEvent (QKeyEvent * event);
void rotateQtScene(float, float);
void rotateQtCamera(float, float);
void rotateQtSceneInViewDirection(float, float);
void rotateQtCameraInViewDirection(float, float);
void moveScene(float, float, float,bool);
void FinishView();
#if QT_VERSION < 0x040000
void updateKeyModifierState(Qt::ButtonState);
#else
void updateKeyModifierState(Qt::KeyboardModifiers);
#endif
protected:
QGLWidget* fWindow;
QDialog* fGLWindow;
QWidget* fGLWindow;
bool hasPendingEvents();
void savePPMToTemp();
int fRecordFrameNumber;
float fRotationAngleX;
float fRotationAngleY;
float fRotationAngleZ;
float fDeltaRotationAngleX;
float fDeltaRotationAngleY;
float fDeltaRotationAngleZ;
bool fHasToRepaint;
bool fReadyToPaint;
bool fIsRepainting;
private:
enum mouseActions {STYLE1,STYLE2,STYLE3,STYLE4};
@@ -197,8 +200,17 @@ private:
QProcess *fProcess;
QTime *fLastEventTime;
int fSpinningDelay;
int fNbMaxFramesPerSec;
float fNbMaxAnglePerSec;
int fLaunchSpinDelay;
G4double fXRot;
G4double fYRot;
bool fNoKeyPress;
bool fAltKeyPress;
bool fControlKeyPress;
bool fShiftKeyPress;
signals:
void rotateTheta(int);
void rotatePhi(int);
@@ -218,6 +230,9 @@ private slots :
void actionDrawingSurfaceRemoval();
void actionDrawingLineSurfaceRemoval();
void actionSaveImage();
void actionChangeBackgroundColor();
void actionChangeTextColor();
void actionChangeDefaultColor();
void actionMovieParameters();
void showShortcuts();
@@ -225,7 +240,6 @@ private slots :
void toggleMouseAction(mouseActions);
void toggleRepresentation(bool);
void toggleProjection(bool);
void toggleBackground(bool);
void toggleTransparency(bool);
void toggleAntialiasing(bool);
void toggleHaloing(bool);
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLSceneHandler.hh,v 1.27 2009/10/21 15:18:14 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenGLSceneHandler.hh,v 1.30 2010/05/30 09:53:05 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
// Andrew Walkden 27th March 1996
@@ -63,6 +63,7 @@ public:
void AddPrimitive (const G4Text&);
void AddPrimitive (const G4Circle&);
void AddPrimitive (const G4Square&);
void AddPrimitives (std::vector <G4VMarker>);
void AddPrimitive (const G4Scale&);
void AddPrimitive (const G4Polyhedron&);
void AddPrimitive (const G4NURBS&);
@@ -82,6 +83,7 @@ public:
void AddSolid (const G4VSolid&);
void AddCompound (const G4VTrajectory&);
void AddCompound (const G4VHit&);
void AddCompound (const G4VDigi&);
void AddCompound (const G4THitsMap<G4double>&);
protected:
@@ -91,8 +93,8 @@ protected:
const G4String& name = "");
virtual ~G4OpenGLSceneHandler ();
const G4Polyhedron* CreateSectionPolyhedron ();
const G4Polyhedron* CreateCutawayPolyhedron ();
G4VSolid* CreateSectionSolid ();
G4VSolid* CreateCutawaySolid ();
void ClearAndDestroyAtts(); // Destroys att holders and clears pick map.
@@ -104,6 +106,7 @@ protected:
private:
void AddCircleSquare (const G4VMarker&, G4OpenGLBitMapStore::Shape);
void AddCircleSquareVector (std::vector <G4VMarker>, G4OpenGLBitMapStore::Shape);
void DrawXYPolygon
(G4OpenGLBitMapStore::Shape,
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLStoredQtViewer.hh,v 1.9 2009/10/14 13:27:30 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenGLStoredQtViewer.hh,v 1.10 2010/03/10 11:03:46 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
// Class G4OpenGLStoredQtViewer : a class derived from
@@ -63,6 +63,7 @@ public:
void ShowView ();
protected:
void showEvent(QShowEvent * event );
void wheelEvent(QWheelEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
@@ -70,6 +71,7 @@ protected:
void mouseReleaseEvent(QMouseEvent *event);
void contextMenuEvent(QContextMenuEvent *e);
void keyPressEvent (QKeyEvent * event);
void paintEvent(QPaintEvent *event);
private:
void ComputeView ();
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLStoredSceneHandler.hh,v 1.28 2009/02/04 16:48:40 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenGLStoredSceneHandler.hh,v 1.32 2010/11/10 17:10:49 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
// Andrew Walkden 10th February 1997
@@ -68,19 +68,25 @@ public:
void ClearStore ();
void ClearTransientStore ();
static G4int GetDisplayListLimit() {return fDisplayListLimit;}
static void SetDisplayListLimit(G4int lim) {fDisplayListLimit = lim;}
protected:
void RequestPrimitives (const G4VSolid& solid);
void AddPrimitivePreamble(const G4Visible& visible);
void AddPrimitivePostamble();
static G4int fSceneIdCount; // static counter for OpenGLStored scenes.
G4int fDisplayListId; // Workspace.
G4bool fMemoryForDisplayLists; // avoid memory overflow
static G4int fSceneIdCount; // static counter for OpenGLStored scenes.
// Display list management. All static since there's only one OGL store.
static G4int fDisplayListId; // Workspace.
static G4bool fMemoryForDisplayLists; // avoid memory overflow
static G4int fDisplayListLimit; // avoid memory overflow
G4int fAddPrimitivePreambleNestingDepth;
// PODL = Persistent Object Display List.
GLint fTopPODL; // List which calls the other PODLs.
// PO = Persistent Object, i.e., run-durantion object, e.g., geometry.
struct PO {
PO(G4int id, const G4Transform3D& tr = G4Transform3D());
G4int fDisplayListId;
@@ -89,7 +95,7 @@ protected:
};
std::vector<PO> fPOList;
// TO = Transparent Object.
// TO = Transient Object, e.g., trajectories.
struct TO {
TO(G4int id, const G4Transform3D& tr = G4Transform3D());
G4int fDisplayListId;
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLViewer.hh,v 1.32 2009/05/14 16:38:23 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenGLViewer.hh,v 1.33 2010/10/05 15:45:19 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
// Andrew Walkden 27th March 1996
@@ -69,6 +69,7 @@ protected:
void Pick(GLdouble x, GLdouble y);
virtual void CreateFontLists () {}
void rotateScene (G4double dx, G4double dy,G4double delta);
void rotateSceneInViewDirection (G4double dx, G4double dy,G4double delta);
//////////////////////////////Vectored PostScript production functions///
void printEPS();
// print EPS file. Depending of fVectoredPs, it will print Vectored or not
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLViewerMessenger.hh,v 1.7 2009/05/18 09:07:12 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenGLViewerMessenger.hh,v 1.8 2010/11/05 06:25:23 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
#ifndef G4OPENGLVIEWERMESSENGER_HH
#define G4OPENGLVIEWERMESSENGER_HH
@@ -40,6 +40,7 @@ class G4UIcmdWithoutParameter;
class G4UIcmdWithADouble;
class G4UIcmdWithABool;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
class G4OpenGLViewerMessenger: public G4UImessenger {
public:
@@ -56,6 +57,7 @@ private:
G4UIcommand* fpCommandPrintFilename;
G4UIdirectory* fpDirectorySet;
G4UIcommand* fpCommandDisplayHeadTime;
G4UIcmdWithAnInteger* fpCommandDisplayListLimit;
G4UIcommand* fpCommandDisplayLightFront;
G4UIcommand* fpCommandEndTime;
G4UIcmdWithADouble* fpCommandFade;
+182
View File
@@ -0,0 +1,182 @@
#------------------------------------------------------------------------------
# sources.cmake
# Module : G4OpenGL
# Package: Geant4.src.G4visualization.G4OpenGL
#
# Sources description for a library.
# Lists the sources and headers of the code explicitely.
# Lists include paths needed.
# Lists the internal granular and global dependencies of the library.
# Source specific properties should be added at the end.
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake,v 1.5 2010/12/01 16:57:53 bmorgan Exp $
# GEANT4 Tag $Name: geant4-09-04 $
#
#------------------------------------------------------------------------------
# List external includes needed.
include_directories(${CLHEP_INCLUDE_DIRS})
# List internal includes needed.
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/hits/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/solids/CSG/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/solids/specific/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPGeometry/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/graphics_reps/include)
include_directories(${CMAKE_SOURCE_DIR}/source/intercoms/include)
include_directories(${CMAKE_SOURCE_DIR}/source/interfaces/basic/include)
include_directories(${CMAKE_SOURCE_DIR}/source/interfaces/common/include)
include_directories(${CMAKE_SOURCE_DIR}/source/tracking/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/externals/gl2ps/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/modeling/include)
#
# Module has optional sources
#
include(Geant4MacroDefineModule)
#
# Define the core sources, includes and libraries which all Geant4
# OpenGL implementations use
#
set(G4VIS_MODULE_OPENGL_HEADERS
G4OpenGL.hh
G4OpenGLImmediateViewer.hh
G4OpenGLImmediateSceneHandler.hh
G4OpenGLViewer.hh
G4OpenGLStoredViewer.hh
G4OpenGLStoredSceneHandler.hh
G4OpenGLBitMapStore.hh
G4OpenGLFontBaseStore.hh
G4OpenGLSceneHandler.hh
G4OpenGLSceneHandler.icc
G4OpenGLViewerMessenger.hh
G4OpenGLTransform3D.hh
)
set(G4VIS_MODULE_OPENGL_SOURCES
G4OpenGLImmediateViewer.cc
G4OpenGLImmediateSceneHandler.cc
G4OpenGLViewer.cc
G4OpenGLStoredViewer.cc
G4OpenGLStoredSceneHandler.cc
G4OpenGLBitMapStore.cc
G4OpenGLFontBaseStore.cc
G4OpenGLSceneHandler.cc
G4OpenGLViewerMessenger.cc
G4OpenGLTransform3D.cc
)
#
# May need OpenGL include here
#
include_directories(${OPENGL_INCLUDE_DIR})
set(G4VIS_MODULE_OPENGL_LINK_LIBRARIES ${OPENGL_LIBRARIES})
#
# All of the above files must have the G4VIS_BUILD_OPENGL_DRIVER definition
#
GEANT4_ADD_COMPILE_DEFINITIONS(SOURCES ${G4VIS_MODULE_OPENGL_SOURCES}
COMPILE_DEFINITIONS G4VIS_BUILD_OPENGL_DRIVER)
#
# Qt only if selected
#
if(GEANT4_USE_QT)
#
# Add in the extra Qt GL sources
#
list(APPEND G4VIS_MODULE_OPENGL_HEADERS
G4OpenGLImmediateQt.hh
G4OpenGLImmediateQtViewer.hh
G4OpenGLQtExportDialog.hh
G4OpenGLQtMovieDialog.hh
G4OpenGLQtViewer.hh
G4OpenGLStoredQt.hh
G4OpenGLStoredQtViewer.hh)
list(APPEND G4VIS_MODULE_OPENGL_SOURCES
G4OpenGLImmediateQt.cc
G4OpenGLImmediateQtViewer.cc
G4OpenGLQtExportDialog.cc
G4OpenGLQtMovieDialog.cc
G4OpenGLQtViewer.cc
G4OpenGLStoredQt.cc
G4OpenGLStoredQtViewer.cc)
# Include the UseQt file to build the moc wrappers
include(${QT_USE_FILE})
# Add the moc sources - must use absolute path to the files
QT4_WRAP_CPP(G4OPENGL_MOC_SOURCES
${CMAKE_SOURCE_DIR}/source/visualization/OpenGL/include/G4OpenGLQtExportDialog.hh
${CMAKE_SOURCE_DIR}/source/visualization/OpenGL/include/G4OpenGLQtMovieDialog.hh
${CMAKE_SOURCE_DIR}/source/visualization/OpenGL/include/G4OpenGLQtViewer.hh
OPTIONS -DG4VIS_BUILD_OPENGLQT_DRIVER)
list(APPEND G4VIS_MODULE_OPENGL_SOURCES ${G4OPENGL_MOC_SOURCES})
# Add the definitions
# Argh.. Have to remember about INTY and UI because of their use...
GEANT4_ADD_COMPILE_DEFINITIONS(SOURCES ${G4VIS_MODULE_OPENGL_SOURCES}
COMPILE_DEFINITIONS
G4VIS_BUILD_OPENGL_DRIVER;G4VIS_BUILD_OPENGLQT_DRIVER;G4INTY_BUILD_QT;G4UI_BUILD_QT_SESSION)
# And for the moc files because these are in the build tree
set_source_files_properties(${G4OPENGL_MOC_SOURCES}
PROPERTIES
COMPILE_DEFINITIONS
"G4VIS_BUILD_OPENGL_DRIVER;G4VIS_BUILD_OPENGLQT_DRIVER"
)
# Add in Qt libraries
list(APPEND G4VIS_MODULE_OPENGL_LINK_LIBRARIES ${QT_LIBRARIES})
endif()
#
# Define the Geant4 Module.
#
GEANT4_DEFINE_MODULE(NAME G4OpenGL
HEADERS
${G4VIS_MODULE_OPENGL_HEADERS}
SOURCES
${G4VIS_MODULE_OPENGL_SOURCES}
GRANULAR_DEPENDENCIES
G4UIbasic
G4UIcommon
G4csg
G4geometrymng
G4gl2ps
G4globman
G4graphics_reps
G4hits
G4intercoms
G4modeling
G4specsolids
G4tracking
G4vis_management
GLOBAL_DEPENDENCIES
G4digits_hits
G4geometry
G4gl2ps
G4global
G4graphics_reps
G4intercoms
G4interfaces
G4modeling
G4tracking
G4vis_management
LINK_LIBRARIES
${G4VIS_MODULE_OPENGL_LINK_LIBRARIES}
)
# List any source specific properties here
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLImmediateQtViewer.cc,v 1.17 2009/11/03 11:02:32 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenGLImmediateQtViewer.cc,v 1.22 2010/06/23 13:29:23 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
// Class G4OpenGLImmediateQtViewer : a class derived from G4OpenGLQtViewer and
@@ -52,7 +52,8 @@ G4OpenGLImmediateQtViewer::G4OpenGLImmediateQtViewer
#else
setFocusPolicy(Qt::StrongFocus); // enable keybord events
#endif
fHasToRepaint =false;
fHasToRepaint = false;
fIsRepainting = false;
if (fViewId < 0) return; // In case error in base class instantiation.
}
@@ -96,19 +97,8 @@ void G4OpenGLImmediateQtViewer::initializeGL () {
}
/** To ensure compatibility with DrawView method
*/
void G4OpenGLImmediateQtViewer::DrawView() {
#ifdef G4DEBUG_VIS_OGL
printf("G4OpenGLImmediateQtViewer::DrawView VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n");
#endif
// That's no the same logic as Stored Viewer, I don't know why...
// see G4OpenGLStoredQtViewer::DrawView for more informations
updateQWidget();
#ifdef G4DEBUG_VIS_OGL
printf("G4OpenGLImmediateQtViewer::DrawView ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
#endif
}
@@ -130,7 +120,7 @@ void G4OpenGLImmediateQtViewer::ComputeView () {
HaloingFirstPass ();
NeedKernelVisit ();
ProcessView ();
glFlush ();
FinishView();
#ifdef G4DEBUG_VIS_OGL
printf("G4OpenGLImmediateQtViewer::ComputeView First ProcessView ok\n");
#endif
@@ -151,19 +141,6 @@ void G4OpenGLImmediateQtViewer::ComputeView () {
fHasToRepaint = true;
}
void G4OpenGLImmediateQtViewer::FinishView()
{
#ifdef G4DEBUG_VIS_OGL
printf("G4OpenGLImmediateQtViewer::FinishView() BEGIN\n");
#endif
glFlush ();
#ifdef G4DEBUG_VIS_OGL
printf("G4OpenGLImmediateQtViewer::FinishView() END\n");
#endif
}
/**
- Lors du resize de la fenetre, on doit non pas redessiner le detecteur, mais aussi les evenements
*/
@@ -171,24 +148,32 @@ void G4OpenGLImmediateQtViewer::resizeGL(
int aWidth
,int aHeight)
{
ResizeWindow(aWidth,aHeight);
fHasToRepaint = sizeHasChanged();
if ((aWidth > 0) && (aHeight > 0)) {
ResizeWindow(aWidth,aHeight);
fHasToRepaint = sizeHasChanged();
}
}
void G4OpenGLImmediateQtViewer::paintGL()
{
#ifdef G4DEBUG_VIS_OGL
printf("\n\nG4OpenGLImmediateQtViewer::paintGL ??\n");
#endif
if (fIsRepainting) {
// return ;
}
if (!fReadyToPaint) {
fReadyToPaint= true;
return;
}
if ((getWinWidth() == 0) && (getWinHeight() == 0)) {
return;
}
// DO NOT RESIZE IF SIZE HAS NOT CHANGE
if ( !fHasToRepaint) {
#if QT_VERSION < 0x040000
if (((getWinWidth() == (unsigned int)width())) &&(getWinHeight() == (unsigned int) height())) {
return;
}
#else
// L. Garnier : Trap to get the size with mac OSX 10.6 and Qt 4.6(devel)
// Tested on Qt4.5 on mac, 4.4 on windows, 4.5 on unbuntu
@@ -202,9 +187,14 @@ void G4OpenGLImmediateQtViewer::paintGL()
sh = frameGeometry().height();
}
if ((getWinWidth() == (unsigned int)sw) &&(getWinHeight() == (unsigned int)sh)) {
#endif
return;
} else if ((sw == 0) && (sh == 0)) { // NOT A TOP LEVEL WIDGET
if (((getWinWidth() == (unsigned int)width())) &&(getWinHeight() == (unsigned int) height())) {
return;
}
}
#endif
}
#ifdef G4DEBUG_VIS_OGL
printf("G4OpenGLImmediateQtViewer::paintGL VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV ready %d\n",fReadyToPaint);
@@ -220,6 +210,7 @@ void G4OpenGLImmediateQtViewer::paintGL()
#ifdef G4DEBUG_VIS_OGL
printf("G4OpenGLImmediateQtViewer::paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ready %d\n\n\n",fReadyToPaint);
#endif
fIsRepainting = false;
}
void G4OpenGLImmediateQtViewer::mousePressEvent(QMouseEvent *event)
@@ -237,6 +228,12 @@ void G4OpenGLImmediateQtViewer::wheelEvent (QWheelEvent * event)
G4wheelEvent(event);
}
void G4OpenGLImmediateQtViewer::showEvent (QShowEvent *)
{
fHasToRepaint = true;
}
/**
* This function was build in order to make a zoom on double clic event.
* It was think to build a rubberband on the zoom area, but never work fine
@@ -262,9 +259,17 @@ void G4OpenGLImmediateQtViewer::contextMenuEvent(QContextMenuEvent *e)
G4manageContextMenuEvent(e);
}
void G4OpenGLImmediateQtViewer::paintEvent(QPaintEvent *) {
if ( fHasToRepaint) {
updateGL();
}
}
void G4OpenGLImmediateQtViewer::updateQWidget() {
fHasToRepaint= true;
updateGL();
repaint();
fHasToRepaint= false;
}
@@ -274,6 +279,7 @@ void G4OpenGLImmediateQtViewer::ShowView (
//////////////////////////////////////////////////////////////////////////////
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
{
fHasToRepaint = true;
#if QT_VERSION < 0x040000
setActiveWindow();
#else
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLImmediateSceneHandler.cc,v 1.31 2009/02/04 16:48:41 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenGLImmediateSceneHandler.cc,v 1.35 2010/06/03 20:35:19 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
// Andrew Walkden 10th February 1997
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLQtViewer.cc,v 1.45 2009/10/21 08:14:44 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenGLQtViewer.cc,v 1.55 2010/10/08 10:07:31 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
// G4OpenGLQtViewer : Class to provide Qt specific
@@ -51,6 +51,7 @@
#include "G4OpenGLQtMovieDialog.hh"
#include "G4UnitsTable.hh"
#include "G4Qt.hh"
#include "G4UIQt.hh"
#include "G4UImanager.hh"
#include "G4UIcommandTree.hh"
#include <qlayout.h>
@@ -77,6 +78,7 @@
#include <qpainter.h>
#include <qgl.h> // include <qglwidget.h>
#include <qdialog.h>
#include <qcolordialog.h>
#include <qevent.h> //include <qcontextmenuevent.h>
@@ -109,42 +111,87 @@ void G4OpenGLQtViewer::CreateMainWindow (
fWindow = glWidget ;
// fWindow->makeCurrent();
QWidget *myParent = getParentWidget();
if (myParent != NULL) {
#if QT_VERSION < 0x040000
glWidget->reparent(myParent,0,QPoint(0,0));
#else
glWidget->setParent(myParent);
#endif
}
//G4Qt* interactorManager = G4Qt::getInstance ();
QHBoxLayout *mainLayout = new QHBoxLayout(fGLWindow);
mainLayout->setMargin(0);
mainLayout->setSpacing(0);
mainLayout->addWidget(fWindow);
#if QT_VERSION < 0x040000
fGLWindow->setCaption(name );
#else
fGLWindow->setLayout(mainLayout);
fGLWindow->setWindowTitle( name);
#endif
ResizeWindow(fVP.GetWindowSizeHintX(),fVP.GetWindowSizeHintY());
// FIXME L.Garnier 9/11/09 Has to be check !!!
// Qt UI with Qt Vis
// Qt UI with X Vis
// X UI with Qt Vis
// X UI with X Vis
// Ne marche pas avec un UIBatch !! (ecran blanc)
//useful for MACOSX, we have to compt the menuBar height
int offset = QApplication::desktop()->height()
- QApplication::desktop()->availableGeometry().height();
// return false if G4UIQt was not launch
G4int YPos= fVP.GetWindowAbsoluteLocationHintY(QApplication::desktop()->height());
if (fVP.GetWindowAbsoluteLocationHintY(QApplication::desktop()->height())< offset) {
YPos = offset;
}
fGLWindow->resize(getWinWidth(), getWinHeight());
fGLWindow->move(fVP.GetWindowAbsoluteLocationHintX(QApplication::desktop()->width()),YPos);
fGLWindow->show();
G4UImanager* UI = G4UImanager::GetUIpointer();
if (UI == NULL) return;
if (! static_cast<G4UIQt*> (UI->GetG4UIWindow())) return;
G4UIQt * uiQt = static_cast<G4UIQt*> (UI->GetG4UIWindow());
if(!fWindow) return;
bool isTabbedView = false;
if ( uiQt) {
isTabbedView = uiQt->AddTabWidget(fWindow,name,getWinWidth(),getWinHeight());
}
#ifdef G4DEBUG_VIS_OGL
else {
printf("G4OpenGLQtViewer::CreateMainWindow :: UIQt NOt found \n");
}
#endif
if (!isTabbedView) { // we have to do a dialog
QWidget *myParent = getParentWidget();
#ifdef G4DEBUG_VIS_OGL
printf("G4OpenGLQtViewer::CreateMainWindow :: getParent OK \n");
#endif
if (myParent != NULL) {
#if QT_VERSION < 0x040000
glWidget->reparent(myParent,0,QPoint(0,0));
#else
glWidget->setParent(myParent);
#endif
}
QHBoxLayout *mainLayout = new QHBoxLayout(fGLWindow);
mainLayout->setMargin(0);
mainLayout->setSpacing(0);
mainLayout->addWidget(fWindow);
if (fGLWindow->inherits("QMainWindow")) {
#if QT_VERSION < 0x040000
fGLWindow->setCaption(name );
#else
fGLWindow->setWindowTitle( name);
#endif
}
#if QT_VERSION >= 0x040000
fGLWindow->setLayout(mainLayout);
#endif
//useful for MACOSX, we have to compt the menuBar height
int offset = QApplication::desktop()->height()
- QApplication::desktop()->availableGeometry().height();
G4int YPos= fVP.GetWindowAbsoluteLocationHintY(QApplication::desktop()->height());
if (fVP.GetWindowAbsoluteLocationHintY(QApplication::desktop()->height())< offset) {
YPos = offset;
}
fGLWindow->resize(getWinWidth(), getWinHeight());
#ifdef G4DEBUG_VIS_OGL
printf("G4OpenGLQtViewer::CreateMainWindow :: resizing to %d %d \n",getWinWidth(), getWinHeight());
#endif
fGLWindow->move(fVP.GetWindowAbsoluteLocationHintX(QApplication::desktop()->width()),YPos);
fGLWindow->show();
} else {
fGLWindow = fWindow;
fGLWindow->resize(getWinWidth(), getWinHeight());
}
if(!fWindow) return;
if (!fContextMenu)
createPopupMenu();
@@ -166,10 +213,6 @@ G4OpenGLQtViewer::G4OpenGLQtViewer (
,G4OpenGLViewer (scene)
,fWindow(0)
,fRecordFrameNumber(0)
,fRotationAngleX(0)
,fRotationAngleY(0)
,fDeltaRotationAngleX(0)
,fDeltaRotationAngleY(0)
,fContextMenu(0)
,fMouseAction(STYLE1)
,fDeltaRotation(1)
@@ -189,7 +232,15 @@ G4OpenGLQtViewer::G4OpenGLQtViewer (
,fMovieParametersDialog(NULL)
,fRecordingStep(WAIT)
,fProcess(NULL)
,fNbMaxFramesPerSec(100)
,fNbMaxAnglePerSec(360)
,fLaunchSpinDelay(100)
,fXRot(0)
,fYRot(0)
,fNoKeyPress(true)
,fAltKeyPress(false)
,fControlKeyPress(false)
,fShiftKeyPress(false)
{
// launch Qt if not
@@ -494,37 +545,86 @@ void G4OpenGLQtViewer::createPopupMenu() {
SLOT(actionDrawingLineSurfaceRemoval()));
#endif
// Background Color
QAction *backgroundColorChooser ;
#if QT_VERSION < 0x040000
QPopupMenu *mBackground = new QPopupMenu(mStyle);
mStyle->insertItem("&Background color",mBackground);
QPopupMenu *mBackgroundColor = new QPopupMenu(mStyle);
mStyle->insertItem("&Background color",mBackgroundColor);
#if QT_VERSION < 0x030200
QAction *white = new QAction("&White","&White",CTRL+Key_W,mBackground,0,true);
QAction *black = new QAction("&Black","&Black",CTRL+Key_B,mBackground,0,true);
backgroundColorChooser = new QAction("&Choose ...","&Choose ...",CTRL+Key_C,mBackgroundColor,0,true);
#else
QAction *white = new QAction("&White",CTRL+Key_W,mBackground);
QAction *black = new QAction("&Black",CTRL+Key_B,mBackground);
white->setToggleAction(true);
black->setToggleAction(true);
backgroundColorChooser = new QAction("&Choose ...","&Choose ...",CTRL+Key_C,mBackgroundColor);
#endif
white->addTo(mBackground);
black->addTo(mBackground);
backgroundColorChooser->addTo(mBackgroundColor);
QObject ::connect(backgroundColorChooser,
SIGNAL(activated()),
this,
SLOT(actionChangeBackgroundColor()));
#else
QMenu *mBackground = mStyle->addMenu("&Background color");
QAction *white = mBackground->addAction("White");
QAction *black = mBackground->addAction("Black");
// === Action Menu ===
backgroundColorChooser = mStyle->addAction("Background color");
QObject ::connect(backgroundColorChooser,
SIGNAL(triggered()),
this,
SLOT(actionChangeBackgroundColor()));
#endif
// Text Color
QAction *textColorChooser ;
#if QT_VERSION < 0x040000
QPopupMenu *mTextColor = new QPopupMenu(mStyle);
mStyle->insertItem("&Text color",mTextColor);
#if QT_VERSION < 0x030200
textColorChooser = new QAction("&Choose ...","&Choose ...",CTRL+Key_C,mTextColor,0,true);
#else
textColorChooser = new QAction("&Choose ...","&Choose ...",CTRL+Key_C,mTextColor);
#endif
textColorChooser->addTo(mTextColor);
QObject ::connect(textColorChooser,
SIGNAL(activated()),
this,
SLOT(actionChangeTextColor()));
#else
// === Action Menu ===
textColorChooser = mStyle->addAction("Text color");
QObject ::connect(textColorChooser,
SIGNAL(triggered()),
this,
SLOT(actionChangeTextColor()));
#endif
// Default Color
QAction *defaultColorChooser ;
#if QT_VERSION < 0x040000
QPopupMenu *mDefaultColor = new QPopupMenu(mStyle);
mStyle->insertItem("&Default color",mDefaultColor);
#if QT_VERSION < 0x030200
defaultColorChooser = new QAction("&Choose ...","&Choose ...",CTRL+Key_C,mDefaultColor,0,true);
#else
defaultColorChooser = new QAction("&Choose ...","&Choose ...",CTRL+Key_C,mDefaultColor);
#endif
defaultColorChooser->addTo(mDefaultColor);
QObject ::connect(defaultColorChooser,
SIGNAL(activated()),
this,
SLOT(actionChangeDefaultColor()));
#else
// === Action Menu ===
defaultColorChooser = mStyle->addAction("Default color");
QObject ::connect(defaultColorChooser,
SIGNAL(triggered()),
this,
SLOT(actionChangeDefaultColor()));
#endif
if (background.GetRed() == 1. &&
background.GetGreen() == 1. &&
background.GetBlue() == 1.) {
createRadioAction(white,black,SLOT(toggleBackground(bool)),1);
} else {
createRadioAction(white,black,SLOT(toggleBackground(bool)),2);
}
#if QT_VERSION < 0x040000
@@ -896,45 +996,43 @@ void G4OpenGLQtViewer::toggleMouseAction(mouseActions aAction) {
Show shortcuts for this mouse action
*/
void G4OpenGLQtViewer::showShortcuts() {
G4cout << "========= Mouse Shortcuts =========" << G4endl;
if (fMouseAction == STYLE1) { // rotate
G4cout << "Click and move mouse to rotate volume " << G4endl;
G4cout << "Press left/right arrows to move volume left/right" << G4endl;
G4cout << "Press up/down arrows to move volume up/down" << G4endl;
G4cout << "Press ALT+up/down arrows to move volume toward/forward" << G4endl;
G4cout << "Press SHIFT+left/right arrows to rotate volume left/right" << G4endl;
G4cout << "Press SHIFT+up/down arrows to rotate volume up/down" << G4endl;
G4cout << "Press ALT+/- to slow/speed auto rotation/move" << G4endl;
G4cout << "In video mode : " << G4endl;
G4cout << " Press SPACE to Start/Pause video recording " << G4endl;
G4cout << " Press RETURN to Stop video recording " << G4endl;
G4cout << "ALT + Click and move mouse to rotate volume (View Direction)" << G4endl;
G4cout << "CTRL + Click and zoom mouse to zoom in/out" << G4endl;
G4cout << "SHIFT + Click and zoommove camera point of view" << G4endl;
} else if (fMouseAction == STYLE2) { //move
G4cout << "Move camera point of view with mouse" << G4endl;
G4cout << "Press left/right arrows to move volume left/right" << G4endl;
G4cout << "Press up/down arrows to move volume up/down" << G4endl;
G4cout << "Press ALT+up/down arrows to move volume toward/forward" << G4endl;
G4cout << "Press SHIFT+left/right arrows to rotate volume left/right" << G4endl;
G4cout << "Press SHIFT+up/down arrows to rotate volume up/down" << G4endl;
G4cout << "Press +/- to zoom into volume" << G4endl;
G4cout << "Press ALT+/- to slow/speed auto rotation/move" << G4endl;
G4cout << "In video mode : " << G4endl;
G4cout << " Press SPACE to Start/Pause video recording " << G4endl;
G4cout << " Press RETURN to Stop video recording " << G4endl;
} else if (fMouseAction == STYLE3) { //pick
G4cout << "Click and pick " << G4endl;
} else {
G4cout << "Move camera point of view with mouse" << G4endl;
G4cout << "Press left/right arrows to move volume left/right" << G4endl;
G4cout << "Press up/down arrows to move volume up/down" << G4endl;
G4cout << "Press ALT+up/down arrows to move volume toward/forward" << G4endl;
G4cout << "Press SHIFT+left/right arrows to rotate volume left/right" << G4endl;
G4cout << "Press SHIFT+up/down arrows to rotate volume up/down" << G4endl;
G4cout << "Press +/- to zoom into volume" << G4endl;
G4cout << "Press ALT+/- to slow/speed auto rotation/move" << G4endl;
G4cout << "In video mode : " << G4endl;
G4cout << " Press SPACE to Start/Pause video recording " << G4endl;
G4cout << " Press RETURN to Stop video recording " << G4endl;
}
G4cout << "========= Move Shortcuts =========" << G4endl;
G4cout << "Press left/right arrows to move volume left/right" << G4endl;
G4cout << "Press up/down arrows to move volume up/down" << G4endl;
G4cout << "Press '+'/'-' to move volume toward/forward" << G4endl;
G4cout << G4endl;
G4cout << "========= Rotation (Theta/Phi) Shortcuts =========" << G4endl;
G4cout << "Press SHIFT + left/right arrows to rotate volume left/right" << G4endl;
G4cout << "Press SHIFT + up/down arrows to rotate volume up/down" << G4endl;
G4cout << G4endl;
G4cout << "========= Rotation (View Direction) Shortcuts =========" << G4endl;
G4cout << "Press ALT + left/right to rotate volume around vertical direction" << G4endl;
G4cout << "Press ALT + up/down to rotate volume around horizontal direction" << G4endl;
G4cout << G4endl;
G4cout << "========= Zoom View =========" << G4endl;
G4cout << "Press CTRL + '+'/'-' to zoom into volume" << G4endl;
G4cout << G4endl;
G4cout << "========= Misc =========" << G4endl;
G4cout << "Press ALT +/- to slow/speed rotation/move" << G4endl;
G4cout << "Press H to reset view" << G4endl;
G4cout << "Press Esc to exit FullScreen" << G4endl;
G4cout << G4endl;
G4cout << "========= Video =========" << G4endl;
G4cout << "In video mode : " << G4endl;
G4cout << " Press SPACE to Start/Pause video recording " << G4endl;
G4cout << " Press RETURN to Stop video recording " << G4endl;
G4cout << G4endl;
}
@@ -1045,77 +1143,14 @@ void G4OpenGLQtViewer::toggleRepresentation(bool check) {
void G4OpenGLQtViewer::toggleProjection(bool check) {
if (check == 1) {
fVP.SetFieldHalfAngle (0);
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/set/projection o");
} else {
// look for the default parameter hidden in G4UIcommand parameters
G4UImanager* UI = G4UImanager::GetUIpointer();
if(UI==NULL)
return;
G4UIcommandTree * treeTop = UI->GetTree();
// find command
G4UIcommand* command = treeTop->FindPath("/vis/viewer/set/projection");
if (!command)
return;
// find param
G4UIparameter * angleParam = NULL;
for(G4int i=0; i<command->GetParameterEntries(); i++)
{
if( command->GetParameter(i)->GetParameterName() == "field-half-angle" ) {
angleParam = command->GetParameter(i);
}
}
if (!angleParam)
return;
// find unit
G4UIparameter * unitParam = NULL;
for(G4int i=0; i<command->GetParameterEntries(); i++)
{
if( command->GetParameter(i)->GetParameterName() == "unit" ) {
unitParam = command->GetParameter(i);
}
}
if (!unitParam)
return;
G4double defaultValue = command->ConvertToDouble(angleParam->GetDefaultValue())
* G4UnitDefinition::GetValueOf(unitParam->GetDefaultValue());
if (defaultValue > 89.5 || defaultValue <= 0.0) {
G4cerr << "Field half angle should be 0 < angle <= 89.5 degrees. Check your default Field half angle parameter";
} else {
G4cout << "Perspective view has been set to default value. Field half angle="<<angleParam->GetDefaultValue() <<" " << G4endl;
fVP.SetFieldHalfAngle (defaultValue);
SetView ();
}
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/set/projection p");
}
updateQWidget();
}
/**
SLOT Activate by a click on the background menu
@param check : 1 white, 0 black
*/
void G4OpenGLQtViewer::toggleBackground(bool check) {
// //I need to revisit the kernel if the background colour changes and
// //hidden line removal is enabled, because hlr drawing utilises the
// //background colour in its drawing...
// // (Note added by JA 13/9/2005) Background now handled in view
// // parameters. A kernel visit is triggered on change of background.
if (check == 1) {
((G4ViewParameters&)this->GetViewParameters()).
SetBackgroundColour(G4Colour(1.,1.,1.)); // White
} else {
((G4ViewParameters&)this->GetViewParameters()).
SetBackgroundColour(G4Colour(0.,0.,0.)); // Black
}
updateQWidget();
}
/**
SLOT Activate by a click on the transparency menu
@param check : 1 , 0
@@ -1174,13 +1209,12 @@ void G4OpenGLQtViewer::toggleHaloing(bool check) {
*/
void G4OpenGLQtViewer::toggleAux(bool check) {
if (check) {
fVP.SetAuxEdgeVisible(false);
} else {
fVP.SetAuxEdgeVisible(true);
} else {
fVP.SetAuxEdgeVisible(false);
}
SetNeedKernelVisit (true);
updateQWidget();
}
/**
@@ -1345,6 +1379,59 @@ void G4OpenGLQtViewer::actionSaveImage() {
}
void G4OpenGLQtViewer::actionChangeBackgroundColor() {
// //I need to revisit the kernel if the background colour changes and
// //hidden line removal is enabled, because hlr drawing utilises the
// //background colour in its drawing...
// // (Note added by JA 13/9/2005) Background now handled in view
// // parameters. A kernel visit is triggered on change of background.
QColor color;
color = QColorDialog::getColor(Qt::black, fGLWindow);
if (color.isValid()) {
QString com = "/vis/viewer/set/background ";
QString num;
com += num.setNum(((float)color.red())/256)+" ";
com += num.setNum(((float)color.green())/256)+" ";
com += num.setNum(((float)color.blue())/256)+" ";
G4UImanager::GetUIpointer()->ApplyCommand(com.toStdString().c_str());
updateQWidget();
}
}
void G4OpenGLQtViewer::actionChangeTextColor() {
QColor color;
color = QColorDialog::getColor(Qt::yellow, fGLWindow);
if (color.isValid()) {
QString com = "/vis/viewer/set/defaultTextColour ";
QString num;
com += num.setNum(((float)color.red())/256)+" ";
com += num.setNum(((float)color.green())/256)+" ";
com += num.setNum(((float)color.blue())/256)+" ";
G4UImanager::GetUIpointer()->ApplyCommand(com.toStdString().c_str());
updateQWidget();
}
}
void G4OpenGLQtViewer::actionChangeDefaultColor() {
QColor color;
color = QColorDialog::getColor(Qt::white, fGLWindow);
printf("actionChangeDefaultColor\n");
if (color.isValid()) {
QString com = "/vis/viewer/set/defaultColour ";
QString num;
com += num.setNum(((float)color.red())/256)+" ";
com += num.setNum(((float)color.green())/256)+" ";
com += num.setNum(((float)color.blue())/256)+" ";
G4UImanager::GetUIpointer()->ApplyCommand(com.toStdString().c_str());
updateQWidget();
}
}
void G4OpenGLQtViewer::actionMovieParameters() {
showMovieParametersDialog();
}
@@ -1398,17 +1485,9 @@ void G4OpenGLQtViewer::FinishView()
void G4OpenGLQtViewer::G4MousePressEvent(QMouseEvent *event)
{
#if QT_VERSION < 0x040000
if ((event->button() & Qt::LeftButton)
&& !((event->state() & Qt::ShiftButton)
|| (event->state() & Qt::ControlButton)
|| (event->state() & Qt::AltButton)
|| (event->state() & Qt::MetaButton))) {
if (event->button() & Qt::LeftButton) {
#else
if ((event->buttons() & Qt::LeftButton)
&& !((event->modifiers() & Qt::ShiftModifier)
|| (event->modifiers() & Qt::ControlModifier)
|| (event->modifiers() & Qt::AltModifier)
|| (event->modifiers() & Qt::MetaModifier))) {
if (event->buttons() & Qt::LeftButton) {
#endif
fWindow->setMouseTracking(true);
fAutoMove = false; // stop automove
@@ -1436,18 +1515,45 @@ void G4OpenGLQtViewer::G4MouseReleaseEvent()
QTime lastMoveTime;
lastMoveTime.start();
// try to addapt speed move/rotate looking to drawing speed
int cycles = 4;
float correctionFactor = 5;
while (fAutoMove) {
// if ( lastMoveTime.elapsed() > (fSpinningDelay / (cycles/2))) {
if ( lastMoveTime.elapsed () >= (int)(1000/fNbMaxFramesPerSec)) {
float lTime = 1000/((float)lastMoveTime.elapsed ());
if (((((float)delta.x())/correctionFactor)*lTime > fNbMaxAnglePerSec) ||
((((float)delta.x())/correctionFactor)*lTime < -fNbMaxAnglePerSec) ) {
correctionFactor = (float)delta.x()*(lTime/fNbMaxAnglePerSec);
if (delta.x() <0 ) {
correctionFactor = -correctionFactor;
}
}
if (((((float)delta.y())/correctionFactor)*lTime > fNbMaxAnglePerSec) ||
((((float)delta.y())/correctionFactor)*lTime < -fNbMaxAnglePerSec) ) {
correctionFactor = (float)delta.y()*(lTime/fNbMaxAnglePerSec);
if (delta.y() <0 ) {
correctionFactor = -correctionFactor;
}
}
// Check Qt Versions for META Keys
// Click and move mouse to rotate volume
// ALT + Click and move mouse to rotate volume (View Direction)
// SHIFT + Click and move camera point of view
// CTRL + Click and zoom mouse to zoom in/out
if (fMouseAction == STYLE1) { // rotate
rotateQtScene(((float)delta.x())/cycles,((float)delta.y())/cycles);
if (fNoKeyPress) {
rotateQtScene(((float)delta.x())/correctionFactor,((float)delta.y())/correctionFactor);
} else if (fAltKeyPress) {
rotateQtSceneInViewDirection(((float)delta.x())/correctionFactor,((float)delta.y())/correctionFactor);
}
} else if (fMouseAction == STYLE2) { // move
moveScene(-((float)delta.x())/cycles,-((float)delta.y())/cycles,0,true);
moveScene(-((float)delta.x())/correctionFactor,-((float)delta.y())/correctionFactor,0,true);
}
lastMoveTime.start();
cycles = 1 ;
}
((QApplication*)G4Qt::getInstance ())->processEvents();
cycles ++ ;
}
}
fWindow->setMouseTracking(false);
@@ -1477,6 +1583,12 @@ void G4OpenGLQtViewer::G4MouseMoveEvent(QMouseEvent *event)
Qt::MouseButtons mButtons = event->buttons();
#endif
#if QT_VERSION < 0x040000
updateKeyModifierState(event->state());
#else
updateKeyModifierState(event->modifiers());
#endif
if (fAutoMove) {
return;
}
@@ -1490,7 +1602,23 @@ void G4OpenGLQtViewer::G4MouseMoveEvent(QMouseEvent *event)
if (fMouseAction == STYLE1) { // rotate
if (mButtons & Qt::LeftButton) {
rotateQtScene(deltaX,deltaY);
if (fNoKeyPress) {
rotateQtScene(((float)deltaX),((float)deltaY));
} else if (fAltKeyPress) {
rotateQtSceneInViewDirection(((float)deltaX),((float)deltaY));
} else if (fShiftKeyPress) {
unsigned int sizeWin;
sizeWin = getWinWidth();
if (getWinHeight() < getWinWidth()) {
sizeWin = getWinHeight();
}
// L.Garnier : 08/2010 100 is the good value, but don't ask me why !
float factor = ((float)100/(float)sizeWin) ;
moveScene(-(float)deltaX*factor,-(float)deltaY*factor,0,false);
} else if (fControlKeyPress) {
fVP.SetZoomFactor(fVP.GetZoomFactor()*(1+((float)deltaY)));
}
}
} else if (fMouseAction == STYLE2) { // move
if (mButtons & Qt::LeftButton) {
@@ -1527,9 +1655,9 @@ void G4OpenGLQtViewer::moveScene(float dx,float dy, float dz,bool mouseMove)
coefDepth = getSceneDepth()*fDeltaDepth;
}
fVP.IncrementPan(-dx*coefTrans,dy*coefTrans,dz*coefDepth);
emit moveX(-dx*coefTrans);
emit moveY(dy*coefTrans);
emit moveZ(dz*coefTrans);
emit moveX(-static_cast<int>(dx*coefTrans));
emit moveY(static_cast<int>(dy*coefTrans));
emit moveZ(static_cast<int>(dz*coefTrans));
updateQWidget();
if (fAutoMove)
@@ -1552,11 +1680,11 @@ void G4OpenGLQtViewer::rotateQtScene(float dx, float dy)
if( dx != 0) {
rotateScene(dx,0,fDeltaRotation);
emit rotateTheta(dx);
emit rotateTheta(static_cast<int>(dx));
}
if( dy != 0) {
rotateScene(0,dy,fDeltaRotation);
emit rotatePhi(dy);
emit rotatePhi(static_cast<int>(dy));
}
updateQWidget();
@@ -1568,6 +1696,29 @@ void G4OpenGLQtViewer::rotateQtScene(float dx, float dy)
@param dy delta mouse y position
*/
void G4OpenGLQtViewer::rotateQtSceneInViewDirection(float dx, float dy)
{
if (fHoldRotateEvent)
return;
fHoldRotateEvent = true;
fXRot +=dx;
fYRot +=dy;
rotateSceneInViewDirection(dx,dy,fDeltaRotation/100);
emit rotateTheta(static_cast<int>(dx));
emit rotatePhi(static_cast<int>(dy));
updateQWidget();
fHoldRotateEvent = false;
}
/**
@param dx delta mouse x position
@param dy delta mouse y position
*/
void G4OpenGLQtViewer::rotateQtCamera(float dx, float dy)
{
if (fHoldRotateEvent)
@@ -1575,13 +1726,41 @@ void G4OpenGLQtViewer::rotateQtCamera(float dx, float dy)
fHoldRotateEvent = true;
rotateScene(dx,dy,fDeltaRotation);
emit rotateTheta(dx);
emit rotatePhi(dy);
emit rotateTheta(static_cast<int>(dx));
emit rotatePhi(static_cast<int>(dy));
updateQWidget();
fHoldRotateEvent = false;
}
/**
@param dx delta mouse x position
@param dy delta mouse y position
*/
void G4OpenGLQtViewer::rotateQtCameraInViewDirection(float dx, float dy)
{
if (fHoldRotateEvent)
return;
fHoldRotateEvent = true;
fVP.SetUpVector(G4Vector3D(0.0, 1.0, 0.0));
fVP.SetViewAndLights (G4Vector3D(0.0, 0.0, 1.0));
fXRot +=dx;
fYRot +=dy;
rotateSceneInViewDirection(fXRot,fYRot,fDeltaRotation/100);
emit rotateTheta(static_cast<int>(dx));
emit rotatePhi(static_cast<int>(dy));
updateQWidget();
fHoldRotateEvent = false;
}
@@ -1638,7 +1817,7 @@ bool G4OpenGLQtViewer::printPDF (
printer.setOutputFormat(QPrinter::PdfFormat);
}
*/
printer.setOutputFileName(aFilename);
printer.setOutputFileName(QString(aFilename.c_str()));
// printer.setFullPage ( true);
QPainter paint(&printer);
paint.drawImage (0,0,aImage );
@@ -1697,103 +1876,21 @@ void G4OpenGLQtViewer::G4wheelEvent (QWheelEvent * event)
}
void G4OpenGLQtViewer::G4keyPressEvent (QKeyEvent * event)
void G4OpenGLQtViewer::G4keyPressEvent (QKeyEvent * event)
{
if (fHoldKeyEvent)
return;
fHoldKeyEvent = true;
#if QT_VERSION < 0x040000
if ((event->key() == Qt::Key_Down) && (event->state() & Qt::AltButton )) { // go backward
#else
if ((event->key() == Qt::Key_Down) && (event->modifiers() & Qt::AltModifier )) { // go backward
#endif
moveScene(0,0,1,false);
}
#if QT_VERSION < 0x040000
else if ((event->key() == Qt::Key_Up) && (event->state() & Qt::AltButton)) { // go forward
#else
else if ((event->key() == Qt::Key_Up) && (event->modifiers() & Qt::AltModifier)) { // go forward
#endif
moveScene(0,0,-1,false);
}
#if QT_VERSION < 0x040000
if ((event->key() == Qt::Key_Down) && (event->state() & Qt::ShiftButton)) { // rotate phi
#else
if ((event->key() == Qt::Key_Down) && (event->modifiers() & Qt::ShiftModifier)) { // rotate phi
#endif
rotateQtCamera(0,-1);
}
#if QT_VERSION < 0x040000
else if ((event->key() == Qt::Key_Up) && (event->state() & Qt::ShiftButton)) { // rotate phi
#else
else if ((event->key() == Qt::Key_Up) && (event->modifiers() & Qt::ShiftModifier)) { // rotate phi
#endif
rotateQtCamera(0,1);
}
#if QT_VERSION < 0x040000
if ((event->key() == Qt::Key_Left) && (event->state() & Qt::ShiftButton)) { // rotate theta
#else
if ((event->key() == Qt::Key_Left) && (event->modifiers() & Qt::ShiftModifier)) { // rotate theta
#endif
rotateQtCamera(1,0);
}
#if QT_VERSION < 0x040000
else if ((event->key() == Qt::Key_Right) && (event->state() & Qt::ShiftButton)) { // rotate theta
#else
else if ((event->key() == Qt::Key_Right) && (event->modifiers() & Qt::ShiftModifier)) { // rotate theta
#endif
rotateQtCamera(-1,0);
}
#if QT_VERSION < 0x040000
if ((event->state() & Qt::AltButton)) {
#else
if ((event->modifiers() & Qt::AltModifier)) {
#endif
if (event->key() == Qt::Key_Plus) {
fDeltaRotation = fDeltaRotation/0.7;
}
else if (event->key() == Qt::Key_Minus) {
fDeltaRotation = fDeltaRotation*0.7;
}
} else {
if (event->key() == Qt::Key_Plus) {
fVP.SetZoomFactor(fVP.GetZoomFactor()*(1+fDeltaZoom));
updateQWidget();
}
else if (event->key() == Qt::Key_Minus) {
fVP.SetZoomFactor(fVP.GetZoomFactor()*(1-fDeltaZoom));
updateQWidget();
}
}
if (event->key() == Qt::Key_Escape) { // escaped from full screen
#if QT_VERSION >= 0x030200
toggleFullScreen(false);
#endif
}
// several case here : If return is pressed, in every case -> display the movie parameters dialog
// If one parameter is wrong -> put it in red (only save filenam could be wrong..)
// If encoder not found-> does nothing.Only display a message in status box
// If all ok-> generate parameter file
// If ok -> put encoder button enabled
if ((event->key() == Qt::Key_Return) || (event->key() == Qt::Key_Enter)){ // end of video
stopVideo();
}
if (event->key() == Qt::Key_Space){ // start/pause of video
startPauseVideo();
}
// with no modifiers
#if QT_VERSION < 0x040000
if (event->state() == Qt::NoButton) {
updateKeyModifierState(event->state());
if (fNoKeyPress) {
#else
if ((event->modifiers() == Qt::NoModifier) || (event->modifiers() == Qt::KeypadModifier )) {
updateKeyModifierState(event->modifiers());
if ((fNoKeyPress) || (event->modifiers() == Qt::KeypadModifier )) {
#endif
if (event->key() == Qt::Key_Down) { // go down
moveScene(0,1,0,false);
@@ -1807,11 +1904,148 @@ void G4OpenGLQtViewer::G4keyPressEvent (QKeyEvent * event)
else if (event->key() == Qt::Key_Right) { // go right
moveScene(1,0,0,false);
}
if (event->key() == Qt::Key_Minus) { // go backward
moveScene(0,0,1,false);
}
else if (event->key() == Qt::Key_Plus) { // go forward
moveScene(0,0,-1,false);
}
// escaped from full screen
if (event->key() == Qt::Key_Escape) {
#if QT_VERSION >= 0x030200
toggleFullScreen(false);
#endif
}
}
// several case here : If return is pressed, in every case -> display the movie parameters dialog
// If one parameter is wrong -> put it in red (only save filenam could be wrong..)
// If encoder not found-> does nothing.Only display a message in status box
// If all ok-> generate parameter file
// If ok -> put encoder button enabled
if ((event->key() == Qt::Key_Return) || (event->key() == Qt::Key_Enter)){ // end of video
stopVideo();
}
if (event->key() == Qt::Key_Space){ // start/pause of video
startPauseVideo();
}
// H : Return Home view
if (event->key() == Qt::Key_H){ // go Home
fDeltaRotation = 1;
fDeltaSceneTranslation = 0.01;
fDeltaDepth = 0.01;
fDeltaZoom = 0.05;
fDeltaMove = 0.05;
fVP.SetZoomFactor(1.);
fVP.SetUpVector(G4Vector3D (0., 1., 0.));
fVP.SetViewAndLights (G4Vector3D (0., 0., 1.));
updateQWidget();
}
// Shift Modifier
if (fShiftKeyPress) {
if (event->key() == Qt::Key_Down) { // rotate phi
rotateQtScene(0,-fDeltaRotation);
}
else if (event->key() == Qt::Key_Up) { // rotate phi
rotateQtScene(0,fDeltaRotation);
}
if (event->key() == Qt::Key_Left) { // rotate theta
rotateQtScene(fDeltaRotation,0);
}
else if (event->key() == Qt::Key_Right) { // rotate theta
rotateQtScene(-fDeltaRotation,0);
}
// Alt Modifier
}
if ((fAltKeyPress)) {
if (event->key() == Qt::Key_Down) { // rotate phi
rotateQtSceneInViewDirection(0,-fDeltaRotation);
}
else if (event->key() == Qt::Key_Up) { // rotate phi
rotateQtSceneInViewDirection(0,fDeltaRotation);
}
if (event->key() == Qt::Key_Left) { // rotate theta
rotateQtSceneInViewDirection(fDeltaRotation,0);
}
else if (event->key() == Qt::Key_Right) { // rotate theta
rotateQtSceneInViewDirection(-fDeltaRotation,0);
}
// Rotatio +/-
if (event->key() == Qt::Key_Plus) {
fDeltaRotation = fDeltaRotation/0.7;
G4cout << "Auto-rotation set to : " << fDeltaRotation << G4endl;
}
else if (event->key() == Qt::Key_Minus) {
fDeltaRotation = fDeltaRotation*0.7;
G4cout << "Auto-rotation set to : " << fDeltaRotation << G4endl;
}
// Control Modifier OR Command on MAC
}
if ((fControlKeyPress)) {
if (event->key() == Qt::Key_Plus) {
fVP.SetZoomFactor(fVP.GetZoomFactor()*(1+fDeltaZoom));
updateQWidget();
}
else if (event->key() == Qt::Key_Minus) {
fVP.SetZoomFactor(fVP.GetZoomFactor()*(1-fDeltaZoom));
updateQWidget();
}
}
fHoldKeyEvent = false;
}
#if QT_VERSION < 0x040000
void G4OpenGLQtViewer::updateKeyModifierState(Qt::ButtonState modifier) {
#else
void G4OpenGLQtViewer::updateKeyModifierState(Qt::KeyboardModifiers modifier) {
#endif
// Check Qt Versions for META Keys
fNoKeyPress = true;
fAltKeyPress = false;
fShiftKeyPress = false;
fControlKeyPress = false;
#if QT_VERSION < 0x040000
if (modifier & Qt::AltButton ) {
fAltKeyPress = true;
fNoKeyPress = false;
}
if (modifier & Qt::ShiftButton ) {
fShiftKeyPress = true;
fNoKeyPress = false;
}
if (modifier & Qt::ControlButton ) {
fControlKeyPress = true;
fNoKeyPress = false;
}
#else
if (modifier & Qt::AltModifier ) {
fAltKeyPress = true;
fNoKeyPress = false;
}
if (modifier & Qt::ShiftModifier ) {
fShiftKeyPress = true;
fNoKeyPress = false;
}
if (modifier & Qt::ControlModifier ) {
fControlKeyPress = true;
fNoKeyPress = false;
}
#endif
}
/** Stop the video. Check all parameters and enable encoder button if all is ok.
*/
void G4OpenGLQtViewer::stopVideo() {
@@ -2606,7 +2840,8 @@ QWidget *G4OpenGLQtViewer::getParentWidget()
{
// launch Qt if not
G4Qt* interactorManager = G4Qt::getInstance ();
// G4UImanager* UI = G4UImanager::GetUIpointer();
// G4UImanager* UI =
G4UImanager::GetUIpointer();
bool found = false;
@@ -2647,6 +2882,9 @@ QWidget *G4OpenGLQtViewer::getParentWidget()
printf("G4OpenGLQtViewer::CreateMainWindow case Qapp exist\n");
#endif
fGLWindow = new QDialog();
#ifdef G4DEBUG_VIS_OGL
printf("G4OpenGLQtViewer::GetParentWidget fGLWindow\n");
#endif
}
if (found) {
return fGLWindow;
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLSceneHandler.cc,v 1.56 2009/10/21 15:18:43 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenGLSceneHandler.cc,v 1.59 2010/05/30 09:53:05 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
// Andrew Walkden 27th March 1996
@@ -137,24 +137,24 @@ void G4OpenGLSceneHandler::EndPrimitives2D ()
G4VSceneHandler::EndPrimitives2D ();
}
const G4Polyhedron* G4OpenGLSceneHandler::CreateSectionPolyhedron ()
G4VSolid* G4OpenGLSceneHandler::CreateSectionSolid ()
{
// Clipping done in G4OpenGLViewer::SetView.
return 0;
// return 0;
// But...OpenGL no longer seems to reconstruct clipped edges, so,
// when the BooleanProcessor is up to it, abandon this and use
// generic clipping in G4VSceneHandler::CreateSectionPolyhedron...
// return G4VSceneHandler::CreateSectionPolyhedron();
// generic clipping in G4VSceneHandler::CreateSectionSolid...
return G4VSceneHandler::CreateSectionSolid();
}
const G4Polyhedron* G4OpenGLSceneHandler::CreateCutawayPolyhedron ()
G4VSolid* G4OpenGLSceneHandler::CreateCutawaySolid ()
{
// Cutaway done in G4OpenGLViewer::SetView.
return 0;
// return 0;
// But...if not, when the BooleanProcessor is up to it...
// return G4VSceneHandler::CreateCutawayPolyhedron();
return G4VSceneHandler::CreateCutawaySolid();
}
void G4OpenGLSceneHandler::AddPrimitive (const G4Polyline& line)
@@ -224,20 +224,27 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
break;
case G4Polymarker::circles:
{
std::vector <G4VMarker> circleV;
for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
G4Circle circle (polymarker);
// If not already drawn
circle.SetPosition (polymarker[iPoint]);
G4OpenGLSceneHandler::AddPrimitive (circle);
circleV.push_back(circle);
// G4OpenGLSceneHandler::AddPrimitive (circle);
}
G4OpenGLSceneHandler::AddPrimitives (circleV);
}
break;
case G4Polymarker::squares:
{
std::vector <G4VMarker> squareV;
for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
G4Square square (polymarker);
square.SetPosition (polymarker[iPoint]);
G4OpenGLSceneHandler::AddPrimitive (square);
squareV.push_back(square);
// G4OpenGLSceneHandler::AddPrimitive (square);
}
G4OpenGLSceneHandler::AddPrimitives (squareV);
}
break;
}
@@ -303,35 +310,55 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Square& square) {
AddCircleSquare (square, G4OpenGLBitMapStore::square);
}
void G4OpenGLSceneHandler::AddPrimitives (std::vector <G4VMarker> square) {
glDisable (GL_POINT_SMOOTH);
AddCircleSquareVector (square, G4OpenGLBitMapStore::square);
}
void G4OpenGLSceneHandler::AddCircleSquare
(const G4VMarker& marker,
G4OpenGLBitMapStore::Shape shape) {
std::vector <G4VMarker> circleVector;
circleVector.push_back(marker);
AddCircleSquareVector(circleVector,shape);
}
void G4OpenGLSceneHandler::AddCircleSquareVector
(std::vector <G4VMarker> marker,
G4OpenGLBitMapStore::Shape shape) {
if (marker.size() == 0) {
return;
}
if (!fProcessingPolymarker) { // Polymarker has already loaded atts.
// Loads G4Atts for picking...
if (fpViewer->GetViewParameters().IsPicking()) {
G4AttHolder* holder = new G4AttHolder;
LoadAtts(marker, holder);
LoadAtts(marker[0], holder);
fPickMap[fPickName] = holder;
}
}
// Note: colour treated in sub-class.
if (fpViewer -> GetViewParameters ().IsMarkerNotHidden ())
if (fpViewer -> GetViewParameters ().IsMarkerNotHidden ()) {
glDisable (GL_DEPTH_TEST);
else {glEnable (GL_DEPTH_TEST); glDepthFunc (GL_LESS);}
} else {
glEnable (GL_DEPTH_TEST); glDepthFunc (GL_LESS);
}
glDisable (GL_LIGHTING);
// Get vis attributes - pick up defaults if none.
const G4VisAttributes* pVA =
fpViewer -> GetApplicableVisAttributes (marker.GetVisAttributes ());
fpViewer -> GetApplicableVisAttributes (marker[0].GetVisAttributes ());
G4double lineWidth = GetLineWidth(pVA);
glLineWidth(lineWidth);
G4VMarker::FillStyle style = marker.GetFillStyle();
G4VMarker::FillStyle style = marker[0].GetFillStyle();
G4bool filled = false;
static G4bool hashedWarned = false;
@@ -360,20 +387,27 @@ void G4OpenGLSceneHandler::AddCircleSquare
}
// A few useful quantities...
G4Point3D centre = marker.GetPosition();
MarkerSizeType sizeType;
G4double size = GetMarkerSize(marker, sizeType);
G4double size = GetMarkerSize(marker[0], sizeType);
// Draw...
if (sizeType == world) { // Size specified in world coordinates.
DrawXYPolygon (shape, size, centre, pVA);
for (unsigned int a=0;a<marker.size();a++) {
G4Point3D centre = marker[a].GetPosition();
// A few useful quantities...
DrawXYPolygon (shape, size, centre, pVA);
}
} else { // Size specified in screen (window) coordinates.
glPointSize (size);
// A few useful quantities...
glPointSize (size);
glBegin (GL_POINTS);
glVertex3f(centre.x(),centre.y(),centre.z());
for (unsigned int a=0;a<marker.size();a++) {
G4Point3D centre = marker[a].GetPosition();
glVertex3f(centre.x(),centre.y(),centre.z());
}
glEnd();
//Antialiasing
glEnable (GL_POINT_SMOOTH);
@@ -844,6 +878,10 @@ void G4OpenGLSceneHandler::AddCompound(const G4VHit& hit) {
G4VSceneHandler::AddCompound(hit); // For now.
}
void G4OpenGLSceneHandler::AddCompound(const G4VDigi& digi) {
G4VSceneHandler::AddCompound(digi); // For now.
}
void G4OpenGLSceneHandler::AddCompound(const G4THitsMap<G4double>& hits) {
G4VSceneHandler::AddCompound(hits); // For now.
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLStoredQtViewer.cc,v 1.28 2009/11/03 11:02:32 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenGLStoredQtViewer.cc,v 1.32 2010/06/23 13:29:23 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
// Class G4OpenGLStoredQtViewer : a class derived from G4OpenGLQtViewer and
@@ -52,7 +52,8 @@ G4OpenGLStoredQtViewer::G4OpenGLStoredQtViewer
#else
setFocusPolicy(Qt::StrongFocus); // enable keybord events
#endif
fHasToRepaint =false;
fHasToRepaint = false;
fIsRepainting = false;
if (fViewId < 0) return; // In case error in base class instantiation.
}
@@ -69,7 +70,7 @@ void G4OpenGLStoredQtViewer::Initialise() {
printf("G4OpenGLStoredQtViewer::Initialise 1\n");
#endif
fReadyToPaint = false;
CreateMainWindow (this,QString(fName));
CreateMainWindow (this,QString(GetName()));
CreateFontLists ();
fReadyToPaint = true;
@@ -102,20 +103,8 @@ void G4OpenGLStoredQtViewer::initializeGL () {
}
void G4OpenGLStoredQtViewer::DrawView () {
#ifdef G4DEBUG_VIS_OGL
printf("G4OpenGLStoredQtViewer::DrawView VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n");
#endif
// That's no the same logic as Immediate Viewer, I don't know why...
// But if I send updateGL here, we go here :
// updateQWidget -> paintGL -> ComputeView
// whih is not the same as ComputeView Directly
// And we loose the redraw of things !
ComputeView();
#ifdef G4DEBUG_VIS_OGL
printf("G4OpenGLStoredQtViewer::DrawView ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
#endif
void G4OpenGLStoredQtViewer::DrawView () {
updateQWidget();
}
void G4OpenGLStoredQtViewer::ComputeView () {
@@ -192,7 +181,7 @@ void G4OpenGLStoredQtViewer::ComputeView () {
#ifdef G4DEBUG_VIS_OGL
printf("G4OpenGLStoredQtViewer::ComputeView %d %d ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n",getWinWidth(), getWinHeight());
#endif
fHasToRepaint =true;
fHasToRepaint = true;
}
@@ -204,13 +193,27 @@ void G4OpenGLStoredQtViewer::resizeGL(
,int aHeight)
{
// Set new size, it will be update when next Repaint()->SetView() called
ResizeWindow(aWidth,aHeight);
fHasToRepaint = sizeHasChanged();
if ((aWidth > 0) && (aHeight > 0)) {
ResizeWindow(aWidth,aHeight);
fHasToRepaint = sizeHasChanged();
}
}
// We have to get several case :
// - Only activate the windows (mouse click for example) -> Do not redraw
// - resize window -> redraw
// - try to avoid recompute everything if we do not rescale picture (side is the same)
void G4OpenGLStoredQtViewer::paintGL()
{
#ifdef G4DEBUG_VIS_OGL
printf("G4OpenGLStoredQtViewer::paintGL \n");
#endif
if (fIsRepainting) {
// return ;
}
fIsRepainting = true;
#ifdef G4DEBUG_VIS_OGL
printf("G4OpenGLStoredQtViewer::paintGL ready:%d fHasTo:%d??\n",fReadyToPaint,fHasToRepaint);
#endif
@@ -246,15 +249,22 @@ void G4OpenGLStoredQtViewer::paintGL()
#endif
SetView();
ClearView (); //ok, put the background correct
ComputeView();
fHasToRepaint =false;
fHasToRepaint = false;
#ifdef G4DEBUG_VIS_OGL
printf("G4OpenGLStoredQtViewer::paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ready %d\n",fReadyToPaint);
#endif
fIsRepainting = false;
}
void G4OpenGLStoredQtViewer::paintEvent(QPaintEvent *) {
if ( fHasToRepaint) {
updateGL();
}
}
void G4OpenGLStoredQtViewer::mousePressEvent(QMouseEvent *event)
@@ -272,6 +282,11 @@ void G4OpenGLStoredQtViewer::wheelEvent (QWheelEvent * event)
G4wheelEvent(event);
}
void G4OpenGLStoredQtViewer::showEvent (QShowEvent *)
{
fHasToRepaint = true;
}
/**
* This function was build in order to make a zoom on double clic event.
* It was think to build a rubberband on the zoom area, but never work fine
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLStoredSceneHandler.cc,v 1.40 2009/02/04 16:48:41 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenGLStoredSceneHandler.cc,v 1.46 2010/11/10 17:11:20 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
// Andrew Walkden 10th February 1997
@@ -78,7 +78,6 @@ G4OpenGLStoredSceneHandler::G4OpenGLStoredSceneHandler
(G4VGraphicsSystem& system,
const G4String& name):
G4OpenGLSceneHandler (system, fSceneIdCount++, name),
fMemoryForDisplayLists (true),
fAddPrimitivePreambleNestingDepth (0),
fTopPODL (0)
{}
@@ -105,12 +104,15 @@ void G4OpenGLStoredSceneHandler::AddPrimitivePreamble(const G4Visible& visible)
if (fMemoryForDisplayLists) {
fDisplayListId = glGenLists (1);
if (glGetError() == GL_OUT_OF_MEMORY) { // Could pre-allocate?
if (glGetError() == GL_OUT_OF_MEMORY ||
fDisplayListId > fDisplayListLimit) {
G4cout <<
"********************* WARNING! ********************"
"\nUnable to allocate any more display lists in OpenGL."
"\n Continuing drawing in IMMEDIATE MODE."
"\n***************************************************"
"********************* WARNING! ********************"
"\n* Display list limit reached in OpenGL."
"\n* Continuing drawing WITHOUT STORING. Scene only partially refreshable."
"\n* Current limit: " << fDisplayListLimit <<
". Change with \"/vis/ogl/set/displayListLimit\"."
"\n***************************************************"
<< G4endl;
fMemoryForDisplayLists = false;
}
@@ -333,6 +335,8 @@ void G4OpenGLStoredSceneHandler::EndModeling () {
void G4OpenGLStoredSceneHandler::ClearStore () {
//G4cout << "G4OpenGLStoredSceneHandler::ClearStore" << G4endl;
G4VSceneHandler::ClearStore (); // Sets need kernel visit, etc.
// Delete OpenGL permanent display lists.
@@ -350,10 +354,14 @@ void G4OpenGLStoredSceneHandler::ClearStore () {
for (size_t i = 0; i < fTOList.size (); i++)
glDeleteLists(fTOList[i].fDisplayListId, 1);
fTOList.clear ();
fMemoryForDisplayLists = true;
}
void G4OpenGLStoredSceneHandler::ClearTransientStore () {
//G4cout << "G4OpenGLStoredSceneHandler::ClearTransientStore" << G4endl;
G4VSceneHandler::ClearTransientStore ();
// Delete OpenGL transient display lists and Transient Objects themselves.
@@ -361,6 +369,8 @@ void G4OpenGLStoredSceneHandler::ClearTransientStore () {
glDeleteLists(fTOList[i].fDisplayListId, 1);
fTOList.clear ();
fMemoryForDisplayLists = true;
// Make sure screen corresponds to graphical database...
if (fpViewer) {
fpViewer -> SetView ();
@@ -462,4 +472,8 @@ void G4OpenGLStoredSceneHandler::RequestPrimitives (const G4VSolid& solid)
G4int G4OpenGLStoredSceneHandler::fSceneIdCount = 0;
G4int G4OpenGLStoredSceneHandler::fDisplayListId = 0;
G4bool G4OpenGLStoredSceneHandler::fMemoryForDisplayLists = true;
G4int G4OpenGLStoredSceneHandler::fDisplayListLimit = 50000;
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLStoredViewer.cc,v 1.26 2009/04/08 16:55:44 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenGLStoredViewer.cc,v 1.29 2010/10/06 10:05:52 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
// Andrew Walkden 7th February 1997
@@ -87,6 +87,10 @@ G4bool G4OpenGLStoredViewer::CompareForKernelVisit(G4ViewParameters& lastVP) {
(lastVP.IsExplode () != fVP.IsExplode ()) ||
(lastVP.GetNoOfSides () != fVP.GetNoOfSides ()) ||
(lastVP.IsMarkerNotHidden () != fVP.IsMarkerNotHidden ()) ||
(lastVP.GetDefaultVisAttributes()->GetColour() !=
fVP.GetDefaultVisAttributes()->GetColour()) ||
(lastVP.GetDefaultTextVisAttributes()->GetColour() !=
fVP.GetDefaultTextVisAttributes()->GetColour()) ||
(lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())||
(lastVP.IsPicking () != fVP.IsPicking ())
)
@@ -155,7 +159,7 @@ void G4OpenGLStoredViewer::DrawDisplayLists () {
for (size_t i = 0; i < fG4OpenGLStoredSceneHandler.fTOList.size(); ++i) {
#ifdef G4DEBUG_VIS_OGL
printf("-");
// printf("-");
#endif
G4OpenGLStoredSceneHandler::TO& to =
fG4OpenGLStoredSceneHandler.fTOList[i];
@@ -164,12 +168,16 @@ void G4OpenGLStoredViewer::DrawDisplayLists () {
G4OpenGLTransform3D oglt (to.fTransform);
glMultMatrixd (oglt.GetGLMatrix ());
if (fVP.IsPicking()) glLoadName(to.fPickName);
G4Colour& c = to.fColour;
const G4Colour& c = to.fColour;
const G4Colour& bg = fVP.GetBackgroundColour();
G4double bsf = 1.; // Brightness scaling factor.
if (fFadeFactor > 0. && to.fEndTime < fEndTime)
bsf = 1. - fFadeFactor *
((fEndTime - to.fEndTime) / (fEndTime - fStartTime));
glColor3d(bsf * c.GetRed (), bsf * c.GetGreen (), bsf * c.GetBlue ());
glColor3d
(bsf * c.GetRed() + (1. - bsf) * bg.GetRed(),
bsf * c.GetGreen() + (1. - bsf) * bg.GetGreen(),
bsf * c.GetBlue() + (1. - bsf) * bg.GetBlue());
glCallList (to.fDisplayListId);
glPopMatrix();
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLStoredXViewer.cc,v 1.25 2009/04/08 16:55:44 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenGLStoredXViewer.cc,v 1.27 2010/06/03 08:26:55 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
// Andrew Walkden 7th February 1997
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLStoredXmViewer.cc,v 1.25 2009/04/08 16:55:44 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenGLStoredXmViewer.cc,v 1.26 2010/04/30 13:18:32 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
// Andrew Walkden 10th February 1997
@@ -57,7 +57,9 @@ G4OpenGLStoredXmViewer (G4OpenGLStoredSceneHandler& sceneHandler,
}
}
G4OpenGLStoredXmViewer::~G4OpenGLStoredXmViewer () {}
G4OpenGLStoredXmViewer::~G4OpenGLStoredXmViewer () {
GetSceneHandler()->RemoveViewerFromList(this);
}
void G4OpenGLStoredXmViewer::Initialise () {
+121 -67
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLViewer.cc,v 1.59 2009/10/20 12:47:45 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenGLViewer.cc,v 1.63 2010/10/05 15:45:19 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
// Andrew Walkden 27th March 1996
@@ -156,54 +156,26 @@ void G4OpenGLViewer::ResizeWindow(unsigned int aWidth, unsigned int aHeight) {
void G4OpenGLViewer::ResizeGLView()
{
#ifdef G4DEBUG_VIS_OGL
printf("G4OpenGLViewer::ResizeGLView %d %d\n",fWinSize_x,fWinSize_y);
printf("G4OpenGLViewer::ResizeGLView %d %d &:%d\n",fWinSize_x,fWinSize_y,this);
#endif
// Check size
GLint dims[2];
glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
if (fWinSize_x > (unsigned)dims[0]) {
G4cerr << "Try to resize view greater than max X viewport dimension. Desired size "<<dims[0] <<" is resize to "<< dims[0] << G4endl;
fWinSize_x = dims[0];
}
if (fWinSize_y > (unsigned)dims[1]) {
G4cerr << "Try to resize view greater than max Y viewport dimension. Desired size "<<dims[0] <<" is resize to "<< dims[1] << G4endl;
fWinSize_y = dims[1];
}
GLsizei side = fWinSize_x;
if (fWinSize_y < fWinSize_x) side = fWinSize_y;
// SPECIAL CASE if fWinSize_x is even (69 for example)
// Ex : X: 69 Y: 26
// side = 26
// width / 2 = 21,5
// height / 2 = 0
// Should be fixed to closed : 21 0 for ex
// Then size must by change to :
// X:68 Y: 26
if ((dims[0] !=0 ) && (dims[1] !=0)) {
// SPECIAL CASE
if ((fWinSize_x - side)%2) {
// fWinSize_x --;
side = fWinSize_x;
if (fWinSize_y < fWinSize_x) side = fWinSize_y;
if (fWinSize_x > (unsigned)dims[0]) {
G4cerr << "Try to resize view greater than max X viewport dimension. Desired size "<<dims[0] <<" is resize to "<< dims[0] << G4endl;
fWinSize_x = dims[0];
}
if (fWinSize_y > (unsigned)dims[1]) {
G4cerr << "Try to resize view greater than max Y viewport dimension. Desired size "<<dims[0] <<" is resize to "<< dims[1] << G4endl;
fWinSize_y = dims[1];
}
}
if ((fWinSize_y - side)%2) {
// fWinSize_y --;
glViewport(0, 0, fWinSize_x,fWinSize_y);
side = fWinSize_x;
if (fWinSize_y < fWinSize_x) side = fWinSize_y;
}
GLint X = (fWinSize_x - side) / 2;
GLint Y = (fWinSize_y - side) / 2;
#ifdef G4DEBUG_VIS_OGL
printf("G4OpenGLViewer::ResizeGLView X:%d Y:%d W:%d H:%d --side%d\n",(fWinSize_x - side) / 2,(fWinSize_y - side) / 2,fWinSize_x,fWinSize_y,side);
#endif
glViewport(X, Y, side, side);
// glViewport(0, 0, fWinSize_x,fWinSize_y);
}
@@ -211,8 +183,6 @@ void G4OpenGLViewer::ResizeGLView()
void G4OpenGLViewer::SetView () {
if (!fSceneHandler.GetScene()) {
G4cerr << "G4OpenGLStoredViewer: Creating a Viewer without a scene is not allowed. \nPlease use /vis/scene/create before /vis/open/.... "
<< G4endl;
return;
}
// Calculates view representation based on extent of object being
@@ -232,6 +202,15 @@ void G4OpenGLViewer::SetView () {
glLightfv (GL_LIGHT0, GL_AMBIENT, ambient);
glLightfv (GL_LIGHT0, GL_DIFFUSE, diffuse);
G4double ratioX = 1;
G4double ratioY = 1;
if (fWinSize_y > fWinSize_x) {
ratioX = ((G4double)fWinSize_y) / ((G4double)fWinSize_x);
}
if (fWinSize_x > fWinSize_y) {
ratioY = ((G4double)fWinSize_x) / ((G4double)fWinSize_y);
}
// Get radius of scene, etc.
// Note that this procedure properly takes into account zoom, dolly and pan.
const G4Point3D targetPoint
@@ -244,10 +223,10 @@ void G4OpenGLViewer::SetView () {
targetPoint + cameraDistance * fVP.GetViewpointDirection().unit();
const GLdouble pnear = fVP.GetNearDistance (cameraDistance, radius);
const GLdouble pfar = fVP.GetFarDistance (cameraDistance, pnear, radius);
const GLdouble right = fVP.GetFrontHalfHeight (pnear, radius);
const GLdouble right = fVP.GetFrontHalfHeight (pnear, radius) * ratioY;
const GLdouble left = -right;
const GLdouble bottom = left;
const GLdouble top = right;
const GLdouble top = fVP.GetFrontHalfHeight (pnear, radius) * ratioX;
const GLdouble bottom = -top;
// FIXME
ResizeGLView();
@@ -291,7 +270,8 @@ void G4OpenGLViewer::SetView () {
// clipping in G4OpenGLSceneHandler::CreateSectionPolyhedron. Also,
// force kernel visit on change of clipping plane in
// G4OpenGLStoredViewer::CompareForKernelVisit.
if (fVP.IsSection () ) { // pair of back to back clip planes.
//if (fVP.IsSection () ) { // pair of back to back clip planes.
if (false) { // pair of back to back clip planes.
const G4Plane3D& s = fVP.GetSectionPlane ();
double sArray[4];
sArray[0] = s.a();
@@ -313,7 +293,8 @@ void G4OpenGLViewer::SetView () {
const G4Planes& cutaways = fVP.GetCutawayPlanes();
size_t nPlanes = cutaways.size();
if (fVP.IsCutaway() &&
//if (fVP.IsCutaway() &&
if (false &&
fVP.GetCutawayMode() == G4ViewParameters::cutawayIntersection &&
nPlanes > 0) {
double a[4];
@@ -404,14 +385,14 @@ void G4OpenGLViewer::Pick(GLdouble x, GLdouble y)
DrawView();
GLint hits = glRenderMode(GL_RENDER);
if (hits < 0)
G4cout << "Too many hits. Zoom in to reduce overlaps." << G4cout;
G4cout << "Too many hits. Zoom in to reduce overlaps." << G4endl;
else if (hits > 0) {
//G4cout << hits << " hit(s)" << G4endl;
GLuint* p = selectBuffer;
for (GLint i = 0; i < hits; ++i) {
GLuint nnames = *p++;
*p++; //OR GLuint zmin = *p++;
*p++; //OR GLuint zmax = *p++;
p++; //OR GLuint zmin = *p++;
p++; //OR GLuint zmax = *p++;
//G4cout << "Hit " << i << ": " << nnames << " names"
// << "\nzmin: " << zmin << ", zmax: " << zmax << G4endl;
for (GLuint j = 0; j < nnames; ++j) {
@@ -498,7 +479,8 @@ void G4OpenGLViewer::printEPS() {
// Change the LC_NUMERIC value in order to have "." separtor and not ","
// This case is only useful for French, Canadien...
char *oldLocale = strdup(setlocale(LC_NUMERIC,NULL));
char* oldLocale = (char*)(malloc(strlen(setlocale(LC_NUMERIC,NULL))+1));
if(oldLocale!=NULL) strcpy(oldLocale,setlocale(LC_NUMERIC,NULL));
setlocale(LC_NUMERIC,"C");
if (fVectoredPs) {
@@ -524,6 +506,9 @@ void G4OpenGLViewer::printEPS() {
fPrintFilenameIndex++;
}
#ifdef G4DEBUG_VIS_OGL
printf("G4OpenGLViewer::printEPS END\n");
#endif
}
bool G4OpenGLViewer::printVectoredEPS() {
@@ -536,7 +521,7 @@ bool G4OpenGLViewer::printNonVectoredEPS () {
int height = getRealPrintSizeY();
#ifdef G4DEBUG_VIS_OGL
printf("G4OpenGLViewer::printNonVectoredEPS file:%s Vec:%d X:%d Y:%d col:%d\n",getRealPrintFilename().c_str(),fVectoredPs,width,height,fPrintColour);
printf("G4OpenGLViewer::printNonVectoredEPS file:%s Vec:%d X:%d Y:%d col:%d fWinX:%d fWinY:%d\n",getRealPrintFilename().c_str(),fVectoredPs,width,height,fPrintColour,fWinSize_x,fWinSize_y);
#endif
FILE* fp;
GLubyte* pixels;
@@ -633,9 +618,20 @@ bool G4OpenGLViewer::printGl2PS() {
fWinSize_x = width;
fWinSize_y = height;
// Laurent G. 16/03/10 : Not the good way to do.
// We should draw in a new offscreen context instead of
// resizing and drawing in current window...
// This should be solve when we will do an offscreen method
// to render OpenGL
// See :
// http://developer.apple.com/Mac/library/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_offscreen/opengl_offscreen.html
// http://www.songho.ca/opengl/gl_fbo.html
ResizeGLView();
if (fGL2PSAction->enableFileWriting()) {
// Set the viewport
// fGL2PSAction->setViewport(0, 0, getRealPrintSizeX(),getRealPrintSizeY());
// By default, we choose the line width (trajectories...)
fGL2PSAction->setLineWidth(1);
// By default, we choose the point size (markers...)
@@ -648,6 +644,7 @@ bool G4OpenGLViewer::printGl2PS() {
fWinSize_x = X;
fWinSize_y = Y;
ResizeGLView();
DrawView ();
// Reset for next time (useful is size change)
// fPrintSizeX = 0;
@@ -674,8 +671,12 @@ G4int G4OpenGLViewer::getRealPrintSizeX() {
}
GLint dims[2];
glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
if (fPrintSizeX > dims[0]){
return dims[0];
// L.Garnier 01-2010: Some problems with mac 10.6
if ((dims[0] !=0 ) && (dims[1] !=0)) {
if (fPrintSizeX > dims[0]){
return dims[0];
}
}
if (fPrintSizeX < -1){
return 0;
@@ -689,8 +690,12 @@ G4int G4OpenGLViewer::getRealPrintSizeY() {
}
GLint dims[2];
glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
if (fPrintSizeY > dims[1]){
return dims[1];
// L.Garnier 01-2010: Some problems with mac 10.6
if ((dims[0] !=0 ) && (dims[1] !=0)) {
if (fPrintSizeY > dims[1]){
return dims[1];
}
}
if (fPrintSizeY < -1){
return 0;
@@ -731,6 +736,9 @@ std::string G4OpenGLViewer::getRealPrintFilename() {
GLdouble G4OpenGLViewer::getSceneNearWidth()
{
if (!fSceneHandler.GetScene()) {
return 0;
}
const G4Point3D targetPoint
= fSceneHandler.GetScene()->GetStandardTargetPoint()
+ fVP.GetCurrentTargetPoint ();
@@ -743,6 +751,9 @@ GLdouble G4OpenGLViewer::getSceneNearWidth()
GLdouble G4OpenGLViewer::getSceneFarWidth()
{
if (!fSceneHandler.GetScene()) {
return 0;
}
const G4Point3D targetPoint
= fSceneHandler.GetScene()->GetStandardTargetPoint()
+ fVP.GetCurrentTargetPoint ();
@@ -757,6 +768,9 @@ GLdouble G4OpenGLViewer::getSceneFarWidth()
GLdouble G4OpenGLViewer::getSceneDepth()
{
if (!fSceneHandler.GetScene()) {
return 0;
}
const G4Point3D targetPoint
= fSceneHandler.GetScene()->GetStandardTargetPoint()
+ fVP.GetCurrentTargetPoint ();
@@ -821,15 +835,6 @@ void G4OpenGLViewer::rotateScene(G4double dx, G4double dy,G4double deltaRotation
// to avoid z rotation flipping
// to allow more than 360° rotation
const G4Point3D targetPoint
= fSceneHandler.GetScene()->GetStandardTargetPoint()
+ fVP.GetCurrentTargetPoint ();
G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
if(radius<=0.) radius = 1.;
const G4double cameraDistance = fVP.GetCameraDistance (radius);
const G4Point3D cameraPosition =
targetPoint + cameraDistance * fVP.GetViewpointDirection().unit();
if (fVP.GetLightsMoveWithCamera()) {
new_up = (new_vp.cross(yprime)).unit();
if (new_vp.z()*vp.z() <0) {
@@ -861,4 +866,53 @@ void G4OpenGLViewer::rotateScene(G4double dx, G4double dy,G4double deltaRotation
fVP.SetViewAndLights (viewPoint);
}
void G4OpenGLViewer::rotateSceneInViewDirection(G4double dx, G4double dy,G4double deltaRotation)
{
if (!fSceneHandler.GetScene()) {
return;
}
G4Vector3D vp;
G4Vector3D up;
G4Vector3D xprime;
G4Vector3D yprime;
G4Vector3D zprime;
G4Vector3D new_vp;
G4Vector3D new_up;
G4Vector3D a1;
G4Vector3D a2;
G4Vector3D delta;
G4Vector3D viewPoint;
//phi spin stuff here
#ifdef G4DEBUG_VIS_OGL
printf("G4OpenGLViewer::rotateScene dx:%f dy:%f delta:%f\n",dx,dy, deltaRotation);
#endif
vp = fVP.GetViewpointDirection ().unit();
up = fVP.GetUpVector ().unit();
G4Vector3D zPrimeVector = G4Vector3D(up.y()*vp.z()-up.z()*vp.y(),
up.z()*vp.x()-up.x()*vp.z(),
up.x()*vp.y()-up.y()*vp.x());
viewPoint = vp/deltaRotation + (zPrimeVector*dx - up*dy) ;
new_up = G4Vector3D(viewPoint.y()*zPrimeVector.z()-viewPoint.z()*zPrimeVector.y(),
viewPoint.z()*zPrimeVector.x()-viewPoint.x()*zPrimeVector.z(),
viewPoint.x()*zPrimeVector.y()-viewPoint.y()*zPrimeVector.x());
G4Vector3D new_upUnit = new_up.unit();
fVP.SetUpVector(new_upUnit);
fVP.SetViewAndLights (viewPoint);
}
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLViewerMessenger.cc,v 1.18 2009/05/14 16:38:23 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenGLViewerMessenger.cc,v 1.21 2010/11/07 10:31:26 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
#ifdef G4VIS_BUILD_OPENGL_DRIVER
@@ -40,6 +40,7 @@
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4VisManager.hh"
#include <sstream>
@@ -178,6 +179,14 @@ G4OpenGLViewerMessenger::G4OpenGLViewerMessenger()
parameter->SetDefaultValue(0.);
fpCommandDisplayLightFront->SetParameter(parameter);
fpCommandDisplayListLimit =
new G4UIcmdWithAnInteger("/vis/ogl/set/displayListLimit", this);
fpCommandDisplayListLimit->SetGuidance
("Set/reset display list limit (to avoid memory exhaustion).");
fpCommandDisplayListLimit->SetParameterName("limit", omitable = true);
fpCommandDisplayListLimit->SetDefaultValue(50000);
fpCommandDisplayListLimit->SetRange("limit>=10000");
fpCommandEndTime =
new G4UIcommand("/vis/ogl/set/endTime", this);
fpCommandEndTime->SetGuidance("Set end and range of track time.");
@@ -240,6 +249,7 @@ G4OpenGLViewerMessenger::~G4OpenGLViewerMessenger ()
delete fpCommandStartTime;
delete fpCommandFade;
delete fpCommandEndTime;
delete fpCommandDisplayListLimit;
delete fpCommandDisplayLightFront;
delete fpCommandDisplayHeadTime;
delete fpDirectorySet;
@@ -269,7 +279,9 @@ void G4OpenGLViewerMessenger::SetNewValue
if (!pOGLViewer) {
G4cout <<
"G4OpenGLViewerMessenger::SetNewValue: Current viewer is not of type"
"\n OGL. Use \"/vis/viewer/select\" or \"/vis/open\"."
"\n OGL. (It is \""
<< pViewer->GetName() <<
"\".)\n Use \"/vis/viewer/select\" or \"/vis/open\"."
<< G4endl;
return;
}
@@ -321,8 +333,9 @@ void G4OpenGLViewerMessenger::SetNewValue
{
G4cout <<
"G4OpenGLViewerMessenger::SetNewValue: Current viewer is not of type OGLS."
"\n The time slice viewing feature is only implemented for OGL Stored"
"\n viewers at present. Use \"/vis/viewer/select\" or \"/vis/open OGLS...\"."
"\n (It is \"" << pViewer->GetName() << "\".)"
"\n This feature is only implemented for OGL Stored viewers."
"\n Use \"/vis/viewer/select\" or \"/vis/open OGLS...\"."
<< G4endl;
return;
}
@@ -413,6 +426,52 @@ void G4OpenGLViewerMessenger::SetNewValue
return;
}
G4VSceneHandler* pSceneHandler = pViewer->GetSceneHandler();
if (!pSceneHandler) {
G4cout <<
"G4OpenGLViewerMessenger::SetNewValue: This viewer has no scene handler."
"\n Shouldn't happen - please report circumstances."
"\n (Viewer is \"" << pViewer->GetName() << "\".)"
"\n Try \"/vis/open\", or similar, to get one."
<< G4endl;
return;
}
G4OpenGLSceneHandler* pOGLSceneHandler =
dynamic_cast<G4OpenGLSceneHandler*>(pSceneHandler);
if (!pOGLSceneHandler) {
G4cout <<
"G4OpenGLViewerMessenger::SetNewValue: Current scene handler is not of type"
"\n OGL. (Viewer is \"" << pViewer->GetName() << "\".)"
"\n (Scene handler is \"" << pSceneHandler->GetName() << "\".)"
"\n Use \"/vis/sceneHandler/list\" and \"/vis/sceneHandler/select\""
"\n or \"/vis/open\"."
<< G4endl;
return;
}
G4OpenGLStoredSceneHandler* pOGLSSceneHandler =
dynamic_cast<G4OpenGLStoredSceneHandler*>(pViewer->GetSceneHandler());
if (!pOGLSSceneHandler) {
G4cout <<
"G4OpenGLViewerMessenger::SetNewValue: Current scene handler is not of type"
"\n OGLS (Stored). (Viewer is \"" << pViewer->GetName() << "\".)"
"\n (Scene handler is \"" << pSceneHandler->GetName() << "\".)"
"\n This feature is only implemented for OGL Stored"
"\n scene handlers. Use \"/vis/viewer/select\" or \"/vis/open OGLS...\"."
<< G4endl;
return;
}
if (command == fpCommandDisplayListLimit)
{
G4int displayListLimit =
fpCommandDisplayListLimit->GetNewIntValue(newValue);
pOGLSSceneHandler->SetDisplayListLimit(displayListLimit);
}
}
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLXViewer.cc,v 1.55 2009/05/13 10:28:00 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenGLXViewer.cc,v 1.56 2010/11/10 17:57:16 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
// Andrew Walkden 7th February 1997
@@ -49,6 +49,7 @@
#include "G4Point3D.hh"
#include "G4Normal3D.hh"
#include "G4StateManager.hh"
#include "G4VisManager.hh"
#include <X11/Xatom.h>
#include <X11/Xutil.h>
@@ -196,24 +197,28 @@ void G4OpenGLXViewer::CreateGLXContext (XVisualInfo* v) {
}
if (!cmap) {
fViewId = -1; // This flags an error.
G4cerr <<
"G4OpenGLViewer::G4OpenGLViewer failed to allocate a standard colormap."
<< G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cerr <<
"G4OpenGLViewer::G4OpenGLViewer failed to allocate a standard colormap."
<< G4endl;
return;
}
G4cout << "Got standard cmap" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::confirmations)
G4cout << "Got standard cmap" << G4endl;
} else {
cmap = XCreateColormap (dpy,
XRootWindow(dpy, vi -> screen),
vi -> visual,
AllocNone);
G4cout << "Created own cmap" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::confirmations)
G4cout << "Created own cmap" << G4endl;
}
if (!cmap) {
fViewId = -1; // This flags an error.
G4cerr << "G4OpenGLViewer::G4OpenGLViewer failed to allocate a Colormap."
<< G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "G4OpenGLViewer::G4OpenGLViewer failed to allocate a Colormap."
<< G4endl;
return;
}
@@ -249,7 +254,8 @@ void G4OpenGLXViewer::CreateMainWindow () {
} else if ((!fVP.IsWindowSizeHintX ()) && fVP.IsWindowLocationHintX () && fVP.IsWindowLocationHintY ()) {
size_hints->flags |= PPosition;
}
G4cout << "Window name: " << fName << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::confirmations)
G4cout << "Window name: " << fName << G4endl;
strncpy (charViewName, fName, 100);
char *window_name = charViewName;
char *icon_name = charViewName;
@@ -0,0 +1,20 @@
#------------------------------------------------------------------------------
# CMakeLists.txt
# Module : G4OpenInventor
# Package: Geant4.src.G4visualization.G4OpenInventor
#
# CMakeLists.txt for single level library that may be build global or granular
#
# Generated on : 24/9/2010
#
# $Id: CMakeLists.txt,v 1.1 2010/09/29 19:12:22 bmorgan Exp $
#
#------------------------------------------------------------------------------
include(Geant4MacroLibraryTargets)
if(GEANT4_BUILD_GRANULAR_LIBS)
GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
else()
GEANT4_GLOBAL_LIBRARY_TARGET(COMPONENTS sources.cmake)
endif()
+14 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.104 2009/11/17 17:47:49 allison Exp $
$Id: History,v 1.108 2010/11/10 17:53:22 allison Exp $
-------------------------------------------------------------------
=========================================================
@@ -20,6 +20,19 @@ committal in the CVS repository !
History file for visualization/OpenInventor
-------------------------------------------
10th November 2010 John Allison (openinventor-V09-03-02)
- G4OpenInventor*Viewer.cc:
o Protected output with G4VisManager::confirmations.
6th October 2010 John Allison (openinventor-V09-03-01)
- G4OpenInventorViewer.cc:
o Added default colour and default text colour to list of parameters
that trigger a kernel visit.
26th May 2010 John Allison (openinventor-V09-03-00)
- G4OpenInventorWin.cc, G4OpenInventorXt.cc: Protection against
repeated initialisation.
17th November 2009 John Allison (openinventor-V09-02-03)
- Tagged for vis tag.
@@ -0,0 +1,112 @@
#------------------------------------------------------------------------------
# sources.cmake
# Module : G4OpenInventor
# Package: Geant4.src.G4visualization.G4OpenInventor
#
# Sources description for a library.
# Lists the sources and headers of the code explicitely.
# Lists include paths needed.
# Lists the internal granular and global dependencies of the library.
# Source specific properties should be added at the end.
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake,v 1.1 2010/09/29 19:12:30 bmorgan Exp $
#
#------------------------------------------------------------------------------
# List external includes needed.
include_directories(${CLHEP_INCLUDE_DIRS})
# List internal includes needed.
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/hits/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/solids/CSG/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/solids/specific/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPGeometry/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPRandom/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/graphics_reps/include)
include_directories(${CMAKE_SOURCE_DIR}/source/intercoms/include)
include_directories(${CMAKE_SOURCE_DIR}/source/interfaces/common/include)
include_directories(${CMAKE_SOURCE_DIR}/source/materials/include)
include_directories(${CMAKE_SOURCE_DIR}/source/tracking/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/externals/gl2ps/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/modeling/include)
#
# Define the Geant4 Module.
#
include(Geant4MacroDefineModule)
GEANT4_DEFINE_MODULE(NAME G4OpenInventor
HEADERS
G4OpenInventor.hh
G4OpenInventorSceneHandler.hh
G4OpenInventorTransform3D.hh
G4OpenInventorViewer.hh
G4OpenInventorWin.hh
G4OpenInventorWin32.hh
G4OpenInventorWinViewer.hh
G4OpenInventorX.hh
G4OpenInventorXt.hh
G4OpenInventorXtViewer.hh
Geant4_SoPolyhedron.h
SoG4LineSet.h
SoG4MarkerSet.h
SoG4Polyhedron.h
SOURCES
G4OpenInventor.cc
G4OpenInventorSceneHandler.cc
G4OpenInventorTransform3D.cc
G4OpenInventorViewer.cc
G4OpenInventorWin.cc
G4OpenInventorWinViewer.cc
G4OpenInventorXt.cc
G4OpenInventorXtViewer.cc
SbPainter.cc
SbPainterPS.cc
SoAlternateRepAction.cc
SoBox.cc
SoCons.cc
SoCounterAction.cc
SoDetectorTreeKit.cc
SoGL2PSAction.cc
SoImageWriter.cc
SoMarkerSet.cc
SoPolyhedron.cc
SoStyleCache.cc
SoTrap.cc
SoTrd.cc
SoTubs.cc
GRANULAR_DEPENDENCIES
G4UIcommon
G4csg
G4geometrymng
G4gl2ps
G4globman
G4graphics_reps
G4hits
G4intercoms
G4materials
G4modeling
G4specsolids
G4tracking
G4vis_management
GLOBAL_DEPENDENCIES
G4digits_hits
G4geometry
G4gl2ps
G4global
G4graphics_reps
G4intercoms
G4interfaces
G4materials
G4modeling
G4tracking
G4vis_management
LINK_LIBRARIES
)
# List any source specific properties here
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4OpenInventorViewer.cc,v 1.60 2009/02/16 15:31:05 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenInventorViewer.cc,v 1.61 2010/10/06 10:09:57 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
#ifdef G4VIS_BUILD_OI_DRIVER
@@ -176,6 +176,10 @@ G4bool G4OpenInventorViewer::CompareForKernelVisit(G4ViewParameters& vp) {
(vp.IsExplode () != fVP.IsExplode ()) ||
(vp.GetNoOfSides () != fVP.GetNoOfSides ()) ||
(vp.IsMarkerNotHidden () != fVP.IsMarkerNotHidden ()) ||
(vp.GetDefaultVisAttributes()->GetColour() !=
fVP.GetDefaultVisAttributes()->GetColour()) ||
(vp.GetDefaultTextVisAttributes()->GetColour() !=
fVP.GetDefaultTextVisAttributes()->GetColour()) ||
(vp.GetBackgroundColour ()!= fVP.GetBackgroundColour ())||
(vp.IsPicking () != fVP.IsPicking ()) ||
// Scaling for Open Inventor is done by the scene handler so it
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenInventorWin.cc,v 1.7 2009/09/18 12:48:43 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenInventorWin.cc,v 1.8 2010/05/26 14:30:46 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
// OpenInventor graphics system factory.
@@ -57,7 +57,7 @@ void G4OpenInventorWin::Initialize ()
HWND toplevel = (HWND)GetInteractorManager()->GetMainInteractor();
SoWin::init(toplevel);
if(!SoWin::getTopLevelWidget()) SoWin::init(toplevel);
InitNodes();
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenInventorWinViewer.cc,v 1.26 2009/09/18 12:48:43 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenInventorWinViewer.cc,v 1.27 2010/11/10 17:53:22 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
/*
* jck : 05 Feb 1997 : Initial Implementation
@@ -51,6 +51,7 @@
#include "G4OpenInventor.hh"
#include "G4OpenInventorSceneHandler.hh"
#include "G4VInteractorManager.hh"
#include "G4VisManager.hh"
#include <windowsx.h>
@@ -94,8 +95,8 @@ G4OpenInventorWinViewer::G4OpenInventorWinViewer(
,fShell(0)
,fViewer(0)
{
G4cout << "Window name: " << fName << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::confirmations)
G4cout << "Window name: " << fName << G4endl;
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenInventorXt.cc,v 1.4 2006/06/29 21:22:24 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4OpenInventorXt.cc,v 1.5 2010/05/26 14:30:46 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
// Jeff Kallenbach 01 Aug 1996
@@ -80,7 +80,7 @@ void G4OpenInventorXt::Initialize()
}
}
SoXt::init(top);
if(!SoXt::getTopLevelWidget()) SoXt::init(top);
InitNodes();
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenInventorXtViewer.cc,v 1.25 2009/09/18 12:48:43 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenInventorXtViewer.cc,v 1.26 2010/11/10 17:53:22 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
/*
* jck 05 Feb 1997 - Initial Implementation
@@ -64,6 +64,7 @@
#include "G4OpenInventor.hh"
#include "G4OpenInventorSceneHandler.hh"
#include "G4VInteractorManager.hh"
#include "G4VisManager.hh"
G4OpenInventorXtViewer::G4OpenInventorXtViewer(
G4OpenInventorSceneHandler& sceneHandler
@@ -74,7 +75,8 @@ G4OpenInventorXtViewer::G4OpenInventorXtViewer(
,fHelpForm(0)
,fHelpText(0)
{
G4cout << "Window name: " << fName << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::confirmations)
G4cout << "Window name: " << fName << G4endl;
}
@@ -0,0 +1,20 @@
#------------------------------------------------------------------------------
# CMakeLists.txt
# Module : G4RayTracer
# Package: Geant4.src.G4visualization.G4RayTracer
#
# CMakeLists.txt for single level library that may be build global or granular
#
# Generated on : 24/9/2010
#
# $Id: CMakeLists.txt,v 1.1 2010/09/29 19:12:38 bmorgan Exp $
#
#------------------------------------------------------------------------------
include(Geant4MacroLibraryTargets)
if(GEANT4_BUILD_GRANULAR_LIBS)
GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
else()
GEANT4_GLOBAL_LIBRARY_TARGET(COMPONENTS sources.cmake)
endif()
+1 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.11 2005/11/18 23:07:04 allison Exp $
# $Id: GNUmakefile,v 1.13 2010/10/27 08:00:36 gcosmo Exp $
name := G4RayTracer
+18 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.60 2009/11/15 12:33:54 allison Exp $
$Id: History,v 1.66 2010/10/27 08:00:36 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -24,6 +24,23 @@ committal in the CVS repository !
History file for Ray Tracer category
---------------------------------------
27th October 2010 Gabriele Cosmo (raytracer-V09-03-04)
- Restored DLL setup as originally. Withdrawn changes in last tag.
19th October 2010 Gabriele Cosmo (raytracer-V09-03-03)
- Replaced G4VIS_ALLOC_EXPORT flag with G4ALLOC_EXPORT for DLL exported
symbols.
14th June 2010 Gabriele Cosmo (raytracer-V09-03-02)
- Added missing virtual destructor to G4VRTScanner, G4RTXScanner and
G4RTSimpleScanner.
30th May 2010 John Allison (raytracer-V09-03-01)
- G4RayTracerSceneHandler: Added AddCompound(const G4VDigi&).
29th May 2010 John Allison (raytracer-V09-03-00)
- G4RayTrajectory.hh: Added DrawTrajectory() ready for i_mode migration.
15th November 2009 John Allison (raytracer-V09-02-02)
- Formal tag to record fixing of bugzilla Problem 1072.
o There is no change of source code.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4RTSimpleScanner.hh,v 1.3 2006/06/29 21:23:25 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4RTSimpleScanner.hh,v 1.4 2010/06/14 14:33:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
@@ -44,9 +44,9 @@ class G4RTSimpleScanner: public G4VRTScanner {
public: // with description
G4RTSimpleScanner();
virtual ~G4RTSimpleScanner();
// Compiler defaults for destructor, copy constructor and
// assignmemt.
// Compiler defaults for copy constructor and assignmemt.
virtual const G4String& GetGSName() const;
// Get name that acts as graphics system name.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4RTXScanner.hh,v 1.4 2006/06/29 21:23:31 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4RTXScanner.hh,v 1.5 2010/06/14 14:33:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
@@ -52,9 +52,9 @@ class G4RTXScanner: public G4VRTScanner {
public: // with description
G4RTXScanner();
virtual ~G4RTXScanner();
// Compiler defaults for destructor, copy constructor and
// assignmemt.
// Compiler defaults for copy constructor and assignmemt.
virtual const G4String& GetGSName() const;
// Get name that acts as graphics system name.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4RayTracerSceneHandler.hh,v 1.12 2009/10/21 15:24:53 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4RayTracerSceneHandler.hh,v 1.13 2010/05/30 10:21:25 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
// John Allison 17th March 2000
@@ -64,6 +64,7 @@ public:
void AddSolid(const G4VSolid&){}
void AddCompound(const G4VTrajectory&){}
void AddCompound(const G4VHit&){}
void AddCompound(const G4VDigi&){}
void AddCompound(const G4THitsMap<G4double>&) {}
private:
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4RayTrajectory.hh,v 1.15 2006/06/29 21:23:45 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4RayTrajectory.hh,v 1.16 2010/05/29 21:09:40 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
@@ -69,6 +69,7 @@ class G4RayTrajectory : public G4VTrajectory
virtual void AppendStep(const G4Step*);
virtual void ShowTrajectory(std::ostream&) const;
virtual void DrawTrajectory() const {;}
virtual void DrawTrajectory(G4int) const {;}
virtual int GetPointEntries() const {return positionRecord->size();}
virtual G4VTrajectoryPoint* GetPoint(G4int i) const
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VRTScanner.hh,v 1.5 2006/06/29 21:23:53 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VRTScanner.hh,v 1.6 2010/06/14 14:33:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
@@ -43,6 +43,9 @@ class G4VRTScanner {
public: // with description
G4VRTScanner();
virtual ~G4VRTScanner();
virtual const G4String& GetGSName() const = 0;
// Get name that acts as graphics system name.
@@ -65,8 +68,7 @@ public: // with description
};
inline void G4VRTScanner::Draw
(unsigned char, unsigned char, unsigned char)
{}
inline
void G4VRTScanner::Draw(unsigned char, unsigned char, unsigned char) {}
#endif
@@ -0,0 +1,155 @@
#------------------------------------------------------------------------------
# sources.cmake
# Module : G4RayTracer
# Package: Geant4.src.G4visualization.G4RayTracer
#
# Sources description for a library.
# Lists the sources and headers of the code explicitely.
# Lists include paths needed.
# Lists the internal granular and global dependencies of the library.
# Source specific properties should be added at the end.
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake,v 1.1 2010/09/29 19:12:47 bmorgan Exp $
#
#------------------------------------------------------------------------------
# List external includes needed.
include_directories(${CLHEP_INCLUDE_DIRS})
# List internal includes needed.
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/detector/include)
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/digits/include)
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/hits/include)
include_directories(${CMAKE_SOURCE_DIR}/source/event/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/navigation/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/volumes/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPGeometry/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPRandom/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/graphics_reps/include)
include_directories(${CMAKE_SOURCE_DIR}/source/intercoms/include)
include_directories(${CMAKE_SOURCE_DIR}/source/materials/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/bosons/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/cuts/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/track/include)
include_directories(${CMAKE_SOURCE_DIR}/source/tracking/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/modeling/include)
#
# Module has optional sources
#
# List those always built
set(G4VIS_RAYTRACER_MODULE_HEADERS
G4RTJpeg.hh
G4RTJpegCoder.hh
G4RTJpegCoderTables.hh
G4RTJpegMaker.hh
G4RTMessenger.hh
G4RTOutBitStream.hh
G4RTSimpleScanner.hh
G4RTSteppingAction.hh
G4RTTrackingAction.hh
G4RayTracer.hh
G4RayTracerFeatures.hh
G4RayTracerSceneHandler.hh
G4RayTracerViewer.hh
G4RayTrajectory.hh
G4RayTrajectoryPoint.hh
G4TheRayTracer.hh
G4VFigureFileMaker.hh
G4VRTScanner.hh)
set(G4VIS_RAYTRACER_MODULE_SOURCES
G4RTJpegCoder.cc
G4RTJpegMaker.cc
G4RTMessenger.cc
G4RTOutBitStream.cc
G4RTSimpleScanner.cc
G4RTSteppingAction.cc
G4RTTrackingAction.cc
G4RayTracer.cc
G4RayTracerSceneHandler.cc
G4RayTracerViewer.cc
G4RayTrajectory.cc
G4RayTrajectoryPoint.cc
G4TheRayTracer.cc
G4VRTScanner.cc)
set(G4VIS_RAYTRACER_MODULE_LINK_LIBRARIES )
#
# X11 RayTracer only if selected
#
if(GEANT4_USE_RAYTRACERX)
list(APPEND G4VIS_RAYTRACER_MODULE_HEADERS
G4RayTracerX.hh
G4RayTracerXViewer.hh
G4RTXScanner.hh)
list(APPEND G4VIS_RAYTRACER_MODULE_SOURCES
G4RayTracerX.cc
G4RayTracerXViewer.cc
G4RTXScanner.cc)
#
# Add source properties and additional LINK_LIBRARIES here
#
endif()
#
# Define the Geant4 Module.
#
include(Geant4MacroDefineModule)
GEANT4_DEFINE_MODULE(NAME G4RayTracer
HEADERS
${G4VIS_RAYTRACER_MODULE_HEADERS}
SOURCES
${G4VIS_RAYTRACER_MODULE_SOURCES}
GRANULAR_DEPENDENCIES
G4bosons
G4cuts
G4detector
G4digits
G4event
G4geometrymng
G4globman
G4graphics_reps
G4hits
G4intercoms
G4materials
G4modeling
G4navigation
G4partman
G4procman
G4track
G4tracking
G4vis_management
G4volumes
GLOBAL_DEPENDENCIES
G4digits_hits
G4event
G4geometry
G4global
G4graphics_reps
G4intercoms
G4materials
G4modeling
G4particles
G4processes
G4track
G4tracking
G4vis_management
LINK_LIBRARIES
${G4VIS_RAYTRACER_MODULE_LINK_LIBRARIES}
)
# List any source specific properties here
@@ -24,20 +24,22 @@
// ********************************************************************
//
//
// $Id: G4RTSimpleScanner.cc,v 1.4 2007/05/22 17:10:42 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4RTSimpleScanner.cc,v 1.5 2010/06/14 14:33:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
#include "G4RTSimpleScanner.hh"
G4RTSimpleScanner::G4RTSimpleScanner():
theNRow(0), theNColumn(0), theIRow(0), theIColumn(0)
G4VRTScanner(), theNRow(0), theNColumn(0), theIRow(0), theIColumn(0)
{
theGSName = "RayTracer";
theGSNickname = "RayTracer";
}
G4RTSimpleScanner::~G4RTSimpleScanner(){}
const G4String& G4RTSimpleScanner::GetGSName() const
{return theGSName;}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4RTXScanner.cc,v 1.7 2009/09/16 16:56:52 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4RTXScanner.cc,v 1.8 2010/06/14 14:33:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
@@ -47,12 +47,14 @@ extern "C" {
}
G4RTXScanner::G4RTXScanner():
theNRow(0), theNColumn(0), theIRow(0), theIColumn(0)
G4VRTScanner(), theNRow(0), theNColumn(0), theIRow(0), theIColumn(0)
{
theGSName = "RayTracerX";
theGSNickname = "RayTracerX";
}
G4RTXScanner::~G4RTXScanner() {}
const G4String& G4RTXScanner::GetGSName() const
{return theGSName;}
@@ -0,0 +1,35 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: G4VRTScanner.cc,v 1.1 2010/06/14 14:33:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
#include "G4VRTScanner.hh"
G4VRTScanner::G4VRTScanner() {}
G4VRTScanner::~G4VRTScanner() {}
+20
View File
@@ -0,0 +1,20 @@
#------------------------------------------------------------------------------
# CMakeLists.txt
# Module : G4Tree
# Package: Geant4.src.G4visualization.G4Tree
#
# CMakeLists.txt for single level library that may be build global or granular
#
# Generated on : 24/9/2010
#
# $Id: CMakeLists.txt,v 1.1 2010/09/29 19:12:55 bmorgan Exp $
#
#------------------------------------------------------------------------------
include(Geant4MacroLibraryTargets)
if(GEANT4_BUILD_GRANULAR_LIBS)
GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
else()
GEANT4_GLOBAL_LIBRARY_TARGET(COMPONENTS sources.cmake)
endif()
+4 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.30 2007/03/27 15:11:43 allison Exp $
$Id: History,v 1.31 2010/11/13 11:26:01 allison Exp $
-------------------------------------------------------------------
=========================================================
@@ -24,6 +24,9 @@ committal in the CVS repository !
History file for visualization/Tree sub-category
------------------------------------------------
13th November 2010 John Allison (vistree-V09-03-00)
- Tagged inclusion of CMake stuff.
25th March 2007 John Allison (vistree-V08-02-01)
- Removed GAGTree.
+92
View File
@@ -0,0 +1,92 @@
#------------------------------------------------------------------------------
# sources.cmake
# Module : G4Tree
# Package: Geant4.src.G4visualization.G4Tree
#
# Sources description for a library.
# Lists the sources and headers of the code explicitely.
# Lists include paths needed.
# Lists the internal granular and global dependencies of the library.
# Source specific properties should be added at the end.
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake,v 1.1 2010/09/29 19:13:03 bmorgan Exp $
#
#------------------------------------------------------------------------------
# List external includes needed.
include_directories(${CLHEP_INCLUDE_DIRS})
# List internal includes needed.
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/detector/include)
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/hits/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/navigation/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/solids/CSG/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/solids/specific/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/volumes/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPGeometry/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/graphics_reps/include)
include_directories(${CMAKE_SOURCE_DIR}/source/intercoms/include)
include_directories(${CMAKE_SOURCE_DIR}/source/materials/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/track/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/modeling/include)
#
# Define the Geant4 Module.
#
include(Geant4MacroDefineModule)
GEANT4_DEFINE_MODULE(NAME G4Tree
HEADERS
G4ASCIITree.hh
G4ASCIITreeMessenger.hh
G4ASCIITreeSceneHandler.hh
G4ASCIITreeViewer.hh
G4VTree.hh
G4VTreeSceneHandler.hh
G4VTreeSceneHandler.icc
G4VTreeViewer.hh
SOURCES
G4ASCIITree.cc
G4ASCIITreeMessenger.cc
G4ASCIITreeSceneHandler.cc
G4ASCIITreeViewer.cc
G4VTree.cc
G4VTreeSceneHandler.cc
G4VTreeViewer.cc
GRANULAR_DEPENDENCIES
G4csg
G4detector
G4geometrymng
G4globman
G4graphics_reps
G4hits
G4intercoms
G4materials
G4modeling
G4navigation
G4partman
G4specsolids
G4track
G4vis_management
G4volumes
GLOBAL_DEPENDENCIES
G4digits_hits
G4geometry
G4global
G4graphics_reps
G4intercoms
G4materials
G4modeling
G4particles
G4track
G4vis_management
LINK_LIBRARIES
)
# List any source specific properties here
+20
View File
@@ -0,0 +1,20 @@
#------------------------------------------------------------------------------
# CMakeLists.txt
# Module : G4VRML
# Package: Geant4.src.G4visualization.G4VRML
#
# CMakeLists.txt for single level library that may be build global or granular
#
# Generated on : 24/9/2010
#
# $Id: CMakeLists.txt,v 1.1 2010/09/29 19:13:11 bmorgan Exp $
#
#------------------------------------------------------------------------------
include(Geant4MacroLibraryTargets)
if(GEANT4_BUILD_GRANULAR_LIBS)
GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
else()
GEANT4_GLOBAL_LIBRARY_TARGET(COMPONENTS sources.cmake)
endif()
+8 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.17 2009/10/21 15:27:21 allison Exp $
$Id: History,v 1.21 2010/11/11 00:48:34 akimura Exp $
-------------------------------------------------------------------
=========================================================
@@ -20,6 +20,13 @@ committal in the CVS repository !
History file for visualization/VRML sub-category
------------------------------------------------
11 November 2010 Akinori Kimura (VRML-V09-03-01)
- Replaced G4cerr with G4cout and added the following line before G4cout.
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
30th May 2010 John Allison (VRML-V09-03-00)
- G4VRML[1/2][File}SceneHandler: Added AddCompound(const G4VDigi&).
21st October 2009 John Allison (VRML-V09-02-01 coworks greps-V09-02-02)
- Added AddCompound (const G4THitsMap<G4double>&) methods.
o Prevents warnings about hiding - calls G4VSceneHandler base class.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VRML1FileSceneHandler.hh,v 1.18 2009/10/21 15:27:21 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4VRML1FileSceneHandler.hh,v 1.19 2010/05/30 10:14:39 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
// G4VRML1FileSceneHandler.hh
// Satoshi Tanaka & Yasuhide Sawada
@@ -72,6 +72,9 @@ public:
void AddCompound ( const G4VHit& hit) {
G4VSceneHandler::AddCompound(hit);
}
void AddCompound ( const G4VDigi& digi) {
G4VSceneHandler::AddCompound(digi);
}
void AddCompound ( const G4THitsMap<G4double> & hits) {
G4VSceneHandler::AddCompound(hits);
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VRML1SceneHandler.hh,v 1.15 2009/10/21 15:27:21 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4VRML1SceneHandler.hh,v 1.16 2010/05/30 10:08:32 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
// G4VRML1SceneHandler.hh
// Yasuhide Sawada & Satoshi Tanaka
@@ -77,6 +77,9 @@ public:
void AddCompound ( const G4VHit& hit) {
G4VSceneHandler::AddCompound(hit);
}
void AddCompound ( const G4VDigi& digi) {
G4VSceneHandler::AddCompound(digi);
}
void AddCompound ( const G4THitsMap<G4double> & hits) {
G4VSceneHandler::AddCompound(hits);
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VRML2FileSceneHandler.hh,v 1.17 2009/10/21 15:27:21 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4VRML2FileSceneHandler.hh,v 1.18 2010/05/30 10:14:39 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
// G4VRML2FileSceneHandler.hh
// Satoshi Tanaka & Yasuhide Sawada
@@ -72,6 +72,9 @@ public:
void AddCompound ( const G4VHit& hit) {
G4VSceneHandler::AddCompound(hit);
}
void AddCompound ( const G4VDigi& digi) {
G4VSceneHandler::AddCompound(digi);
}
void AddCompound ( const G4THitsMap<G4double> & hits) {
G4VSceneHandler::AddCompound(hits);
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VRML2SceneHandler.hh,v 1.14 2009/10/21 15:27:21 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4VRML2SceneHandler.hh,v 1.15 2010/05/30 10:08:32 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
// G4VRML2SceneHandler.hh
// Satoshi Tanaka & Yasuhide Sawada
@@ -75,6 +75,9 @@ public:
void AddCompound ( const G4VHit& hit) {
G4VSceneHandler::AddCompound(hit);
}
void AddCompound ( const G4VDigi& digi) {
G4VSceneHandler::AddCompound(digi);
}
void AddCompound ( const G4THitsMap<G4double> & hits) {
G4VSceneHandler::AddCompound(hits);
}
+121
View File
@@ -0,0 +1,121 @@
#------------------------------------------------------------------------------
# sources.cmake
# Module : G4VRML
# Package: Geant4.src.G4visualization.G4VRML
#
# Sources description for a library.
# Lists the sources and headers of the code explicitely.
# Lists include paths needed.
# Lists the internal granular and global dependencies of the library.
# Source specific properties should be added at the end.
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake,v 1.2 2010/11/23 20:40:23 bmorgan Exp $
#
#------------------------------------------------------------------------------
# List external includes needed.
include_directories(${CLHEP_INCLUDE_DIRS})
# List internal includes needed.
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/hits/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/solids/CSG/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/solids/specific/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPGeometry/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/graphics_reps/include)
include_directories(${CMAKE_SOURCE_DIR}/source/intercoms/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/modeling/include)
#
# Module has optional sources
#
include(Geant4MacroDefineModule)
# List those always built
set(G4VIS_VRML_MODULE_HEADERS
G4VRML1File.hh
G4VRML1FileSceneHandler.hh
G4VRML1FileViewer.hh
G4VRML2File.hh
G4VRML2FileSceneHandler.hh
G4VRML2FileViewer.hh)
set(G4VIS_VRML_MODULE_SOURCES
G4VRML1File.cc
G4VRML1FileSceneHandler.cc
G4VRML1FileViewer.cc
G4VRML1SceneHandlerFunc.icc
G4VRML2File.cc
G4VRML2FileSceneHandler.cc
G4VRML2FileViewer.cc
G4VRML2SceneHandlerFunc.icc)
#
# VRML Network drivers only if user selected
#
if(GEANT4_USE_NETWORKVRML)
list(APPEND G4VIS_VRML_MODULE_HEADERS
FRClient.h
G4FRClient.hh
G4VRML1.hh
G4VRML1SceneHandler.hh
G4VRML1Viewer.hh
G4VRML2.hh
G4VRML2SceneHandler.hh
G4VRML2Viewer.hh
G4VRMLNetConfig.hh)
list(APPEND G4VIS_VRML_MODULE_SOURCES
FRClient.cc
G4FRClient.cc
G4VRML1.cc
G4VRML1SceneHandler.cc
G4VRML1Viewer.cc
G4VRML2.cc
G4VRML2SceneHandler.cc
G4VRML2Viewer.cc)
#
# Add extra needed defs here
#
GEANT4_ADD_COMPILE_DEFINITIONS(SOURCES ${G4VIS_VRML_MODULE_SOURCES}
COMPILE_DEFINITIONS G4VIS_BUILD_VRML_DRIVER)
endif()
#
# Define the Geant4 Module.
#
GEANT4_DEFINE_MODULE(NAME G4VRML
HEADERS
${G4VIS_VRML_MODULE_HEADERS}
SOURCES
${G4VIS_VRML_MODULE_SOURCES}
GRANULAR_DEPENDENCIES
G4csg
G4geometrymng
G4globman
G4graphics_reps
G4hits
G4intercoms
G4modeling
G4specsolids
G4vis_management
GLOBAL_DEPENDENCIES
G4digits_hits
G4geometry
G4global
G4graphics_reps
G4intercoms
G4modeling
G4vis_management
LINK_LIBRARIES
)
# List any source specific properties here
+6 -4
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: FRClient.cc,v 1.7 2006/06/29 21:25:49 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: FRClient.cc,v 1.8 2010/11/11 00:14:50 akimura Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// FRClient.cc
// FukuiRenderer Client
@@ -55,6 +55,7 @@
#include <string.h>
#include <stdio.h>
#include "G4VisManager.hh"
#include "FRClient.h"
FRClient::FRClient()
@@ -98,8 +99,9 @@ int FRClient::connect(const char *hostname, int port_)
}
hp = gethostbyname(hostname) ;
if ( !hp ) {
G4cerr << "ERROR: gethostbyname() failed" << G4endl;
return -1;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "ERROR: gethostbyname() failed" << G4endl;
return -1;
}
memcpy( (char * )&sa.sin_addr, (char * )hp->h_addr, hp->h_length );
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VRML1FileSceneHandler.cc,v 1.12 2006/06/29 21:25:57 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VRML1FileSceneHandler.cc,v 1.13 2010/11/11 00:14:50 akimura Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// G4VRML1FileSceneHandler.cc
// Satoshi Tanaka & Yasuhide Sawada
@@ -39,6 +39,7 @@
#include <stdlib.h>
#include "globals.hh"
#include "G4VisManager.hh"
#include "G4Scene.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
@@ -103,7 +104,8 @@ G4VRML1FileSceneHandler::G4VRML1FileSceneHandler(G4VRML1File& system, const G4St
G4VRML1FileSceneHandler::~G4VRML1FileSceneHandler()
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** ~G4VRML1FileSceneHandler" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** ~G4VRML1FileSceneHandler" << G4endl;
#endif
VRMLEndModeling();
}
@@ -133,13 +135,15 @@ void G4VRML1FileSceneHandler::connectPort()
// Message in the final execution
if( i == MAX_FILE_INDEX )
{
G4cerr << "===========================================" << G4endl;
G4cerr << "WARNING MESSAGE from VRML1FILE driver: " << G4endl;
G4cerr << " This file name is the final one in the " << G4endl;
G4cerr << " automatic updation of the output file name." << G4endl;
G4cerr << " You may overwrite existing files, i.e. " << G4endl;
G4cerr << " g4_XX.wrl. " << G4endl;
G4cerr << "===========================================" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "===========================================" << G4endl;
G4cout << "WARNING MESSAGE from VRML1FILE 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_XX.wrl. " << G4endl;
G4cout << "===========================================" << G4endl;
}
}
// re-determine file name as G4VRMLFILE_DEST_DIR/g4_XX.wrl
@@ -165,12 +169,13 @@ void G4VRML1FileSceneHandler::connectPort()
} // for
// open a VRML 1.0 file with determined file name
G4cerr << "===========================================" << G4endl;
G4cerr << "Output VRML 1.0 file: " << fVRMLFileName << G4endl;
G4cerr << "Maximum number of files in the destination directory: " << fMaxFileNum << G4endl;
G4cerr << " (Customizable with the environment variable: G4VRMLFILE_MAX_FILE_NUM) " << G4endl;
G4cerr << "===========================================" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "===========================================" << G4endl;
G4cout << "Output VRML 1.0 file: " << fVRMLFileName << G4endl;
G4cout << "Maximum number of files in the destination directory: " << fMaxFileNum << G4endl;
G4cout << " (Customizable with the environment variable: G4VRMLFILE_MAX_FILE_NUM) " << G4endl;
G4cout << "===========================================" << G4endl;
}
fDest.open(fVRMLFileName) ; fFlagDestOpen = true ;
}
@@ -186,18 +191,21 @@ void G4VRML1FileSceneHandler::closePort()
// close VRML file
fDest.close(); fFlagDestOpen = false ;
G4cerr << "*** VRML 1.0 File " << fVRMLFileName << " is generated." << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "*** VRML 1.0 File " << fVRMLFileName << " is generated." << G4endl;
// Invoke viewer
if ( !strcmp(viewer, NO_VRML_VIEWER )) {
G4cerr << "MESSAGE from VRML1FILE driver:" << G4endl;
G4cerr << " Set an environmental variable " ;
G4cerr << ENV_VRML_VIEWER << G4endl;
G4cerr << " if you want to visualize the generated VRML file" << G4endl;
G4cerr << " automatically. For example, " << G4endl;
G4cerr << " setenv " << ENV_VRML_VIEWER << " vrweb " << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "MESSAGE from VRML1FILE driver:" << G4endl;
G4cout << " Set an environmental variable " ;
G4cout << ENV_VRML_VIEWER << G4endl;
G4cout << " if you want to visualize the generated VRML file" << G4endl;
G4cout << " automatically. For example, " << G4endl;
G4cout << " setenv " << ENV_VRML_VIEWER << " vrweb " << G4endl;
}
} else {
sprintf( command, "%s %s", viewer, fVRMLFileName );
system( command );
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VRML1FileViewer.cc,v 1.11 2006/06/29 21:25:59 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VRML1FileViewer.cc,v 1.12 2010/11/11 00:14:50 akimura Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// G4VRMLView.cc
// Satoshi Tanaka & Yasuhide Sawada
@@ -33,6 +33,7 @@
//#define DEBUG_FR_VIEW
#include "G4VisManager.hh"
#include "G4Scene.hh"
#include "G4VRML1FileViewer.hh"
#include "G4VRML1FileSceneHandler.hh"
@@ -53,14 +54,16 @@ G4VRML1FileViewer::~G4VRML1FileViewer()
void G4VRML1FileViewer::SetView()
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4VRML1FileViewer::SetView(): No effects" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4VRML1FileViewer::SetView(): No effects" << G4endl;
#endif
}
void G4VRML1FileViewer::DrawView()
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4VRML1FileViewer::DrawView()" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4VRML1FileViewer::DrawView()" << G4endl;
#endif
fSceneHandler.VRMLBeginModeling();
@@ -74,7 +77,8 @@ void G4VRML1FileViewer::DrawView()
void G4VRML1FileViewer::ClearView(void)
{
//#if defined DEBUG_FR_VIEW
G4cerr << "***** G4VRML1File1View::ClearView()" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4VRML1File1View::ClearView()" << G4endl;
//#endif
if(fSceneHandler.fFlagDestOpen) {
fSceneHandler.fDest.close();
@@ -88,7 +92,8 @@ void G4VRML1FileViewer::ClearView(void)
void G4VRML1FileViewer::ShowView(void)
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4VRML1FileViewer::ShowView()" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4VRML1FileViewer::ShowView()" << G4endl;
#endif
fSceneHandler.VRMLEndModeling();
}
@@ -96,6 +101,7 @@ void G4VRML1FileViewer::ShowView(void)
void G4VRML1FileViewer::FinishView(void)
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4VRML1FileViewer::FinishView(): No effects" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4VRML1FileViewer::FinishView(): No effects" << G4endl;
#endif
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VRML1SceneHandler.cc,v 1.10 2006/06/29 21:26:01 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VRML1SceneHandler.cc,v 1.11 2010/11/11 00:14:50 akimura Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// G4VRML1SceneHandler.cc
// Yasuhide Sawada and Satoshi Tanaka
@@ -43,6 +43,7 @@
#include <fstream>
#include "globals.hh"
#include "G4VisManager.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4Point3D.hh"
@@ -80,7 +81,8 @@ G4VRML1SceneHandler::G4VRML1SceneHandler(G4VRML1& system, const G4String& name)
G4VRML1SceneHandler::~G4VRML1SceneHandler()
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** ~G4VRML1SceneHandler" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** ~G4VRML1SceneHandler" << G4endl;
#endif
}
@@ -100,14 +102,18 @@ void G4VRML1SceneHandler::connectPort(G4int max_trial)
for (trial = 0; !fDest.isConnected()&& trial < max_trial; trial++, port++ ) {
if (fDest.connect( (const char * )fSystem.getHostName(), port)) {
// INET domain connection is established
G4cerr << "*** GEANT4 is connected to port ";
G4cerr << fDest.getPort();
G4cerr << " of server " << fSystem.getHostName() << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "*** GEANT4 is connected to port ";
G4cout << fDest.getPort();
G4cout << " of server " << fSystem.getHostName() << G4endl;
}
break;
} else {
// Connection failed. Try the next port.
G4cerr << "*** GEANT4 incremented targeting port to ";
G4cerr << port << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "*** GEANT4 incremented targeting port to ";
G4cout << port << G4endl;
}
}
sleep (1);
@@ -115,17 +121,20 @@ void G4VRML1SceneHandler::connectPort(G4int max_trial)
} // for
if (!fDest.isConnected()) {
G4cerr << "*** INET Connection failed. " << G4endl;
G4cerr << " Maybe, you have not invoked viewer g4vrmlview yet, " << G4endl;
G4cerr << " or too many viewers are already running in the " << G4endl;
G4cerr << " server host(" << fSystem.getHostName() << "). " << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "*** INET Connection failed. " << G4endl;
G4cout << " Maybe, you have not invoked viewer g4vrmlview yet, " << G4endl;
G4cout << " or too many viewers are already running in the " << G4endl;
G4cout << " server host(" << fSystem.getHostName() << "). " << G4endl;
}
}
}
void G4VRML1SceneHandler::closePort()
{
fDest.close();
G4cerr << "*** INET Connection closed. " << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "*** INET Connection closed. " << G4endl;
}
@@ -24,12 +24,14 @@
// ********************************************************************
//
//
// $Id: G4VRML1SceneHandlerFunc.icc,v 1.16 2006/06/29 21:26:03 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VRML1SceneHandlerFunc.icc,v 1.17 2010/11/11 00:14:50 akimura Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// G4VRML1SceneHandlerFunc.icc
// Satoshi Tanaka & Yasuhide Sawada
#include "G4VisManager.hh"
//#define DEBUG_SCENE_FUNC
// MACRO
@@ -43,7 +45,8 @@
void G4VRML1SCENEHANDLER::AddSolid(const G4Trd& trd)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddSolid trd" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid trd" << "\n" ;
#endif
VRMLBeginModeling () ;
ADDTHIS_WITH_NAME(trd)
@@ -52,7 +55,8 @@ void G4VRML1SCENEHANDLER::AddSolid(const G4Trd& trd)
void G4VRML1SCENEHANDLER::AddSolid(const G4Trap& trap)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddSolid trap" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid trap" << "\n" ;
#endif
VRMLBeginModeling () ;
ADDTHIS_WITH_NAME(trap)
@@ -61,7 +65,8 @@ void G4VRML1SCENEHANDLER::AddSolid(const G4Trap& trap)
void G4VRML1SCENEHANDLER::AddSolid(const G4Para& para)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddSolid para" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid para" << "\n" ;
#endif
VRMLBeginModeling () ;
ADDTHIS_WITH_NAME(para)
@@ -70,7 +75,8 @@ void G4VRML1SCENEHANDLER::AddSolid(const G4Para& para)
void G4VRML1SCENEHANDLER::AddSolid(const G4Torus& torus )
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddSolid torus" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid torus" << "\n" ;
#endif
VRMLBeginModeling () ;
ADDTHIS_WITH_NAME(torus)
@@ -80,7 +86,8 @@ void G4VRML1SCENEHANDLER::AddSolid(const G4Torus& torus )
void G4VRML1SCENEHANDLER::AddSolid(const G4VSolid& vsolid)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddSolid vsolid" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid vsolid" << "\n" ;
#endif
VRMLBeginModeling () ;
ADDTHIS_WITH_NAME(vsolid)
@@ -89,7 +96,8 @@ void G4VRML1SCENEHANDLER::AddSolid(const G4VSolid& vsolid)
void G4VRML1SCENEHANDLER::AddSolid(const G4Tubs& tubs)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddSolid tubs" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid tubs" << "\n" ;
#endif
VRMLBeginModeling () ;
@@ -126,7 +134,8 @@ void G4VRML1SCENEHANDLER::AddSolid(const G4Tubs& tubs)
void G4VRML1SCENEHANDLER::AddSolid(const G4Cons& cons)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddSolid cons" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid cons" << "\n" ;
#endif
VRMLBeginModeling () ;
@@ -165,7 +174,8 @@ void G4VRML1SCENEHANDLER::AddSolid(const G4Cons& cons)
void G4VRML1SCENEHANDLER::AddSolid(const G4Box& box)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddSolid box" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid box" << "\n" ;
#endif
VRMLBeginModeling () ;
@@ -193,7 +203,8 @@ void G4VRML1SCENEHANDLER::AddSolid(const G4Box& box)
void G4VRML1SCENEHANDLER::AddSolid(const G4Sphere& sphere)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddSolid sphere" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid sphere" << "\n" ;
#endif
VRMLBeginModeling () ;
@@ -229,7 +240,8 @@ void G4VRML1SCENEHANDLER::AddSolid(const G4Sphere& sphere)
void G4VRML1SCENEHANDLER::AddPrimitive(const G4Polyline& polyline)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddPrimitive polyline" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddPrimitive polyline" << "\n" ;
#endif
VRMLBeginModeling () ;
@@ -268,7 +280,8 @@ void G4VRML1SCENEHANDLER::AddPrimitive(const G4Polyline& polyline)
void G4VRML1SCENEHANDLER::AddPrimitive(const G4Polyhedron& polyhedron)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddPrimitive(G4Polyhedron)" << "\n";
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddPrimitive(G4Polyhedron)" << "\n";
#endif
if (polyhedron.GetNoFacets() == 0) return;
@@ -337,9 +350,11 @@ void G4VRML1SCENEHANDLER::AddPrimitive(const G4Polyhedron& polyhedron)
void G4VRML1SCENEHANDLER::AddPrimitive(const G4NURBS&)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddPrimitive nurbs" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddPrimitive nurbs" << "\n" ;
#endif
G4cerr << "G4VRML1File::AddPrimitive(G4NURBS&): not implemented. " << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "G4VRML1File::AddPrimitive(G4NURBS&): not implemented. " << "\n" ;
VRMLBeginModeling () ;
}
@@ -347,9 +362,11 @@ void G4VRML1SCENEHANDLER::AddPrimitive(const G4NURBS&)
void G4VRML1SCENEHANDLER::AddPrimitive( const G4Text& )
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddPrimitive text" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddPrimitive text" << "\n" ;
#endif
G4cerr <<
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout <<
"***** void G4VRML1SCENEHANDLER::AddPrimitive( const G4Text& text )"
" not implemented yet."
<< "\n";
@@ -360,7 +377,8 @@ void G4VRML1SCENEHANDLER::AddPrimitive( const G4Text& )
void G4VRML1SCENEHANDLER::AddPrimitive( const G4Circle& circle )
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddPrimitive circle" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddPrimitive circle" << "\n" ;
#endif
VRMLBeginModeling () ;
@@ -390,7 +408,8 @@ void G4VRML1SCENEHANDLER::AddPrimitive( const G4Circle& circle )
void G4VRML1SCENEHANDLER::AddPrimitive(const G4Square& square)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddPrimitive square" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddPrimitive square" << "\n" ;
#endif
VRMLBeginModeling () ;
@@ -422,7 +441,8 @@ void G4VRML1SCENEHANDLER::AddPrimitive(const G4Square& square)
void G4VRML1SCENEHANDLER::BeginModeling()
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** BeginModeling " << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** BeginModeling " << "\n" ;
#endif
G4VSceneHandler::BeginModeling();
}
@@ -430,7 +450,8 @@ void G4VRML1SCENEHANDLER::BeginModeling()
void G4VRML1SCENEHANDLER::EndModeling()
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** EndModeling " << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** EndModeling " << "\n" ;
#endif
G4VSceneHandler::EndModeling();
}
@@ -440,7 +461,8 @@ void G4VRML1SCENEHANDLER::BeginPrimitives(const G4Transform3D& objectTransformat
G4VSceneHandler::BeginPrimitives (objectTransformation);
fpObjectTransformation = &objectTransformation;
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** BeginPrimitives " << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** BeginPrimitives " << "\n" ;
#endif
VRMLBeginModeling();
}
@@ -448,7 +470,8 @@ void G4VRML1SCENEHANDLER::BeginPrimitives(const G4Transform3D& objectTransformat
void G4VRML1SCENEHANDLER::EndPrimitives()
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** EndPrimitives " << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** EndPrimitives " << "\n" ;
#endif
G4VSceneHandler::EndPrimitives();
}
@@ -554,7 +577,8 @@ void G4VRML1SCENEHANDLER::VRMLBeginModeling()
{
if (!IS_CONNECTED ) {
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** VRMLBeginModeling() (started)" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** VRMLBeginModeling() (started)" << "\n" ;
#endif
this->connectPort();
fDest << "#VRML V1.0 ascii" << "\n";
@@ -566,7 +590,8 @@ void G4VRML1SCENEHANDLER::VRMLEndModeling()
{
if ( IS_CONNECTED ) {
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** VRMLEndModeling() (started)" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** VRMLEndModeling() (started)" << "\n" ;
#endif
fDest << "#End of file." << "\n";
+14 -7
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VRML1Viewer.cc,v 1.8 2006/06/29 21:26:05 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VRML1Viewer.cc,v 1.9 2010/11/11 00:14:50 akimura Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// G4VRMLView.cc
// Yasuhide Sawada & Satoshi Tanaka
@@ -39,6 +39,8 @@
//#define DEBUG_FR_VIEW
#include "G4VisManager.hh"
#include "G4Scene.hh"
#include "G4VRML1Viewer.hh"
#include "G4VRML1SceneHandler.hh"
@@ -55,14 +57,16 @@ G4VRML1Viewer::~G4VRML1Viewer()
void G4VRML1Viewer::SetView()
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4VRML1Viewer::SetView(): No effects" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4VRML1Viewer::SetView(): No effects" << G4endl;
#endif
}
void G4VRML1Viewer::DrawView()
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4VRML1Viewer::DrawView()" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4VRML1Viewer::DrawView()" << G4endl;
#endif
fSceneHandler.VRMLBeginModeling();
@@ -76,14 +80,16 @@ void G4VRML1Viewer::DrawView()
void G4VRML1Viewer::ClearView(void)
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4VRML1Viewer::ClearView(): No effects" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4VRML1Viewer::ClearView(): No effects" << G4endl;
#endif
}
void G4VRML1Viewer::ShowView(void)
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4VRML1Viewer::ShowView()" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4VRML1Viewer::ShowView()" << G4endl;
#endif
fSceneHandler.VRMLEndModeling();
}
@@ -91,7 +97,8 @@ void G4VRML1Viewer::ShowView(void)
void G4VRML1Viewer::FinishView(void)
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4VRML1Viewer::FinishView(): No effects" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4VRML1Viewer::FinishView(): No effects" << G4endl;
#endif
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VRML2FileSceneHandler.cc,v 1.14 2006/06/29 21:26:11 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VRML2FileSceneHandler.cc,v 1.15 2010/11/11 00:14:50 akimura Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// G4VRML2FileSceneHandler.cc
// Satoshi Tanaka & Yasuhide Sawada
@@ -42,6 +42,7 @@
#include "globals.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4VisManager.hh"
#include "G4Point3D.hh"
#include "G4VisAttributes.hh"
#include "G4VModel.hh"
@@ -118,7 +119,8 @@ G4VRML2FileSceneHandler::G4VRML2FileSceneHandler(G4VRML2File& system, const G4St
G4VRML2FileSceneHandler::~G4VRML2FileSceneHandler()
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** ~G4VRML2FileSceneHandler" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** ~G4VRML2FileSceneHandler" << G4endl;
#endif
VRMLEndModeling();
}
@@ -148,13 +150,15 @@ void G4VRML2FileSceneHandler::connectPort()
// Message in the final execution
if( i == MAX_FILE_INDEX )
{
G4cerr << "===========================================" << G4endl;
G4cerr << "WARNING MESSAGE from VRML2FILE driver: " << G4endl;
G4cerr << " This file name is the final one in the " << G4endl;
G4cerr << " automatic updation of the output file name." << G4endl;
G4cerr << " You may overwrite existing files, i.e. " << G4endl;
G4cerr << " g4_XX.wrl. " << G4endl;
G4cerr << "===========================================" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "===========================================" << G4endl;
G4cout << "WARNING MESSAGE from VRML2FILE 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_XX.wrl. " << G4endl;
G4cout << "===========================================" << G4endl;
}
}
// re-determine file name as G4VRMLFILE_DEST_DIR/g4_XX.wrl
@@ -179,12 +183,13 @@ void G4VRML2FileSceneHandler::connectPort()
} // for
// open a VRML 2.0 file with determined file name
G4cerr << "===========================================" << G4endl;
G4cerr << "Output VRML 2.0 file: " << fVRMLFileName << G4endl;
G4cerr << "Maximum number of files in the destination directory: " << fMaxFileNum << G4endl;
G4cerr << " (Customizable with the environment variable: G4VRMLFILE_MAX_FILE_NUM) " << G4endl;
G4cerr << "===========================================" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "===========================================" << G4endl;
G4cout << "Output VRML 2.0 file: " << fVRMLFileName << G4endl;
G4cout << "Maximum number of files in the destination directory: " << fMaxFileNum << G4endl;
G4cout << " (Customizable with the environment variable: G4VRMLFILE_MAX_FILE_NUM) " << G4endl;
G4cout << "===========================================" << G4endl;
}
fDest.open(fVRMLFileName) ; fFlagDestOpen = true ;
}
@@ -200,18 +205,21 @@ void G4VRML2FileSceneHandler::closePort()
// close VRML file
fDest.close(); fFlagDestOpen = false ;
G4cerr << "*** VRML 2.0 File " << fVRMLFileName << " is generated." << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "*** VRML 2.0 File " << fVRMLFileName << " is generated." << G4endl;
// Invoke viewer
if ( !strcmp(viewer, NO_VRML_VIEWER )) {
G4cerr << "MESSAGE from VRML2FILE driver:" << G4endl;
G4cerr << " Set an environmental variable " ;
G4cerr << ENV_VRML_VIEWER << G4endl;
G4cerr << " if you want to visualize the generated VRML file" << G4endl;
G4cerr << " automatically. For example, " << G4endl;
G4cerr << " setenv " << ENV_VRML_VIEWER << " vrwave " << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "MESSAGE from VRML2FILE driver:" << G4endl;
G4cout << " Set an environmental variable " ;
G4cout << ENV_VRML_VIEWER << G4endl;
G4cout << " if you want to visualize the generated VRML file" << G4endl;
G4cout << " automatically. For example, " << G4endl;
G4cout << " setenv " << ENV_VRML_VIEWER << " vrwave " << G4endl;
}
} else {
sprintf( command, "%s %s", viewer, fVRMLFileName );
system( command );
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VRML2FileViewer.cc,v 1.13 2006/06/29 21:26:13 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VRML2FileViewer.cc,v 1.14 2010/11/11 00:14:50 akimura Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// G4VRML2FileViewer.cc
// Satoshi Tanaka & Yasuhide Sawada
@@ -35,6 +35,7 @@
#include <cmath>
#include "G4VisManager.hh"
#include "G4Scene.hh"
#include "G4VRML2FileViewer.hh"
#include "G4VRML2FileSceneHandler.hh"
@@ -59,7 +60,8 @@ G4VRML2FileViewer::~G4VRML2FileViewer()
void G4VRML2FileViewer::SetView()
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4VRML2FileViewer::SetView(): No effects" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4VRML2FileViewer::SetView(): No effects" << G4endl;
#endif
// Do nothing, since VRML a browser is running as a different process.
@@ -70,7 +72,8 @@ void G4VRML2FileViewer::SetView()
void G4VRML2FileViewer::DrawView()
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4VRML2FileViewer::DrawView()" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4VRML2FileViewer::DrawView()" << G4endl;
#endif
fSceneHandler.VRMLBeginModeling() ;
@@ -87,7 +90,8 @@ void G4VRML2FileViewer::DrawView()
void G4VRML2FileViewer::ClearView(void)
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4VRML2File1View::ClearView()" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4VRML2File1View::ClearView()" << G4endl;
#endif
if(fSceneHandler.fFlagDestOpen) {
fSceneHandler.fDest.close();
@@ -101,7 +105,8 @@ void G4VRML2FileViewer::ClearView(void)
void G4VRML2FileViewer::ShowView(void)
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4VRML2FileViewer::ShowView()" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4VRML2FileViewer::ShowView()" << G4endl;
#endif
fSceneHandler.VRMLEndModeling();
}
@@ -109,7 +114,8 @@ void G4VRML2FileViewer::ShowView(void)
void G4VRML2FileViewer::FinishView(void)
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4VRML2FileViewer::FinishView(): No effects" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4VRML2FileViewer::FinishView(): No effects" << G4endl;
#endif
}
@@ -120,7 +126,8 @@ void G4VRML2FileViewer::SendViewParameters ()
// later due to user interaction via visualization system's GUI.)
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4VRML2FileViewer::SendViewParameters()\n";
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4VRML2FileViewer::SendViewParameters()\n";
#endif
// error recovery
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VRML2SceneHandler.cc,v 1.12 2006/06/29 21:26:15 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VRML2SceneHandler.cc,v 1.13 2010/11/11 00:14:50 akimura Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// G4VRML2SceneHandler.cc
// Satoshi Tanaka & Yasuhide Sawada
@@ -45,6 +45,8 @@
#include <cmath>
#include "globals.hh"
#include "G4VisManager.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4Point3D.hh"
@@ -92,7 +94,8 @@ G4VRML2SceneHandler::G4VRML2SceneHandler(G4VRML2& system, const G4String& name)
G4VRML2SceneHandler::~G4VRML2SceneHandler()
{
#if defined DEBUG_FR_SCENE
G4cerr << "***** ~G4VRML2SceneHandler" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** ~G4VRML2SceneHandler" << G4endl;
#endif
}
@@ -112,14 +115,18 @@ void G4VRML2SceneHandler::connectPort(G4int max_trial)
for (trial = 0; !fDest.isConnected()&& trial < max_trial; trial++, port++ ) {
if (fDest.connect( (const char * )fSystem.getHostName(), port)) {
// INET domain connection is established
G4cerr << "*** GEANT4 is connected to port ";
G4cerr << fDest.getPort();
G4cerr << " of server " << fSystem.getHostName() << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "*** GEANT4 is connected to port ";
G4cout << fDest.getPort();
G4cout << " of server " << fSystem.getHostName() << G4endl;
}
break;
} else {
// Connection failed. Try the next port.
G4cerr << "*** GEANT4 incremented targeting port to ";
G4cerr << port << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "*** GEANT4 incremented targeting port to ";
G4cout << port << G4endl;
}
}
sleep (1);
@@ -127,17 +134,20 @@ void G4VRML2SceneHandler::connectPort(G4int max_trial)
} // for
if (!fDest.isConnected()) {
G4cerr << "*** INET Connection failed. " << G4endl;
G4cerr << " Maybe, you have not invoked viewer g4vrmlview yet, " << G4endl;
G4cerr << " or too many viewers are already running in the " << G4endl;
G4cerr << " server host(" << fSystem.getHostName() << "). " << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors) {
G4cout << "*** INET Connection failed. " << G4endl;
G4cout << " Maybe, you have not invoked viewer g4vrmlview yet, " << G4endl;
G4cout << " or too many viewers are already running in the " << G4endl;
G4cout << " server host(" << fSystem.getHostName() << "). " << G4endl;
}
}
}
void G4VRML2SceneHandler::closePort()
{
fDest.close();
G4cerr << "*** INET Connection closed. " << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "*** INET Connection closed. " << G4endl;
}
@@ -24,18 +24,21 @@
// ********************************************************************
//
//
// $Id: G4VRML2SceneHandlerFunc.icc,v 1.20 2006/06/29 21:26:17 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VRML2SceneHandlerFunc.icc,v 1.21 2010/11/11 00:14:50 akimura Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// G4VRML2SceneHandlerFunc.icc
// Satoshi Tanaka & Yasuhide Sawada
//#define DEBUG_SCENE_FUNC
#include "G4VisManager.hh"
void G4VRML2SCENEHANDLER::AddSolid(const G4Trd& trd)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddSolid trd" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid trd" << "\n" ;
#endif
VRMLBeginModeling () ;
G4VSceneHandler::AddSolid(trd);
@@ -44,7 +47,8 @@ void G4VRML2SCENEHANDLER::AddSolid(const G4Trd& trd)
void G4VRML2SCENEHANDLER::AddSolid(const G4Trap& trap)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddSolid trap" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid trap" << "\n" ;
#endif
VRMLBeginModeling () ;
G4VSceneHandler::AddSolid(trap);
@@ -53,7 +57,8 @@ void G4VRML2SCENEHANDLER::AddSolid(const G4Trap& trap)
void G4VRML2SCENEHANDLER::AddSolid(const G4Para& para)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddSolid para" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid para" << "\n" ;
#endif
VRMLBeginModeling () ;
G4VSceneHandler::AddSolid(para);
@@ -62,7 +67,8 @@ void G4VRML2SCENEHANDLER::AddSolid(const G4Para& para)
void G4VRML2SCENEHANDLER::AddSolid(const G4Torus& torus )
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddSolid torus" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid torus" << "\n" ;
#endif
VRMLBeginModeling () ;
G4VSceneHandler::AddSolid(torus);
@@ -72,7 +78,8 @@ void G4VRML2SCENEHANDLER::AddSolid(const G4Torus& torus )
void G4VRML2SCENEHANDLER::AddSolid(const G4VSolid& vsolid)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddSolid vsolid" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid vsolid" << "\n" ;
#endif
VRMLBeginModeling () ;
G4VSceneHandler::AddSolid(vsolid);
@@ -81,7 +88,8 @@ void G4VRML2SCENEHANDLER::AddSolid(const G4VSolid& vsolid)
void G4VRML2SCENEHANDLER::AddSolid(const G4Tubs& tubs)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddSolid tubs" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid tubs" << "\n" ;
#endif
VRMLBeginModeling () ;
G4VSceneHandler::AddSolid(tubs) ;
@@ -92,7 +100,8 @@ void G4VRML2SCENEHANDLER::AddSolid(const G4Tubs& tubs)
void G4VRML2SCENEHANDLER::AddSolid(const G4Cons& cons)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddSolid cons" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid cons" << "\n" ;
#endif
VRMLBeginModeling () ;
G4VSceneHandler::AddSolid(cons) ;
@@ -101,7 +110,8 @@ void G4VRML2SCENEHANDLER::AddSolid(const G4Cons& cons)
void G4VRML2SCENEHANDLER::AddSolid(const G4Box& box)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddSolid box" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid box" << "\n" ;
#endif
VRMLBeginModeling () ;
G4VSceneHandler::AddSolid(box) ;
@@ -111,7 +121,8 @@ void G4VRML2SCENEHANDLER::AddSolid(const G4Box& box)
void G4VRML2SCENEHANDLER::AddSolid(const G4Sphere& sphere)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddSolid sphere" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddSolid sphere" << "\n" ;
#endif
VRMLBeginModeling () ;
G4VSceneHandler::AddSolid(sphere) ;
@@ -120,7 +131,8 @@ void G4VRML2SCENEHANDLER::AddSolid(const G4Sphere& sphere)
void G4VRML2SCENEHANDLER::AddPrimitive(const G4Polyline& polyline)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddPrimitive polyline" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddPrimitive polyline" << "\n" ;
#endif
VRMLBeginModeling () ;
@@ -169,7 +181,8 @@ void G4VRML2SCENEHANDLER::AddPrimitive(const G4Polyline& polyline)
void G4VRML2SCENEHANDLER::AddPrimitive(const G4Polyhedron& polyhedron)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddPrimitive(G4Polyhedron)" << "\n";
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddPrimitive(G4Polyhedron)" << "\n";
#endif
if (polyhedron.GetNoFacets() == 0) return;
@@ -252,9 +265,11 @@ void G4VRML2SCENEHANDLER::AddPrimitive(const G4Polyhedron& polyhedron)
void G4VRML2SCENEHANDLER::AddPrimitive(const G4NURBS&)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddPrimitive nurbs" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddPrimitive nurbs" << "\n" ;
#endif
G4cerr << "G4VRML2File::AddPrimitive(G4NURBS&): not implemented. " << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "G4VRML2File::AddPrimitive(G4NURBS&): not implemented. " << "\n" ;
VRMLBeginModeling () ;
}
@@ -262,9 +277,11 @@ void G4VRML2SCENEHANDLER::AddPrimitive(const G4NURBS&)
void G4VRML2SCENEHANDLER::AddPrimitive( const G4Text& )
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddPrimitive text" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddPrimitive text" << "\n" ;
#endif
G4cerr <<
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout <<
"***** void G4VRML2SCENEHANDLER::AddPrimitive( const G4Text& text )"
" not implemented yet."
<< "\n";
@@ -276,7 +293,8 @@ void G4VRML2SCENEHANDLER::AddPrimitive( const G4Text& )
void G4VRML2SCENEHANDLER::AddPrimitive( const G4Circle& circle )
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddPrimitive circle" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddPrimitive circle" << "\n" ;
#endif
VRMLBeginModeling () ;
@@ -334,7 +352,8 @@ void G4VRML2SCENEHANDLER::AddPrimitive( const G4Circle& circle )
void G4VRML2SCENEHANDLER::AddPrimitive(const G4Square& square)
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** AddPrimitive square" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** AddPrimitive square" << "\n" ;
#endif
VRMLBeginModeling () ;
@@ -395,7 +414,8 @@ void G4VRML2SCENEHANDLER::AddPrimitive(const G4Square& square)
void G4VRML2SCENEHANDLER::BeginModeling()
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** BeginModeling" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** BeginModeling" << "\n" ;
#endif
G4VSceneHandler::BeginModeling();
@@ -404,7 +424,8 @@ void G4VRML2SCENEHANDLER::BeginModeling()
void G4VRML2SCENEHANDLER::EndModeling()
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** EndModeling " << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** EndModeling " << "\n" ;
#endif
G4VSceneHandler::EndModeling();
}
@@ -414,7 +435,8 @@ void G4VRML2SCENEHANDLER::BeginPrimitives(const G4Transform3D& objectTransformat
G4VSceneHandler::BeginPrimitives (objectTransformation);
fpObjectTransformation = &objectTransformation;
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** BeginPrimitives " << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** BeginPrimitives " << "\n" ;
#endif
VRMLBeginModeling();
}
@@ -422,7 +444,8 @@ void G4VRML2SCENEHANDLER::BeginPrimitives(const G4Transform3D& objectTransformat
void G4VRML2SCENEHANDLER::EndPrimitives()
{
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** EndPrimitives " << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** EndPrimitives " << "\n" ;
#endif
G4VSceneHandler::EndPrimitives();
}
@@ -499,7 +522,8 @@ void G4VRML2SCENEHANDLER::VRMLBeginModeling()
{
if (!IS_CONNECTED ) {
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** VRMLBeginModeling (started)" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** VRMLBeginModeling (started)" << "\n" ;
#endif
this->connectPort();
fDest << "#VRML V2.0 utf8" << "\n";
@@ -511,7 +535,8 @@ void G4VRML2SCENEHANDLER::VRMLEndModeling()
{
if ( IS_CONNECTED ) {
#if defined DEBUG_SCENE_FUNC
G4cerr << "***** VRMLEndModeling (started)" << "\n" ;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** VRMLEndModeling (started)" << "\n" ;
#endif
fDest << "#End of file." << "\n";
this->closePort();
+15 -8
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VRML2Viewer.cc,v 1.12 2006/06/29 21:26:35 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VRML2Viewer.cc,v 1.13 2010/11/11 00:14:50 akimura Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// G4VRML2Viewer.cc
// Satoshi Tanaka & Yasuhide Sawada
@@ -41,6 +41,7 @@
#include <cmath>
#include "G4VisManager.hh"
#include "G4Scene.hh"
#include "G4VRML2Viewer.hh"
#include "G4VRML2SceneHandler.hh"
@@ -64,7 +65,8 @@ G4VRML2Viewer::~G4VRML2Viewer()
void G4VRML2Viewer::SetView()
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4VRML2Viewer::SetView(): No effects" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4VRML2Viewer::SetView(): No effects" << G4endl;
#endif
// Do nothing, since VRML a browser is running as a different process.
@@ -76,7 +78,8 @@ void G4VRML2Viewer::SetView()
void G4VRML2Viewer::DrawView()
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4VRML2Viewer::DrawView()" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4VRML2Viewer::DrawView()" << G4endl;
#endif
fSceneHandler.VRMLBeginModeling() ;
@@ -92,14 +95,16 @@ void G4VRML2Viewer::DrawView()
void G4VRML2Viewer::ClearView(void)
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4VRML2Viewer::ClearView(): No effects" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4VRML2Viewer::ClearView(): No effects" << G4endl;
#endif
}
void G4VRML2Viewer::ShowView(void)
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4VRML2Viewer::ShowView()" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4VRML2Viewer::ShowView()" << G4endl;
#endif
fSceneHandler.VRMLEndModeling();
}
@@ -107,7 +112,8 @@ void G4VRML2Viewer::ShowView(void)
void G4VRML2Viewer::FinishView(void)
{
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4VRML2Viewer::FinishView(): No effects" << G4endl;
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4VRML2Viewer::FinishView(): No effects" << G4endl;
#endif
}
@@ -118,7 +124,8 @@ void G4VRML2Viewer::SendViewParameters ()
// later due to user interaction via visualization system's GUI.)
#if defined DEBUG_FR_VIEW
G4cerr << "***** G4VRML2Viewer::SendViewParameters()\n";
if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
G4cout << "***** G4VRML2Viewer::SendViewParameters()\n";
#endif
// error recovery
if ( fsin_VHA < 1.0e-6 ) { return ; }
+20
View File
@@ -0,0 +1,20 @@
#------------------------------------------------------------------------------
# CMakeLists.txt
# Module : G4visXXX
# Package: Geant4.src.G4visualization.G4visXXX
#
# CMakeLists.txt for single level library that may be build global or granular
#
# Generated on : 24/9/2010
#
# $Id: CMakeLists.txt,v 1.1 2010/09/29 19:13:27 bmorgan Exp $
#
#------------------------------------------------------------------------------
include(Geant4MacroLibraryTargets)
if(GEANT4_BUILD_GRANULAR_LIBS)
GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
else()
GEANT4_GLOBAL_LIBRARY_TARGET(COMPONENTS sources.cmake)
endif()
+6 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.28 2009/10/21 15:28:53 allison Exp $
$Id: History,v 1.30 2010/10/06 15:49:24 allison Exp $
-------------------------------------------------------------------
=========================================================
@@ -20,6 +20,11 @@ committal in the CVS repository !
History file for visualization/XXX sub-category (a template graphics system)
---------------------------------------------------------------------------
6th October 2010 John Allison (visXXX-V08-03-00)
- G4XXXSGViewer.cc, G4XXXStoredViewer.cc:
o Added default colour and default text colour to list of parameters
that trigger a kernel visit.
21st October 2009 John Allison (visXXX-V09-02-00 coworks greps-V09-02-02)
- Added AddCompound (const G4THitsMap<G4double>&) methods.
o Prevents warnings about hiding - calls G4VSceneHandler base class.
+89
View File
@@ -0,0 +1,89 @@
#------------------------------------------------------------------------------
# sources.cmake
# Module : G4visXXX
# Package: Geant4.src.G4visualization.G4visXXX
#
# Sources description for a library.
# Lists the sources and headers of the code explicitely.
# Lists include paths needed.
# Lists the internal granular and global dependencies of the library.
# Source specific properties should be added at the end.
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake,v 1.1 2010/09/29 19:13:35 bmorgan Exp $
#
#------------------------------------------------------------------------------
# List external includes needed.
include_directories(${CLHEP_INCLUDE_DIRS})
# List internal includes needed.
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/hits/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/solids/CSG/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/solids/specific/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPGeometry/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/graphics_reps/include)
include_directories(${CMAKE_SOURCE_DIR}/source/intercoms/include)
include_directories(${CMAKE_SOURCE_DIR}/source/tracking/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/modeling/include)
#
# Define the Geant4 Module.
#
include(Geant4MacroDefineModule)
GEANT4_DEFINE_MODULE(NAME G4visXXX
HEADERS
G4XXX.hh
G4XXXFile.hh
G4XXXFileSceneHandler.hh
G4XXXFileViewer.hh
G4XXXSG.hh
G4XXXSGSceneHandler.hh
G4XXXSGViewer.hh
G4XXXSceneHandler.hh
G4XXXStored.hh
G4XXXStoredSceneHandler.hh
G4XXXStoredViewer.hh
G4XXXViewer.hh
SOURCES
G4XXX.cc
G4XXXFile.cc
G4XXXFileSceneHandler.cc
G4XXXFileViewer.cc
G4XXXSG.cc
G4XXXSGSceneHandler.cc
G4XXXSGViewer.cc
G4XXXSceneHandler.cc
G4XXXStored.cc
G4XXXStoredSceneHandler.cc
G4XXXStoredViewer.cc
G4XXXViewer.cc
GRANULAR_DEPENDENCIES
G4csg
G4geometrymng
G4globman
G4graphics_reps
G4hits
G4intercoms
G4modeling
G4specsolids
G4tracking
G4vis_management
GLOBAL_DEPENDENCIES
G4digits_hits
G4geometry
G4global
G4graphics_reps
G4intercoms
G4modeling
G4tracking
G4vis_management
LINK_LIBRARIES
)
# List any source specific properties here
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4XXXSGViewer.cc,v 1.4 2006/08/29 16:11:25 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4XXXSGViewer.cc,v 1.5 2010/10/06 10:12:03 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
// John Allison 10th March 2006
@@ -132,6 +132,10 @@ G4bool G4XXXSGViewer::CompareForKernelVisit(G4ViewParameters& lastVP)
(lastVP.IsExplode () != fVP.IsExplode ()) ||
(lastVP.GetNoOfSides () != fVP.GetNoOfSides ()) ||
(lastVP.IsMarkerNotHidden () != fVP.IsMarkerNotHidden ()) ||
(lastVP.GetDefaultVisAttributes()->GetColour() !=
fVP.GetDefaultVisAttributes()->GetColour()) ||
(lastVP.GetDefaultTextVisAttributes()->GetColour() !=
fVP.GetDefaultTextVisAttributes()->GetColour()) ||
(lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())
) {
return true;
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4XXXStoredViewer.cc,v 1.5 2006/08/29 16:11:25 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4XXXStoredViewer.cc,v 1.6 2010/10/06 10:12:03 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
// John Allison 7th March 2006
@@ -128,6 +128,10 @@ G4bool G4XXXStoredViewer::CompareForKernelVisit(G4ViewParameters& lastVP)
(lastVP.IsExplode () != fVP.IsExplode ()) ||
(lastVP.GetNoOfSides () != fVP.GetNoOfSides ()) ||
(lastVP.IsMarkerNotHidden () != fVP.IsMarkerNotHidden ()) ||
(lastVP.GetDefaultVisAttributes()->GetColour() !=
fVP.GetDefaultVisAttributes()->GetColour()) ||
(lastVP.GetDefaultTextVisAttributes()->GetColour() !=
fVP.GetDefaultTextVisAttributes()->GetColour()) ||
(lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())
) {
return true;
+27
View File
@@ -0,0 +1,27 @@
#------------------------------------------------------------------------------
# CMakeLists.txt
# Module :
# Package: Geant4.src.G4visualization.
#
# Intermediate level CMakeLists.txt - just process subdirectories
#
# Generated on : 24/9/2010
#
# $Id: CMakeLists.txt,v 1.1 2010/09/29 19:13:44 bmorgan Exp $
#
#------------------------------------------------------------------------------
#
# GL2PS built for GL and Inventor drivers
#
if(GEANT4_USE_OPENGL OR GEANT4_USE_INVENTOR)
add_subdirectory(gl2ps)
endif()
#
# Geant4 internal ZLIB build optional
#
if(NOT GEANT4_USE_SYSTEM_ZLIB)
add_subdirectory(zlib)
endif()
View File
+20
View File
@@ -0,0 +1,20 @@
#------------------------------------------------------------------------------
# CMakeLists.txt
# Module : G4gl2ps
# Package: Geant4.src.G4visualization..G4gl2ps
#
# CMakeLists.txt for single level library that may be build global or granular
#
# Generated on : 24/9/2010
#
# $Id: CMakeLists.txt,v 1.1 2010/09/29 19:14:00 bmorgan Exp $
#
#------------------------------------------------------------------------------
include(Geant4MacroLibraryTargets)
if(GEANT4_BUILD_GRANULAR_LIBS)
GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
else()
GEANT4_GLOBAL_LIBRARY_TARGET(COMPONENTS sources.cmake)
endif()
+20 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.15 2009/11/18 17:23:36 gcosmo Exp $
$Id: History,v 1.21 2010/11/13 10:37:57 allison Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,25 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
13th November 2010, John Allison (visexternal-V09-03-03)
- Geant4_gl2ps.h: Added #ifdef _WIN32, #define _USE_MATH_DEFINE.
5th November 2010, John Allison (visexternal-V09-03-02)
- Fixed Linux warnings.
5th November 2010, John Allison (visexternal-V09-03-01)
- Tagged.
3rd November 2010, Laurent Garnier
- Update gl2ps to 1.3.5 (before it was 1.3.3)
6th October 2010, John Allison (visexternal-V09-03-00)
- Tagged.
26th April 2010, Laurent Garnier
- G4OpenGL2PSAction : add new method to set viewport
18 Nov 2009, Gabriele Cosmo (visexternal-V09-02-06)
- Added GLOBLIBS dependencies to GNUmakefile to allow for building
DLLs on Windows. Removed redundant CPPFLAGS addition.
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4OpenGL2PSAction.hh,v 1.3 2009/04/29 09:37:55 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4OpenGL2PSAction.hh,v 1.4 2010/04/26 16:28:18 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
#ifndef G4OpenGL2PSAction_h
@@ -48,6 +48,7 @@ public:
bool fileWritingEnabled() const;
void setLineWidth(int);
void setPointSize(int);
void setViewport(int,int,int,int);
protected:
void G4gl2psBegin();
@@ -26,7 +26,7 @@
#ifndef Geant4_gl2ps_h
#define Geant4_gl2ps_h
// gl2ps-1.3.3
// gl2ps-1.3.5
// The gl2ps code is prefixed by Geant4_ in order
// to avoid clashes with other gl2ps code that may come at link
// time from other channels.
@@ -231,4 +231,8 @@
#include "gl2ps.h"
#ifdef _WIN32
#define _USE_MATH_DEFINES
#endif
#endif
+5 -2
View File
@@ -52,7 +52,9 @@
* library in the file named "COPYING.GL2PS"; if not, I will be glad
* to provide one.
*
* For the latest info about gl2ps, see http://www.geuz.org/gl2ps/.
* For the latest info about gl2ps and a full list of contributors,
* see http://www.geuz.org/gl2ps/.
*
* Please report all bugs and problems to <gl2ps@geuz.org>.
*/
@@ -67,6 +69,7 @@
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
# if defined(_MSC_VER)
# pragma warning(disable:4115)
# pragma warning(disable:4996)
# endif
# include <windows.h>
# if defined(GL2PSDLL)
@@ -102,7 +105,7 @@
#define GL2PS_MAJOR_VERSION 1
#define GL2PS_MINOR_VERSION 3
#define GL2PS_PATCH_VERSION 3
#define GL2PS_PATCH_VERSION 5
#define GL2PS_EXTRA_VERSION ""
#define GL2PS_VERSION (GL2PS_MAJOR_VERSION + \
+60
View File
@@ -0,0 +1,60 @@
#------------------------------------------------------------------------------
# sources.cmake
# Module : G4gl2ps
# Package: Geant4.src.G4visualization..G4gl2ps
#
# Sources description for a library.
# Lists the sources and headers of the code explicitely.
# Lists include paths needed.
# Lists the internal granular and global dependencies of the library.
# Source specific properties should be added at the end.
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake,v 1.5 2010/12/01 16:59:36 bmorgan Exp $
# GEANT4 Tag $Name: geant4-09-04 $
#
#------------------------------------------------------------------------------
# List external includes needed.
include_directories(${CLHEP_INCLUDE_DIRS})
# List internal includes needed.
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/externals/zlib/include)
# Must have GL headers available
include_directories(${OPENGL_INCLUDE_DIR})
#
# We need to add definitions depending on what GL drivers are built
#
if(GEANT4_USE_OPENGL)
ADD_DEFINITIONS(-DG4VIS_BUILD_OPENGL_DRIVER)
endif()
if(GEANT4_USE_INVENTOR)
ADD_DEFINITIONS(-DG4VIS_BUILD_OI_DRIVER)
endif()
#
# Define the Geant4 Module.
#
include(Geant4MacroDefineModule)
GEANT4_DEFINE_MODULE(NAME G4gl2ps
HEADERS
G4OpenGL2PSAction.hh
Geant4_gl2ps.h
gl2ps.h
SOURCES
G4OpenGL2PSAction.cc
gl2ps.cc
GRANULAR_DEPENDENCIES
G4zlib
GLOBAL_DEPENDENCIES
G4zlib
LINK_LIBRARIES
${OPENGL_LIBRARIES}
)
# List any source specific properties here

Some files were not shown because too many files have changed in this diff Show More