File indexing completed on 2025-07-02 08:36:08
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 #ifndef G4SceneTreeItem_hh
0029 #define G4SceneTreeItem_hh
0030
0031 #include "G4AttDef.hh"
0032 #include "G4AttValue.hh"
0033 #include "G4VisAttributes.hh"
0034 #include "globals.hh"
0035
0036 #include <list>
0037 #include <map>
0038 #include <vector>
0039
0040 class G4SceneTreeItem
0041 {
0042 public:
0043
0044 enum Type
0045 {
0046 unidentified,
0047 root,
0048 model,
0049 pvmodel,
0050 ghost,
0051 touchable
0052 };
0053
0054 explicit G4SceneTreeItem(Type type = unidentified) { fType = type; }
0055 ~G4SceneTreeItem() = default;
0056
0057
0058 G4SceneTreeItem(const G4SceneTreeItem&) = default;
0059
0060
0061 G4SceneTreeItem& operator= (const G4SceneTreeItem&) = default;
0062
0063
0064
0065 Type GetType() const { return fType; }
0066 const G4String& GetTypeString() const { return fTypeMap[fType]; }
0067 void SetType(Type type) { fType = type; }
0068
0069 const G4String& GetPVPath() const { return fPVPath; }
0070 void SetPVPath(const G4String& PVPath) { fPVPath = PVPath; }
0071
0072 const G4String& GetDescription() const { return fDescription; }
0073 void SetDescription(const G4String& description) { fDescription = description; }
0074
0075 const G4String& GetModelType() const { return fModelType; }
0076 void SetModelType(const G4String& modelType) { fModelType = modelType; }
0077
0078 const G4String& GetModelDescription() const { return fModelDescription; }
0079 void SetModelDescription(const G4String& modelDescription)
0080 {
0081 fModelDescription = modelDescription;
0082 }
0083
0084 const std::map<G4String, G4AttDef>* GetAttDefs() const { return fpAttDefs; }
0085 void SetAttDefs(const std::map<G4String, G4AttDef>* pAttDefs) { fpAttDefs = pAttDefs; };
0086
0087 std::vector<G4AttValue>* GetAttValues() const { return fpAttValues; }
0088 void SetAttValues(std::vector<G4AttValue>* pAttValues) { fpAttValues = pAttValues; }
0089
0090 const G4VisAttributes& GetVisAttributes() const { return fVisAttributes; }
0091 G4VisAttributes& AccessVisAttributes() { return fVisAttributes; }
0092 void SetVisAttributes(const G4VisAttributes& visAtts) { fVisAttributes = visAtts; }
0093
0094 const std::list<G4SceneTreeItem>& GetChildren() const { return fChildren; }
0095
0096 std::list<G4SceneTreeItem>::iterator InsertChild(std::list<G4SceneTreeItem>::iterator pos,
0097 const G4SceneTreeItem& item)
0098 {
0099 return fChildren.insert(pos, item);
0100 }
0101 std::list<G4SceneTreeItem>& AccessChildren() { return fChildren; }
0102
0103 G4bool IsExpanded() const { return fExpanded; }
0104 void SetExpanded(G4bool expanded) { fExpanded = expanded; }
0105
0106
0107
0108
0109 void ResetVisibility();
0110
0111
0112 G4bool FindTouchableFromRoot(const G4String& fullPathString,
0113 std::list<G4SceneTreeItem>::iterator& foundIter);
0114
0115
0116 void DumpSingleItem(std::ostream&, G4int verbosity = 0) const;
0117
0118
0119 void DumpTree(std::ostream&, G4int verbosity = 0) const;
0120
0121 private:
0122 Type fType = unidentified;
0123 static std::map<Type, G4String> fTypeMap;
0124 G4String fDescription;
0125 G4String fModelType = "none";
0126 G4String fModelDescription;
0127 G4String fPVPath;
0128 G4VisAttributes fVisAttributes;
0129 const std::map<G4String, G4AttDef>* fpAttDefs = nullptr;
0130 std::vector<G4AttValue>* fpAttValues = nullptr;
0131 std::list<G4SceneTreeItem> fChildren;
0132 G4bool fExpanded = true;
0133 };
0134
0135 #endif