Import Geant4 10.7.0 source tree

This commit is contained in:
Gabriele Cosmo
2020-12-04 12:30:43 +01:00
parent 67ba86d073
commit dab42d2018
3770 changed files with 226369 additions and 286486 deletions
+20
View File
@@ -18,6 +18,26 @@ committal in the CVS repository !
History file for visualization/OpenInventor
-------------------------------------------
20 October 2020 Frederick Jones (openinventor-V10-06-11)
- Completed all the planned features of the OIQt viewer.
- This Qt based viewer implements all the functionality
of the older Xt/Xm based OIXE viewer and is ready to
be used as its replacement.
18 September 2020 John Allison (openinventor-V10-06-10)
- Part of vis-V10-06-07.
- G4OpenInventorViewer.cc:
o CompareForKernelVisit; Force kernel visit if global parameters change.
. GlobalMarkerScale and GlobalLineWidthScale.
07 September 2020 Gabriele Cosmo (openinventor-V10-06-09)
- Corrected condition for inclusion of GL headers in SbGL.h.
28 August 2020 Ben Morgan (openinventor-V10-06-08)
- Ensure use of XQuartz/System GL on macOS with SoXt/SoQt
respectively.
01 June 2020 Ben Morgan (openinventor-V10-06-07)
- Use CMake AUTOMOC to automatically generate and compile Moc
sources
@@ -32,60 +32,421 @@
#if defined (G4VIS_BUILD_OIQT_DRIVER) || defined (G4VIS_USE_OIQT)
//#include <map>
//#include <vector>
//#include <fstream>
//#include <Inventor/SbLinear.h>
//#include <Inventor/nodes/SoLineSet.h>
// Set up notification of event processing
#include "G4VStateDependent.hh"
class G4OpenInventorQtExaminerViewer;
class HookEventProcState : public G4VStateDependent
{
public:
HookEventProcState(G4OpenInventorQtExaminerViewer*);
~HookEventProcState();
virtual G4bool Notify(G4ApplicationState requestedState);
private:
G4OpenInventorQtExaminerViewer* viewer;
};
#include "G4Types.hh"
//#include "G4OpenInventorViewer.hh"
#include <map>
#include <vector>
#include <fstream>
#include <Inventor/SbLinear.h>
#include <Inventor/nodes/SoLineSet.h>
#include <Inventor/nodes/SoEventCallback.h>
#include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
#include <Inventor/events/SoKeyboardEvent.h>
#include <qobject.h>
class SoCoordinate3;
class SoFont;
class SoText2;
class SoPointSet;
class G4OpenInventorQtExaminerViewer : public SoQtExaminerViewer {
class QWidget;
class QDialog;
class QMenuBar;
class QMenu;
class QAction;
class QListWidgetItem;
class QPushButton;
class QRadioButton;
class QMessageBox;
class QFont;
// The Aux Window dialog created with Qt Designer:
class Ui_Dialog;
class G4OpenInventorQtExaminerViewer: public QObject,
public SoQtExaminerViewer {
Q_OBJECT
// friend class G4OpenInventorQtExaminerViewerMessenger;
// FWJ
friend class G4OpenInventorQtViewer;
friend class G4OpenInventorQtViewer;
private Q_SLOTS :
void FileOpenBookmarkCB();
void FileNewBookmarkCB();
void FileLoadRefPathCB();
void FileSaveRefPathCB();
void FileLoadSceneGraphCB();
void FileSaveSceneGraphCB();
void ToolsAnimateRefParticleCB();
void ToolsRefPathStartCB();
void ToolsRefPathInvertCB();
void HelpControlsCB();
// For added viewer buttons
void SaveViewPtCB();
void NextViewPtCB();
void PrevViewPtCB();
void AbbrOutputCB(bool); // Includes mouse-over fcns
void PickRefPathCB();
void SwitchWireFrameCB(bool);
// Lists Window
void LoadBookmarkCB(QListWidgetItem*);
void DeleteBookmarkCB();
void RenameBookmarkCB();
void SortBookmarksCB();
void LookAtSceneElementCB(QListWidgetItem*);
private:
static G4OpenInventorQtExaminerViewer* viewer;
// void (*escapeCallback)(void *);
// void * examinerObject;
// SbBool lshiftdown, rshiftdown, lctrldown, rctrldown;
static G4OpenInventorQtExaminerViewer* viewer;
void (*escapeCallback)();
// void (*escapeCallback)(void*);
void* examinerObject;
SbBool lshiftdown, rshiftdown, lctrldown, rctrldown;
QFont* font;
QMenuBar* menubar;
QMenu* filemenu;
QMenu* toolsmenu;
QMenu* etcmenu;
QMenu* helpmenu;
QMessageBox* helpmsgbox;
bool externalQtApp;
QAction* FileOpenBookmark;
QAction* FileNewBookmark;
QAction* FileLoadRefPath;
QAction* FileSaveRefPath;
QAction* FileLoadSceneGraph;
QAction* FileSaveSceneGraph;
QAction* ToolsAnimateRefParticle;
QAction* ToolsRefPathStart;
QAction* ToolsRefPathInvert;
// KEEP in the viewer
QAction* HelpControls;
// Added viewer buttons
QPushButton* saveViewPtButton;
QPushButton* nextViewPtButton;
QPushButton* prevViewPtButton;
QPushButton* abbrOutputButton;
// QRadioButton* abbrOutputButton;
QPushButton* pickRefPathButton;
QPushButton* switchWireFrameButton;
// QRadioButton* switchWireFrameButton;
QListWidgetItem* saveViewPtItem;
Ui_Dialog* AuxWindowDialog;
QDialog* AuxWindow;
public:
// Same constructor as the SoQtExaminerViewer
G4OpenInventorQtExaminerViewer(QWidget* parent = NULL,
const char* name = NULL,
G4OpenInventorQtExaminerViewer(QWidget* parent = NULL,
const char* name = NULL,
SbBool embed = TRUE,
SoQtFullViewer::BuildFlag flag = BUILD_ALL,
SoQtViewer::Type type = BROWSER);
SoQtViewer::Type type = BROWSER);
~G4OpenInventorQtExaminerViewer();
template <class T> void parseString(T &t, const std::string &s, bool &error);
// Menubar information needed by G4OpenInventorQtViewer
// for common menu items:
QMenuBar* getMenubar() { return menubar; }
QMenu* getFileMenu() { return filemenu; }
QMenu* getEtcMenu() { return etcmenu; }
QFont* getFont() { return font; };
void setExternalQtApp() { externalQtApp = TRUE; }
// Needed?
std::string saveScenegraphFileName;
std::string saveRefCoordsFileName;
void addEscapeCallback(void (*cb)());
// void addEscapeCallback(void (*cb)(void *), void *);
bool abbrOutputFlag;
bool pickRefPathFlag;
bool viewingBeforePickRef;
~G4OpenInventorQtExaminerViewer();
protected:
// FWJ why this?
// Same constructor as the SoQtExaminerViewer
// G4OpenInventorQtExaminerViewer(QWidget parent,
// const char *name,
// SbBool embed,
// SoQtFullViewer::BuildFlag flag,
// SoQtViewer::Type type,
// SbBool build);
// FWJ try to handle events as in XtExaminerViewer
SbBool processSoEvent(const SoEvent* const event);
// FWJ Constructor with build flag added (as in parent)
// Need for this TBD.
// G4OpenInventorQtExaminerViewer(QWidget parent,
// const char *name,
// SbBool embed,
// SoQtFullViewer::BuildFlag flag,
// SoQtViewer::Type type,
// SbBool build);
void construct(const SbBool build);
void buildWidget(QWidget* parent);
virtual void afterRealizeHook();
HookEventProcState* hookBeamOn;
friend class HookEventProcState;
bool newEvents;
static void sceneChangeCB(void*, SoSensor*);
// FWJ try to handle events as in XtExaminerViewer
SbBool processSoEvent(const SoEvent* const event);
void saveViewPt(char* name);
bool loadViewPts();
void addViewPoints();
void setViewPt();
void writeViewPtIdx();
void cleanUpAfterPrevFile();
void deleteViewPt(char *vpName = NULL);
void renameViewPt(char *vpName);
void sortViewPts(std::vector<std::string>);
void moveCamera(float dist = 0, bool lookdown = false);
std::string curEltName;
SbVec3f camUpVec;
SbVec3f camDir;
void rotateCamera();
void updateViewParams(SoKeyboardEvent::Key);
static void mouseoverCB(void *aThis, SoEventCallback *eventCB);
static void pickingCB(void *aThis, SoEventCallback *eventCB);
// Animation
static void animateRefParticleCB();
static void animateSensorCB(void *, SoSensor *);
static void animateSensorRotationCB(void *, SoSensor *);
void animateRefParticle();
void saveCurCamera();
void restoreCamera();
double animateBtwPtsPeriod, speedStep;
void incSpeed();
void decSpeed();
SoTimerSensor *animateSensor;
SoTimerSensor *animateSensorRotation;
SoNodeSensor *sceneChangeSensor;
SbVec3f camStartPos, camEndPos;
SbRotation camStartOrient, camEndOrient;
void setReferencePath(SoLineSet*, SoCoordinate3*, bool append = false);
void setReferencePathZPos();
void findAndSetRefPath();
SoCoordinate3* getCoordsNode(SoFullPath *path);
void getSceneElements(); // reads elements from the scene graph
float sqrlen(const SbVec3f&);
void distanceToTrajectory(const SbVec3f&, float&, SbVec3f&, int&);
void sortElements();
void createElementsList();
// static void closeMainWindowCB(Widget, XtPointer, XtPointer);
void evenOutRefParticlePts();
// static void gotoRefPathStartCB(Widget, XtPointer, XtPointer);
void gotoRefPathStart();
// static void invertRefPathCB(Widget, XtPointer, XtPointer);
void invertRefPath();
enum CameraType {
PERSPECTIVE,
ORTHOGRAPHIC
};
enum State {
GENERAL,
BEAMLINE,
VIEWPOINT,
ANIMATION,
REVERSED_ANIMATION,
PAUSED_ANIMATION,
ROTATING
};
// For storing the view point
struct viewPtData {
char* viewPtName;
int viewportMapping;
SbVec3f position;
SbRotation orientation;
float aspectRatio;
float nearDistance;
float farDistance;
float focalDistance;
CameraType camType;
float height;
};
struct sceneElement {
std::string name;
SoFullPath* path;
SbVec3f center;
float closestPointZCoord;
};
struct elementForSorting {
float closestPointZCoord;
SbVec3f closestPoint;
float smallestDistance;
float distanceToBeamlineStart;
std::string name;
G4bool operator<(elementForSorting const &other) const
{
if (closestPointZCoord < other.closestPointZCoord)
return true;
if (closestPointZCoord > other.closestPointZCoord)
return false;
// otherwise closestPointZCoord == other.closestPointZCoord.
// Compare the distances from the center of the element to
// the start of the beamline.
if (distanceToBeamlineStart < other.distanceToBeamlineStart)
return true;
if (distanceToBeamlineStart > other.distanceToBeamlineStart)
return false;
// In case both closestPointZCoord and smallestDistance are
// equal, we have two exactly overlapping elements, if so
// the order doesn't matter
return true;
}
};
bool zcoordSetFlag;
std::vector<sceneElement> sceneElements;
std::vector<viewPtData> viewPtList;
std::string fileName;
std::ifstream fileIn;
std::ofstream fileOut;
int viewPtIdx;
int MAX_VP_IDX;
int MAX_VP_NAME;
// For storing coordinate points of the reference particle
std::vector<SbVec3f> refParticleTrajectory;
// For displaying distance during anim and beamline modes
std::vector<float> refZPositions;
int refParticleIdx;
int prevRefIdx;
float distance;
State currentState, prevState, beforePausing;
char* curViewPtName;
int step;
SbVec3f prevPt;
SbVec3f prevParticleDir;
void* prevColorField;
viewPtData camB4Animation;
bool returnToSaveVP;
bool returnToAnim;
SoCamera* myCam;
void setStartingPtForAnimation();
float left_right, up_down;
SbVec3f rotAxis; // For 90 degree rotations
int rotCnt; // # of steps rotation is split into
std::string viewPtAutoName();
////////////////////////ANIM_SPEED_INDICATOR///////////////////////
SoSearchAction * searcher;
SoNode * superimposition;
SoCoordinate3 * sgeometry;
SoScale * sscale;
SoTranslation * stranslation;
SoTranslation * curInfoTrans;
SoTranslation * mouseOverTransSolid;
SoTranslation * mouseOverTransMaterial;
SoTranslation * mouseOverTransLogName;
SoTranslation * mouseOverTransZPos;
// Used for 2 similar purposes: 1. Displays z position during animation
// 2. Displays name of the current viewpoint
SoText2 * curInfoText;
// Need to use many different fields for mouseover
// because newlines are ignored when the scene is rendered
SoText2* mouseOverTextSolid;
SoText2* mouseOverTextMaterial;
SoText2* mouseOverTextLogName;
SoText2* mouseOverTextZPos;
SoFont* curInfoFont;
SoFont* mouseOverFontSolid;
SoFont* mouseOverFontMaterial;
SoFont* mouseOverFontLogName;
SoFont* mouseOverFontZPos;
SoSwitch* axisSwitch;
SoSwitch* animSpeedOutlineSwitch;
SoSwitch* animSpeedSwitch;
SoSwitch* curInfoSwitch;
SoNode* getSuperimpositionNode(SoNode*, const char* name);
void superimpositionEvent(SoAction* action);
static void superimpositionCB(void* closure, SoAction* action);
virtual void actualRedraw(void);
void updateSpeedIndicator(void);
float maxSpeed;
////////////////////////ANIM_SPEED_INDICATOR///////////////////////
// FWJ added for Ortho camera
float defaultHeight;
float defaultHeightAngle;
// FWJ add look-ahead for animation tracking on curves
G4int pathLookahead;
// Used by G4 app during element rotations, stores previous view
SbVec3f upVector, offsetFromCenter, center;
bool rotUpVec;
SoSeparator* newSceneGraph;
};
@@ -34,24 +34,76 @@
// Inheritance :
#include "G4OpenInventorViewer.hh"
// This causes clash with enum CursorShape in qnamespace.h !
//#include <X11/Intrinsic.h>
#include <Inventor/nodes/SoEventCallback.h>
//class SoQtExaminerViewer;
class G4OpenInventorQtExaminerViewer;
class G4OpenInventorQtViewer: public G4OpenInventorViewer {
#include <qobject.h>
class QMenuBar;
class QFont;
class QAction;
//class G4OpenInventorQtViewer: public G4OpenInventorViewer {
class G4OpenInventorQtViewer: public QObject,
public G4OpenInventorViewer {
Q_OBJECT
private Q_SLOTS :
// File menu
void FileWritePSCB();
void FileWritePDFCB();
void FileWriteIVCB();
void FileEscapeCB();
// Etc menu
void EtcEraseDetectorCB();
void EtcEraseEventCB();
void EtcSetSolidCB();
void EtcSetReducedWireframeCB();
void EtcSetFullWireframeCB();
void EtcVisibMInvisibDCB();
void EtcVisibMVisibDCB();
void EtcUpdateSceneCB();
void EtcSceneGraphStatsCB();
private:
// File menu
QAction* FileWritePS;
QAction* FileWritePDF;
QAction* FileWriteIV;
QAction* FileEscape;
// Etc menu
QAction* EtcEraseDetector;
QAction* EtcEraseEvent;
QAction* EtcSetSolid;
QAction* EtcSetReducedWireframe;
QAction* EtcSetFullWireframe;
QAction* EtcVisibMInvisibD;
QAction* EtcVisibMVisibD;
QAction* EtcUpdateScene;
QAction* EtcSceneGraphStats;
public:
G4OpenInventorQtViewer(G4OpenInventorSceneHandler& scene,
const G4String& name = "");
virtual ~G4OpenInventorQtViewer();
void Initialise();
public: //G4VViewer
virtual void FinishView();
virtual void SetView();
protected:
virtual void ViewerRender();
virtual SoCamera* GetCamera();
@@ -60,29 +112,6 @@ protected:
//SoQtExaminerViewer* fViewer;
G4OpenInventorQtExaminerViewer* fViewer;
// FWJ from OpenInventorXtViewer.hh
// Widget AddMenu(Widget,const G4String&,const G4String&);
// void AddButton(Widget,const G4String&,XtCallbackProc);
// static void PostScriptCbk(Widget,XtPointer,XtPointer);
// static void PixmapPostScriptCbk(Widget,XtPointer,XtPointer);
// static void WriteInventorCbk(Widget,XtPointer,XtPointer);
// static void EscapeCbk(Widget,XtPointer,XtPointer);
// static void SceneGraphStatisticsCbk(Widget,XtPointer,XtPointer);
// static void EraseDetectorCbk(Widget,XtPointer,XtPointer);
// static void EraseEventCbk(Widget,XtPointer,XtPointer);
// static void SetSolidCbk(Widget,XtPointer,XtPointer);
// static void SetWireFrameCbk(Widget,XtPointer,XtPointer);
// static void SetReducedWireFrameCbk(Widget,XtPointer,XtPointer);
// static void SetFullWireFrameCbk(Widget,XtPointer,XtPointer);
// static void UpdateSceneCbk(Widget,XtPointer,XtPointer);
// static void HelpCbk(Widget,XtPointer,XtPointer);
// static void HelpCancelCbk(Widget,XtPointer,XtPointer);
// static void SetPreviewCbk(Widget,XtPointer,XtPointer);
// static void SetPreviewAndFullCbk(Widget,XtPointer,XtPointer);
// Widget fShell;
// Widget fHelpForm;
// Widget fHelpForm;
// Widget fHelpText;
};
#endif
@@ -47,6 +47,7 @@ class QString;
class G4SoQt : public G4VInteractorManager {
public:
virtual ~G4SoQt();
static G4SoQt* getInstance();
// FWJ no command line args for time being
// static G4SoQt* getInstance(int, char**, char*);
@@ -54,7 +55,8 @@ public:
void* GetEvent();
void FlushAndWaitExecution();
void SecondaryLoop();
virtual ~G4SoQt();
// Added direct exit method
void ExitSecondaryLoop();
bool IsExternalApp();
private:
@@ -24,15 +24,18 @@
// ********************************************************************
//
#ifndef HEPVis_SbGL_h
#define HEPVis_SbGL_h
#define HEPVis_SbGL_h
#ifdef WIN32
#include <windows.h>
#endif
#ifdef APPLE_GL
#include <gl.h>
#include <glu.h>
// Needs setting based on choice of driver
// Apple system for SoQt on Apple
// Native otherwise (Apple Framework)
#if defined(__APPLE__) && (!defined(G4VIS_BUILD_OIX_DRIVER) || !defined(G4VIS_USE_OIX_DRIVER))
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h>
#include <GL/glu.h>
@@ -0,0 +1,171 @@
/********************************************************************************
** Form generated from reading UI file 'OIQtListsDialogwS1786.ui'
**
** Created by: Qt User Interface Compiler version 5.6.1
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef OIQTLISTSDIALOGWS1786_H
#define OIQTLISTSDIALOGWS1786_H
#include <QtCore/QVariant>
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QDialog>
#include <QtWidgets/QFormLayout>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QHeaderView>
#include <QtWidgets/QLabel>
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QListWidget>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QWidget>
QT_BEGIN_NAMESPACE
class Ui_Dialog
{
public:
QWidget *horizontalLayoutWidget;
QHBoxLayout *horizontalLayout;
QPushButton *pushButton_2;
QPushButton *pushButton_3;
QPushButton *pushButton;
QWidget *layoutWidget;
QFormLayout *formLayout;
QLabel *label;
QLineEdit *lineEdit;
QListWidget *listWidget;
QWidget *layoutWidget1;
QFormLayout *formLayout_2;
QLabel *label_2;
QListWidget *listWidget1;
void setupUi(QDialog *Dialog)
{
if (Dialog->objectName().isEmpty())
Dialog->setObjectName(QStringLiteral("Dialog"));
Dialog->resize(224, 554);
QFont font;
font.setPointSize(12);
Dialog->setFont(font);
horizontalLayoutWidget = new QWidget(Dialog);
horizontalLayoutWidget->setObjectName(QStringLiteral("horizontalLayoutWidget"));
horizontalLayoutWidget->setGeometry(QRect(10, 260, 201, 26));
horizontalLayout = new QHBoxLayout(horizontalLayoutWidget);
horizontalLayout->setSpacing(8);
horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));
horizontalLayout->setSizeConstraint(QLayout::SetMaximumSize);
horizontalLayout->setContentsMargins(0, 0, 0, 0);
pushButton_2 = new QPushButton(horizontalLayoutWidget);
pushButton_2->setObjectName(QStringLiteral("pushButton_2"));
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(pushButton_2->sizePolicy().hasHeightForWidth());
pushButton_2->setSizePolicy(sizePolicy);
pushButton_2->setStyleSheet(QStringLiteral("font: 12pt \"Sans Serif\";"));
horizontalLayout->addWidget(pushButton_2);
pushButton_3 = new QPushButton(horizontalLayoutWidget);
pushButton_3->setObjectName(QStringLiteral("pushButton_3"));
sizePolicy.setHeightForWidth(pushButton_3->sizePolicy().hasHeightForWidth());
pushButton_3->setSizePolicy(sizePolicy);
pushButton_3->setStyleSheet(QStringLiteral("font: 12pt \"Sans Serif\";"));
horizontalLayout->addWidget(pushButton_3);
pushButton = new QPushButton(horizontalLayoutWidget);
pushButton->setObjectName(QStringLiteral("pushButton"));
sizePolicy.setHeightForWidth(pushButton->sizePolicy().hasHeightForWidth());
pushButton->setSizePolicy(sizePolicy);
pushButton->setStyleSheet(QStringLiteral("font: 12pt \"Sans Serif\";"));
horizontalLayout->addWidget(pushButton);
layoutWidget = new QWidget(Dialog);
layoutWidget->setObjectName(QStringLiteral("layoutWidget"));
layoutWidget->setGeometry(QRect(10, 10, 201, 241));
formLayout = new QFormLayout(layoutWidget);
formLayout->setObjectName(QStringLiteral("formLayout"));
formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
formLayout->setContentsMargins(0, 0, 0, 0);
label = new QLabel(layoutWidget);
label->setObjectName(QStringLiteral("label"));
label->setStyleSheet(QStringLiteral("font: 12pt \"Sans Serif\";"));
formLayout->setWidget(0, QFormLayout::LabelRole, label);
lineEdit = new QLineEdit(layoutWidget);
lineEdit->setObjectName(QStringLiteral("lineEdit"));
lineEdit->setStyleSheet(QStringLiteral("font: 12pt \"Sans Serif\";"));
lineEdit->setReadOnly(true);
formLayout->setWidget(1, QFormLayout::SpanningRole, lineEdit);
listWidget = new QListWidget(layoutWidget);
listWidget->setObjectName(QStringLiteral("listWidget"));
listWidget->setFont(font);
formLayout->setWidget(3, QFormLayout::SpanningRole, listWidget);
layoutWidget1 = new QWidget(Dialog);
layoutWidget1->setObjectName(QStringLiteral("layoutWidget1"));
layoutWidget1->setGeometry(QRect(10, 300, 201, 241));
formLayout_2 = new QFormLayout(layoutWidget1);
formLayout_2->setObjectName(QStringLiteral("formLayout_2"));
formLayout_2->setContentsMargins(0, 0, 0, 0);
label_2 = new QLabel(layoutWidget1);
label_2->setObjectName(QStringLiteral("label_2"));
label_2->setStyleSheet(QStringLiteral("font: 12pt \"Sans Serif\";"));
formLayout_2->setWidget(0, QFormLayout::LabelRole, label_2);
listWidget1 = new QListWidget(layoutWidget1);
listWidget1->setObjectName(QStringLiteral("listWidget1"));
QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Expanding);
sizePolicy1.setHorizontalStretch(1);
sizePolicy1.setVerticalStretch(1);
sizePolicy1.setHeightForWidth(listWidget1->sizePolicy().hasHeightForWidth());
listWidget1->setSizePolicy(sizePolicy1);
listWidget1->setFont(font);
formLayout_2->setWidget(1, QFormLayout::SpanningRole, listWidget1);
retranslateUi(Dialog);
QMetaObject::connectSlotsByName(Dialog);
} // setupUi
void retranslateUi(QDialog *Dialog)
{
Dialog->setWindowTitle(QApplication::translate("Dialog", "OIQt", 0));
#ifndef QT_NO_TOOLTIP
pushButton_2->setToolTip(QApplication::translate("Dialog", "Delete bookmark", 0));
#endif // QT_NO_TOOLTIP
pushButton_2->setText(QApplication::translate("Dialog", "Del", 0));
#ifndef QT_NO_TOOLTIP
pushButton_3->setToolTip(QApplication::translate("Dialog", "Rename bookmark", 0));
#endif // QT_NO_TOOLTIP
pushButton_3->setText(QApplication::translate("Dialog", "Ren", 0));
#ifndef QT_NO_TOOLTIP
pushButton->setToolTip(QApplication::translate("Dialog", "Sort bookmarks", 0));
#endif // QT_NO_TOOLTIP
pushButton->setText(QApplication::translate("Dialog", "Sort", 0));
label->setText(QApplication::translate("Dialog", "Bookmarks", 0));
label_2->setText(QApplication::translate("Dialog", "Elements [S mm]", 0));
} // retranslateUi
};
namespace Ui {
class Dialog: public Ui_Dialog {};
} // namespace Ui
QT_END_NAMESPACE
#endif // OIQTLISTSDIALOGWS1786_H
+60 -90
View File
@@ -3,19 +3,6 @@
# Package: Geant4.src.G4visualization.G4OpenInventor
#------------------------------------------------------------------------------
#----------------------------------------------------------------------------
# Generic Inventor Headers, base library, OpenGL and Geant4 defines
#
include_directories(${INVENTOR_INCLUDE_DIR})
set(G4VIS_MODULE_OPENINVENTOR_INCLUDE_DIRS ${INVENTOR_INCLUDE_DIR})
set(G4VIS_MODULE_OPENINVENTOR_LINK_LIBRARIES ${INVENTOR_LIBRARY})
include_directories(${OPENGL_INCLUDE_DIR})
list(APPEND G4VIS_MODULE_OPENINVENTOR_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
list(APPEND G4VIS_MODULE_OPENINVENTOR_LINK_LIBRARIES ${OPENGL_LIBRARIES})
add_definitions(-DG4VIS_BUILD_OI_DRIVER)
#----------------------------------------------------------------------------
# Geant4 OpenInventor Core sources and headers (all platforms)
#
@@ -54,100 +41,87 @@ set(G4VIS_MODULE_OPENINVENTOR_SOURCES
SoTubs.cc
)
set(G4VIS_MODULE_OPENINVENTOR_LINK_LIBRARIES Coin::Coin)
add_definitions(-DG4VIS_BUILD_OI_DRIVER)
#----------------------------------------------------------------------------
# UNIX Only (Xt) sources
#
if(UNIX)
if(NOT GEANT4_USE_INVENTOR_QT)
list(APPEND G4VIS_MODULE_OPENINVENTOR_HEADERS
G4OpenInventorX.hh
G4OpenInventorXt.hh
G4OpenInventorXtExaminerViewerMessenger.hh
G4OpenInventorXtExaminerViewer.hh
G4OpenInventorXtExtended.hh
G4OpenInventorXtExtendedViewer.hh
G4OpenInventorXtViewer.hh
wheelmouse.h
SoXtInternal.h
console.h
favorites.h
saveViewPt.h
pickext.h
pickref.h
wireframe.h
)
if(GEANT4_USE_INVENTOR_XT)
list(APPEND G4VIS_MODULE_OPENINVENTOR_HEADERS
G4OpenInventorX.hh
G4OpenInventorXt.hh
G4OpenInventorXtExaminerViewerMessenger.hh
G4OpenInventorXtExaminerViewer.hh
G4OpenInventorXtExtended.hh
G4OpenInventorXtExtendedViewer.hh
G4OpenInventorXtViewer.hh
wheelmouse.h
SoXtInternal.h
console.h
favorites.h
saveViewPt.h
pickext.h
pickref.h
wireframe.h)
list(APPEND G4VIS_MODULE_OPENINVENTOR_SOURCES
G4OpenInventorXt.cc
G4OpenInventorXtExaminerViewer.cc
G4OpenInventorXtExaminerViewerMessenger.cc
G4OpenInventorXtExtended.cc
G4OpenInventorXtExtendedViewer.cc
G4OpenInventorXtViewer.cc
wheelmouse.cc
)
list(APPEND G4VIS_MODULE_OPENINVENTOR_SOURCES
G4OpenInventorXt.cc
G4OpenInventorXtExaminerViewer.cc
G4OpenInventorXtExaminerViewerMessenger.cc
G4OpenInventorXtExtended.cc
G4OpenInventorXtExtendedViewer.cc
G4OpenInventorXtViewer.cc
wheelmouse.cc)
# Add the definitions for SoXt
add_definitions(-DG4INTY_BUILD_XT)
add_definitions(-DG4VIS_BUILD_OIX_DRIVER)
# SoXt Library
list(APPEND G4VIS_MODULE_OPENINVENTOR_LINK_LIBRARIES
${INVENTOR_SOXT_LIBRARY}
)
# We also need Xm and X11
include_directories(${X11_INCLUDE_DIR})
include_directories(${MOTIF_INCLUDE_DIR})
list(APPEND G4VIS_MODULE_OPENINVENTOR_INCLUDE_DIRS
${OPENGL_INCLUDE_DIR}
${MOTIF_INCLUDE_DIR}
)
list(APPEND G4VIS_MODULE_OPENINVENTOR_LINK_LIBRARIES
${MOTIF_LIBRARIES}
${X11_LIBRARIES}
${X11_Xpm_LIB}
)
add_definitions(-DG4INTY_BUILD_XT)
add_definitions(-DG4VIS_BUILD_OIX_DRIVER)
# SoXt Library and others
list(APPEND G4VIS_MODULE_OPENINVENTOR_LINK_LIBRARIES SoXt::SoXt Motif::Xm)
if(APPLE)
list(APPEND G4VIS_MODULE_OPENINVENTOR_LINK_LIBRARIES XQuartzGL::GL)
else()
list(APPEND G4VIS_MODULE_OPENINVENTOR_LINK_LIBRARIES OpenGL::GL)
endif()
endif()
#----------------------------------------------------------------------------
# Open Inventor Qt
#
list(APPEND G4VIS_MODULE_OPENINVENTOR_HEADERS
G4OpenInventorQt.hh
G4OpenInventorQtExaminerViewer.hh
G4OpenInventorQtViewer.hh
G4SoQt.hh
)
if(GEANT4_USE_INVENTOR_QT)
list(APPEND G4VIS_MODULE_OPENINVENTOR_HEADERS
G4OpenInventorQt.hh
G4OpenInventorQtExaminerViewer.hh
G4OpenInventorQtViewer.hh
G4SoQt.hh
ui_OIQtListsDialog.h)
list(APPEND G4VIS_MODULE_OPENINVENTOR_SOURCES
G4OpenInventorQt.cc
G4OpenInventorQtExaminerViewer.cc
G4OpenInventorQtViewer.cc
G4SoQt.cc
)
list(APPEND G4VIS_MODULE_OPENINVENTOR_SOURCES
G4OpenInventorQt.cc
G4OpenInventorQtExaminerViewer.cc
G4OpenInventorQtViewer.cc
G4SoQt.cc)
# Add the definitions
# Argh.. Have to remember about INTY and UI because of their use...
add_definitions(-DG4VIS_BUILD_OIQT_DRIVER)
add_definitions(-DG4INTY_BUILD_QT)
add_definitions(-DG4UI_BUILD_QT_SESSION)
# Add the definitions
# Argh.. Have to remember about INTY and UI because of their use...
add_definitions(-DG4VIS_BUILD_OIQT_DRIVER)
add_definitions(-DG4INTY_BUILD_QT)
add_definitions(-DG4UI_BUILD_QT_SESSION)
# Add in Qt libraries
list(APPEND G4VIS_MODULE_OPENINVENTOR_LINK_LIBRARIES
${INVENTOR_SOQT_LIBRARY}
Qt5::OpenGL Qt5::Gui Qt5::PrintSupport Qt5::Widgets)
endif()
# Add libraries
list(APPEND G4VIS_MODULE_OPENINVENTOR_LINK_LIBRARIES
SoQt::SoQt
OpenGL::GL
Qt5::OpenGL Qt5::Gui Qt5::PrintSupport Qt5::Widgets)
endif()
#----------------------------------------------------------------------------
# WIN32 Only (Win32) sources
#
if(WIN32)
if(GEANT4_USE_INVENTOR_WIN)
set(G4VIS_MODULE_OPENINVENTOR_HEADERS
${G4VIS_MODULE_OPENINVENTOR_HEADERS}
G4OpenInventorWin.hh
@@ -161,16 +135,12 @@ if(WIN32)
G4OpenInventorWinViewer.cc
)
# Add the include for SoWin
# Add the definitions for SoWin
add_definitions(-DG4INTY_BUILD_WIN32)
add_definitions(-DG4VIS_BUILD_OIWIN32_DRIVER)
# SoWin Library
list(APPEND G4VIS_MODULE_OPENINVENTOR_LINK_LIBRARIES
${INVENTOR_SOWIN_LIBRARY}
)
list(APPEND G4VIS_MODULE_OPENINVENTOR_LINK_LIBRARIES SoWin::SoWin OpenGL::GL)
endif()
#
File diff suppressed because it is too large Load Diff
@@ -40,12 +40,10 @@
#include <Inventor/Qt/viewers/SoQtFullViewer.h>
#include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
//#include <Xm/Xm.h>
//#include <Xm/PushB.h>
//#include <Xm/Form.h>
//#include <Xm/CascadeB.h>
//#include <Xm/RowColumn.h>
//#include <Xm/Text.h>
//#include <QMenuBar>
#include <QMenu>
#include <QAction>
#include <QFont>
#include "HEPVis/actions/SoGL2PSAction.h"
@@ -54,14 +52,15 @@
#include "G4VInteractorManager.hh"
#include "G4VisManager.hh"
#include "G4SoQt.hh"
#ifndef G4GMAKE
#include "moc_G4OpenInventorQtViewer.cpp"
#endif
G4OpenInventorQtViewer::G4OpenInventorQtViewer(
G4OpenInventorSceneHandler& sceneHandler, const G4String& name)
: G4OpenInventorViewer(sceneHandler, name)
, fViewer(0)
: G4OpenInventorViewer(sceneHandler, name), fViewer(0)
{
// FWJ fName is in G4VViewer parent of G4OpenInventorViewer
if (G4VisManager::GetVerbosity() >= G4VisManager::confirmations)
@@ -72,32 +71,132 @@ G4OpenInventorQtViewer::G4OpenInventorQtViewer(
void G4OpenInventorQtViewer::Initialise()
{
QWidget* parent = SoQt::getTopLevelWidget();
QWidget* parent = SoQt::getTopLevelWidget();
// FWJ DEBUG
// G4cout << "G4OIQtViewer: Creating G4OIQtExaminerViewer with parent " <<
// parent << G4endl;
// FWJ DEBUG
// G4cout << "G4OIQtViewer: Creating G4OIQtExaminerViewer with parent " <<
// parent << G4endl;
// fViewer = new SoQtExaminerViewer(parent, "Geant4", TRUE);
fViewer = new G4OpenInventorQtExaminerViewer(parent, "Geant4", TRUE);
// fViewer = new SoQtExaminerViewer(parent, "Geant4", TRUE);
fViewer = new G4OpenInventorQtExaminerViewer(parent, "Geant4", TRUE);
// G4String wName = fName;
//
// QWidget parent = (QWidget)fInteractorManager->GetParentInteractor();
int width = fVP.GetWindowSizeHintX();
int height = fVP.GetWindowSizeHintY();
// G4String wName = fName;
//
// QWidget parent = (QWidget)fInteractorManager->GetParentInteractor();
// FWJ not sure what this is for
// fInteractorManager->AddShell(fShell);
int width = fVP.GetWindowSizeHintX();
int height = fVP.GetWindowSizeHintY();
// FWJ or this:
// } else {
// char* str = fInteractorManager->GetCreationString();
// if(str!=0) wName = str;
// fViewer = new SoQtExaminerViewer(parent,wName.c_str(),TRUE);
// }
// FWJ not sure what this is for
// fInteractorManager->AddShell(fShell);
// FWJ or this:
// } else {
// char* str = fInteractorManager->GetCreationString();
// if(str!=0) wName = str;
// fViewer = new SoQtExaminerViewer(parent,wName.c_str(),TRUE);
// }
fViewer->setSize(SbVec2s(width, height));
// Add common menu items...
// QMenuBar* menubar = fViewer->getMenubar();
QMenu* filemenu = fViewer->getFileMenu();
QMenu* etcmenu = fViewer->getEtcMenu();
QFont* font = fViewer->getFont();
// File menu
FileWritePS = new QAction("Write PostScript (gl2ps)", this);
FileWritePS->setFont(*font);
connect(FileWritePS, SIGNAL(triggered()), this,
SLOT(FileWritePSCB()));
filemenu->addAction(FileWritePS);
FileWritePDF = new QAction("Write PDF (gl2ps)", this);
FileWritePDF->setFont(*font);
connect(FileWritePDF, SIGNAL(triggered()), this,
SLOT(FileWritePDFCB()));
filemenu->addAction(FileWritePDF);
FileWriteIV = new QAction("Write IV", this);
FileWriteIV->setFont(*font);
connect(FileWriteIV, SIGNAL(triggered()), this,
SLOT(FileWriteIVCB()));
filemenu->addAction(FileWriteIV);
FileEscape = new QAction("Escape", this);
FileEscape->setFont(*font);
connect(FileEscape, SIGNAL(triggered()), this,
SLOT(FileEscapeCB()));
filemenu->addAction(FileEscape);
// G4cout << "G4OIQtViewer: externalApp = " <<
// static_cast<G4SoQt*>(fInteractorManager)->IsExternalApp() << G4endl;
if (static_cast<G4SoQt*>(fInteractorManager)->IsExternalApp())
fViewer->setExternalQtApp();
// Register escape CB with viewer, allowing E key escape
// fViewer->addEscapeCallback(FileEscapeCB);
// fViewer->addEscapeCallback(FileEscapeCB, (void*)this);
// Etc menu
EtcEraseDetector = new QAction("Erase detector", this);
EtcEraseDetector->setFont(*font);
connect(EtcEraseDetector, SIGNAL(triggered()), this,
SLOT(EtcEraseDetectorCB()));
etcmenu->addAction(EtcEraseDetector);
EtcEraseEvent = new QAction("Erase event", this);
EtcEraseEvent->setFont(*font);
connect(EtcEraseEvent, SIGNAL(triggered()), this,
SLOT(EtcEraseEventCB()));
etcmenu->addAction(EtcEraseEvent);
EtcSetSolid = new QAction("Set solid", this);
EtcSetSolid->setFont(*font);
connect(EtcSetSolid, SIGNAL(triggered()), this, SLOT(EtcSetSolidCB()));
etcmenu->addAction(EtcSetSolid);
EtcSetReducedWireframe = new QAction("Set (G4) reduced wireframe", this);
EtcSetReducedWireframe->setFont(*font);
connect(EtcSetReducedWireframe, SIGNAL(triggered()), this,
SLOT(EtcSetReducedWireframeCB()));
etcmenu->addAction(EtcSetReducedWireframe);
EtcSetFullWireframe = new QAction("Set full wireframe", this);
EtcSetFullWireframe->setFont(*font);
connect(EtcSetFullWireframe, SIGNAL(triggered()), this,
SLOT(EtcSetFullWireframeCB()));
etcmenu->addAction(EtcSetFullWireframe);
EtcVisibMInvisibD = new QAction("Visible mothers + invisible daughters",
this);
EtcVisibMInvisibD->setFont(*font);
connect(EtcVisibMInvisibD, SIGNAL(triggered()), this,
SLOT(EtcVisibMInvisibDCB()));
etcmenu->addAction(EtcVisibMInvisibD);
EtcVisibMVisibD = new QAction("Visible mothers + visible daughters", this);
EtcVisibMVisibD->setFont(*font);
connect(EtcVisibMVisibD, SIGNAL(triggered()), this,
SLOT(EtcVisibMVisibDCB()));
etcmenu->addAction(EtcVisibMVisibD);
EtcUpdateScene = new QAction("Update scene", this);
EtcUpdateScene->setFont(*font);
connect(EtcUpdateScene, SIGNAL(triggered()), this,
SLOT(EtcUpdateSceneCB()));
etcmenu->addAction(EtcUpdateScene);
EtcSceneGraphStats = new QAction("Scene graph stats", this);
EtcSceneGraphStats->setFont(*font);
connect(EtcSceneGraphStats, SIGNAL(triggered()), this,
SLOT(EtcSceneGraphStatsCB()));
etcmenu->addAction(EtcSceneGraphStats);
fViewer->setSize(SbVec2s(width, height));
// Have a GL2PS render action :
const SbViewportRegion& vpRegion = fViewer->getViewportRegion();
@@ -178,134 +277,104 @@ SoCamera* G4OpenInventorQtViewer::GetCamera () {
}
// FWJ need new implementation in SoQt for the following...
//Widget G4OpenInventorQtViewer::AddMenu(
// Widget aMenuBar
//,const G4String& aName
//,const G4String& aLabel
//)
//{
// // Pulldown menu :
// Widget menu = XmCreatePulldownMenu(aMenuBar,(char*)aName.c_str(),NULL,0);
// // Cascade button :
// Arg args[2];
// XmString cps =
// XmStringLtoRCreate((char*)aLabel.c_str(),(char*)XmSTRING_DEFAULT_CHARSET);
// XtSetArg (args[0],XmNlabelString,cps);
// XtSetArg (args[1],XmNsubMenuId,menu);
// Widget widget = XmCreateCascadeButton(aMenuBar,(char*)aName.c_str(),args,2);
// XmStringFree (cps);
// XtManageChild(widget);
// return menu;
//}
// File menu...
// void G4OpenInventorQtViewer::AddButton (
// Widget aMenu
// ,const G4String& aLabel
// ,XtCallbackProc aCallback
// )
// {
// Widget widget = XmCreatePushButton(aMenu,(char*)aLabel.c_str(),NULL,0);
// XtManageChild(widget);
// XtAddCallback(widget,XmNactivateCallback,aCallback,(XtPointer)this);
//}
void G4OpenInventorQtViewer::FileWritePSCB()
{
// G4cout << "G4OIQtViewer: File: Write PS CALLBACK" << G4endl;
// FWJ Workaround: avoids empty 2nd page in file
SbBool superimpState =
fViewer->getSuperimpositionEnabled(fViewer->superimposition);
fViewer->setSuperimpositionEnabled(fViewer->superimposition, FALSE);
WritePostScript();
if (superimpState)
fViewer->setSuperimpositionEnabled(fViewer->superimposition, TRUE);
}
//void G4OpenInventorQtViewer::HelpCancelCbk(
// Widget,XtPointer aData,XtPointer) {
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
// XtUnmanageChild(This->fHelpForm);
//}
void G4OpenInventorQtViewer::FileWritePDFCB()
{
// G4cout << "G4OIQtViewer: File: Write PDF CALLBACK" << G4endl;
// FWJ Workaround: avoids empty 2nd page in file
SbBool superimpState =
fViewer->getSuperimpositionEnabled(fViewer->superimposition);
fViewer->setSuperimpositionEnabled(fViewer->superimposition, FALSE);
WritePDF();
if (superimpState)
fViewer->setSuperimpositionEnabled(fViewer->superimposition, TRUE);
}
void G4OpenInventorQtViewer::FileWriteIVCB()
{
// G4cout << "G4OIQtViewer: File: Write IV CALLBACK" << G4endl;
WriteInventor();
}
// void G4OpenInventorQtViewer::EscapeCbk(
// Widget,XtPointer aData,XtPointer) {
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
// This->Escape();
//}
void G4OpenInventorQtViewer::FileEscapeCB()
{
// G4cout << "G4OIQtViewer: File: Escape CALLBACK" << G4endl;
static_cast<G4SoQt*>(fInteractorManager)->ExitSecondaryLoop();
// Escape();
}
// void G4OpenInventorQtViewer::PostScriptCbk(
// Widget,XtPointer aData,XtPointer) {
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
// This->WritePostScript();
//}
// Etc menu...
//void G4OpenInventorQtViewer::PixmapPostScriptCbk(
// Widget,XtPointer aData,XtPointer) {
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
// This->WritePixmapPostScript();
//}
void
G4OpenInventorQtViewer::EtcEraseDetectorCB()
{
// G4cout << "G4OIQtViewer: Etc: Erase Detector CALLBACK" << G4endl;
EraseDetector();
}
//void G4OpenInventorQtViewer::SceneGraphStatisticsCbk(
// Widget,XtPointer aData,XtPointer) {
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
// This->SceneGraphStatistics();
//}
void
G4OpenInventorQtViewer::EtcEraseEventCB()
{
// G4cout << "G4OIQtViewer: Etc: Erase Event CALLBACK" << G4endl;
EraseEvent();
}
//void G4OpenInventorQtViewer::WriteInventorCbk(
// Widget,XtPointer aData,XtPointer) {
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
// This->WriteInventor();
//}
void G4OpenInventorQtViewer::EtcSetSolidCB()
{
// G4cout << "G4OIQtViewer: Etc: Set Solid CALLBACK" << G4endl;
SetSolid();
}
//void G4OpenInventorQtViewer::EraseDetectorCbk(
// Widget,XtPointer aData,XtPointer) {
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
// This->EraseDetector();
//}
void G4OpenInventorQtViewer::EtcSetReducedWireframeCB()
{
// G4cout << "G4OIQtViewer: Etc: Set Reduced Wireframe CALLBACK" << G4endl;
SetReducedWireFrame(true);
}
//void G4OpenInventorQtViewer::EraseEventCbk(
// Widget,XtPointer aData,XtPointer) {
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
// This->EraseEvent();
//}
void G4OpenInventorQtViewer::EtcSetFullWireframeCB()
{
// G4cout << "G4OIQtViewer: Etc: Set Full Wireframe CALLBACK" << G4endl;
SetReducedWireFrame(false);
}
//void G4OpenInventorQtViewer::SetSolidCbk(
// Widget,XtPointer aData,XtPointer) {
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
// This->SetSolid();
//}
void G4OpenInventorQtViewer::EtcVisibMInvisibDCB()
{
// G4cout << "G4OIQtViewer: Etc: Visible Mothers + Invisible Daughters"
// " CALLBACK" << G4endl;
SetPreview();
}
//void G4OpenInventorQtViewer::SetWireFrameCbk(
// Widget,XtPointer aData,XtPointer) {
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
// This->SetWireFrame();
//}
void G4OpenInventorQtViewer::EtcVisibMVisibDCB()
{
// G4cout << "G4OIQtViewer: Etc: Visible Mothers + Visible Daughters"
// "CALLBACK" << G4endl;
SetPreviewAndFull();
}
// void G4OpenInventorQtViewer::SetReducedWireFrameCbk(
// Widget,XtPointer aData,XtPointer) {
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
// This->SetReducedWireFrame(true);
// }
void G4OpenInventorQtViewer::EtcUpdateSceneCB()
{
// G4cout << "G4OIQtViewer: Etc: Update Scene CALLBACK" << G4endl;
UpdateScene();
}
// void G4OpenInventorQtViewer::SetFullWireFrameCbk(
// Widget,XtPointer aData,XtPointer) {
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
// This->SetReducedWireFrame(false);
// }
void G4OpenInventorQtViewer::EtcSceneGraphStatsCB()
{
// G4cout << "G4OIQtViewer: Etc: Scene Graph Stats CALLBACK" << G4endl;
SceneGraphStatistics();
}
// void G4OpenInventorQtViewer::UpdateSceneCbk(
// Widget,XtPointer aData,XtPointer) {
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
// This->UpdateScene();
// }
// void G4OpenInventorQtViewer::SetPreviewCbk(
// Widget,XtPointer aData,XtPointer) {
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
// This->SetPreview();
// }
// void G4OpenInventorQtViewer::SetPreviewAndFullCbk(
// Widget,XtPointer aData,XtPointer) {
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
// This->SetPreviewAndFull();
// }
// void G4OpenInventorQtViewer::HelpCbk(
// Widget,XtPointer aData,XtPointer) {
// G4OpenInventorQtViewer* This = (G4OpenInventorQtViewer*)aData;
// XtManageChild(This->fHelpForm);
// XmTextSetString(This->fHelpText,(char*)This->Help().c_str());
// }
#endif
@@ -64,8 +64,6 @@ G4OpenInventorViewer::G4OpenInventorViewer(
,fGroupCameraSensor(0)
,fCameraSensor(0)
{
fNeedKernelVisit = true; //?? Temporary, until KernelVisitDecision fixed.
fVP.SetAutoRefresh(true);
fDefaultVP.SetAutoRefresh(true);
fVP.SetPicking(true);
@@ -151,7 +149,6 @@ void G4OpenInventorViewer::KernelVisitDecision () {
CompareForKernelVisit(fLastVP)) {
NeedKernelVisit ();
}
fLastVP = fVP;
}
G4bool G4OpenInventorViewer::CompareForKernelVisit(G4ViewParameters& vp) {
@@ -175,6 +172,8 @@ G4bool G4OpenInventorViewer::CompareForKernelVisit(G4ViewParameters& vp) {
// G4OpenGLStoredSceneHander::CreateSection/CutawayPolyhedron.
(vp.IsExplode () != fVP.IsExplode ()) ||
(vp.GetNoOfSides () != fVP.GetNoOfSides ()) ||
(vp.GetGlobalMarkerScale() != fVP.GetGlobalMarkerScale()) ||
(vp.GetGlobalLineWidthScale() != fVP.GetGlobalLineWidthScale()) ||
(vp.IsMarkerNotHidden () != fVP.IsMarkerNotHidden ()) ||
(vp.GetDefaultVisAttributes()->GetColour() !=
fVP.GetDefaultVisAttributes()->GetColour()) ||
@@ -374,6 +373,7 @@ G4OpenInventorViewer::lookedAt(SoCamera* camera,SbVec3f & dir, SbVec3f & up)
void G4OpenInventorViewer::DrawView () {
//G4cout << "debug Iv::DrawViewer " <<G4endl;
if (!fNeedKernelVisit) KernelVisitDecision();
fLastVP= fVP;
ProcessView();
FinishView();
}
@@ -1498,8 +1498,8 @@ SbBool G4OpenInventorXtExaminerViewer::processSoEvent(const SoEvent * const ev)
case SoKeyboardEvent::DELETE:
if (viewPtList.size()
&& (currentState != ANIMATION
|| currentState != REVERSED_ANIMATION
|| currentState != PAUSED_ANIMATION)) {
&& currentState != REVERSED_ANIMATION
&& currentState != PAUSED_ANIMATION)) {
String dialogName = (char *) "Delete Viewpoint";
std::string msg = "Are you sure you want to delete current viewpoint?";
warningMsgDialog(msg, dialogName, deleteViewPtCB);
@@ -4493,6 +4493,8 @@ void G4OpenInventorXtExaminerViewer::evenOutRefParticlePts()
numOfPts++;
totalDistBtwPts += (p2 - p1).length();
}
// Nothing useful to do (and fix Coverity)
if (numOfPts <= 2) return;
avgDistBtwPts = totalDistBtwPts / numOfPts;
float minDistAllowed = 0.75 * avgDistBtwPts;
@@ -82,8 +82,14 @@ G4SoQt::G4SoQt()
// new QApplication (*p_argn, args);
// if(!qApp) {
// FWJ detects existence of Qt UI or other running qApp
if (qApp) externalApp = true;
QWidget* mainWin = SoQt::init("Geant4");
// FWJ Cf Xt:
QtInited = TRUE;
// FWJ DEBUG
// G4cout << "G4SoQt: mainWin=" << mainWin << G4endl;
// G4cout << "G4SoQt: toplevelwidget=" << SoQt::getTopLevelWidget() << G4endl;
@@ -138,13 +144,26 @@ void G4SoQt::FlushAndWaitExecution()
void G4SoQt::SecondaryLoop()
{
// FWJ DEBUG
if (externalApp) return;
// G4cout <<
// "ENTERING OIQT VIEWER SECONDARY LOOP" << G4endl;
// else
G4cout <<
"ENTERING OIQT VIEWER SECONDARY LOOP... PRESS E KEY TO EXIT" << G4endl;
"ENTERING OIQT VIEWER SECONDARY LOOP... PRESS E KEY TO EXIT" << G4endl;
SoQt::mainLoop();
}
/***************************************************************************/
void G4SoQt::ExitSecondaryLoop()
{
// FWJ DEBUG
// G4cout << "G4SoQt: EXIT SECONDARY LOOP externalApp=" <<
// externalApp << G4endl;
if (externalApp) return;
SoQt::exitMainLoop();
}
/***************************************************************************/
bool G4SoQt::IsExternalApp()
{