File indexing completed on 2025-10-21 08:57:02
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 { fModelDescription = modelDescription; }
0081
0082 const G4String& GetFurtherInfo() const { return fFurtherInfo; }
0083 void SetFurtherInfo(const G4String& furtherInfo)
0084 { fFurtherInfo = furtherInfo; }
0085
0086 const std::map<G4String, G4AttDef>* GetAttDefs() const { return fpAttDefs; }
0087 void SetAttDefs(const std::map<G4String, G4AttDef>* pAttDefs) { fpAttDefs = pAttDefs; };
0088
0089 std::vector<G4AttValue>* GetAttValues() const { return fpAttValues; }
0090 void SetAttValues(std::vector<G4AttValue>* pAttValues) { fpAttValues = pAttValues; }
0091
0092 const G4VisAttributes& GetVisAttributes() const { return fVisAttributes; }
0093 G4VisAttributes& AccessVisAttributes() { return fVisAttributes; }
0094 void SetVisAttributes(const G4VisAttributes& visAtts) { fVisAttributes = visAtts; }
0095
0096 const std::list<G4SceneTreeItem>& GetChildren() const { return fChildren; }
0097
0098 std::list<G4SceneTreeItem>::iterator InsertChild(std::list<G4SceneTreeItem>::iterator pos,
0099 const G4SceneTreeItem& item)
0100 {
0101 return fChildren.insert(pos, item);
0102 }
0103 std::list<G4SceneTreeItem>& AccessChildren() { return fChildren; }
0104
0105 G4bool IsExpanded() const { return fExpanded; }
0106 void SetExpanded(G4bool expanded) { fExpanded = expanded; }
0107
0108
0109
0110
0111 void ResetVisibility();
0112
0113
0114 G4bool FindTouchableFromRoot(const G4String& fullPathString,
0115 std::list<G4SceneTreeItem>::iterator& foundIter);
0116
0117
0118 void DumpSingleItem(std::ostream&, G4int verbosity = 0) const;
0119
0120
0121 void DumpTree(std::ostream&, G4int verbosity = 0) const;
0122
0123 private:
0124 Type fType = unidentified;
0125 static std::map<Type, G4String> fTypeMap;
0126 G4String fDescription;
0127 G4String fModelType = "none";
0128 G4String fModelDescription;
0129 G4String fFurtherInfo;
0130 G4String fPVPath;
0131 G4VisAttributes fVisAttributes;
0132 const std::map<G4String, G4AttDef>* fpAttDefs = nullptr;
0133 std::vector<G4AttValue>* fpAttValues = nullptr;
0134 std::list<G4SceneTreeItem> fChildren;
0135 G4bool fExpanded = true;
0136 };
0137
0138 #endif