CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
37 {
39 
40 public:
41  // enum ESelectionState { kNone, kSelected, kHighlighted, kFiltered };
42 
43  enum Bits
44  {
45  kExpanded = BIT(0),
46 
47  kVisNodeSelf = BIT(1),
48  kVisNodeChld = BIT(2),
49 
50  kHighlighted = BIT(3),
51  kSelected = BIT(4)
52  };
53 
54  struct NodeInfo
55  {
56  NodeInfo():m_node(0), m_parent(-1), m_color(0), m_level(-1),
58 
59  NodeInfo(TGeoNode* n, Int_t p, Color_t col, Char_t l, UChar_t f = kVisNodeSelf|kVisNodeChld ):m_node(n), m_parent(p), m_color(col), m_level(l),
60  m_flags(f) {}
61 
62  TGeoNode* m_node;
63  Int_t m_parent;
64  Color_t m_color;
65  UChar_t m_level;
66  UChar_t m_flags;
67  UChar_t m_transparency;
68 
69 
70  const char* name() const;
71  // const char* nameIndent() const;
72 
73  void setBit(UChar_t f) { m_flags |= f;}
74  void resetBit(UChar_t f) { m_flags &= ~f; }
75  void setBitVal(UChar_t f, bool x) { x ? setBit(f) : resetBit(f);}
76 
77  bool testBit(UChar_t f) const { return (m_flags & f) == f; }
78  bool testBitAny(UChar_t f) const { return (m_flags & f) != 0; }
79 
80  void switchBit(UChar_t f) { testBit(f) ? resetBit(f) : setBit(f); }
81 
83  };
84 
85 
86  typedef std::vector<NodeInfo> Entries_v;
87  typedef Entries_v::iterator Entries_i;
88 
90 
91  //private:
92  // AMT: this could be a common base class with FWCollectionSummaryModelCellRenderer ..
94  {
95  public:
97  virtual ~ColorBoxRenderer();
98 
99  virtual UInt_t width() const { return m_width; }
100  virtual UInt_t height() const { return m_height; }
101  void setData(Color_t c, bool);
102  virtual void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight);
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  virtual ~FWGeometryTableManagerBase();
118  // virtual std::string& cellName(const NodeInfo& ) const { return &std::string("ddd");}
119  virtual const char* cellName(const NodeInfo& ) const { return 0;}
120 
121  // virtual functions of FWTableManagerBase
122 
123  virtual int unsortedRowNumber(int unsorted) const;
124  virtual int numberOfRows() const;
125  virtual std::vector<std::string> getTitles() const;
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  virtual void implSort(int, bool) {}
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 
159  virtual void setVisibility(NodeInfo&, bool );
160  virtual void setVisibilityChld(NodeInfo&, bool);
161  virtual void setDaughtersSelfVisibility(int selectedIdx, bool v);
162 
163  virtual bool getVisibilityChld(const NodeInfo& nodeInfo) const;
164  virtual bool getVisibility (const NodeInfo& nodeInfo) const;
165 
166  virtual void applyColorTranspToDaughters(int selectedIdx, bool recurse);
167 
168  bool isNodeRendered(int idx, int top_node_idx) const;
169 
170  static void getNNodesTotal(TGeoNode* geoNode, int& off);
171 
172  void showEditor(int);
173  void cancelEditor(bool);
174  void setCellValueEditor(TGTextEntry *editor);
176  // protected:
178  const FWGeometryTableManagerBase& operator=(const FWGeometryTableManagerBase&); // stop default
179 
180 
181  bool firstColumnClicked(int row, int xPos);
182  // void changeSelection(int iRow, int iColumn);
183 
184  void redrawTable(bool setExpand = false);
185 
186  virtual void recalculateVisibility() = 0;
187 
188 
189  virtual bool cellDataIsSortable() const { return false ; }
190  // ---------- member data --------------------------------
191 
192 
193  // table stuff
194  mutable TGGC* m_highlightContext;
197 
198  std::vector<int> m_row_to_index;
199 
201 
203 
204  TGTextEntry* m_editor;
206 };
207 
208 
209 
210 inline void FWGeometryTableManagerBase::getNNodesTotal(TGeoNode* geoNode, int& off)
211 {
212  int nD = geoNode->GetNdaughters();
213  off += nD;
214  for (int i = 0; i < nD; ++i )
215  {
216  getNNodesTotal(geoNode->GetDaughter(i), off);
217  }
218 }
219 
220 #endif
int i
Definition: DBlmapReader.cc:9
bool isNodeRendered(int idx, int top_node_idx) const
virtual std::vector< std::string > getTitles() const
returns the title names for each column
virtual void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight)
bool firstColumnClicked(int row, int xPos)
virtual bool nodeIsParent(const NodeInfo &) const
virtual bool getVisibility(const NodeInfo &nodeInfo) const
virtual const char * cellName(const NodeInfo &) const
virtual void recalculateVisibility()=0
virtual bool getVisibilityChld(const NodeInfo &nodeInfo) const
void getNodePath(int, std::string &) const
void getNodeMatrix(const NodeInfo &nodeInfo, TGeoHMatrix &mat) const
virtual void applyColorTranspToDaughters(int selectedIdx, bool recurse)
virtual void setVisibilityChld(NodeInfo &, bool)
double xPos
bool nodeImported(int idx) const
virtual void implSort(int, bool)
Called by &#39;sort&#39; method to actually handle the sorting of the rows. Arguments are the same as &#39;sort&#39;...
const FWGeometryTableManagerBase & operator=(const FWGeometryTableManagerBase &)
virtual const std::string title() const
double f[11][100]
void loadGeometry(TGeoNode *, TObjArray *)
void setDaughtersSelfVisibility(bool)
virtual void setVisibility(NodeInfo &, bool)
static void getNNodesTotal(TGeoNode *geoNode, int &off)
virtual int unsortedRowNumber(int unsorted) const
when passed the index to the sorted order of the rows it returns the original row number from the und...
NodeInfo(TGeoNode *n, Int_t p, Color_t col, Char_t l, UChar_t f=kVisNodeSelf|kVisNodeChld)
tuple editor
Definition: idDealer.py:73
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
void setCellValueEditor(TGTextEntry *editor)
virtual UInt_t height() const
returns the minimum height of the cell to which the renderer is representing
virtual UInt_t width() const
returns the minimum width of the cell to which the renderer is representing
volatile std::atomic< bool > shutdown_flag false
Definition: DDAxes.h:10
virtual bool cellDataIsSortable() const
int col
Definition: cuy.py:1008
void redrawTable(bool setExpand=false)
virtual int numberOfRows() const
Number of rows in the table.