Import Geant4 10.7.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2020-06-26 10:23:25 +02:00
parent c02c370437
commit 67ba86d073
1871 changed files with 174422 additions and 131884 deletions
@@ -25,7 +25,7 @@
//
//
//
//
//
#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
@@ -44,6 +44,10 @@
#include <qlineedit.h>
#include <qbuttongroup.h>
#ifndef G4GMAKE
#include "moc_G4OpenGLQtExportDialog.cpp"
#endif
G4OpenGLQtExportDialog::G4OpenGLQtExportDialog(
QWidget* parentw
,QString format
@@ -68,7 +72,7 @@ G4OpenGLQtExportDialog::G4OpenGLQtExportDialog(
QVBoxLayout* globalVLayout = new QVBoxLayout(this);
globalVLayout->setMargin(10);
globalVLayout->setSpacing(10);
@@ -76,14 +80,14 @@ G4OpenGLQtExportDialog::G4OpenGLQtExportDialog(
QWidget * sizeWidget = new QWidget(this); // widget containing group button
QVBoxLayout * sizeWidgetLayout = new QVBoxLayout(sizeWidget);
sizeWidgetLayout->setMargin (10);
sizeWidgetLayout->setMargin (10);
// original and modify radiobuttons
sizeGroupBox = new QGroupBox(tr("Size"));
QVBoxLayout *sizeGroupBoxLayout = new QVBoxLayout(sizeGroupBox);
QButtonGroup * sizeButtonGroupBox = new QButtonGroup();
sizeGroupBoxLayout->setMargin (15);
sizeGroupBoxLayout->setMargin (15);
original = new QRadioButton("Original");
modify = new QRadioButton("Modify");
@@ -92,12 +96,12 @@ G4OpenGLQtExportDialog::G4OpenGLQtExportDialog(
sizeButtonGroupBox->addButton(modify);
sizeButtonGroupBox->setExclusive(true);
sizeGroupBoxLayout->addWidget(original);
sizeGroupBoxLayout->addWidget(modify);
sizeGroupBoxLayout->addWidget(original);
sizeGroupBoxLayout->addWidget(modify);
sizeGroupBox->setLayout(sizeGroupBoxLayout);
sizeWidgetLayout->addWidget(sizeGroupBox);
connect( sizeButtonGroupBox, SIGNAL( buttonClicked(QAbstractButton*) ), this, SLOT( changeSizeBox()) );
original->setChecked( true );
@@ -108,7 +112,7 @@ G4OpenGLQtExportDialog::G4OpenGLQtExportDialog(
QHBoxLayout *heightLineLayout = new QHBoxLayout(heightWidget);
QString tmp;
heightLineLayout->addWidget(new QLabel("Height",heightWidget));
height = new QLineEdit(tmp.setNum(originalHeight),heightWidget);
height->setMaxLength(5);
@@ -155,7 +159,7 @@ G4OpenGLQtExportDialog::G4OpenGLQtExportDialog(
QVBoxLayout * EPSGroupBoxLayout = new QVBoxLayout(EPSWidgetGroupBox);
EPSGroupBoxLayout->setMargin (15);
EPSGroupBoxLayout->setMargin (15);
// colorButton = new QRadioButton("Color",EPSWidgetGroupBox);
// BWButton = new QRadioButton("Grayscale",EPSWidgetGroupBox);
@@ -165,8 +169,8 @@ G4OpenGLQtExportDialog::G4OpenGLQtExportDialog(
// EPSColorButtonGroupBox->addButton(BWButton);
// EPSColorButtonGroupBox->setExclusive(true);
// EPSGroupBoxLayout->addWidget(colorButton);
// EPSGroupBoxLayout->addWidget(BWButton);
// EPSGroupBoxLayout->addWidget(colorButton);
// EPSGroupBoxLayout->addWidget(BWButton);
vectorEPSCheckBox = new QCheckBox( "Vector EPS File",EPSWidgetGroupBox);
EPSGroupBoxLayout->addWidget(vectorEPSCheckBox);
@@ -174,18 +178,18 @@ G4OpenGLQtExportDialog::G4OpenGLQtExportDialog(
EPSWidgetGroupBox->setLayout(EPSGroupBoxLayout);
// colorButton->setChecked( true );
vectorEPSCheckBox->setChecked( true );
globalVLayout->addWidget(EPSWidgetGroupBox);
connect( vectorEPSCheckBox, SIGNAL( clicked() ), this, SLOT( changeVectorEPS()) );
}
if ((format == "jpg") ||
if ((format == "jpg") ||
(format == "jpeg")) {
QGroupBox *imageGroupBox = new QGroupBox(tr("Image quality"),this);
QHBoxLayout *hSliderLayout = new QHBoxLayout(imageGroupBox);
hSliderLayout->setMargin (15);
hSliderLayout->setMargin (15);
qualitySlider= new QSlider(Qt::Horizontal,imageGroupBox);
qualitySlider->setMinimum(0);
@@ -195,7 +199,7 @@ G4OpenGLQtExportDialog::G4OpenGLQtExportDialog(
hSliderLayout->addWidget(new QLabel("Low ",imageGroupBox));
hSliderLayout->addWidget(qualitySlider);
hSliderLayout->addWidget(new QLabel(" Maximum",imageGroupBox));
imageGroupBox->setLayout(hSliderLayout);
globalVLayout->addWidget(imageGroupBox);
@@ -324,7 +328,7 @@ void G4OpenGLQtExportDialog:: textHeightChanged(
width->setText(tmp.setNum(s.toInt()*originalWidth/originalHeight));
isChangingSize = false;
}
}
}
G4OpenGLQtExportDialog::~G4OpenGLQtExportDialog()
{
@@ -25,7 +25,7 @@
//
//
//
//
//
#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
@@ -42,6 +42,9 @@
#include <qfiledialog.h>
#include <qprocess.h>
#ifndef G4GMAKE
#include "moc_G4OpenGLQtMovieDialog.cpp"
#endif
// +---------------------------------------+
// + Path for encoder +
@@ -75,12 +78,12 @@ G4OpenGLQtMovieDialog::G4OpenGLQtMovieDialog(
QVBoxLayout* globalVLayout = new QVBoxLayout(this);
globalVLayout->setMargin(10);
globalVLayout->setSpacing(10);
// Encoder group box
QGroupBox *encoderGroupBox = new QGroupBox(tr("Encoder path"),this);
QGroupBox *encoderGroupBox = new QGroupBox(tr("Encoder path"),this);
QVBoxLayout *encoderVGroupBoxLayout = new QVBoxLayout(encoderGroupBox);
// Encoder Path
// Encoder Path
QWidget *encoderHBox = new QWidget(encoderGroupBox);
QHBoxLayout *encoderHBoxLayout = new QHBoxLayout(encoderHBox);
fEncoderPath = new QLineEdit("",encoderHBox);
@@ -110,7 +113,7 @@ G4OpenGLQtMovieDialog::G4OpenGLQtMovieDialog(
QGroupBox *tempFolderGroupBox = new QGroupBox(tr("Temporary folder path"),this);
QVBoxLayout *tempFolderVGroupBoxLayout = new QVBoxLayout(tempFolderGroupBox);
// temp folder Path
// temp folder Path
QWidget *tempFolderHBox = new QWidget(tempFolderGroupBox);
QHBoxLayout *tempFolderHBoxLayout = new QHBoxLayout(tempFolderHBox);
@@ -141,7 +144,7 @@ G4OpenGLQtMovieDialog::G4OpenGLQtMovieDialog(
QGroupBox *saveFileGroupBox = new QGroupBox(tr("Save as"),this);
QVBoxLayout *saveFileVGroupBoxLayout = new QVBoxLayout(saveFileGroupBox);
// save file
// save file
QWidget *saveFileHBox = new QWidget(saveFileGroupBox);
QHBoxLayout *saveFileHBoxLayout = new QHBoxLayout(saveFileHBox);
@@ -261,7 +264,7 @@ void G4OpenGLQtMovieDialog::selectEncoderPathAction()
{
QString nomFich = QFileDialog::getOpenFileName ( this,
"Select your encoder",
tr("Select your encoder ..."));
tr("Select your encoder ..."));
if (nomFich == "") {
@@ -276,7 +279,7 @@ void G4OpenGLQtMovieDialog::selectTempPathAction()
{
QString nomFich = QFileDialog::getExistingDirectory ( this,
"Select temporary folder",
tr("Select temporary folder ..."));
tr("Select temporary folder ..."));
if (nomFich == "") {
return;
@@ -290,7 +293,7 @@ void G4OpenGLQtMovieDialog::selectSaveFileNameAction()
{
QString nomFich = QFileDialog::getSaveFileName ( this,
"Select saved file",
tr("Select saved file ..."));
tr("Select saved file ..."));
if (nomFich == "") {
return;
@@ -371,7 +374,7 @@ bool G4OpenGLQtMovieDialog::checkSaveFileNameParameters() {
QString temp = fParentViewer->setSaveFileName(fSaveFileName->text());
fSaveFileStatus->setText(temp);
if (temp != "") {
if (temp != "") {
mypalette.setColor( QPalette::Base, Qt::red);
status = false;
} else {
File diff suppressed because it is too large Load Diff
@@ -1055,14 +1055,16 @@ bool G4OpenGLViewer::setExportFilename(G4String name,G4bool inc) {
} else {
// guess format by extention
std::string extension = name.substr(name.find_last_of(".") + 1);
// no format
if (name.size() != extension.size()) {
if (! setExportImageFormat(extension, false)) {
// If there is a dot in the name the above might find rubbish, so...
if (extension.size() >= 3 && extension.size() <= 4) { // Possible extension
if (setExportImageFormat(extension, false)) { // Extension found
fExportFilename = name.substr(0,name.find_last_of("."));
} else { // No viable extension found
return false;
}
} else { // Assume name is already the required without-extension part
fExportFilename = name;
}
// get the name
fExportFilename = name.substr(0,name.find_last_of("."));
}
return true;
}
@@ -62,24 +62,35 @@ G4OpenGLViewerMessenger::G4OpenGLViewerMessenger()
fpCommandExport =
new G4UIcommand("/vis/ogl/export", this);
fpCommandExport->SetGuidance ("export a screenshot of current OpenGL viewer");
fpCommandExport->SetGuidance ("If name is \"\", filename and extension will have the default value");
fpCommandExport->SetGuidance ("If name is \"toto.png\", set the name to \"toto\" and the format to \"png\". No incremented suffix is added.");
fpCommandExport->SetGuidance ("If name is \"toto\", set the name to \"toto\" and the format to default (or current format if specify). Will also add an incremented suffix at the end of the file, except if name is the same as previous it will not reset incremented suffix.");
fpCommandExport->SetGuidance ("Setting size is available only on eps/pdf/svg/ps formats");
fpCommandExport->SetGuidance ("Export a screenshot of current OpenGL viewer");
fpCommandExport->SetGuidance
("If name is \"\", filename and extension will have the current value");
fpCommandExport->SetGuidance
("If name is \"toto.png\", set the name to \"toto\" and the format to \"png\".");
fpCommandExport->SetGuidance
("If name is \"toto\", set the name to \"toto\" and the format to current format.");
fpCommandExport->SetGuidance
("Will also add an incremented suffix at the end of the name, except if name is"
"\nthe same as previous it will not reset the incremented suffix.");
fpCommandExport->SetGuidance
("Setting size is available only on eps/pdf/svg/ps formats.");
G4UIparameter* parameterExport;
parameterExport = new G4UIparameter ("name", 's', omitable = true);
parameterExport->SetDefaultValue("!");
parameterExport->SetGuidance("by default, will take a default value or the last /vis/ogl/set/printFilename value if set");
parameterExport->SetGuidance
("By default, will take a default value or the last \"/vis/ogl/set/printFilename\""
" value if set.");
fpCommandExport->SetParameter(parameterExport);
parameterExport = new G4UIparameter ("width", 'd', omitable = true);
parameterExport->SetGuidance("By default, will take the current width of the viewer or /vis/ogl/set/printSize if set");
parameterExport->SetGuidance("This parameter is only useful for eps/pdf/svg/ps formats !");
parameterExport->SetGuidance
("By default, will take the current width of the viewer or \"/vis/ogl/set/printSize\""
"\nif set. This parameter is only useful for eps/pdf/svg/ps formats !");
parameterExport->SetDefaultValue(-1);
fpCommandExport->SetParameter(parameterExport);
parameterExport = new G4UIparameter ("height", 'd', omitable = true);
parameterExport->SetGuidance("By default, will take the current height of the viewer or /vis/ogl/set/printSize if set");
parameterExport->SetGuidance("This parameter is only useful for eps/pdf/svg/ps formats !");
parameterExport->SetGuidance
("By default, will take the current height of the viewer or \"/vis/ogl/set/printSize\""
"\nif set. This parameter is only useful for eps/pdf/svg/ps formats !");
parameterExport->SetDefaultValue(-1);
fpCommandExport->SetParameter(parameterExport);
@@ -109,8 +120,10 @@ G4OpenGLViewerMessenger::G4OpenGLViewerMessenger()
new G4UIcmdWithoutParameter("/vis/ogl/printEPS", this);
fpCommandPrintEPS->SetGuidance("Print Encapsulated PostScript file.");
fpCommandPrintEPS->SetGuidance
("Generates files with names G4OpenGL_n.eps, where n is a sequence"
"\nnumber, starting at 0."
("See \"/vis/ogl/export\" for other file formats.");
fpCommandPrintEPS->SetGuidance
("Generates files with names G4OpenGL_viewer-name_nnnn.eps, where nnnn is a"
"\nsequence number, starting at 0000."
"\nCan be \"vectored\" or \"pixmap\" - see \"/vis/ogl/set/printMode\".");
fpDirectorySet = new G4UIdirectory ("/vis/ogl/set/");
@@ -235,6 +248,17 @@ G4OpenGLViewerMessenger::G4OpenGLViewerMessenger()
fpCommandEventsDrawInterval->SetParameterName("N", omitable = true);
fpCommandEventsDrawInterval->SetDefaultValue(1);
fpCommandExportFormat =
new G4UIcommand("/vis/ogl/set/exportFormat", this);
fpCommandExportFormat->SetGuidance ("Set export format");
fpCommandExportFormat->SetGuidance ("By default, pdf/eps/svg/ps are available. Depending of viewers several other format are available.");
fpCommandExportFormat->SetGuidance ("Try /vis/ogl/set/exportFormat without parameters to see them.");
fpCommandExportFormat->SetGuidance ("Changing format will reset the incremental suffix to 0.");
G4UIparameter* parameterExportFormat;
parameterExportFormat = new G4UIparameter ("format", 's', omitable = true);
parameterExportFormat->SetDefaultValue("");
fpCommandExportFormat->SetParameter(parameterExportFormat);
fpCommandFade = new G4UIcmdWithADouble("/vis/ogl/set/fade", this);
fpCommandFade->SetGuidance
("DEPRECATED. Use /vis/viewer/set/timeWindow/fadeFactor."
@@ -255,19 +279,7 @@ G4OpenGLViewerMessenger::G4OpenGLViewerMessenger()
parameterPrintFilename->SetDefaultValue(1);
fpCommandPrintFilename->SetParameter(parameterPrintFilename);
fpCommandExportFormat =
new G4UIcommand("/vis/ogl/set/exportFormat", this);
fpCommandExportFormat->SetGuidance ("Set export format");
fpCommandExportFormat->SetGuidance ("By default, pdf/eps/svg/ps are available. Depending of viewers several other format are available.");
fpCommandExportFormat->SetGuidance ("Try /vis/ogl/set/exportFormat without parameters to see them.");
fpCommandExportFormat->SetGuidance ("Changing format will reset the incremental suffix to 0.");
G4UIparameter* parameterExportFormat;
parameterExportFormat = new G4UIparameter ("format", 's', omitable = true);
parameterExportFormat->SetDefaultValue("");
fpCommandExportFormat->SetParameter(parameterExportFormat);
fpCommandPrintMode = new G4UIcmdWithAString
("/vis/ogl/set/printMode",this);
fpCommandPrintMode = new G4UIcmdWithAString("/vis/ogl/set/printMode",this);
fpCommandPrintMode->SetGuidance("Set print mode, only available for \"ps\" format");
fpCommandPrintMode->SetParameterName("print_mode",omitable = true);
fpCommandPrintMode->SetCandidates("vectored pixmap");
@@ -384,27 +396,7 @@ void G4OpenGLViewerMessenger::SetNewValue
<< G4endl;
return;
}
if (command == fpCommandPrintEPS)
{
pOGLViewer->setExportImageFormat("eps",true);
pOGLViewer->exportImage();
if (pOGLViewer->fVP.IsAutoRefresh())
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
return;
}
if (command == fpCommandExportFormat)
{
G4String name;
std::istringstream iss(newValue);
iss >> name;
pOGLViewer->setExportImageFormat(name);
return;
}
if (command == fpCommandExport)
{
G4String name;
@@ -418,41 +410,15 @@ void G4OpenGLViewerMessenger::SetNewValue
return;
}
if (command == fpCommandPrintSize)
{
G4int width,height;
std::istringstream iss(newValue);
iss >> width
>> height;
pOGLViewer->setExportSize(width,height);
return;
}
if (command == fpCommandExportFormat)
{
G4String name;
std::istringstream iss(newValue);
iss >> name;
pOGLViewer->setExportImageFormat(name);
if (command == fpCommandPrintFilename)
{
G4String name;
G4bool inc;
std::istringstream iss(newValue);
iss >> name
>> inc;
pOGLViewer->setExportFilename(name,inc);
return;
}
if (command == fpCommandPrintMode)
{
if (newValue == "vectored") pOGLViewer->fVectoredPs = true;
if (newValue == "pixmap") pOGLViewer->fVectoredPs = false;
return;
}
if (command == fpCommandTransparency)
{
pOGLViewer->transparency_enabled = command->ConvertToBool(newValue);
if (pOGLViewer->fVP.IsAutoRefresh())
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
return;
}
return;
}
if (command == fpCommandEventsDrawInterval)
{
@@ -465,17 +431,17 @@ void G4OpenGLViewerMessenger::SetNewValue
if (command == fpCommandFlushAt)
{
// G4bool firstTime = true;
std::map<G4String,G4OpenGLSceneHandler::FlushAction> actionMap;
// if (firstTime) {
static G4bool firstTime = true;
static std::map<G4String,G4OpenGLSceneHandler::FlushAction> actionMap;
if (firstTime) {
actionMap["endOfEvent"] = G4OpenGLSceneHandler::endOfEvent;
actionMap["endOfRun"] = G4OpenGLSceneHandler::endOfRun;
actionMap["eachPrimitive"] = G4OpenGLSceneHandler::eachPrimitive;
actionMap["NthPrimitive"] = G4OpenGLSceneHandler::NthPrimitive;
actionMap["NthEvent"] = G4OpenGLSceneHandler::NthEvent;
actionMap["never"] = G4OpenGLSceneHandler::never;
// firstTime = false;
// }
firstTime = false;
}
G4String action;
G4int entitiesFlushInterval;
std::istringstream iss(newValue);
@@ -485,6 +451,54 @@ void G4OpenGLViewerMessenger::SetNewValue
return;
}
if (command == fpCommandPrintEPS)
{
pOGLViewer->setExportImageFormat("eps",true);
pOGLViewer->exportImage();
if (pOGLViewer->fVP.IsAutoRefresh())
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
return;
}
if (command == fpCommandPrintFilename)
{
G4String name;
G4bool inc;
std::istringstream iss(newValue);
iss >> name
>> inc;
pOGLViewer->setExportFilename(name,inc);
return;
}
if (command == fpCommandPrintMode)
{
if (newValue == "vectored") pOGLViewer->fVectoredPs = true;
if (newValue == "pixmap") pOGLViewer->fVectoredPs = false;
return;
}
if (command == fpCommandPrintSize)
{
G4int width,height;
std::istringstream iss(newValue);
iss >> width
>> height;
pOGLViewer->setExportSize(width,height);
return;
}
if (command == fpCommandTransparency)
{
pOGLViewer->transparency_enabled = command->ConvertToBool(newValue);
if (pOGLViewer->fVP.IsAutoRefresh())
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
return;
}
// Stored viewer commands
G4OpenGLStoredViewer* pOGLSViewer =
dynamic_cast<G4OpenGLStoredViewer*>(pViewer);
@@ -605,6 +619,7 @@ void G4OpenGLViewerMessenger::SetNewValue
return;
}
// Scene handler commands
G4OpenGLStoredSceneHandler* pOGLSSceneHandler =
dynamic_cast<G4OpenGLStoredSceneHandler*>(pViewer->GetSceneHandler());