CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/Fireworks/Core/src/FWGeometryTableManager.h

Go to the documentation of this file.
00001 #ifndef Fireworks_Core_FWGeometryTableManager_h
00002 #define Fireworks_Core_FWGeometryTableManager_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     Core
00006 // Class  :     FWGeometryTableManager
00007 // 
00016 //
00017 // Original Author:  
00018 //         Created:  Wed Jan  4 20:34:22 CET 2012
00019 // $Id: FWGeometryTableManager.h,v 1.10 2012/05/10 23:57:52 amraktad Exp $
00020 //
00021 
00022 #include "Fireworks/Core/interface/FWGeometryTableManagerBase.h"
00023 #include <string>
00024 #include <boost/tr1/unordered_map.hpp>
00025 
00026 class FWGeometryTableViewBase;
00027 class FWGeometryTableView;
00028 
00029 #include "TGeoVolume.h"
00030 
00031 
00032 class FWGeometryTableManager : public FWGeometryTableManagerBase
00033 {
00034 public:
00035    enum ECol   { kNameColumn, kColorColumn, kTranspColumn, kVisSelfColumn, kVisChildColumn, kMaterialColumn, kNumColumn };
00036 
00037    enum GeometryBits
00038    {
00039       kMatches         =  BIT(5),
00040       kChildMatches    =  BIT(6),
00041       kFilterCached    =  BIT(7)
00042    };
00043 
00044    struct Match
00045    {
00046       bool m_matches;
00047       bool m_childMatches;
00048       Match() : m_matches(false), m_childMatches(false) {}
00049 
00050       bool accepted() { return m_matches || m_childMatches; }
00051    };
00052 
00053 
00054    typedef boost::unordered_map<TGeoVolume*, Match>  Volumes_t;
00055    typedef Volumes_t::iterator               Volumes_i; 
00056 
00057    FWGeometryTableManager(FWGeometryTableView*);
00058    virtual ~FWGeometryTableManager();
00059 
00060    virtual void recalculateVisibility();
00061    void recalculateVisibilityNodeRec(int);
00062    void recalculateVisibilityVolumeRec(int);
00063    // geo 
00064    void loadGeometry( TGeoNode* iGeoTopNode, TObjArray* iVolumes);
00065    void checkChildMatches(TGeoVolume* v,  std::vector<TGeoVolume*>&);
00066    void importChildren(int parent_idx);
00067    void checkHierarchy();
00068 
00069    // signal callbacks
00070    void updateFilter(int);
00071    void printMaterials();
00072 
00073    virtual void setDaughtersSelfVisibility(int i, bool v);
00074    virtual void setVisibility(NodeInfo& nodeInfo, bool );
00075    virtual void setVisibilityChld(NodeInfo& nodeInfo, bool);
00076 
00077    virtual bool getVisibilityChld(const NodeInfo& nodeInfo) const;
00078    virtual bool getVisibility (const NodeInfo& nodeInfo) const;
00079 
00080    void assertNodeFilterCache(NodeInfo& data);
00081  
00082    virtual int numberOfColumns() const { return kNumColumn; }
00083    virtual FWTableCellRendererBase* cellRenderer(int iSortedRowNumber, int iCol) const;
00084    
00085    void checkRegionOfInterest(double* center, double radius, long algo);
00086    void resetRegionOfInterest();
00087    
00088 protected:
00089    virtual bool nodeIsParent(const NodeInfo&) const;
00090    //   virtual FWGeometryTableManagerBase::ESelectionState nodeSelectionState(int) const;
00091    virtual const char* cellName(const NodeInfo& data) const;
00092 
00093 private:
00094    FWGeometryTableManager(const FWGeometryTableManager&); // stop default
00095    const FWGeometryTableManager& operator=(const FWGeometryTableManager&); // stop default
00096 
00097 
00098    FWGeometryTableView *m_browser;
00099 
00100    mutable Volumes_t    m_volumes;
00101 
00102    bool                 m_filterOff; //cached
00103 };
00104 
00105 #endif