Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4SceneTreeItem.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
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     // A ghost is a touchable we know to be there but know only its path
0044     enum Type
0045     {
0046       unidentified,
0047       root,
0048       model,
0049       pvmodel,  // Physical Volume model - special case 
0050       ghost,
0051       touchable
0052     };
0053 
0054     explicit G4SceneTreeItem(Type type = unidentified) { fType = type; }
0055     ~G4SceneTreeItem() = default;
0056 
0057     // Copy contructor copies the whole tree, i.e., children and all descendants
0058     G4SceneTreeItem(const G4SceneTreeItem&) = default;
0059 
0060     // Assigns the whole tree, i.e., children and all descendants
0061     G4SceneTreeItem& operator= (const G4SceneTreeItem&) = default;
0062 
0063     // Access functions
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     // Insert item at - or rather, just before - pos
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     // Utility functions
0107 
0108     // Reset visibility of all objects to false - visible objects will then set to true
0109     void ResetVisibility();
0110 
0111     // If found, returns "true" and places iterator in foundIter
0112     G4bool FindTouchableFromRoot(const G4String& fullPathString,
0113                                  std::list<G4SceneTreeItem>::iterator& foundIter);
0114 
0115     // Dump single item, i.e., ignore any children
0116     void DumpSingleItem(std::ostream&, G4int verbosity = 0) const;
0117 
0118     // Dump whole tree
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  // G4SceneTreeItem_hh