Import Geant4 10.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 14:11:04 +02:00
parent c9b32a6c0a
commit d4af681f38
4886 changed files with 420149 additions and 1023309 deletions
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4OpenInventor.cc 66373 2012-12-18 09:41:34Z gcosmo $
// $Id: G4OpenInventor.cc 91687 2015-07-31 09:44:16Z gcosmo $
//
#ifdef G4VIS_BUILD_OI_DRIVER
@@ -47,6 +47,9 @@
#include "G4OpenInventorSceneHandler.hh"
#include "G4UImanager.hh"
#include "G4UIbatch.hh"
G4OpenInventor::G4OpenInventor (
const G4String name
,const G4String nickname
@@ -88,6 +91,30 @@ void G4OpenInventor::InitNodes()
SoAlternateRepAction::initClass();
}
G4bool G4OpenInventor::IsUISessionCompatible () const
{
G4bool isCompatible = false;
G4UImanager* ui = G4UImanager::GetUIpointer();
G4UIsession* session = ui->GetSession();
// If session is a batch session, it may be:
// a) this is a batch job (the user has not instantiated any UI session);
// b) we are currently processing a UI command, in which case the UI
// manager creates a temporary batch session and to find out if there is
// a genuine UI session that the user has instantiated we must drill
// down through previous sessions to a possible non-batch session.
while (G4UIbatch* batch = dynamic_cast<G4UIbatch*>(session)) {
session = batch->GetPreviousSession();
}
// OI windows are not appropriate in a batch session.
if (session) {
// If non-zero, this is the originating non-batch session
// The user has instantiated a UI session...
isCompatible = true;
}
return isCompatible;
}
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4OpenInventorViewer.cc 66373 2012-12-18 09:41:34Z gcosmo $
// $Id: G4OpenInventorViewer.cc 88190 2015-02-02 17:24:54Z gcosmo $
#ifdef G4VIS_BUILD_OI_DRIVER
@@ -482,11 +482,29 @@ void G4OpenInventorViewer::Escape(){
void G4OpenInventorViewer::WritePostScript(const G4String& aFile) {
if(!fGL2PSAction) return;
fGL2PSAction->setFileName(aFile.c_str());
fGL2PSAction->setExportImageFormat(GL2PS_EPS);
// Use gl2ps default buffer (2048*2048)
fGL2PSAction->setBufferSize(0);
G4cout << "Produce " << aFile << "..." << G4endl;
if (fGL2PSAction->enableFileWriting()) {
ViewerRender();
fGL2PSAction->disableFileWriting();
}
fGL2PSAction->resetBufferSizeParameters();
}
void G4OpenInventorViewer::WritePDF(const G4String& aFile) {
if(!fGL2PSAction) return;
fGL2PSAction->setFileName(aFile.c_str());
fGL2PSAction->setExportImageFormat(GL2PS_PDF);
// Use gl2ps default buffer (2048*2048)
fGL2PSAction->setBufferSize(0);
G4cout << "Produce " << aFile << "..." << G4endl;
if (fGL2PSAction->enableFileWriting()) {
ViewerRender();
fGL2PSAction->disableFileWriting();
}
fGL2PSAction->resetBufferSizeParameters();
}
void G4OpenInventorViewer::WritePixmapPostScript(const G4String& aFile) {
@@ -148,8 +148,9 @@ void G4OpenInventorXtExtendedViewer::Initialise() {
{Widget menu = fViewer->getMenu();
//{Widget menu = AddMenu(menuBar,"File","File");
AddButton(menu,"PS (gl2ps)",PostScriptCbk);
AddButton(menu,"PS (pixmap)",PixmapPostScriptCbk);
AddButton(menu,"Write PS (gl2ps)",PostScriptCbk);
AddButton(menu, "Write PDF (gl2ps)", PDFCbk);
AddButton(menu,"Write PS (pixmap)",PixmapPostScriptCbk);
AddButton(menu,"Write IV",WriteInventorCbk);
AddButton(menu,"Escape",EscapeCbk);}
@@ -325,6 +326,11 @@ void G4OpenInventorXtExtendedViewer::PostScriptCbk(
G4OpenInventorXtExtendedViewer* This = (G4OpenInventorXtExtendedViewer*)aData;
This->WritePostScript();
}
void G4OpenInventorXtExtendedViewer::PDFCbk(
Widget,XtPointer aData,XtPointer) {
G4OpenInventorXtExtendedViewer* This = (G4OpenInventorXtExtendedViewer*)aData;
This->WritePDF();
}
void G4OpenInventorXtExtendedViewer::PixmapPostScriptCbk(
Widget,XtPointer aData,XtPointer) {