Import Geant4 11.0.0.beta source tree
This commit is contained in:
@@ -1,19 +1,4 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# CMakeLists.txt
|
||||
# Module : G4visQt3D
|
||||
# Package: Geant4.src.G4visualization.G4visQt3D
|
||||
#
|
||||
# CMakeLists.txt for single level library that may be build global or granular
|
||||
#
|
||||
# Generated on : 24/9/2010
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
# - G4visQt3D category build
|
||||
|
||||
include(Geant4MacroLibraryTargets)
|
||||
if(GEANT4_BUILD_GRANULAR_LIBS)
|
||||
GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
|
||||
else()
|
||||
GEANT4_GLOBAL_LIBRARY_TARGET(COMPONENTS sources.cmake)
|
||||
endif()
|
||||
geant4_global_library_target(COMPONENTS sources.cmake)
|
||||
|
||||
|
||||
@@ -19,7 +19,32 @@ committal in the CVS repository !
|
||||
History file for visualization/Qt3D sub-category
|
||||
-----------------------------------------------
|
||||
|
||||
29-Dec-2020 John Allison (visQt3D-V10-06-03)
|
||||
07 June 2021 John Allison (visQt3D-V10-07-05)
|
||||
- Requires greps-V10-07-07 (new method AddCompound (const G4Mesh&)).
|
||||
- Requires modeling-V10-07-09 (new class G4Mesh).
|
||||
- Requires visman-V10-07-10 (new default method and new commands).
|
||||
- G4Qt3DViewer.hh:
|
||||
o Fix hidden function warning.
|
||||
- G4Qt3DViewer.cc:
|
||||
o Force kernel visit if special mesh rendering parameters change.
|
||||
|
||||
28-May-2021 Ben Morgan (visQt3D-V10-07-04)
|
||||
- Migrate to modular CMake build
|
||||
|
||||
27 May 2021 John Allison (visQt3D-V10-07-03)
|
||||
- AddPrimitive(const G4Polyhedron&):
|
||||
o Minor improvement to error message in the case of unexpected number
|
||||
of edges.
|
||||
|
||||
17-Apr-2021 John Allison (visQt3D-V10-07-02)
|
||||
- Fix compiler warning (unused variable "text")
|
||||
|
||||
08-Apr-2021 John Allison (visQt3D-V10-07-01)
|
||||
- Move //#define G4QT3DDEBUG to G4Qt3DUtils.hh.
|
||||
o Improve overall protection of debug output with #ifdef G4QT3DDEBUG.
|
||||
- Include some trial code for text output, but comment it out.
|
||||
|
||||
29-Dec-2020 John Allison (visQt3D-V10-07-00)
|
||||
- G4Qt3DViewer: Move code from constructor to G4Qt3DViewer::Initialise().
|
||||
- G4Qt3DSceneHandler:
|
||||
o Implement auxiliary edge suppression.
|
||||
|
||||
@@ -39,8 +39,6 @@ class QEntity;
|
||||
}
|
||||
class G4Qt3DQEntity;
|
||||
|
||||
//#define G4QT3DDEBUG
|
||||
|
||||
class G4Qt3DSceneHandler: public G4VSceneHandler {
|
||||
|
||||
friend class G4Qt3DViewer;
|
||||
@@ -61,6 +59,7 @@ public:
|
||||
void BeginPrimitives(const G4Transform3D& objectTransformation);
|
||||
void EndPrimitives();
|
||||
|
||||
using G4VSceneHandler::AddPrimitive;
|
||||
void AddPrimitive(const G4Polyline&);
|
||||
void AddPrimitive(const G4Polymarker&);
|
||||
void AddPrimitive(const G4Text&);
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
#include <Qt3DCore>
|
||||
#include <fstream>
|
||||
|
||||
//#define G4QT3DDEBUG
|
||||
|
||||
class G4Colour;
|
||||
|
||||
namespace G4Qt3DUtils {
|
||||
|
||||
@@ -1,61 +1,41 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# sources.cmake
|
||||
# Module : G4visQt3D
|
||||
# Package: Geant4.src.G4visualization.G4visQt3D
|
||||
#
|
||||
# Sources description for a library.
|
||||
# Lists the sources and headers of the code explicitely.
|
||||
# Lists include paths needed.
|
||||
# Lists the internal granular and global dependencies of the library.
|
||||
# Source specific properties should be added at the end.
|
||||
#
|
||||
# Generated on : 24/9/2010
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
# - G4visQt3D module build definition
|
||||
|
||||
#
|
||||
# Define the Geant4 Module.
|
||||
#
|
||||
GEANT4_DEFINE_MODULE(NAME G4visQt3D
|
||||
HEADERS
|
||||
G4Qt3D.hh
|
||||
G4Qt3DQEntity.hh
|
||||
G4Qt3DSceneHandler.hh
|
||||
G4Qt3DUtils.hh
|
||||
G4Qt3DViewer.hh
|
||||
SOURCES
|
||||
G4Qt3D.cc
|
||||
G4Qt3DSceneHandler.cc
|
||||
G4Qt3DUtils.cc
|
||||
G4Qt3DViewer.cc
|
||||
GRANULAR_DEPENDENCIES
|
||||
G4csg
|
||||
G4geometrymng
|
||||
G4globman
|
||||
G4graphics_reps
|
||||
G4hits
|
||||
G4intercoms
|
||||
G4interfaces
|
||||
G4modeling
|
||||
G4specsolids
|
||||
G4tracking
|
||||
G4vis_management
|
||||
GLOBAL_DEPENDENCIES
|
||||
G4digits_hits
|
||||
G4geometry
|
||||
G4global
|
||||
G4graphics_reps
|
||||
G4intercoms
|
||||
G4interfaces
|
||||
G4modeling
|
||||
G4tracking
|
||||
G4vis_management
|
||||
LINK_LIBRARIES
|
||||
Qt5::Gui Qt5::Widgets Qt5::3DCore Qt5::3DExtras Qt5::3DRender
|
||||
)
|
||||
geant4_add_module(G4visQt3D
|
||||
PUBLIC_HEADERS
|
||||
G4Qt3D.hh
|
||||
G4Qt3DQEntity.hh
|
||||
G4Qt3DSceneHandler.hh
|
||||
G4Qt3DUtils.hh
|
||||
G4Qt3DViewer.hh
|
||||
SOURCES
|
||||
G4Qt3D.cc
|
||||
G4Qt3DSceneHandler.cc
|
||||
G4Qt3DUtils.cc
|
||||
G4Qt3DViewer.cc)
|
||||
|
||||
geant4_module_compile_definitions(G4visQt3D
|
||||
PRIVATE G4INTY_BUILD_QT G4UI_BUILD_QT_SESSION G4VIS_BUILD_QT3D_DRIVER)
|
||||
|
||||
geant4_module_link_libraries(G4visQt3D
|
||||
PUBLIC
|
||||
G4modeling
|
||||
G4globman
|
||||
G4hepgeometry
|
||||
G4vis_management
|
||||
Qt5::Gui
|
||||
Qt5::Widgets
|
||||
Qt5::3DCore
|
||||
Qt5::3DExtras
|
||||
Qt5::3DRender
|
||||
PRIVATE
|
||||
G4csg
|
||||
G4graphics_reps
|
||||
G4geometrymng
|
||||
G4navigation
|
||||
G4UIbasic
|
||||
G4intercoms)
|
||||
|
||||
|
||||
add_definitions(-DG4INTY_BUILD_QT -DG4UI_BUILD_QT_SESSION -DG4VIS_BUILD_QT3D_DRIVER)
|
||||
|
||||
# List any source specific properties here
|
||||
|
||||
|
||||
@@ -128,7 +128,8 @@ G4Qt3DQEntity* G4Qt3DSceneHandler::CreateNewNode()
|
||||
|
||||
if (fReadyForTransients) { // All transients hang from this node
|
||||
newNode = new G4Qt3DQEntity(fpTransientObjects);
|
||||
newNode->setObjectName(fpModel->GetGlobalTag().c_str());
|
||||
G4String name = fpModel? fpModel->GetGlobalTag(): "User";
|
||||
newNode->setObjectName(name.c_str());
|
||||
return newNode;
|
||||
}
|
||||
|
||||
@@ -467,7 +468,7 @@ void G4Qt3DSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
|
||||
}
|
||||
}
|
||||
|
||||
void G4Qt3DSceneHandler::AddPrimitive(const G4Text& text) {
|
||||
void G4Qt3DSceneHandler::AddPrimitive(const G4Text& /*text*/) {
|
||||
#ifdef G4QT3DDEBUG
|
||||
G4cout <<
|
||||
"G4Qt3DSceneHandler::AddPrimitive(const G4Text& text) called.\n"
|
||||
@@ -483,6 +484,7 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Text& text) {
|
||||
"Text drawing doesn't work yet");
|
||||
} // OK. Not working, but let it execute, which it does without error.
|
||||
|
||||
/* But it crashes after /vis/viewer/rebuild!!!
|
||||
auto currentNode = CreateNewNode();
|
||||
if (!currentNode) return; // Node not available
|
||||
|
||||
@@ -490,7 +492,8 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Text& text) {
|
||||
|
||||
auto position = fObjectTransformation*G4Translate3D(text.GetPosition());
|
||||
auto transform = G4Qt3DUtils::CreateQTransformFrom(position);
|
||||
transform->setScale(10);
|
||||
// transform->setScale(10);
|
||||
transform->setScale(0.1);
|
||||
|
||||
// auto currentEntity = new Qt3DCore::QEntity(currentNode);
|
||||
|
||||
@@ -499,8 +502,10 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Text& text) {
|
||||
qtext->setParent(currentNode);
|
||||
// qtext->setParent(currentEntity); // ?? Doesn't help
|
||||
qtext->setText(text.GetText().c_str());
|
||||
qtext->setHeight(100);
|
||||
qtext->setWidth(1000);
|
||||
// qtext->setHeight(100);
|
||||
// qtext->setWidth(1000);
|
||||
qtext->setHeight(20);
|
||||
qtext->setWidth(100);
|
||||
qtext->setColor(Qt::green);
|
||||
qtext->setFont(QFont("Courier New", 10));
|
||||
qtext->addComponent(transform);
|
||||
@@ -520,6 +525,7 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Text& text) {
|
||||
// currentNode->addComponent(material);
|
||||
// currentNode->addComponent(transform);
|
||||
// currentNode->addComponent(textMesh);
|
||||
*/
|
||||
}
|
||||
|
||||
void G4Qt3DSceneHandler::AddPrimitive(const G4Circle& circle)
|
||||
@@ -704,7 +710,10 @@ void G4Qt3DSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron)
|
||||
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;
|
||||
G4cerr
|
||||
<< "ERROR: polyhedron face with unexpected number of edges (" << nEdges << ')'
|
||||
<< "\n Tag: " << fpModel->GetCurrentTag()
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
} while (notLastFace);
|
||||
|
||||
@@ -62,9 +62,9 @@ void G4Qt3DUtils::delete_entity_recursively(Qt3DCore::QNode *node){
|
||||
#endif
|
||||
Qt3DCore::QEntity* entity = dynamic_cast<Qt3DCore::QEntity*>(node);
|
||||
if(entity == nullptr){
|
||||
#ifdef G4QT3DDEBUG
|
||||
G4String name = node->objectName().toStdString();
|
||||
if (name == "") name = "X";
|
||||
#ifdef G4QT3DDEBUG
|
||||
G4Qt3DUtils::LogFile << (void*)node << ": "
|
||||
<< "Deleting non-entity node " << name << std::endl;
|
||||
#endif
|
||||
@@ -73,9 +73,9 @@ void G4Qt3DUtils::delete_entity_recursively(Qt3DCore::QNode *node){
|
||||
return;
|
||||
}
|
||||
for (auto component: entity->components()) {
|
||||
#ifdef G4QT3DDEBUG
|
||||
G4String name = component->objectName().toStdString();
|
||||
if (name == "") name = "X";
|
||||
#ifdef G4QT3DDEBUG
|
||||
G4Qt3DUtils::LogFile << (void*)node << ": " << "Deleting component " << name
|
||||
<< " of " << entity->objectName().toStdString() << std::endl;
|
||||
#endif
|
||||
@@ -104,17 +104,17 @@ void G4Qt3DUtils::delete_entity_recursively(Qt3DCore::QNode *node){
|
||||
void G4Qt3DUtils::delete_components_and_children_of_entity_recursively(Qt3DCore::QNode *node){
|
||||
Qt3DCore::QEntity* entity = dynamic_cast<Qt3DCore::QEntity*>(node);
|
||||
if(entity == nullptr){
|
||||
#ifdef G4QT3DDEBUG
|
||||
G4String name = node->objectName().toStdString();
|
||||
if (name == "") name = "X";
|
||||
#ifdef G4QT3DDEBUG
|
||||
G4Qt3DUtils::LogFile << (void*)node << ": " << "Found non-entity node " << name << std::endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
for (auto component: entity->components()){
|
||||
#ifdef G4QT3DDEBUG
|
||||
G4String name = component->objectName().toStdString();
|
||||
if (name == "") name = "X";
|
||||
#ifdef G4QT3DDEBUG
|
||||
G4Qt3DUtils::LogFile << (void*)entity << ": " << "Deleting component " << name
|
||||
<< " of " << entity->objectName().toStdString() << std::endl;
|
||||
#endif
|
||||
|
||||
@@ -247,7 +247,9 @@ G4bool G4Qt3DViewer::CompareForKernelVisit(G4ViewParameters& lastVP)
|
||||
(lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())||
|
||||
(lastVP.IsPicking () != fVP.IsPicking ()) ||
|
||||
(lastVP.GetVisAttributesModifiers() !=
|
||||
fVP.GetVisAttributesModifiers())
|
||||
fVP.GetVisAttributesModifiers()) ||
|
||||
(lastVP.IsSpecialMeshRendering() !=
|
||||
fVP.IsSpecialMeshRendering())
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
@@ -265,6 +267,10 @@ G4bool G4Qt3DViewer::CompareForKernelVisit(G4ViewParameters& lastVP)
|
||||
(lastVP.GetExplodeFactor () != fVP.GetExplodeFactor ()))
|
||||
return true;
|
||||
|
||||
if (lastVP.IsSpecialMeshRendering() &&
|
||||
(lastVP.GetSpecialMeshVolumes() != fVP.GetSpecialMeshVolumes()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user