CMS 3D CMS Logo

FWGeometryTableManagerBase.h
Go to the documentation of this file.
1 #ifndef Fireworks_Core_FWGeometryTableManagerBase_h
2 #define Fireworks_Core_FWGeometryTableManagerBase_h
3 // -*- C++ -*-
4 //
5 // Package: Core
6 // Class : FWGeometryTableManagerBase
7 //
16 //
17 // Original Author: Alja Mrak-Tadel, Matevz Tadel
18 // Created: Thu Jan 27 14:50:40 CET 2011
19 //
20 
21 #include <sigc++/sigc++.h>
22 
24 
29 
30 #include "TGeoNode.h"
31 
33 class TGeoNode;
34 class TEvePointSet;
35 
38 
39 public:
40  // enum ESelectionState { kNone, kSelected, kHighlighted, kFiltered };
41 
42  enum Bits {
43  kExpanded = BIT(0),
44 
45  kVisNodeSelf = BIT(1),
46  kVisNodeChld = BIT(2),
47 
48  kHighlighted = BIT(3),
49  kSelected = BIT(4)
50  };
51 
52  struct NodeInfo {
54 
55  NodeInfo(TGeoNode* n, Int_t p, Color_t col, Char_t l, UChar_t f = kVisNodeSelf | kVisNodeChld)
56  : m_node(n), m_parent(p), m_color(col), m_level(l), m_flags(f) {}
57 
58  TGeoNode* m_node;
59  Int_t m_parent;
60  Color_t m_color;
61  UChar_t m_level;
62  UChar_t m_flags;
63  UChar_t m_transparency;
64 
65  const char* name() const;
66  // const char* nameIndent() const;
67 
68  void setBit(UChar_t f) { m_flags |= f; }
69  void resetBit(UChar_t f) { m_flags &= ~f; }
70  void setBitVal(UChar_t f, bool x) { x ? setBit(f) : resetBit(f); }
71 
72  bool testBit(UChar_t f) const { return (m_flags & f) == f; }
73  bool testBitAny(UChar_t f) const { return (m_flags & f) != 0; }
74 
75  void switchBit(UChar_t f) { testBit(f) ? resetBit(f) : setBit(f); }
76 
78  m_color = x.m_color;
79  m_transparency = x.m_transparency;
80  if (m_node->GetVolume()) {
81  m_node->GetVolume()->SetLineColor(x.m_color);
82  m_node->GetVolume()->SetTransparency(x.m_transparency);
83  }
84  }
85  };
86 
87  typedef std::vector<NodeInfo> Entries_v;
88  typedef Entries_v::iterator Entries_i;
89 
91 
92  //private:
93  // AMT: this could be a common base class with FWCollectionSummaryModelCellRenderer ..
95  public:
97  ~ColorBoxRenderer() override;
98 
99  UInt_t width() const override { return m_width; }
100  UInt_t height() const override { return m_height; }
101  void setData(Color_t c, bool);
102  void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight) override;
103 
104  UInt_t m_width;
105  UInt_t m_height;
106  Pixel_t m_color;
109  };
110 
111 protected:
112  virtual bool nodeIsParent(const NodeInfo&) const { return false; }
113  // virtual ESelectionState nodeSelectionState(int idx) const;
114 
115 public:
117  ~FWGeometryTableManagerBase() override;
118  // virtual std::string& cellName(const NodeInfo& ) const { return &std::string("ddd");}
119  virtual const char* cellName(const NodeInfo&) const { return nullptr; }
120 
121  // virtual functions of FWTableManagerBase
122 
123  int unsortedRowNumber(int unsorted) const override;
124  int numberOfRows() const override;
125  std::vector<std::string> getTitles() const override;
126 
127  virtual const std::string title() const;
128 
129  //int selectedRow() const;
130  //int selectedColumn() const;
131  //virtual bool rowIsSelected(int row) const;
132 
133  std::vector<int> rowToIndex() { return m_row_to_index; }
134 
135  // void setSelection(int row, int column, int mask);
136  void implSort(int, bool) override {}
137 
138  bool nodeImported(int idx) const;
139  // geo stuff
140 
141  NodeInfo* getSelected();
142 
144  NodeInfo& refEntry(int i) { return m_entries[i]; }
145 
146  void loadGeometry(TGeoNode*, TObjArray*);
147 
148  void setBackgroundToWhite(bool);
149  void getNodePath(int, std::string&) const;
150 
151  int getLevelOffset() const { return m_levelOffset; }
152  void setLevelOffset(int x) { m_levelOffset = x; }
153 
154  void setDaughtersSelfVisibility(bool);
155 
156  void getNodeMatrix(const NodeInfo& nodeInfo, TGeoHMatrix& mat) const;
157 
158  virtual void setVisibility(NodeInfo&, bool);
159  virtual void setVisibilityChld(NodeInfo&, bool);
160  virtual void setDaughtersSelfVisibility(int selectedIdx, bool v);
161 
162  virtual bool getVisibilityChld(const NodeInfo& nodeInfo) const;
163  virtual bool getVisibility(const NodeInfo& nodeInfo) const;
164 
165  virtual void applyColorTranspToDaughters(int selectedIdx, bool recurse);
166 
167  bool isNodeRendered(int idx, int top_node_idx) const;
168 
169  static void getNNodesTotal(TGeoNode* geoNode, int& off);
170 
171  void showEditor(int);
172  void cancelEditor(bool);
173  void setCellValueEditor(TGTextEntry* editor);
175  // protected:
177  const FWGeometryTableManagerBase& operator=(const FWGeometryTableManagerBase&); // stop default
178 
179  bool firstColumnClicked(int row, int xPos);
180  // void changeSelection(int iRow, int iColumn);
181 
182  void redrawTable(bool setExpand = false);
183 
184  virtual void recalculateVisibility() = 0;
185 
186  bool cellDataIsSortable() const override { return false; }
187  // ---------- member data --------------------------------
188 
189  // table stuff
190  mutable TGGC* m_highlightContext;
193 
194  std::vector<int> m_row_to_index;
195 
197 
199 
200  TGTextEntry* m_editor;
202 };
203 
204 inline void FWGeometryTableManagerBase::getNNodesTotal(TGeoNode* geoNode, int& off) {
205  int nD = geoNode->GetNdaughters();
206  off += nD;
207  for (int i = 0; i < nD; ++i) {
208  getNNodesTotal(geoNode->GetDaughter(i), off);
209  }
210 }
211 
212 #endif
FWGeometryTableManagerBase::m_editor
TGTextEntry * m_editor
Definition: FWGeometryTableManagerBase.h:200
FWGeometryTableManagerBase::kExpanded
Definition: FWGeometryTableManagerBase.h:43
FWGeometryTableManagerBase::recalculateVisibility
virtual void recalculateVisibility()=0
FWGeometryTableManagerBase::cellDataIsSortable
bool cellDataIsSortable() const override
Definition: FWGeometryTableManagerBase.h:186
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
FWGeometryTableManagerBase::m_entries
Entries_v m_entries
Definition: FWGeometryTableManagerBase.h:196
FWTextTableCellRenderer.h
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
FWGeometryTableManagerBase::~FWGeometryTableManagerBase
~FWGeometryTableManagerBase() override
Definition: FWGeometryTableManagerBase.cc:104
FWGeometryTableManagerBase::ColorBoxRenderer::m_colorContext
TGGC * m_colorContext
Definition: FWGeometryTableManagerBase.h:108
FWGeometryTableViewBase.h
FWGeometryTableManagerBase::showEditor
void showEditor(int)
Definition: FWGeometryTableManagerBase.cc:215
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
FWGeometryTableManagerBase::ColorBoxRenderer::m_isSelected
bool m_isSelected
Definition: FWGeometryTableManagerBase.h:107
FWGeometryTableManagerBase::firstColumnClicked
bool firstColumnClicked(int row, int xPos)
Definition: FWGeometryTableManagerBase.cc:135
cuy.col
col
Definition: cuy.py:1010
FWGeometryTableManagerBase::NodeInfo::m_parent
Int_t m_parent
Definition: FWGeometryTableManagerBase.h:59
FWGeometryTableManagerBase::m_highlightContext
TGGC * m_highlightContext
Definition: FWGeometryTableManagerBase.h:190
FWGeometryTableManagerBase::Entries_v
std::vector< NodeInfo > Entries_v
Definition: FWGeometryTableManagerBase.h:87
FWTextTreeCellRenderer
Definition: FWTextTreeCellRenderer.h:17
FWGeometryTableManagerBase::cancelEditor
void cancelEditor(bool)
Definition: FWGeometryTableManagerBase.cc:244
FWGeometryTableManagerBase::ColorBoxRenderer::draw
void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight) override
Definition: FWGeometryTableManagerBase.cc:60
DDAxes::x
findQualityFiles.v
v
Definition: findQualityFiles.py:179
FWGeometryTableManagerBase::setLevelOffset
void setLevelOffset(int x)
Definition: FWGeometryTableManagerBase.h:152
FWGeometryTableManagerBase::NodeInfo::copyColorTransparency
void copyColorTransparency(const NodeInfo &x)
Definition: FWGeometryTableManagerBase.h:77
FWGeometryTableManagerBase::kHighlighted
Definition: FWGeometryTableManagerBase.h:48
FWGeometryTableManagerBase::rowToIndex
std::vector< int > rowToIndex()
Definition: FWGeometryTableManagerBase.h:133
FWGeometryTableManagerBase::NodeInfo::m_color
Color_t m_color
Definition: FWGeometryTableManagerBase.h:60
FWGeometryTableManagerBase::ColorBoxRenderer::m_color
Pixel_t m_color
Definition: FWGeometryTableManagerBase.h:106
FWGeometryTableManagerBase
Definition: FWGeometryTableManagerBase.h:36
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
FWGeometryTableManagerBase::loadGeometry
void loadGeometry(TGeoNode *, TObjArray *)
FWGeometryTableManagerBase::NodeInfo::switchBit
void switchBit(UChar_t f)
Definition: FWGeometryTableManagerBase.h:75
FWGeometryTableManagerBase::NodeInfo::NodeInfo
NodeInfo(TGeoNode *n, Int_t p, Color_t col, Char_t l, UChar_t f=kVisNodeSelf|kVisNodeChld)
Definition: FWGeometryTableManagerBase.h:55
FWGeometryTableManagerBase::ColorBoxRenderer::width
UInt_t width() const override
returns the minimum width of the cell to which the renderer is representing
Definition: FWGeometryTableManagerBase.h:99
FWGeometryTableManagerBase::ColorBoxRenderer
Definition: FWGeometryTableManagerBase.h:94
FWGeometryTableManagerBase::getNodePath
void getNodePath(int, std::string &) const
Definition: FWGeometryTableManagerBase.cc:192
FWGeometryTableManagerBase::getSelected
NodeInfo * getSelected()
FWGeometryTableManagerBase::nodeIsParent
virtual bool nodeIsParent(const NodeInfo &) const
Definition: FWGeometryTableManagerBase.h:112
FWGeometryTableManagerBase::NodeInfo::m_node
TGeoNode * m_node
Definition: FWGeometryTableManagerBase.h:58
FWGeometryTableManagerBase::getNNodesTotal
static void getNNodesTotal(TGeoNode *geoNode, int &off)
Definition: FWGeometryTableManagerBase.h:204
FWGeometryTableManagerBase::FWGeometryTableManagerBase
FWGeometryTableManagerBase()
Definition: FWGeometryTableManagerBase.cc:87
FWGeometryTableManagerBase::title
virtual const std::string title() const
Definition: FWGeometryTableManagerBase.cc:123
FWGeometryTableViewBase
Definition: FWGeometryTableViewBase.h:41
FWGeometryTableManagerBase::unsortedRowNumber
int unsortedRowNumber(int unsorted) const override
when passed the index to the sorted order of the rows it returns the original row number from the und...
Definition: FWGeometryTableManagerBase.cc:106
FWGeometryTableManagerBase::applyColorTranspToDaughters
virtual void applyColorTranspToDaughters(int selectedIdx, bool recurse)
Definition: FWGeometryTableManagerBase.cc:289
FWGeometryTableManagerBase::m_editTransparencyIdx
int m_editTransparencyIdx
Definition: FWGeometryTableManagerBase.h:201
FWGeometryTableManagerBase::cellName
virtual const char * cellName(const NodeInfo &) const
Definition: FWGeometryTableManagerBase.h:119
FWGeometryTableManagerBase::isNodeRendered
bool isNodeRendered(int idx, int top_node_idx) const
Definition: FWGeometryTableManagerBase.cc:310
FWGeometryTableManagerBase::ColorBoxRenderer::setData
void setData(Color_t c, bool)
Definition: FWGeometryTableManagerBase.cc:55
FWTableManagerBase
Definition: FWTableManagerBase.h:44
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FWGeometryTableManagerBase::ColorBoxRenderer::ColorBoxRenderer
ColorBoxRenderer()
Definition: FWGeometryTableManagerBase.cc:41
FWTextTreeCellRenderer.h
FWGeometryTableManagerBase::setVisibilityChld
virtual void setVisibilityChld(NodeInfo &, bool)
Definition: FWGeometryTableManagerBase.cc:260
FWGeometryTableManagerBase::m_levelOffset
int m_levelOffset
Definition: FWGeometryTableManagerBase.h:198
FWGeometryTableManagerBase::setBackgroundToWhite
void setBackgroundToWhite(bool)
Definition: FWGeometryTableManagerBase.cc:125
FWGeometryTableManagerBase::getNodeMatrix
void getNodeMatrix(const NodeInfo &nodeInfo, TGeoHMatrix &mat) const
Definition: FWGeometryTableManagerBase.cc:161
FWGeometryTableManagerBase::getVisibilityChld
virtual bool getVisibilityChld(const NodeInfo &nodeInfo) const
Definition: FWGeometryTableManagerBase.cc:285
FWGeometryTableManagerBase::operator=
const FWGeometryTableManagerBase & operator=(const FWGeometryTableManagerBase &)
FWGeometryTableManagerBase::kVisNodeSelf
Definition: FWGeometryTableManagerBase.h:45
FWGeometryTableManagerBase::implSort
void implSort(int, bool) override
Called by 'sort' method to actually handle the sorting of the rows. Arguments are the same as 'sort'.
Definition: FWGeometryTableManagerBase.h:136
FWGeometryTableManagerBase::setDaughtersSelfVisibility
void setDaughtersSelfVisibility(bool)
FWGeometryTableManagerBase::Bits
Bits
Definition: FWGeometryTableManagerBase.h:42
FWGeometryTableManagerBase::nodeImported
bool nodeImported(int idx) const
FWGeometryTableManagerBase::NodeInfo::name
const char * name() const
Definition: FWGeometryTableManagerBase.cc:39
FWTableCellRendererBase
Definition: FWTableCellRendererBase.h:44
FWGeometryTableManagerBase::ColorBoxRenderer::height
UInt_t height() const override
returns the minimum height of the cell to which the renderer is representing
Definition: FWGeometryTableManagerBase.h:100
FWGeometryTableManagerBase::NodeInfo::m_level
UChar_t m_level
Definition: FWGeometryTableManagerBase.h:61
FWGeometryTableManagerBase::NodeInfo::resetBit
void resetBit(UChar_t f)
Definition: FWGeometryTableManagerBase.h:69
FWGeometryTableManagerBase::applyTransparencyFromEditor
void applyTransparencyFromEditor()
Definition: FWGeometryTableManagerBase.cc:224
FWGeometryTableManagerBase::m_highlightIdx
int m_highlightIdx
Definition: FWGeometryTableManagerBase.h:90
FWGeometryTableManagerBase::NodeInfo::testBitAny
bool testBitAny(UChar_t f) const
Definition: FWGeometryTableManagerBase.h:73
FWGeometryTableManagerBase::refEntries
Entries_v & refEntries()
Definition: FWGeometryTableManagerBase.h:143
FWGeometryTableManagerBase::kSelected
Definition: FWGeometryTableManagerBase.h:49
FWGeometryTableManagerBase::getLevelOffset
int getLevelOffset() const
Definition: FWGeometryTableManagerBase.h:151
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
FWGeometryTableManagerBase::NodeInfo
Definition: FWGeometryTableManagerBase.h:52
FWGeometryTableManagerBase::setCellValueEditor
void setCellValueEditor(TGTextEntry *editor)
Definition: FWGeometryTableManagerBase.cc:210
FWGeometryTableManagerBase::setVisibility
virtual void setVisibility(NodeInfo &, bool)
Definition: FWGeometryTableManagerBase.cc:256
FWGeometryTableManagerBase::ColorBoxRenderer::~ColorBoxRenderer
~ColorBoxRenderer() override
Definition: FWGeometryTableManagerBase.cc:51
FWGeometryTableManagerBase::redrawTable
void redrawTable(bool setExpand=false)
Definition: FWGeometryTableManagerBase.cc:177
FWGeometryTableManagerBase::NodeInfo::setBitVal
void setBitVal(UChar_t f, bool x)
Definition: FWGeometryTableManagerBase.h:70
FWGeometryTableManagerBase::numberOfRows
int numberOfRows() const override
Number of rows in the table.
Definition: FWGeometryTableManagerBase.cc:108
FWGeometryTableManagerBase::refEntry
NodeInfo & refEntry(int i)
Definition: FWGeometryTableManagerBase.h:144
FWGeometryTableManagerBase::NodeInfo::testBit
bool testBit(UChar_t f) const
Definition: FWGeometryTableManagerBase.h:72
FWGeometryTableManagerBase::m_row_to_index
std::vector< int > m_row_to_index
Definition: FWGeometryTableManagerBase.h:194
FWTableCellRendererBase.h
FWGeometryTableManagerBase::Entries_i
Entries_v::iterator Entries_i
Definition: FWGeometryTableManagerBase.h:88
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
FWGeometryTableManagerBase::m_renderer
FWTextTreeCellRenderer m_renderer
Definition: FWGeometryTableManagerBase.h:191
FWGeometryTableManagerBase::kVisNodeChld
Definition: FWGeometryTableManagerBase.h:46
FWGeometryTableManagerBase::getTitles
std::vector< std::string > getTitles() const override
returns the title names for each column
Definition: FWGeometryTableManagerBase.cc:110
FWGeometryTableManagerBase::ColorBoxRenderer::m_height
UInt_t m_height
Definition: FWGeometryTableManagerBase.h:105
FWGeometryTableManagerBase::m_colorBoxRenderer
ColorBoxRenderer m_colorBoxRenderer
Definition: FWGeometryTableManagerBase.h:192
FWGeometryTableManagerBase::ColorBoxRenderer::m_width
UInt_t m_width
Definition: FWGeometryTableManagerBase.h:104
FWGeometryTableManagerBase::NodeInfo::NodeInfo
NodeInfo()
Definition: FWGeometryTableManagerBase.h:53
FWGeometryTableManagerBase::getVisibility
virtual bool getVisibility(const NodeInfo &nodeInfo) const
Definition: FWGeometryTableManagerBase.cc:281
FWGeometryTableManagerBase::NodeInfo::setBit
void setBit(UChar_t f)
Definition: FWGeometryTableManagerBase.h:68
FWTableManagerBase.h
FWGeometryTableManagerBase::NodeInfo::m_transparency
UChar_t m_transparency
Definition: FWGeometryTableManagerBase.h:63
FWGeometryTableManagerBase::NodeInfo::m_flags
UChar_t m_flags
Definition: FWGeometryTableManagerBase.h:62