35 auto* q =
new Qt3DCore::QTransform;
38 (
g.xx(),
g.xy(),
g.xz(),
g.dx(),
39 g.yx(),
g.yy(),
g.yz(),
g.dy(),
40 g.zx(),
g.zy(),
g.zz(),
g.dz(),
42 q->setObjectName(
"transform");
53 return QVector3D(v.
x(),v.
y(),v.
z());
59 G4Qt3DUtils::LogFile <<
"node " << node->objectName().toStdString() << std::endl;
61 Qt3DCore::QEntity* entity =
dynamic_cast<Qt3DCore::QEntity*
>(node);
62 if(entity ==
nullptr){
66 G4Qt3DUtils::LogFile << (
void*)node <<
": "
67 <<
"Deleting non-entity node " <<
name << std::endl;
73 for (
auto component: entity->components()) {
77 G4Qt3DUtils::LogFile << (
void*)node <<
": " <<
"Deleting component " <<
name
78 <<
" of " << entity->objectName().toStdString() << std::endl;
80 entity->removeComponent(component);
84 for (
auto child_node: entity->childNodes()) {
88 G4Qt3DUtils::LogFile << (
void*)child_node <<
": " <<
"Child node " <<
name
89 <<
" of " << entity->objectName().toStdString() << std::endl;
96 G4Qt3DUtils::LogFile << (
void*)entity <<
": " <<
"Deleting entity " <<
name << std::endl;
103 Qt3DCore::QEntity* entity =
dynamic_cast<Qt3DCore::QEntity*
>(node);
104 if(entity ==
nullptr){
108 G4Qt3DUtils::LogFile << (
void*)node <<
": " <<
"Found non-entity node " <<
name << std::endl;
112 for (
auto component: entity->components()){
116 G4Qt3DUtils::LogFile << (
void*)entity <<
": " <<
"Deleting component " <<
name
117 <<
" of " << entity->objectName().toStdString() << std::endl;
119 entity->removeComponent(component);
123 auto child_nodes = entity->childNodes();
124 for (
auto child_node: child_nodes) {
128 G4Qt3DUtils::LogFile << (
void*)child_node <<
": " <<
"Child node " <<
name
129 <<
" of " << entity->objectName().toStdString() << std::endl;
136 G4Qt3DUtils::LogFile << (
void*)entity <<
": " <<
"Clearing child nodes of " <<
name << std::endl;
142std::ofstream G4Qt3DUtils::LogFile(
"LogFile.txt");
143void G4Qt3DUtils::PrintQObjectTree
144 (
const QObject* node,
147 auto& logFile = G4Qt3DUtils::LogFile;
148 if (where.length()) logFile <<
"\n===== QObjectTree at " << where << std::endl;
149 static G4int iDep = -1;
151 G4String nodeName = node->objectName().toStdString();
152 if (nodeName ==
"") nodeName =
"X";
153 for (
G4int i = 0; i < iDep; ++i) logFile <<
" ";
154 logFile << (
void*)node <<
": "
155 <<
"Node at depth " << iDep <<
": " << nodeName <<
": "
156 <<
"thread: " << node->thread() <<
": "
157 <<
"parent: " << node->parent() <<
": ";
158 const auto* g4node =
dynamic_cast<const G4Qt3DQEntity*
>(node);
162 logFile <<
typeid(node).
name() << std::endl;
165 for (
const auto& component: g4node->components()) {
168 for (
G4int i = 0; i < iDep; ++i) logFile <<
" ";
169 logFile << (
void*)component <<
": "<<
"Component at depth " << iDep <<
" "
170 <<
name <<
" of " << nodeName << std::endl;
173 for (
const auto& child: node->children()) {
174 PrintQObjectTree(child);
177 if (where.length()) logFile <<
"===== End: QObjectTree at " << where << std::endl;
static constexpr double g
G4double GetAlpha() const
G4double GetGreen() const
const G4PhysicalVolumeModel::G4PhysicalVolumeNodeID & GetPVNodeID() const
const char * name(G4int ptype)
Qt3DCore::QTransform * CreateQTransformFrom(const G4Transform3D &)
QColor ConvertToQColor(const G4Colour &c)
void delete_entity_recursively(Qt3DCore::QNode *node)
void delete_components_and_children_of_entity_recursively(Qt3DCore::QNode *node)
QVector3D ConvertToQVector3D(const G4ThreeVector &v)