Import Geant4 10.4.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2017-06-30 10:49:55 +02:00
parent 3a5407696b
commit 1a1316fea4
2180 changed files with 237880 additions and 59109 deletions
+27 -2
View File
@@ -1,4 +1,4 @@
$Id: History 102570 2017-02-09 08:40:47Z gcosmo $
$Id: History 104288 2017-05-23 13:23:23Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,7 +17,32 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
6th January 2017 John Allison (opengl-V10-02-27)
23rd May 2017 John Allison (opengl-V10-03-02)
- Hopefully fix gcc-7.1 warnings.
16th May 2017 Laurent Garnier
- Fix DEV-262 bug. Picking was not working for retina display due to a screen factor *2
23rd April 2017 John Allison
- G4OpenGLXViewer.cc: Reverted to XA_RGB_BEST_MAP.
- G4OpenGLViewer.cc:
o Minor improvement to picking (suppressing "no hits" message).
o Minor code clean-uo.
18th January 2017 Laurent Garnier
- Merge John's picking branch
o G4OpenGLViewer, G4OpenGLQtViewer, G4OpenGLSceneHandler, G4OpenGLStoredQtViewer, G4OpenGLViewer
G4OpenGLQtViewer.cc: Change labels of picking points in pick info box
17th January 2017 Laurent Garnier
- G4OpenGLQtViewer.cc: Change labels of picking points in pick info box
12th January 2017 John Allison (opengl-V10-03-01)
- G4OpenGLImmediate/StoredQtViewer::ShowView: Tidied.
- G4OpenGLSceneHandler::ScaledFlush: Tidied.
6th January 2017 John Allison (opengl-V10-03-00)
- G4OpenGLSceneHandler.cc: Fixed bug in ScaledFlush.
21th November 2016 Laurent Garnier (opengl-V10-02-26)
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4OpenGLViewer.hh 101714 2016-11-22 08:53:13Z gcosmo $
// $Id: G4OpenGLViewer.hh 103926 2017-05-03 13:43:27Z gcosmo $
//
//
// Andrew Walkden 27th March 1996
@@ -153,7 +153,7 @@ protected:
void ResizeGLView();
void ResizeWindow(unsigned int, unsigned int);
virtual G4String Pick(GLdouble x, GLdouble y);
std::vector < G4OpenGLViewerPickMap* > GetPickDetails(GLdouble x, GLdouble y);
const std::vector < G4OpenGLViewerPickMap* > & GetPickDetails(GLdouble x, GLdouble y);
virtual void CreateFontLists () {}
void rotateScene (G4double dx, G4double dy);
void rotateSceneToggle (G4double dx, G4double dy);
@@ -0,0 +1,101 @@
/****************************************************************************
** Meta object code from reading C++ file 'G4OpenGLQtExportDialog.hh'
**
** Created: Tue May 23 15:27:06 2017
** by: The Qt Meta Object Compiler version 63 (Qt 4.8.4)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../include/G4OpenGLQtExportDialog.hh"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'G4OpenGLQtExportDialog.hh' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 63
#error "This file was generated using the moc from 4.8.4. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_G4OpenGLQtExportDialog[] = {
// content:
6, // revision
0, // classname
0, 0, // classinfo
4, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: signature, parameters, type, tag, flags
24, 23, 23, 23, 0x0a,
40, 23, 23, 23, 0x0a,
58, 23, 23, 23, 0x0a,
84, 23, 23, 23, 0x0a,
0 // eod
};
static const char qt_meta_stringdata_G4OpenGLQtExportDialog[] = {
"G4OpenGLQtExportDialog\0\0changeSizeBox()\0"
"changeVectorEPS()\0textWidthChanged(QString)\0"
"textHeightChanged(QString)\0"
};
void G4OpenGLQtExportDialog::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
Q_ASSERT(staticMetaObject.cast(_o));
G4OpenGLQtExportDialog *_t = static_cast<G4OpenGLQtExportDialog *>(_o);
switch (_id) {
case 0: _t->changeSizeBox(); break;
case 1: _t->changeVectorEPS(); break;
case 2: _t->textWidthChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
case 3: _t->textHeightChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
default: ;
}
}
}
const QMetaObjectExtraData G4OpenGLQtExportDialog::staticMetaObjectExtraData = {
0, qt_static_metacall
};
const QMetaObject G4OpenGLQtExportDialog::staticMetaObject = {
{ &QDialog::staticMetaObject, qt_meta_stringdata_G4OpenGLQtExportDialog,
qt_meta_data_G4OpenGLQtExportDialog, &staticMetaObjectExtraData }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &G4OpenGLQtExportDialog::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *G4OpenGLQtExportDialog::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *G4OpenGLQtExportDialog::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_G4OpenGLQtExportDialog))
return static_cast<void*>(const_cast< G4OpenGLQtExportDialog*>(this));
return QDialog::qt_metacast(_clname);
}
int G4OpenGLQtExportDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QDialog::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 4)
qt_static_metacall(this, _c, _id, _a);
_id -= 4;
}
return _id;
}
QT_END_MOC_NAMESPACE
@@ -0,0 +1,121 @@
/****************************************************************************
** Meta object code from reading C++ file 'G4OpenGLQtMovieDialog.hh'
**
** Created: Tue May 23 15:27:06 2017
** by: The Qt Meta Object Compiler version 63 (Qt 4.8.4)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../include/G4OpenGLQtMovieDialog.hh"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'G4OpenGLQtMovieDialog.hh' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 63
#error "This file was generated using the moc from 4.8.4. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_G4OpenGLQtMovieDialog[] = {
// content:
6, // revision
0, // classname
0, 0, // classinfo
10, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: signature, parameters, type, tag, flags
23, 22, 22, 22, 0x0a,
41, 22, 22, 22, 0x0a,
53, 22, 48, 22, 0x0a,
80, 22, 48, 22, 0x0a,
110, 22, 48, 22, 0x0a,
138, 22, 22, 22, 0x08,
164, 22, 22, 22, 0x08,
187, 22, 22, 22, 0x08,
214, 22, 22, 22, 0x08,
231, 22, 22, 22, 0x08,
0 // eod
};
static const char qt_meta_stringdata_G4OpenGLQtMovieDialog[] = {
"G4OpenGLQtMovieDialog\0\0stopFinishClose()\0"
"save()\0bool\0checkEncoderSwParameters()\0"
"checkSaveFileNameParameters()\0"
"checkTempFolderParameters()\0"
"selectEncoderPathAction()\0"
"selectTempPathAction()\0"
"selectSaveFileNameAction()\0resetRecording()\0"
"enabledApplyButton()\0"
};
void G4OpenGLQtMovieDialog::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
Q_ASSERT(staticMetaObject.cast(_o));
G4OpenGLQtMovieDialog *_t = static_cast<G4OpenGLQtMovieDialog *>(_o);
switch (_id) {
case 0: _t->stopFinishClose(); break;
case 1: _t->save(); break;
case 2: { bool _r = _t->checkEncoderSwParameters();
if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break;
case 3: { bool _r = _t->checkSaveFileNameParameters();
if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break;
case 4: { bool _r = _t->checkTempFolderParameters();
if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break;
case 5: _t->selectEncoderPathAction(); break;
case 6: _t->selectTempPathAction(); break;
case 7: _t->selectSaveFileNameAction(); break;
case 8: _t->resetRecording(); break;
case 9: _t->enabledApplyButton(); break;
default: ;
}
}
}
const QMetaObjectExtraData G4OpenGLQtMovieDialog::staticMetaObjectExtraData = {
0, qt_static_metacall
};
const QMetaObject G4OpenGLQtMovieDialog::staticMetaObject = {
{ &QDialog::staticMetaObject, qt_meta_stringdata_G4OpenGLQtMovieDialog,
qt_meta_data_G4OpenGLQtMovieDialog, &staticMetaObjectExtraData }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &G4OpenGLQtMovieDialog::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *G4OpenGLQtMovieDialog::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *G4OpenGLQtMovieDialog::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_G4OpenGLQtMovieDialog))
return static_cast<void*>(const_cast< G4OpenGLQtMovieDialog*>(this));
return QDialog::qt_metacast(_clname);
}
int G4OpenGLQtMovieDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QDialog::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 10)
qt_static_metacall(this, _c, _id, _a);
_id -= 10;
}
return _id;
}
QT_END_MOC_NAMESPACE
@@ -0,0 +1,170 @@
/****************************************************************************
** Meta object code from reading C++ file 'G4OpenGLQtViewer.hh'
**
** Created: Tue May 23 15:27:06 2017
** by: The Qt Meta Object Compiler version 63 (Qt 4.8.4)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../include/G4OpenGLQtViewer.hh"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'G4OpenGLQtViewer.hh' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 63
#error "This file was generated using the moc from 4.8.4. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_G4OpenGLQtViewer[] = {
// content:
6, // revision
0, // classname
0, 0, // classinfo
29, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: signature, parameters, type, tag, flags
18, 17, 17, 17, 0x0a,
36, 17, 17, 17, 0x09,
71, 17, 17, 17, 0x08,
89, 17, 17, 17, 0x08,
119, 17, 17, 17, 0x08,
143, 17, 17, 17, 0x08,
170, 17, 17, 17, 0x08,
194, 17, 17, 17, 0x08,
210, 17, 17, 17, 0x08,
233, 17, 17, 17, 0x08,
258, 17, 17, 17, 0x08,
281, 17, 17, 17, 0x08,
306, 17, 17, 17, 0x08,
331, 17, 17, 17, 0x08,
351, 17, 17, 17, 0x08,
367, 17, 17, 17, 0x08,
393, 17, 17, 17, 0x08,
416, 17, 17, 17, 0x08,
440, 17, 17, 17, 0x08,
465, 17, 17, 17, 0x08,
495, 487, 17, 17, 0x08,
547, 17, 17, 17, 0x08,
588, 17, 17, 17, 0x08,
604, 17, 17, 17, 0x08,
629, 17, 17, 17, 0x08,
658, 17, 17, 17, 0x08,
686, 17, 17, 17, 0x08,
719, 710, 17, 17, 0x08,
768, 17, 17, 17, 0x08,
0 // eod
};
static const char qt_meta_stringdata_G4OpenGLQtViewer[] = {
"G4OpenGLQtViewer\0\0startPauseVideo()\0"
"updateToolbarAndMouseContextMenu()\0"
"actionSaveImage()\0actionChangeBackgroundColor()\0"
"actionChangeTextColor()\0"
"actionChangeDefaultColor()\0"
"actionMovieParameters()\0showShortcuts()\0"
"toggleMouseAction(int)\0toggleSurfaceAction(int)\0"
"toggleProjection(bool)\0toggleTransparency(bool)\0"
"toggleAntialiasing(bool)\0toggleHaloing(bool)\0"
"toggleAux(bool)\0toggleHiddenMarkers(bool)\0"
"toggleFullScreen(bool)\0processEncodeFinished()\0"
"processLookForFinished()\0processEncodeStdout()\0"
"item,id\0sceneTreeComponentItemChanged(QTreeWidgetItem*,int)\0"
"toggleSceneTreeComponentPickingCout(int)\0"
"togglePicking()\0currentTabActivated(int)\0"
"sceneTreeComponentSelected()\0"
"changeDepthInSceneTree(int)\0"
"changeSearchSelection()\0item,val\0"
"changeColorAndTransparency(QTreeWidgetItem*,int)\0"
"tableWidgetViewerSetItemChanged(QTableWidgetItem*)\0"
};
void G4OpenGLQtViewer::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
Q_ASSERT(staticMetaObject.cast(_o));
G4OpenGLQtViewer *_t = static_cast<G4OpenGLQtViewer *>(_o);
switch (_id) {
case 0: _t->startPauseVideo(); break;
case 1: _t->updateToolbarAndMouseContextMenu(); break;
case 2: _t->actionSaveImage(); break;
case 3: _t->actionChangeBackgroundColor(); break;
case 4: _t->actionChangeTextColor(); break;
case 5: _t->actionChangeDefaultColor(); break;
case 6: _t->actionMovieParameters(); break;
case 7: _t->showShortcuts(); break;
case 8: _t->toggleMouseAction((*reinterpret_cast< int(*)>(_a[1]))); break;
case 9: _t->toggleSurfaceAction((*reinterpret_cast< int(*)>(_a[1]))); break;
case 10: _t->toggleProjection((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 11: _t->toggleTransparency((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 12: _t->toggleAntialiasing((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 13: _t->toggleHaloing((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 14: _t->toggleAux((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 15: _t->toggleHiddenMarkers((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 16: _t->toggleFullScreen((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 17: _t->processEncodeFinished(); break;
case 18: _t->processLookForFinished(); break;
case 19: _t->processEncodeStdout(); break;
case 20: _t->sceneTreeComponentItemChanged((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
case 21: _t->toggleSceneTreeComponentPickingCout((*reinterpret_cast< int(*)>(_a[1]))); break;
case 22: _t->togglePicking(); break;
case 23: _t->currentTabActivated((*reinterpret_cast< int(*)>(_a[1]))); break;
case 24: _t->sceneTreeComponentSelected(); break;
case 25: _t->changeDepthInSceneTree((*reinterpret_cast< int(*)>(_a[1]))); break;
case 26: _t->changeSearchSelection(); break;
case 27: _t->changeColorAndTransparency((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
case 28: _t->tableWidgetViewerSetItemChanged((*reinterpret_cast< QTableWidgetItem*(*)>(_a[1]))); break;
default: ;
}
}
}
const QMetaObjectExtraData G4OpenGLQtViewer::staticMetaObjectExtraData = {
0, qt_static_metacall
};
const QMetaObject G4OpenGLQtViewer::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_G4OpenGLQtViewer,
qt_meta_data_G4OpenGLQtViewer, &staticMetaObjectExtraData }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &G4OpenGLQtViewer::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *G4OpenGLQtViewer::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *G4OpenGLQtViewer::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_G4OpenGLQtViewer))
return static_cast<void*>(const_cast< G4OpenGLQtViewer*>(this));
if (!strcmp(_clname, "G4OpenGLViewer"))
return static_cast< G4OpenGLViewer*>(const_cast< G4OpenGLQtViewer*>(this));
return QObject::qt_metacast(_clname);
}
int G4OpenGLQtViewer::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 29)
qt_static_metacall(this, _c, _id, _a);
_id -= 29;
}
return _id;
}
QT_END_MOC_NAMESPACE
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4OpenGLImmediateQtViewer.cc 101714 2016-11-22 08:53:13Z gcosmo $
// $Id: G4OpenGLImmediateQtViewer.cc 103926 2017-05-03 13:43:27Z gcosmo $
//
//
// Class G4OpenGLImmediateQtViewer : a class derived from G4OpenGLQtViewer and
@@ -344,8 +344,6 @@ void G4OpenGLImmediateQtViewer::ShowView (
//////////////////////////////////////////////////////////////////////////////
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
{
// Tentatively offered - JA
// glFlush ();
fHasToRepaint = true;
activateWindow();
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4OpenGLQtViewer.cc 101105 2016-11-07 08:09:26Z gcosmo $
// $Id: G4OpenGLQtViewer.cc 104288 2017-05-23 13:23:23Z gcosmo $
//
//
// G4OpenGLQtViewer : Class to provide Qt specific
@@ -98,15 +98,15 @@
#include "G4Threading.hh"
#endif
#ifdef G4MULTITHREADED
namespace
{
#ifdef G4MULTITHREADED
G4Mutex mWaitForVisSubThreadQtOpenGLContextMoved = G4MUTEX_INITIALIZER;
G4Mutex mWaitForVisSubThreadQtOpenGLContextInitialized = G4MUTEX_INITIALIZER;
G4Condition c1_VisSubThreadQtOpenGLContextInitialized = G4CONDITION_INITIALIZER;
G4Condition c2_VisSubThreadQtOpenGLContextMoved = G4CONDITION_INITIALIZER;
#endif
}
#endif
//////////////////////////////////////////////////////////////////////////////
void G4OpenGLQtViewer::CreateMainWindow (
@@ -1290,8 +1290,14 @@ void G4OpenGLQtViewer::G4MousePressEvent(QMouseEvent *evnt)
*/
void G4OpenGLQtViewer::G4MouseReleaseEvent(QMouseEvent *evnt)
{
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
// factorX == factorY
double factorX = ((double)viewport[2]/fGLWidget->width());
double factorY = ((double)viewport[3]/fGLWidget->height());
fSpinningDelay = fLastEventTime->elapsed();
QPoint delta = (fLastPos3-fLastPos1);
QPoint delta = (fLastPos3-fLastPos1)*factorX;
// reset cursor state
fGLWidget->setCursor(QCursor(Qt::ArrowCursor));
@@ -1300,7 +1306,7 @@ void G4OpenGLQtViewer::G4MouseReleaseEvent(QMouseEvent *evnt)
if ((delta.x() != 0) || (delta.y() != 0)) {
return;
}
updatePickInfosWidget(evnt->pos().x(),evnt->pos().y());
updatePickInfosWidget(evnt->pos().x()*factorX,evnt->pos().y()*factorY);
} else if (fSpinningDelay < fLaunchSpinDelay ) {
if ((delta.x() == 0) && (delta.y() == 0)) {
@@ -2135,7 +2141,7 @@ bool G4OpenGLQtViewer::exportImage(std::string name, int width, int height) {
setExportSize(width, height);
}
// first, try to do it with generic function
if (G4OpenGLViewer::exportImage()) {
if (G4OpenGLViewer::exportImage(name, width, height)) {
return true;
// Then try Qt saving functions
@@ -4446,7 +4452,7 @@ void G4OpenGLQtViewer::updatePickInfosWidget(int aX, int aY) {
createPickInfosWidget();
}
std::vector < G4OpenGLViewerPickMap* > pickMap = GetPickDetails(aX,aY);
const std::vector < G4OpenGLViewerPickMap* > & pickMap = GetPickDetails(aX,aY);
// remove all previous widgets
if (fPickInfosWidget) {
@@ -4472,8 +4478,41 @@ void G4OpenGLQtViewer::updatePickInfosWidget(int aX, int aY) {
for (unsigned int a=0; a< pickMap.size(); a++) {
// Add a box inside the pick viewer box
std::ostringstream label;
label << "Hit number:" << a << ", PickName: " << pickMap[a]->getPickName();
if (pickMap[a]->getAttributes().size() > 0) {
std::string txt = pickMap[a]->getAttributes()[0].data();
// Look for Volumes
std::size_t pos = txt.find("Physical Volume Path (PVPath):") + 31;
if (pos != 31-1) {
std::size_t pos2 = txt.find("\n",pos);
label << "Volume: " + txt.substr(pos,pos2-pos);
} else {
// Look for tracks
if (pickMap[a]->getAttributes().size() > 1) {
std::string txt1 = pickMap[a]->getAttributes()[1].data();
pos = txt.find("Run ID (RunID):") + 16;
if (pos != 16-1) {
std::size_t pos2 = txt.find("\n",pos);
std::size_t posEID = txt.find("Event ID (EventID):",pos2) + 20;
std::size_t posEID2 = txt.find("\n",posEID);
std::size_t posPN = txt1.find("Particle Name (PN):") + 20;
std::size_t posPN2 = txt1.find("\n",posPN);
std::size_t posCh = txt1.find("Charge (Ch):",posPN2) + 13;
std::size_t posCh2 = txt1.find("\n",posCh);
label << "RunID:" << txt.substr(pos,pos2-pos)
<< " EventID:" << txt.substr(posEID,posEID2-posEID)
<< " PN:" << txt1.substr(posPN,posPN2-posPN)
<< " Ch:" << txt1.substr(posCh,posCh2-posCh);
}
} else {
label << "Hit number:" << a << ", PickName: " << pickMap[a]->getPickName();
}
}
} else {
label << "Hit number:" << a << ", PickName: " << pickMap[a]->getPickName();
}
QPushButton* pickCoutButton = new QPushButton(label.str().c_str());
pickCoutButton->setStyleSheet ("text-align: left; padding: 1px; border: 0px;");
pickCoutButton->setIcon(*fTreeIconClosed);
@@ -4505,7 +4544,7 @@ void G4OpenGLQtViewer::updatePickInfosWidget(int aX, int aY) {
pushUp->setSizePolicy(vPolicy);
fPickInfosWidget->layout()->addWidget(pushUp);
// highlight the first one :
/* // highlight the first one :
// first un-highlight the last selected
changeColorAndTransparency(fLastHighlightName,fLastHighlightColor);
@@ -4519,16 +4558,20 @@ void G4OpenGLQtViewer::updatePickInfosWidget(int aX, int aY) {
updateQWidget();
}
*/
QDialog* dial = static_cast<QDialog*> (fUIPickInfosWidget->parent());
if (dial) {
// change name
std::ostringstream oss;
if (pickMap.size() == 0) {
dial->setWindowTitle(QString("No object selected - ")+GetName());
oss << "No object";
} else if (pickMap.size() == 1) {
dial->setWindowTitle(QString("1 object selected - ")+GetName());
oss << "1 object";
} else {
dial->setWindowTitle(QString::number(pickMap.size())+" objects selected - "+GetName());
oss << QString::number(pickMap.size()).toStdString() << " objects";
}
oss << " selected - " << GetName();
dial->setWindowTitle(oss.str().c_str());
}
// set picking cout visible
fPickInfosScrollArea->setVisible(true);
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4OpenGLSceneHandler.cc 102570 2017-02-09 08:40:47Z gcosmo $
// $Id: G4OpenGLSceneHandler.cc 104288 2017-05-23 13:23:23Z gcosmo $
//
//
// Andrew Walkden 27th March 1996
@@ -192,7 +192,7 @@ void G4OpenGLSceneHandler::ScaledFlush()
break;
case eachPrimitive:
// This is equivalent to numeric with fEntitiesFlushInterval == 1.
fEntitiesFlushInterval = 1;
fEntitiesFlushInterval = 1; // fallthrough
// Fall through to NthPrimitive.
case NthPrimitive:
{ // Encapsulate in scope {} brackets to satisfy Windows.
@@ -246,7 +246,7 @@ void G4OpenGLSceneHandler::ScaledFlush()
break;
case eachPrimitive:
// This is equivalent to NthPrimitive with fEntitiesFlushInterval == 1.
fEntitiesFlushInterval = 1;
fEntitiesFlushInterval = 1; // fallthrough
// Fall through to NthPrimitive.
case NthPrimitive:
{ // Encapsulate in scope {} brackets to satisfy Windows.
@@ -426,12 +426,12 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
//filled = false;
break;
case G4VMarker::hashed:
if (!hashedWarned) {
if (!hashedWarned) { // fallthrough
G4cout << "Hashed fill style in G4OpenGLSceneHandler."
<< "\n Not implemented. Using G4VMarker::filled."
<< G4endl;
hashedWarned = true;
}
} // fallthrough
// Maybe use
//glPolygonStipple (fStippleMaskHashed);
// Drop through to filled...
@@ -450,7 +450,7 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
switch (polymarker.GetMarkerType()) {
default:
case G4Polymarker::dots:
size = 1.;
size = 1.; // fallthrough
// Drop through to circles
case G4Polymarker::circles:
nSides = GetNoOfSides(fpVisAttribs);
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4OpenGLStoredQtViewer.cc 101714 2016-11-22 08:53:13Z gcosmo $
// $Id: G4OpenGLStoredQtViewer.cc 103926 2017-05-03 13:43:27Z gcosmo $
//
//
// Class G4OpenGLStoredQtViewer : a class derived from G4OpenGLQtViewer and
@@ -407,6 +407,7 @@ void G4OpenGLStoredQtViewer::updateQWidget() {
// will be called if it hasn't already been called.
// Copies the back buffer of a double-buffered context to the front buffer.
repaint(); // will read scene tree state
// updateGL() // From J.Allison picking branch
updateViewerPropertiesTableWidget();
updateSceneTreeWidget();
fUpdateGLLock = false;
@@ -418,12 +419,12 @@ void G4OpenGLStoredQtViewer::ShowView (
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
{
// glFlush (); // Tentativley offered by JA 29/04/16.
// Some X servers fail to draw all trajectories, particularly Mac
// XQuartz. Revisit this at a future date. Meanwhile, issue an
// extra...
ClearView(); // Necessary? JA 29/04/16
DrawView(); // Necessary? JA 29/04/16
// ClearView(); // Necessary? JA 29/04/16
// DrawView(); // Necessary? JA 29/04/16
activateWindow();
// glFlush(); // NO NEED and as drawView will already cause a flush
// that could do a double flush
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4OpenGLViewer.cc 101714 2016-11-22 08:53:13Z gcosmo $
// $Id: G4OpenGLViewer.cc 103926 2017-05-03 13:43:27Z gcosmo $
//
//
// Andrew Walkden 27th March 1996
@@ -493,21 +493,27 @@ void G4OpenGLViewer::HaloingSecondPass () {
G4String G4OpenGLViewer::Pick(GLdouble x, GLdouble y)
{
std::vector < G4OpenGLViewerPickMap* > pickMap = GetPickDetails(x,y);
const std::vector < G4OpenGLViewerPickMap* > & pickMap = GetPickDetails(x,y);
G4String txt = "";
if (pickMap.size() == 0) {
txt += "Too many hits. Zoom in to reduce overlaps.";;
// txt += "No hits recorded.";;
} else {
for (unsigned int a=0; a< pickMap.size(); a++) {
txt += pickMap[a]->print();
for (unsigned int a=0; a < pickMap.size(); a++) {
if (pickMap[a]->getAttributes().size() > 0) {
txt += pickMap[a]->print();
}
}
}
return txt;
}
std::vector < G4OpenGLViewerPickMap* > G4OpenGLViewer::GetPickDetails(GLdouble x, GLdouble y)
const std::vector < G4OpenGLViewerPickMap* > & G4OpenGLViewer::GetPickDetails(GLdouble x, GLdouble y)
{
std::vector < G4OpenGLViewerPickMap* > pickMapVector;
static std::vector < G4OpenGLViewerPickMap* > pickMapVector;
for (auto pickMap: pickMapVector) {
delete pickMap;
}
pickMapVector.clear();
const G4int BUFSIZE = 512;
GLuint selectBuffer[BUFSIZE];
@@ -522,6 +528,12 @@ std::vector < G4OpenGLViewerPickMap* > G4OpenGLViewer::GetPickDetails(GLdouble x
glLoadIdentity();
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
/* G4cout
<< "viewport, x,y: "
<< viewport[0] << ',' << viewport[1] << ',' << viewport[2] << ',' << viewport[3]
<< ", " << x << ',' << y
<< G4endl;
*/
fIsGettingPickInfos = true;
// Define 5x5 pixel pick area
g4GluPickMatrix(x, viewport[3] - y, 5., 5., viewport);
@@ -530,8 +542,11 @@ std::vector < G4OpenGLViewerPickMap* > G4OpenGLViewer::GetPickDetails(GLdouble x
DrawView();
GLint hits = glRenderMode(GL_RENDER);
fIsGettingPickInfos = false;
if (hits < 0) {
G4cout << "Too many hits. Zoom in to reduce overlaps." << G4endl;
goto reset_and_return;
}
if (hits > 0) {
GLuint* p = selectBuffer;
for (GLint i = 0; i < hits; ++i) {
G4OpenGLViewerPickMap* pickMap = new G4OpenGLViewerPickMap();
@@ -549,15 +564,14 @@ std::vector < G4OpenGLViewerPickMap* > G4OpenGLViewer::GetPickDetails(GLdouble x
pickMap->setHitNumber(i);
pickMap->setSubHitNumber(j);
pickMap->setPickName(name);
std::map<GLuint, G4AttHolder*>::iterator iter =
fOpenGLSceneHandler.fPickMap.find(name);
if (iter != fOpenGLSceneHandler.fPickMap.end()) {
G4AttHolder* attHolder = iter->second;
if(attHolder && attHolder->GetAttDefs().size()) {
for (size_t iAtt = 0;
iAtt < attHolder->GetAttDefs().size(); ++iAtt) {
std::map<GLuint, G4AttHolder*>::iterator iter =
fOpenGLSceneHandler.fPickMap.find(name);
if (iter != fOpenGLSceneHandler.fPickMap.end()) {
G4AttHolder* attHolder = iter->second;
if(attHolder && attHolder->GetAttDefs().size()) {
for (size_t iAtt = 0; iAtt < attHolder->GetAttDefs().size(); ++iAtt) {
std::ostringstream oss;
oss << G4AttCheck(attHolder->GetAttValues()[iAtt],
oss << G4AttCheck(attHolder->GetAttValues()[iAtt],
attHolder->GetAttDefs()[iAtt]);
pickMap->addAttributes(oss.str());
}
@@ -567,6 +581,8 @@ std::vector < G4OpenGLViewerPickMap* > G4OpenGLViewer::GetPickDetails(GLdouble x
pickMapVector.push_back(pickMap);
}
}
reset_and_return:
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4OpenGLXViewer.cc 97241 2016-05-30 12:06:54Z gcosmo $
// $Id: G4OpenGLXViewer.cc 103926 2017-05-03 13:43:27Z gcosmo $
//
//
// Andrew Walkden 7th February 1997
@@ -198,17 +198,17 @@ void G4OpenGLXViewer::CreateGLXContext (XVisualInfo* v) {
vi -> screen,
vi -> visualid,
vi -> depth,
XA_RGB_DEFAULT_MAP,
XA_RGB_BEST_MAP,
False,
True);
if (status == 1) {
cmap = 0;
status = XGetRGBColormaps (dpy,
XRootWindow (dpy, vi -> screen),
XRootWindow (dpy, vi -> screen),
&standardCmaps,
&numCmaps,
XA_RGB_DEFAULT_MAP);
XA_RGB_BEST_MAP);
if (status == 1)
for (i = 0; i < numCmaps; i++) {
if (standardCmaps[i].visualid == vi -> visualid) {