11#include <QTreeWidgetItem>
79 bool is_visible =
true;
92 int representation = 1;
102 std::string material;
117 double density = 0.0;
126 bool recursive =
false;
130 [[nodiscard]] std::string
get_mother()
const {
return mother; }
133 [[nodiscard]] QColor
get_color()
const {
return color; }
145 [[nodiscard]]
double get_mass()
const {
return mass; }
207using g4tree_map = std::map<std::string, std::unique_ptr<G4Ttree_item>>;
247 explicit GTree(
const std::shared_ptr<GOptions>& gopt,
248 std::unordered_map<std::string, G4Volume*> g4volumes_map,
249 QWidget* parent =
nullptr);
270 std::map<std::string, g4tree_map> g4_systems_tree;
275 QTreeWidget* treeWidget =
nullptr;
281 QWidget* rightPanel =
nullptr;
286 QWidget* bottomPanel =
nullptr;
294 QLabel* typeLabel =
nullptr;
295 QLabel* daughtersLabel =
nullptr;
296 QLabel* nameLabel =
nullptr;
297 QLabel* materialLabel =
nullptr;
298 QLabel* massLabel =
nullptr;
299 QLabel* volumeLabel =
nullptr;
300 QLabel* densityLabel =
nullptr;
305 QSlider* opacitySlider =
nullptr;
310 QLabel* opacityLabel =
nullptr;
316 void build_tree(std::unordered_map<std::string, G4Volume*> g4volumes_map);
334 void set_visibility(
const std::string& fullName,
bool visible);
341 void set_color(
const std::string& fullName,
const QColor& c);
348 void set_opacity(
const std::string& volumeName,
double opacity);
354 QWidget* right_widget();
361 int get_ndaughters(QTreeWidgetItem* item)
const;
368 G4Ttree_item* findTreeItem(
const std::string& fullName);
377 std::string current_volume_name;
390 void onItemChanged(QTreeWidgetItem* item,
int column);
399 void onColorButtonClicked();
406 void onTreeItemClicked(QTreeWidgetItem* item,
int column);
413 void onCurrentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous);
430 void onOpacitySliderChanged(
int value);
Lightweight per-volume record used by GTree to populate the UI.
void set_recursive(bool recursive)
Set the recursive flag.
int get_representation() const
Return the cached representation mode.
static std::string vname_from_v4name(std::string v4name)
Extract the "leaf" volume name from a full volume name.
double get_opacity() const
Return the cached opacity (alpha) in [0,1].
G4Ttree_item(G4Volume *g4volume)
Construct a cached record for a single geometry volume.
double get_density() const
Return the cached density.
void set_opacity(double opacity)
Update the cached opacity.
double get_volume() const
Return the cached volume.
bool get_visibility() const
Return the cached visibility state.
double get_mass() const
Return the cached mass.
QColor get_color() const
Return the cached RGB color.
bool get_recursive() const
Return the cached recursive flag.
void set_color(QColor &c)
Update the cached color.
static std::string system_from_v4name(std::string v4name)
Extract the system name from a full volume name.
std::string get_material() const
Return the cached material name.
std::string get_mother() const
Return the cached mother name.
Qt widget that displays the geometry hierarchy and allows interactive style edits.
GTree(const std::shared_ptr< GOptions > &gopt, std::unordered_map< std::string, G4Volume * > g4volumes_map, QWidget *parent=nullptr)
Construct the geometry tree widget.
GTree & operator=(const GTree &)=delete
Non-assignable: the widget owns unique model resources.
GTree(const GTree &)=delete
Non-copyable: the widget owns unique model resources.
std::map< std::string, std::unique_ptr< G4Ttree_item > > g4tree_map