Import Geant4 10.7.1 source tree
This commit is contained in:
@@ -19,6 +19,26 @@ committal in the CVS repository !
|
||||
History file for visualization/OpenInventor
|
||||
-------------------------------------------
|
||||
|
||||
06 January 2021 Frederick Jones (openinventor-V10-06-12)
|
||||
- G4OpenInventorQtViewer, G4OpenInventorQtExaminerViewer
|
||||
o Under UIQt: viewer fails (root node is null) if
|
||||
/vis/open/OI command is entered. Suspected a timing
|
||||
problem and moved uiQt->addTabWidget() from G4OIQtViewer
|
||||
to G4OIQtExaminerviewer::afterRealizeHook().
|
||||
|
||||
08 December 2020 Frederick Jones
|
||||
- G4OpenInventorQtViewer.hh,cc:
|
||||
o Fixed the uiQt->addTabWidget() call with correct arguments
|
||||
so that tabbed viewer opens correctly.
|
||||
o For UIQt case suppressed the viewer window titling which was
|
||||
changing the UI window title.
|
||||
|
||||
22 October 2020 John Allison
|
||||
- Some changes to instantiation and initialisation.
|
||||
o G4OpenInventorQtViewer now opens in a tab with correct name.
|
||||
o The main window name is left unchanged (it has same name as executable).
|
||||
o But the G4OpenInventorQtExaminerViewer still opens in a detached window.
|
||||
|
||||
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
|
||||
|
||||
@@ -127,6 +127,7 @@ private Q_SLOTS :
|
||||
private:
|
||||
|
||||
static G4OpenInventorQtExaminerViewer* viewer;
|
||||
const char* fName;
|
||||
|
||||
void (*escapeCallback)();
|
||||
// void (*escapeCallback)(void*);
|
||||
|
||||
@@ -31,14 +31,7 @@
|
||||
// this :
|
||||
#include "G4OpenInventorQt.hh"
|
||||
|
||||
#include <Inventor/Qt/SoQt.h>
|
||||
|
||||
#include "G4SoQt.hh"
|
||||
#include "G4UIQt.hh"
|
||||
#include "G4Qt.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include <qobject.h>
|
||||
//#include "G4Qt.hh"
|
||||
#include "G4OpenInventorSceneHandler.hh"
|
||||
#include "G4OpenInventorQtViewer.hh"
|
||||
|
||||
@@ -119,20 +112,28 @@ G4OpenInventorQt::~G4OpenInventorQt()
|
||||
G4VViewer* G4OpenInventorQt::CreateViewer(G4VSceneHandler& scene,
|
||||
const G4String& name)
|
||||
{
|
||||
G4UImanager* UI = G4UImanager::GetUIpointer();
|
||||
G4UIQt *uiQt = static_cast<G4UIQt*> (UI->GetG4UIWindow());
|
||||
if (uiQt) {
|
||||
if (!((G4Qt*)(GetInteractorManager()->GetMainInteractor()))->IsExternalApp()) {
|
||||
QWidget* mainWin = (QWidget*)(GetInteractorManager()->GetMainInteractor());
|
||||
// Trying to get around git by adding this comment 2
|
||||
uiQt->AddTabWidget((QWidget*)mainWin,QString(name));
|
||||
auto pView = new G4OpenInventorQtViewer(static_cast<G4OpenInventorSceneHandler&>(scene), name);
|
||||
|
||||
if (pView) {
|
||||
if (pView->GetViewId() < 0) {
|
||||
G4cerr <<
|
||||
"G4OpenInventorQt::CreateViewer: ERROR flagged by negative"
|
||||
" view id in G4OpenInventorQtViewer creation."
|
||||
"\n Destroying view and returning null pointer."
|
||||
<< G4endl;
|
||||
delete pView;
|
||||
pView = 0;
|
||||
}
|
||||
}
|
||||
if (!pView) {
|
||||
G4cerr <<
|
||||
"G4OpenInventorQt::CreateViewer: ERROR: null pointer on new G4OpenInventorQtViewer."
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
Initialize();
|
||||
|
||||
G4OpenInventorSceneHandler* pScene = (G4OpenInventorSceneHandler*)&scene;
|
||||
return new G4OpenInventorQtViewer(*pScene, name);
|
||||
|
||||
return pView;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -40,8 +40,8 @@
|
||||
#include <algorithm> // For using sort on a vector
|
||||
|
||||
#include "G4ios.hh"
|
||||
//#include "G4UImanager.hh"
|
||||
//#include "G4UIQt.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UIQt.hh"
|
||||
|
||||
#include <Inventor/Qt/SoQt.h>
|
||||
#include <Inventor/Qt/SoQtCursor.h>
|
||||
@@ -131,7 +131,7 @@ G4OpenInventorQtExaminerViewer(QWidget* parent, const char* name, SbBool embed,
|
||||
// FWJ THIS DOESN'T WORK APPARENTLY NO MAINWINDOW
|
||||
// QMenuBar* menubar = ((QMainWindow*)parent)->menuBar();
|
||||
// G4cout << "G4OpenInventorQtExaminerViewer menubar=" << menubar << G4endl;
|
||||
|
||||
fName = name;
|
||||
viewer = this;
|
||||
construct(TRUE);
|
||||
}
|
||||
@@ -164,12 +164,6 @@ void G4OpenInventorQtExaminerViewer::construct(const SbBool)
|
||||
|
||||
buildWidget(getParentWidget());
|
||||
|
||||
// TRY TO EMBED IN Qt UI
|
||||
// Works but dumps core on a subsequent vis/open OIQt
|
||||
// auto UI = G4UImanager::GetUIpointer();
|
||||
// auto uiQt = dynamic_cast<G4UIQt*>(UI->GetG4UIWindow());
|
||||
// if (uiQt) uiQt->AddTabWidget(getParentWidget(), "OIQt");
|
||||
|
||||
fileName = "bookmarkFile"; // Default viewpoint file name
|
||||
viewPtIdx = -1; // index of the most recent viewpoint in viewPtList vector
|
||||
|
||||
@@ -762,6 +756,11 @@ void G4OpenInventorQtExaminerViewer::afterRealizeHook()
|
||||
AuxWindow->show();
|
||||
AuxWindow->raise();
|
||||
AuxWindow->activateWindow();
|
||||
|
||||
auto UI = G4UImanager::GetUIpointer();
|
||||
auto uiQt = dynamic_cast<G4UIQt*>(UI->GetG4UIWindow());
|
||||
// This explicitly sets the TabWidget as parent before addTab():
|
||||
if (uiQt) uiQt->AddTabWidget(getParentWidget(), QString(fName));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -51,6 +51,8 @@
|
||||
#include "G4OpenInventorSceneHandler.hh"
|
||||
#include "G4VInteractorManager.hh"
|
||||
#include "G4VisManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UIQt.hh"
|
||||
|
||||
#include "G4SoQt.hh"
|
||||
|
||||
@@ -64,7 +66,7 @@ G4OpenInventorQtViewer::G4OpenInventorQtViewer(
|
||||
{
|
||||
// FWJ fName is in G4VViewer parent of G4OpenInventorViewer
|
||||
if (G4VisManager::GetVerbosity() >= G4VisManager::confirmations)
|
||||
G4cout << "Window name: " << fName << G4endl;
|
||||
G4cout << "Window name: " << fName << G4endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,8 +79,23 @@ void G4OpenInventorQtViewer::Initialise()
|
||||
// G4cout << "G4OIQtViewer: Creating G4OIQtExaminerViewer with parent " <<
|
||||
// parent << G4endl;
|
||||
|
||||
// fViewer = new SoQtExaminerViewer(parent, "Geant4", TRUE);
|
||||
fViewer = new G4OpenInventorQtExaminerViewer(parent, "Geant4", TRUE);
|
||||
fViewer = new G4OpenInventorQtExaminerViewer(parent, fName, TRUE);
|
||||
|
||||
auto UI = G4UImanager::GetUIpointer();
|
||||
auto uiQt = dynamic_cast<G4UIQt*>(UI->GetG4UIWindow());
|
||||
|
||||
// Moved this to G4OpenInventorQtExaminerViewer::afterRealizeHook()
|
||||
///////////////////////////////////////////////////////////
|
||||
//
|
||||
// This explicitly sets the TabWidget as parent before addTab():
|
||||
// if (uiQt) uiQt->AddTabWidget(parent, QString(fName));
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
// Simpler: calls addTab(), but causes viewer parts to show (temporarily)
|
||||
// in the "Useful tips" page !!
|
||||
// if (uiQt) uiQt->AddViewerTab(parent, fName);
|
||||
// Leaves an empty viewer window frame hanging around:
|
||||
// if (uiQt) uiQt->AddTabWidget(fViewer->getWidget(), QString(fName));
|
||||
|
||||
// G4String wName = fName;
|
||||
//
|
||||
@@ -215,7 +232,8 @@ void G4OpenInventorQtViewer::Initialise()
|
||||
fViewer->setTransparencyType(SoGLRenderAction::SORTED_OBJECT_ADD);
|
||||
fViewer->viewAll();
|
||||
fViewer->saveHomePosition();
|
||||
fViewer->setTitle(fName);
|
||||
// SOMEHOW this also the OIQt main window title
|
||||
if (!uiQt) fViewer->setTitle(fName);
|
||||
fViewer->show();
|
||||
|
||||
// This SHOULD invoke the event loop:
|
||||
|
||||
@@ -19,6 +19,12 @@ committal in the CVS repository !
|
||||
History file for visualization/Qt3D sub-category
|
||||
-----------------------------------------------
|
||||
|
||||
29-Dec-2020 John Allison (visQt3D-V10-06-03)
|
||||
- G4Qt3DViewer: Move code from constructor to G4Qt3DViewer::Initialise().
|
||||
- G4Qt3DSceneHandler:
|
||||
o Implement auxiliary edge suppression.
|
||||
o Tidy up G4Qt3DSceneHandler::AddPrimitive(const G4Text& - still doesn't work.
|
||||
|
||||
29-Oct-2020 Ben Morgan (visQt3D-V10-06-02)
|
||||
- Remove inclusion of obsolete CMake module
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
|
||||
G4Qt3DViewer(G4Qt3DSceneHandler&,const G4String& name);
|
||||
virtual ~G4Qt3DViewer();
|
||||
void Initialise();
|
||||
void SetView();
|
||||
void ClearView();
|
||||
void DrawView();
|
||||
|
||||
@@ -480,9 +480,8 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Text& text) {
|
||||
first = false;
|
||||
G4Exception("G4Qt3DSceneHandler::AddPrimitive(const G4Text& text)",
|
||||
"qt3D-0002", JustWarning,
|
||||
"Text drawing not yet implemented");
|
||||
}
|
||||
return;
|
||||
"Text drawing doesn't work yet");
|
||||
} // OK. Not working, but let it execute, which it does without error.
|
||||
|
||||
auto currentNode = CreateNewNode();
|
||||
if (!currentNode) return; // Node not available
|
||||
@@ -493,32 +492,34 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Text& text) {
|
||||
auto transform = G4Qt3DUtils::CreateQTransformFrom(position);
|
||||
transform->setScale(10);
|
||||
|
||||
// auto currentEntity = new Qt3DCore::QEntity(currentNode);
|
||||
|
||||
// This simply does not work
|
||||
// auto qtext = new Qt3DExtras::QText2DEntity(currentNode);
|
||||
// qtext->setText(text.GetText().c_str());
|
||||
// qtext->setHeight(100);
|
||||
// qtext->setWidth(1000);
|
||||
// qtext->setColor(Qt::green);
|
||||
// qtext->setFont(QFont("Courier New", 10));
|
||||
//
|
||||
// qtext->addComponent(transform);
|
||||
// qtext->addComponent(material);
|
||||
auto qtext = new Qt3DExtras::QText2DEntity();
|
||||
qtext->setParent(currentNode);
|
||||
// qtext->setParent(currentEntity); // ?? Doesn't help
|
||||
qtext->setText(text.GetText().c_str());
|
||||
qtext->setHeight(100);
|
||||
qtext->setWidth(1000);
|
||||
qtext->setColor(Qt::green);
|
||||
qtext->setFont(QFont("Courier New", 10));
|
||||
qtext->addComponent(transform);
|
||||
|
||||
// This produces text in 3D facing +z - not what we want
|
||||
const auto& colour = GetTextColour(text);
|
||||
auto material = new Qt3DExtras::QDiffuseSpecularMaterial();
|
||||
material->setObjectName("materialForText");
|
||||
material->setAmbient(G4Qt3DUtils::ConvertToQColor(colour));
|
||||
if (colour.GetAlpha() < 1.) material->setAlphaBlendingEnabled(true);
|
||||
|
||||
auto textMesh = new Qt3DExtras::QExtrudedTextMesh();
|
||||
textMesh->setText(text.GetText().c_str());
|
||||
textMesh->setFont(QFont("Courier New", 10));
|
||||
textMesh->setDepth(.01f);
|
||||
|
||||
currentNode->addComponent(material);
|
||||
currentNode->addComponent(transform);
|
||||
currentNode->addComponent(textMesh);
|
||||
// const auto& colour = GetTextColour(text);
|
||||
// auto material = new Qt3DExtras::QDiffuseSpecularMaterial();
|
||||
// material->setObjectName("materialForText");
|
||||
// material->setAmbient(G4Qt3DUtils::ConvertToQColor(colour));
|
||||
// if (colour.GetAlpha() < 1.) material->setAlphaBlendingEnabled(true);
|
||||
//
|
||||
// auto textMesh = new Qt3DExtras::QExtrudedTextMesh();
|
||||
// textMesh->setText(text.GetText().c_str());
|
||||
// textMesh->setFont(QFont("Courier New", 10));
|
||||
// textMesh->setDepth(.01f);
|
||||
//
|
||||
// currentNode->addComponent(material);
|
||||
// currentNode->addComponent(transform);
|
||||
// currentNode->addComponent(textMesh);
|
||||
}
|
||||
|
||||
void G4Qt3DSceneHandler::AddPrimitive(const G4Circle& circle)
|
||||
@@ -671,6 +672,7 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
|
||||
lines.push_back(newLine);
|
||||
};
|
||||
|
||||
G4bool isAuxilaryEdgeVisible = fpViewer->GetViewParameters().IsAuxEdgeVisible();
|
||||
G4bool notLastFace;
|
||||
do {
|
||||
G4int nEdges;
|
||||
@@ -684,12 +686,12 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
|
||||
normals.push_back(normal[0]);
|
||||
normals.push_back(normal[1]);
|
||||
normals.push_back(normal[2]);
|
||||
insertIfNew(Line(vertex[0],vertex[1]));
|
||||
insertIfNew(Line(vertex[1],vertex[2]));
|
||||
if(isAuxilaryEdgeVisible||edgeFlag[0]>0)insertIfNew(Line(vertex[0],vertex[1]));
|
||||
if(isAuxilaryEdgeVisible||edgeFlag[1]>0)insertIfNew(Line(vertex[1],vertex[2]));
|
||||
if (nEdges == 3) {
|
||||
// Face is a triangle
|
||||
// One more line for wireframe, triangles for surfaces are complete
|
||||
insertIfNew(Line(vertex[2],vertex[0]));
|
||||
if(isAuxilaryEdgeVisible||edgeFlag[2]>0)insertIfNew(Line(vertex[2],vertex[0]));
|
||||
} else if (nEdges == 4) {
|
||||
// Face is a quadrilateral
|
||||
// Create another triangle for surfaces, add two more lines for wireframe
|
||||
@@ -699,8 +701,8 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
|
||||
normals.push_back(normal[2]);
|
||||
normals.push_back(normal[3]);
|
||||
normals.push_back(normal[0]);
|
||||
insertIfNew(Line(vertex[2],vertex[3]));
|
||||
insertIfNew(Line(vertex[3],vertex[0]));
|
||||
if(isAuxilaryEdgeVisible||edgeFlag[2]>0)insertIfNew(Line(vertex[2],vertex[3]));
|
||||
if(isAuxilaryEdgeVisible||edgeFlag[3]>0)insertIfNew(Line(vertex[3],vertex[0]));
|
||||
} else {
|
||||
G4cerr << "ERROR: polyhedron face with more than 4 edges" << G4endl;
|
||||
return;
|
||||
|
||||
@@ -45,6 +45,9 @@ G4Qt3DViewer::G4Qt3DViewer
|
||||
, fMousePressed(false)
|
||||
, fMousePressedX(0.)
|
||||
, fMousePressedY(0.)
|
||||
{}
|
||||
|
||||
void G4Qt3DViewer::Initialise()
|
||||
{
|
||||
setObjectName(fName.c_str());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user